Merge branch 'refs/heads/b_lms' into master_merge
This commit is contained in:
@@ -16,8 +16,10 @@ import cn.hutool.core.date.DateUtil;
|
||||
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||
import org.nl.b_lms.sch.point.dao.mapper.BstIvtPackageinfoivtMapper;
|
||||
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
|
||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||
import org.nl.b_lms.sch.tasks.first_floor_area.ZxDjwTask;
|
||||
import org.nl.b_lms.sch.tasks.first_floor_area.ZxqTask;
|
||||
import org.nl.b_lms.sch.tasks.first_floor_area.auto.TaskQueueManager;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.OutBoxManageService;
|
||||
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
@@ -215,6 +217,7 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
//下发空木箱出库任务
|
||||
outBox1(entityList, packagerelationList, boxType);
|
||||
//transferToPacking1(packagerelationList);
|
||||
//outBox(entityList, packagerelationList, boxType);
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
@@ -225,9 +228,9 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
*/
|
||||
private void outBox1(List<String> entityList, List<PdmBiSubpackagerelation> packagerelationList, String boxType) {
|
||||
JSONObject boxInfo = new JSONObject();
|
||||
boxInfo.put("device_code", "ZXQ_1_1");
|
||||
boxInfo.put("material_code", "MX61103");
|
||||
String workorderId = "1597797877554483219";
|
||||
boxInfo.put("device_code", "ZXQ_2_1");
|
||||
boxInfo.put("material_code", "MX6510");
|
||||
//String workorderId = "1597797877554483219";
|
||||
//子卷个数
|
||||
boxInfo.put("num", "1");
|
||||
String boxSn = outBoxManageService.outBox(boxInfo);
|
||||
@@ -235,10 +238,10 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
throw new BadRequestException("库位 -> 装箱对接位,木箱码不能为空!");
|
||||
}
|
||||
//更新子卷包装关系更新木箱号
|
||||
UpdateWrapper<PdmBiSubpackagerelation> updateWrapper1 = new UpdateWrapper<>();
|
||||
updateWrapper1.set("package_box_sn", boxSn);
|
||||
updateWrapper1.eq("workorder_id", workorderId);
|
||||
pdmBiSubpackagerelationMapper.update(null, updateWrapper1);
|
||||
// UpdateWrapper<PdmBiSubpackagerelation> updateWrapper1 = new UpdateWrapper<>();
|
||||
// updateWrapper1.set("package_box_sn", boxSn);
|
||||
// updateWrapper1.eq("workorder_id", workorderId);
|
||||
// pdmBiSubpackagerelationMapper.update(null, updateWrapper1);
|
||||
}
|
||||
|
||||
|
||||
@@ -363,7 +366,7 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
.eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("待检区"))
|
||||
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
|
||||
.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("有子卷"))
|
||||
.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("合格品"))
|
||||
.orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||
Set<String> containerNames = packagerelationList.stream()
|
||||
.map(PdmBiSubpackagerelation::getContainer_name)
|
||||
@@ -371,28 +374,23 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
List<BstIvtPackageinfoivt> djqPoints = djqPointList.stream()
|
||||
.filter(djqPoint -> containerNames.contains(djqPoint.getContainer_name()))
|
||||
.collect(Collectors.toList());
|
||||
//下发agv任务
|
||||
//任务组id
|
||||
String groupId =deviceCode.substring(deviceCode.indexOf("_") + 1);
|
||||
List<SchBaseTask> schBaseTaskList =new ArrayList<>();
|
||||
//确定起点,安装装箱组标识加入任务队列
|
||||
djqPoints.forEach(r -> {
|
||||
//装箱区点位
|
||||
List<BstIvtPackageinfoivt> zxqPointList = packageinfoivtService
|
||||
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
.eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("装箱区"))
|
||||
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
|
||||
.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("空"))
|
||||
.eq(BstIvtPackageinfoivt::getBlock, deviceCode.substring(deviceCode.indexOf("_") + 1))
|
||||
.orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("待检区->装箱区"));
|
||||
jo.put("vehicle_code", r.getContainer_name());
|
||||
jo.put("point_code1", r.getPoint_code());
|
||||
//木箱号
|
||||
jo.put("vehicle_code2", boxSn);
|
||||
//装箱区没满,则确定起点与终点,如果满了则只确定起点
|
||||
if (CollectionUtils.isNotEmpty(zxqPointList)) {
|
||||
jo.put("point_code2", zxqPointList.get(0).getPoint_code());
|
||||
}
|
||||
zxqTask.createTask(jo);
|
||||
SchBaseTask task = zxqTask.dynamicCreateTask(jo);
|
||||
//增加任务到队列
|
||||
schBaseTaskList.add(task);
|
||||
});
|
||||
TaskQueueManager taskQueueManager = new TaskQueueManager();
|
||||
taskQueueManager.addTasksToQueue(deviceCode,schBaseTaskList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public interface IbstIvtPackageinfoivtService extends IService<BstIvtPackageinfo
|
||||
* @param ivtStatus 库存状态
|
||||
* @return List<BstIvtPackageinfoivt>
|
||||
*/
|
||||
List<BstIvtPackageinfoivt> checkEndPointTask(String ivtType, String ivtStatus);
|
||||
List<BstIvtPackageinfoivt> checkEndPointTask(String ivtType, String ivtStatus, String pointCode,String taskType);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -60,20 +60,32 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
|
||||
|
||||
|
||||
@Override
|
||||
public List<BstIvtPackageinfoivt> checkEndPointTask(String ivtType, String ivtStatus) {
|
||||
public List<BstIvtPackageinfoivt> checkEndPointTask(String ivtType, String ivtStatus, String pointCode,String taskType) {
|
||||
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = bstIvtPackageinfoivtMapper
|
||||
.selectList(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
|
||||
.eq(BstIvtPackageinfoivt::getPoint_status, ivtType)
|
||||
.eq(BstIvtPackageinfoivt::getIvt_status,ivtStatus)
|
||||
.eq(BstIvtPackageinfoivt::getIvt_status, ivtStatus)
|
||||
.orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||
List<SchBaseTask> taskList = taskService.list(new LambdaUpdateWrapper<SchBaseTask>()
|
||||
//未完成任务
|
||||
.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
|
||||
.and(
|
||||
r -> r.in(SchBaseTask::getPoint_code2, bstIvtPackageinfoivtList)
|
||||
));
|
||||
return bstIvtPackageinfoivtList.stream().filter(r->! taskList.stream().map(SchBaseTask::getPoint_code2).collect(Collectors.toSet()).contains(r.getPoint_code())).collect(Collectors.toList());
|
||||
if (pointCode.equals("1")) {
|
||||
List<SchBaseTask> taskList = taskService.list(new LambdaUpdateWrapper<SchBaseTask>()
|
||||
//起点未完成任务
|
||||
.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
|
||||
.eq(SchBaseTask::getTask_type, taskType)
|
||||
.and(
|
||||
r -> r.in(SchBaseTask::getPoint_code1, bstIvtPackageinfoivtList)
|
||||
));
|
||||
return bstIvtPackageinfoivtList.stream().filter(r -> !taskList.stream().map(SchBaseTask::getPoint_code1).collect(Collectors.toSet()).contains(r.getPoint_code())).collect(Collectors.toList());
|
||||
} else {
|
||||
List<SchBaseTask> taskList = taskService.list(new LambdaUpdateWrapper<SchBaseTask>()
|
||||
//终点未完成任务
|
||||
.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
|
||||
.eq(SchBaseTask::getTask_type, taskType)
|
||||
.and(
|
||||
r -> r.in(SchBaseTask::getPoint_code2, bstIvtPackageinfoivtList)
|
||||
));
|
||||
return bstIvtPackageinfoivtList.stream().filter(r -> !taskList.stream().map(SchBaseTask::getPoint_code2).collect(Collectors.toSet()).contains(r.getPoint_code())).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -91,8 +91,6 @@ public class TwoLashTask extends AbstractAcsTask {
|
||||
//第二次捆扎次数
|
||||
interaction_json.put("bindingTimes","1");
|
||||
interaction_json.put("isBinding", IOSEnum.IS_SEND.code("否"));
|
||||
|
||||
|
||||
char dtl_type = json.getString("task_type").charAt(json.getString("task_type").length() - 1);
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
|
||||
@@ -13,14 +13,12 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
|
||||
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
|
||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||
import org.nl.b_lms.sch.task.dto.SchBaseTaskVO;
|
||||
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.util.service.OutBoxManageService;
|
||||
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
@@ -75,8 +73,6 @@ public class DjqTask extends AbstractAcsTask {
|
||||
.remark(r.getRemark())
|
||||
.product_area(r.getProduct_area())
|
||||
.agv_system_type(PackageInfoIvtEnum.AGV_SYSTEM_TYPE.code("1楼诺宝任务"))
|
||||
//.truss_type(PackageInfoIvtEnum.TRUSS_TYPE.code("点对点任务"))
|
||||
//.dtl_type(r.getDtl_type())
|
||||
.interaction_json(JSON.parseObject(r.getRequest_param()))
|
||||
.build();
|
||||
resultList.add(dto);
|
||||
@@ -89,7 +85,7 @@ public class DjqTask extends AbstractAcsTask {
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getTask_id, taskObj.getString("task_id")), false);
|
||||
if (schBaseTask == null) {
|
||||
throw new BadRequestException("满轴缓存位 -> 待检区更新接口任务号为空!");
|
||||
throw new BadRequestException("满轴缓存位 -> 待检区完成接口任务号为空!");
|
||||
}
|
||||
if (StringUtils.isBlank(schBaseTask.getVehicle_code())) {
|
||||
throw new BadRequestException("满轴缓存位 -> 待检区,子卷号不能为空!");
|
||||
@@ -104,7 +100,8 @@ public class DjqTask extends AbstractAcsTask {
|
||||
//2.改变起点点位状态
|
||||
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code1()));
|
||||
//3更新库存记录
|
||||
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("有子卷")).set("container_name", schBaseTask.getVehicle_code()).eq("point_code", schBaseTask.getPoint_code2()));
|
||||
//todo 暂时改为质检合格品
|
||||
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("合格品")).set("container_name", schBaseTask.getVehicle_code()).eq("point_code", schBaseTask.getPoint_code2()));
|
||||
//4.判断是否存在确定起点的输送线->满轴缓存位任务,存在就下发任务
|
||||
List<SchBaseTask> taskList = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
//确定起点未下发
|
||||
|
||||
@@ -72,7 +72,7 @@ public class GzqTask extends AbstractAcsTask {
|
||||
.agv_system_type(PackageInfoIvtEnum.AGV_SYSTEM_TYPE.code("1楼诺宝任务"))
|
||||
//.truss_type(PackageInfoIvtEnum.TRUSS_TYPE.code("点对点任务"))
|
||||
//.dtl_type(r.getDtl_type())
|
||||
.interaction_json(JSON.parseObject(r.getRequest_param()))
|
||||
.interaction_json(JSON.parseObject(r.getRequest_param()))
|
||||
.build();
|
||||
resultList.add(dto);
|
||||
});
|
||||
@@ -84,7 +84,7 @@ public class GzqTask extends AbstractAcsTask {
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>().eq( SchBaseTask::getTask_id, taskObj.getString("task_id")), false);
|
||||
if (schBaseTask == null) {
|
||||
throw new BadRequestException("满轴缓存位 -> 管制区更新接口任务号为空!");
|
||||
throw new BadRequestException("满轴缓存位 -> 管制区完成接口任务号为空!");
|
||||
}
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
|
||||
@@ -28,14 +28,13 @@ import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* 3 目标空载具缓存位, 装箱区 -> 空载具缓存位 , 补空载具, agv任务
|
||||
* 3 目标空载具缓存位, 待检区或管制区 -> 空载具缓存位补空agv任务
|
||||
*
|
||||
* @author gbx
|
||||
* @since 2024-01-24
|
||||
@@ -77,8 +76,6 @@ public class KzjhcwTask extends AbstractAcsTask {
|
||||
.remark(r.getRemark())
|
||||
.product_area(r.getProduct_area())
|
||||
.agv_system_type(PackageInfoIvtEnum.AGV_SYSTEM_TYPE.code("1楼诺宝任务"))
|
||||
//.truss_type(PackageInfoIvtEnum.TRUSS_TYPE.code("点对点任务"))
|
||||
//.dtl_type(r.getDtl_type())
|
||||
.interaction_json(JSON.parseObject(r.getRequest_param()))
|
||||
.build();
|
||||
resultList.add(dto);
|
||||
@@ -91,7 +88,7 @@ public class KzjhcwTask extends AbstractAcsTask {
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getTask_id, taskObj.getString("task_id")), false);
|
||||
if (schBaseTask == null) {
|
||||
throw new BadRequestException("待检区或管制区 -> 空载具缓存位更新接口任务号为空!");
|
||||
throw new BadRequestException("待检区或管制区 -> 空载具缓存位完成接口任务号为空!");
|
||||
}
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
@@ -104,7 +101,7 @@ public class KzjhcwTask extends AbstractAcsTask {
|
||||
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code1()));
|
||||
//更新库存记录
|
||||
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空载具")).eq("point_code", schBaseTask.getPoint_code2()));
|
||||
//3.装箱区搬运空载具到空载具缓存位完毕,判断是否存在确定终点的空载具缓存位->输送线任务,存在就下发任务
|
||||
//3.待检区或管制区搬运空载具到空载具缓存位完毕,判断是否存在确定终点的空载具缓存位->输送线任务,存在就下发任务
|
||||
List<SchBaseTask> taskList = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
//确定终点未下发
|
||||
.eq(SchBaseTask::getTask_status, TaskStatusEnum.SURE_END.getCode())
|
||||
@@ -219,30 +216,39 @@ public class KzjhcwTask extends AbstractAcsTask {
|
||||
*/
|
||||
public void toKzjHcw(String pointCode) {
|
||||
//存在空载具缓存位无空载具的点位
|
||||
List<BstIvtPackageinfoivt> kzjIvtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("空载具缓存位"), PackageInfoIvtEnum.IVT_STATUS.code("空"));
|
||||
List<BstIvtPackageinfoivt> kzjIvtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("空载具缓存位"), PackageInfoIvtEnum.IVT_STATUS.code("空"), "2", PackageInfoIvtEnum.TASK_TYPE.code("取空(待检区或管制区->空载具缓存位)"));
|
||||
String pointCode1 = null;
|
||||
JSONObject toKzjHcwTask = new JSONObject();
|
||||
if (StringUtils.isNotBlank(pointCode)) {
|
||||
pointCode1 = pointCode;
|
||||
} else {
|
||||
//查询装箱区有空载具
|
||||
List<BstIvtPackageinfoivt> zxqPointList = packageinfoivtService
|
||||
//查询待检区有空载具
|
||||
List<BstIvtPackageinfoivt> djqPointList = packageinfoivtService
|
||||
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
.eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("装箱区"))
|
||||
.eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("待检区"))
|
||||
.eq(BstIvtPackageinfoivt::getIs_used, IOSEnum.IS_NOTANDYES.code("是"))
|
||||
.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("空载具")).orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||
//装箱区有空载具
|
||||
if (CollectionUtils.isNotEmpty(zxqPointList)) {
|
||||
pointCode1 = zxqPointList.get(0).getPoint_code();
|
||||
if (CollectionUtils.isNotEmpty(djqPointList)) {
|
||||
pointCode1 = djqPointList.get(0).getPoint_code();
|
||||
} else {
|
||||
//去管制区搬运空载具
|
||||
List<BstIvtPackageinfoivt> gzqPointList = packageinfoivtService
|
||||
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
.eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("管制区"))
|
||||
.eq(BstIvtPackageinfoivt::getIs_used, IOSEnum.IS_NOTANDYES.code("是"))
|
||||
.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("空载具")).orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||
if (CollectionUtils.isNotEmpty(gzqPointList)) {
|
||||
pointCode1 = gzqPointList.get(0).getPoint_code();
|
||||
}
|
||||
}
|
||||
//去待检区或管制区搬运空载具
|
||||
if (CollectionUtils.isNotEmpty(kzjIvtList) && pointCode1 != null) {
|
||||
toKzjHcwTask.put("point_code1", pointCode1);
|
||||
//送到到任意空载具缓存位
|
||||
toKzjHcwTask.put("point_code2", kzjIvtList.get(0).getPoint_code());
|
||||
toKzjHcwTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("取空(待检区或管制区->空载具缓存位)"));
|
||||
this.createTask(toKzjHcwTask);
|
||||
}
|
||||
}
|
||||
//去装箱区搬运空载具
|
||||
if (CollectionUtils.isNotEmpty(kzjIvtList) && pointCode1 != null) {
|
||||
toKzjHcwTask.put("point_code1", pointCode1);
|
||||
//送到到任意空载具缓存位
|
||||
toKzjHcwTask.put("point_code2", kzjIvtList.get(0).getPoint_code());
|
||||
toKzjHcwTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("取空(待检区->空载具缓存位)"));
|
||||
this.createTask(toKzjHcwTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,10 +95,7 @@ public class MzhcwTask extends AbstractAcsTask {
|
||||
.priority(r.getPriority())
|
||||
.remark(r.getRemark())
|
||||
.product_area(r.getProduct_area())
|
||||
//.agv_system_type(PackageInfoIvtEnum.AGV_SYSTEM_TYPE.code("1楼诺宝任务"))
|
||||
//.truss_type(PackageInfoIvtEnum.TRUSS_TYPE.code("点对点任务"))
|
||||
//.dtl_type(r.getDtl_type())
|
||||
.interaction_json(JSON.parseObject(r.getRequest_param()))
|
||||
.interaction_json(JSON.parseObject(r.getRequest_param()))
|
||||
.build();
|
||||
resultList.add(dto);
|
||||
});
|
||||
@@ -110,7 +107,7 @@ public class MzhcwTask extends AbstractAcsTask {
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getTask_id, taskObj.getString("task_id")), false);
|
||||
if (schBaseTask == null) {
|
||||
throw new BadRequestException("输送线点位 -> 满轴缓存位更新接口任务号为空!");
|
||||
throw new BadRequestException("输送线点位 -> 满轴缓存位完成接口任务号为空!");
|
||||
}
|
||||
// 执行中
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
@@ -121,64 +118,19 @@ public class MzhcwTask extends AbstractAcsTask {
|
||||
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
//1.更改任务状态为完成
|
||||
schBaseTask.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||
//2.改变起点点位状态
|
||||
//packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code1()));
|
||||
//更新库存记录
|
||||
//2.更新库存记录
|
||||
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("有子卷")).set("container_name", schBaseTask.getVehicle_code()).eq("point_code", schBaseTask.getPoint_code2()));
|
||||
//3.任务一、待检区AGV搬运任务,查询子卷信息,去分切计划表查找定级数据,桁架任务完成根据子卷定级创建AGV任务将满轴搬运至质检区或管制区
|
||||
// if (StringUtils.isBlank(schBaseTask.getVehicle_code())) {
|
||||
// throw new BadRequestException("子卷号不能为空!");
|
||||
// }
|
||||
//PdmBiSlittingproductionplan containerInfo = productionPlanService.getOne(new LambdaUpdateWrapper<PdmBiSlittingproductionplan>()
|
||||
//.eq(PdmBiSlittingproductionplan::getContainer_name, schBaseTask.getVehicle_code()));
|
||||
// if (containerInfo == null) {
|
||||
//todo 现场测试,子卷号不在包装关系表中
|
||||
// throw new BadRequestException("找不到子卷信息!");
|
||||
// }
|
||||
//子卷等级
|
||||
// String level = containerInfo.getLevel() == null ? "1" : containerInfo.getLevel();
|
||||
// if (Arrays.stream(ContainerLevelEnum.values()).noneMatch(enumItem -> enumItem.getCode().equals(level))) {
|
||||
// throw new BadRequestException("非法的子卷等级!");
|
||||
// }
|
||||
//String level ="1";
|
||||
//查询库位信息
|
||||
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = packageinfoivtService
|
||||
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
|
||||
.orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||
// JSONObject toDjqTask = new JSONObject();
|
||||
// //获取子卷号
|
||||
// toDjqTask.put("vehicle_code", schBaseTask.getVehicle_code());
|
||||
// // 判断子卷等级属于待检区还是管制区,创建满轴缓存位到待检区或管制区的agv任务
|
||||
// if (Stream.of(ContainerLevelEnum.BEST, ContainerLevelEnum.WELL, ContainerLevelEnum.COMMON).anyMatch(enumItem -> enumItem.getCode().equals(level))) {
|
||||
// List<BstIvtPackageinfoivt> djqPointList = bstIvtPackageinfoivtList.stream()
|
||||
// .filter(r -> PackageInfoIvtEnum.POINT_STATUS.code("待检区").equals(r.getPoint_status())
|
||||
// && PackageInfoIvtEnum.IVT_STATUS.code("空").equals(r.getIvt_status())&& r.getIs_used().equals(PackageInfoIvtEnum.IS_USED.code("启用"))).collect(Collectors.toList());
|
||||
// if (CollectionUtils.isEmpty(djqPointList)) {
|
||||
// throw new BadRequestException("待检区暂无空余库位!");
|
||||
// }
|
||||
// toDjqTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("满轴缓存位->待检区"));
|
||||
// toDjqTask.put("point_code1", schBaseTask.getPoint_code2());
|
||||
// toDjqTask.put("point_code2", djqPointList.get(0).getPoint_code());
|
||||
// // djqTask.createTask(toDjqTask);
|
||||
// } else if (Stream.of(ContainerLevelEnum.REWORK, ContainerLevelEnum.CONTROL).anyMatch(enumItem -> enumItem.getCode().equals(level))) {
|
||||
// List<BstIvtPackageinfoivt> gkqPointList = bstIvtPackageinfoivtList.stream()
|
||||
// .filter(r -> PackageInfoIvtEnum.POINT_STATUS.code("管制区").equals(r.getPoint_status())
|
||||
// && PackageInfoIvtEnum.IVT_STATUS.code("空").equals(r.getIvt_status())&& r.getIs_used().equals(PackageInfoIvtEnum.IS_USED.code("启用"))).collect(Collectors.toList());
|
||||
// if (CollectionUtils.isEmpty(gkqPointList)) {
|
||||
// throw new BadRequestException("管控区暂无空余库位!");
|
||||
// }
|
||||
// toDjqTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("满轴缓存位->管制区"));
|
||||
// toDjqTask.put("point_code1", schBaseTask.getPoint_code2());
|
||||
// toDjqTask.put("point_code2", gkqPointList.get(0).getPoint_code());
|
||||
// //gzqTask.createTask(toDjqTask);
|
||||
// }
|
||||
//createTaskToDjq(schBaseTask);
|
||||
//4.创建空载具到输送线任务,完成后需要创建空载具缓存位->输送线任务
|
||||
//如果是输送线->满轴缓存位任务
|
||||
if (schBaseTask.getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("输送线->满轴缓存位"))) {
|
||||
List<BstIvtPackageinfoivt> kzjPointList = bstIvtPackageinfoivtList.stream()
|
||||
.filter(r -> PackageInfoIvtEnum.POINT_STATUS.code("空载具缓存位").equals(r.getPoint_status())
|
||||
&& PackageInfoIvtEnum.IVT_STATUS.code("空载具").equals(r.getIvt_status())).collect(Collectors.toList());
|
||||
//如果是输送线->满轴缓存位任务
|
||||
List<BstIvtPackageinfoivt> kzjPointList = packageinfoivtService
|
||||
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
|
||||
.eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("空载具缓存位"))
|
||||
.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("空载具"))
|
||||
.orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||
JSONObject toSsxTask = new JSONObject();
|
||||
toSsxTask.put("acs_task_type", PackageInfoIvtEnum.ACS_TASK_TYPE.code("桁架任务"));
|
||||
toSsxTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("放空(空载具缓存位->输送线)"));
|
||||
@@ -192,49 +144,7 @@ public class MzhcwTask extends AbstractAcsTask {
|
||||
toSsxTask.put("point_code2", schBaseTask.getPoint_code1());
|
||||
ssxDjwTask.createTask(toSsxTask);
|
||||
} else {
|
||||
// //空载具缓存位空载具:判断是否有正在搬运空载具过来的任务,有的话不创建
|
||||
// //没有的话创建搬运空载具任务, 当任务完成的时候,补发桁架任务。
|
||||
// List<BstIvtPackageinfoivt> packageinfoivtList = packageinfoivtService.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
// .eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("空载具缓存位"))
|
||||
// .eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用")));
|
||||
// //todo 查找正在搬运到待检区的任务,假设只有一个
|
||||
// List<SchBaseTask> taskList = taskService.list(new LambdaUpdateWrapper<SchBaseTask>()
|
||||
// //执行中
|
||||
// .eq(SchBaseTask::getTask_status, TaskStatusEnum.EXECUTING.getCode())
|
||||
// .and(
|
||||
// r -> r.in(SchBaseTask::getPoint_code2, packageinfoivtList)
|
||||
// ));
|
||||
// //没有正在搬运空载具过来的任务,创建搬运空载具任务
|
||||
// if (CollectionUtils.isEmpty(taskList)) {
|
||||
// //查询待检区或管制区有空载具的
|
||||
// List<BstIvtPackageinfoivt> djqOrGzqPointList = packageinfoivtService
|
||||
// .list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
// .in(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("待检区"), PackageInfoIvtEnum.POINT_STATUS.code("管制区"))
|
||||
// .eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("空载具")).orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||
// List<BstIvtPackageinfoivt> djqPointList = djqOrGzqPointList.stream().filter(r -> r.getPoint_status().equals(PackageInfoIvtEnum.POINT_STATUS.code("待检区"))).collect(Collectors.toList());
|
||||
// //待检区库位有空载具
|
||||
// if (CollectionUtils.isNotEmpty(djqPointList)) {
|
||||
// List<BstIvtPackageinfoivt> kzjPoint = packageinfoivtList.stream()
|
||||
// .filter(r -> PackageInfoIvtEnum.IVT_STATUS.code("空载具").equals(r.getIvt_status()))
|
||||
// .sorted(Comparator.comparing(BstIvtPackageinfoivt::getSort_seq))
|
||||
// .collect(Collectors.toList());
|
||||
// //创建搬运空载具任务
|
||||
// JSONObject toKzjhcwTask = new JSONObject();
|
||||
// if (CollectionUtils.isNotEmpty(djqPointList)) {
|
||||
// //优先去待检区取空载具
|
||||
// toKzjhcwTask.put("point_code1", djqPointList.get(0).getPoint_code());
|
||||
// } else {
|
||||
//
|
||||
// toKzjhcwTask.put("point_code1", djqOrGzqPointList.get(0).getPoint_code());
|
||||
// }
|
||||
// toKzjhcwTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("取空(待检区->空载具缓存位)"));
|
||||
// //送到到任意空载具缓存位
|
||||
// toKzjhcwTask.put("point_code2", kzjPoint.get(0).getPoint_code());
|
||||
// //toKzjhcwTask.put("vehicle_code", containerInfo.getContainer_name());
|
||||
// toKzjhcwTask.put("vehicle_code", schBaseTask.getVehicle_code());
|
||||
// kzjhcwTask.createTask(toKzjhcwTask);
|
||||
// }
|
||||
//}
|
||||
//sendVehicle(schBaseTask);
|
||||
}
|
||||
} else {
|
||||
//四个点任务,改变pointCode3点位状态
|
||||
@@ -255,6 +165,100 @@ public class MzhcwTask extends AbstractAcsTask {
|
||||
taskService.update(schBaseTask);
|
||||
}
|
||||
|
||||
private void sendVehicle(SchBaseTask schBaseTask) {
|
||||
//空载具缓存位空载具:判断是否有正在搬运空载具过来的任务,有的话不创建
|
||||
//没有的话创建搬运空载具任务, 当任务完成的时候,补发桁架任务。
|
||||
List<BstIvtPackageinfoivt> packageinfoivtList = packageinfoivtService.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
.eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("空载具缓存位"))
|
||||
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用")));
|
||||
List<SchBaseTask> taskList = taskService.list(new LambdaUpdateWrapper<SchBaseTask>()
|
||||
//执行中
|
||||
.eq(SchBaseTask::getTask_status, TaskStatusEnum.EXECUTING.getCode())
|
||||
.and(
|
||||
r -> r.in(SchBaseTask::getPoint_code2, packageinfoivtList)
|
||||
));
|
||||
//没有正在搬运空载具过来的任务,创建搬运空载具任务
|
||||
if (CollectionUtils.isEmpty(taskList)) {
|
||||
//查询待检区或管制区有空载具的
|
||||
List<BstIvtPackageinfoivt> djqOrGzqPointList = packageinfoivtService
|
||||
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
.in(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("待检区"), PackageInfoIvtEnum.POINT_STATUS.code("管制区"))
|
||||
.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("空载具")).orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||
List<BstIvtPackageinfoivt> djqPointList = djqOrGzqPointList.stream().filter(r -> r.getPoint_status().equals(PackageInfoIvtEnum.POINT_STATUS.code("待检区"))).collect(Collectors.toList());
|
||||
//待检区库位有空载具
|
||||
if (CollectionUtils.isNotEmpty(djqPointList)) {
|
||||
List<BstIvtPackageinfoivt> kzjPoint = packageinfoivtList.stream()
|
||||
.filter(r -> PackageInfoIvtEnum.IVT_STATUS.code("空载具").equals(r.getIvt_status()))
|
||||
.sorted(Comparator.comparing(BstIvtPackageinfoivt::getSort_seq))
|
||||
.collect(Collectors.toList());
|
||||
//创建搬运空载具任务
|
||||
JSONObject toKzjHcwTask = new JSONObject();
|
||||
if (CollectionUtils.isNotEmpty(djqPointList)) {
|
||||
//优先去待检区取空载具
|
||||
toKzjHcwTask.put("point_code1", djqPointList.get(0).getPoint_code());
|
||||
} else {
|
||||
|
||||
toKzjHcwTask.put("point_code1", djqOrGzqPointList.get(0).getPoint_code());
|
||||
}
|
||||
toKzjHcwTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("取空(待检区或管制区->空载具缓存位)"));
|
||||
//送到到任意空载具缓存位
|
||||
toKzjHcwTask.put("point_code2", kzjPoint.get(0).getPoint_code());
|
||||
//toKzjHcwTask.put("vehicle_code", containerInfo.getContainer_name());
|
||||
toKzjHcwTask.put("vehicle_code", schBaseTask.getVehicle_code());
|
||||
kzjhcwTask.createTask(toKzjHcwTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void createTaskToDjq(SchBaseTask schBaseTask) {
|
||||
if (StringUtils.isBlank(schBaseTask.getVehicle_code())) {
|
||||
throw new BadRequestException("子卷号不能为空!");
|
||||
}
|
||||
PdmBiSlittingproductionplan containerInfo = productionPlanService.getOne(new LambdaUpdateWrapper<PdmBiSlittingproductionplan>()
|
||||
.eq(PdmBiSlittingproductionplan::getContainer_name, schBaseTask.getVehicle_code()));
|
||||
if (containerInfo == null) {
|
||||
throw new BadRequestException("找不到子卷信息!");
|
||||
}
|
||||
//子卷等级
|
||||
String level = containerInfo.getLevel() == null ? "1" : containerInfo.getLevel();
|
||||
if (Arrays.stream(ContainerLevelEnum.values()).noneMatch(enumItem -> enumItem.getCode().equals(level))) {
|
||||
throw new BadRequestException("非法的子卷等级!");
|
||||
}
|
||||
//查询库位信息
|
||||
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = packageinfoivtService
|
||||
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
|
||||
.orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||
JSONObject toDjqTask = new JSONObject();
|
||||
//获取子卷号
|
||||
toDjqTask.put("vehicle_code", schBaseTask.getVehicle_code());
|
||||
// 判断子卷等级属于待检区还是管制区,创建满轴缓存位到待检区或管制区的agv任务
|
||||
if (Stream.of(ContainerLevelEnum.BEST, ContainerLevelEnum.WELL, ContainerLevelEnum.COMMON).anyMatch(enumItem -> enumItem.getCode().equals(level))) {
|
||||
List<BstIvtPackageinfoivt> djqPointList = bstIvtPackageinfoivtList.stream()
|
||||
.filter(r -> PackageInfoIvtEnum.POINT_STATUS.code("待检区").equals(r.getPoint_status())
|
||||
&& PackageInfoIvtEnum.IVT_STATUS.code("空").equals(r.getIvt_status()) && r.getIs_used().equals(PackageInfoIvtEnum.IS_USED.code("启用"))).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(djqPointList)) {
|
||||
throw new BadRequestException("待检区暂无空余库位!");
|
||||
}
|
||||
toDjqTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("满轴缓存位->待检区"));
|
||||
toDjqTask.put("point_code1", schBaseTask.getPoint_code2());
|
||||
toDjqTask.put("point_code2", djqPointList.get(0).getPoint_code());
|
||||
djqTask.createTask(toDjqTask);
|
||||
} else if (Stream.of(ContainerLevelEnum.REWORK, ContainerLevelEnum.CONTROL).anyMatch(enumItem -> enumItem.getCode().equals(level))) {
|
||||
List<BstIvtPackageinfoivt> gkqPointList = bstIvtPackageinfoivtList.stream()
|
||||
.filter(r -> PackageInfoIvtEnum.POINT_STATUS.code("管制区").equals(r.getPoint_status())
|
||||
&& PackageInfoIvtEnum.IVT_STATUS.code("空").equals(r.getIvt_status()) && r.getIs_used().equals(PackageInfoIvtEnum.IS_USED.code("启用"))).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(gkqPointList)) {
|
||||
throw new BadRequestException("管控区暂无空余库位!");
|
||||
}
|
||||
toDjqTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("满轴缓存位->管制区"));
|
||||
toDjqTask.put("point_code1", schBaseTask.getPoint_code2());
|
||||
toDjqTask.put("point_code2", gkqPointList.get(0).getPoint_code());
|
||||
gzqTask.createTask(toDjqTask);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createTask(JSONObject form) {
|
||||
Assert.notNull(form, "请求参数不能为空");
|
||||
@@ -331,36 +335,6 @@ public class MzhcwTask extends AbstractAcsTask {
|
||||
schBaseTask.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
taskService.update(schBaseTask);
|
||||
}
|
||||
/**
|
||||
* 满轴缓存位->待检区
|
||||
*/
|
||||
public void toDjq(String pointCode) {
|
||||
//查询空载具缓存位是否有空载具
|
||||
List<BstIvtPackageinfoivt> djQIvtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("待检区"), PackageInfoIvtEnum.IVT_STATUS.code("空"));
|
||||
String pointCode1 = null;
|
||||
JSONObject toDjqTask = new JSONObject();
|
||||
if (StringUtils.isNotBlank(pointCode)) {
|
||||
pointCode1 = pointCode;
|
||||
} else {
|
||||
//查询满轴位是否有子卷且不存在进行中的任务
|
||||
List<BstIvtPackageinfoivt> mzPointList = packageinfoivtService
|
||||
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
.eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("满轴缓存位"))
|
||||
.eq(BstIvtPackageinfoivt::getIs_used, IOSEnum.IS_NOTANDYES.code("是"))
|
||||
.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("有子卷")).orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||
//装箱区有空载具
|
||||
if (CollectionUtils.isNotEmpty(mzPointList)) {
|
||||
pointCode1 = mzPointList.get(0).getPoint_code();
|
||||
}
|
||||
}
|
||||
//去装箱区搬运空载具
|
||||
if (CollectionUtils.isNotEmpty(djQIvtList) && pointCode1 != null) {
|
||||
toDjqTask.put("point_code1", pointCode1);
|
||||
//送到到任意空载具缓存位
|
||||
toDjqTask.put("point_code2", djQIvtList.get(0).getPoint_code());
|
||||
toDjqTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("取空(待检区->空载具缓存位)"));
|
||||
this.createTask(toDjqTask);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
package org.nl.b_lms.sch.tasks.first_floor_area;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.BooleanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
|
||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||
import org.nl.b_lms.sch.task.dto.SchBaseTaskVO;
|
||||
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.sch.AcsTaskDto;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 7 目标待检区, 装箱区 -> 待检区或管制区送空载具,agv任务
|
||||
*
|
||||
* @author gbx
|
||||
* @since 2024-01-24
|
||||
*/
|
||||
@Service()
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class SendKzjTask extends AbstractAcsTask {
|
||||
@Resource
|
||||
private IschBaseTaskService taskService;
|
||||
@Resource
|
||||
private IbstIvtPackageinfoivtService packageinfoivtService;
|
||||
|
||||
private final String THIS_CLASS = SendKzjTask.class.getName();
|
||||
|
||||
@Override
|
||||
public List<AcsTaskDto> addTask() {
|
||||
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||
List<SchBaseTask> taskList = taskService.list(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getHandle_class, THIS_CLASS)
|
||||
.eq(SchBaseTask::getTask_status, TaskStatusEnum.START_AND_POINT.getCode())
|
||||
.eq(SchBaseTask::getIs_delete, 0)
|
||||
);
|
||||
taskList.forEach(r -> {
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.ext_task_id(r.getTask_id().toString())
|
||||
.task_code(r.getTask_code())
|
||||
.task_type(r.getAcs_task_type())
|
||||
.start_device_code(r.getPoint_code1())
|
||||
.next_device_code(r.getPoint_code2())
|
||||
.start_device_code2(r.getPoint_code3())
|
||||
.next_device_code2(r.getPoint_code4())
|
||||
.vehicle_code(r.getVehicle_code())
|
||||
.priority(r.getPriority())
|
||||
.remark(r.getRemark())
|
||||
.product_area(r.getProduct_area())
|
||||
.agv_system_type(PackageInfoIvtEnum.AGV_SYSTEM_TYPE.code("1楼诺宝任务"))
|
||||
.interaction_json(JSON.parseObject(r.getRequest_param()))
|
||||
.build();
|
||||
resultList.add(dto);
|
||||
});
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getTask_id, taskObj.getString("task_id")), false);
|
||||
if (schBaseTask == null) {
|
||||
throw new BadRequestException("装箱区->待检区或管制区送空载具完成接口任务号为空!");
|
||||
}
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
schBaseTask.setTask_status(TaskStatusEnum.EXECUTING.getCode());
|
||||
}
|
||||
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
//1.更改任务状态为完成
|
||||
schBaseTask.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||
//2.改变起点点位状态
|
||||
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code1()));
|
||||
//3.更新库存记录
|
||||
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空载具")).eq("point_code", schBaseTask.getPoint_code2()));
|
||||
}
|
||||
// 取消
|
||||
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
||||
if (Integer.parseInt(schBaseTask.getTask_status()) > Integer.parseInt(TaskStatusEnum.ISSUE.getCode())) {
|
||||
throw new BadRequestException("任务已执行不能取消");
|
||||
}
|
||||
//更新任务表删除字段
|
||||
schBaseTask.setIs_delete(IOSEnum.IS_NOTANDYES.code("是"));
|
||||
}
|
||||
schBaseTask.setUpdate_time(DateUtil.now());
|
||||
schBaseTask.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
schBaseTask.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
taskService.update(schBaseTask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createTask(JSONObject form) {
|
||||
Assert.notNull(form, "请求参数不能为空");
|
||||
String taskType = form.getString("task_type");
|
||||
if (StrUtil.isBlank(taskType)) {
|
||||
throw new BadRequestException("业务类型不能为空");
|
||||
}
|
||||
String vehicleCode = form.getString("vehicle_code");
|
||||
if (StrUtil.isBlank(vehicleCode)) {
|
||||
throw new BadRequestException("载具号不能为空");
|
||||
}
|
||||
String pointCode1 = form.getString("point_code1");
|
||||
if (StrUtil.isBlank(pointCode1)) {
|
||||
throw new BadRequestException("起点不能为空");
|
||||
}
|
||||
String pointCode2 = form.getString("point_code2");
|
||||
if (StrUtil.isBlank(pointCode2)) {
|
||||
throw new BadRequestException("下一点不能为空");
|
||||
}
|
||||
//是否立即下发
|
||||
boolean isSend = !StrUtil.isNotBlank(form.getString("is_send")) || BooleanUtil.toBoolean(form.getString("is_send"));
|
||||
SchBaseTaskVO schBaseTaskVo = SchBaseTaskVO.builder()
|
||||
.task_type(taskType)
|
||||
.vehicle_code(vehicleCode)
|
||||
.point_code1(pointCode1)
|
||||
.point_code2(pointCode2)
|
||||
.point_code3(form.getString("point_code3"))
|
||||
.point_code4(form.getString("point_code4"))
|
||||
.task_id(org.nl.common.utils.IdUtil.getStringId())
|
||||
.task_code(org.nl.common.utils.IdUtil.getStringId())
|
||||
.handle_class(THIS_CLASS)
|
||||
.create_id(SecurityUtils.getCurrentUserId())
|
||||
.create_name(SecurityUtils.getCurrentUsername())
|
||||
.create_time(DateUtil.now())
|
||||
.is_send(isSend ? "1" : "0")
|
||||
.acs_task_type(StrUtil.isEmpty(form.getString("acs_task_type")) ? PackageInfoIvtEnum.ACS_TASK_TYPE.code("agv任务") : form.getString("acs_task_type"))
|
||||
.task_status(StrUtil.isEmpty(form.getString("task_status")) ? TaskStatusEnum.START_AND_POINT.getCode() : form.getString("task_status"))
|
||||
.product_area(StrUtil.isEmpty(form.getString("product_area")) ? "B2" : form.getString("product_area"))
|
||||
.build();
|
||||
SchBaseTask task = new SchBaseTask();
|
||||
BeanUtils.copyProperties(schBaseTaskVo, task);
|
||||
taskService.save(task);
|
||||
//如果目标点位没有空位先创建不下发
|
||||
if (isSend) {
|
||||
this.immediateNotifyAcs(null);
|
||||
}
|
||||
return task.getTask_id();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void forceFinish(String taskId) {
|
||||
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskId), false);
|
||||
if (schBaseTask == null) {
|
||||
throw new BadRequestException("装箱区->待检区或管制区送空载具强制完成接口任务号为空!");
|
||||
}
|
||||
schBaseTask.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||
schBaseTask.setUpdate_time(DateUtil.now());
|
||||
schBaseTask.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
schBaseTask.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
taskService.update(schBaseTask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String taskId) {
|
||||
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskId), false);
|
||||
if (schBaseTask == null) {
|
||||
throw new BadRequestException("装箱区->待检区或管制区送空载具取消接口任务号为空!");
|
||||
}
|
||||
schBaseTask.setTask_status(IOSEnum.ACS_RESULT.code("取消"));
|
||||
schBaseTask.setUpdate_time(DateUtil.now());
|
||||
schBaseTask.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
schBaseTask.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
taskService.update(schBaseTask);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
|
||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||
@@ -50,10 +49,6 @@ public class SsxDjwTask extends AbstractAcsTask {
|
||||
private IbstIvtPackageinfoivtService packageinfoivtService;
|
||||
|
||||
|
||||
@Resource
|
||||
private KzjhcwTask kzjhcwTask;
|
||||
@Resource
|
||||
private SsxDjwTask ssxDjwTask;
|
||||
|
||||
|
||||
|
||||
@@ -77,10 +72,7 @@ public class SsxDjwTask extends AbstractAcsTask {
|
||||
.priority(r.getPriority())
|
||||
.remark(r.getRemark())
|
||||
.product_area(r.getProduct_area())
|
||||
//.agv_system_type(PackageInfoIvtEnum.AGV_SYSTEM_TYPE.code("1楼诺宝任务"))
|
||||
//.truss_type(PackageInfoIvtEnum.TRUSS_TYPE.code("点对点任务"))
|
||||
//.dtl_type(r.getDtl_type())
|
||||
.interaction_json(JSON.parseObject(r.getRequest_param()))
|
||||
.interaction_json(JSON.parseObject(r.getRequest_param()))
|
||||
.build();
|
||||
resultList.add(dto);
|
||||
});
|
||||
@@ -92,7 +84,7 @@ public class SsxDjwTask extends AbstractAcsTask {
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>().eq( SchBaseTask::getTask_id, taskObj.getString("task_id")), false);
|
||||
if (schBaseTask == null) {
|
||||
throw new BadRequestException("空载具缓存位 -> 输送线更新接口任务号为空!");
|
||||
throw new BadRequestException("空载具缓存位 -> 输送线完成接口任务号为空!");
|
||||
}
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
@@ -103,8 +95,6 @@ public class SsxDjwTask extends AbstractAcsTask {
|
||||
schBaseTask.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||
//2.改变起点点位状态
|
||||
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code1()));
|
||||
//更新库存记录
|
||||
//packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("有子卷")).set("container_name", schBaseTask.getVehicle_code()).eq("point_code", schBaseTask.getPoint_code2()));
|
||||
//3.空载具缓存位到输送线送空任务完成,去待检区或管制区补空载具
|
||||
// List<BstIvtPackageinfoivt> zxqPointList = packageinfoivtService
|
||||
// .list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
@@ -115,7 +105,7 @@ public class SsxDjwTask extends AbstractAcsTask {
|
||||
// //有空载具,创建搬运空载具任务
|
||||
// if (CollectionUtils.isNotEmpty(zxqPointList)) {
|
||||
// JSONObject toKzjhcwTask = new JSONObject();
|
||||
// toKzjhcwTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("取空(待检区->空载具缓存位)"));
|
||||
// toKzjhcwTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("取空(待检区或管制区->空载具缓存位)"));
|
||||
// toKzjhcwTask.put("point_code1", zxqPointList.get(0).getPoint_code());
|
||||
// //任务起点为补空载具终点
|
||||
// toKzjhcwTask.put("point_code2", schBaseTask.getPoint_code1());
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ZxDjwTask extends AbstractAcsTask {
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getTask_id, taskObj.getString("task_id")), false);
|
||||
if (schBaseTask == null) {
|
||||
throw new BadRequestException("装箱区 -> 装箱对接位更新接口任务号为空!");
|
||||
throw new BadRequestException("装箱区 -> 装箱对接位完成接口任务号为空!");
|
||||
}
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
|
||||
@@ -77,6 +77,56 @@ public class ZxqTask extends AbstractAcsTask {
|
||||
|
||||
private final String THIS_CLASS = ZxqTask.class.getName();
|
||||
|
||||
|
||||
public SchBaseTask dynamicCreateTask(JSONObject form) {
|
||||
Assert.notNull(form, "请求参数不能为空");
|
||||
String taskType = form.getString("task_type");
|
||||
if (StrUtil.isBlank(taskType)) {
|
||||
throw new BadRequestException("业务类型不能为空");
|
||||
}
|
||||
String vehicleCode = form.getString("vehicle_code");
|
||||
if (StrUtil.isBlank(vehicleCode)) {
|
||||
throw new BadRequestException("载具号不能为空");
|
||||
}
|
||||
String pointCode1 = form.getString("point_code1");
|
||||
if (StrUtil.isBlank(pointCode1)) {
|
||||
throw new BadRequestException("起点不能为空");
|
||||
}
|
||||
String pointCode2 = form.getString("point_code2");
|
||||
if (StrUtil.isBlank(pointCode2)) {
|
||||
throw new BadRequestException("下一点不能为空");
|
||||
}
|
||||
//是否立即下发
|
||||
boolean isSend = !StrUtil.isNotBlank(form.getString("is_send")) || BooleanUtil.toBoolean(form.getString("is_send"));
|
||||
SchBaseTaskVO schBaseTaskVo = SchBaseTaskVO.builder()
|
||||
.task_type(taskType)
|
||||
.vehicle_code(vehicleCode)
|
||||
.point_code1(pointCode1)
|
||||
.point_code2(pointCode2)
|
||||
.point_code3(form.getString("point_code3"))
|
||||
.point_code4(form.getString("point_code4"))
|
||||
.task_id(org.nl.common.utils.IdUtil.getStringId())
|
||||
.task_code(org.nl.common.utils.IdUtil.getStringId())
|
||||
.handle_class(THIS_CLASS)
|
||||
.create_id(SecurityUtils.getCurrentUserId())
|
||||
.create_name(SecurityUtils.getCurrentUsername())
|
||||
.create_time(DateUtil.now())
|
||||
.is_send(isSend ? "1" : "0")
|
||||
.request_param(form.getString("request_param"))
|
||||
.acs_task_type(StrUtil.isEmpty(form.getString("acs_task_type")) ? PackageInfoIvtEnum.ACS_TASK_TYPE.code("agv任务") : form.getString("acs_task_type"))
|
||||
.task_status(StrUtil.isEmpty(form.getString("task_status")) ? TaskStatusEnum.START_AND_POINT.getCode() : form.getString("task_status"))
|
||||
.product_area(StrUtil.isEmpty(form.getString("product_area")) ? "B2" : form.getString("product_area"))
|
||||
.build();
|
||||
SchBaseTask task = new SchBaseTask();
|
||||
BeanUtils.copyProperties(schBaseTaskVo, task);
|
||||
taskService.save(task);
|
||||
//如果目标点位没有空位先创建不下发
|
||||
if (isSend) {
|
||||
this.immediateNotifyAcs(null);
|
||||
}
|
||||
return task;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AcsTaskDto> addTask() {
|
||||
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||
@@ -112,7 +162,7 @@ public class ZxqTask extends AbstractAcsTask {
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getTask_id, taskObj.getString("task_id")), false);
|
||||
if (schBaseTask == null) {
|
||||
throw new BadRequestException("待检区 -> 装箱区更新接口任务号为空!");
|
||||
throw new BadRequestException("待检区 -> 装箱区完成接口任务号为空!");
|
||||
}
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
@@ -166,9 +216,6 @@ public class ZxqTask extends AbstractAcsTask {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//扩展参数
|
||||
JSONObject param = new JSONObject();
|
||||
//获取木箱信息,未包装的木箱
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
package org.nl.b_lms.sch.tasks.first_floor_area.auto;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
|
||||
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.first_floor_area.KzjhcwTask;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AutoSendEmptyVehicle {
|
||||
|
||||
@Resource
|
||||
private KzjhcwTask kzjhcwTask;
|
||||
|
||||
|
||||
public void run() {
|
||||
this.sendKzjHcwEmptyVehicle();
|
||||
}
|
||||
|
||||
//装箱区->待检区补空任务
|
||||
void sendKzjHcwEmptyVehicle() {
|
||||
kzjhcwTask.toKzjHcw("");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package org.nl.b_lms.sch.tasks.first_floor_area.auto;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
|
||||
import org.nl.b_lms.sch.tasks.first_floor_area.DjqTask;
|
||||
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AutoSendMzToDjq {
|
||||
|
||||
@Resource
|
||||
private DjqTask djqTask;
|
||||
|
||||
@Resource
|
||||
private IbstIvtPackageinfoivtService packageinfoivtService;
|
||||
|
||||
//满轴->待检区agv自动搬运任务
|
||||
public void run() {
|
||||
this.sendMzqToDjq();
|
||||
}
|
||||
|
||||
void sendMzqToDjq() {
|
||||
JSONObject toDjqTask =new JSONObject();
|
||||
//满轴有子卷且没有未完成任务
|
||||
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("满轴缓存位"), PackageInfoIvtEnum.IVT_STATUS.code("有子卷"), "1", PackageInfoIvtEnum.TASK_TYPE.code("满轴缓存位->待检区"));
|
||||
if (CollectionUtils.isNotEmpty(bstIvtPackageinfoivtList)) {
|
||||
List<BstIvtPackageinfoivt> djqPointList = bstIvtPackageinfoivtList.stream()
|
||||
.filter(r -> PackageInfoIvtEnum.POINT_STATUS.code("待检区").equals(r.getPoint_status())
|
||||
&& PackageInfoIvtEnum.IVT_STATUS.code("空").equals(r.getIvt_status()) && r.getIs_used().equals(PackageInfoIvtEnum.IS_USED.code("启用"))).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(djqPointList)) {
|
||||
toDjqTask.put("vehicle_code", bstIvtPackageinfoivtList.get(0).getContainer_name());
|
||||
toDjqTask.put("point_code1", bstIvtPackageinfoivtList.get(0).getPoint_code());
|
||||
toDjqTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("满轴缓存位->待检区"));
|
||||
toDjqTask.put("point_code2", djqPointList.get(0).getPoint_code());
|
||||
djqTask.createTask(toDjqTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
// void sendMzqToDjq() {
|
||||
// //满轴位有子卷
|
||||
// List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = bstIvtPackageinfoivtMapper
|
||||
// .selectList(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
// .eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
|
||||
// .eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("满轴缓存位"))
|
||||
// .eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("有子卷"))
|
||||
// .orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||
// if (CollectionUtils.isNotEmpty(bstIvtPackageinfoivtList)) {
|
||||
// String containerName = bstIvtPackageinfoivtList.get(0).getContainer_name();
|
||||
// String pointCode = bstIvtPackageinfoivtList.get(0).getPoint_code();
|
||||
// //查询子卷信息,去分切计划表查找定级数据,桁架任务完成根据子卷定级创建AGV任务将满轴搬运至质检区或管制区
|
||||
// PdmBiSlittingproductionplan containerInfo = productionPlanService.getOne(new LambdaUpdateWrapper<PdmBiSlittingproductionplan>()
|
||||
// .eq(PdmBiSlittingproductionplan::getContainer_name, containerName));
|
||||
// if (containerInfo == null) {
|
||||
// throw new BadRequestException("找不到子卷信息!");
|
||||
// }
|
||||
// //子卷等级
|
||||
// String level = containerInfo.getLevel() == null ? "1" : containerInfo.getLevel();
|
||||
// String finalLevel = level;
|
||||
// if (Arrays.stream(ContainerLevelEnum.values()).noneMatch(enumItem -> enumItem.getCode().equals(finalLevel))) {
|
||||
// throw new BadRequestException("非法的子卷等级!");
|
||||
// }
|
||||
// level = "1";
|
||||
// JSONObject toDjqTask = new JSONObject();
|
||||
// toDjqTask.put("vehicle_code", containerName);
|
||||
// // 判断子卷等级属于待检区还是管制区,创建满轴缓存位到待检区或管制区的agv任务
|
||||
// String finalLevel1 = level;
|
||||
// if (Stream.of(ContainerLevelEnum.BEST, ContainerLevelEnum.WELL, ContainerLevelEnum.COMMON).anyMatch(enumItem -> enumItem.getCode().equals(finalLevel1))) {
|
||||
// List<BstIvtPackageinfoivt> djqPointList = bstIvtPackageinfoivtList.stream()
|
||||
// .filter(r -> PackageInfoIvtEnum.POINT_STATUS.code("待检区").equals(r.getPoint_status())
|
||||
// && PackageInfoIvtEnum.IVT_STATUS.code("空").equals(r.getIvt_status()) && r.getIs_used().equals(PackageInfoIvtEnum.IS_USED.code("启用"))).collect(Collectors.toList());
|
||||
// if (CollectionUtils.isEmpty(djqPointList)) {
|
||||
// throw new BadRequestException("待检区暂无空余库位!");
|
||||
// }
|
||||
// toDjqTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("满轴缓存位->待检区"));
|
||||
// toDjqTask.put("point_code1", pointCode);
|
||||
// toDjqTask.put("point_code2", djqPointList.get(0).getPoint_code());
|
||||
// djqTask.createTask(toDjqTask);
|
||||
// } else {
|
||||
// String finalLevel2 = level;
|
||||
// if (Stream.of(ContainerLevelEnum.REWORK, ContainerLevelEnum.CONTROL).anyMatch(enumItem -> enumItem.getCode().equals(finalLevel2))) {
|
||||
// List<BstIvtPackageinfoivt> gkqPointList = bstIvtPackageinfoivtList.stream()
|
||||
// .filter(r -> PackageInfoIvtEnum.POINT_STATUS.code("管制区").equals(r.getPoint_status())
|
||||
// && PackageInfoIvtEnum.IVT_STATUS.code("空").equals(r.getIvt_status()) && r.getIs_used().equals(PackageInfoIvtEnum.IS_USED.code("启用"))).collect(Collectors.toList());
|
||||
// if (CollectionUtils.isEmpty(gkqPointList)) {
|
||||
// throw new BadRequestException("管控区暂无空余库位!");
|
||||
// }
|
||||
// toDjqTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("满轴缓存位->管制区"));
|
||||
// toDjqTask.put("point_code1", pointCode);
|
||||
// toDjqTask.put("point_code2", gkqPointList.get(0).getPoint_code());
|
||||
// gzqTask.createTask(toDjqTask);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
package org.nl.b_lms.sch.tasks.first_floor_area.auto;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproductionplanService;
|
||||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
|
||||
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||
import org.nl.b_lms.sch.point.dao.mapper.BstIvtPackageinfoivtMapper;
|
||||
import org.nl.b_lms.sch.tasks.first_floor_area.DjqTask;
|
||||
import org.nl.b_lms.sch.tasks.first_floor_area.GzqTask;
|
||||
import org.nl.common.enums.ContainerLevelEnum;
|
||||
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AutoSendToDjq {
|
||||
|
||||
@Resource
|
||||
private DjqTask djqTask;
|
||||
@Resource
|
||||
private GzqTask gzqTask;
|
||||
|
||||
@Resource
|
||||
private BstIvtPackageinfoivtMapper bstIvtPackageinfoivtMapper;
|
||||
|
||||
@Resource
|
||||
private IPdmBiSlittingproductionplanService productionPlanService;
|
||||
|
||||
public void run() {
|
||||
this.sendMzqToDjq();
|
||||
}
|
||||
|
||||
//装箱区->待检区补空任务
|
||||
void sendMzqToDjq() {
|
||||
// //满轴位有子卷
|
||||
// List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = bstIvtPackageinfoivtMapper
|
||||
// .selectList(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
// .eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
|
||||
// .eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("满轴缓存位"))
|
||||
// .eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("有子卷"))
|
||||
// .orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||
// if (CollectionUtils.isNotEmpty(bstIvtPackageinfoivtList)) {
|
||||
// String containerName = bstIvtPackageinfoivtList.get(0).getContainer_name();
|
||||
// String pointCode = bstIvtPackageinfoivtList.get(0).getPoint_code();
|
||||
// //查询子卷信息,去分切计划表查找定级数据,桁架任务完成根据子卷定级创建AGV任务将满轴搬运至质检区或管制区
|
||||
// PdmBiSlittingproductionplan containerInfo = productionPlanService.getOne(new LambdaUpdateWrapper<PdmBiSlittingproductionplan>()
|
||||
// .eq(PdmBiSlittingproductionplan::getContainer_name, containerName));
|
||||
// if (containerInfo == null) {
|
||||
// throw new BadRequestException("找不到子卷信息!");
|
||||
// }
|
||||
// //子卷等级
|
||||
// String level = containerInfo.getLevel() == null ? "1" : containerInfo.getLevel();
|
||||
// String finalLevel = level;
|
||||
// if (Arrays.stream(ContainerLevelEnum.values()).noneMatch(enumItem -> enumItem.getCode().equals(finalLevel))) {
|
||||
// throw new BadRequestException("非法的子卷等级!");
|
||||
// }
|
||||
// level = "1";
|
||||
// JSONObject toDjqTask = new JSONObject();
|
||||
// toDjqTask.put("vehicle_code", containerName);
|
||||
// // 判断子卷等级属于待检区还是管制区,创建满轴缓存位到待检区或管制区的agv任务
|
||||
// String finalLevel1 = level;
|
||||
// if (Stream.of(ContainerLevelEnum.BEST, ContainerLevelEnum.WELL, ContainerLevelEnum.COMMON).anyMatch(enumItem -> enumItem.getCode().equals(finalLevel1))) {
|
||||
// List<BstIvtPackageinfoivt> djqPointList = bstIvtPackageinfoivtList.stream()
|
||||
// .filter(r -> PackageInfoIvtEnum.POINT_STATUS.code("待检区").equals(r.getPoint_status())
|
||||
// && PackageInfoIvtEnum.IVT_STATUS.code("空").equals(r.getIvt_status()) && r.getIs_used().equals(PackageInfoIvtEnum.IS_USED.code("启用"))).collect(Collectors.toList());
|
||||
// if (CollectionUtils.isEmpty(djqPointList)) {
|
||||
// throw new BadRequestException("待检区暂无空余库位!");
|
||||
// }
|
||||
// toDjqTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("满轴缓存位->待检区"));
|
||||
// toDjqTask.put("point_code1", pointCode);
|
||||
// toDjqTask.put("point_code2", djqPointList.get(0).getPoint_code());
|
||||
// djqTask.createTask(toDjqTask);
|
||||
// } else {
|
||||
// String finalLevel2 = level;
|
||||
// if (Stream.of(ContainerLevelEnum.REWORK, ContainerLevelEnum.CONTROL).anyMatch(enumItem -> enumItem.getCode().equals(finalLevel2))) {
|
||||
// List<BstIvtPackageinfoivt> gkqPointList = bstIvtPackageinfoivtList.stream()
|
||||
// .filter(r -> PackageInfoIvtEnum.POINT_STATUS.code("管制区").equals(r.getPoint_status())
|
||||
// && PackageInfoIvtEnum.IVT_STATUS.code("空").equals(r.getIvt_status()) && r.getIs_used().equals(PackageInfoIvtEnum.IS_USED.code("启用"))).collect(Collectors.toList());
|
||||
// if (CollectionUtils.isEmpty(gkqPointList)) {
|
||||
// throw new BadRequestException("管控区暂无空余库位!");
|
||||
// }
|
||||
// toDjqTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("满轴缓存位->管制区"));
|
||||
// toDjqTask.put("point_code1", pointCode);
|
||||
// toDjqTask.put("point_code2", gkqPointList.get(0).getPoint_code());
|
||||
// gzqTask.createTask(toDjqTask);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package org.nl.b_lms.sch.tasks.first_floor_area.auto;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
|
||||
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AutoSendToZxq {
|
||||
|
||||
@Resource
|
||||
private IbstIvtPackageinfoivtService packageinfoivtService;
|
||||
|
||||
//待检区->装箱区agv自动搬运任务
|
||||
public void run() {
|
||||
this.sendDjqToZxq();
|
||||
}
|
||||
|
||||
void sendDjqToZxq() {
|
||||
//装箱区有空位
|
||||
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code("空"),"2",PackageInfoIvtEnum.IVT_STATUS.code("空"));
|
||||
if (CollectionUtils.isNotEmpty(bstIvtPackageinfoivtList)) {
|
||||
Map<String, List<String>> ivtList = bstIvtPackageinfoivtList.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
BstIvtPackageinfoivt::getPoint_code,
|
||||
LinkedHashMap::new,
|
||||
Collectors.mapping(BstIvtPackageinfoivt::getPoint_name, Collectors.toList())
|
||||
));
|
||||
TaskQueueManager taskQueueManager =new TaskQueueManager();
|
||||
taskQueueManager.processTasks(ivtList);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package org.nl.b_lms.sch.tasks.first_floor_area.auto;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
|
||||
import org.nl.b_lms.sch.tasks.first_floor_area.SendKzjTask;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AutoSendVehicleToDjq {
|
||||
|
||||
|
||||
@Resource
|
||||
private IbstIvtPackageinfoivtService packageinfoivtService;
|
||||
@Resource
|
||||
private SendKzjTask sendKzjTask;
|
||||
|
||||
//装箱区->待检区送空agv自动搬运任务
|
||||
public void run() {
|
||||
this.sendKzjHcwEmptyVehicle();
|
||||
}
|
||||
|
||||
|
||||
void sendKzjHcwEmptyVehicle() {
|
||||
JSONObject task = new JSONObject();
|
||||
String pointCode1=null;
|
||||
String pointCode2;
|
||||
//待检区有空位
|
||||
List<BstIvtPackageinfoivt> djqList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code("空"),"2",PackageInfoIvtEnum.TASK_TYPE.code("送空(装箱区->待检区或管制区)"));
|
||||
if (CollectionUtils.isNotEmpty(djqList)) {
|
||||
pointCode2=djqList.get(0).getPoint_code();
|
||||
}else{
|
||||
//管制区有空位
|
||||
List<BstIvtPackageinfoivt> zxqList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code("空"),"2",PackageInfoIvtEnum.TASK_TYPE.code("送空(装箱区->待检区或管制区)"));
|
||||
pointCode2=zxqList.get(0).getPoint_code();
|
||||
}
|
||||
//查询装箱区有空载具
|
||||
List<BstIvtPackageinfoivt> zxqPointList = packageinfoivtService
|
||||
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
.eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("装箱区"))
|
||||
.eq(BstIvtPackageinfoivt::getIs_used, IOSEnum.IS_NOTANDYES.code("是"))
|
||||
.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("空载具")).orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||
//装箱区有空载具
|
||||
if (CollectionUtils.isNotEmpty(zxqPointList)) {
|
||||
pointCode1 = zxqPointList.get(0).getPoint_code();
|
||||
}
|
||||
//去装箱区搬运空载具
|
||||
if (pointCode1 != null && pointCode2 != null) {
|
||||
task.put("point_code1", pointCode1);
|
||||
task.put("point_code2", pointCode2);
|
||||
task.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("送空(装箱区->待检区或管制区)"));
|
||||
sendKzjTask.createTask(task);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.nl.b_lms.sch.tasks.first_floor_area.auto;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.sch.tasks.first_floor_area.KzjhcwTask;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AutoSendVehicleToKz {
|
||||
|
||||
@Resource
|
||||
private KzjhcwTask kzjhcwTask;
|
||||
|
||||
|
||||
public void run() {
|
||||
this.sendToKzjHcw();
|
||||
}
|
||||
|
||||
//待检区->空轴缓存位送空agv自动搬运任务
|
||||
void sendToKzjHcw() {
|
||||
kzjhcwTask.toKzjHcw("");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package org.nl.b_lms.sch.tasks.first_floor_area.auto;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.first_floor_area.ZxqTask;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
@Service()
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class TaskQueueManager {
|
||||
|
||||
@Resource
|
||||
private IschBaseTaskService taskService;
|
||||
|
||||
private final Map<String, Queue<SchBaseTask>> taskGroupQueues;
|
||||
|
||||
public TaskQueueManager() {
|
||||
taskGroupQueues = new HashMap<>();
|
||||
}
|
||||
|
||||
|
||||
public void addTasksToQueue(String groupIdentifier, List<SchBaseTask> tasks) {
|
||||
if (!taskGroupQueues.containsKey(groupIdentifier)) {
|
||||
taskGroupQueues.put(groupIdentifier, new LinkedList<>());
|
||||
}
|
||||
Queue<SchBaseTask> queue = taskGroupQueues.get(groupIdentifier);
|
||||
queue.addAll(tasks);
|
||||
}
|
||||
|
||||
|
||||
public void processTasks(Map<String, List<String>> tasksToProcessPerQueue) {
|
||||
//队列剩余数量
|
||||
// int tasksCount = taskQueueManager.taskGroupQueues.getOrDefault("Group1", new LinkedList<>()).size();
|
||||
//队列为空
|
||||
// boolean isEmpty = taskQueueManager.taskGroupQueues.values().stream().allMatch(Queue::isEmpty);
|
||||
|
||||
for (Map.Entry<String, List<String>> entry : tasksToProcessPerQueue.entrySet()) {
|
||||
String groupId = entry.getKey();
|
||||
int taskCount = entry.getValue().size();
|
||||
Queue<SchBaseTask> queue = taskGroupQueues.get(groupId);
|
||||
if (queue == null) {
|
||||
continue;
|
||||
}
|
||||
int getCount = 0;
|
||||
while (!queue.isEmpty() && getCount < taskCount) {
|
||||
String PointCode = entry.getValue().get(getCount);
|
||||
//从队列中移除任务
|
||||
SchBaseTask task = queue.poll();
|
||||
executeTask(task, PointCode);
|
||||
getCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 执行任务
|
||||
private void executeTask(SchBaseTask task, String pointCode) {
|
||||
if (task != null) {
|
||||
UpdateWrapper<SchBaseTask> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.set("point_code2", pointCode);
|
||||
taskService.update(task, updateWrapper);
|
||||
ZxqTask taskBean = new ZxqTask();
|
||||
//任务下发
|
||||
taskBean.immediateNotifyAcs(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,9 @@
|
||||
`bst_ivt_cutpointivt` bct
|
||||
LEFT JOIN pdm_bi_slittingproductionplan p ON p.qzzno = bct.qzz_no1 OR p.qzzno = bct.qzz_no2
|
||||
WHERE bct.point_status = '2' AND p.parent_container_name = #{parent_container_name} AND p.split_group = #{split_group}
|
||||
AND (bct.qzz_no1 IS NULL OR bct.qzz_no1 = '' OR bct.qzz_no2 IS NULL OR bct.qzz_no2 = '')
|
||||
AND (LENGTH(bic.qzz_no1) = 0 OR LENGTH(bic.qzz_no2) = 0)
|
||||
AND (LENGTH(bic.qzz_no1) <![CDATA[ > ]]> 0 OR LENGTH(bic.qzz_no2) <![CDATA[ > ]]> 0)
|
||||
AND bct.is_used = '1'
|
||||
LIMIT 1
|
||||
</select>
|
||||
<select id="getSameGroupTaskPoint" resultType="java.lang.String">
|
||||
|
||||
@@ -217,8 +217,9 @@ public class InBussManageServiceImpl implements InBussManageService {
|
||||
|
||||
List<String> pcsnList = Arrays.asList(material_barcode.split(","));
|
||||
|
||||
|
||||
// 查询子卷包装关系
|
||||
List<JSONObject> subList = subTab.query("container_name in ('" + String.join("','", pcsnList) + "') and status in ('0','1')")
|
||||
List<JSONObject> subList = subTab.query("container_name ='A1652211050505A2' and status in ('0','1')")
|
||||
.getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
|
||||
if (ObjectUtil.isEmpty(subList)) {
|
||||
|
||||
@@ -20,9 +20,12 @@ public enum PackageInfoIvtEnum {
|
||||
//点位类型
|
||||
POINT_STATUS(MapOf.of("满轴缓存位", "1", "空载具缓存位", "2", "待检区", "3", "管制区", "4", "装箱区", "5", "装箱位", "6")),
|
||||
|
||||
|
||||
|
||||
|
||||
//任务类型
|
||||
TASK_TYPE(MapOf.of("输送线->满轴缓存位", "010901", "满轴缓存位->待检区", "010902", "满轴缓存位->管制区", "010903", "放空(空载具缓存位->输送线)",
|
||||
"010904", "取空(待检区->空载具缓存位)", "010905", "待检区->管制区", "010906","管制区->待检区", "010907","待检区->装箱区", "010908", "装箱区->装箱对接位", "010909","放空(装箱区->待检区)", "010910","输送线四个点任务", "010911")),
|
||||
"010904", "取空(待检区或管制区->空载具缓存位)", "010905", "待检区->管制区", "010906","管制区->待检区", "010907","待检区->装箱区", "010908", "装箱区->装箱对接位", "010909","放空(装箱区->待检区)", "010910","输送线四个点任务", "010911","送空(装箱区->待检区或管制区)", "010912")),
|
||||
|
||||
//ACS任务类型
|
||||
ACS_TASK_TYPE(MapOf.of("agv任务", "1", "桁架任务", "6")),
|
||||
@@ -40,7 +43,7 @@ public enum PackageInfoIvtEnum {
|
||||
POINT_LOCATION(MapOf.of("上", "0", "下", "1")),
|
||||
|
||||
//库存状态
|
||||
IVT_STATUS(MapOf.of("空", "0","空载具", "1","有子卷","2"));
|
||||
IVT_STATUS(MapOf.of("空", "0","空载具", "1","有子卷","2","合格品","3","管制品","4"));
|
||||
|
||||
|
||||
private Map<String, String> code;
|
||||
|
||||
@@ -31,6 +31,7 @@ public class AcsToWmsController {
|
||||
@Log(value = "ACS给WMS反馈任务状态", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> receiveTaskStatusAcs(@RequestBody String string) {
|
||||
log.info("ACS给WMS反馈任务状态:{}", string);
|
||||
return new ResponseEntity<>(acsToWmsService.receiveTaskStatusAcs(string), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@SneakyThrows
|
||||
public Map<String, Object> receiveTaskStatusAcs(String string) {
|
||||
log.info("receiveTaskStatusAcs请求参数:--------------------------------------" + string);
|
||||
log.info("acs向lms反馈任务状态,请求参数:--------------------------------------" + string);
|
||||
JSONArray array = JSONArray.parseArray(string);
|
||||
//返回处理失败的任务
|
||||
JSONArray errArr = new JSONArray();
|
||||
@@ -232,7 +232,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
result.put("message", "任务状态反馈成功!");
|
||||
result.put("data", new JSONObject());
|
||||
result.put("errArr", errArr);
|
||||
log.info("receiveTaskStatusAcs返回参数:--------------------------------------" + result.toString());
|
||||
log.info("acs向lms反馈任务状态,返回参数:--------------------------------------" + result.toString());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1792,7 +1792,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
// 如果满轴位没有可用的空点位,先创建一个桁架任务但是不下发,等这边空出来点位,判断是否有这种桁架任务然后补发;
|
||||
// 这个情况是有agv任务在搬去待检区或管制区的路上,还没有更新任务状态;需要查询是否有这种任务,等这个任务更新完后,
|
||||
// 再补发之前创建的输送线到满轴缓存位任务;
|
||||
log.info("sendProductToFirstFloor--------------------------:" + whereJson.toString());
|
||||
log.info("二楼到一楼,成品子卷到达一楼输送线,sendProductToFirstFloor--------------------------:" + whereJson.toString());
|
||||
JSONObject result = new JSONObject();
|
||||
if (StringUtils.isBlank(whereJson.getString("device_code")) || StringUtils.isBlank(whereJson.getString("material_barcode"))) {
|
||||
throw new BadRequestException("接口sendProductToFirstFloor,任务号或子卷号参数为空!");
|
||||
@@ -1866,6 +1866,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.info("二楼到一楼,成品子卷到达一楼输送线,异常,任务正在创建中");
|
||||
result.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
result.put("message", "任务正在创建中!");
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
ENV = 'development'
|
||||
|
||||
# 接口地址
|
||||
VUE_APP_BASE_API = 'http://localhost:9999'
|
||||
VUE_APP_WS_API = 'ws://localhost:9999'
|
||||
VUE_APP_BASE_API = 'http://localhost:8011'
|
||||
VUE_APP_WS_API = 'ws://localhost:8011'
|
||||
|
||||
# 是否启用 babel-plugin-dynamic-import-node插件
|
||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
package org.nl.b_lms.sch.tasks.first_floor_area;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.BooleanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
|
||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||
import org.nl.b_lms.sch.task.dto.SchBaseTaskVO;
|
||||
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.sch.AcsTaskDto;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 7 目标待检区, 装箱区 -> 待检区或管制区送空载具,agv任务
|
||||
*
|
||||
* @author gbx
|
||||
* @since 2024-01-24
|
||||
*/
|
||||
@Service()
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class SendKzjTask extends AbstractAcsTask {
|
||||
@Resource
|
||||
private IschBaseTaskService taskService;
|
||||
@Resource
|
||||
private IbstIvtPackageinfoivtService packageinfoivtService;
|
||||
|
||||
private final String THIS_CLASS = SendKzjTask.class.getName();
|
||||
|
||||
@Override
|
||||
public List<AcsTaskDto> addTask() {
|
||||
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||
List<SchBaseTask> taskList = taskService.list(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getHandle_class, THIS_CLASS)
|
||||
.eq(SchBaseTask::getTask_status, TaskStatusEnum.START_AND_POINT.getCode())
|
||||
.eq(SchBaseTask::getIs_delete, 0)
|
||||
);
|
||||
taskList.forEach(r -> {
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.ext_task_id(r.getTask_id().toString())
|
||||
.task_code(r.getTask_code())
|
||||
.task_type(r.getAcs_task_type())
|
||||
.start_device_code(r.getPoint_code1())
|
||||
.next_device_code(r.getPoint_code2())
|
||||
.start_device_code2(r.getPoint_code3())
|
||||
.next_device_code2(r.getPoint_code4())
|
||||
.vehicle_code(r.getVehicle_code())
|
||||
.priority(r.getPriority())
|
||||
.remark(r.getRemark())
|
||||
.product_area(r.getProduct_area())
|
||||
.agv_system_type(PackageInfoIvtEnum.AGV_SYSTEM_TYPE.code("1楼诺宝任务"))
|
||||
.interaction_json(JSON.parseObject(r.getRequest_param()))
|
||||
.build();
|
||||
resultList.add(dto);
|
||||
});
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getTask_id, taskObj.getString("task_id")), false);
|
||||
if (schBaseTask == null) {
|
||||
throw new BadRequestException("装箱区->待检区或管制区送空载具完成接口任务号为空!");
|
||||
}
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
schBaseTask.setTask_status(TaskStatusEnum.EXECUTING.getCode());
|
||||
}
|
||||
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
//1.更改任务状态为完成
|
||||
schBaseTask.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||
//2.改变起点点位状态
|
||||
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code1()));
|
||||
//3.更新库存记录
|
||||
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空载具")).eq("point_code", schBaseTask.getPoint_code2()));
|
||||
}
|
||||
// 取消
|
||||
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
||||
if (Integer.parseInt(schBaseTask.getTask_status()) > Integer.parseInt(TaskStatusEnum.ISSUE.getCode())) {
|
||||
throw new BadRequestException("任务已执行不能取消");
|
||||
}
|
||||
//更新任务表删除字段
|
||||
schBaseTask.setIs_delete(IOSEnum.IS_NOTANDYES.code("是"));
|
||||
}
|
||||
schBaseTask.setUpdate_time(DateUtil.now());
|
||||
schBaseTask.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
schBaseTask.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
taskService.update(schBaseTask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createTask(JSONObject form) {
|
||||
Assert.notNull(form, "请求参数不能为空");
|
||||
String taskType = form.getString("task_type");
|
||||
if (StrUtil.isBlank(taskType)) {
|
||||
throw new BadRequestException("业务类型不能为空");
|
||||
}
|
||||
String vehicleCode = form.getString("vehicle_code");
|
||||
if (StrUtil.isBlank(vehicleCode)) {
|
||||
throw new BadRequestException("载具号不能为空");
|
||||
}
|
||||
String pointCode1 = form.getString("point_code1");
|
||||
if (StrUtil.isBlank(pointCode1)) {
|
||||
throw new BadRequestException("起点不能为空");
|
||||
}
|
||||
String pointCode2 = form.getString("point_code2");
|
||||
if (StrUtil.isBlank(pointCode2)) {
|
||||
throw new BadRequestException("下一点不能为空");
|
||||
}
|
||||
//是否立即下发
|
||||
boolean isSend = !StrUtil.isNotBlank(form.getString("is_send")) || BooleanUtil.toBoolean(form.getString("is_send"));
|
||||
SchBaseTaskVO schBaseTaskVo = SchBaseTaskVO.builder()
|
||||
.task_type(taskType)
|
||||
.vehicle_code(vehicleCode)
|
||||
.point_code1(pointCode1)
|
||||
.point_code2(pointCode2)
|
||||
.point_code3(form.getString("point_code3"))
|
||||
.point_code4(form.getString("point_code4"))
|
||||
.task_id(org.nl.common.utils.IdUtil.getStringId())
|
||||
.task_code(org.nl.common.utils.IdUtil.getStringId())
|
||||
.handle_class(THIS_CLASS)
|
||||
.create_id(SecurityUtils.getCurrentUserId())
|
||||
.create_name(SecurityUtils.getCurrentUsername())
|
||||
.create_time(DateUtil.now())
|
||||
.is_send(isSend ? "1" : "0")
|
||||
.acs_task_type(StrUtil.isEmpty(form.getString("acs_task_type")) ? PackageInfoIvtEnum.ACS_TASK_TYPE.code("agv任务") : form.getString("acs_task_type"))
|
||||
.task_status(StrUtil.isEmpty(form.getString("task_status")) ? TaskStatusEnum.START_AND_POINT.getCode() : form.getString("task_status"))
|
||||
.product_area(StrUtil.isEmpty(form.getString("product_area")) ? "B2" : form.getString("product_area"))
|
||||
.build();
|
||||
SchBaseTask task = new SchBaseTask();
|
||||
BeanUtils.copyProperties(schBaseTaskVo, task);
|
||||
taskService.save(task);
|
||||
//如果目标点位没有空位先创建不下发
|
||||
if (isSend) {
|
||||
this.immediateNotifyAcs(null);
|
||||
}
|
||||
return task.getTask_id();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void forceFinish(String taskId) {
|
||||
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskId), false);
|
||||
if (schBaseTask == null) {
|
||||
throw new BadRequestException("装箱区->待检区或管制区送空载具强制完成接口任务号为空!");
|
||||
}
|
||||
schBaseTask.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||
schBaseTask.setUpdate_time(DateUtil.now());
|
||||
schBaseTask.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
schBaseTask.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
taskService.update(schBaseTask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String taskId) {
|
||||
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskId), false);
|
||||
if (schBaseTask == null) {
|
||||
throw new BadRequestException("装箱区->待检区或管制区送空载具取消接口任务号为空!");
|
||||
}
|
||||
schBaseTask.setTask_status(IOSEnum.ACS_RESULT.code("取消"));
|
||||
schBaseTask.setUpdate_time(DateUtil.now());
|
||||
schBaseTask.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
schBaseTask.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
taskService.update(schBaseTask);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.nl.b_lms.sch.tasks.first_floor_area.auto;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
|
||||
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||
import org.springframework.stereotype.Component;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AutoSendToZxq {
|
||||
|
||||
@Resource
|
||||
private IbstIvtPackageinfoivtService packageinfoivtService;
|
||||
|
||||
//待检区->装箱区agv自动搬运任务
|
||||
public void run() {
|
||||
this.sendDjqToZxq();
|
||||
}
|
||||
|
||||
void sendDjqToZxq() {
|
||||
//装箱区有空位
|
||||
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code("空"),"2",PackageInfoIvtEnum.IVT_STATUS.code("空"));
|
||||
if (CollectionUtils.isNotEmpty(bstIvtPackageinfoivtList)) {
|
||||
Map<String, List<String>> ivtList = bstIvtPackageinfoivtList.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
BstIvtPackageinfoivt::getPoint_code,
|
||||
LinkedHashMap::new,
|
||||
Collectors.mapping(BstIvtPackageinfoivt::getPoint_name, Collectors.toList())
|
||||
));
|
||||
TaskQueueManager taskQueueManager =new TaskQueueManager();
|
||||
taskQueueManager.processTasks(ivtList);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package org.nl.b_lms.sch.tasks.first_floor_area.auto;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
|
||||
import org.nl.b_lms.sch.tasks.first_floor_area.SendKzjTask;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||
import org.springframework.stereotype.Component;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AutoSendVehicleToDjq {
|
||||
|
||||
|
||||
@Resource
|
||||
private IbstIvtPackageinfoivtService packageinfoivtService;
|
||||
@Resource
|
||||
private SendKzjTask sendKzjTask;
|
||||
|
||||
//装箱区->待检区送空agv自动搬运任务
|
||||
public void run() {
|
||||
this.sendKzjHcwEmptyVehicle();
|
||||
}
|
||||
|
||||
|
||||
void sendKzjHcwEmptyVehicle() {
|
||||
JSONObject task = new JSONObject();
|
||||
String pointCode1=null;
|
||||
String pointCode2;
|
||||
//待检区有空位
|
||||
List<BstIvtPackageinfoivt> djqList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code("空"),"2",PackageInfoIvtEnum.TASK_TYPE.code("送空(装箱区->待检区或管制区)"));
|
||||
if (CollectionUtils.isNotEmpty(djqList)) {
|
||||
pointCode2=djqList.get(0).getPoint_code();
|
||||
}else{
|
||||
//管制区有空位
|
||||
List<BstIvtPackageinfoivt> zxqList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code("空"),"2",PackageInfoIvtEnum.TASK_TYPE.code("送空(装箱区->待检区或管制区)"));
|
||||
pointCode2=zxqList.get(0).getPoint_code();
|
||||
}
|
||||
//查询装箱区有空载具
|
||||
List<BstIvtPackageinfoivt> zxqPointList = packageinfoivtService
|
||||
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
.eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("装箱区"))
|
||||
.eq(BstIvtPackageinfoivt::getIs_used, IOSEnum.IS_NOTANDYES.code("是"))
|
||||
.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("空载具")).orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||
//装箱区有空载具
|
||||
if (CollectionUtils.isNotEmpty(zxqPointList)) {
|
||||
pointCode1 = zxqPointList.get(0).getPoint_code();
|
||||
}
|
||||
//去装箱区搬运空载具
|
||||
if (pointCode1 != null && pointCode2 != null) {
|
||||
task.put("point_code1", pointCode1);
|
||||
task.put("point_code2", pointCode2);
|
||||
task.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("送空(装箱区->待检区或管制区)"));
|
||||
sendKzjTask.createTask(task);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user