fix:修复推送MES包装关系

This commit is contained in:
2024-08-02 17:31:02 +08:00
parent 526ca7aa40
commit 80f5e8fa1e
2 changed files with 28 additions and 29 deletions

View File

@@ -32,7 +32,6 @@ 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.dao.SchBaseTask;
import org.nl.b_lms.sch.task.dto.SchBaseTaskDto; import org.nl.b_lms.sch.task.dto.SchBaseTaskDto;
import org.nl.b_lms.sch.task.service.IschBaseTaskService; 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.ZxqTask; import org.nl.b_lms.sch.tasks.first_floor_area.ZxqTask;
import org.nl.b_lms.sch.tasks.first_floor_area.auto.TaskQueue; import org.nl.b_lms.sch.tasks.first_floor_area.auto.TaskQueue;
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxinfoService; import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxinfoService;
@@ -53,6 +52,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
@@ -317,7 +317,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
.anyMatch(r -> !r.getPaper_tube_description().equals(packagerelationList.get(0).getPaper_tube_description()))) { .anyMatch(r -> !r.getPaper_tube_description().equals(packagerelationList.get(0).getPaper_tube_description()))) {
throw new BadRequestException("子卷规格不一致,请检查!"); throw new BadRequestException("子卷规格不一致,请检查!");
} }
} }
@@ -337,21 +336,9 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
new QueryWrapper<BstIvtBoxinfo>().lambda() new QueryWrapper<BstIvtBoxinfo>().lambda()
.eq(BstIvtBoxinfo::getBox_no, boxSn) .eq(BstIvtBoxinfo::getBox_no, boxSn)
); );
if (StringUtils.isBlank(boxDao.getBox_weight())) {
throw new BadRequestException("木箱的重量不能为空!");
}
if (workIdList.size() > Integer.parseInt(boxDao.getNum())) {
throw new BadRequestException("子卷数量超过木箱的最大装卷数!");
}
//木箱重量 //木箱重量
BigDecimal boxWeight = new BigDecimal(boxDao.getBox_weight()); BigDecimal boxWeight = new BigDecimal(boxDao.getBox_weight());
if (boxWeight.compareTo(new BigDecimal(0)) == 0) {
throw new BadRequestException("木箱的重量不能0");
}
totalWeight = totalWeight.add(boxWeight); totalWeight = totalWeight.add(boxWeight);
if (totalWeight.compareTo(new BigDecimal(0)) == 0) {
throw new BadRequestException("理论毛重不能为0");
}
//更新及子卷包装状态已分配规格及木箱规格组 //更新及子卷包装状态已分配规格及木箱规格组
String weightTotal = totalWeight.toString(); String weightTotal = totalWeight.toString();
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
@@ -361,14 +348,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
log.error("子卷装箱异常updateBoxGroup更新子卷包装关系异常,木箱号为:" + boxSn + ",异常信息:" + e); log.error("子卷装箱异常updateBoxGroup更新子卷包装关系异常,木箱号为:" + boxSn + ",异常信息:" + e);
} }
}, pool); }, pool);
//给MES传输子卷包装关系
CompletableFuture.runAsync(() -> {
try {
transferBoxPackageToMes(false, whereJson, containerNameList, boxSn, weightTotal);
} catch (Exception e) {
log.error("子卷装箱异常transferBoxPackageToMes给MES传输子卷包装关系异常,木箱号为:" + boxSn + ",异常信息:" + e);
}
}, pool);
//待检区->装箱区agv任务 //待检区->装箱区agv任务
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
try { try {
@@ -377,6 +356,14 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
log.error("子卷装箱异常agvTransfer待检区->装箱区agv确定起点任务创建异常,木箱号为:" + boxSn + ",异常信息:" + e); log.error("子卷装箱异常agvTransfer待检区->装箱区agv确定起点任务创建异常,木箱号为:" + boxSn + ",异常信息:" + e);
} }
}, pool); }, pool);
//给MES传输子卷包装关系
CompletableFuture.runAsync(() -> {
try {
transferBoxPackageToMes(false, whereJson, containerNameList, boxSn, weightTotal);
} catch (Exception e) {
log.error("子卷装箱异常transferBoxPackageToMes给MES传输子卷包装关系异常,木箱号为:" + boxSn + ",异常信息:" + e);
}
}, pool);
} }
@@ -410,14 +397,26 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
if (boxWeight.compareTo(new BigDecimal(0)) == 0) { if (boxWeight.compareTo(new BigDecimal(0)) == 0) {
throw new BadRequestException("理论毛重不能为0"); throw new BadRequestException("理论毛重不能为0");
} }
JSONArray containerJsonArray = packagerelationList.stream().map(PdmBiSubpackagerelation::getContainer_name).collect(Collectors.toCollection(JSONArray::new)); //推送MES
JSONArray containerJsonArray = new JSONArray();
packagerelationList.forEach(r -> {
JSONObject jsonObject = new JSONObject();
jsonObject.put("ContainerName", r.getContainer_name());
containerJsonArray.add(jsonObject);
});
param.put("rows", containerJsonArray); param.put("rows", containerJsonArray);
param.put("num", packagerelationList.size()); param.put("num", packagerelationList.size());
param.put("box_no", packagerelationList.get(0).getPackage_box_sn()); param.put("box_no", packagerelationList.get(0).getPackage_box_sn());
param.put("box_weight", packagerelationList.get(0).getBox_weight()); param.put("box_weight", packagerelationList.get(0).getBox_weight());
} else { } else {
JSONArray containerJsonArray = new JSONArray();
packagerelationList.forEach(r -> {
JSONObject jsonObject = new JSONObject();
jsonObject.put("ContainerName", r.getContainer_name());
containerJsonArray.add(jsonObject);
});
param.put("rows", containerJsonArray);
param.put("num", containerNameList.size()); param.put("num", containerNameList.size());
param.put("rows", containerNameList.stream().collect(Collectors.toCollection(JSONArray::new)));
param.put("box_no", boxSn); param.put("box_no", boxSn);
param.put("box_weight", totalWeight); param.put("box_weight", totalWeight);
} }

View File

@@ -168,11 +168,11 @@ public class AutoSendZxToDjw {
param.put("barcode", containerName); param.put("barcode", containerName);
jo.put("request_param", param.toString()); jo.put("request_param", param.toString());
zxDjwTask.createTask(jo); zxDjwTask.createTask(jo);
try { // try {
transferBoxPackageToMes(relationList, bstIvtBoxinfo); // transferBoxPackageToMes(relationList, bstIvtBoxinfo);
} catch (Exception ex) { // } catch (Exception ex) {
log.error("子卷装箱异常,传输子卷包装关系至MES接口捕获异常信息" + ex); // log.error("子卷装箱异常,传输子卷包装关系至MES接口捕获异常信息" + ex);
} // }
} }
} }
} else { } else {