diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java index 5527a4c1f..bfe0da3c6 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java @@ -99,6 +99,7 @@ public class SapToLmsServiceImpl implements SapToLmsService { jsonMst.put("receiver", json.getString("CONSIGNEE")); // 收货人 jsonMst.put("receiptphone", json.getString("TEL_NUMBER")); // 联系电话 jsonMst.put("contractno", json.getString("BSTNK")); // 合同号 + jsonMst.put("cust_code", json.getString("KUNNR")); // 客户 // 明细 JSONObject jsonMater = materTab.query("material_code = '" + json.getString("MATNR") + "'").uniqueResult(0); @@ -195,7 +196,7 @@ public class SapToLmsServiceImpl implements SapToLmsService { if (StrUtil.equals(lfart, "ZLF")) { jsonMst.put("tableData", tableData); // 调用出库新增并分配 - String iostorinv_id = checkOutBillService.insertDtl(jsonMst); + String iostorinv_id = checkOutBillService.insertDtl2(jsonMst); JSONObject jsonObject = new JSONObject(); jsonObject.put("iostorinv_id", iostorinv_id); //checkOutBillService.allDiv(jsonObject); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/VirtualOutServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/VirtualOutServiceImpl.java index 1ced396ff..2437ea1a2 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/VirtualOutServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/VirtualOutServiceImpl.java @@ -93,7 +93,7 @@ public class VirtualOutServiceImpl implements VirtualOutService { String box_no = whereJson.getString("box_no"); // 箱号 - JSONArray disArr = disTab.query("box_no = '" + box_no + "' and work_status <> '99'").getResultJSONArray(0); + JSONArray disArr = WQL.getWO("PDA_ST_01").addParam("flag", "7").addParam("box_no", box_no).process().getResultJSONArray(0); for (int i = 0; i < disArr.size(); i++) { JSONObject jsonDis = disArr.getJSONObject(i); // 更新状态为完成 diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_ST_01.wql b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_ST_01.wql index 760e17ca3..3ef9abb58 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_ST_01.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_ST_01.wql @@ -174,4 +174,24 @@ pdm_bi_printinfo ENDSELECT ENDQUERY + ENDIF + + IF 输入.flag = "7" + QUERY + SELECT + dis.* + FROM + ST_IVT_IOStorInvDis dis + LEFT JOIN st_ivt_iostorinv mst ON dis.iostorinv_id = mst.iostorinv_id + WHERE + mst.is_delete = '0' + AND mst.io_type = '1' + AND dis.work_status <> '99' + + OPTION 输入.box_no <> "" + dis.box_no = 输入.box_no + ENDOPTION + + ENDSELECT + ENDQUERY ENDIF \ No newline at end of file diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_VIRTUALOUT.wql b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_VIRTUALOUT.wql index 4795b5bc4..a65b0b3ec 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_VIRTUALOUT.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_VIRTUALOUT.wql @@ -66,6 +66,7 @@ WHERE dis.sect_id = '1586913215886004224' AND mst.is_delete = '0' + AND mst.io_type = '1' AND mst.bill_status <> '99' OPTION 输入.box_no <> "" @@ -117,6 +118,7 @@ WHERE dis.sect_id = '1586913215886004224' AND mst.is_delete = '0' + AND mst.io_type = '1' AND dis.work_status <> '99' OPTION 输入.box_no <> "" diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/CheckOutBillService.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/CheckOutBillService.java index 9bb000752..3d1312b6d 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/CheckOutBillService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/CheckOutBillService.java @@ -48,6 +48,12 @@ public interface CheckOutBillService { * / */ String insertDtl (JSONObject whereJson); + /** + * 发货出库用 + * @param whereJson + * / + */ + String insertDtl2 (JSONObject whereJson); /** * 新增出库单 * @param whereJson diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java index 19e194a65..6ba394109 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java @@ -332,6 +332,129 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { return iostorinv_id; } + @Override + @Transactional(rollbackFor = Exception.class) + public String insertDtl2(JSONObject map) { + WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_StructIvt"); + //明细另一种写法 + //JSONArray jsonArr = JSONArray.fromObject(whereJson.get("tableData")); + JSONArray rows = map.getJSONArray("tableData"); + + map.remove("tableData"); + Long currentUserId = SecurityUtils.getCurrentUserId(); + String nickName = SecurityUtils.getCurrentNickName(); + String user = map.getString("user"); + if (ObjectUtil.isNotEmpty(user)) { + if (user.equals("mes")) { + currentUserId = Long.parseLong(2 + ""); + nickName = "mes用户"; + } + if (user.equals("sap")) { + currentUserId = Long.parseLong(3 + ""); + nickName = "sap用户"; + } + } + String now = DateUtil.now(); + String iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + ""; + String bill_code = CodeUtil.getNewCode("IO_CODE"); + + JSONObject jsonStor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_id ='" + MapUtil.getStr(map, "stor_id") + "'").uniqueResult(0); + map.put("iostorinv_id", iostorinv_id); + map.put("bill_code", bill_code); + map.put("biz_date", map.getString("biz_date").substring(0, 10)); + String bill_type = (String) map.get("bill_type"); + map.put("buss_type", bill_type.substring(0, 4)); + map.put("io_type", "1"); + map.put("detail_count", rows.size() + ""); + map.put("create_mode", "01"); + map.put("stor_code", jsonStor.getString("stor_code")); + map.put("stor_name", jsonStor.getString("stor_name")); + map.put("input_optid", currentUserId + ""); + map.put("input_optname", nickName); + map.put("input_time", now); + map.put("update_optid", currentUserId + ""); + map.put("update_optname", nickName); + map.put("update_time", now); + map.put("is_delete", "0"); + map.put("is_upload", "0"); + if (ObjectUtil.isNotEmpty(user)) { + if (!user.equals("mes") || user.equals("sap")) { + Long deptId = SecurityUtils.getDeptId(); + map.put("sysdeptid", deptId); + map.put("syscompanyid", deptId); + } + } + double qty = 0.0; // 主表重量 + int num = rows.size(); // 明细数 + for (int i = 0; i < rows.size(); i++) { + JSONObject row = rows.getJSONObject(i); + JSONObject jsonDtl = new JSONObject(); + jsonDtl.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + ""); + jsonDtl.put("iostorinv_id", iostorinv_id); + jsonDtl.put("seq_no", (i + 1) + ""); + jsonDtl.put("material_id", row.getString("material_id")); + jsonDtl.put("pcsn", row.getString("pcsn")); + jsonDtl.put("box_no", row.getString("box_no")); + jsonDtl.put("quality_scode", "01"); + jsonDtl.put("bill_status", "10"); + jsonDtl.put("qty_unit_id", row.get("qty_unit_id")); + jsonDtl.put("qty_unit_name", row.getString("qty_unit_name")); + jsonDtl.put("plan_qty", row.get("plan_qty")); + jsonDtl.put("remark", row.getString("remark")); + jsonDtl.put("source_bill_code", row.getString("source_bill_code")); + jsonDtl.put("assign_qty", "0"); + jsonDtl.put("unassign_qty", row.get("plan_qty")); + jsonDtl.put("vbeln", row.getString("vbeln")); + jsonDtl.put("posnr", row.getString("posnr")); + WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(jsonDtl); + qty += jsonDtl.getDoubleValue("plan_qty"); + + // 判断此明细子卷是否存在,存在则将此木箱下的子卷全部生成明细 + String pcsn = row.getString("pcsn"); + if (ObjectUtil.isNotEmpty(pcsn)) { + JSONObject json = ivtTab.query("pcsn = '" + pcsn + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(json)) continue; + + JSONObject jsonMap = new JSONObject(); + jsonMap.put("flag", "1"); + jsonMap.put("pcsn", pcsn); + jsonMap.put("struct_id", json.getString("struct_id")); + + JSONArray ivtArr = WQL.getWO("ST_OUTIVT02").addParamMap(jsonMap).process().getResultJSONArray(0); + for (int j = 0; j < ivtArr.size(); j++) { + JSONObject jsonIvt = ivtArr.getJSONObject(j); + JSONObject jsonDtl2 = new JSONObject(); + + jsonDtl2.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + ""); + jsonDtl2.put("iostorinv_id", iostorinv_id); + jsonDtl2.put("seq_no", i + 2 + j); + jsonDtl2.put("material_id", jsonIvt.getString("material_id")); + jsonDtl2.put("pcsn", jsonIvt.getString("pcsn")); + jsonDtl2.put("box_no", jsonIvt.getString("box_no")); + jsonDtl2.put("quality_scode", "01"); + jsonDtl2.put("bill_status", "10"); + jsonDtl2.put("qty_unit_id", jsonIvt.get("qty_unit_id")); + jsonDtl2.put("qty_unit_name", jsonIvt.getString("qty_unit_name")); + jsonDtl2.put("plan_qty", jsonIvt.get("canuse_qty")); + jsonDtl2.put("remark", ""); + jsonDtl2.put("assign_qty", "0"); + jsonDtl2.put("unassign_qty", jsonIvt.get("canuse_qty")); + jsonDtl2.put("source_billdtl_id", jsonDtl.getString("iostorinvdtl_id")); + WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(jsonDtl2); + + qty += jsonDtl2.getDoubleValue("plan_qty"); + } + num += ivtArr.size(); + } + + } + map.put("total_qty", qty); + map.put("detail_count", num); + WQLObject.getWQLObject("ST_IVT_IOStorInv").insert(map); + + return iostorinv_id; + } + @Override public JSONArray getOutBillDtl(Map whereJson) { whereJson.put("flag", "2"); diff --git a/lms/nladmin-ui/src/views/wms/st/outbill/index.vue b/lms/nladmin-ui/src/views/wms/st/outbill/index.vue index 69d3350a1..9b75a84e0 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/index.vue +++ b/lms/nladmin-ui/src/views/wms/st/outbill/index.vue @@ -550,8 +550,12 @@ export default { return strStyle + arr.join('') }, printExcel(jo) { + if (jo.shd_dtl_num === '') { + return this.crud.notify('客户为空!', CRUD.NOTIFICATION_TYPE.INFO) + } checkoutbill.getDisNum({ 'iostorinv_id': jo.iostorinv_id }).then(res => { const j = Math.ceil(res.num / jo.shd_dtl_num) + debugger for (let i = 0; i < j; i++) { download('/api/checkoutbill/downloadExcel', { 'iostorinv_id': jo.iostorinv_id, 'j': i, 'pageNum': j }).then(result => { downloadFile(result, '发货单', 'xlsx')