add:增加二次分配请求频繁处理
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package org.nl.b_lms.pdm.subpackagerelation.service.impl;
|
package org.nl.b_lms.pdm.subpackagerelation.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@@ -20,6 +21,7 @@ import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
|||||||
import org.nl.b_lms.sch.tasks.first_floor_area.*;
|
import org.nl.b_lms.sch.tasks.first_floor_area.*;
|
||||||
import org.nl.b_lms.sch.tasks.first_floor_area.auto.TaskQueueManager;
|
import org.nl.b_lms.sch.tasks.first_floor_area.auto.TaskQueueManager;
|
||||||
import org.nl.b_lms.sch.tasks.first_floor_area.auto.TaskQueue;
|
import org.nl.b_lms.sch.tasks.first_floor_area.auto.TaskQueue;
|
||||||
|
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.database.service.dao.BstIvtBoxinfo;
|
||||||
import org.nl.b_lms.storage_manage.database.service.dao.mapper.BstIvtBoxinfoMapper;
|
import org.nl.b_lms.storage_manage.database.service.dao.mapper.BstIvtBoxinfoMapper;
|
||||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.OutBoxManageService;
|
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.OutBoxManageService;
|
||||||
@@ -30,6 +32,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
import org.nl.system.service.param.ISysParamService;
|
import org.nl.system.service.param.ISysParamService;
|
||||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -62,7 +65,8 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
|||||||
@Resource
|
@Resource
|
||||||
private ISysParamService iSysParamService;
|
private ISysParamService iSysParamService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IBstIvtBoxinfoService iBstIvtBoxinfoService;
|
||||||
@Resource
|
@Resource
|
||||||
private DjqTask djqTask;
|
private DjqTask djqTask;
|
||||||
@Resource
|
@Resource
|
||||||
@@ -322,9 +326,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
|||||||
boxInfo.put("material_code", boxType);
|
boxInfo.put("material_code", boxType);
|
||||||
boxInfo.put("num", entityList.size());
|
boxInfo.put("num", entityList.size());
|
||||||
String boxSn = outBoxManageService.outBox(boxInfo);
|
String boxSn = outBoxManageService.outBox(boxInfo);
|
||||||
if (StringUtils.isBlank(boxSn)) {
|
|
||||||
throw new BadRequestException("装箱区 -> 装箱对接位,木箱码不能为空!");
|
|
||||||
}
|
|
||||||
//更新及子卷包装状态已分配规格及木箱规格组
|
//更新及子卷包装状态已分配规格及木箱规格组
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||||
import org.redisson.api.RLock;
|
import org.redisson.api.RLock;
|
||||||
import org.redisson.api.RedissonClient;
|
import org.redisson.api.RedissonClient;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
@@ -241,8 +242,6 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
|
|||||||
* @return 新的点位
|
* @return 新的点位
|
||||||
*/
|
*/
|
||||||
private String getNewPoint(String taskCode, String actionType) {
|
private String getNewPoint(String taskCode, String actionType) {
|
||||||
BstIvtPackageinfoivt newPoint = new BstIvtPackageinfoivt();
|
|
||||||
String taskPointType = null;
|
|
||||||
//执行中的任务
|
//执行中的任务
|
||||||
SchBaseTask baseTask = taskService.getOne(new LambdaQueryWrapper<SchBaseTask>()
|
SchBaseTask baseTask = taskService.getOne(new LambdaQueryWrapper<SchBaseTask>()
|
||||||
.eq(SchBaseTask::getTask_code, taskCode)
|
.eq(SchBaseTask::getTask_code, taskCode)
|
||||||
@@ -250,6 +249,18 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
|
|||||||
if (baseTask == null) {
|
if (baseTask == null) {
|
||||||
throw new BadRequestException("该任务未执行或不存在!");
|
throw new BadRequestException("该任务未执行或不存在!");
|
||||||
}
|
}
|
||||||
|
//已分配过二次分配点位
|
||||||
|
if (StringUtils.isNotBlank(baseTask.getRequest_param())) {
|
||||||
|
if (baseTask.getRequest_param().equals(IOSEnum.IS_SEND.code("是"))) {
|
||||||
|
if (PackageInfoIvtEnum.TASK_ACTION_TYPE.code("取货分配").equals(actionType)) {
|
||||||
|
return baseTask.getPoint_code1();
|
||||||
|
} else if (PackageInfoIvtEnum.TASK_ACTION_TYPE.code("放货分配").equals(actionType)) {
|
||||||
|
return baseTask.getPoint_code2();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BstIvtPackageinfoivt newPoint = new BstIvtPackageinfoivt();
|
||||||
|
String taskPointType = null;
|
||||||
//空载具缓存位特殊二次分配逻辑:先判断是否有执行中的行架任务,有就分配行架搬运起点,无就按顺序排序分配点位
|
//空载具缓存位特殊二次分配逻辑:先判断是否有执行中的行架任务,有就分配行架搬运起点,无就按顺序排序分配点位
|
||||||
if (baseTask.getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("补空(管制区->空载具缓存位)")) ||
|
if (baseTask.getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("补空(管制区->空载具缓存位)")) ||
|
||||||
baseTask.getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("补空(待检区->空载具缓存位)"))
|
baseTask.getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("补空(待检区->空载具缓存位)"))
|
||||||
@@ -286,6 +297,7 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
|
|||||||
} else if (PackageInfoIvtEnum.TASK_ACTION_TYPE.code("放货分配").equals(actionType)) {
|
} else if (PackageInfoIvtEnum.TASK_ACTION_TYPE.code("放货分配").equals(actionType)) {
|
||||||
baseTask.setPoint_code2(newPoint.getPoint_code());
|
baseTask.setPoint_code2(newPoint.getPoint_code());
|
||||||
}
|
}
|
||||||
|
baseTask.setRequest_param(IOSEnum.IS_SEND.code("是"));
|
||||||
taskService.updateById(baseTask);
|
taskService.updateById(baseTask);
|
||||||
return newPoint.getPoint_code();
|
return newPoint.getPoint_code();
|
||||||
} else {
|
} else {
|
||||||
@@ -441,11 +453,19 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
|
|||||||
}
|
}
|
||||||
//取货任务
|
//取货任务
|
||||||
if (actionType.equals(PackageInfoIvtEnum.TASK_ACTION_TYPE.code("取货完成"))) {
|
if (actionType.equals(PackageInfoIvtEnum.TASK_ACTION_TYPE.code("取货完成"))) {
|
||||||
//清空起点库存状态
|
List<BstIvtPackageinfoivt> ivtList = packageinfoivtService.list(new LambdaQueryWrapper<BstIvtPackageinfoivt>()
|
||||||
bstIvtPackageinfoivtMapper.update(null, new UpdateWrapper<BstIvtPackageinfoivt>()
|
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
|
||||||
.setSql("ivt_status = '0', container_name = null")
|
.eq(BstIvtPackageinfoivt::getPoint_code, baseTask.getPoint_code1()));
|
||||||
.eq("point_code", baseTask.getPoint_code1()));
|
if (CollectionUtils.isEmpty(ivtList)) {
|
||||||
|
throw new BadRequestException("任务编号为:" + baseTask.getTask_code() + "取货完成的目标点位不存在!");
|
||||||
|
}
|
||||||
|
//只有子卷号相同才能清除库存
|
||||||
|
if (baseTask.getVehicle_code().equals(ivtList.get(0).getContainer_name())) {
|
||||||
|
//清空起点库存状态
|
||||||
|
bstIvtPackageinfoivtMapper.update(null, new UpdateWrapper<BstIvtPackageinfoivt>()
|
||||||
|
.setSql("ivt_status = '0', container_name = null")
|
||||||
|
.eq("point_code", baseTask.getPoint_code1()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,6 +93,9 @@ public class DjqTask extends AbstractAcsTask {
|
|||||||
if (schBaseTask == null) {
|
if (schBaseTask == null) {
|
||||||
throw new BadRequestException("满轴缓存位 -> 待检区完成接口任务号为空!");
|
throw new BadRequestException("满轴缓存位 -> 待检区完成接口任务号为空!");
|
||||||
}
|
}
|
||||||
|
if (schBaseTask.getTask_status().equals(TaskStatusEnum.FINISHED.getCode())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (StringUtils.isBlank(schBaseTask.getVehicle_code())) {
|
if (StringUtils.isBlank(schBaseTask.getVehicle_code())) {
|
||||||
throw new BadRequestException("满轴缓存位 -> 待检区,子卷号不能为空!");
|
throw new BadRequestException("满轴缓存位 -> 待检区,子卷号不能为空!");
|
||||||
}
|
}
|
||||||
@@ -217,9 +220,13 @@ public class DjqTask extends AbstractAcsTask {
|
|||||||
public void forceFinish(String taskId) {
|
public void forceFinish(String taskId) {
|
||||||
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>()
|
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>()
|
||||||
.eq(SchBaseTask::getTask_id, taskId), false);
|
.eq(SchBaseTask::getTask_id, taskId), false);
|
||||||
|
//todo 增加校验,完成状态不执行任何操作
|
||||||
if (schBaseTask == null) {
|
if (schBaseTask == null) {
|
||||||
throw new BadRequestException("满轴缓存位 -> 待检区强制完成接口任务号为空!");
|
throw new BadRequestException("满轴缓存位 -> 待检区强制完成接口任务号为空!");
|
||||||
}
|
}
|
||||||
|
if (schBaseTask.getTask_status().equals(TaskStatusEnum.FINISHED.getCode())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
updateTaskStatus(JSONObject.parseObject(JSON.toJSONString(schBaseTask)), TaskStatusEnum.FINISHED.getCode());
|
updateTaskStatus(JSONObject.parseObject(JSON.toJSONString(schBaseTask)), TaskStatusEnum.FINISHED.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -121,13 +121,13 @@ public class ZxqTask extends AbstractAcsTask {
|
|||||||
schBaseTask.setTask_status(TaskStatusEnum.EXECUTING.getCode());
|
schBaseTask.setTask_status(TaskStatusEnum.EXECUTING.getCode());
|
||||||
}
|
}
|
||||||
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||||
PdmBiSlittingproductionplan containerInfo = productionPlanService.getOne(new LambdaUpdateWrapper<PdmBiSlittingproductionplan>()
|
// PdmBiSlittingproductionplan containerInfo = productionPlanService.getOne(new LambdaUpdateWrapper<PdmBiSlittingproductionplan>()
|
||||||
.eq(PdmBiSlittingproductionplan::getContainer_name, schBaseTask.getVehicle_code()));
|
// .eq(PdmBiSlittingproductionplan::getContainer_name, schBaseTask.getVehicle_code()));
|
||||||
if (containerInfo == null) {
|
// if (containerInfo == null) {
|
||||||
throw new BadRequestException("该子卷信息不存在!");
|
// throw new BadRequestException("该子卷信息不存在!");
|
||||||
} else if (StrUtil.isEmpty(containerInfo.getContainer_name())) {
|
// } else if (StrUtil.isEmpty(containerInfo.getContainer_name())) {
|
||||||
throw new BadRequestException("子卷号不能为空!");
|
// throw new BadRequestException("子卷号不能为空!");
|
||||||
}
|
// }
|
||||||
//1.更改任务状态为完成
|
//1.更改任务状态为完成
|
||||||
schBaseTask.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
schBaseTask.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||||
//2.改变起点点位状态
|
//2.改变起点点位状态
|
||||||
|
|||||||
Reference in New Issue
Block a user