opt:优化空木箱出库,装箱区,子卷木箱分配相关逻辑。
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
package org.nl.b_lms.pdm.subpackagerelation.service.impl;
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
|
||||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.mapper.PdmBiSlittingproductionplanMapper;
|
||||
@@ -17,6 +14,9 @@ import org.nl.b_lms.pdm.subpackagerelation.dao.mapper.PdmBiSubpackagerelationMap
|
||||
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
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.tasks.first_floor_area.ZxDjwTask;
|
||||
import org.nl.b_lms.sch.tasks.first_floor_area.ZxqTask;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.OutBoxManageService;
|
||||
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||
@@ -24,8 +24,6 @@ import org.nl.common.utils.SecurityUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.pdm.service.SlittingproductionplanService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
@@ -49,13 +47,20 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
|
||||
@Resource
|
||||
private ZxqTask zxqTask;
|
||||
@Resource
|
||||
private ZxDjwTask zxDjwTask;
|
||||
|
||||
@Resource
|
||||
private OutBoxManageService outBoxManageService;
|
||||
@Resource
|
||||
private PdmBiSlittingproductionplanMapper pdmBiSlittingproductionplanMapper;
|
||||
@Resource
|
||||
private IbstIvtPackageinfoivtService packageinfoivtService;
|
||||
|
||||
@Resource
|
||||
private PdmBiSubpackagerelationMapper pdmBiSubpackagerelationMapper;
|
||||
@Resource
|
||||
private BstIvtPackageinfoivtMapper bstIvtPackageinfoivtMapper;
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
@@ -178,6 +183,10 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateEntityList(JSONObject whereJson) {
|
||||
List<PdmBiSubpackagerelation> packagerelationList = JSONObject.parseArray(whereJson.getJSONArray("tableMater").toJSONString(), PdmBiSubpackagerelation.class);
|
||||
List<PdmBiSubpackagerelation> isOutBox = packagerelationList.stream().filter(r -> r.getStatus().equals("0")).collect(Collectors.toList());
|
||||
if (isOutBox.size() > 0) {
|
||||
throw new BadRequestException("标记为黄色的子卷号已分配木箱,请重新选择未分配木箱的子卷");
|
||||
}
|
||||
List<String> entityList = JSONObject.parseArray(whereJson.getJSONArray("tableMater").toJSONString(), PdmBiSubpackagerelation.class).stream()
|
||||
.map(PdmBiSubpackagerelation::getWorkorder_id)
|
||||
.map(String::valueOf)
|
||||
@@ -199,22 +208,59 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
String boxType = whereJson.getString("checked");
|
||||
updateWrapper.set("box_type", boxType);
|
||||
updateWrapper.set("box_group", maxBoxGroup);
|
||||
// updateWrapper.set("status", "0");
|
||||
updateWrapper.set("status", "0");
|
||||
updateWrapper.in("workorder_id", entityList);
|
||||
pdmBiSubpackagerelationMapper.update(null, updateWrapper);
|
||||
//下发空木箱出库任务
|
||||
//outBox(entityList, boxType);
|
||||
//下发装箱区桁架任务
|
||||
transferToPacking(packagerelationList);
|
||||
//outBox(entityList, packagerelationList, boxType);
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void outBox(List<String> entityList, String boxType) {
|
||||
|
||||
/**
|
||||
* 空木箱出库
|
||||
*/
|
||||
private void outBox(List<String> entityList, List<PdmBiSubpackagerelation> packagerelationList, String boxType) {
|
||||
JSONObject boxInfo = new JSONObject();
|
||||
//todo 测试,暂时默认ZXQ_1_1
|
||||
boxInfo.put("device_code", "ZXQ_1_1");
|
||||
String deviceCode;
|
||||
//均衡获取木箱出库终点
|
||||
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = bstIvtPackageinfoivtMapper.selectList(new LambdaQueryWrapper<BstIvtPackageinfoivt>().eq(BstIvtPackageinfoivt::getPoint_status, "5").eq(BstIvtPackageinfoivt::getIs_used, "1").orderByAsc(BstIvtPackageinfoivt::getPoint_code));
|
||||
if (CollectionUtils.isEmpty(bstIvtPackageinfoivtList)) {
|
||||
throw new BadRequestException("没有可用的装箱区对接位");
|
||||
}
|
||||
List<Map<String, Integer>> pointCodeList = bstIvtPackageinfoivtList.stream()
|
||||
.map(p -> {
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
map.put(p.getPoint_code(), StringUtils.isNotBlank(p.getContainer_name()) ? 1 : 0);
|
||||
return map;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
//获取装箱位任务数量
|
||||
List<Map<String, Integer>> taskCount = bstIvtPackageinfoivtMapper.getPointTaskCount();
|
||||
if (CollectionUtils.isNotEmpty(taskCount)) {
|
||||
for (Map<String, Integer> p : pointCodeList) {
|
||||
for (Map.Entry<String, Integer> e : p.entrySet()) {
|
||||
String pointCode = e.getKey();
|
||||
for (Map<String, Integer> taskMap : taskCount) {
|
||||
if (taskMap.containsKey(pointCode)) {
|
||||
e.setValue(taskMap.get(pointCode));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//获取资源最少的装箱对接位
|
||||
Optional<String> minPointKey = pointCodeList.stream()
|
||||
.min(Comparator.comparingInt(map -> map.entrySet().iterator().next().getValue()))
|
||||
.map(map -> map.keySet().iterator().next());
|
||||
deviceCode = minPointKey.orElse("");
|
||||
} else {
|
||||
deviceCode = bstIvtPackageinfoivtList.get(0).getPoint_code();
|
||||
}
|
||||
//确定装箱区终点
|
||||
boxInfo.put("device_code", deviceCode);
|
||||
boxInfo.put("material_code", boxType);
|
||||
boxInfo.put("num", entityList.size());
|
||||
String boxSn = outBoxManageService.outBox(boxInfo);
|
||||
@@ -226,21 +272,56 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
updateWrapper1.set("package_box_sn", boxSn);
|
||||
updateWrapper1.in("workorder_id", entityList);
|
||||
pdmBiSubpackagerelationMapper.update(null, updateWrapper1);
|
||||
//待检区->装箱区agv任务
|
||||
agvTransfer(packagerelationList, deviceCode, boxSn);
|
||||
}
|
||||
|
||||
/**
|
||||
* 待检区->装箱区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("启用"))
|
||||
.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.isNotEmpty(zxqPointList)) {
|
||||
jo.put("point_code2", zxqPointList.get(0).getPoint_code());
|
||||
}
|
||||
zxqTask.createTask(jo);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void transferToPacking(List<PdmBiSubpackagerelation> packagerelationList) {
|
||||
//创建子卷搬运到装箱区任务
|
||||
// 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("空"))
|
||||
// .orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
||||
// //装箱区有点位,就下发
|
||||
// if (CollectionUtils.isNotEmpty(zxqPointList)) {
|
||||
//下发装箱区->装箱对接位桁架任务
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("待检区->装箱区"));
|
||||
jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("装箱区->装箱对接位"));
|
||||
//todo 测试,装箱点位-1-1
|
||||
jo.put("point_code1", "ZXQ_1_9");
|
||||
//todo 测试,装箱对接位01
|
||||
@@ -279,13 +360,8 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
//托盘类型 1小托盘 2大托盘
|
||||
param.put("containerType", "2");
|
||||
jo.put("request_param", param.toString());
|
||||
zxqTask.createTask(jo);
|
||||
// } else {
|
||||
// throw new BadRequestException("装箱区暂无空余库位!");
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
zxDjwTask.createTask(jo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package org.nl.b_lms.sch.point.dao.mapper;
|
||||
|
||||
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
|
||||
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* {@code @Description:} 装箱区点位库存表(BstIvtPackageinfoivt)数据持久层
|
||||
@@ -11,5 +16,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
*/
|
||||
public interface BstIvtPackageinfoivtMapper extends BaseMapper<BstIvtPackageinfoivt> {
|
||||
|
||||
/**
|
||||
* 获取对接位任务数量
|
||||
*/
|
||||
List<Map<String,Integer>> getPointTaskCount();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.b_lms.sch.point.dao.mapper.BstIvtPackageinfoivtMapper">
|
||||
|
||||
<select id="getPointTaskCount" resultType="java.util.Map">
|
||||
SELECT
|
||||
p.point_code,
|
||||
COUNT(t.point_code2) AS count
|
||||
FROM
|
||||
bst_ivt_packageinfoivt p
|
||||
LEFT JOIN
|
||||
sch_base_task t ON p.point_code = t.point_code2
|
||||
WHERE
|
||||
p.point_status = '5'
|
||||
AND t.task_status <![CDATA[ < ]]> '07'
|
||||
GROUP BY
|
||||
p.point_code
|
||||
ORDER BY
|
||||
p.point_code;
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -11,7 +11,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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;
|
||||
@@ -30,7 +29,6 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -49,13 +47,8 @@ public class DjqTask extends AbstractAcsTask {
|
||||
@Resource
|
||||
private IbstIvtPackageinfoivtService packageinfoivtService;
|
||||
@Resource
|
||||
private OutBoxManageService outBoxManageService;
|
||||
@Resource
|
||||
private IpdmBiSubpackagerelationService pdmBiSubpackagerelationService;
|
||||
@Resource
|
||||
private MzhcwTask mzhcwTask;
|
||||
@Resource
|
||||
private ZxqTask zxqTask;
|
||||
|
||||
|
||||
private final String THIS_CLASS = DjqTask.class.getName();
|
||||
|
||||
@@ -108,10 +101,9 @@ public class DjqTask extends AbstractAcsTask {
|
||||
schBaseTask.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||
//2.改变起点点位状态
|
||||
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code1()));
|
||||
//更新库存记录
|
||||
//3更新库存记录
|
||||
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("有子卷")).set("container_name", schBaseTask.getVehicle_code()).eq("point_code", schBaseTask.getPoint_code2()));
|
||||
String vehicleCode = schBaseTask.getVehicle_code();
|
||||
//5.查询是否有未下发的输送线->满轴位任务,有就下发
|
||||
//4.查询是否有未下发的输送线->满轴位任务,有就下发
|
||||
List<SchBaseTask> notIssueTaskList = taskService.list(new LambdaUpdateWrapper<SchBaseTask>()
|
||||
//确定起点
|
||||
.eq(SchBaseTask::getTask_type, PackageInfoIvtEnum.TASK_TYPE.code("输送线->满轴缓存位"))
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.BooleanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -12,11 +13,15 @@ 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.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.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.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.common.enums.PackageInfoIvtEnum;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
@@ -27,7 +32,6 @@ 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;
|
||||
@@ -45,8 +49,13 @@ import java.util.stream.Collectors;
|
||||
public class ZxDjwTask extends AbstractAcsTask {
|
||||
|
||||
|
||||
|
||||
@Resource
|
||||
private ZxqTask zxqTask;
|
||||
private DjqTask djqTask;
|
||||
@Resource
|
||||
private BstIvtBoxinfoMapper bstIvtBoxinfoMapper;
|
||||
@Resource
|
||||
private IpdmBiSubpackagerelationService subpackageRelationService;
|
||||
@Resource
|
||||
private IschBaseTaskService taskService;
|
||||
@Resource
|
||||
@@ -91,7 +100,7 @@ public class ZxDjwTask extends AbstractAcsTask {
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getTask_id, taskObj.getString("task_id")), false);
|
||||
if (schBaseTask == null) {
|
||||
throw new BadRequestException("满轴缓存位 -> 管制区更新接口任务号为空!");
|
||||
throw new BadRequestException("装箱区 -> 装箱对接位更新接口任务号为空!");
|
||||
}
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
@@ -111,7 +120,19 @@ public class ZxDjwTask extends AbstractAcsTask {
|
||||
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code1()));
|
||||
//更新库存记录
|
||||
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.创建搬运空载具任务,放空(装箱区->待检区)
|
||||
//3.更改子卷信息状态为包装1,创建装箱区->装箱位桁架任务的时候判断是否最后一个子卷:相同木箱号如果生成状态0个数等于1且子卷号等于当前载具号,就是最后一个子卷
|
||||
PdmBiSubpackagerelation pdmBiSubpackagerelation = subpackageRelationService
|
||||
.getOne(new LambdaUpdateWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getContainer_name, schBaseTask.getVehicle_code()), false);
|
||||
pdmBiSubpackagerelation.setStatus("1");
|
||||
subpackageRelationService.updateById(pdmBiSubpackagerelation);
|
||||
//4.查询同一个木箱号如果生成状态0个数等于0,更新该木箱信息表为包装1
|
||||
List<PdmBiSubpackagerelation> packagerelationList = subpackageRelationService.list(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getPackage_box_sn, schBaseTask.getVehicle_code2()).eq(PdmBiSubpackagerelation::getStatus, "0"));
|
||||
if (CollectionUtils.isEmpty(packagerelationList)) {
|
||||
BstIvtBoxinfo bstIvtBoxinfo = bstIvtBoxinfoMapper.selectOne(new LambdaQueryWrapper<BstIvtBoxinfo>().eq(BstIvtBoxinfo::getBox_no, schBaseTask.getVehicle_code2()).eq(BstIvtBoxinfo::getIs_packing, null));
|
||||
bstIvtBoxinfo.setIs_packing("1");
|
||||
bstIvtBoxinfoMapper.updateById(bstIvtBoxinfo);
|
||||
}
|
||||
//5.装箱区->装箱对接位桁架任务完成后,创建搬运空载具任务,放空(装箱区->待检区)
|
||||
List<BstIvtPackageinfoivt> djqOrGzqPointList = packageinfoivtService
|
||||
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||
.in(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("待检区"), PackageInfoIvtEnum.POINT_STATUS.code("管制区"))
|
||||
@@ -119,6 +140,7 @@ public class ZxDjwTask extends AbstractAcsTask {
|
||||
List<BstIvtPackageinfoivt> djqPointList = djqOrGzqPointList.stream().filter(r -> r.getPoint_status().equals(PackageInfoIvtEnum.POINT_STATUS.code("待检区"))).collect(Collectors.toList());
|
||||
JSONObject toDjqOrGzqTask = new JSONObject();
|
||||
toDjqOrGzqTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("放空(装箱区->待检区)"));
|
||||
//装箱区->待检区起点为桁架任务的起点
|
||||
toDjqOrGzqTask.put("point_code1", schBaseTask.getPoint_code1());
|
||||
if (CollectionUtils.isNotEmpty(djqPointList)) {
|
||||
//优先送到待检区
|
||||
@@ -127,7 +149,7 @@ public class ZxDjwTask extends AbstractAcsTask {
|
||||
toDjqOrGzqTask.put("point_code2", djqOrGzqPointList.get(0).getPoint_code());
|
||||
}
|
||||
toDjqOrGzqTask.put("vehicle_code", containerInfo.getContainer_name());
|
||||
zxqTask.createTask(toDjqOrGzqTask);
|
||||
djqTask.createTask(toDjqOrGzqTask);
|
||||
}
|
||||
// 取消
|
||||
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
||||
|
||||
@@ -6,12 +6,14 @@ import cn.hutool.core.util.BooleanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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;
|
||||
@@ -19,6 +21,8 @@ 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.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.common.enums.PackageInfoIvtEnum;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
@@ -29,6 +33,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;
|
||||
@@ -49,8 +54,6 @@ public class ZxqTask extends AbstractAcsTask {
|
||||
private ZxDjwTask zxDjwTask;
|
||||
|
||||
|
||||
|
||||
|
||||
@Resource
|
||||
private IschBaseTaskService taskService;
|
||||
@Resource
|
||||
@@ -60,6 +63,13 @@ public class ZxqTask extends AbstractAcsTask {
|
||||
|
||||
@Resource
|
||||
private IPdmBiSlittingproductionplanService productionPlanService;
|
||||
|
||||
@Resource
|
||||
private PdmBiSlittingproductionplanMapper pdmBiSlittingproductionplanMapper;
|
||||
@Resource
|
||||
private BstIvtBoxinfoMapper bstIvtBoxinfoMapper;
|
||||
|
||||
|
||||
private final String THIS_CLASS = ZxqTask.class.getName();
|
||||
|
||||
@Override
|
||||
@@ -117,8 +127,7 @@ public class ZxqTask extends AbstractAcsTask {
|
||||
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code1()));
|
||||
//更新库存记录
|
||||
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("有子卷")).set("container_name", schBaseTask.getVehicle_code()).eq("point_code", schBaseTask.getPoint_code2()));
|
||||
//todo 3.刘先源的空木箱出库任务完成状态更新时,判断装箱区是否存在木箱号对应的子卷,如果存在,就创建搬运任务
|
||||
//4.查询子卷对应的包装关系表,判断装箱位的木箱号是否为子卷对应的木箱号,是,创建搬运任务到装箱对接位位,否,什么都不做
|
||||
//3.查询子卷对应的包装关系表,判断装箱位的木箱号是否为子卷对应的木箱号,是,创建搬运任务到装箱对接位位桁架任务,否,什么都不做
|
||||
PdmBiSubpackagerelation pdmBiSubpackagerelation = subpackageRelationService
|
||||
.getOne(new LambdaUpdateWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getContainer_name, schBaseTask.getVehicle_code()), false);
|
||||
if (pdmBiSubpackagerelation != null) {
|
||||
@@ -135,6 +144,49 @@ public class ZxqTask extends AbstractAcsTask {
|
||||
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("找不到木箱信息!");
|
||||
}
|
||||
//木箱最大数量
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class BstIvtBoxinfo implements Serializable {
|
||||
* 木箱标识
|
||||
*/
|
||||
@TableId(value = "box_id")
|
||||
private Long box_id;
|
||||
private String box_id;
|
||||
|
||||
/*
|
||||
* 木箱号
|
||||
|
||||
@@ -47,7 +47,7 @@ public class BstIvtBoxinfoServiceImpl extends ServiceImpl<BstIvtBoxinfoMapper, B
|
||||
public BstIvtBoxinfo mesInsert(JSONObject whereJson) {
|
||||
|
||||
BstIvtBoxinfo boxDao = BstIvtBoxinfo.builder()
|
||||
.box_id(IdUtil.getLongId())
|
||||
.box_id(IdUtil.getStringId())
|
||||
.box_high(whereJson.getString("Height"))
|
||||
.box_length(whereJson.getString("Length"))
|
||||
.box_width(whereJson.getString("Width"))
|
||||
|
||||
@@ -7,14 +7,12 @@ public enum LevelEnum {
|
||||
INFO,
|
||||
WARN,
|
||||
ERROR;
|
||||
|
||||
public static LevelEnum checkLevel(String level) {
|
||||
if (!StringUtils.isEmpty(level)) {
|
||||
for (LevelEnum value : LevelEnum.values()) {
|
||||
if (value.name().equals(level)) {
|
||||
return value;
|
||||
}
|
||||
;
|
||||
}
|
||||
}
|
||||
return LevelEnum.DEBUG;
|
||||
|
||||
Reference in New Issue
Block a user