生成移库单阻挡问题解决
This commit is contained in:
@@ -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<String, Object> 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() {
|
||||
//查询单据字段类型
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user