From d8c7d47f311f48267b64b91ef2174d3c10a5da36 Mon Sep 17 00:00:00 2001 From: liuxy Date: Sun, 27 Nov 2022 18:40:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../st/service/impl/StructivtServiceImpl.java | 4 + .../wms/basedata/st/wql/QST_STRUCTIVT001.wql | 4 + .../inbill/service/CheckOutBillService.java | 2 + .../outbill/rest/CheckOutBillController.java | 6 + .../service/impl/CheckOutBillServiceImpl.java | 113 ++++++++++++++---- .../st/outbill/wql/QST_IVT_CHECKOUTBILL.wql | 40 +++++++ .../src/views/wms/basedata/st/ivt/index.vue | 12 +- .../src/views/wms/st/outbill/AddDtl.vue | 11 +- .../src/views/wms/st/outbill/ViewDialog.vue | 8 +- .../src/views/wms/st/outbill/checkoutbill.js | 9 +- 10 files changed, 181 insertions(+), 28 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/StructivtServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/StructivtServiceImpl.java index 1e11b60c2..298f2f872 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/StructivtServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/StructivtServiceImpl.java @@ -43,6 +43,7 @@ public class StructivtServiceImpl implements StructivtService { String material = MapUtil.getStr(whereJson, "material"); String struct = MapUtil.getStr(whereJson, "struct"); String region_id = MapUtil.getStr(whereJson, "region_id"); + String pcsn = MapUtil.getStr(whereJson, "pcsn"); JSONObject map = new JSONObject(); map.put("flag", "1"); map.put("region_id", region_id); @@ -52,6 +53,9 @@ public class StructivtServiceImpl implements StructivtService { if (StrUtil.isNotEmpty(struct)) { map.put("struct", "%" + struct + "%"); } + if (StrUtil.isNotEmpty(pcsn)) { + map.put("pcsn", "%" + pcsn + "%"); + } JSONObject jsonObject = WQL.getWO("QST_STRUCTIVT001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "ivt.instorage_time desc"); return jsonObject; } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCTIVT001.wql b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCTIVT001.wql index 340879ab7..944053185 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCTIVT001.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCTIVT001.wql @@ -17,6 +17,7 @@ 输入.struct TYPEAS s_string 输入.material TYPEAS s_string 输入.region_id TYPEAS f_string + 输入.pcsn TYPEAS s_string [临时表] --这边列出来的临时表就会在运行期动态创建 @@ -75,6 +76,9 @@ mater.material_name like 输入.material ) ENDOPTION + OPTION 输入.pcsn <> "" + ivt.pcsn like 输入.pcsn + ENDOPTION OPTION 输入.region_id <> "" ivt.region_id = 输入.region_id 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 3d1312b6d..8c488cbd3 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 @@ -194,4 +194,6 @@ public interface CheckOutBillService { * @param whereJson / */ JSONArray queryBox(JSONObject whereJson); + + JSONArray getOutBillTask2(Map 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 c76b142b9..4de247ff6 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 @@ -123,6 +123,12 @@ public class CheckOutBillController { public ResponseEntity getOutBillTask(@RequestParam Map whereJson){ return new ResponseEntity<>(checkOutBillService.getOutBillTask(whereJson), HttpStatus.OK); } + @PostMapping("/getOutBillTask2") + @Log("详情查询出库单分配任务2") + @ApiOperation("详情查询出库单分配任务2") + public ResponseEntity getOutBillTask2(@RequestBody Map whereJson){ + return new ResponseEntity<>(checkOutBillService.getOutBillTask2(whereJson), HttpStatus.OK); + } @GetMapping("/getStructIvt") @Log("查询可分配库存") @ApiOperation("查询可分配库存") 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 6ba394109..0aae32591 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 @@ -88,6 +88,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { map.put("flag", "7"); map.put("begin_time", MapUtil.getStr(whereJson, "begin_time")); map.put("end_time", MapUtil.getStr(whereJson, "end_time")); + map.put("canuse_qty", "0"); if (StrUtil.isNotEmpty(map.get("material_code"))) { map.put("material_code", "%" + map.get("material_code") + "%"); @@ -203,18 +204,25 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_StructIvt"); //明细另一种写法 //JSONArray jsonArr = JSONArray.fromObject(whereJson.get("tableData")); - JSONArray rows = map.getJSONArray("tableData"); + JSONArray array = map.getJSONArray("tableData"); + JSONArray rows = new JSONArray(); // 过滤相同箱号的明细 HashSet boxSet = new HashSet<>(); - for (int i = 0; i < rows.size(); i++) { - JSONObject json = rows.getJSONObject(i); - boxSet.add(json.getString("box_no")); + for (int i = 0; i < array.size(); i++) { + JSONObject json = array.getJSONObject(i); + if (ObjectUtil.isNotEmpty(json.getString("box_no"))) { + boxSet.add(json.getString("box_no")); + } else { + rows.add(json); + } } - 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); + if (ObjectUtil.isNotEmpty(boxSet)) { +// 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"); @@ -265,6 +273,11 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { int num = rows.size(); // 明细数 for (int i = 0; i < rows.size(); i++) { JSONObject row = rows.getJSONObject(i); + // 校验计划数量不能为零 + double plan_qty = row.getDoubleValue("plan_qty"); + if (plan_qty == 0.0) { + throw new BadRequestException("数量不能为0"); + } JSONObject jsonDtl = new JSONObject(); jsonDtl.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + ""); jsonDtl.put("iostorinv_id", iostorinv_id); @@ -301,7 +314,6 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { 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); @@ -317,6 +329,11 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { jsonDtl2.put("assign_qty", "0"); jsonDtl2.put("unassign_qty", jsonIvt.get("canuse_qty")); jsonDtl2.put("source_billdtl_id", jsonDtl.getString("iostorinvdtl_id")); + // 校验计划数量不能为零 + double plan_qty2 = jsonDtl2.getDoubleValue("plan_qty"); + if (plan_qty2 == 0.0) { + throw new BadRequestException("数量不能为0"); + } WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(jsonDtl2); qty += jsonDtl2.getDoubleValue("plan_qty"); @@ -388,6 +405,12 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { int num = rows.size(); // 明细数 for (int i = 0; i < rows.size(); i++) { JSONObject row = rows.getJSONObject(i); + // 校验计划数量不能为零 + double plan_qty = row.getDoubleValue("plan_qty"); + if (plan_qty == 0.0) { + throw new BadRequestException("数量不能为0"); + } + JSONObject jsonDtl = new JSONObject(); jsonDtl.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + ""); jsonDtl.put("iostorinv_id", iostorinv_id); @@ -440,6 +463,11 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { jsonDtl2.put("assign_qty", "0"); jsonDtl2.put("unassign_qty", jsonIvt.get("canuse_qty")); jsonDtl2.put("source_billdtl_id", jsonDtl.getString("iostorinvdtl_id")); + // 校验计划数量不能为零 + double plan_qty2 = jsonDtl2.getDoubleValue("plan_qty"); + if (plan_qty2 == 0.0) { + throw new BadRequestException("数量不能为0"); + } WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(jsonDtl2); qty += jsonDtl2.getDoubleValue("plan_qty"); @@ -502,6 +530,33 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { return jo; } + @Override + public JSONArray getOutBillTask2(Map whereJson) { + HashMap map = new HashMap<>(whereJson); + map.put("flag", "101"); + JSONArray jo = new JSONArray(); + if (map.containsKey("iostorinvdtl_id")) { + jo = WQL.getWO("QST_IVT_CHECKOUTBILL") + .addParamMap(map) + .process() + .getResultJSONArray(0); + } + for (int i = 0; i < jo.size(); i++) { + JSONObject json = jo.getJSONObject(i); + String task_status = json.getString("task_status"); + if (ObjectUtil.isEmpty(task_status)) { + String work_status = json.getString("work_status"); + if (StrUtil.equals(work_status, "01")) { + json.put("task_status","01"); + } + if (StrUtil.equals(work_status, "99")) { + json.put("task_status","07"); + } + } + } + return jo; + } + @Override @Transactional(rollbackFor = Exception.class) public void update(JSONObject whereJson) { @@ -522,24 +577,38 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { String iostorinv_id = (String) whereJson.get("iostorinv_id"); wo_dtl.delete("iostorinv_id = '" + iostorinv_id + "'"); - JSONArray rows = whereJson.getJSONArray("tableData"); + JSONArray array = whereJson.getJSONArray("tableData"); + JSONArray rows = new JSONArray(); + // 过滤相同箱号的明细 HashSet boxSet = new HashSet<>(); - for (int i = 0; i < rows.size(); i++) { - JSONObject json = rows.getJSONObject(i); - boxSet.add(json.getString("box_no")); + for (int i = 0; i < array.size(); i++) { + JSONObject json = array.getJSONObject(i); + if (ObjectUtil.isNotEmpty(json.getString("box_no"))) { + boxSet.add(json.getString("box_no")); + } else { + rows.add(json); + } } - 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); + if (ObjectUtil.isNotEmpty(boxSet)) { +// 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); + // 校验计划数量不能为零 + double plan_qty = row.getDoubleValue("plan_qty"); + if (plan_qty == 0.0) { + throw new BadRequestException("数量不能为0"); + } + JSONObject jsonDtl = new JSONObject(); jsonDtl.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + ""); jsonDtl.put("iostorinv_id", iostorinv_id); @@ -576,7 +645,6 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { 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); @@ -592,6 +660,11 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { jsonDtl2.put("assign_qty", "0"); jsonDtl2.put("unassign_qty", jsonIvt.get("canuse_qty")); jsonDtl2.put("source_billdtl_id", jsonDtl.getString("iostorinvdtl_id")); + // 校验计划数量不能为零 + double plan_qty2 = jsonDtl2.getDoubleValue("plan_qty"); + if (plan_qty2 == 0.0) { + throw new BadRequestException("数量不能为0"); + } WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(jsonDtl2); qty += jsonDtl2.getDoubleValue("plan_qty"); 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 6446e4722..5fda3a1be 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 @@ -44,6 +44,7 @@ 输入.deptIds TYPEAS f_string 输入.sale_order_name TYPEAS s_string 输入.box_no TYPEAS s_string + 输入.canuse_qty TYPEAS s_string [临时表] --这边列出来的临时表就会在运行期动态创建 @@ -485,6 +486,10 @@ attr.storagevehicle_code = 输入.box_no ENDOPTION + OPTION 输入.canuse_qty <> "" + ivt.canuse_qty > 输入.canuse_qty + ENDOPTION + ENDSELECT ENDPAGEQUERY ENDIF @@ -572,6 +577,41 @@ ENDQUERY ENDIF + IF 输入.flag = "101" + QUERY + SELECT + dis.*, + mater.material_code, + mater.material_name, + point.point_code AS next_point_code, + task.task_code, + task.task_type, + task.task_status + FROM + st_ivt_iostorinvdis dis + LEFT JOIN md_me_materialbase mater ON dis.material_id = mater.material_id + LEFT JOIN sch_base_point point ON dis.point_id = point.point_id + LEFT JOIN sch_base_task task ON dis.task_id = task.task_id + WHERE + 1=1 + + OPTION 输入.iostorinvdtl_id <> "" + dis.iostorinvdtl_id = 输入.iostorinvdtl_id + ENDOPTION + OPTION 输入.iostorinv_id <> "" + dis.iostorinv_id = 输入.iostorinv_id + ENDOPTION + OPTION 输入.is_issued <> "" + dis.is_issued = 输入.is_issued + ENDOPTION + OPTION 输入.struct_id <> "" + dis.struct_id = 输入.struct_id + ENDOPTION + + ENDSELECT + ENDQUERY + ENDIF + IF 输入.flag = "11" QUERY SELECT diff --git a/lms/nladmin-ui/src/views/wms/basedata/st/ivt/index.vue b/lms/nladmin-ui/src/views/wms/basedata/st/ivt/index.vue index 60af11694..5eca86464 100644 --- a/lms/nladmin-ui/src/views/wms/basedata/st/ivt/index.vue +++ b/lms/nladmin-ui/src/views/wms/basedata/st/ivt/index.vue @@ -31,6 +31,16 @@ class="filter-item" /> + + + - + 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 70a08e9de..5e79d1508 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/AddDtl.vue +++ b/lms/nladmin-ui/src/views/wms/st/outbill/AddDtl.vue @@ -95,7 +95,8 @@ export default { return { dialogVisible: false, opendtlParam: '', - rows: [] + rows: [], + openShow: true } }, watch: { @@ -113,6 +114,12 @@ export default { methods: { [CRUD.HOOK.beforeRefresh]() { this.crud.query.mater_type = this.opendtlParam + if (this.openShow) { + this.openShow = false + return false + } else { + return true + } }, close() { this.crud.resetQuery(false) @@ -120,7 +127,7 @@ export default { }, open() { this.crud.query.mater_type = this.opendtlParam - this.crud.toQuery() + // this.crud.toQuery() }, submit() { this.rows = this.$refs.multipleTable.selection diff --git a/lms/nladmin-ui/src/views/wms/st/outbill/ViewDialog.vue b/lms/nladmin-ui/src/views/wms/st/outbill/ViewDialog.vue index 093d70fec..7cf4783a6 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/ViewDialog.vue +++ b/lms/nladmin-ui/src/views/wms/st/outbill/ViewDialog.vue @@ -136,10 +136,10 @@ > - - + + - + @@ -253,7 +253,7 @@ export default { }, queryTableDdis() { if (this.currentdtl !== null) { - checkoutbill.getOutBillTask({ 'iostorinvdtl_id': this.currentdtl.iostorinvdtl_id }).then(res => { + checkoutbill.getOutBillTask2({ 'iostorinvdtl_id': this.currentdtl.iostorinvdtl_id }).then(res => { this.tabledis = res }).catch(() => { this.tabledis = [] 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 0a9775309..bcaffd69e 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/checkoutbill.js +++ b/lms/nladmin-ui/src/views/wms/st/outbill/checkoutbill.js @@ -183,4 +183,11 @@ export function queryBox(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, queryBox } +export function getOutBillTask2(data) { + return request({ + url: '/api/checkoutbill/getOutBillTask2', + 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, getOutBillTask2 }