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.dto.SchBaseTaskDto;
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.auto.TaskQueue;
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
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()))) {
throw new BadRequestException("子卷规格不一致,请检查!");
}
}
@@ -337,21 +336,9 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
new QueryWrapper<BstIvtBoxinfo>().lambda()
.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());
if (boxWeight.compareTo(new BigDecimal(0)) == 0) {
throw new BadRequestException("木箱的重量不能0");
}
totalWeight = totalWeight.add(boxWeight);
if (totalWeight.compareTo(new BigDecimal(0)) == 0) {
throw new BadRequestException("理论毛重不能为0");
}
//更新及子卷包装状态已分配规格及木箱规格组
String weightTotal = totalWeight.toString();
CompletableFuture.runAsync(() -> {
@@ -361,14 +348,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
log.error("子卷装箱异常updateBoxGroup更新子卷包装关系异常,木箱号为:" + boxSn + ",异常信息:" + e);
}
}, pool);
//给MES传输子卷包装关系
CompletableFuture.runAsync(() -> {
try {
transferBoxPackageToMes(false, whereJson, containerNameList, boxSn, weightTotal);
} catch (Exception e) {
log.error("子卷装箱异常transferBoxPackageToMes给MES传输子卷包装关系异常,木箱号为:" + boxSn + ",异常信息:" + e);
}
}, pool);
//待检区->装箱区agv任务
CompletableFuture.runAsync(() -> {
try {
@@ -377,6 +356,14 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
log.error("子卷装箱异常agvTransfer待检区->装箱区agv确定起点任务创建异常,木箱号为:" + boxSn + ",异常信息:" + e);
}
}, 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) {
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("num", packagerelationList.size());
param.put("box_no", packagerelationList.get(0).getPackage_box_sn());
param.put("box_weight", packagerelationList.get(0).getBox_weight());
} 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("rows", containerNameList.stream().collect(Collectors.toCollection(JSONArray::new)));
param.put("box_no", boxSn);
param.put("box_weight", totalWeight);
}

View File

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