rev:仓储异常处理
This commit is contained in:
@@ -61,7 +61,7 @@ public enum IOSEnum {
|
||||
//仓位锁定类型
|
||||
LOCK_TYPE(MapOf.of("未锁定", "1", "入库锁", "2", "出库锁", "3", "空托盘出库锁", "4",
|
||||
"空托盘入库锁", "5", "移出锁", "6", "移入锁", "7","木箱入库锁","8","木箱出库锁","9",
|
||||
"出库异常锁","10","其它", "99"
|
||||
"出库异常锁","10","货位异常锁", "11","其它", "99"
|
||||
)),
|
||||
|
||||
//仓库id
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package org.nl.b_lms.storage_manage.ios.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 任务类型枚举类
|
||||
*
|
||||
* @author lxy
|
||||
* @Date 2023/11/14 20:11
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum TASKEnum {
|
||||
// 木箱任务类型
|
||||
BOX_TYPE(MapOf.of("木箱入库", "010702", "木箱出库", "010704")),
|
||||
|
||||
// 托盘任务类型
|
||||
VEHICLE_TYPE(MapOf.of("托盘入库", "010705", "托盘出库", "010706")),
|
||||
|
||||
// 成品任务类型
|
||||
PROUD_TYPE(MapOf.of("成品入库", "010703", "成品出库", "010711")),
|
||||
;
|
||||
|
||||
private Map<String, String> code;
|
||||
|
||||
public String code(String desc) {
|
||||
String code = this.getCode().get(desc);
|
||||
if (StringUtils.isNotEmpty(code)) {
|
||||
return code;
|
||||
}
|
||||
throw new BadRequestException(this.name() + "对应类型" + desc + "未定义");
|
||||
}
|
||||
|
||||
public String check(String code) {
|
||||
for (Map.Entry<String, String> entry : this.getCode().entrySet()) {
|
||||
if (entry.getValue().equals("code")) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
throw new BadRequestException(this.name() + "对应类型" + code + "未定义");
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||
import org.nl.b_lms.sch.tasks.TwoInBoxTask;
|
||||
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxinfoService;
|
||||
import org.nl.b_lms.storage_manage.database.service.dao.BstIvtBoxinfo;
|
||||
@@ -51,6 +53,12 @@ public class InBoxManageServiceImpl implements InBoxManageService {
|
||||
@Autowired
|
||||
private IBstIvtBoxinfoService iBstIvtBoxinfoService;
|
||||
|
||||
/**
|
||||
* 任务服务
|
||||
*/
|
||||
@Autowired
|
||||
private IschBaseTaskService ischBaseTaskService;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void inBox(JSONObject whereJson) {
|
||||
@@ -157,6 +165,53 @@ public class InBoxManageServiceImpl implements InBoxManageService {
|
||||
// TODO 手持下发桁架任务
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public String taskExceptional(JSONObject jsonObject) {
|
||||
// 仓位表
|
||||
WQLObject attrTab = WQLObject.getWQLObject("ST_IVT_StructAttr");
|
||||
|
||||
// 查询任务
|
||||
SchBaseTask taskDao = ischBaseTaskService.getOne(
|
||||
new QueryWrapper<SchBaseTask>().lambda()
|
||||
.eq(SchBaseTask::getTask_code, jsonObject.getString("task_code"))
|
||||
);
|
||||
|
||||
// 标记原货位为满入异常锁
|
||||
JSONObject jsonAttr = attrTab.query("struct_code = '" + taskDao.getPoint_code2() + "'").uniqueResult(0);
|
||||
jsonAttr.put("lock_type", IOSEnum.LOCK_TYPE.code("货位异常锁"));
|
||||
attrTab.update(jsonAttr);
|
||||
|
||||
// 重新分配货位
|
||||
BstIvtBoxinfo boxDao = iBstIvtBoxinfoService.getOne(
|
||||
new QueryWrapper<BstIvtBoxinfo>().lambda()
|
||||
.eq(BstIvtBoxinfo::getBox_no, taskDao.getVehicle_code())
|
||||
);
|
||||
|
||||
JSONObject jsonParam = new JSONObject();
|
||||
jsonParam.put("stor_id", IOSEnum.STOR_ID.code("二期"));
|
||||
jsonParam.put("sect_id", RegionTypeEnum.TWO_MX01.getId());
|
||||
jsonParam.put("box_length", boxDao.getBox_length());
|
||||
jsonParam.put("box_width", boxDao.getBox_width());
|
||||
jsonParam.put("box_high", boxDao.getBox_high());
|
||||
|
||||
// 调用找货位方法
|
||||
JSONObject jsonAttrNow = getStruct(jsonParam);
|
||||
if (ObjectUtil.isEmpty(jsonAttrNow)) {
|
||||
throw new BadRequestException("仓位不足!");
|
||||
}
|
||||
|
||||
// 锁定新终点
|
||||
jsonAttrNow.put("lock_type", IOSEnum.LOCK_TYPE.code("木箱入库锁"));
|
||||
attrTab.update(jsonAttrNow);
|
||||
|
||||
// 更新任务终点
|
||||
taskDao.setPoint_code2(jsonAttrNow.getString("struct_code"));
|
||||
ischBaseTaskService.updateById(taskDao);
|
||||
|
||||
return jsonAttrNow.getString("struct_code");
|
||||
}
|
||||
|
||||
/**
|
||||
* 找一个空仓位(木箱区)
|
||||
* @param jsonParam {
|
||||
|
||||
@@ -6,6 +6,9 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvService;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvdisService;
|
||||
@@ -18,6 +21,7 @@ import org.nl.common.utils.MapOf;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.sch.service.TaskService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -46,6 +50,9 @@ public class InBussManageServiceImpl implements InBussManageService {
|
||||
@Autowired
|
||||
private IStIvtIostorinvdisService iStIvtIostorinvdisService;
|
||||
|
||||
@Autowired
|
||||
private IschBaseTaskService ischBaseTaskService;
|
||||
|
||||
/**
|
||||
* 不需要查询的排集合
|
||||
*/
|
||||
@@ -267,6 +274,86 @@ public class InBussManageServiceImpl implements InBussManageService {
|
||||
iStIvtIostorinvService.divStruct(jsonDiv);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public String taskExceptional(JSONObject jsonObject) {
|
||||
/*
|
||||
* 1.锁定原货位
|
||||
* 2.重新找新货位
|
||||
* 3.更新单据相关数据
|
||||
*/
|
||||
// 仓位表
|
||||
WQLObject attrTab = WQLObject.getWQLObject("ST_IVT_StructAttr");
|
||||
|
||||
// 1.更新原仓位
|
||||
SchBaseTask taskDao = ischBaseTaskService.getOne(
|
||||
new QueryWrapper<SchBaseTask>().lambda()
|
||||
.eq(SchBaseTask::getTask_code, jsonObject.getString("task_code"))
|
||||
);
|
||||
|
||||
// 查找对应单据
|
||||
List<LinkedHashMap> disDaoList = iStIvtIostorinvdisService.list(
|
||||
new QueryWrapper<StIvtIostorinvdis>().lambda()
|
||||
.eq(StIvtIostorinvdis::getTask_id, taskDao.getTask_id())
|
||||
).stream()
|
||||
.map(row -> JSONObject.parseObject(JSON.toJSONString(row), LinkedHashMap.class))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 取消单据分配
|
||||
JSONObject pram = new JSONObject();
|
||||
pram.put("tableMater", disDaoList);
|
||||
iStIvtIostorinvService.unDivStruct(pram);
|
||||
|
||||
// 标记原货位为满入异常锁
|
||||
JSONObject jsonAttr = attrTab.query("struct_code = '" + taskDao.getPoint_code2() + "'").uniqueResult(0);
|
||||
jsonAttr.put("lock_type", IOSEnum.LOCK_TYPE.code("货位异常锁"));
|
||||
attrTab.update(jsonAttr);
|
||||
|
||||
// 2.重新分配货位
|
||||
String iostorinv_id = disDaoList.get(0).get("iostorinv_id").toString();
|
||||
|
||||
// 重新分配过的明细
|
||||
List<LinkedHashMap> disList = iStIvtIostorinvdisService.list(
|
||||
new QueryWrapper<StIvtIostorinvdis>().lambda()
|
||||
.eq(StIvtIostorinvdis::getIostorinv_id, iostorinv_id)
|
||||
).stream()
|
||||
.map(row -> JSONObject.parseObject(JSON.toJSONString(row), LinkedHashMap.class))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
StIvtIostorinvdtl dtlDao = iStIvtIostorinvdtlService.list(
|
||||
new QueryWrapper<StIvtIostorinvdtl>().lambda()
|
||||
.eq(StIvtIostorinvdtl::getIostorinvdtl_id, disList.get(0).get("iostorinvdtl_id"))
|
||||
).get(0);
|
||||
|
||||
JSONObject jsonDiv = new JSONObject();
|
||||
jsonDiv.put("dtl_row",JSONObject.parseObject(JSON.toJSONString(dtlDao)));
|
||||
jsonDiv.put("tableMater", disList);
|
||||
jsonDiv.put("checked", true);
|
||||
jsonDiv.put("is_send", IOSEnum.IS_SEND.code("否"));
|
||||
jsonDiv.put("sect_id", IOSEnum.SECT_ID.code("二期主存区"));
|
||||
jsonDiv.put("stor_id", IOSEnum.STOR_ID.code("二期"));
|
||||
|
||||
iStIvtIostorinvService.divStruct(jsonDiv);
|
||||
|
||||
// 3.更新明细任务标识
|
||||
iStIvtIostorinvdisService.update(
|
||||
new UpdateWrapper<StIvtIostorinvdis>().lambda()
|
||||
.eq(StIvtIostorinvdis::getIostorinv_id, iostorinv_id)
|
||||
.set(StIvtIostorinvdis::getTask_id, taskDao.getTask_id())
|
||||
);
|
||||
|
||||
// 4.更新任务终点
|
||||
List<StIvtIostorinvdis> disListNow = iStIvtIostorinvdisService.list(
|
||||
new QueryWrapper<StIvtIostorinvdis>().lambda()
|
||||
.eq(StIvtIostorinvdis::getIostorinv_id, iostorinv_id)
|
||||
);
|
||||
|
||||
taskDao.setPoint_code2(disListNow.get(0).getStruct_code());
|
||||
ischBaseTaskService.updateById(taskDao);
|
||||
|
||||
return disListNow.get(0).getStruct_code();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最小巷道
|
||||
* @param jsonSub {
|
||||
|
||||
@@ -3,13 +3,18 @@ package org.nl.b_lms.storage_manage.ios.service.iostorInv.util.impl;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||
import org.nl.b_lms.sch.tasks.TwoInEmpTask;
|
||||
import org.nl.b_lms.storage_manage.database.service.dao.BstIvtBoxinfo;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.InVehicleManageService;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -39,6 +44,12 @@ public class InVehicleManageServiceImpl implements InVehicleManageService {
|
||||
*/
|
||||
private List<String> notInBlockList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 任务服务
|
||||
*/
|
||||
@Autowired
|
||||
private IschBaseTaskService ischBaseTaskService;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void inVehicle(JSONObject whereJson) {
|
||||
@@ -93,6 +104,46 @@ public class InVehicleManageServiceImpl implements InVehicleManageService {
|
||||
notInBlockList.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public String taskExceptional(JSONObject jsonObject) {
|
||||
// 仓位表
|
||||
WQLObject attrTab = WQLObject.getWQLObject("ST_IVT_StructAttr");
|
||||
|
||||
// 查询任务
|
||||
SchBaseTask taskDao = ischBaseTaskService.getOne(
|
||||
new QueryWrapper<SchBaseTask>().lambda()
|
||||
.eq(SchBaseTask::getTask_code, jsonObject.getString("task_code"))
|
||||
);
|
||||
|
||||
// 标记原货位为满入异常锁
|
||||
JSONObject jsonAttr = attrTab.query("struct_code = '" + taskDao.getPoint_code2() + "'").uniqueResult(0);
|
||||
jsonAttr.put("lock_type", IOSEnum.LOCK_TYPE.code("货位异常锁"));
|
||||
attrTab.update(jsonAttr);
|
||||
|
||||
// 重新分配货位
|
||||
JSONObject jsonParam = new JSONObject();
|
||||
jsonParam.put("stor_id", IOSEnum.STOR_ID.code("二期"));
|
||||
jsonParam.put("sect_id", RegionTypeEnum.TWO_TTP01.getId());
|
||||
jsonParam.put("vehicle_type", taskDao.getVehicle_type());
|
||||
|
||||
// 调用找货位方法
|
||||
JSONObject jsonAttrNow = getStruct(jsonParam);
|
||||
if (ObjectUtil.isEmpty(jsonAttrNow)) {
|
||||
throw new BadRequestException("仓位不足!");
|
||||
}
|
||||
|
||||
// 锁定新终点
|
||||
jsonAttrNow.put("lock_type", IOSEnum.LOCK_TYPE.code("空托盘入库锁"));
|
||||
attrTab.update(jsonAttrNow);
|
||||
|
||||
// 更新任务终点
|
||||
taskDao.setPoint_code2(jsonAttrNow.getString("struct_code"));
|
||||
ischBaseTaskService.updateById(taskDao);
|
||||
|
||||
return jsonAttrNow.getString("struct_code");
|
||||
}
|
||||
|
||||
/**
|
||||
* 找一个空仓位(空托盘区)
|
||||
* @param jsonParam {
|
||||
|
||||
@@ -3,8 +3,13 @@ package org.nl.b_lms.storage_manage.ios.service.iostorInv.util.impl;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||
import org.nl.b_lms.sch.tasks.TwoMoveBoxTask;
|
||||
import org.nl.b_lms.sch.tasks.TwoOutBoxTask;
|
||||
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxinfoService;
|
||||
import org.nl.b_lms.storage_manage.database.service.dao.BstIvtBoxinfo;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.OutBoxManageService;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
@@ -12,6 +17,7 @@ import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -41,6 +47,18 @@ public class OutBoxManageServiceImpl implements OutBoxManageService {
|
||||
*/
|
||||
private List<String> notOutBlockList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 木箱信息服务
|
||||
*/
|
||||
@Autowired
|
||||
private IBstIvtBoxinfoService iBstIvtBoxinfoService;
|
||||
|
||||
/**
|
||||
* 任务服务
|
||||
*/
|
||||
@Autowired
|
||||
private IschBaseTaskService ischBaseTaskService;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void outBox(JSONObject whereJson) {
|
||||
@@ -94,6 +112,55 @@ public class OutBoxManageServiceImpl implements OutBoxManageService {
|
||||
notOutBlockList.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public String taskExceptional(JSONObject jsonObject) {
|
||||
// 仓位表
|
||||
WQLObject attrTab = WQLObject.getWQLObject("ST_IVT_StructAttr");
|
||||
|
||||
// 查询任务
|
||||
SchBaseTask taskDao = ischBaseTaskService.getOne(
|
||||
new QueryWrapper<SchBaseTask>().lambda()
|
||||
.eq(SchBaseTask::getTask_code, jsonObject.getString("task_code"))
|
||||
);
|
||||
|
||||
// 标记原货位为满入异常锁
|
||||
JSONObject jsonAttr = attrTab.query("struct_code = '" + taskDao.getPoint_code1() + "'").uniqueResult(0);
|
||||
jsonAttr.put("lock_type", IOSEnum.LOCK_TYPE.code("货位异常锁"));
|
||||
attrTab.update(jsonAttr);
|
||||
|
||||
// 重新分配货位
|
||||
BstIvtBoxinfo boxDao = iBstIvtBoxinfoService.getOne(
|
||||
new QueryWrapper<BstIvtBoxinfo>().lambda()
|
||||
.eq(BstIvtBoxinfo::getBox_no, taskDao.getVehicle_code())
|
||||
);
|
||||
|
||||
JSONObject jsonParam = new JSONObject();
|
||||
jsonParam.put("stor_id", IOSEnum.STOR_ID.code("二期"));
|
||||
jsonParam.put("sect_id", RegionTypeEnum.TWO_MX01.getId());
|
||||
jsonParam.put("box_length", boxDao.getBox_length());
|
||||
jsonParam.put("box_width", boxDao.getBox_width());
|
||||
jsonParam.put("box_high", boxDao.getBox_high());
|
||||
jsonParam.put("num", boxDao.getNum());
|
||||
|
||||
// 调用找货位方法
|
||||
JSONObject jsonAttrNow = getStruct(jsonParam);
|
||||
if (ObjectUtil.isEmpty(jsonAttrNow)) {
|
||||
throw new BadRequestException("库存不足!");
|
||||
}
|
||||
|
||||
// 锁定新终点
|
||||
jsonAttrNow.put("lock_type", IOSEnum.LOCK_TYPE.code("木箱出库锁"));
|
||||
attrTab.update(jsonAttrNow);
|
||||
|
||||
// 更新任务起点
|
||||
taskDao.setPoint_code1(jsonAttrNow.getString("struct_code"));
|
||||
taskDao.setVehicle_code(jsonAttrNow.getString("storagevehicle_code"));
|
||||
ischBaseTaskService.updateById(taskDao);
|
||||
|
||||
return jsonAttrNow.getString("struct_code");
|
||||
}
|
||||
|
||||
/**
|
||||
* 找一个空木箱
|
||||
* @param whereJson {
|
||||
@@ -102,6 +169,8 @@ public class OutBoxManageServiceImpl implements OutBoxManageService {
|
||||
* box_width: 宽
|
||||
* box_high: 高
|
||||
* num: 子卷数
|
||||
* stor_id: 仓库
|
||||
* sect_id: 库区
|
||||
* }
|
||||
* @return JSONObject: 仓位对象
|
||||
*/
|
||||
|
||||
@@ -3,6 +3,9 @@ package org.nl.b_lms.storage_manage.ios.service.iostorInv.util.impl;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||
import org.nl.b_lms.sch.tasks.TwoInEmpTask;
|
||||
import org.nl.b_lms.sch.tasks.TwoOutEmpTask;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
@@ -12,6 +15,7 @@ import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -41,6 +45,12 @@ public class OutVehicleManageServiceImpl implements OutVehicleManageService {
|
||||
*/
|
||||
private List<String> notOutBlockList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 任务服务
|
||||
*/
|
||||
@Autowired
|
||||
private IschBaseTaskService ischBaseTaskService;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void outVehicle(JSONObject whereJson) {
|
||||
@@ -96,6 +106,48 @@ public class OutVehicleManageServiceImpl implements OutVehicleManageService {
|
||||
notOutRowList.clear();
|
||||
notOutBlockList.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public String taskExceptional(JSONObject jsonObject) {
|
||||
// 仓位表
|
||||
WQLObject attrTab = WQLObject.getWQLObject("ST_IVT_StructAttr");
|
||||
|
||||
// 查询任务
|
||||
SchBaseTask taskDao = ischBaseTaskService.getOne(
|
||||
new QueryWrapper<SchBaseTask>().lambda()
|
||||
.eq(SchBaseTask::getTask_code, jsonObject.getString("task_code"))
|
||||
);
|
||||
|
||||
// 标记原货位为满入异常锁
|
||||
JSONObject jsonAttr = attrTab.query("struct_code = '" + taskDao.getPoint_code1() + "'").uniqueResult(0);
|
||||
jsonAttr.put("lock_type", IOSEnum.LOCK_TYPE.code("货位异常锁"));
|
||||
attrTab.update(jsonAttr);
|
||||
|
||||
// 重新分配货位
|
||||
JSONObject jsonParam = new JSONObject();
|
||||
jsonParam.put("stor_id", IOSEnum.STOR_ID.code("二期"));
|
||||
jsonParam.put("sect_id", RegionTypeEnum.TWO_TTP01.getId());
|
||||
jsonParam.put("vehicle_type", taskDao.getVehicle_type());
|
||||
|
||||
// 调用找货位方法
|
||||
JSONObject jsonAttrNow = getStruct(jsonParam);
|
||||
if (ObjectUtil.isEmpty(jsonAttrNow)) {
|
||||
throw new BadRequestException("仓位不足!");
|
||||
}
|
||||
|
||||
// 锁定新终点
|
||||
jsonAttrNow.put("lock_type", IOSEnum.LOCK_TYPE.code("空托盘出库锁"));
|
||||
attrTab.update(jsonAttrNow);
|
||||
|
||||
// 更新任务起点
|
||||
taskDao.setPoint_code1(jsonAttrNow.getString("struct_code"));
|
||||
taskDao.setVehicle_code(jsonAttrNow.getString("storagevehicle_code"));
|
||||
ischBaseTaskService.updateById(taskDao);
|
||||
|
||||
return jsonAttrNow.getString("struct_code");
|
||||
}
|
||||
|
||||
/**
|
||||
* 找一个空托盘(空托盘区)
|
||||
* @param whereJson {
|
||||
|
||||
@@ -30,4 +30,13 @@ public interface InBoxManageService {
|
||||
*/
|
||||
void boxBinVehicle(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 任务异常处理(1.满入 2.浅货位有货-放货时)
|
||||
* @param jsonObject {
|
||||
* task_code : 任务编码
|
||||
* }
|
||||
* @return point_code: 货位编码
|
||||
*/
|
||||
String taskExceptional(JSONObject jsonObject);
|
||||
|
||||
}
|
||||
|
||||
@@ -53,4 +53,13 @@ public interface InBussManageService {
|
||||
*/
|
||||
void inTask(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* 任务异常处理(1.满入 2.浅货位有货-放货时)
|
||||
* @param jsonObject {
|
||||
* task_code : 任务编码
|
||||
* }
|
||||
* @return point_code: 货位编码
|
||||
*/
|
||||
String taskExceptional(JSONObject jsonObject);
|
||||
|
||||
}
|
||||
|
||||
@@ -22,4 +22,13 @@ public interface InVehicleManageService {
|
||||
*/
|
||||
void inVehicle(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 任务异常处理(1.满入 2.浅货位有货-放货时)
|
||||
* @param jsonObject {
|
||||
* task_code : 任务编码
|
||||
* }
|
||||
* @return point_code: 货位编码
|
||||
*/
|
||||
String taskExceptional(JSONObject jsonObject);
|
||||
|
||||
}
|
||||
|
||||
@@ -24,4 +24,14 @@ public interface OutBoxManageService {
|
||||
*/
|
||||
void outBox(JSONObject whereJson);
|
||||
|
||||
|
||||
/**
|
||||
* 任务异常处理(1.空出 2.浅货位有货-取货时)
|
||||
* @param jsonObject {
|
||||
* task_code : 任务编码
|
||||
* }
|
||||
* @return point_code: 货位编码
|
||||
*/
|
||||
String taskExceptional(JSONObject jsonObject);
|
||||
|
||||
}
|
||||
|
||||
@@ -21,4 +21,13 @@ public interface OutVehicleManageService {
|
||||
*/
|
||||
void outVehicle(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 任务异常处理(1.空出 2.浅货位有货-取货时)
|
||||
* @param jsonObject {
|
||||
* task_code : 任务编码
|
||||
* }
|
||||
* @return point_code: 货位编码
|
||||
*/
|
||||
String taskExceptional(JSONObject jsonObject);
|
||||
|
||||
}
|
||||
|
||||
@@ -170,5 +170,12 @@ public class AcsToWmsController {
|
||||
return new ResponseEntity<>(acsToWmsService.deviceApplyTwo(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/deviceApplyExceptional")
|
||||
@Log(value = "二期任务异常反馈", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> deviceApplyExceptional(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(acsToWmsService.deviceApplyExceptional(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -155,4 +155,16 @@ public interface AcsToWmsService {
|
||||
* @return
|
||||
*/
|
||||
JSONObject deviceApplyTwo(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 二期任务异常反馈
|
||||
* @param whereJson:{
|
||||
* type :异常类型
|
||||
* task_code : 任务编码
|
||||
* }
|
||||
* @return JSONObject {
|
||||
* point_code: 货位编码
|
||||
* }
|
||||
*/
|
||||
JSONObject deviceApplyExceptional(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.google.common.collect.Interner;
|
||||
import com.google.common.collect.Interners;
|
||||
@@ -24,6 +25,7 @@ import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||
import org.nl.b_lms.sch.tasks.TwoBoxExcepTask;
|
||||
import org.nl.b_lms.sch.tasks.first_floor_area.MzhcwTask;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.TASKEnum;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.*;
|
||||
import org.nl.common.enums.NoticeTypeEnum;
|
||||
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||
@@ -113,6 +115,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
*/
|
||||
private final InBoxManageService inBoxManageService;
|
||||
|
||||
/**
|
||||
* 木箱出库处理服务
|
||||
*/
|
||||
private final OutBoxManageService outBoxManageService;
|
||||
|
||||
@Resource
|
||||
private IschBaseTaskService taskService;
|
||||
@Resource
|
||||
@@ -1966,4 +1973,69 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@SneakyThrows
|
||||
public JSONObject deviceApplyExceptional(JSONObject whereJson) {
|
||||
log.info("deviceApplyExceptional请求参数:---------------------------------------------" + whereJson.toString());
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
// 异常类型
|
||||
String type = whereJson.getString("type");
|
||||
RLock lock = redissonClient.getLock("acs_to_wms_two_c:" + type);
|
||||
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
|
||||
|
||||
try {
|
||||
if (tryLock) {
|
||||
|
||||
SchBaseTask taskDao = taskService.getOne(
|
||||
new QueryWrapper<SchBaseTask>().lambda()
|
||||
.eq(SchBaseTask::getTask_code, whereJson.getString("task_code"))
|
||||
);
|
||||
|
||||
String point_code = "";
|
||||
// 判断任务类型
|
||||
if (taskDao.getTask_type().equals(TASKEnum.BOX_TYPE.code("木箱入库"))) {
|
||||
// 木箱入库:满入、浅货位有货-放货时
|
||||
if (type.equals("1") || type.equals("4")) {
|
||||
point_code = inBoxManageService.taskExceptional(whereJson);
|
||||
}
|
||||
} else if (taskDao.getTask_type().equals(TASKEnum.BOX_TYPE.code("木箱出库"))) {
|
||||
// 木箱出库:空出、浅货位有货-取货时
|
||||
if (type.equals("2") || type.equals("3")) {
|
||||
point_code = outBoxManageService.taskExceptional(whereJson);
|
||||
}
|
||||
} else if (taskDao.getTask_type().equals(TASKEnum.VEHICLE_TYPE.code("托盘入库"))) {
|
||||
// 托盘入库:满入、浅货位有货-放货时
|
||||
if (type.equals("1") || type.equals("4")) {
|
||||
point_code = inVehicleManageService.taskExceptional(whereJson);
|
||||
}
|
||||
} else if (taskDao.getTask_type().equals(TASKEnum.VEHICLE_TYPE.code("托盘出库"))) {
|
||||
// 托盘出库:空出、浅货位有货-取货时
|
||||
if (type.equals("2") || type.equals("3")) {
|
||||
point_code = outVehicleManageService.taskExceptional(whereJson);
|
||||
}
|
||||
} else if (taskDao.getTask_type().equals(TASKEnum.PROUD_TYPE.code("成品入库"))) {
|
||||
// 成品入库:满入、浅货位有货-放货时
|
||||
if (type.equals("1") || type.equals("4")) {
|
||||
point_code = inBussManageService.taskExceptional(whereJson);
|
||||
}
|
||||
}
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "下发成功!");
|
||||
result.put("point_code", point_code);
|
||||
log.info("deviceApplyExceptional返回参数:---------------------------------------------" + result.toString());
|
||||
return result;
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
result.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
result.put("message", "申请任务超时!" + type);
|
||||
log.info("deviceApplyExceptional返回参数:---------------------------------------------" + result.toString());
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user