fix: 修复货梯与供给线呼叫空盘任务相关问题
This commit is contained in:
@@ -209,7 +209,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
} else if (StrUtil.equals(type, "2")) {
|
||||
// 2.共挤线满托入库: 调用物料入库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(material_num) || (StrUtil.equals(material_num, "0")))
|
||||
throw new BadRequestException("物料数量不能为空或者为0");
|
||||
material_num = "0";
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", point_code); // 满料位
|
||||
|
||||
@@ -5,16 +5,22 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
||||
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.wms.log.LokiLogType;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
/**
|
||||
* ACS连接工具类:
|
||||
*/
|
||||
@Slf4j
|
||||
public class AcsUtil {
|
||||
public static JSONObject notifyAcs(String api, JSONArray list) {
|
||||
MDC.put("log_file_type", LokiLogType.LMS_TO_ACS.getDesc());
|
||||
log.info("请求接口: " + api + ", 数据:" + list);
|
||||
//判断是否连接ACS系统
|
||||
String isConnect = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_connect_acs").getValue();
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
@@ -269,8 +269,8 @@ public class GjxCallEmpVehicleTask extends AbstractAcsTask {
|
||||
} else {
|
||||
// 空托盘暂存区没有就到养生A区找: 先找到出库等待点
|
||||
JSONObject jsonEmpWait = pointTab.query("region_id = '" + RegionTypeEnum.YSAQKTPQ01.getId() +
|
||||
"' and col_num in ('9', '13') and can_vehicle_type = '" + vehicle_type +
|
||||
"' and is_used = '1' and is_delete = '0'").uniqueResult(0);
|
||||
"' and col_num in ('9', '13') and can_vehicle_type like '%" + vehicle_type +
|
||||
"%' and is_used = '1' and is_delete = '0'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonEmpWait)) continue;
|
||||
|
||||
JSONObject jsonStartPoint = pointTab.query("region_id = '" + jsonEmpWait.getString("region_id") +
|
||||
|
||||
@@ -50,11 +50,20 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
|
||||
String point_code1 = jsonTask.getString("point_code1");
|
||||
String point_code2 = jsonTask.getString("point_code2");
|
||||
if (ObjectUtil.isNotEmpty(point_code1)) {
|
||||
JSONObject jsonPoint1 = pointTab.query("point_code ='" + point_code1 + "'").uniqueResult(0);
|
||||
jsonPoint1.put("point_status", "1");
|
||||
jsonPoint1.put("lock_type", "1");
|
||||
jsonPoint1.put("update_time", DateUtil.now());
|
||||
pointTab.update(jsonPoint1);
|
||||
// JSONObject jsonPoint1 = pointTab.query("point_code ='" + point_code1 + "'").uniqueResult(0);
|
||||
// jsonPoint1.put("point_status", "1");
|
||||
// jsonPoint1.put("lock_type", "1");
|
||||
// jsonPoint1.put("update_time", DateUtil.now());
|
||||
// pointTab.update(jsonPoint1);
|
||||
// 释放货梯
|
||||
// 锁定所有当前货梯
|
||||
String allPre = point_code1.substring(0, 5);
|
||||
JSONObject param2 = new JSONObject();
|
||||
param2.put("lock_type", "1");
|
||||
param2.put("task_id", "");
|
||||
param2.put("point_status", "1");
|
||||
pointTab.update(param2, "point_code like '" + allPre + "%' " +
|
||||
"AND point_code <> '" + allPre + "' ");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(point_code2)) {
|
||||
JSONObject jsonPoint2 = pointTab.query("point_code ='" + point_code2 + "'").uniqueResult(0);
|
||||
@@ -88,6 +97,7 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
String point_code3 = jsonTask.getString("point_code3");
|
||||
String point_code1 = jsonTask.getString("point_code1");
|
||||
String point_code = "";
|
||||
// 更新终点:判断point_code3是否为空,为空就更新point_code2
|
||||
if (ObjectUtil.isNotEmpty(point_code3)) {
|
||||
@@ -129,6 +139,14 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
|
||||
if (ObjectUtil.isNotEmpty(jsonTask.getString("vehicle_code"))) {
|
||||
groupTab.delete("vehicle_code = '" + jsonTask.getString("vehicle_code") + "'");
|
||||
}
|
||||
// 锁定所有当前货梯
|
||||
String allPre = point_code1.substring(0, 5);
|
||||
JSONObject param2 = new JSONObject();
|
||||
param2.put("lock_type", "1");
|
||||
param2.put("task_id", "");
|
||||
param2.put("point_status", "1");
|
||||
pointTab.update(param2, "point_code like '" + allPre + "%' " +
|
||||
"AND point_code <> '" + allPre + "' ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,6 +160,7 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
|
||||
* 3.下发给ACS
|
||||
*/
|
||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表
|
||||
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_point"); // 点位表
|
||||
|
||||
//任务表【SCH_BASE_Task】
|
||||
//判断当前点是否有未完成的任务
|
||||
@@ -150,6 +169,11 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
|
||||
JSONObject taskObj = taskTab.query("is_delete='0' and point_code1 = '" + point_code1 + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(taskObj)) throw new BadRequestException("当前点位" + point_code1 + "存在未完成的任务");
|
||||
|
||||
// 判断是否锁定
|
||||
JSONObject jsonObject = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||
if (jsonObject.getString("lock_type").equals("2")) {
|
||||
throw new BadRequestException("当前点位" + point_code1 + "已被锁住");
|
||||
}
|
||||
SchTaskDto dto = SchTaskDto.builder().task_id(org.nl.wms.util.IdUtil.getLongId())
|
||||
.task_code(CodeUtil.getNewCode("TASK_CODE"))
|
||||
.task_type("")
|
||||
@@ -163,6 +187,10 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
|
||||
.build();
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
taskTab.insert(json);
|
||||
// 锁住当前点货梯
|
||||
jsonObject.put("lock_type", "2");
|
||||
jsonObject.put("task_id", dto.getTask_id());
|
||||
pointTab.update(jsonObject);
|
||||
this.findNextPoint();
|
||||
// this.immediateNotifyAcs();
|
||||
return String.valueOf(dto.getTask_id());
|
||||
@@ -269,6 +297,12 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
|
||||
JSONObject jsonEnd = pointTab.query("point_code = '" + endPoint + "'").uniqueResult(0);
|
||||
jsonEnd.put("lock_type", "2");
|
||||
pointTab.update(jsonEnd);
|
||||
// 锁住送当前货梯所有点
|
||||
String allPre = jsonTask.getString("point_code1").substring(0, 5);
|
||||
JSONObject param2 = new JSONObject();
|
||||
param2.put("lock_type", "2");
|
||||
param2.put("task_id", jsonTask.getString("task_id"));
|
||||
pointTab.update(param2, "point_code like '" + allPre + "%' AND point_code <> '" + allPre + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,17 +408,6 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
|
||||
"and lock_type = '1' and is_used = '1' and is_delete = '0' and point_status = '1'", "in_order_seq desc").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(inOrderSeqDesc)) end_code = inOrderSeqDesc.getString("point_code");
|
||||
}
|
||||
// 为空就去养生A区的等待位
|
||||
// JSONObject jsonEmpWait = pointTab.query("region_id = '" + RegionTypeEnum.YSAQKTPQ01.getId() + "' and col_num = '1' and can_vehicle_type = '" + vehicle_type + "' and lock_type = '1' and is_used = '1' and is_delete = '0' and point_status = '1'").uniqueResult(0);
|
||||
//
|
||||
// if (ObjectUtil.isNotEmpty(jsonEmpWait)) {
|
||||
// // 判断是否有任务
|
||||
// boolean is_point = this.isTask(jsonEmpWait.getString("point_code"));
|
||||
// if (is_point) {
|
||||
// JSONArray jsonEmpArr = pointTab.query("region_id = '" + RegionTypeEnum.YSAQKTPQ01.getId() + "' and row_num = '" + jsonEmpWait.getString("row_num") + "' and can_vehicle_type = '" + vehicle_type + "' and lock_type = '1' and is_used = '1' and is_delete = '0' and point_status = '1'").getResultJSONArray(0);
|
||||
// if (ObjectUtil.isNotEmpty(jsonEmpArr)) end_code = jsonEmpWait.getString("point_code");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,14 +54,21 @@ public class YqxSendMaterialTask extends AbstractAcsTask {
|
||||
|
||||
if (StrUtil.equals(status, "0")) {
|
||||
//取消任务,释放相关点位的锁
|
||||
String point_code1 = jsonTask.getString("point_code1");
|
||||
// String point_code1 = jsonTask.getString("point_code1");
|
||||
String point_code2 = jsonTask.getString("point_code2");
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("lock_type", "1");
|
||||
param.put("task_id", "");
|
||||
pointTab.update(param, "point_code = '" + point_code1 + "'");
|
||||
pointTab.update(param, "point_code = '" + point_code2 + "'");
|
||||
|
||||
// JSONObject param = new JSONObject();
|
||||
// param.put("lock_type", "1");
|
||||
// param.put("task_id", "");
|
||||
// pointTab.update(param, "point_code = '" + point_code1 + "'");
|
||||
// pointTab.update(param, "point_code = '" + point_code2 + "'");
|
||||
if (ObjectUtil.isNotEmpty(point_code2)) {
|
||||
// 锁定所有当前货梯
|
||||
String allPre = point_code2.substring(0, 5);
|
||||
JSONObject param2 = new JSONObject();
|
||||
param2.put("lock_type", "1");
|
||||
param2.put("task_id", "");
|
||||
pointTab.update(param2, "point_code like '" + allPre + "%' AND point_code <> '" + allPre + "'");
|
||||
}
|
||||
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
||||
jsonTask.put("remark", "已取消");
|
||||
taskTab.update(jsonTask);
|
||||
@@ -83,15 +90,24 @@ public class YqxSendMaterialTask extends AbstractAcsTask {
|
||||
jsonTask.put("remark", "任务执行完成");
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
|
||||
//取消任务,释放相关点位的锁
|
||||
String point_code1 = jsonTask.getString("point_code1");
|
||||
// String point_code1 = jsonTask.getString("point_code1");
|
||||
String point_code2 = jsonTask.getString("point_code2");
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("lock_type", "1");
|
||||
param.put("task_id", "");
|
||||
if (ObjectUtil.isNotEmpty(point_code2)) {
|
||||
// 锁定所有当前货梯
|
||||
String allPre = point_code2.substring(0, 5);
|
||||
JSONObject param2 = new JSONObject();
|
||||
param2.put("lock_type", "1");
|
||||
param2.put("task_id", "");
|
||||
pointTab.update(param2, "point_code like '" + allPre + "%' " +
|
||||
"AND point_code <> '" + allPre + "' " +
|
||||
"AND point_code <> '" + point_code2 + "'");
|
||||
}
|
||||
|
||||
pointTab.update(param, "point_code = '" + point_code1 + "'");
|
||||
// pointTab.update(param, "point_code = '" + point_code1 + "'");
|
||||
|
||||
param.put("point_status", "3");
|
||||
pointTab.update(param, "point_code = '" + point_code2 + "'");
|
||||
@@ -121,15 +137,18 @@ public class YqxSendMaterialTask extends AbstractAcsTask {
|
||||
taskObj.put("remark", "电梯无可用点");
|
||||
taskObj.put("update_time", DateUtil.now());
|
||||
taskTab.update(taskObj);
|
||||
} else {
|
||||
//锁住点位
|
||||
endPoint.put("lock_type", "2");
|
||||
endPoint.put("task_id", task_id);
|
||||
pointTab.update(endPoint);
|
||||
} else { // 找到对应的货梯单位
|
||||
// 锁定所有当前货梯
|
||||
String pointCode = endPoint.getString("point_code");
|
||||
String allPre = pointCode.substring(0, 5);
|
||||
JSONObject param2 = new JSONObject();
|
||||
param2.put("lock_type", "2");
|
||||
param2.put("task_id", task_id);;
|
||||
pointTab.update(param2, "point_code like '" + allPre + "%' AND point_code <> '" + allPre + "'");
|
||||
|
||||
//修改任务状态
|
||||
taskObj.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
taskObj.put("point_code2", endPoint.getString("point_code"));
|
||||
taskObj.put("point_code2", pointCode);
|
||||
taskObj.put("remark", "");
|
||||
taskObj.put("update_time", DateUtil.now());
|
||||
taskTab.update(taskObj);
|
||||
|
||||
Reference in New Issue
Block a user