1.子卷装箱增加子卷质检生成包装关系,去除临时包装关系;
2.修改最后一个子卷判断方式;
3.恢复装箱毛重推送,优化装箱页面;
This commit is contained in:
2024-07-31 13:53:18 +08:00
parent 66d23ee832
commit 2cc00c2c06
15 changed files with 264 additions and 204 deletions

View File

@@ -76,9 +76,10 @@ public class PdmBiSubpackagerelationController {
*
* @param whereJson 查询条件
*/
@GetMapping("/queryContainerNameBySaleOrder")
@PostMapping ("/queryContainerNameBySaleOrder")
@SaIgnore
@Log("根据订单号查询子卷信息")
public ResponseEntity<Object> queryContainerNameBySaleOrder(@RequestParam Map whereJson) {
public ResponseEntity<Object> queryContainerNameBySaleOrder(@RequestBody Map whereJson) {
return new ResponseEntity<>(TableDataInfo.build(pdmBiSubpackagerelationService.queryContainerNameBySaleOrder(whereJson)), HttpStatus.OK);
}
@@ -112,6 +113,7 @@ public class PdmBiSubpackagerelationController {
}
@PostMapping("/updateEntityList")
@SaIgnore
@Log("子卷装箱")
//@SaCheckPermission("@el.check(updateEntityList)")
public ResponseEntity<Object> updateEntityList(@RequestBody JSONObject whereJson) {

View File

@@ -324,6 +324,20 @@ public class PdmBiSubpackagerelation extends Model<PdmBiSubpackagerelation> {
private String paper_tube_description;
/**
* 纸管重量
*/
@TableField(exist = false)
private String paper_weight;
/**
* 子卷重量
*/
@TableField(exist = false)
private String weight;
/**
* 获取主键值

View File

@@ -28,6 +28,6 @@ public interface PdmBiSubpackagerelationMapper extends BaseMapper<PdmBiSubpackag
@Param("status") String status);
List<PdmBiSubpackagerelation> queryContainerNameBySaleOrder( @Param("sale_order_name") String sale_order_name);
List<PdmBiSubpackagerelation> queryContainerNameBySaleOrder( @Param("sale_order_name") String sale_order_name,@Param("container_name") String container_name);
}

View File

@@ -77,14 +77,22 @@
b.*,
(CASE
WHEN c.paper_tube_or_FRP = '1' THEN c.paper_tube_description
WHEN c.paper_tube_or_FRP = '2' THEN c.FRP_description END) AS paper_tube_description
WHEN c.paper_tube_or_FRP = '2' THEN c.FRP_description END) AS paper_tube_description,
c.weight,
c.paper_weight
FROM `pdm_bi_subpackagerelation` a
LEFT JOIN bst_ivt_packageinfoivt b ON a.container_name = b.container_name
LEFT JOIN pdm_bi_slittingproductionplan c ON a.container_name = c.container_name
WHERE b.point_status = '3'
AND b.ivt_status = '3'
AND a.sale_order_name = #{sale_order_name}
AND b.is_used = '1'
AND c.is_delete = '0'
<if test="sale_order_name != null and sale_order_name != ''">
AND a.sale_order_name = #{sale_order_name}
</if>
<if test="container_name != null and container_name != ''">
AND a.container_name = #{container_name}
</if>
ORDER BY box_group
</select>

View File

@@ -32,9 +32,10 @@ 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.DjqTask;
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.TaskQueue;
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxinfoService;
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.b_lms.storage_manage.ios.enums.IOSEnum;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.OutBoxManageService;
@@ -43,7 +44,6 @@ import org.nl.common.domain.query.PageQuery;
import org.nl.common.enums.PackageInfoIvtEnum;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.system.service.param.ISysParamService;
import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.redisson.api.RLock;
@@ -79,11 +79,9 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
private IschBaseTaskService taskService;
@Resource
private ZxqTask zxqTask;
@Resource
private ZxDjwTask zxDjwTask;
@Resource
private ISysParamService iSysParamService;
private IBstIvtBoxinfoService iBstIvtBoxinfoService;
@Resource
private LmsToMesServiceImpl lmsToMesServiceImpl;
@@ -145,7 +143,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
TableDataInfo<Map> build = TableDataInfo.build(mst_detail);
build.setTotalElements(page.getTotal());
return build;
}
@@ -189,15 +186,28 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
/**
* 根据订单号查询子卷信息
*
* @param whereJson 查询条件
*/
@Override
public List<PdmBiSubpackagerelation> queryContainerNameBySaleOrder(Map whereJson) {
if (!whereJson.containsKey("sale_order_name")) {
List<PdmBiSubpackagerelation> pdmBiSubpackagerelationList;
//请求来源
if (!whereJson.containsKey("type")) {
return Collections.emptyList();
}
List<PdmBiSubpackagerelation> pdmBiSubpackagerelationList = pdmBiSubpackagerelationMapper.queryContainerNameBySaleOrder(whereJson.get("sale_order_name").toString());
if (whereJson.get("type").toString().equals(PackageInfoIvtEnum.REQUEST_SOURCE.code("PC"))) {
//订单号
if (!whereJson.containsKey("sale_order_name")) {
return Collections.emptyList();
}
pdmBiSubpackagerelationList = pdmBiSubpackagerelationMapper.queryContainerNameBySaleOrder(whereJson.get("sale_order_name").toString(), null);
} else {
//子卷号
if (!whereJson.containsKey("container_name")) {
return Collections.emptyList();
}
pdmBiSubpackagerelationList = pdmBiSubpackagerelationMapper.queryContainerNameBySaleOrder(null, whereJson.get("container_name").toString());
}
Map<String, Long> countByGroup = pdmBiSubpackagerelationList.stream()
.filter(item -> item.getBox_group() != null)
.collect(Collectors.groupingBy(PdmBiSubpackagerelation::getBox_group, Collectors.counting()));
@@ -205,19 +215,19 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
//获取子卷长度
// int containerLength = getMaxNum(null, r.getPaper_tube_description());
// r.setUn_plan_product_property3(Integer.toString(containerLength));
if (r.getBox_group() != null) {
r.setQuanlity_in_box(BigDecimal.valueOf(countByGroup.getOrDefault(r.getBox_group(), null)));
} else {
r.setQuanlity_in_box(BigDecimal.ZERO);
r.setBox_group("0");
if (whereJson.get("type").toString().equals(PackageInfoIvtEnum.REQUEST_SOURCE.code("PC"))) {
if (r.getBox_group() != null) {
r.setQuanlity_in_box(BigDecimal.valueOf(countByGroup.getOrDefault(r.getBox_group(), null)));
} else {
r.setQuanlity_in_box(BigDecimal.ZERO);
r.setBox_group("0");
}
}
// 调用方法获取木箱料号:输入:子卷号、输出:木箱信息
PdmBiOrderbominfo bomInfoDao = iPdmBiOrderbominfoService.getBiOrderbominfoByContainer(r.getContainer_name());
if (ObjectUtil.isNotEmpty(bomInfoDao)) {
r.setBox_type(bomInfoDao.getProductName());
}
});
return pdmBiSubpackagerelationList;
}
@@ -253,28 +263,22 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
*
* @param whereJson 分配信息
*/
//@Override
@Override
@Transactional(rollbackFor = Exception.class)
public void updateEntityList8(JSONObject whereJson) {
//todo 正式环境代码,需恢复
StopWatch stopWatch = new StopWatch();
stopWatch.start();
public void updateEntityList(JSONObject whereJson) {
List<PdmBiSubpackagerelation> packagerelationList = JSONObject.parseArray(whereJson.getJSONArray("tableMater").toJSONString(), PdmBiSubpackagerelation.class);
if (CollectionUtils.isEmpty(packagerelationList)) {
throw new BadRequestException("无选中子卷信息");
}
if (packagerelationList.size() > 1) {
throw new BadRequestException("暂时只能选择一个子卷");
}
//检查是否存在已分配规格的子卷号
List<PdmBiSubpackagerelation> isOutBox = packagerelationList.stream().filter(r -> r.getStatus().equals("0")).collect(Collectors.toList());
if (isOutBox.size() > 0) {
throw new BadRequestException("标记为黄色的子卷号已分配且对应的木箱已出库,请重新选择未分配木箱规格的子卷");
}
// JSONArray jsonArray = whereJson.getJSONArray("tableMater");
// if (jsonArray == null || jsonArray.size() == 0) {
// throw new BadRequestException("无选中子卷信息");
// }
JSONArray jsonArray = whereJson.getJSONArray("tableMater");
if (jsonArray == null || jsonArray.size() == 0) {
throw new BadRequestException("无选中子卷信息");
}
//均衡获取木箱出库装箱区对接位
String deviceCode = getPointCode();
Integer taskCount = bstIvtPackageinfoivtMapper.getZxqTaskCount(deviceCode.substring(deviceCode.lastIndexOf("_") + 1));
@@ -303,7 +307,7 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
.collect(Collectors.toSet());
List<PdmBiSlittingproductionplan> planList = iPdmBiSlittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>().in(PdmBiSlittingproductionplan::getContainer_name, containerNameList));
if (CollectionUtils.isEmpty(planList)) {
throw new BadRequestException("该箱号不存在分切计划");
throw new BadRequestException("需要装箱的子卷号不存在分切计划");
}
BigDecimal totalWeight;
totalWeight = planList.stream()
@@ -315,59 +319,101 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
if (totalWeight.compareTo(new BigDecimal(0)) == 0) {
throw new BadRequestException("分切计划的子卷重量不能为0");
}
BigDecimal boxWeight = new BigDecimal(whereJson.getString("box_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");
}
stopWatch.stop();
System.out.println("子卷装箱代码1装箱信息查询执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
log.info("子卷装箱代码1箱信息查询执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
outBox8(workIdList, containerNameList, deviceCode, maxBoxGroup, whereJson.getString("checked"), totalWeight.toString());
outBox(workIdList, containerNameList, deviceCode, maxBoxGroup, whereJson.getString("checked"), totalWeight);
} catch (Exception e) {
throw new BadRequestException(e.getMessage());
}
}
/**
* 子卷装箱
*
* @param whereJson 分配信息
*/
// @Override
@Transactional(rollbackFor = Exception.class)
public void updateEntityList8(JSONObject whereJson) {
List<PdmBiSubpackagerelation> packagerelationList = JSONObject.parseArray(whereJson.getJSONArray("tableMater").toJSONString(), PdmBiSubpackagerelation.class);
if (CollectionUtils.isEmpty(packagerelationList)) {
throw new BadRequestException("无选中子卷信息");
}
//检查是否存在已分配规格的子卷号
List<PdmBiSubpackagerelation> isOutBox = packagerelationList.stream().filter(r -> r.getStatus().equals("0")).collect(Collectors.toList());
if (isOutBox.size() > 0) {
throw new BadRequestException("标记为黄色的子卷号已分配且对应的木箱已出库,请重新选择未分配木箱规格的子卷");
}
//均衡获取木箱出库装箱区对接位
String deviceCode = getPointCode();
Integer taskCount = bstIvtPackageinfoivtMapper.getZxqTaskCount(deviceCode.substring(deviceCode.lastIndexOf("_") + 1));
if (taskCount + packagerelationList.size() > 10) {
throw new BadRequestException("子卷搬运任务数已达上限!");
}
List<PdmBiSubpackagerelation> pdmBiSubpackagerelationList = pdmBiSubpackagerelationMapper
.selectList(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getSale_order_name, packagerelationList.get(0).getSale_order_name()));
Integer maxBoxGroup = pdmBiSubpackagerelationList.stream()
.map(PdmBiSubpackagerelation::getBox_group)
.filter(Objects::nonNull)
.map(Integer::parseInt)
.max(Integer::compareTo)
.orElse(0) + 1;
List<String> workIdList = JSONObject.parseArray(whereJson.getJSONArray("tableMater").toJSONString(), PdmBiSubpackagerelation.class).stream()
.map(PdmBiSubpackagerelation::getWorkorder_id)
.map(String::valueOf)
.collect(Collectors.toList());
if (workIdList.isEmpty()) {
return;
}
//根据分切计划获取子卷重量计算理论毛重
Set<String> containerNameList = packagerelationList.stream()
.map(PdmBiSubpackagerelation::getContainer_name)
.collect(Collectors.toSet());
outBox8(workIdList, containerNameList, deviceCode, maxBoxGroup, whereJson.getString("checked"));
}
/**
* 空木箱出库
*/
private void outBox8(List<String> workIdList, Set<String> containerNameList, String deviceCode, Integer maxBoxGroup, String boxType, String totalWeight) {
//todo 正式环境代码,需恢复
//均衡获取装箱对接位
//String deviceCode = "ZXQ_1_1";
StopWatch stopWatch = new StopWatch();
stopWatch.start();
private void outBox(List<String> workIdList, Set<String> containerNameList, String deviceCode, Integer maxBoxGroup, String boxType, BigDecimal totalWeight) {
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 = "MX230118000013";
BstIvtBoxinfo boxDao = iBstIvtBoxinfoService.getOne(
new QueryWrapper<BstIvtBoxinfo>().lambda()
.eq(BstIvtBoxinfo::getBox_no, boxSn)
);
if (StringUtils.isBlank(boxDao.getBox_weight())) {
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");
}
StopWatch stopWatch1 = new StopWatch();
stopWatch1.start();
//更新及子卷包装状态已分配规格及木箱规格组
String weightTotal = totalWeight.toString();
CompletableFuture.runAsync(() -> {
try {
//updateBoxGroup(maxBoxGroup, workIdList, boxSn, boxType, totalWeight);
updateBoxGroup(maxBoxGroup, workIdList, boxSn, boxType, weightTotal);
} catch (Exception e) {
log.error("异常信息" + e);
log.error("子卷装箱异常,更新子卷包装关系异常:" + e);
}
}, pool);
//给LMS传输子卷包装关系
//给MES传输子卷包装关系
CompletableFuture.runAsync(() -> {
try {
transferBoxPackageToMes(true, null, containerNameList, boxSn, totalWeight);
transferBoxPackageToMes(true, null, containerNameList, boxSn, weightTotal);
} catch (Exception e) {
log.error("异常信息" + e);
log.error("子卷装箱异常给MES传输子卷包装关系异常:" + e);
}
}, pool);
//待检区->装箱区agv任务
@@ -375,16 +421,45 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
try {
agvTransfer(containerNameList, deviceCode, boxSn);
} catch (Exception e) {
log.error("异常信息" + e);
log.error("子卷装箱异常,待检区->装箱区agv确定起点任务创建异常:" + e);
}
}, pool);
stopWatch1.stop();
System.out.println("子卷装箱代码2装箱信息更新执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch1.getTotalTimeMillis());
log.info("子卷装箱代码2装箱信息更新执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch1.getTotalTimeMillis());
}
private void updateBoxGroup(Integer maxBoxGroup, List<String> entityList, String boxSn, String boxType) {
/**
* 空木箱出库
*/
private void outBox8(List<String> workIdList, Set<String> containerNameList, String deviceCode, Integer
maxBoxGroup, String boxType) {
//均衡获取装箱对接位
JSONObject boxInfo = new JSONObject();
//确定装箱区终点
boxInfo.put("device_code", deviceCode);
boxInfo.put("material_code", boxType);
boxInfo.put("num", workIdList.size());
String boxSn = outBoxManageService.outBox(boxInfo);
//更新及子卷包装状态已分配规格及木箱规格组
CompletableFuture.runAsync(() -> {
try {
// updateBoxGroup(maxBoxGroup, workIdList, boxSn, boxType);
} catch (Exception e) {
log.error("updateBoxGroup接口更新及子卷包装状态已分配规格及木箱规格组异常" + e);
}
}, pool);
//待检区->装箱区agv任务
CompletableFuture.runAsync(() -> {
try {
agvTransfer(containerNameList, deviceCode, boxSn);
} catch (Exception e) {
log.error("agvTransfer接口待检区->装箱区agv任务异常" + e);
}
}, pool);
}
private void updateBoxGroup(Integer maxBoxGroup, List<String> entityList, String boxSn, String boxType, String totalWeight) {
UpdateWrapper<PdmBiSubpackagerelation> updateWrapper = new UpdateWrapper<>();
//理论毛重
updateWrapper.set("box_weight", totalWeight);
updateWrapper.set("package_box_sn", boxSn);
updateWrapper.set("quanlity_in_box", entityList.size());
updateWrapper.set("box_type", boxType);
@@ -426,7 +501,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
protected void agvTransfer8(Set<String> containerNameList, String deviceCode, String boxSn) {
//todo 正式环境代码,需恢复
//待检区点位
List<BstIvtPackageinfoivt> djqPointList = packageinfoivtService
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
@@ -469,7 +543,7 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
if (CollectionUtils.isEmpty(bstIvtPackageinfoivtList)) {
throw new BadRequestException("没有可用的装箱区对接位");
}
Map<String, Integer> resultMap = new HashMap<>();
Map<String, Integer> resultMap = new LinkedHashMap<>();
//获取装箱位任务数量
List<Map<String, Object>> taskCount = bstIvtPackageinfoivtMapper.getPointTaskCount();
if (taskCount != null) {
@@ -485,12 +559,12 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
}
}
bstIvtPackageinfoivtList.stream()
.collect(Collectors.toMap(
BstIvtPackageinfoivt::getPoint_code,
p -> StringUtils.isNotBlank(p.getContainer_name()) ? 1 : 0,
Integer::sum
))
.forEach((key, value) -> resultMap.merge(key, value, Integer::sum));
.sorted(Comparator.comparing(BstIvtPackageinfoivt::getSort_seq))
.forEach(p -> {
String key = p.getPoint_code();
int value = StringUtils.isNotBlank(p.getContainer_name()) ? 1 : 0;
resultMap.merge(key, value, Integer::sum);
});
List<Map<String, Integer>> result = resultMap.entrySet().stream()
.map(entry -> Collections.singletonMap(entry.getKey(), entry.getValue()))
.collect(Collectors.toList());
@@ -574,88 +648,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
sub.setProduct_name("测试");
this.saveOrUpdate(sub);
}
}
/**
* 子卷装箱
*
* @param whereJson 分配信息
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateEntityList(JSONObject whereJson) {
List<PdmBiSubpackagerelation> packagerelationList = JSONObject.parseArray(whereJson.getJSONArray("tableMater").toJSONString(), PdmBiSubpackagerelation.class);
if (CollectionUtils.isEmpty(packagerelationList)) {
throw new BadRequestException("无选中子卷信息");
}
// if (packagerelationList.size() > 1) {
// throw new BadRequestException("暂时只能选择一个子卷");
// }
//检查是否存在已分配规格的子卷号
List<PdmBiSubpackagerelation> isOutBox = packagerelationList.stream().filter(r -> r.getStatus().equals("0")).collect(Collectors.toList());
if (isOutBox.size() > 0) {
throw new BadRequestException("标记为黄色的子卷号已分配且对应的木箱已出库,请重新选择未分配木箱规格的子卷");
}
//均衡获取木箱出库装箱区对接位
String deviceCode = getPointCode();
Integer taskCount = bstIvtPackageinfoivtMapper.getZxqTaskCount(deviceCode.substring(deviceCode.lastIndexOf("_") + 1));
if (taskCount + packagerelationList.size() > 10) {
throw new BadRequestException("子卷搬运任务数已达上限!");
}
List<PdmBiSubpackagerelation> pdmBiSubpackagerelationList = pdmBiSubpackagerelationMapper
.selectList(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getSale_order_name, packagerelationList.get(0).getSale_order_name()));
Integer maxBoxGroup = pdmBiSubpackagerelationList.stream()
.map(PdmBiSubpackagerelation::getBox_group)
.filter(Objects::nonNull)
.map(Integer::parseInt)
.max(Integer::compareTo)
.orElse(0) + 1;
List<String> workIdList = JSONObject.parseArray(whereJson.getJSONArray("tableMater").toJSONString(), PdmBiSubpackagerelation.class).stream()
.map(PdmBiSubpackagerelation::getWorkorder_id)
.map(String::valueOf)
.collect(Collectors.toList());
if (workIdList.isEmpty()) {
return;
}
//根据分切计划获取子卷重量计算理论毛重
Set<String> containerNameList = packagerelationList.stream()
.map(PdmBiSubpackagerelation::getContainer_name)
.collect(Collectors.toSet());
outBox(workIdList, containerNameList, deviceCode, maxBoxGroup, whereJson.getString("checked"));
}
/**
* 空木箱出库
*/
private void outBox(List<String> workIdList, Set<String> containerNameList, String deviceCode, Integer
maxBoxGroup, String boxType) {
//均衡获取装箱对接位
JSONObject boxInfo = new JSONObject();
//确定装箱区终点
boxInfo.put("device_code", deviceCode);
boxInfo.put("material_code", boxType);
boxInfo.put("num", workIdList.size());
String boxSn = outBoxManageService.outBox(boxInfo);
//更新及子卷包装状态已分配规格及木箱规格组
CompletableFuture.runAsync(() -> {
try {
updateBoxGroup(maxBoxGroup, workIdList, boxSn, boxType);
} catch (Exception e) {
log.error("updateBoxGroup接口更新及子卷包装状态已分配规格及木箱规格组异常" + e);
}
}, pool);
//待检区->装箱区agv任务
CompletableFuture.runAsync(() -> {
try {
agvTransfer(containerNameList, deviceCode, boxSn);
} catch (Exception e) {
log.error("agvTransfer接口待检区->装箱区agv任务异常" + e);
}
}, pool);
}

View File

@@ -14,6 +14,7 @@ import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.nl.b_lms.pdm.info.service.IPdmBiContainerinfoService;
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.dao.mapper.BstIvtPackageinfoivtMapper;
@@ -62,7 +63,8 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
@Resource
private IpdmBiSubpackagerelationService subpackagerelationService;
@Resource
private IPdmBiContainerinfoService iPdmBiContainerinfoService;
/**
* 查询数据分页
*
@@ -827,7 +829,7 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
return result;
}
if (whereJson.getString("ivt_status").equals(PackageInfoIvtEnum.IVT_STATUS.code("合格品"))) {
subpackagerelationService.createSubTest(whereJson);
iPdmBiContainerinfoService.createSubInfoByContainer(whereJson.getString("container_name"));
}
updateWrapper.set("container_name", dtoList.get(0).getContainer_name());
updateWrapper.set("ivt_status", whereJson.getString("ivt_status"));
@@ -836,7 +838,7 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
else if (StringUtils.isNotBlank(whereJson.getString("container_name")) && StringUtils.isNotBlank(whereJson.getString("pointCode"))) {
dtoList = bstIvtPackageinfoivtMapper.selectList(new LambdaQueryWrapper<BstIvtPackageinfoivt>().eq(BstIvtPackageinfoivt::getPoint_code, whereJson.getString("pointCode").equals("1") ? "ZXQ_135" : "ZXQ_136"));
if (whereJson.getString("ivt_status").equals(PackageInfoIvtEnum.IVT_STATUS.code("合格品"))) {
subpackagerelationService.createSubTest(whereJson);
iPdmBiContainerinfoService.createSubInfoByContainer(whereJson.getString("container_name"));
updateWrapper.set("container_name", whereJson.getString("container_name"));
updateWrapper.set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("合格品"));
} else {

View File

@@ -149,7 +149,7 @@ public class ZxDjwTask extends AbstractAcsTask {
//5.最后一个子卷,清除装箱位木箱信息
packageinfoivtService.update(null, new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code2()));
//清除最后一个子卷计数
redisUtils.set(NUM_KEY, 0);
//redisUtils.set(NUM_KEY, 0);
//6.创建装箱区->待检区或管制区补空任务
callingVehicleToDjqOrGzq(Integer.parseInt(packagerelationList.get(0).getQuanlity_in_box().toString()));
}
@@ -173,7 +173,8 @@ public class ZxDjwTask extends AbstractAcsTask {
}
/**
* 装箱任务完成,异步调用装箱区->待检区补空任务
* 装箱任务完成,异步间隔调用装箱区->待检区补空任务
* <a href="https://maimai.cn/article/detail?fid=1481325336&efid=HqBFR_5bjNMzuqkNhfwv0g">...</a>
*/
public void callingVehicleToDjqOrGzq(Integer callingNum) {
CompletableFuture.runAsync(() -> {
@@ -189,7 +190,7 @@ public class ZxDjwTask extends AbstractAcsTask {
}
}
} catch (Exception e) {
log.error("updateBoxGroup接口更新及子卷包装状态已分配规格及木箱规格组异常" + e);
log.error("子卷装箱异常,子卷装箱完成,空载具->待检区或管制区任务创建失败" + e);
}
}, pool);
}

View File

@@ -146,8 +146,14 @@ public class AutoSendZxToDjw {
jo.put("is_send", IOSEnum.IS_NOTANDYES.code(""));
//扩展参数
JSONObject param = new JSONObject();
//子卷号
param.put("barcode", containerName);
//查询是否为最后一个子卷,相同木箱号且子卷包装状态为生成
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", IOSEnum.IS_NOTANDYES.code(""));
} else {
param.put("lastOne", IOSEnum.IS_NOTANDYES.code(""));
}
//获取木箱高度等级
param.put("heightLevel", getHeightLevel(bstIvtBoxinfo));
//获取子卷长度
@@ -156,26 +162,17 @@ public class AutoSendZxToDjw {
param.put("maxNo", bstIvtBoxinfo.getNum());
//托盘类型 1小托盘 2大托盘
param.put("containerType", bstIvtBoxinfo.getVehicle_type());
//木箱计划放入子卷数量
//木箱放入子卷数量
param.put("boxNo", relationList.get(0).getQuanlity_in_box());
Integer num = getNumFromRedis();
num = num + 1;
if (num.equals(Integer.parseInt(relationList.get(0).getQuanlity_in_box().toString()))) {
param.put("lastOne", IOSEnum.IS_NOTANDYES.code(""));
num = 0;
} else {
param.put("lastOne", IOSEnum.IS_NOTANDYES.code(""));
}
// 更新计数
redisUtils.set(NUM_KEY, num);
//子卷号
param.put("barcode", containerName);
jo.put("request_param", param.toString());
zxDjwTask.createTask(jo);
// try {
//todo 传输子卷包装关系至MES,暂时不计算,MES会推过来
//transferBoxPackageToMes(relationList, bstIvtBoxinfo);
// } catch (Exception ex) {
// log.error("装箱区->装箱对接位sendZxToDjw,传输子卷包装关系至MES接口捕获异常信息" + ex);
// }
try {
transferBoxPackageToMes(relationList, bstIvtBoxinfo);
} catch (Exception ex) {
log.error("子卷装箱异常,传输子卷包装关系至MES接口捕获异常信息" + ex);
}
}
}
} else {
@@ -194,7 +191,7 @@ public class AutoSendZxToDjw {
*/
public void transferBoxPackageToMes(List<PdmBiSubpackagerelation> packagerelationList, BstIvtBoxinfo bstIvtBoxinfo) {
if (StringUtils.isBlank(packagerelationList.get(0).getPackage_box_sn())) {
log.info("transferBoxPackageToMes接口的子卷号" + packagerelationList.get(0).getContainer_name() + ",子卷未确定木箱规格信息");
log.info("子卷装箱异常,transferBoxPackageToMes接口的子卷号" + packagerelationList.get(0).getContainer_name() + ",子卷未确定木箱规格信息");
throw new BadRequestException("子卷未确定木箱规格信息!");
}
JSONObject param = new JSONObject();
@@ -203,7 +200,7 @@ public class AutoSendZxToDjw {
.collect(Collectors.toSet());
List<PdmBiSlittingproductionplan> planList = iPdmBiSlittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>().in(PdmBiSlittingproductionplan::getContainer_name, containerNameList));
if (CollectionUtils.isEmpty(planList)) {
log.info("装箱区的子卷号" + planList.get(0).getContainer_name() + "无对应的分切计划信息,请检查!");
log.info("子卷装箱异常transferBoxPackageToMes接口的子卷号" + packagerelationList.get(0).getContainer_name() + ",无对应的分切计划信息,请检查!");
throw new BadRequestException("该箱号不存在分切计划");
}
BigDecimal totalWeight;
@@ -214,17 +211,17 @@ public class AutoSendZxToDjw {
.map(BigDecimal::new)
.reduce(BigDecimal.ZERO, BigDecimal::add);
if (totalWeight.compareTo(new BigDecimal(0)) == 0) {
log.info(planList.get(0).getContainer_name()+"分切计划的子卷重量不能为0");
log.info("子卷装箱异常transferBoxPackageToMes接口的子卷号" + packagerelationList.get(0).getContainer_name() + ",分切计划的子卷重量不能为0");
throw new BadRequestException("分切计划的子卷重量不能为0");
}
BigDecimal boxWeight = new BigDecimal(bstIvtBoxinfo.getBox_weight());
if (boxWeight.compareTo(new BigDecimal(0)) == 0) {
log.info(planList.get(0).getContainer_name()+"对应的木箱的重量不能0");
log.info("子卷装箱异常transferBoxPackageToMes接口的子卷号" + packagerelationList.get(0).getContainer_name() + ",对应的木箱的重量不能0");
throw new BadRequestException("木箱的重量不能0");
}
totalWeight = totalWeight.add(boxWeight);
if (totalWeight.compareTo(new BigDecimal(0)) == 0) {
log.info(planList.get(0).getContainer_name()+"理论毛重计算有误不能为0,请检查!");
log.info("子卷装箱异常transferBoxPackageToMes接口的子卷号" + packagerelationList.get(0).getContainer_name() + ",理论毛重计算有误不能为0,请检查!");
throw new BadRequestException("理论毛重不能为0");
}
//更新子卷包装关系的重量
@@ -244,7 +241,6 @@ public class AutoSendZxToDjw {
void sendZxToDjw8() {
//todo 正式环境代码,需恢复
//装箱位有木箱
List<BstIvtPackageinfoivt> zxwPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱位"), PackageInfoIvtEnum.IVT_STATUS.code("空载具"), "", PackageInfoIvtEnum.SORT_TYPE.code("升序"), PackageInfoIvtEnum.TASK_TYPE.code("装箱区->装箱对接位"));
if (CollectionUtils.isEmpty(zxwPackageinfoivtList)) {
@@ -312,6 +308,32 @@ public class AutoSendZxToDjw {
param.put("barcode", containerName);
jo.put("request_param", param.toString());
zxDjwTask.createTask(jo);
//扩展参数
// JSONObject param = new JSONObject();
// //子卷号
// param.put("barcode", containerName);
// //获取木箱高度等级
// param.put("heightLevel", getHeightLevel(bstIvtBoxinfo));
// //获取子卷长度
// param.put("len", getMaxNum(productionPlanList.get(0), null));
// //木箱最大数量
// param.put("maxNo", bstIvtBoxinfo.getNum());
// //托盘类型 1小托盘 2大托盘
// param.put("containerType", bstIvtBoxinfo.getVehicle_type());
// //木箱计划放入子卷数量
// param.put("boxNo", relationList.get(0).getQuanlity_in_box());
// Integer num = getNumFromRedis();
// num = num + 1;
// if (num.equals(Integer.parseInt(relationList.get(0).getQuanlity_in_box().toString()))) {
// param.put("lastOne", IOSEnum.IS_NOTANDYES.code("是"));
// num = 0;
// } else {
// param.put("lastOne", IOSEnum.IS_NOTANDYES.code("否"));
// }
// // 更新计数
// redisUtils.set(NUM_KEY, num);
// jo.put("request_param", param.toString());
// zxDjwTask.createTask(jo);
}
}

View File

@@ -73,9 +73,9 @@ public class TaskQueue {
zxqTask.immediateNotifyAcs(null);
log.info("待检区->装箱区agv任务编号为"+task.getTask_code()+",任务状态为:"+task.getTask_status()+"下发完成。");
//同步删除子卷包装关系
LambdaQueryWrapper<PdmBiSubpackagerelation> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PdmBiSubpackagerelation::getContainer_name, task.getVehicle_code());
pdmBiSubpackagerelationMapper.delete(queryWrapper);
//LambdaQueryWrapper<PdmBiSubpackagerelation> queryWrapper = new LambdaQueryWrapper<>();
//queryWrapper.eq(PdmBiSubpackagerelation::getContainer_name, task.getVehicle_code());
//pdmBiSubpackagerelationMapper.delete(queryWrapper);
}
}

View File

@@ -18,16 +18,12 @@
AND attr.lock_type = '1'
AND attr.is_delete = '0'
and attr.is_used = '1'
<if test="query.search != null and query.search != ''">
and (box.material_code = #{query.search}
or box.material_name LIKE '%${query.search}%')
</if>
GROUP BY box.material_code
</where>
</select>
<select id="getBoxIvtPage" resultType="java.util.Map">

View File

@@ -66,7 +66,10 @@ public enum PackageInfoIvtEnum {
PACK_POINT(MapOf.of("装箱对接位01", "ZXQ_1_1")),
//库存状态
IVT_STATUS(MapOf.of("", "0", "空载具", "1", "有子卷", "2", "合格品", "3", "管制品", "4"));
IVT_STATUS(MapOf.of("", "0", "空载具", "1", "有子卷", "2", "合格品", "3", "管制品", "4")),
//请求源
REQUEST_SOURCE(MapOf.of("PC", "0", "手持", "1"));
private Map<String, String> code;