This commit is contained in:
2022-11-26 19:21:18 +08:00
parent 1c3c153ed9
commit a2f3c1f09d
4 changed files with 62 additions and 27 deletions

View File

@@ -3,6 +3,7 @@ package org.nl.wms.pda.st.service.impl;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
@@ -58,6 +59,10 @@ public class PrintServiceImpl implements PrintService {
//组织木箱打印信息 //组织木箱打印信息
//箱号 //箱号
String package_box_sn = box_jo.getString("package_box_sn"); String package_box_sn = box_jo.getString("package_box_sn");
// 木箱1
String package_box_sn1 = package_box_sn.substring(0,package_box_sn.indexOf("@")+1);
// 木箱2
String package_box_sn2 = package_box_sn.substring(package_box_sn.indexOf("@") + 1, package_box_sn.length());
//订单号 //订单号
String sale_order_name = box_jo.getString("sale_order_name"); String sale_order_name = box_jo.getString("sale_order_name");
//品名 //品名
@@ -72,7 +77,7 @@ public class PrintServiceImpl implements PrintService {
//入库日期 //入库日期
String date_of_FG_inbound = box_jo.getString("date_of_fg_inbound"); String date_of_FG_inbound = box_jo.getString("date_of_fg_inbound");
//毛重 //毛重
String box_weight = box_jo.getString("box_weight"); String box_weight = NumberUtil.round(box_jo.getString("box_weight"),2).toString();
//生产日期 //生产日期
String date_of_production = box_jo.getString("date_of_production"); String date_of_production = box_jo.getString("date_of_production");
//卷数 //卷数
@@ -103,9 +108,10 @@ public class PrintServiceImpl implements PrintService {
} }
fw = new FileWriter(filePath); fw = new FileWriter(filePath);
BufferedWriter bw = new BufferedWriter(fw); BufferedWriter bw = new BufferedWriter(fw);
bw.write("package_box_sn,sale_order_name,product_description,product_name,width,pcsn,date_of_FG_inbound,box_weight,date_of_production,quanlity_in_box,quality_guaran_period,nspector,storage_conditions,weight\n"); bw.write("package_box_sn1,package_box_sn2,sale_order_name,product_description,product_name,width,pcsn,date_of_FG_inbound,box_weight,date_of_production,quanlity_in_box,quality_guaran_period,nspector,storage_conditions,weight\n");
bw.write(package_box_sn + "," bw.write(package_box_sn1 + ","
+ package_box_sn2 + ","
+ sale_order_name + "," + sale_order_name + ","
+ product_description + "," + product_description + ","
+ product_name + "," + product_name + ","
@@ -118,7 +124,7 @@ public class PrintServiceImpl implements PrintService {
+ quality_guaran_period + "," + quality_guaran_period + ","
+ nspector + "," + nspector + ","
+ storage_conditions + "," + storage_conditions + ","
+ weight + ",\n" + NumberUtil.round(weight,2).toString() + ",\n"
); );
bw.close(); bw.close();

View File

@@ -2132,6 +2132,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
WQLObject custTab = WQLObject.getWQLObject("MD_CS_CustomerBase"); // 客户基本信息表 WQLObject custTab = WQLObject.getWQLObject("MD_CS_CustomerBase"); // 客户基本信息表
WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_IOStorInv"); // 出入库主表 WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_IOStorInv"); // 出入库主表
WQLObject dtlTab = WQLObject.getWQLObject("ST_IVT_IOStorInv"); // 出入库明细表
WQLObject disTab = WQLObject.getWQLObject("ST_IVT_IOStorInv"); // 出入库分配明细
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation"); // 子卷包装关系表 WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation"); // 子卷包装关系表
JSONObject jsonMst = mstTab.query("iostorinv_id = '" + MapUtil.getStr(whereJson, "iostorinv_id") + "'").uniqueResult(0); JSONObject jsonMst = mstTab.query("iostorinv_id = '" + MapUtil.getStr(whereJson, "iostorinv_id") + "'").uniqueResult(0);
@@ -2151,21 +2153,35 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
// WriteSheet sheet = EasyExcel.writerSheet().build(); // WriteSheet sheet = EasyExcel.writerSheet().build();
// 5.单组填充 // 5.单组填充
HashMap<String, Object> oneMap = new HashMap<>(); HashMap<String, Object> oneMap = new HashMap<>();
oneMap.put("bill_code", jsonMst.getString("bill_code")); // 出库单号
oneMap.put("create_date", DateUtil.today()); // 出库日期 // 送货单号
oneMap.put("consignee", jsonMst.getString("consignee")); // 客户 JSONObject jsonDtl = dtlTab.query("iostorinv_id = '" + jsonMst.getString("iostorinv_id") + "'").uniqueResult(0);
oneMap.put("receiptaddress", jsonMst.getString("receiptaddress")); // 客户地址 if (ObjectUtil.isNotEmpty(jsonDtl)) oneMap.put("vbeln",jsonDtl.getString("vbeln"));
oneMap.put("trans_code", jsonMst.getString("trans_code")); // 承运公司 // 页码
oneMap.put("receiptaddress2", jsonMst.getString("receiptaddress")); // 收货地址 String pageNow = String.valueOf(j + 1);
oneMap.put("receiptphone", jsonMst.getString("receiver") +"/"+jsonMst.getString("receiptphone")); // 客户电话 oneMap.put("page",pageNow+ "/" + MapUtil.getStr(whereJson,"pageNum"));
oneMap.put("deliveryphone", jsonMst.getString("deliveryname") +"/"+jsonMst.getString("deliveryphone") ); // 承运人电话 oneMap.put("consignee", jsonMst.getString("consignee")); // 收货单位
oneMap.put("receiver", jsonMst.getString("receiver")); // 收货人
oneMap.put("receiptaddress", jsonMst.getString("receiptaddress")); // 收货地址
oneMap.put("receiptphone", jsonMst.getString("receiptphone")); // 收货人联系电话
oneMap.put("logisticscompany", jsonMst.getString("logisticscompany")); // 物流公司
oneMap.put("drivername", jsonMst.getString("drivername")); // 司机
oneMap.put("carno", jsonMst.getString("carno")); // 车牌号
oneMap.put("driverphone", jsonMst.getString("driverphone")); // 司机联系电话
// 总箱数 // 总箱数
/* JSONArray jsonAllBox = WQL.getWO("ST_OUTIVT02").addParam("flag", "4").addParam("iostorinv_id", MapUtil.getStr(whereJson, "iostorinv_id")).process().getResultJSONArray(0); JSONArray jsonAllBox = WQL.getWO("ST_OUTIVT02").addParam("flag", "4").addParam("iostorinv_id", MapUtil.getStr(whereJson, "iostorinv_id")).process().getResultJSONArray(0);
oneMap.put("all_box", jsonAllBox.size()); oneMap.put("all_box", jsonAllBox.size());
oneMap.put("all_qty", ""); // 总毛重
oneMap.put("deliveryaddress", jsonMst.getString("deliveryaddress")); double all_box_qty = 0;
oneMap.put("deliveryname", jsonMst.getString("deliveryname")); for (int t = 0; t < jsonAllBox.size(); t++) {
oneMap.put("deliveryphone", jsonMst.getString("deliveryphone"));*/ JSONObject json = jsonAllBox.getJSONObject(t);
NumberUtil.add(all_box_qty,json.getDoubleValue("box_qty"));
}
oneMap.put("all_box_qty", NumberUtil.round(all_box_qty,2).toString());
oneMap.put("deliveryaddress", jsonMst.getString("deliveryaddress")); // 送货方地址
oneMap.put("deliveryname", jsonMst.getString("deliveryname")); // 送货方联系人
oneMap.put("deliveryphone", jsonMst.getString("deliveryphone")); // 送货方联系电话
// 6.多组填充 // 6.多组填充
JSONArray dtlArr = WQL.getWO("ST_OUTIVT02").addParam("flag", "3").addParam("iostorinv_id", MapUtil.getStr(whereJson, "iostorinv_id")).process().getResultJSONArray(0); JSONArray dtlArr = WQL.getWO("ST_OUTIVT02").addParam("flag", "3").addParam("iostorinv_id", MapUtil.getStr(whereJson, "iostorinv_id")).process().getResultJSONArray(0);
@@ -2173,12 +2189,14 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
if (shd_dtl_num > dtlArr.size()) { if (shd_dtl_num > dtlArr.size()) {
double all_qty = 0; double all_qty = 0;
String order_no = "";
ArrayList<HashMap<String, Object>> flData = new ArrayList<>(); ArrayList<HashMap<String, Object>> flData = new ArrayList<>();
WriteSheet sheet = EasyExcel.writerSheet().build(); WriteSheet sheet = EasyExcel.writerSheet().build();
for (int i = 0; i < dtlArr.size(); i++) { for (int i = 0; i < dtlArr.size(); i++) {
JSONObject json = dtlArr.getJSONObject(i); JSONObject json = dtlArr.getJSONObject(i);
JSONObject jsonSub = subTab.query("package_box_sn = '" + json.getString("box_no") + "'").uniqueResult(0); JSONObject jsonSub = subTab.query("package_box_sn = '" + json.getString("box_no") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonSub)) throw new BadRequestException("没有查询到子卷包装"); if (ObjectUtil.isEmpty(jsonSub)) throw new BadRequestException("没有查询到子卷包装");
order_no = jsonSub.getString("sale_order_name");
// 规格: 厚度*幅宽 // 规格: 厚度*幅宽
String material_spec = jsonSub.getString("thickness") + "*" + jsonSub.getString("width"); String material_spec = jsonSub.getString("thickness") + "*" + jsonSub.getString("width");
@@ -2191,17 +2209,21 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
HashMap<String, Object> mapFL = new HashMap<>(); HashMap<String, Object> mapFL = new HashMap<>();
// 明细 // 明细
String date_of_production = jsonSub.getString("date_of_production").replaceAll("[[\\s-:punct:]]", ""); // String date_of_production = jsonSub.getString("date_of_production").replaceAll("[[\\s-:punct:]]", "");
mapFL.put("date_of_production", date_of_production); // 批号 : 子卷包装生产日期 // mapFL.put("date_of_production", date_of_production); // 批号 : 子卷包装生产日期
mapFL.put("material_name", json.getString("material_name")); mapFL.put("material_name", json.getString("material_name"));
mapFL.put("material_spec", material_spec); mapFL.put("material_spec", material_spec);
mapFL.put("qty_unit_name", "KG"); // mapFL.put("qty_unit_name", "KG");
mapFL.put("box_no", sub_box_no); mapFL.put("box_no", sub_box_no);
mapFL.put("qty", NumberUtil.round(json.getString("qty"), 2).doubleValue()); mapFL.put("qty", NumberUtil.round(json.getString("qty"), 2).doubleValue());
flData.add(mapFL); flData.add(mapFL);
all_qty = NumberUtil.add(String.valueOf(all_qty), json.getString("qty")).doubleValue(); all_qty = NumberUtil.add(String.valueOf(all_qty), json.getString("qty")).doubleValue();
} }
oneMap.put("all_qty",all_qty); // 订单号
if (ObjectUtil.isNotEmpty(order_no)) {
oneMap.put("order_no",order_no.substring(0,order_no.indexOf("-")));
}
oneMap.put("all_qty",all_qty); // 合计
workBook.fill(oneMap, sheet); workBook.fill(oneMap, sheet);
workBook.fill(new FillWrapper("data", flData), sheet); workBook.fill(new FillWrapper("data", flData), sheet);
workBook.finish(); workBook.finish();
@@ -2211,6 +2233,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
Integer integer = Integer.valueOf(String.valueOf(NumberUtil.round(ceil, 0))); Integer integer = Integer.valueOf(String.valueOf(NumberUtil.round(ceil, 0)));
double all_qty = 0; double all_qty = 0;
String order_no = "";
ArrayList<HashMap<String, Object>> flData = new ArrayList<>(); ArrayList<HashMap<String, Object>> flData = new ArrayList<>();
for (int i = j * shd_dtl_num; i < (j + 1) * shd_dtl_num; i++) { for (int i = j * shd_dtl_num; i < (j + 1) * shd_dtl_num; i++) {
if (i == dtlArr.size()) { if (i == dtlArr.size()) {
@@ -2220,6 +2243,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
JSONObject json = dtlArr.getJSONObject(i); JSONObject json = dtlArr.getJSONObject(i);
JSONObject jsonSub = subTab.query("package_box_sn = '" + json.getString("box_no") + "'").uniqueResult(0); JSONObject jsonSub = subTab.query("package_box_sn = '" + json.getString("box_no") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonSub)) throw new BadRequestException("没有查询到子卷包装"); if (ObjectUtil.isEmpty(jsonSub)) throw new BadRequestException("没有查询到子卷包装");
order_no = jsonSub.getString("sale_order_name");
// 规格: 厚度*幅宽 // 规格: 厚度*幅宽
String material_spec = jsonSub.getString("thickness") + "*" + jsonSub.getString("width"); String material_spec = jsonSub.getString("thickness") + "*" + jsonSub.getString("width");
@@ -2232,11 +2256,11 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
HashMap<String, Object> mapFL = new HashMap<>(); HashMap<String, Object> mapFL = new HashMap<>();
// 明细 // 明细
String date_of_production = jsonSub.getString("date_of_production").replaceAll("[[\\s-:punct:]]", ""); // String date_of_production = jsonSub.getString("date_of_production").replaceAll("[[\\s-:punct:]]", "");
mapFL.put("date_of_production", date_of_production); // 批号 : 子卷包装生产日期 // mapFL.put("date_of_production", date_of_production); // 批号 : 子卷包装生产日期
mapFL.put("material_name", json.getString("material_name")); mapFL.put("material_name", json.getString("material_name"));
mapFL.put("material_spec", material_spec); mapFL.put("material_spec", material_spec);
mapFL.put("qty_unit_name", "KG"); // mapFL.put("qty_unit_name", "KG");
mapFL.put("box_no", sub_box_no); mapFL.put("box_no", sub_box_no);
mapFL.put("qty", NumberUtil.round(json.getString("qty"), 2).doubleValue()); mapFL.put("qty", NumberUtil.round(json.getString("qty"), 2).doubleValue());
flData.add(mapFL); flData.add(mapFL);
@@ -2245,7 +2269,11 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
all_qty = NumberUtil.add(String.valueOf(all_qty), json.getString("qty")).doubleValue(); all_qty = NumberUtil.add(String.valueOf(all_qty), json.getString("qty")).doubleValue();
} }
oneMap.put("all_qty",all_qty); // 订单号
if (ObjectUtil.isNotEmpty(order_no)) {
oneMap.put("order_no",order_no.substring(0,order_no.indexOf("-")));
}
oneMap.put("all_qty",all_qty); // 合计
WriteSheet sheet = EasyExcel.writerSheet(0).build(); WriteSheet sheet = EasyExcel.writerSheet(0).build();
workBook.fill(oneMap, sheet); workBook.fill(oneMap, sheet);
workBook.fill(new FillWrapper("data", flData), sheet); workBook.fill(new FillWrapper("data", flData), sheet);

View File

@@ -106,7 +106,8 @@
IF 输入.flag = "4" IF 输入.flag = "4"
QUERY QUERY
SELECT SELECT
count(*) AS num count(*) AS num,
sum(dis.real_qty) AS box_qty
FROM FROM
ST_IVT_IOStorInvDis dis ST_IVT_IOStorInvDis dis
WHERE WHERE

View File

@@ -553,7 +553,7 @@ export default {
checkoutbill.getDisNum({ 'iostorinv_id': jo.iostorinv_id }).then(res => { checkoutbill.getDisNum({ 'iostorinv_id': jo.iostorinv_id }).then(res => {
const j = Math.ceil(res.num / jo.shd_dtl_num) const j = Math.ceil(res.num / jo.shd_dtl_num)
for (let i = 0; i < j; i++) { for (let i = 0; i < j; i++) {
download('/api/checkoutbill/downloadExcel', { 'iostorinv_id': jo.iostorinv_id, 'j': i }).then(result => { download('/api/checkoutbill/downloadExcel', { 'iostorinv_id': jo.iostorinv_id, 'j': i, 'pageNum': j }).then(result => {
downloadFile(result, '发货单', 'xlsx') downloadFile(result, '发货单', 'xlsx')
crud.downloadLoading = false crud.downloadLoading = false
}).catch(() => { }).catch(() => {