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 fb67c7567..9bb000752 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 @@ -182,4 +182,10 @@ public interface CheckOutBillService { * @param whereJson / */ JSONObject getDisNum(Map whereJson); + + /** + * 新增物料库存条件过滤 + * @param whereJson / + */ + JSONArray queryBox(JSONObject whereJson); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/rest/CheckOutBillController.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/rest/CheckOutBillController.java index e9b1e432b..c76b142b9 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/rest/CheckOutBillController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/rest/CheckOutBillController.java @@ -218,4 +218,11 @@ public class CheckOutBillController { public ResponseEntity getDisNum(@RequestBody Map whereJson) { return new ResponseEntity<>(checkOutBillService.getDisNum(whereJson),HttpStatus.OK); } + + @PostMapping("/queryBox") + @Log("新增物料库存条件过滤") + @ApiOperation("新增物料库存条件过滤") + public ResponseEntity queryBox(@RequestBody JSONObject whereJson) { + return new ResponseEntity<>(checkOutBillService.queryBox(whereJson),HttpStatus.OK); + } } 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 d9dd2a380..19e194a65 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 @@ -95,7 +95,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { if (StrUtil.isNotEmpty(map.get("pcsn"))) { map.put("pcsn", "%" + map.get("pcsn") + "%"); } - JSONObject jo = WQL.getWO("QST_IVT_CHECKOUTBILL").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), ""); + JSONObject jo = WQL.getWO("QST_IVT_CHECKOUTBILL").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "ivt.struct_code ASC"); return jo; } @@ -204,6 +204,19 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { //明细另一种写法 //JSONArray jsonArr = JSONArray.fromObject(whereJson.get("tableData")); JSONArray rows = map.getJSONArray("tableData"); + // 过滤相同箱号的明细 + HashSet boxSet = new HashSet<>(); + for (int i = 0; i < rows.size(); i++) { + JSONObject json = rows.getJSONObject(i); + boxSet.add(json.getString("box_no")); + } + rows.clear(); + // 遍历 + for (String box_no : boxSet) { + JSONObject jsonObject = WQL.getWO("QST_IVT_CHECKOUTBILL").addParam("flag", "7").addParam("box_no", box_no).process().uniqueResult(0); + rows.add(jsonObject); + } + map.remove("tableData"); Long currentUserId = SecurityUtils.getCurrentUserId(); String nickName = SecurityUtils.getCurrentNickName(); @@ -300,7 +313,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { 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("remark", ""); jsonDtl2.put("assign_qty", "0"); jsonDtl2.put("unassign_qty", jsonIvt.get("canuse_qty")); jsonDtl2.put("source_billdtl_id", jsonDtl.getString("iostorinvdtl_id")); @@ -379,11 +392,29 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { WQLObject wo = WQLObject.getWQLObject("ST_IVT_IOStorInv"); WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl"); + WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_StructIvt"); + wo.update(whereJson); //先删除该单据下的所有明细 String iostorinv_id = (String) whereJson.get("iostorinv_id"); wo_dtl.delete("iostorinv_id = '" + iostorinv_id + "'"); + JSONArray rows = whereJson.getJSONArray("tableData"); + // 过滤相同箱号的明细 + HashSet boxSet = new HashSet<>(); + for (int i = 0; i < rows.size(); i++) { + JSONObject json = rows.getJSONObject(i); + boxSet.add(json.getString("box_no")); + } + rows.clear(); + // 遍历 + for (String box_no : boxSet) { + JSONObject jsonObject = WQL.getWO("QST_IVT_CHECKOUTBILL").addParam("flag", "7").addParam("box_no", box_no).process().uniqueResult(0); + rows.add(jsonObject); + } + + 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(); @@ -399,9 +430,54 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { 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(); + } + whereJson.put("total_qty", qty); + whereJson.put("detail_count", num); + wo.update(whereJson); } } @@ -2290,6 +2366,26 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { return json; } + @Override + public JSONArray queryBox(JSONObject whereJson) { + + JSONArray data = whereJson.getJSONArray("data"); + // 先过滤相同的箱号 + HashSet boxSet = new HashSet<>(); + for (int i = 0; i < data.size(); i++) { + JSONObject json = data.getJSONObject(i); + boxSet.add(json.getString("box_no")); + } + + JSONArray array = new JSONArray(); + // 遍历 + for (String box_no : boxSet) { + JSONArray boxArr = WQL.getWO("QST_IVT_CHECKOUTBILL").addParam("flag", "7").addParam("box_no", box_no).process().getResultJSONArray(0); + array.addAll(boxArr); + } + return array; + } + /** * 更新主表状态 * diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/QST_IVT_CHECKOUTBILL.wql b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/QST_IVT_CHECKOUTBILL.wql index 719cc2409..d1a1a6502 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/QST_IVT_CHECKOUTBILL.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/QST_IVT_CHECKOUTBILL.wql @@ -43,6 +43,7 @@ 输入.task_status TYPEAS s_string 输入.deptIds TYPEAS f_string 输入.sale_order_name TYPEAS s_string + 输入.box_no TYPEAS s_string [临时表] --这边列出来的临时表就会在运行期动态创建 @@ -479,6 +480,11 @@ OPTION 输入.end_time <> "" ivt.instorage_time <= 输入.end_time ENDOPTION + + OPTION 输入.box_no <> "" + attr.storagevehicle_code = 输入.box_no + ENDOPTION + ENDSELECT ENDPAGEQUERY ENDIF diff --git a/lms/nladmin-ui/src/views/wms/st/outbill/AddDialog.vue b/lms/nladmin-ui/src/views/wms/st/outbill/AddDialog.vue index 4369e8d0f..892592246 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/AddDialog.vue +++ b/lms/nladmin-ui/src/views/wms/st/outbill/AddDialog.vue @@ -215,7 +215,7 @@ --> - + @@ -379,32 +379,52 @@ export default { })*/ }, tableChanged(rows) { - const tablemap = new Map() rows.forEach((item) => { debugger if (this.form.tableData.length !== 0) { this.flagnow = false for (let i = 0; i < this.form.tableData.length; i++) { - if (this.form.tableData[i].material_id === item.material_id) { + if (this.form.tableData[i].box_no === item.box_no && this.form.tableData[i].pcsn === item.pcsn) { this.flagnow = true } } if (!this.flagnow) { item.edit = true - item.quality_scode = '00' - tablemap.set(item.material_id, item) + this.form.tableData.splice(-1, 0, item) } } else { item.edit = true - item.quality_scode = '00' - tablemap.set(item.material_id, item) + this.form.tableData.splice(-1, 0, item) } }) - for (const value of tablemap.values()) { - this.form.tableData.push(value) - } this.form.detail_count = this.form.tableData.length }, + tableChanged5(rows) { + const data = { + 'data': rows + } + checkoutbill.queryBox(data).then(res => { + res.forEach((item) => { + debugger + if (this.form.tableData.length !== 0) { + this.flagnow = false + for (let i = 0; i < this.form.tableData.length; i++) { + if (this.form.tableData[i].box_no === item.box_no && this.form.tableData[i].pcsn === item.pcsn) { + this.flagnow = true + } + } + if (!this.flagnow) { + item.edit = true + this.form.tableData.splice(-1, 0, item) + } + } else { + item.edit = true + this.form.tableData.splice(-1, 0, item) + } + }) + this.form.detail_count = this.form.tableData.length + }) + }, setMaterValue(row) { for (let i = 0; i < this.form.tableData.length; i++) { if (this.form.tableData[i].material_id === row.material_id) { diff --git a/lms/nladmin-ui/src/views/wms/st/outbill/AddDtl.vue b/lms/nladmin-ui/src/views/wms/st/outbill/AddDtl.vue index ff8097203..70a08e9de 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/AddDtl.vue +++ b/lms/nladmin-ui/src/views/wms/st/outbill/AddDtl.vue @@ -47,6 +47,7 @@ + diff --git a/lms/nladmin-ui/src/views/wms/st/outbill/checkoutbill.js b/lms/nladmin-ui/src/views/wms/st/outbill/checkoutbill.js index fae986b89..0a9775309 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/checkoutbill.js +++ b/lms/nladmin-ui/src/views/wms/st/outbill/checkoutbill.js @@ -176,4 +176,11 @@ export function getDisNum(data) { data }) } -export default { add, edit, del, allDiv, allCancel, getOutBillDtl, getOutBillDis, setPoint, getOutBillTask, getStructIvt, manualDiv, confirm, issueTask, finishTask, cancleTaskfinish, getInvTypes, paramByCodeType, schAreaType, backConfirm, getOutBillDisDtl, getType, allDivOne, moneySubmit, getDisNum } +export function queryBox(data) { + return request({ + url: '/api/checkoutbill/queryBox', + method: 'post', + data + }) +} +export default { add, edit, del, allDiv, allCancel, getOutBillDtl, getOutBillDis, setPoint, getOutBillTask, getStructIvt, manualDiv, confirm, issueTask, finishTask, cancleTaskfinish, getInvTypes, paramByCodeType, schAreaType, backConfirm, getOutBillDisDtl, getType, allDivOne, moneySubmit, getDisNum, queryBox } diff --git a/lms/nladmin-ui/src/views/wms/statistics/sendReceiveQuery/index.vue b/lms/nladmin-ui/src/views/wms/statistics/sendReceiveQuery/index.vue index faa5f7e87..a4ff9e33d 100644 --- a/lms/nladmin-ui/src/views/wms/statistics/sendReceiveQuery/index.vue +++ b/lms/nladmin-ui/src/views/wms/statistics/sendReceiveQuery/index.vue @@ -108,18 +108,14 @@