opt:6.15上线装箱区代码修改
This commit is contained in:
@@ -17,10 +17,10 @@ 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.*;
|
||||
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.ContainerLevelEnum;
|
||||
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -36,6 +36,7 @@ import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
/**
|
||||
@@ -47,25 +48,39 @@ import java.util.stream.Collectors;
|
||||
@Service("pdmBiSubpackagerelationService")
|
||||
public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpackagerelationMapper, PdmBiSubpackagerelation> implements IpdmBiSubpackagerelationService {
|
||||
|
||||
|
||||
@Resource
|
||||
private ZxqTask zxqTask;
|
||||
@Resource
|
||||
private ZxDjwTask zxDjwTask;
|
||||
|
||||
@Resource
|
||||
private OutBoxManageService outBoxManageService;
|
||||
private ISysParamService iSysParamService;
|
||||
|
||||
@Resource
|
||||
private PdmBiSlittingproductionplanMapper pdmBiSlittingproductionplanMapper;
|
||||
private DjqTask djqTask;
|
||||
@Resource
|
||||
private GzqTask gzqTask;
|
||||
|
||||
@Resource
|
||||
private KzjhcwTask kzjhcwTask;
|
||||
|
||||
@Resource
|
||||
private OutBoxManageService outBoxManageService;
|
||||
|
||||
@Resource
|
||||
private IbstIvtPackageinfoivtService packageinfoivtService;
|
||||
|
||||
@Resource
|
||||
private PdmBiSubpackagerelationMapper pdmBiSubpackagerelationMapper;
|
||||
|
||||
|
||||
@Resource
|
||||
private PdmBiSlittingproductionplanMapper pdmBiSlittingproductionplanMapper;
|
||||
|
||||
|
||||
@Resource
|
||||
private BstIvtPackageinfoivtMapper bstIvtPackageinfoivtMapper;
|
||||
@Resource
|
||||
private ISysParamService iSysParamService;
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
@@ -148,9 +163,191 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
item.setBox_group("0");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//下发空木箱出库任务
|
||||
outBox1();
|
||||
|
||||
//满轴->待检
|
||||
//mzToDj();
|
||||
|
||||
//待检->装箱
|
||||
// djToZx();
|
||||
|
||||
//下发桁架任务1
|
||||
//transferToPacking1();
|
||||
|
||||
//下发桁架任务2
|
||||
//transferToPacking2();
|
||||
|
||||
|
||||
return pdmBiSubpackagerelationList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 满轴->待检
|
||||
*/
|
||||
public void mzToDj() {
|
||||
//子卷号
|
||||
String containerName = "A1382211300106C8";
|
||||
//起点
|
||||
String pointCode1 = "ZXQ_01";
|
||||
//查询库位信息
|
||||
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", containerName);
|
||||
List<BstIvtPackageinfoivt> djqPointList = bstIvtPackageinfoivtList.stream()
|
||||
.filter(r -> PackageInfoIvtEnum.POINT_STATUS.code("待检区").equals(r.getPoint_status())
|
||||
&& PackageInfoIvtEnum.IVT_STATUS.code("空").equals(r.getIvt_status())).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(djqPointList)) {
|
||||
toDjqTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("满轴缓存位->待检区"));
|
||||
toDjqTask.put("point_code1", pointCode1);
|
||||
toDjqTask.put("point_code2", djqPointList.get(0).getPoint_code());
|
||||
djqTask.createTask(toDjqTask);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 待检->装箱
|
||||
*/
|
||||
public void djToZx() {
|
||||
//子卷号
|
||||
String containerName = "";
|
||||
//起点
|
||||
String pointCode1 = "";
|
||||
//木箱
|
||||
String boxSn = "";
|
||||
//装箱区点位
|
||||
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("空"))
|
||||
//装箱区1
|
||||
.eq(BstIvtPackageinfoivt::getBlock, "1")
|
||||
.orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||
if (CollectionUtils.isNotEmpty(zxqPointList)) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("待检区->装箱区"));
|
||||
jo.put("vehicle_code", containerName);
|
||||
jo.put("point_code1", pointCode1);
|
||||
//木箱号
|
||||
jo.put("vehicle_code2", boxSn);
|
||||
jo.put("point_code2", zxqPointList.get(0).getPoint_code());
|
||||
zxqTask.createTask(jo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 空木箱出库
|
||||
*/
|
||||
private void outBox1() {
|
||||
JSONObject boxInfo = new JSONObject();
|
||||
boxInfo.put("device_code", "ZXQ_1_1");
|
||||
boxInfo.put("material_code", "MX61103");
|
||||
//子卷个数
|
||||
boxInfo.put("num", "1");
|
||||
String boxSn = outBoxManageService.outBox(boxInfo);
|
||||
if (StringUtils.isBlank(boxSn)) {
|
||||
throw new BadRequestException("库位 -> 装箱对接位,木箱码不能为空!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void transferToPacking1() {
|
||||
JSONObject jo = new JSONObject();
|
||||
//子卷号
|
||||
String containerName = "A1652211050505A2";
|
||||
//获取纸管长度
|
||||
String frpDescription = "1300";
|
||||
//获取木箱高度等级
|
||||
String height = "730";
|
||||
//起点
|
||||
String point_code1 = "ZXQ_1_9";
|
||||
//终点
|
||||
String point_code2 = "ZXQ_1_1";
|
||||
//托盘类型 1小托盘 2大托盘
|
||||
String containerType = "2";
|
||||
//木箱高度等级
|
||||
String heightLevel = "";
|
||||
String heightLevel1 = iSysParamService.findByCode("height_level_1").getValue();
|
||||
String heightLevel2 = iSysParamService.findByCode("height_level_2").getValue();
|
||||
if (Integer.parseInt(height) <= Integer.parseInt(heightLevel1)) {
|
||||
heightLevel = "1";
|
||||
} else if (Integer.parseInt(height) > Integer.parseInt(heightLevel1) && Integer.parseInt(height) <= Integer.parseInt(heightLevel2)) {
|
||||
heightLevel = "2";
|
||||
} else {
|
||||
heightLevel = "3";
|
||||
}
|
||||
jo.put("point_code1", point_code1);
|
||||
jo.put("point_code2", point_code2);
|
||||
jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("装箱区->装箱对接位"));
|
||||
jo.put("vehicle_code", containerName);
|
||||
jo.put("acs_task_type", PackageInfoIvtEnum.ACS_TASK_TYPE.code("桁架任务"));
|
||||
jo.put("is_send", "1");
|
||||
JSONObject param = new JSONObject();
|
||||
//木箱最大数量
|
||||
param.put("maxNo", "1");
|
||||
//木箱放入子卷数量
|
||||
param.put("boxNo", "1");
|
||||
//是否最后子卷
|
||||
param.put("lastOne", "1");
|
||||
//子卷号
|
||||
param.put("barcode", containerName);
|
||||
//子卷长度
|
||||
param.put("len", frpDescription);
|
||||
//木箱高度等级
|
||||
param.put("heightLevel", heightLevel);
|
||||
//托盘类型 1小托盘 2大托盘
|
||||
param.put("containerType", containerType);
|
||||
jo.put("request_param", param.toString());
|
||||
zxDjwTask.createTask(jo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 装箱区->装箱对接位桁架任务2
|
||||
*/
|
||||
|
||||
public void transferToPacking2() {
|
||||
//下发装箱区->装箱对接位桁架任务
|
||||
JSONObject jo = new JSONObject();
|
||||
//子卷号
|
||||
String containerName = "";
|
||||
//获取纸管长度
|
||||
String frpDescription = "";
|
||||
//起点
|
||||
String point_code1 = "ZXQ_1_8";
|
||||
//终点
|
||||
String point_code2 = "ZXQ_1_1";
|
||||
jo.put("point_code1", point_code1);
|
||||
jo.put("point_code2", point_code2);
|
||||
jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("装箱区->装箱对接位"));
|
||||
jo.put("vehicle_code", containerName);
|
||||
jo.put("acs_task_type", PackageInfoIvtEnum.ACS_TASK_TYPE.code("桁架任务"));
|
||||
jo.put("is_send", "1");
|
||||
JSONObject param = new JSONObject();
|
||||
//木箱最大数量
|
||||
param.put("maxNo", "1");
|
||||
//木箱放入子卷数量
|
||||
param.put("boxNo", "1");
|
||||
//是否最后子卷
|
||||
param.put("lastOne", "1");
|
||||
//子卷号
|
||||
param.put("barcode", containerName);
|
||||
//子卷长度
|
||||
param.put("len", frpDescription);
|
||||
//托盘类型 1小托盘 2大托盘
|
||||
param.put("containerType", "1");
|
||||
jo.put("request_param", param.toString());
|
||||
zxDjwTask.createTask(jo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建
|
||||
@@ -214,90 +411,12 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
updateWrapper.set("status", "0");
|
||||
updateWrapper.in("workorder_id", entityList);
|
||||
pdmBiSubpackagerelationMapper.update(null, updateWrapper);
|
||||
//下发空木箱出库任务
|
||||
outBox1(entityList, packagerelationList, boxType);
|
||||
//transferToPacking1(packagerelationList);
|
||||
//outBox(entityList, packagerelationList, boxType);
|
||||
// outBox(entityList, packagerelationList, boxType);
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 空木箱出库
|
||||
*/
|
||||
private void outBox1(List<String> entityList, List<PdmBiSubpackagerelation> packagerelationList, String boxType) {
|
||||
JSONObject boxInfo = new JSONObject();
|
||||
boxInfo.put("device_code", "ZXQ_2_1");
|
||||
boxInfo.put("material_code", "MX6510");
|
||||
//String workorderId = "1597797877554483219";
|
||||
//子卷个数
|
||||
boxInfo.put("num", "1");
|
||||
String boxSn = outBoxManageService.outBox(boxInfo);
|
||||
if (StringUtils.isBlank(boxSn)) {
|
||||
throw new BadRequestException("库位 -> 装箱对接位,木箱码不能为空!");
|
||||
}
|
||||
//更新子卷包装关系更新木箱号
|
||||
// UpdateWrapper<PdmBiSubpackagerelation> updateWrapper1 = new UpdateWrapper<>();
|
||||
// updateWrapper1.set("package_box_sn", boxSn);
|
||||
// updateWrapper1.eq("workorder_id", workorderId);
|
||||
// pdmBiSubpackagerelationMapper.update(null, updateWrapper1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void transferToPacking1(List<PdmBiSubpackagerelation> packagerelationList) {
|
||||
JSONObject jo = new JSONObject();
|
||||
//子卷号
|
||||
String containerName = "A1652211050505A2";
|
||||
//获取纸管长度
|
||||
String frpDescription = "1300";
|
||||
//获取木箱高度等级
|
||||
String height = "730";
|
||||
//起点
|
||||
String point_code1 = "ZXQ_1_9";
|
||||
//终点
|
||||
String point_code2 = "ZXQ_1_1";
|
||||
//托盘类型 1小托盘 2大托盘
|
||||
String containerType = "2";
|
||||
//木箱高度等级
|
||||
String heightLevel = "";
|
||||
String heightLevel1 = iSysParamService.findByCode("height_level_1").getValue();
|
||||
String heightLevel2 = iSysParamService.findByCode("height_level_2").getValue();
|
||||
if (Integer.parseInt(height) <= Integer.parseInt(heightLevel1)) {
|
||||
heightLevel = "1";
|
||||
} else if (Integer.parseInt(height) > Integer.parseInt(heightLevel1) && Integer.parseInt(height) <= Integer.parseInt(heightLevel2)) {
|
||||
heightLevel = "2";
|
||||
} else {
|
||||
heightLevel = "3";
|
||||
}
|
||||
jo.put("point_code1", point_code1);
|
||||
jo.put("point_code2", point_code2);
|
||||
jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("装箱区->装箱对接位"));
|
||||
jo.put("vehicle_code", containerName);
|
||||
jo.put("acs_task_type", PackageInfoIvtEnum.ACS_TASK_TYPE.code("桁架任务"));
|
||||
jo.put("is_send", "1");
|
||||
JSONObject param = new JSONObject();
|
||||
//木箱最大数量
|
||||
param.put("maxNo", "1");
|
||||
//木箱放入子卷数量
|
||||
param.put("boxNo", "1");
|
||||
//是否最后子卷
|
||||
param.put("lastOne", "1");
|
||||
//子卷号
|
||||
param.put("barcode", containerName);
|
||||
//子卷长度
|
||||
param.put("len", frpDescription);
|
||||
//木箱高度等级
|
||||
param.put("heightLevel", heightLevel);
|
||||
//托盘类型 1小托盘 2大托盘
|
||||
param.put("containerType", containerType);
|
||||
jo.put("request_param", param.toString());
|
||||
zxDjwTask.createTask(jo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 空木箱出库
|
||||
@@ -353,7 +472,7 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
updateWrapper1.in("workorder_id", entityList);
|
||||
pdmBiSubpackagerelationMapper.update(null, updateWrapper1);
|
||||
//待检区->装箱区agv任务
|
||||
agvTransfer(packagerelationList, deviceCode, boxSn);
|
||||
//agvTransfer(packagerelationList, deviceCode, boxSn);
|
||||
}
|
||||
|
||||
|
||||
@@ -361,6 +480,46 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
* 待检区->装箱区agv任务
|
||||
*/
|
||||
private void agvTransfer(List<PdmBiSubpackagerelation> packagerelationList, String deviceCode, String boxSn) {
|
||||
//待检区点位
|
||||
List<BstIvtPackageinfoivt> djqPointList = packageinfoivtService
|
||||
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
.eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("待检区"))
|
||||
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
|
||||
//todo 暂时改为合格品
|
||||
.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("合格品"))
|
||||
.orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||
Set<String> containerNames = packagerelationList.stream()
|
||||
.map(PdmBiSubpackagerelation::getContainer_name)
|
||||
.collect(Collectors.toSet());
|
||||
List<BstIvtPackageinfoivt> djqPoints = djqPointList.stream()
|
||||
.filter(djqPoint -> containerNames.contains(djqPoint.getContainer_name()))
|
||||
.collect(Collectors.toList());
|
||||
//下发agv任务
|
||||
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.isEmpty(zxqPointList)) {
|
||||
throw new BadRequestException("装箱区点位已满!");
|
||||
}
|
||||
jo.put("point_code2", zxqPointList.get(0).getPoint_code());
|
||||
zxqTask.createTask(jo);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void agvTransfer1(List<PdmBiSubpackagerelation> packagerelationList, String deviceCode, String boxSn) {
|
||||
//待检区点位
|
||||
List<BstIvtPackageinfoivt> djqPointList = packageinfoivtService
|
||||
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
@@ -375,8 +534,8 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
.filter(djqPoint -> containerNames.contains(djqPoint.getContainer_name()))
|
||||
.collect(Collectors.toList());
|
||||
//任务组id
|
||||
String groupId =deviceCode.substring(deviceCode.indexOf("_") + 1);
|
||||
List<SchBaseTask> schBaseTaskList =new ArrayList<>();
|
||||
String groupId = deviceCode.substring(deviceCode.indexOf("_") + 1);
|
||||
List<SchBaseTask> schBaseTaskList = new ArrayList<>();
|
||||
//确定起点,安装装箱组标识加入任务队列
|
||||
djqPoints.forEach(r -> {
|
||||
JSONObject jo = new JSONObject();
|
||||
@@ -389,58 +548,8 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
//增加任务到队列
|
||||
schBaseTaskList.add(task);
|
||||
});
|
||||
TaskQueueManager taskQueueManager = new TaskQueueManager();
|
||||
taskQueueManager.addTasksToQueue(deviceCode,schBaseTaskList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void transferToPacking(List<PdmBiSubpackagerelation> packagerelationList) {
|
||||
//下发装箱区->装箱对接位桁架任务
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("装箱区->装箱对接位"));
|
||||
//todo 测试,装箱点位-1-1
|
||||
jo.put("point_code1", "ZXQ_1_8");
|
||||
//todo 测试,装箱对接位01
|
||||
jo.put("point_code2", "ZXQ_1_1");
|
||||
jo.put("vehicle_code", packagerelationList.get(0).getContainer_name());
|
||||
jo.put("acs_task_type", PackageInfoIvtEnum.ACS_TASK_TYPE.code("桁架任务"));
|
||||
jo.put("is_send", "1");
|
||||
List<PdmBiSlittingproductionplan> productionPlanList = pdmBiSlittingproductionplanMapper.selectList(new LambdaQueryWrapper<PdmBiSlittingproductionplan>().eq(PdmBiSlittingproductionplan::getContainer_name, packagerelationList.get(0).getContainer_name()));
|
||||
if (productionPlanList.isEmpty()) {
|
||||
throw new BadRequestException("该子卷暂无分切计划信息");
|
||||
}
|
||||
//获取纸管长度
|
||||
String containerLength = productionPlanList.get(0).getPaper_tube_or_FRP().equals("1") ? productionPlanList.get(0).getPaper_tube_description() : productionPlanList.get(0).getFRP_description();
|
||||
int maxNum = 0;
|
||||
for (String part : containerLength.split("\\|")) {
|
||||
String numStr = part.replaceAll("\\D+", "");
|
||||
if (!numStr.isEmpty()) {
|
||||
int num = Integer.parseInt(numStr);
|
||||
if (num > maxNum) {
|
||||
maxNum = num;
|
||||
}
|
||||
}
|
||||
}
|
||||
//todo 测试,扩展参数
|
||||
JSONObject param = new JSONObject();
|
||||
//木箱最大数量
|
||||
param.put("maxNo", "1");
|
||||
//木箱放入子卷数量
|
||||
param.put("boxNo", "1");
|
||||
//是否最后子卷
|
||||
param.put("lastOne", "1");
|
||||
//子卷号
|
||||
param.put("barcode", packagerelationList.get(0).getContainer_name());
|
||||
//子卷长度
|
||||
//param.put("len", maxNum);
|
||||
param.put("len", maxNum);
|
||||
//托盘类型 1小托盘 2大托盘
|
||||
param.put("containerType", "1");
|
||||
jo.put("request_param", param.toString());
|
||||
zxDjwTask.createTask(jo);
|
||||
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, String pointCode,String taskType);
|
||||
List<BstIvtPackageinfoivt> checkEndPointTask(String ivtType, String ivtStatus, String pointCode);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.b_lms.sch.point.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
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;
|
||||
@@ -41,11 +42,6 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
|
||||
private IschBaseTaskService taskService;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
@@ -60,36 +56,38 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
|
||||
|
||||
|
||||
@Override
|
||||
public List<BstIvtPackageinfoivt> checkEndPointTask(String ivtType, String ivtStatus, String pointCode,String taskType) {
|
||||
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = bstIvtPackageinfoivtMapper
|
||||
public List<BstIvtPackageinfoivt> checkEndPointTask(String ivtType, String ivtStatus, String pointCode) {
|
||||
List<BstIvtPackageinfoivt> packageinfoivtList = bstIvtPackageinfoivtMapper
|
||||
.selectList(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
|
||||
.eq(BstIvtPackageinfoivt::getPoint_status, ivtType)
|
||||
.eq(BstIvtPackageinfoivt::getIvt_status, ivtStatus)
|
||||
.orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||
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());
|
||||
Set<String> pointIds = packageinfoivtList.stream().map(BstIvtPackageinfoivt::getPoint_code).collect(Collectors.toSet());
|
||||
if (CollectionUtils.isNotEmpty(pointIds)) {
|
||||
if (pointCode.equals("1")) {
|
||||
List<SchBaseTask> taskList = taskService.list(new LambdaUpdateWrapper<SchBaseTask>()
|
||||
//起点未完成任务
|
||||
.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
|
||||
.and(
|
||||
r -> r.in(SchBaseTask::getPoint_code1, pointIds)
|
||||
));
|
||||
return packageinfoivtList.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())
|
||||
.and(
|
||||
r -> r.in(SchBaseTask::getPoint_code2, pointIds)
|
||||
));
|
||||
return packageinfoivtList.stream().filter(r -> !taskList.stream().map(SchBaseTask::getPoint_code2).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());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
|
||||
@@ -5,18 +5,30 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
||||
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
|
||||
import org.nl.b_lms.storage_manage.database.service.dao.BstIvtBoxinfo;
|
||||
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.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.sch.AcsTaskDto;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.nl.common.enums.PackageInfoIvtEnum.IVT_STATUS;
|
||||
import static org.nl.wms.util.TaskUtil.getRoutePlanCode;
|
||||
|
||||
/**
|
||||
@@ -30,6 +42,9 @@ public class TwoOutBoxTask extends AbstractAcsTask {
|
||||
*/
|
||||
private final String THIS_CLASS = TwoOutBoxTask.class.getName();
|
||||
|
||||
@Autowired
|
||||
private IbstIvtPackageinfoivtService packageinfoivtService;
|
||||
|
||||
@Override
|
||||
public List<AcsTaskDto> addTask() {
|
||||
/*
|
||||
@@ -67,6 +82,10 @@ public class TwoOutBoxTask extends AbstractAcsTask {
|
||||
|
||||
// 仓位表
|
||||
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
|
||||
|
||||
// 仓位表
|
||||
WQLObject packageinfoivt = WQLObject.getWQLObject("bst_ivt_packageinfoivt");
|
||||
|
||||
// 任务表
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||
|
||||
@@ -89,11 +108,20 @@ public class TwoOutBoxTask extends AbstractAcsTask {
|
||||
map.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
||||
// 更新仓位
|
||||
JSONObject jsonAttr = attrTab.query("struct_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
|
||||
jsonAttr.put("lock_type",IOSEnum.LOCK_TYPE.code("未锁定"));
|
||||
jsonAttr.put("storagevehicle_code","");
|
||||
jsonAttr.put("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"));
|
||||
jsonAttr.put("storagevehicle_code", "");
|
||||
attrTab.update(jsonAttr);
|
||||
//更新木箱信息
|
||||
JSONObject packageInfo = packageinfoivt.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
|
||||
packageInfo.put("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空载具"));
|
||||
packageInfo.put("container_name",jsonTask.getString("vehicle_code"));
|
||||
packageinfoivt.update(packageInfo);
|
||||
//更新木箱信息
|
||||
// packageinfoivtService.update(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
// .eq(BstIvtPackageinfoivt::getPoint_code, jsonTask.getString("point_code2"))
|
||||
// .set(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("空载具"))
|
||||
// .set(BstIvtPackageinfoivt::getContainer_name, jsonTask.getString("vehicle_code")));
|
||||
}
|
||||
|
||||
// 取消
|
||||
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
||||
if (taskObj.getIntValue("task_status") > Integer.valueOf(TaskStatusEnum.ISSUE.getCode())) {
|
||||
@@ -103,7 +131,7 @@ public class TwoOutBoxTask extends AbstractAcsTask {
|
||||
map.put("is_delete", IOSEnum.IS_NOTANDYES.code("是"));
|
||||
// 解锁仓位
|
||||
JSONObject jsonAttr = attrTab.query("struct_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
|
||||
jsonAttr.put("lock_type",IOSEnum.LOCK_TYPE.code("未锁定"));
|
||||
jsonAttr.put("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"));
|
||||
attrTab.update(jsonAttr);
|
||||
}
|
||||
map.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
@@ -112,6 +140,7 @@ public class TwoOutBoxTask extends AbstractAcsTask {
|
||||
WQLObject.getWQLObject("SCH_BASE_Task").update(map, "task_id = '" + taskObj.getString("task_id") + "'");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void findStartPoint() {
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ 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.sch.tasks.first_floor_area.auto.TaskQueueManager;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
@@ -30,7 +31,10 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 4 目标待检区, 满轴缓存位 -> 待检区,agv任务
|
||||
@@ -101,7 +105,7 @@ public class DjqTask extends AbstractAcsTask {
|
||||
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code1()));
|
||||
//3更新库存记录
|
||||
//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()));
|
||||
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>()
|
||||
//确定起点未下发
|
||||
@@ -121,6 +125,9 @@ public class DjqTask extends AbstractAcsTask {
|
||||
//任务下发
|
||||
mzhcwTask.immediateNotifyAcs(task.getTask_id().toString());
|
||||
}
|
||||
//5搬运装箱区
|
||||
//sendDjqToZxq(schBaseTask);
|
||||
|
||||
}
|
||||
// 取消
|
||||
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
||||
@@ -185,7 +192,20 @@ public class DjqTask extends AbstractAcsTask {
|
||||
return task.getTask_id();
|
||||
}
|
||||
|
||||
|
||||
public void sendDjqToZxq(SchBaseTask schBaseTask) {
|
||||
//装箱区有空位
|
||||
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code("空"),"2");
|
||||
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);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void forceFinish(String taskId) {
|
||||
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>()
|
||||
|
||||
@@ -28,6 +28,7 @@ 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;
|
||||
@@ -142,9 +143,9 @@ public class KzjhcwTask extends AbstractAcsTask {
|
||||
throw new BadRequestException("业务类型不能为空");
|
||||
}
|
||||
String vehicleCode = form.getString("vehicle_code");
|
||||
if (StrUtil.isBlank(vehicleCode)) {
|
||||
throw new BadRequestException("载具号不能为空");
|
||||
}
|
||||
// if (StrUtil.isBlank(vehicleCode)) {
|
||||
// throw new BadRequestException("载具号不能为空");
|
||||
// }
|
||||
String pointCode1 = form.getString("point_code1");
|
||||
if (StrUtil.isBlank(pointCode1)) {
|
||||
throw new BadRequestException("起点不能为空");
|
||||
@@ -214,9 +215,9 @@ public class KzjhcwTask extends AbstractAcsTask {
|
||||
/**
|
||||
* 装箱区->空载具缓存位补空
|
||||
*/
|
||||
public void toKzjHcw(String pointCode) {
|
||||
public void toKzjHcw1(String pointCode) {
|
||||
//存在空载具缓存位无空载具的点位
|
||||
List<BstIvtPackageinfoivt> kzjIvtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("空载具缓存位"), PackageInfoIvtEnum.IVT_STATUS.code("空"), "2", PackageInfoIvtEnum.TASK_TYPE.code("取空(待检区或管制区->空载具缓存位)"));
|
||||
List<BstIvtPackageinfoivt> kzjIvtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("空载具缓存位"), PackageInfoIvtEnum.IVT_STATUS.code("空"), "2");
|
||||
String pointCode1 = null;
|
||||
JSONObject toKzjHcwTask = new JSONObject();
|
||||
if (StringUtils.isNotBlank(pointCode)) {
|
||||
@@ -251,4 +252,33 @@ public class KzjhcwTask extends AbstractAcsTask {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void toKzjHcw(String pointCode) {
|
||||
//存在空载具缓存位无空载具的点位
|
||||
List<BstIvtPackageinfoivt> kzjIvtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("空载具缓存位"), PackageInfoIvtEnum.IVT_STATUS.code("空"), "2");
|
||||
String pointCode1 = null;
|
||||
JSONObject toKzjHcwTask = new JSONObject();
|
||||
if (StringUtils.isNotBlank(pointCode)) {
|
||||
pointCode1 = pointCode;
|
||||
} else {
|
||||
//查询装箱区有空载具
|
||||
List<BstIvtPackageinfoivt> zxqPointList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code("空载具"), "1");
|
||||
//装箱区有空载具
|
||||
if (CollectionUtils.isNotEmpty(zxqPointList)) {
|
||||
pointCode1 = zxqPointList.get(0).getPoint_code();
|
||||
} else {
|
||||
//待检区有空载具
|
||||
List<BstIvtPackageinfoivt> djqPointList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("待检区"), PackageInfoIvtEnum.IVT_STATUS.code("空载具"), "1");
|
||||
pointCode1 = djqPointList.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ public class MzhcwTask extends AbstractAcsTask {
|
||||
private SsxDjwTask ssxDjwTask;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<AcsTaskDto> addTask() {
|
||||
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||
@@ -211,6 +212,36 @@ public class MzhcwTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
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("找不到子卷信息!");
|
||||
}
|
||||
//查询库位信息
|
||||
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());
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
private void createTaskToDjq1(SchBaseTask schBaseTask) {
|
||||
if (StringUtils.isBlank(schBaseTask.getVehicle_code())) {
|
||||
throw new BadRequestException("子卷号不能为空!");
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ public class ZxDjwTask extends AbstractAcsTask {
|
||||
bstIvtBoxinfoMapper.updateById(bstIvtBoxinfo);
|
||||
}
|
||||
//创建装箱区->空载具缓存位补空任务
|
||||
kzjhcwTask.toKzjHcw(schBaseTask.getPoint_code1());
|
||||
//kzjhcwTask.toKzjHcw(schBaseTask.getPoint_code1());
|
||||
}
|
||||
// 取消
|
||||
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
||||
|
||||
@@ -183,82 +183,7 @@ public class ZxqTask extends AbstractAcsTask {
|
||||
//更新库存记录
|
||||
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.查询子卷对应的包装关系表,判断装箱位的木箱号是否为子卷对应的木箱号,是,创建搬运任务到装箱对接位位桁架任务,否,什么都不做
|
||||
PdmBiSubpackagerelation pdmBiSubpackagerelation = subpackageRelationService
|
||||
.getOne(new LambdaUpdateWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getContainer_name, schBaseTask.getVehicle_code()), false);
|
||||
if (pdmBiSubpackagerelation != null) {
|
||||
//查询目标点位信息
|
||||
BstIvtPackageinfoivt zxqPoint = packageinfoivtService.getOne(new LambdaUpdateWrapper<BstIvtPackageinfoivt>().eq(BstIvtPackageinfoivt::getPoint_code, schBaseTask.getPoint_code2()));
|
||||
//查询装箱对接位的木箱号和区域与子卷对应的木箱号与区域是否匹配
|
||||
BstIvtPackageinfoivt zxdjwPoint = packageinfoivtService.getOne(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
.eq(BstIvtPackageinfoivt::getContainer_name, pdmBiSubpackagerelation.getPackage_box_sn()).eq(BstIvtPackageinfoivt::getBlock, zxqPoint.getBlock()));
|
||||
if (zxdjwPoint != null) {
|
||||
//创建搬运任务到装箱位
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("装箱区->装箱对接位"));
|
||||
jo.put("acs_task_type", PackageInfoIvtEnum.ACS_TASK_TYPE.code("桁架任务"));
|
||||
jo.put("point_code1", schBaseTask.getPoint_code2());
|
||||
jo.put("point_code2", zxdjwPoint.getPoint_code());
|
||||
jo.put("vehicle_code", schBaseTask.getVehicle_code());
|
||||
jo.put("is_send", "1");
|
||||
List<PdmBiSlittingproductionplan> productionPlanList = pdmBiSlittingproductionplanMapper.selectList(new LambdaQueryWrapper<PdmBiSlittingproductionplan>().eq(PdmBiSlittingproductionplan::getContainer_name, schBaseTask.getVehicle_code()));
|
||||
if (productionPlanList.isEmpty()) {
|
||||
throw new BadRequestException("该子卷暂无分切计划信息");
|
||||
}
|
||||
//获取纸管长度
|
||||
String containerLength = productionPlanList.get(0).getPaper_tube_or_FRP().equals("1") ? productionPlanList.get(0).getPaper_tube_description() : productionPlanList.get(0).getFRP_description();
|
||||
int maxNum = 0;
|
||||
for (String part : containerLength.split("\\|")) {
|
||||
String numStr = part.replaceAll("\\D+", "");
|
||||
if (!numStr.isEmpty()) {
|
||||
int num = Integer.parseInt(numStr);
|
||||
if (num > maxNum) {
|
||||
maxNum = num;
|
||||
}
|
||||
}
|
||||
}
|
||||
//扩展参数
|
||||
JSONObject param = new JSONObject();
|
||||
//获取木箱信息,未包装的木箱
|
||||
BstIvtBoxinfo bstIvtBoxinfo = bstIvtBoxinfoMapper.selectOne(new LambdaQueryWrapper<BstIvtBoxinfo>().eq(BstIvtBoxinfo::getBox_no, schBaseTask.getVehicle_code2()).eq(BstIvtBoxinfo::getIs_packing, null));
|
||||
if (bstIvtBoxinfo == null) {
|
||||
throw new BadRequestException("找不到木箱信息!");
|
||||
}
|
||||
//获取木箱高度等级
|
||||
String height = "";
|
||||
String heightLevel1 = iSysParamService.findByCode("height_level_1").getValue();
|
||||
String heightLevel2 = iSysParamService.findByCode("height_level_2").getValue();
|
||||
String box_high = bstIvtBoxinfo.getBox_high();
|
||||
if (Integer.parseInt(box_high) <= Integer.parseInt(heightLevel1)) {
|
||||
height = "1";
|
||||
} else if (Integer.parseInt(box_high) > Integer.parseInt(heightLevel1) && Integer.parseInt(box_high) <= Integer.parseInt(heightLevel2)) {
|
||||
height = "2";
|
||||
} else {
|
||||
height = "3";
|
||||
}
|
||||
//木箱高度等级
|
||||
param.put("heightLevel", height);
|
||||
//木箱最大数量
|
||||
param.put("maxNo", bstIvtBoxinfo.getNum());
|
||||
//托盘类型 1小托盘 2大托盘
|
||||
param.put("containerType", bstIvtBoxinfo.getVehicle_type());
|
||||
//查询是否为最后一个子卷,相同木箱号且状态为生成
|
||||
List<PdmBiSubpackagerelation> packagerelationList = subpackageRelationService.list(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getPackage_box_sn, schBaseTask.getVehicle_code2()).eq(PdmBiSubpackagerelation::getStatus, "0"));
|
||||
if (packagerelationList.size() == 1 && packagerelationList.get(0).getContainer_name().equals(schBaseTask.getVehicle_code())) {
|
||||
//最后子卷
|
||||
param.put("lastOne", "1");
|
||||
} else {
|
||||
param.put("lastOne", "0");
|
||||
}
|
||||
//木箱放入子卷数量
|
||||
param.put("boxNo", pdmBiSubpackagerelation.getQuanlity_in_box());
|
||||
//子卷号
|
||||
param.put("barcode", schBaseTask.getVehicle_code());
|
||||
//子卷长度
|
||||
param.put("len", maxNum);
|
||||
jo.put("request_param", param.toString());
|
||||
zxDjwTask.createTask(jo);
|
||||
}
|
||||
}
|
||||
//zxqToZxw(schBaseTask);
|
||||
}
|
||||
// 取消
|
||||
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
||||
@@ -275,6 +200,85 @@ public class ZxqTask extends AbstractAcsTask {
|
||||
|
||||
}
|
||||
|
||||
private void zxqToZxw(SchBaseTask schBaseTask) {
|
||||
PdmBiSubpackagerelation pdmBiSubpackagerelation = subpackageRelationService
|
||||
.getOne(new LambdaUpdateWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getContainer_name, schBaseTask.getVehicle_code()), false);
|
||||
if (pdmBiSubpackagerelation != null) {
|
||||
//查询目标点位信息
|
||||
BstIvtPackageinfoivt zxqPoint = packageinfoivtService.getOne(new LambdaUpdateWrapper<BstIvtPackageinfoivt>().eq(BstIvtPackageinfoivt::getPoint_code, schBaseTask.getPoint_code2()));
|
||||
//查询装箱对接位的木箱号和区域与子卷对应的木箱号与区域是否匹配
|
||||
BstIvtPackageinfoivt zxdjwPoint = packageinfoivtService.getOne(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
.eq(BstIvtPackageinfoivt::getContainer_name, pdmBiSubpackagerelation.getPackage_box_sn()).eq(BstIvtPackageinfoivt::getBlock, zxqPoint.getBlock()));
|
||||
if (zxdjwPoint != null) {
|
||||
//创建搬运任务到装箱位
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("装箱区->装箱对接位"));
|
||||
jo.put("acs_task_type", PackageInfoIvtEnum.ACS_TASK_TYPE.code("桁架任务"));
|
||||
jo.put("point_code1", schBaseTask.getPoint_code2());
|
||||
jo.put("point_code2", zxdjwPoint.getPoint_code());
|
||||
jo.put("vehicle_code", schBaseTask.getVehicle_code());
|
||||
jo.put("is_send", "1");
|
||||
List<PdmBiSlittingproductionplan> productionPlanList = pdmBiSlittingproductionplanMapper.selectList(new LambdaQueryWrapper<PdmBiSlittingproductionplan>().eq(PdmBiSlittingproductionplan::getContainer_name, schBaseTask.getVehicle_code()));
|
||||
if (productionPlanList.isEmpty()) {
|
||||
throw new BadRequestException("该子卷暂无分切计划信息");
|
||||
}
|
||||
//获取纸管长度
|
||||
String containerLength = productionPlanList.get(0).getPaper_tube_or_FRP().equals("1") ? productionPlanList.get(0).getPaper_tube_description() : productionPlanList.get(0).getFRP_description();
|
||||
int maxNum = 0;
|
||||
for (String part : containerLength.split("\\|")) {
|
||||
String numStr = part.replaceAll("\\D+", "");
|
||||
if (!numStr.isEmpty()) {
|
||||
int num = Integer.parseInt(numStr);
|
||||
if (num > maxNum) {
|
||||
maxNum = num;
|
||||
}
|
||||
}
|
||||
}
|
||||
//扩展参数
|
||||
JSONObject param = new JSONObject();
|
||||
//获取木箱信息,未包装的木箱
|
||||
BstIvtBoxinfo bstIvtBoxinfo = bstIvtBoxinfoMapper.selectOne(new LambdaQueryWrapper<BstIvtBoxinfo>().eq(BstIvtBoxinfo::getBox_no, schBaseTask.getVehicle_code2()).eq(BstIvtBoxinfo::getIs_packing, null));
|
||||
if (bstIvtBoxinfo == null) {
|
||||
throw new BadRequestException("找不到木箱信息!");
|
||||
}
|
||||
//获取木箱高度等级
|
||||
String height = "";
|
||||
String heightLevel1 = iSysParamService.findByCode("height_level_1").getValue();
|
||||
String heightLevel2 = iSysParamService.findByCode("height_level_2").getValue();
|
||||
String box_high = bstIvtBoxinfo.getBox_high();
|
||||
if (Integer.parseInt(box_high) <= Integer.parseInt(heightLevel1)) {
|
||||
height = "1";
|
||||
} else if (Integer.parseInt(box_high) > Integer.parseInt(heightLevel1) && Integer.parseInt(box_high) <= Integer.parseInt(heightLevel2)) {
|
||||
height = "2";
|
||||
} else {
|
||||
height = "3";
|
||||
}
|
||||
//木箱高度等级
|
||||
param.put("heightLevel", height);
|
||||
//木箱最大数量
|
||||
param.put("maxNo", bstIvtBoxinfo.getNum());
|
||||
//托盘类型 1小托盘 2大托盘
|
||||
param.put("containerType", bstIvtBoxinfo.getVehicle_type());
|
||||
//查询是否为最后一个子卷,相同木箱号且状态为生成
|
||||
List<PdmBiSubpackagerelation> packagerelationList = subpackageRelationService.list(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getPackage_box_sn, schBaseTask.getVehicle_code2()).eq(PdmBiSubpackagerelation::getStatus, "0"));
|
||||
if (packagerelationList.size() == 1 && packagerelationList.get(0).getContainer_name().equals(schBaseTask.getVehicle_code())) {
|
||||
//最后子卷
|
||||
param.put("lastOne", "1");
|
||||
} else {
|
||||
param.put("lastOne", "0");
|
||||
}
|
||||
//木箱放入子卷数量
|
||||
param.put("boxNo", pdmBiSubpackagerelation.getQuanlity_in_box());
|
||||
//子卷号
|
||||
param.put("barcode", schBaseTask.getVehicle_code());
|
||||
//子卷长度
|
||||
param.put("len", maxNum);
|
||||
jo.put("request_param", param.toString());
|
||||
zxDjwTask.createTask(jo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String createTask(JSONObject form) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.b_lms.sch.tasks.first_floor_area.auto;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||
@@ -16,6 +17,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AutoSendMzToDjq {
|
||||
|
||||
@Resource
|
||||
@@ -26,24 +28,20 @@ public class AutoSendMzToDjq {
|
||||
|
||||
//满轴->待检区agv自动搬运任务
|
||||
public void run() {
|
||||
this.sendMzqToDjq();
|
||||
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)) {
|
||||
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("满轴缓存位"), PackageInfoIvtEnum.IVT_STATUS.code("有子卷"), "1");
|
||||
List<BstIvtPackageinfoivt> djqPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("待检区"), PackageInfoIvtEnum.IVT_STATUS.code("空"), "2");
|
||||
if (CollectionUtils.isNotEmpty(bstIvtPackageinfoivtList)&&CollectionUtils.isNotEmpty(djqPackageinfoivtList)) {
|
||||
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());
|
||||
toDjqTask.put("point_code2", djqPackageinfoivtList.get(0).getPoint_code());
|
||||
djqTask.createTask(toDjqTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
// void sendMzqToDjq() {
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package org.nl.b_lms.sch.tasks.first_floor_area.auto;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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.tasks.first_floor_area.DjqTask;
|
||||
import org.nl.b_lms.sch.tasks.first_floor_area.ZxqTask;
|
||||
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -17,10 +21,13 @@ import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AutoSendToZxq {
|
||||
|
||||
@Resource
|
||||
private IbstIvtPackageinfoivtService packageinfoivtService;
|
||||
@Resource
|
||||
private ZxqTask zxqTask;
|
||||
|
||||
//待检区->装箱区agv自动搬运任务
|
||||
public void run() {
|
||||
@@ -28,8 +35,23 @@ public class AutoSendToZxq {
|
||||
}
|
||||
|
||||
void sendDjqToZxq() {
|
||||
JSONObject toDjqTask =new JSONObject();
|
||||
//待检区有子卷且没有未完成任务
|
||||
List<BstIvtPackageinfoivt> djqPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("待检区"), PackageInfoIvtEnum.IVT_STATUS.code("有子卷"), "1");
|
||||
List<BstIvtPackageinfoivt> zxqPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code("空"), "2");
|
||||
if (CollectionUtils.isNotEmpty(djqPackageinfoivtList)&&CollectionUtils.isNotEmpty(zxqPackageinfoivtList)) {
|
||||
toDjqTask.put("vehicle_code", djqPackageinfoivtList.get(0).getContainer_name());
|
||||
toDjqTask.put("point_code1", djqPackageinfoivtList.get(0).getPoint_code());
|
||||
toDjqTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("待检区->装箱区"));
|
||||
toDjqTask.put("point_code2", zxqPackageinfoivtList.get(0).getPoint_code());
|
||||
zxqTask.createTask(toDjqTask);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void sendDjqToZxq1() {
|
||||
//装箱区有空位
|
||||
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code("空"),"2",PackageInfoIvtEnum.IVT_STATUS.code("空"));
|
||||
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code("空"),"2");
|
||||
if (CollectionUtils.isNotEmpty(bstIvtPackageinfoivtList)) {
|
||||
Map<String, List<String>> ivtList = bstIvtPackageinfoivtList.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
|
||||
@@ -27,7 +27,7 @@ public class AutoSendVehicleToDjq {
|
||||
|
||||
//装箱区->待检区送空agv自动搬运任务
|
||||
public void run() {
|
||||
this.sendKzjHcwEmptyVehicle();
|
||||
//this.sendKzjHcwEmptyVehicle();
|
||||
}
|
||||
|
||||
|
||||
@@ -36,12 +36,12 @@ public class AutoSendVehicleToDjq {
|
||||
String pointCode1=null;
|
||||
String pointCode2;
|
||||
//待检区有空位
|
||||
List<BstIvtPackageinfoivt> djqList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code("空"),"2",PackageInfoIvtEnum.TASK_TYPE.code("送空(装箱区->待检区或管制区)"));
|
||||
List<BstIvtPackageinfoivt> djqList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code("空"),"2");
|
||||
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("送空(装箱区->待检区或管制区)"));
|
||||
List<BstIvtPackageinfoivt> zxqList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code("空"),"2");
|
||||
pointCode2=zxqList.get(0).getPoint_code();
|
||||
}
|
||||
//查询装箱区有空载具
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.b_lms.sch.tasks.first_floor_area.auto;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.sch.tasks.first_floor_area.KzjhcwTask;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -9,6 +10,7 @@ import javax.annotation.Resource;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AutoSendVehicleToKz {
|
||||
|
||||
@Resource
|
||||
@@ -19,7 +21,7 @@ public class AutoSendVehicleToKz {
|
||||
this.sendToKzjHcw();
|
||||
}
|
||||
|
||||
//待检区->空轴缓存位送空agv自动搬运任务
|
||||
//待检区->空轴缓存位补空agv自动搬运任务
|
||||
void sendToKzjHcw() {
|
||||
kzjhcwTask.toKzjHcw("");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
package org.nl.b_lms.sch.tasks.first_floor_area.auto;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.pdm.bi.slittingproductionplan.service.dao.mapper.PdmBiSlittingproductionplanMapper;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
||||
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.service.IschBaseTaskService;
|
||||
import org.nl.b_lms.sch.tasks.first_floor_area.DjqTask;
|
||||
import org.nl.b_lms.sch.tasks.first_floor_area.ZxDjwTask;
|
||||
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.common.enums.PackageInfoIvtEnum;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AutoSendZxToDjw {
|
||||
|
||||
|
||||
@Resource
|
||||
private ZxDjwTask zxDjwTask;
|
||||
|
||||
|
||||
@Resource
|
||||
private IbstIvtPackageinfoivtService packageinfoivtService;
|
||||
@Resource
|
||||
private IpdmBiSubpackagerelationService subpackageRelationService;
|
||||
|
||||
|
||||
@Resource
|
||||
private PdmBiSlittingproductionplanMapper pdmBiSlittingproductionplanMapper;
|
||||
@Resource
|
||||
private BstIvtBoxinfoMapper bstIvtBoxinfoMapper;
|
||||
|
||||
@Resource
|
||||
private ISysParamService iSysParamService;
|
||||
|
||||
//满轴->待检区agv自动搬运任务
|
||||
public void run() {
|
||||
this.sendZxToDjw();
|
||||
}
|
||||
|
||||
void sendZxToDjw() {
|
||||
List<BstIvtPackageinfoivt> zxqPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code("有子卷"), "1");
|
||||
List<BstIvtPackageinfoivt> zxwPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱位"), PackageInfoIvtEnum.IVT_STATUS.code("空载具"), "2");
|
||||
if (CollectionUtils.isNotEmpty(zxqPackageinfoivtList) && CollectionUtils.isNotEmpty(zxwPackageinfoivtList)) {
|
||||
//3.查询子卷对应的包装关系表,判断装箱位的木箱号是否为子卷对应的木箱号,是,创建搬运任务到装箱对接位位桁架任务,否,什么都不做
|
||||
PdmBiSubpackagerelation pdmBiSubpackagerelation = subpackageRelationService
|
||||
.getOne(new LambdaUpdateWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getPackage_box_sn, zxwPackageinfoivtList.get(0).getContainer_name()), false);
|
||||
if (pdmBiSubpackagerelation == null) {
|
||||
throw new BadRequestException("装箱位木箱号无对应子卷包装关系的木箱号!");
|
||||
}
|
||||
String containerName = pdmBiSubpackagerelation.getContainer_name();
|
||||
String boxNo = zxwPackageinfoivtList.get(0).getContainer_name();
|
||||
List<BstIvtPackageinfoivt> zxqPoint = zxqPackageinfoivtList.stream().filter(r -> r.getContainer_name().equals(containerName)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(zxqPoint)) {
|
||||
throw new BadRequestException("装箱区暂无该子卷信息");
|
||||
}
|
||||
List<PdmBiSlittingproductionplan> productionPlanList = pdmBiSlittingproductionplanMapper.selectList(new LambdaQueryWrapper<PdmBiSlittingproductionplan>().eq(PdmBiSlittingproductionplan::getContainer_name, containerName));
|
||||
if (productionPlanList.isEmpty()) {
|
||||
throw new BadRequestException("该子卷暂无分切计划信息");
|
||||
}
|
||||
//创建搬运任务到装箱位
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("装箱区->装箱对接位"));
|
||||
jo.put("acs_task_type", PackageInfoIvtEnum.ACS_TASK_TYPE.code("桁架任务"));
|
||||
jo.put("point_code1", zxqPoint.get(0).getPoint_code());
|
||||
jo.put("point_code2", zxwPackageinfoivtList.get(0).getPoint_code());
|
||||
jo.put("vehicle_code", pdmBiSubpackagerelation.getContainer_name());
|
||||
jo.put("is_send", "1");
|
||||
//获取纸管长度
|
||||
String containerLength = productionPlanList.get(0).getPaper_tube_or_FRP().equals("1") ? productionPlanList.get(0).getPaper_tube_description() : productionPlanList.get(0).getFRP_description();
|
||||
int maxNum = 0;
|
||||
for (String part : containerLength.split("\\|")) {
|
||||
String numStr = part.replaceAll("\\D+", "");
|
||||
if (!numStr.isEmpty()) {
|
||||
int num = Integer.parseInt(numStr);
|
||||
if (num > maxNum) {
|
||||
maxNum = num;
|
||||
}
|
||||
}
|
||||
}
|
||||
//扩展参数
|
||||
JSONObject param = new JSONObject();
|
||||
//获取木箱信息,未包装的木箱
|
||||
// BstIvtBoxinfo bstIvtBoxinfo = bstIvtBoxinfoMapper.selectOne(new LambdaQueryWrapper<BstIvtBoxinfo>().eq(BstIvtBoxinfo::getBox_no,boxNo).eq(BstIvtBoxinfo::getIs_packing, null));
|
||||
BstIvtBoxinfo bstIvtBoxinfo = bstIvtBoxinfoMapper.selectOne(new LambdaQueryWrapper<BstIvtBoxinfo>().eq(BstIvtBoxinfo::getBox_no, boxNo));
|
||||
if (bstIvtBoxinfo == null) {
|
||||
throw new BadRequestException("找不到木箱信息!");
|
||||
}
|
||||
//获取木箱高度等级
|
||||
String height = "";
|
||||
String heightLevel1 = iSysParamService.findByCode("height_level_1").getValue();
|
||||
String heightLevel2 = iSysParamService.findByCode("height_level_2").getValue();
|
||||
String box_high = bstIvtBoxinfo.getBox_high();
|
||||
if (Integer.parseInt(box_high) <= Integer.parseInt(heightLevel1)) {
|
||||
height = "1";
|
||||
} else if (Integer.parseInt(box_high) > Integer.parseInt(heightLevel1) && Integer.parseInt(box_high) <= Integer.parseInt(heightLevel2)) {
|
||||
height = "2";
|
||||
} else {
|
||||
height = "3";
|
||||
}
|
||||
//木箱高度等级
|
||||
param.put("heightLevel", height);
|
||||
//木箱最大数量
|
||||
param.put("maxNo", bstIvtBoxinfo.getNum());
|
||||
//托盘类型 1小托盘 2大托盘
|
||||
param.put("containerType", bstIvtBoxinfo.getVehicle_type());
|
||||
//查询是否为最后一个子卷,相同木箱号且状态为生成
|
||||
// List<PdmBiSubpackagerelation> packagerelationList = subpackageRelationService.list(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getPackage_box_sn, boxNo).eq(PdmBiSubpackagerelation::getStatus, "0"));
|
||||
// if (packagerelationList.size() == 1 && packagerelationList.get(0).getContainer_name().equals(containerName)) {
|
||||
// //最后子卷
|
||||
// param.put("lastOne", "1");
|
||||
// } else {
|
||||
// param.put("lastOne", "0");
|
||||
// }
|
||||
param.put("lastOne", "1");
|
||||
//木箱放入子卷数量
|
||||
//param.put("boxNo", pdmBiSubpackagerelation.getQuanlity_in_box());
|
||||
param.put("boxNo", "1");
|
||||
//子卷号
|
||||
param.put("barcode", containerName);
|
||||
//子卷长度
|
||||
param.put("len", maxNum);
|
||||
jo.put("request_param", param.toString());
|
||||
zxDjwTask.createTask(jo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 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);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
@@ -213,15 +213,12 @@ public class InBussManageServiceImpl implements InBussManageService {
|
||||
if (ObjectUtil.isEmpty(jsonObject.getString("device_code"))) {
|
||||
throw new BadRequestException("设备号不能为空!");
|
||||
}
|
||||
|
||||
|
||||
List<String> pcsnList = Arrays.asList(material_barcode.split(","));
|
||||
|
||||
|
||||
// 查询子卷包装关系
|
||||
List<JSONObject> subList = subTab.query("container_name ='A1652211050505A2' and status in ('0','1')")
|
||||
// List<JSONObject> subList = subTab.query("container_name ='A1262210272905A1' and status in ('0','1')")
|
||||
// .getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
List<JSONObject> subList = subTab.query("container_name in ('" + String.join("','", pcsnList) + "') and status in ('0','1')")
|
||||
.getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
|
||||
if (ObjectUtil.isEmpty(subList)) {
|
||||
throw new BadRequestException("未查询到子卷包装信息!");
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.Map;
|
||||
@Getter
|
||||
public enum PackageInfoIvtEnum {
|
||||
//点位类型
|
||||
POINT_STATUS(MapOf.of("满轴缓存位", "1", "空载具缓存位", "2", "待检区", "3", "管制区", "4", "装箱区", "5", "装箱位", "6")),
|
||||
POINT_STATUS(MapOf.of("满轴缓存位", "1", "空载具缓存位", "2", "待检区", "3", "管制区", "4", "装箱位", "5","装箱区", "6")),
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@ import org.springframework.web.socket.server.standard.ServerEndpointExporter;
|
||||
@Configuration
|
||||
public class WebSocketConfig {
|
||||
|
||||
@Bean
|
||||
public ServerEndpointExporter serverEndpointExporter() {
|
||||
return new ServerEndpointExporter();
|
||||
}
|
||||
// @Bean
|
||||
// public ServerEndpointExporter serverEndpointExporter() {
|
||||
// return new ServerEndpointExporter();
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user