rev:异常任务处理
This commit is contained in:
@@ -18,7 +18,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 二期异常移库任务类
|
||||
* 二期异常出库任务(木箱:浅货位阻挡)
|
||||
* Created by Lxy on 2024/1/19.
|
||||
*/
|
||||
public class TwoExcepionalMoveTask extends AbstractAcsTask {
|
||||
@@ -85,37 +85,27 @@ public class TwoExcepionalMoveTask extends AbstractAcsTask {
|
||||
|
||||
map.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
||||
|
||||
// 更新起点仓位
|
||||
JSONObject jsonAttr = attrTab.query("struct_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
|
||||
jsonAttr.put("lock_type",IOSEnum.LOCK_TYPE.code("未锁定"));
|
||||
jsonAttr.put("storagevehicle_code","");
|
||||
attrTab.update(jsonAttr);
|
||||
if (jsonTask.getString("vehicle_code").equals(IOSEnum.IS_NOTANDYES.code("否"))){
|
||||
// 更新起点仓位
|
||||
JSONObject jsonAttr = attrTab.query("struct_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
|
||||
jsonAttr.put("lock_type",IOSEnum.LOCK_TYPE.code("未锁定"));
|
||||
jsonAttr.put("storagevehicle_code","");
|
||||
attrTab.update(jsonAttr);
|
||||
|
||||
// 更新终点仓位
|
||||
JSONObject jsonAttr1 = attrTab.query("struct_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
|
||||
jsonAttr1.put("lock_type",IOSEnum.LOCK_TYPE.code("其它"));
|
||||
attrTab.update(jsonAttr1);
|
||||
// 生成对接位到异常口的任务
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("start_device_code", jsonTask.getString("point_code2"));
|
||||
param.put("next_device_code", IOSEnum.EXCEP_OUT.code("异常出库口"));
|
||||
param.put("task_type", "010712");
|
||||
param.put("vehicle_code",IOSEnum.IS_NOTANDYES.code("是"));
|
||||
createTask(param);
|
||||
immediateNotifyAcs(null);
|
||||
}
|
||||
}
|
||||
|
||||
// 取消
|
||||
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
||||
|
||||
if (taskObj.getIntValue("task_status") > Integer.valueOf(TaskStatusEnum.ISSUE.getCode())) {
|
||||
throw new BadRequestException("任务已执行不能取消");
|
||||
}
|
||||
|
||||
// 更新任务表删除字段
|
||||
map.put("is_delete", IOSEnum.IS_NOTANDYES.code("是"));
|
||||
|
||||
// 解锁起点仓位
|
||||
JSONObject jsonAttr = attrTab.query("struct_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
|
||||
jsonAttr.put("lock_type",IOSEnum.LOCK_TYPE.code("未锁定"));
|
||||
attrTab.update(jsonAttr);
|
||||
|
||||
// 解锁终点仓位
|
||||
JSONObject jsonAttr1 = attrTab.query("struct_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
|
||||
jsonAttr1.put("lock_type",IOSEnum.LOCK_TYPE.code("未锁定"));
|
||||
attrTab.update(jsonAttr1);
|
||||
throw new BadRequestException("异常任务不允许取消!");
|
||||
}
|
||||
|
||||
map.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
|
||||
@@ -63,7 +63,7 @@ public enum IOSEnum {
|
||||
"空托盘出库锁", "4", "空托盘入库锁", "5",
|
||||
"移出锁", "6", "移入锁", "7","木箱入库锁","8",
|
||||
"木箱出库锁","9","出库异常锁","10",
|
||||
"货位异常锁", "11","其它", "99"
|
||||
"货位异常锁", "11","货位异常出库锁", "12","其它", "99"
|
||||
)),
|
||||
|
||||
//仓库id
|
||||
|
||||
@@ -129,7 +129,8 @@ public class InVehicleManageServiceImpl implements InVehicleManageService {
|
||||
JSONObject jsonParam = new JSONObject();
|
||||
jsonParam.put("stor_id", IOSEnum.STOR_ID.code("二期"));
|
||||
jsonParam.put("sect_id", RegionTypeEnum.TWO_BZC01.getId());
|
||||
jsonParam.put("vehicle_type", taskDao.getVehicle_type());
|
||||
jsonParam.put("vehicle_type", jsonAttr.getString("storagevehicle_type"));
|
||||
jsonParam.put("move_block_num", jsonAttr.getString("block_num"));
|
||||
|
||||
// 调用找货位方法
|
||||
JSONObject jsonAttrNow = getStruct(jsonParam);
|
||||
@@ -166,12 +167,24 @@ public class InVehicleManageServiceImpl implements InVehicleManageService {
|
||||
* 判断是否有仓位
|
||||
* 判断条件:库区、仓库、是否启用、是否删除、未锁定、没有载具
|
||||
*/
|
||||
JSONArray structArray = attrTab.query("IFNULL(storagevehicle_code,'') = '' " +
|
||||
"AND is_used = '" + IOSEnum.IS_NOTANDYES.code("是") + "' AND is_delete = '" + IOSEnum.IS_NOTANDYES.code("否") + "' " +
|
||||
"AND lock_type = '" + IOSEnum.LOCK_TYPE.code("未锁定") + "' AND stor_id = '" + jsonParam.getString("stor_id") + "' " +
|
||||
"AND storagevehicle_type = '" + jsonParam.getString("vehicle_type") + "'" +
|
||||
"AND height = '2'" +
|
||||
"AND sect_id = '" + jsonParam.getString("sect_id") + "'").getResultJSONArray(0);
|
||||
String block_num = jsonParam.getString("move_block_num");
|
||||
|
||||
JSONArray structArray = new JSONArray();
|
||||
if (ObjectUtil.isEmpty(block_num)) {
|
||||
structArray = attrTab.query("IFNULL(storagevehicle_code,'') = '' " +
|
||||
"AND is_used = '" + IOSEnum.IS_NOTANDYES.code("是") + "' AND is_delete = '" + IOSEnum.IS_NOTANDYES.code("否") + "' " +
|
||||
"AND lock_type = '" + IOSEnum.LOCK_TYPE.code("未锁定") + "' AND stor_id = '" + jsonParam.getString("stor_id") + "' " +
|
||||
"AND storagevehicle_type = '" + jsonParam.getString("vehicle_type") + "'" +
|
||||
"AND height = '2'" +
|
||||
"AND sect_id = '" + jsonParam.getString("sect_id") + "'").getResultJSONArray(0);
|
||||
} else {
|
||||
structArray = attrTab.query("IFNULL(storagevehicle_code,'') = '' " +
|
||||
"AND is_used = '" + IOSEnum.IS_NOTANDYES.code("是") + "' AND is_delete = '" + IOSEnum.IS_NOTANDYES.code("否") + "' " +
|
||||
"AND lock_type = '" + IOSEnum.LOCK_TYPE.code("未锁定") + "' AND stor_id = '" + jsonParam.getString("stor_id") + "' " +
|
||||
"AND storagevehicle_type = '" + jsonParam.getString("vehicle_type") + "'" +
|
||||
"AND height = '2'" +
|
||||
"AND sect_id = '" + jsonParam.getString("sect_id") + "' AND block_num = '"+block_num+"'").getResultJSONArray(0);
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(structArray)) {
|
||||
notInRowList.clear();
|
||||
@@ -180,7 +193,10 @@ public class InVehicleManageServiceImpl implements InVehicleManageService {
|
||||
}
|
||||
|
||||
// 确定巷道:查看每个巷道最小托盘数的巷道,获取最小托盘数的想到
|
||||
String block_num = getMinBlock(jsonParam);
|
||||
// 不是移库则需要找新巷道
|
||||
if (ObjectUtil.isEmpty(block_num)) {
|
||||
block_num = getMinBlock(jsonParam);
|
||||
}
|
||||
|
||||
// 确定排:查看每排的载具数量,找到数量最小的那排
|
||||
jsonParam.put("block_num", block_num);
|
||||
|
||||
@@ -197,26 +197,16 @@ public class OutBoxManageServiceImpl implements OutBoxManageService {
|
||||
throw new BadRequestException("对应浅货位不存在或未启用!" + jsonTask.getString("point_code1"));
|
||||
}
|
||||
|
||||
// 查询移入货位
|
||||
JSONObject jsonAttrMove = attrTab.query("sect_id = '" + jsonAttrOrder.getString("sect_id") + "' and struct_id <> '" + jsonAttrNow.getString("struct_id") + "' and lock_type = '" + IOSEnum.LOCK_TYPE.code("未锁定") + "' and IFNULL(storagevehicle_code,'') = '' AND is_used = '1' AND is_delete = '0' AND block_num = '"+jsonAttrOrder.getString("block_num")+"' order by zdepth DESC")
|
||||
.uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(jsonAttrMove)) {
|
||||
throw new BadRequestException("仓库不足!");
|
||||
}
|
||||
|
||||
// 锁住仓位
|
||||
jsonAttrNow.put("lock_type", IOSEnum.LOCK_TYPE.code("其它"));
|
||||
jsonAttrNow.put("lock_type", IOSEnum.LOCK_TYPE.code("货位异常出库锁"));
|
||||
attrTab.update(jsonAttrNow);
|
||||
|
||||
jsonAttrMove.put("lock_type", IOSEnum.LOCK_TYPE.code("其它"));
|
||||
attrTab.update(jsonAttrMove);
|
||||
|
||||
// 生成任务
|
||||
JSONObject taskParam = new JSONObject();
|
||||
taskParam.put("start_device_code", jsonAttrNow.getString("struct_code"));
|
||||
taskParam.put("next_device_code", jsonAttrMove.getString("struct_code"));
|
||||
taskParam.put("next_device_code", IOSEnum.OUT_POINT.code(jsonAttrNow.getString("row_num")));
|
||||
taskParam.put("task_type", "010712");
|
||||
taskParam.put("vehicle_code",IOSEnum.IS_NOTANDYES.code("否"));
|
||||
|
||||
TwoExcepionalMoveTask taskBean = new TwoExcepionalMoveTask();
|
||||
String task_id = taskBean.createTask(taskParam);
|
||||
|
||||
@@ -180,26 +180,16 @@ public class OutVehicleManageServiceImpl implements OutVehicleManageService {
|
||||
throw new BadRequestException("对应浅货位不存在或未启用!" + jsonTask.getString("point_code1"));
|
||||
}
|
||||
|
||||
// 查询移入货位
|
||||
JSONObject jsonAttrMove = attrTab.query("sect_id = '" + jsonAttrOrder.getString("sect_id") + "' and struct_id <> '" + jsonAttrNow.getString("struct_id") + "' and lock_type = '" + IOSEnum.LOCK_TYPE.code("未锁定") + "' and IFNULL(storagevehicle_code,'') = '' AND is_used = '1' AND is_delete = '0' AND block_num = '"+jsonAttrOrder.getString("block_num")+"' order by zdepth DESC")
|
||||
.uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(jsonAttrMove)) {
|
||||
throw new BadRequestException("仓库不足!");
|
||||
}
|
||||
|
||||
// 锁住仓位
|
||||
jsonAttrMove.put("lock_type", IOSEnum.LOCK_TYPE.code("其它"));
|
||||
attrTab.update(jsonAttrMove);
|
||||
|
||||
jsonAttrNow.put("lock_type", IOSEnum.LOCK_TYPE.code("其它"));
|
||||
jsonAttrNow.put("lock_type", IOSEnum.LOCK_TYPE.code("货位异常出库锁"));
|
||||
attrTab.update(jsonAttrNow);
|
||||
|
||||
// 生成任务
|
||||
JSONObject taskParam = new JSONObject();
|
||||
taskParam.put("start_device_code", jsonAttrNow.getString("struct_code"));
|
||||
taskParam.put("next_device_code", jsonAttrMove.getString("struct_code"));
|
||||
taskParam.put("next_device_code", IOSEnum.OUT_POINT.code(jsonAttrNow.getString("row_num")));
|
||||
taskParam.put("task_type", "010712");
|
||||
taskParam.put("vehicle_code",IOSEnum.IS_NOTANDYES.code("否"));
|
||||
|
||||
TwoExcepionalMoveTask taskBean = new TwoExcepionalMoveTask();
|
||||
String task_id = taskBean.createTask(taskParam);
|
||||
|
||||
@@ -2209,11 +2209,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
if (type.equals("2")) {
|
||||
point_code = outBoxManageService.taskExceptional(whereJson);
|
||||
}
|
||||
// TODO 重写
|
||||
if (type.equals("3")) {
|
||||
throw new BadRequestException("浅货位有货!");
|
||||
/* String task_id = outBoxManageService.taskExceptionalOut(whereJson);
|
||||
result.put("task_id", task_id);*/
|
||||
String task_id = outBoxManageService.taskExceptionalOut(whereJson);
|
||||
result.put("task_id", task_id);
|
||||
}
|
||||
} else if (taskDao.getTask_type().equals(TASKEnum.VEHICLE_TYPE.code("托盘入库"))) {
|
||||
// 托盘入库:满入、浅货位有货-放货时
|
||||
@@ -2226,9 +2224,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
point_code = outVehicleManageService.taskExceptional(whereJson);
|
||||
}
|
||||
if (type.equals("3")) {
|
||||
throw new BadRequestException("浅货位有货!");
|
||||
/* String task_id = outVehicleManageService.taskExceptionalOut(whereJson);
|
||||
result.put("task_id", task_id);*/
|
||||
String task_id = outVehicleManageService.taskExceptionalOut(whereJson);
|
||||
result.put("task_id", task_id);
|
||||
}
|
||||
} else if (taskDao.getTask_type().equals(TASKEnum.PROUD_TYPE.code("成品入库"))) {
|
||||
// 成品入库:满入、浅货位有货-放货时
|
||||
@@ -2238,7 +2235,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
|
||||
if (!type.equals("3") && ObjectUtil.isEmpty(point_code)) {
|
||||
throw new BadRequestException("点位为空!");
|
||||
throw new BadRequestException("仓位为空!");
|
||||
}
|
||||
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
|
||||
Reference in New Issue
Block a user