From 8ca0fd2f7428ba4050c88360bb1707166c3ed5cb Mon Sep 17 00:00:00 2001 From: liuxy Date: Tue, 11 Apr 2023 20:28:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E6=88=90=E7=A7=BB=E5=BA=93=E5=8D=95?= =?UTF-8?q?=E9=98=BB=E6=8C=A1=E9=97=AE=E9=A2=98=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/HandMoveStorServiceImpl.java | 200 ++++++++++++++++++ .../st/instor/task/HandMoveStorAcsTask.java | 4 + .../st/instor/wql/QST_IVT_HANDMOVESTOR.wql | 41 ++++ .../wms/st/inStor/moveStor/AddDialog.vue | 2 +- .../views/wms/st/inStor/moveStor/index.vue | 6 + 5 files changed, 252 insertions(+), 1 deletion(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/HandMoveStorServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/HandMoveStorServiceImpl.java index e7fb0d120..2750cb7e5 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/HandMoveStorServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/HandMoveStorServiceImpl.java @@ -14,12 +14,14 @@ import org.nl.common.utils.SecurityUtils; import org.nl.modules.system.util.CodeUtil; 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.wms.basedata.st.service.impl.UserStorServiceImpl; import org.nl.wms.sch.manage.TaskStatusEnum; import org.nl.wms.st.inbill.service.StorPublicService; import org.nl.wms.st.instor.service.HandMoveStorService; import org.nl.wms.st.instor.task.HandMoveStorAcsTask; +import org.nl.wms.st.outbill.service.impl.CheckOutBillServiceImpl; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -37,6 +39,7 @@ import java.util.Map; @Slf4j public class HandMoveStorServiceImpl implements HandMoveStorService { private final StorPublicService storPublicService; + private final HandMoveStorAcsTask handMoveStorAcsTask; @Override public Map pageQuery(Map whereJson, Pageable page) { @@ -959,6 +962,8 @@ public class HandMoveStorServiceImpl implements HandMoveStorService { WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_MoveInvDtl"); //任务表 WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task"); + //仓位表 + WQLObject wo_attr = WQLObject.getWQLObject("st_ivt_structattr"); HandMoveStorAcsTask handMoveStorAcsTask = new HandMoveStorAcsTask(); @@ -978,6 +983,13 @@ public class HandMoveStorServiceImpl implements HandMoveStorService { for (int i = 0; i < ja.size(); i++) { JSONObject jo = ja.getJSONObject(i); String task_id = jo.getString("task_id"); + + // 判断起点是否被挡 + JSONObject jsonTask = wo_Task.query("task_id = '" + task_id + "'").uniqueResult(0); + JSONObject jsonAttr = wo_attr.query("struct_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0); + // 调用共用判断是否阻挡并生成任务、移库单 + this.isBlock(jsonAttr); + JSONObject result = handMoveStorAcsTask.immediateNotifyAcs(task_id); JSONObject task = wo_Task.query("task_id='" + task_id + "'").uniqueResult(0); if (ObjectUtil.isNotEmpty(result)) { @@ -1006,6 +1018,194 @@ public class HandMoveStorServiceImpl implements HandMoveStorService { wo_mst.update(map, "moveinv_id='" + moveinv_id + "'"); } + @Transactional(rollbackFor = Exception.class) + public Integer isBlock(JSONObject whereJson) { + String placement_type = whereJson.getString("placement_type"); + CheckOutBillServiceImpl bean = SpringContextHolder.getBean(CheckOutBillServiceImpl.class); + + JSONArray jsonLockArr = new JSONArray(); + + if (StrUtil.equals(placement_type, "01")) { + /* + * 双通 + */ + + // 判断右边边被阻挡个数 + JSONObject isNumMap = new JSONObject(); + isNumMap.put("flag", "3"); + isNumMap.put("block_num", whereJson.getString("block_num")); + isNumMap.put("row_num", whereJson.getString("row_num")); + isNumMap.put("out_order_seq", whereJson.getString("out_order_seq")); + JSONArray numArrFirst = WQL.getWO("ST_OUTIVT04").addParamMap(isNumMap).process().getResultJSONArray(0); + + // 调用共用方法计算被挡个数 + JSONArray rightNumArr = bean.isNum(numArrFirst); + + // 判断左边被挡个数 + isNumMap.put("flag", "4"); + JSONArray numArrLast = WQL.getWO("ST_OUTIVT04").addParamMap(isNumMap).process().getResultJSONArray(0); + + // 调用共用方法计算被挡个数 + JSONArray leftNumArr = bean.isNum(numArrLast); + + if (rightNumArr.size() > leftNumArr.size()) { + /* + * 左边开始 + */ + // 查询仓位被锁住的货位 + isNumMap.put("flag", "5"); + JSONArray isLockArr = WQL.getWO("ST_OUTIVT04").addParamMap(isNumMap).process().getResultJSONArray(0); + + JSONArray numArr = bean.isNum(isLockArr); + // 不为空则返回报错 + if (ObjectUtil.isNotEmpty(numArr)) { + String error = ""; + + for (int k = 0; k < numArr.size(); k++) { + JSONObject json = numArr.getJSONObject(k); + error += json.getString("struct_code") + ","; + } + + throw new BadRequestException("仓位:" + error + "被锁定且未下发任务,无法生成任务!"); + } + + // 查询被阻挡需要移库的货位 + isNumMap.put("flag", "6"); + jsonLockArr = WQL.getWO("QST_IVT_HANDMOVESTOR").addParamMap(isNumMap).process().getResultJSONArray(0); + + } if (rightNumArr.size() < leftNumArr.size()) { + /* + * 右边开始 + */ + // 查询仓位被锁住的货位 + isNumMap.put("flag", "6"); + JSONArray isLockArr = WQL.getWO("ST_OUTIVT04").addParamMap(isNumMap).process().getResultJSONArray(0); + + JSONArray numArr = bean.isNum(isLockArr); + + // 不为空则返回报错 + if (ObjectUtil.isNotEmpty(numArr)) { + String error = ""; + + for (int k = 0; k < numArr.size(); k++) { + JSONObject json = numArr.getJSONObject(k); + error += json.getString("struct_code") + ","; + } + + throw new BadRequestException("仓位:" + error + "被锁定且未下发任务,无法生成任务!"); + } + + // 查询被阻挡需要移库的货位 + isNumMap.put("flag", "7"); + jsonLockArr = WQL.getWO("QST_IVT_HANDMOVESTOR").addParamMap(isNumMap).process().getResultJSONArray(0); + + } else { + /* + * 默认从右边开始 + */ + // 查询仓位被锁住的货位 + isNumMap.put("flag", "6"); + JSONArray isLockArr = WQL.getWO("ST_OUTIVT04").addParamMap(isNumMap).process().getResultJSONArray(0); + + JSONArray numArr = bean.isNum(isLockArr); + + // 不为空则返回报错 + if (ObjectUtil.isNotEmpty(numArr)) { + String error = ""; + + for (int k = 0; k < numArr.size(); k++) { + JSONObject json = numArr.getJSONObject(k); + error += json.getString("struct_code") + ","; + } + + throw new BadRequestException("仓位:" + error + "被锁定且未下发任务,无法生成任务!"); + } + + // 查询被阻挡需要移库的货位 + isNumMap.put("flag", "7"); + jsonLockArr = WQL.getWO("QST_IVT_HANDMOVESTOR").addParamMap(isNumMap).process().getResultJSONArray(0); + } + + } else if (StrUtil.equals(placement_type, "02")) { + /* + * 左通 + */ + // 查询仓位被锁住的货位 + JSONObject isNumMap = new JSONObject(); + isNumMap.put("flag", "5"); + isNumMap.put("block_num", whereJson.getString("block_num")); + isNumMap.put("row_num", whereJson.getString("row_num")); + isNumMap.put("out_order_seq", whereJson.getString("out_order_seq")); + JSONArray isLockArr = WQL.getWO("ST_OUTIVT04").addParamMap(isNumMap).process().getResultJSONArray(0); + + JSONArray numArr = bean.isNum(isLockArr); + // 不为空则返回报错 + if (ObjectUtil.isNotEmpty(numArr)) { + String error = ""; + + for (int k = 0; k < numArr.size(); k++) { + JSONObject json = numArr.getJSONObject(k); + error += json.getString("struct_code") + ","; + } + + throw new BadRequestException("仓位:" + error + "被锁定且未下发任务,无法生成任务!"); + } + + // 查询被阻挡需要移库的货位 + isNumMap.put("flag", "6"); + jsonLockArr = WQL.getWO("QST_IVT_HANDMOVESTOR").addParamMap(isNumMap).process().getResultJSONArray(0); + + } else if (StrUtil.equals(placement_type, "03")) { + /* + * 右通 + */ + + // 查询仓位被锁住的货位 + JSONObject isNumMap = new JSONObject(); + isNumMap.put("flag", "6"); + isNumMap.put("block_num", whereJson.getString("block_num")); + isNumMap.put("row_num", whereJson.getString("row_num")); + isNumMap.put("out_order_seq", whereJson.getString("out_order_seq")); + JSONArray isLockArr = WQL.getWO("ST_OUTIVT04").addParamMap(isNumMap).process().getResultJSONArray(0); + + JSONArray numArr = bean.isNum(isLockArr); + + // 不为空则返回报错 + if (ObjectUtil.isNotEmpty(numArr)) { + String error = ""; + + for (int k = 0; k < numArr.size(); k++) { + JSONObject json = numArr.getJSONObject(k); + error += json.getString("struct_code") + ","; + } + + throw new BadRequestException("仓位:" + error + "被锁定且未下发任务,无法生成任务!"); + } + + // 查询被阻挡需要移库的货位 + isNumMap.put("flag", "7"); + jsonLockArr = WQL.getWO("QST_IVT_HANDMOVESTOR").addParamMap(isNumMap).process().getResultJSONArray(0); + } + + /* + * 生成移库任务 + */ + + // 判断是否需要生成移库 + if (ObjectUtil.isNotEmpty(jsonLockArr)) { + JSONObject moveParam = new JSONObject(); + moveParam.put("jsonAllBlockPoint", jsonLockArr); + moveParam.put("is_move", "1"); + moveParam.put("task_group_id", IdUtil.getSnowflake(1,1).nextId()); + bean.createMove(moveParam); + + // 下发移库任务组 + handMoveStorAcsTask.immediateNotifyAcs(null); + } + + return jsonLockArr.size(); + } + @Override public JSONArray getInvTypes() { //查询单据字段类型 diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/task/HandMoveStorAcsTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/task/HandMoveStorAcsTask.java index 6366d4651..2a21bdb2b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/task/HandMoveStorAcsTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/task/HandMoveStorAcsTask.java @@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import lombok.RequiredArgsConstructor; import org.nl.modules.common.exception.BadRequestException; import org.nl.common.utils.SecurityUtils; import org.nl.modules.wql.core.bean.WQLObject; @@ -14,12 +15,15 @@ import org.nl.wms.sch.manage.AbstractAcsTask; import org.nl.wms.sch.manage.TaskStatusEnum; import org.nl.wms.sch.tasks.EmptyVehicleTask; import org.nl.wms.st.instor.service.impl.HandMoveStorServiceImpl; +import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +@Component +@RequiredArgsConstructor public class HandMoveStorAcsTask extends AbstractAcsTask { private final String THIS_CLASS = HandMoveStorAcsTask.class.getName(); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/wql/QST_IVT_HANDMOVESTOR.wql b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/wql/QST_IVT_HANDMOVESTOR.wql index 39296143e..11996e66b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/wql/QST_IVT_HANDMOVESTOR.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/wql/QST_IVT_HANDMOVESTOR.wql @@ -41,6 +41,9 @@ 输入.task_id TYPEAS s_string 输入.storagevehicle_code TYPEAS s_string 输入.struct_code TYPEAS s_string + 输入.block_num TYPEAS s_string + 输入.row_num TYPEAS s_string + 输入.out_order_seq TYPEAS s_string 输入.ids TYPEAS f_string 输入.deptIds TYPEAS f_string 输入.in_stor_id TYPEAS f_string @@ -330,5 +333,43 @@ ENDQUERY ENDIF + IF 输入.flag = "6" + QUERY + SELECT + attr.* + FROM + st_ivt_structattr attr + WHERE + attr.lock_type = '1' + AND attr.block_num = 输入.block_num + AND attr.row_num = 输入.row_num + AND attr.out_order_seq > 输入.out_order_seq + AND IFNULL( attr.storagevehicle_code, '' ) <> '' + + order by attr.out_order_seq DESC + + ENDSELECT + ENDQUERY + ENDIF + + IF 输入.flag = "7" + QUERY + SELECT + attr.* + FROM + st_ivt_structattr attr + WHERE + attr.lock_type = '1' + AND attr.block_num = 输入.block_num + AND attr.row_num = 输入.row_num + AND attr.out_order_seq < 输入.out_order_seq + AND IFNULL( attr.storagevehicle_code, '' ) <> '' + + order by attr.out_order_seq ASC + + ENDSELECT + ENDQUERY + ENDIF + diff --git a/lms/nladmin-ui/src/views/wms/st/inStor/moveStor/AddDialog.vue b/lms/nladmin-ui/src/views/wms/st/inStor/moveStor/AddDialog.vue index 0b350cd49..a605fde77 100644 --- a/lms/nladmin-ui/src/views/wms/st/inStor/moveStor/AddDialog.vue +++ b/lms/nladmin-ui/src/views/wms/st/inStor/moveStor/AddDialog.vue @@ -65,11 +65,11 @@ { this.querytable() + this.loadingConfirm = false + }).catch(() => { + this.loadingConfirm = false }) }, confirm() {