代码更新

This commit is contained in:
2023-02-19 17:31:34 +08:00
parent 47df45110b
commit dd547b846f
6 changed files with 117 additions and 57 deletions

View File

@@ -177,7 +177,7 @@
dtl.bill_status IN ('30','40')
ENDOPTION
ORDER BY
dtl.box_no
dtl.box_no,dtl.pcsn
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -23,6 +23,7 @@ import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.modules.wql.util.WqlUtil;
import org.nl.system.service.param.impl.SysParamServiceImpl;
import org.nl.wms.basedata.st.service.impl.UserStorServiceImpl;
import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl;
import org.nl.wms.ext.sap.service.impl.LmsToSapServiceImpl;
@@ -4625,77 +4626,127 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
WQLObject disTab = WQLObject.getWQLObject("st_ivt_iostorinvdis"); // 出入库分配明细
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation"); // 子卷包装关系表
WQLObject tranTab = WQLObject.getWQLObject("MD_CS_TransportationBase"); // 物流公司表
WQLObject storTab = WQLObject.getWQLObject("st_ivt_bsrealstorattr"); // 实物仓库表
JSONObject jsonMst = mstTab.query("iostorinv_id = '" + MapUtil.getStr(whereJson, "iostorinv_id") + "'").uniqueResult(0);
String cust_code = jsonMst.getString("cust_code");
JSONObject jsonCust = custTab.query("cust_code = '" + cust_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonCust)) throw new BadRequestException("客户不存在");
String bill_type = jsonMst.getString("bill_type");
int j = Integer.parseInt((String) whereJson.get("j"));
//1.根据出入库主表中 收货单位 查询客户表中的模板路径
String code_template = jsonCust.getString("shd_print_no");
HashMap<String, Object> oneMap = new HashMap<>();
// 2.获取输出流
ServletOutputStream outputStream = response.getOutputStream();
// 3.创建模板工作簿
ExcelWriter workBook = EasyExcel.write(outputStream, null).withTemplate(code_template).build();
// 4.获取第一个sheet
// WriteSheet sheet = EasyExcel.writerSheet().build();
// 5.单组填充
HashMap<String, Object> oneMap = new HashMap<>();
String code_template = "";
int shd_dtl_num = 0; // 送货单明细数
JSONObject jsonDtl = dtlTab.query("iostorinv_id = '" + jsonMst.getString("iostorinv_id") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonDtl)) {
// 送货单号
oneMap.put("vbeln", jsonDtl.getString("vbeln"));
// 订单号
String source_bill_code = jsonDtl.getString("source_bill_code");
if (ObjectUtil.isNotEmpty(source_bill_code)) {
try {
oneMap.put("order_no", source_bill_code.substring(0, source_bill_code.indexOf("-")));
} catch (Exception e) {
oneMap.put("order_no", source_bill_code);
// 调拨发货单
if (StrUtil.equals(bill_type, "1004")) {
shd_dtl_num = 44;
//1.获取系统参数模板地址
code_template = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("allot_order").getValue();
// 5.单组填充
JSONObject jsonDtl = dtlTab.query("iostorinv_id = '" + jsonMst.getString("iostorinv_id") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonDtl)) {
// 调拨单号
oneMap.put("vbeln", jsonMst.getString("bill_code"));
// 调出仓库
oneMap.put("out_stor", jsonMst.getString("stor_code"));
// 调入仓库
JSONObject jsonStor = storTab.query("stor_id = '" + jsonMst.getString("out_stor_id") + "'").uniqueResult(0);
oneMap.put("in_stor", jsonStor.getString("stor_code"));
}
String pageNow = String.valueOf(j + 1); // 页码
oneMap.put("page", pageNow + "/" + MapUtil.getStr(whereJson, "pageNum"));
oneMap.put("consignee", jsonMst.getString("consignee")); // 收货单位
oneMap.put("receiver", jsonMst.getString("receiver")); // 收货人
String receiptaddress = jsonMst.getString("receiptaddress");
oneMap.put("receiptaddress", receiptaddress); // 收货地址
oneMap.put("receiptphone", jsonMst.getString("receiptphone")); // 收货人联系电话
// 物流公司
JSONObject jsonTran = tranTab.query("cust_code = '" + jsonMst.getString("trans_code") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonTran)) {
oneMap.put("logisticscompany", jsonTran.getString("cust_name"));
}
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);
oneMap.put("all_box", jsonAllBox.size());
// 总毛重
double all_box_qty = 0;
for (int t = 0; t < jsonAllBox.size(); t++) {
JSONObject json = jsonAllBox.getJSONObject(t);
all_box_qty = 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")); // 送货方联系电话
} else {
if (ObjectUtil.isEmpty(jsonCust)) throw new BadRequestException("客户不存在");
shd_dtl_num = jsonCust.getIntValue("shd_dtl_num");
//1.根据出入库主表中 收货单位 查询客户表中的模板路径
code_template = jsonCust.getString("shd_print_no");
JSONObject jsonDtl = dtlTab.query("iostorinv_id = '" + jsonMst.getString("iostorinv_id") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonDtl)) {
// 送货单号
oneMap.put("vbeln", jsonDtl.getString("vbeln"));
// 订单号
String source_bill_code = jsonDtl.getString("source_bill_code");
if (ObjectUtil.isNotEmpty(source_bill_code)) {
try {
oneMap.put("order_no", source_bill_code.substring(0, source_bill_code.indexOf("-")));
} catch (Exception e) {
oneMap.put("order_no", source_bill_code);
}
}
}
}
String pageNow = String.valueOf(j + 1); // 页码
oneMap.put("page", pageNow + "/" + MapUtil.getStr(whereJson, "pageNum"));
oneMap.put("consignee", jsonMst.getString("consignee")); // 收货单位
oneMap.put("receiver", jsonMst.getString("receiver")); // 收货人
String receiptaddress = jsonMst.getString("receiptaddress");
String pageNow = String.valueOf(j + 1); // 页码
oneMap.put("page", pageNow + "/" + MapUtil.getStr(whereJson, "pageNum"));
oneMap.put("consignee", jsonMst.getString("consignee")); // 收货单位
oneMap.put("receiver", jsonMst.getString("receiver")); // 收货
String receiptaddress = jsonMst.getString("receiptaddress");
/* StrBuilder strBuilder = new StrBuilder(receiptaddress);
if (receiptaddress.length() > 10) {
strBuilder.insert(11,"\n");
}*/
oneMap.put("receiptaddress", receiptaddress); // 收货地址
oneMap.put("receiptphone", jsonMst.getString("receiptphone")); // 收货人联系电话
// 物流公司
JSONObject jsonTran = tranTab.query("cust_code = '" + jsonMst.getString("trans_code") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonTran)) {
oneMap.put("logisticscompany", jsonTran.getString("cust_name"));
oneMap.put("receiptaddress", receiptaddress); // 收货地址
oneMap.put("receiptphone", jsonMst.getString("receiptphone")); // 收货人联系电话
// 物流公司
JSONObject jsonTran = tranTab.query("cust_code = '" + jsonMst.getString("trans_code") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonTran)) {
oneMap.put("logisticscompany", jsonTran.getString("cust_name"));
}
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);
oneMap.put("all_box", jsonAllBox.size());
// 总毛重
double all_box_qty = 0;
for (int t = 0; t < jsonAllBox.size(); t++) {
JSONObject json = jsonAllBox.getJSONObject(t);
all_box_qty = 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")); // 送货方联系电话
}
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);
oneMap.put("all_box", jsonAllBox.size());
// 总毛重
double all_box_qty = 0;
for (int t = 0; t < jsonAllBox.size(); t++) {
JSONObject json = jsonAllBox.getJSONObject(t);
all_box_qty = 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.多组填充
JSONArray dtlArr = WQL.getWO("ST_OUTIVT02").addParam("flag", "3").addParam("iostorinv_id", MapUtil.getStr(whereJson, "iostorinv_id")).process().getResultJSONArray(0);
int shd_dtl_num = jsonCust.getIntValue("shd_dtl_num"); // 送货单明细数
if (shd_dtl_num > dtlArr.size()) {
double all_qty = 0;
@@ -4738,6 +4789,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
/* if (ObjectUtil.isNotEmpty(order_no)) {
oneMap.put("order_no",order_no.substring(0,order_no.indexOf("-")));
}*/
ExcelWriter workBook = EasyExcel.write(outputStream, null).withTemplate(code_template).build();
oneMap.put("all_qty", all_qty); // 合计
workBook.fill(oneMap, sheet);
workBook.fill(new FillWrapper("data", flData), sheet);
@@ -4789,9 +4842,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
}
// 订单号
/* if (ObjectUtil.isNotEmpty(order_no)) {
oneMap.put("order_no",order_no.substring(0,order_no.indexOf("-")));
}*/
ExcelWriter workBook = EasyExcel.write(outputStream, null).withTemplate(code_template).build();
oneMap.put("all_qty", all_qty); // 合计
WriteSheet sheet = EasyExcel.writerSheet(0).build();
workBook.fill(oneMap, sheet);

View File

@@ -183,7 +183,7 @@
OPTION 输入.unassign_flag <> ""
iosdtl.unassign_qty >0
ENDOPTION
order by iosdtl.seq_no
order by iosdtl.box_no,iosdtl.pcsn
ENDSELECT
ENDQUERY
ENDIF
@@ -399,7 +399,7 @@
dis.work_status <= 输入.bill_status
ENDOPTION
order by attr.layer_num ASC,attr.row_num ASC,attr.col_num ASC
order by dis.box_no,dis.pcsn
ENDSELECT
ENDQUERY
ENDIF