fix:去除测试参数,测试代码,修改补空任务触发时间。

This commit is contained in:
2024-07-18 22:25:49 +08:00
parent de9e24bf05
commit 0154f6ccf9
4 changed files with 6 additions and 229 deletions

View File

@@ -3,7 +3,6 @@ package org.nl.b_lms.pdm.subpackagerelation.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.StopWatch;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -514,46 +513,7 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
return minPointCode.orElseGet(() -> bstIvtPackageinfoivtList.get(0).getPoint_code());
}
/**
* 待检区->装箱区agv任务
*/
private void agvTransfer1(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("启用"))
.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);
});
}
/**
* 多选删除
@@ -582,170 +542,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
return entity;
}
/**
* 满轴->待检
*/
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);
}
@Override
public void createSubTest(JSONObject jo) {
@@ -803,8 +599,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
@Override
@Transactional(rollbackFor = Exception.class)
public void updateEntityList(JSONObject whereJson) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
List<PdmBiSubpackagerelation> packagerelationList = JSONObject.parseArray(whereJson.getJSONArray("tableMater").toJSONString(), PdmBiSubpackagerelation.class);
if (CollectionUtils.isEmpty(packagerelationList)) {
throw new BadRequestException("无选中子卷信息");
@@ -818,8 +612,7 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
throw new BadRequestException("标记为黄色的子卷号已分配且对应的木箱已出库,请重新选择未分配木箱规格的子卷");
}
//均衡获取木箱出库装箱区对接位
// String deviceCode = getPointCode();
String deviceCode = "ZXQ_1_1";
String deviceCode = getPointCode();
Integer taskCount = bstIvtPackageinfoivtMapper.getZxqTaskCount(deviceCode.substring(deviceCode.lastIndexOf("_") + 1));
if (taskCount + packagerelationList.size() > 10) {
throw new BadRequestException("子卷搬运任务数已达上限!");
@@ -843,9 +636,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
Set<String> containerNameList = packagerelationList.stream()
.map(PdmBiSubpackagerelation::getContainer_name)
.collect(Collectors.toSet());
stopWatch.stop();
System.out.println("子卷装箱代码1装箱信息查询执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
log.info("子卷装箱代码1箱信息查询执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
outBox(workIdList, containerNameList, deviceCode, maxBoxGroup, whereJson.getString("checked"));
}
@@ -856,21 +646,12 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
private void outBox(List<String> workIdList, Set<String> containerNameList, String deviceCode, Integer
maxBoxGroup, String boxType) {
//均衡获取装箱对接位
StopWatch stopWatch = new StopWatch();
stopWatch.start();
JSONObject boxInfo = new JSONObject();
//确定装箱区终点
boxInfo.put("device_code", deviceCode);
boxInfo.put("material_code", boxType);
boxInfo.put("num", workIdList.size());
String boxSn = outBoxManageService.outBox(boxInfo);
stopWatch.stop();
System.out.println("木箱出库代码执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
log.info("木箱出库代码执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
//空木箱出库测试
//String boxSn = "MX240702000166";
StopWatch stopWatch1 = new StopWatch();
stopWatch1.start();
//更新及子卷包装状态已分配规格及木箱规格组
CompletableFuture.runAsync(() -> {
try {
@@ -887,9 +668,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
log.error("agvTransfer接口待检区->装箱区agv任务异常" + e);
}
}, pool);
stopWatch1.stop();
System.out.println("子卷装箱代码2装箱信息更新执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch1.getTotalTimeMillis());
log.info("子卷装箱代码2装箱信息更新执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch1.getTotalTimeMillis());
}
@@ -901,7 +679,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
.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));
List<BstIvtPackageinfoivt> djqPoints = djqPointList.stream()
.filter(r -> containerNameList.contains(r.getContainer_name()))

View File

@@ -179,8 +179,8 @@ public class ZxDjwTask extends AbstractAcsTask {
try {
for (int i = 0; i < callingNum; i++) {
try {
//5秒执行一次
TimeUnit.SECONDS.sleep(5L);
//9秒执行一次
TimeUnit.SECONDS.sleep(9L);
autoSendVehicleToDjq.sendVehicleToDjqOrGzq1(IOSEnum.IS_NOTANDYES.code(""));
} catch (InterruptedException e) {
Thread.currentThread().interrupt();

View File

@@ -61,7 +61,7 @@ public class AutoSendGzqToDjq {
.filter(r -> r.getPoint_code().equals("ZXQ_135") || r.getPoint_code().equals("ZXQ_136"))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(ivtLists)) {
pointCode3 = gzqIvtList.get(0).getPoint_code();
pointCode3 = ivtLists.get(0).getPoint_code();
if (StringUtils.isNotBlank(pointCode3)) {
List<BstIvtPackageinfoivt> packageList;
packageList = packageinfoivtService.checkEndPointTask(

View File

@@ -128,7 +128,7 @@ public class AutoSendZxToDjw {
//装箱区点位上有与该木箱号匹配的子卷
if (CollectionUtils.isNotEmpty(zxqPoint)) {
List<PdmBiSlittingproductionplan> productionPlanList = pdmBiSlittingproductionplanMapper.selectList(new LambdaQueryWrapper<PdmBiSlittingproductionplan>().eq(PdmBiSlittingproductionplan::getContainer_name, containerName).eq(PdmBiSlittingproductionplan::getIs_delete, IOSEnum.IS_NOTANDYES.code("")));
if (productionPlanList.isEmpty()) {
if (CollectionUtils.isEmpty(productionPlanList)) {
log.info("装箱区的子卷号为" + containerName + "无对应的分切计划信息,请检查!");
throw new BadRequestException("装箱区的子卷号为" + containerName + "无对应的分切计划信息,请检查!");
}