fix:出库问题处理
This commit is contained in:
@@ -247,46 +247,49 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
//均衡获取木箱出库装箱区对接位
|
||||
//= getPointCode(packagerelationList.size());
|
||||
String deviceCode = "ZXQ_1_1";
|
||||
try {
|
||||
List<String> workIdList = JSONObject.parseArray(whereJson.getJSONArray("tableMater").toJSONString(), PdmBiSubpackagerelation.class).stream()
|
||||
.map(PdmBiSubpackagerelation::getWorkorder_id)
|
||||
.map(String::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
//根据分切计划获取子卷重量计算理论毛重
|
||||
Set<String> containerNameList = packagerelationList.stream()
|
||||
.map(PdmBiSubpackagerelation::getContainer_name)
|
||||
.collect(Collectors.toSet());
|
||||
List<PdmBiSlittingproductionplan> planList = iPdmBiSlittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
||||
.in(PdmBiSlittingproductionplan::getContainer_name, containerNameList)
|
||||
.eq(PdmBiSlittingproductionplan::getIs_delete,IOSEnum.IS_NOTANDYES.code("否"))
|
||||
);
|
||||
|
||||
if (ObjectUtils.isEmpty(planList)) {
|
||||
throw new BadRequestException("子卷查询不到分切计划,请检查!");
|
||||
}
|
||||
BigDecimal totalWeight;
|
||||
totalWeight = planList.stream()
|
||||
.map(PdmBiSlittingproductionplan::getWeight)
|
||||
.filter(p -> p != null && !p.trim().isEmpty())
|
||||
.filter(r -> !r.isEmpty())
|
||||
.map(BigDecimal::new)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
if (totalWeight.compareTo(new BigDecimal(0)) == 0) {
|
||||
throw new BadRequestException("分切计划的子卷重量不能为0");
|
||||
}
|
||||
//获取子卷组号
|
||||
List<PdmBiSubpackagerelation> pdmBiSubpackagerelationList = pdmBiSubpackagerelationMapper
|
||||
.selectList(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getSale_order_name, packagerelationList.get(0).getSale_order_name()));
|
||||
Integer maxBoxGroup = pdmBiSubpackagerelationList.stream()
|
||||
.map(PdmBiSubpackagerelation::getBox_group)
|
||||
.filter(r -> r != null && !r.trim().isEmpty())
|
||||
.map(Integer::parseInt)
|
||||
.max(Integer::compareTo)
|
||||
.orElse(0) + 1;
|
||||
outBox(workIdList, containerNameList, deviceCode, maxBoxGroup, whereJson, totalWeight);
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException(e.getMessage());
|
||||
int count = taskService.count(new QueryWrapper<SchBaseTask>()
|
||||
.eq("point_code2", deviceCode)
|
||||
.eq("task_type", "010704")
|
||||
.lt("task_status", TaskStatusEnum.FINISHED.getCode()));
|
||||
if (count>2){
|
||||
throw new BadRequestException("当前装箱区木箱任务已满,稍后再试");
|
||||
}
|
||||
List<String> workIdList = JSONObject.parseArray(whereJson.getJSONArray("tableMater").toJSONString(), PdmBiSubpackagerelation.class).stream()
|
||||
.map(PdmBiSubpackagerelation::getWorkorder_id)
|
||||
.map(String::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
//根据分切计划获取子卷重量计算理论毛重
|
||||
Set<String> containerNameList = packagerelationList.stream()
|
||||
.map(PdmBiSubpackagerelation::getContainer_name)
|
||||
.collect(Collectors.toSet());
|
||||
List<PdmBiSlittingproductionplan> planList = iPdmBiSlittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
||||
.in(PdmBiSlittingproductionplan::getContainer_name, containerNameList)
|
||||
.eq(PdmBiSlittingproductionplan::getIs_delete,IOSEnum.IS_NOTANDYES.code("否"))
|
||||
);
|
||||
|
||||
if (ObjectUtils.isEmpty(planList)) {
|
||||
throw new BadRequestException("子卷查询不到分切计划,请检查!");
|
||||
}
|
||||
BigDecimal totalWeight;
|
||||
totalWeight = planList.stream()
|
||||
.map(PdmBiSlittingproductionplan::getWeight)
|
||||
.filter(p -> p != null && !p.trim().isEmpty())
|
||||
.filter(r -> !r.isEmpty())
|
||||
.map(BigDecimal::new)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
if (totalWeight.compareTo(new BigDecimal(0)) == 0) {
|
||||
throw new BadRequestException("分切计划的子卷重量不能为0");
|
||||
}
|
||||
//获取子卷组号
|
||||
List<PdmBiSubpackagerelation> pdmBiSubpackagerelationList = pdmBiSubpackagerelationMapper
|
||||
.selectList(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getSale_order_name, packagerelationList.get(0).getSale_order_name()));
|
||||
Integer maxBoxGroup = pdmBiSubpackagerelationList.stream()
|
||||
.map(PdmBiSubpackagerelation::getBox_group)
|
||||
.filter(r -> r != null && !r.trim().isEmpty())
|
||||
.map(Integer::parseInt)
|
||||
.max(Integer::compareTo)
|
||||
.orElse(0) + 1;
|
||||
outBox(workIdList, containerNameList, deviceCode, maxBoxGroup, whereJson, totalWeight);
|
||||
}
|
||||
|
||||
private void checkEntityList(JSONObject whereJson, List<PdmBiSubpackagerelation> packagerelationList) {
|
||||
@@ -326,7 +329,7 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
/**
|
||||
* 空木箱出库
|
||||
*/
|
||||
private void outBox(List<String> workIdList, Set<String> containerNameList, String deviceCode, Integer maxBoxGroup, JSONObject whereJson, BigDecimal totalWeight) {
|
||||
public void outBox(List<String> workIdList, Set<String> containerNameList, String deviceCode, Integer maxBoxGroup, JSONObject whereJson, BigDecimal totalWeight) {
|
||||
JSONObject boxInfo = new JSONObject();
|
||||
//确定木箱出库装箱区
|
||||
boxInfo.put("device_code", deviceCode);
|
||||
@@ -342,22 +345,8 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
totalWeight = totalWeight.add(boxWeight);
|
||||
//更新及子卷包装状态已分配规格及木箱规格组
|
||||
String weightTotal = totalWeight.toString();
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
updateBoxGroup(maxBoxGroup, workIdList, boxDao, weightTotal);
|
||||
} catch (Exception e) {
|
||||
log.error("子卷装箱异常,updateBoxGroup更新子卷包装关系异常,木箱号为:" + boxSn + ",异常信息:" + e);
|
||||
}
|
||||
}, pool);
|
||||
updateBoxGroup(maxBoxGroup, workIdList, boxDao, weightTotal);
|
||||
agvTransfer(containerNameList, deviceCode, boxSn);
|
||||
//待检区->装箱区agv任务
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
agvTransfer(containerNameList, deviceCode, boxSn);
|
||||
} catch (Exception e) {
|
||||
log.error("子卷装箱异常,agvTransfer待检区->装箱区agv确定起点任务创建异常,木箱号为:" + boxSn + ",异常信息:" + e);
|
||||
}
|
||||
}, pool);
|
||||
//给MES传输子卷包装关系
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
@@ -558,8 +547,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SneakyThrows
|
||||
protected void agvTransfer(Set<String> containerNameList, String deviceCode, String boxSn) {
|
||||
//待检区点位
|
||||
List<BstIvtPackageinfoivt> djqPointList = packageinfoivtService
|
||||
@@ -573,38 +560,26 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
.collect(Collectors.toList());
|
||||
//任务组id
|
||||
String groupId = deviceCode.substring(deviceCode.indexOf("_") + 1, deviceCode.indexOf("_", deviceCode.indexOf("_") + 1));
|
||||
RLock lock = redissonClient.getLock(groupId);
|
||||
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
//确定起点,安装装箱组标识加入任务队列
|
||||
String now = DateUtil.now();
|
||||
for (int i1 = 0; i1 < djqPoints.size(); i1++) {
|
||||
BstIvtPackageinfoivt item = djqPoints.get(i1);
|
||||
//校验重复任务
|
||||
List<SchBaseTask> taskList = taskService.list(new LambdaQueryWrapper<SchBaseTask>().eq(SchBaseTask::getVehicle_code, item.getContainer_name()).eq(SchBaseTask::getTask_type, PackageInfoIvtEnum.TASK_TYPE.code("待检区->装箱区"))
|
||||
.eq(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code("否")).lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode()));
|
||||
if (CollectionUtils.isEmpty(taskList)){
|
||||
JSONObject jo = new JSONObject();
|
||||
//确定搬运任务不执行
|
||||
jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("待检区->装箱区"));
|
||||
jo.put("vehicle_code", item.getContainer_name());
|
||||
jo.put("point_code1", item.getPoint_code());
|
||||
jo.put("date",now);
|
||||
jo.put("task_step",i1);
|
||||
jo.put("task_status", TaskStatusEnum.SURE_START.getCode());
|
||||
jo.put("vehicle_code2", groupId);
|
||||
zxqTask.createTaskReturnTask(jo);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.info("待检区->装箱区任务队列正在创建被锁住。");
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
String now = DateUtil.now();
|
||||
for (int i1 = 0; i1 < djqPoints.size(); i1++) {
|
||||
BstIvtPackageinfoivt item = djqPoints.get(i1);
|
||||
//校验重复任务
|
||||
List<SchBaseTask> taskList = taskService.list(new LambdaQueryWrapper<SchBaseTask>().eq(SchBaseTask::getVehicle_code, item.getContainer_name()).eq(SchBaseTask::getTask_type, PackageInfoIvtEnum.TASK_TYPE.code("待检区->装箱区"))
|
||||
.eq(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code("否")).lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode()));
|
||||
if (CollectionUtils.isEmpty(taskList)){
|
||||
JSONObject jo = new JSONObject();
|
||||
//确定搬运任务不执行
|
||||
jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("待检区->装箱区"));
|
||||
jo.put("vehicle_code", item.getContainer_name());
|
||||
jo.put("point_code1", item.getPoint_code());
|
||||
jo.put("date",now);
|
||||
jo.put("task_step",i1);
|
||||
jo.put("task_status", TaskStatusEnum.SURE_START.getCode());
|
||||
jo.put("vehicle_code2", groupId);
|
||||
zxqTask.createTaskReturnTask(jo);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -283,10 +283,7 @@ public class ZxqTask extends AbstractAcsTask {
|
||||
SchBaseTask task = new SchBaseTask();
|
||||
BeanUtils.copyProperties(schBaseTaskVo, task);
|
||||
taskService.save(task);
|
||||
//如果目标点位没有空位先创建不下发
|
||||
if (isSend) {
|
||||
this.immediateNotifyAcs(null);
|
||||
}
|
||||
|
||||
return task;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinvdis;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinvdtl;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.mapper.StIvtIostorinvMapper;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.InBussManageService;
|
||||
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;
|
||||
@@ -357,9 +358,10 @@ public class InBussManageServiceImpl implements InBussManageService {
|
||||
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);
|
||||
attrTab.update(
|
||||
MapOf.of("lock_type", IOSEnum.LOCK_TYPE.code("货位异常锁")
|
||||
,"update_time",DateUtil.now(),"remark",taskDao.getTask_id()+"满入申请")
|
||||
, "struct_code = '" + taskDao.getPoint_code2() + "'");
|
||||
|
||||
// 2.重新分配货位
|
||||
String iostorinv_id = disDaoList.get(0).get("iostorinv_id").toString();
|
||||
|
||||
Reference in New Issue
Block a user