add:增加装箱对接位桁架任务尾卷信息

This commit is contained in:
2024-03-20 17:19:36 +08:00
parent 773a951f1f
commit 0fc22f8885
2 changed files with 31 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.BooleanUtil; import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; 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.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@@ -13,11 +14,14 @@ import org.nl.b_lms.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproducti
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan; 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.dao.PdmBiSubpackagerelation;
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService; import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
import org.nl.b_lms.pdm_manage.enums.SUBEnum;
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt; import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService; 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.SchBaseTaskVO; import org.nl.b_lms.sch.task.dto.SchBaseTaskVO;
import org.nl.b_lms.sch.task.service.IschBaseTaskService; import org.nl.b_lms.sch.task.service.IschBaseTaskService;
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.ios.enums.IOSEnum; import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
import org.nl.common.enums.PackageInfoIvtEnum; import org.nl.common.enums.PackageInfoIvtEnum;
import org.nl.common.utils.SecurityUtils; import org.nl.common.utils.SecurityUtils;
@@ -28,7 +32,9 @@ import org.nl.wms.sch.manage.TaskStatusEnum;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
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.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -53,6 +59,9 @@ public class ZxqTask extends AbstractAcsTask {
@Resource @Resource
private IpdmBiSubpackagerelationService subpackageRelationService; private IpdmBiSubpackagerelationService subpackageRelationService;
@Resource
private IBstIvtBoxinfoService iBstIvtBoxinfoService;
@Resource @Resource
private IPdmBiSlittingproductionplanService productionPlanService; private IPdmBiSlittingproductionplanService productionPlanService;
private final String THIS_CLASS = ZxqTask.class.getName(); private final String THIS_CLASS = ZxqTask.class.getName();
@@ -117,14 +126,34 @@ public class ZxqTask extends AbstractAcsTask {
PdmBiSubpackagerelation pdmBiSubpackagerelation = subpackageRelationService PdmBiSubpackagerelation pdmBiSubpackagerelation = subpackageRelationService
.getOne(new LambdaUpdateWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getContainer_name, schBaseTask.getVehicle_code()), false); .getOne(new LambdaUpdateWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getContainer_name, schBaseTask.getVehicle_code()), false);
if (pdmBiSubpackagerelation != null) { if (pdmBiSubpackagerelation != null) {
//查询目标点位信息 // 装箱区点位,获取装箱区所在区块
BstIvtPackageinfoivt zxqPoint = packageinfoivtService.getOne(new LambdaUpdateWrapper<BstIvtPackageinfoivt>().eq(BstIvtPackageinfoivt::getPoint_code, schBaseTask.getPoint_code2())); BstIvtPackageinfoivt zxqPoint = packageinfoivtService.getOne(new LambdaUpdateWrapper<BstIvtPackageinfoivt>().eq(BstIvtPackageinfoivt::getPoint_code, schBaseTask.getPoint_code2()));
//查询装箱对接位的木箱号和区域与子卷对应的木箱号与区域是否匹配 //查询装箱对接位的木箱号和区域与子卷对应的木箱号与区域是否匹配
//装箱对接位的container_name存的是木箱号
BstIvtPackageinfoivt zxdjwPoint = packageinfoivtService.getOne(new LambdaUpdateWrapper<BstIvtPackageinfoivt>() BstIvtPackageinfoivt zxdjwPoint = packageinfoivtService.getOne(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
.eq(BstIvtPackageinfoivt::getContainer_name, pdmBiSubpackagerelation.getPackage_box_sn()).eq(BstIvtPackageinfoivt::getBlock, zxqPoint.getBlock())); .eq(BstIvtPackageinfoivt::getContainer_name, pdmBiSubpackagerelation.getPackage_box_sn()).eq(BstIvtPackageinfoivt::getBlock, zxqPoint.getBlock()));
if (zxdjwPoint != null) { if (zxdjwPoint != null) {
//创建搬运任务到装箱位 //创建搬运任务到装箱位
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
//该子卷改为包装关系
pdmBiSubpackagerelation.update(new UpdateWrapper<PdmBiSubpackagerelation>().set("status", SUBEnum.STATUS.code("包装")));
BstIvtBoxinfo boxInfo = iBstIvtBoxinfoService.getOne(new LambdaQueryWrapper<BstIvtBoxinfo>().eq(BstIvtBoxinfo::getBox_no, pdmBiSubpackagerelation.getPackage_box_sn()), false);
if (boxInfo == null) {
throw new BadRequestException("待检区 -> 装箱区,子卷所属的木箱信息不能为空!");
}
List<PdmBiSubpackagerelation> containerList = subpackageRelationService.list(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getPackage_box_sn, pdmBiSubpackagerelation.getPackage_box_sn()));
long packagingCount = containerList.stream().filter(r -> r.getStatus().equals(SUBEnum.STATUS.code("包装"))).count();
// 给桁架任务添加尾卷信息
if (BigDecimal.valueOf(packagingCount).equals(pdmBiSubpackagerelation.getQuanlity_in_box())) {
JSONObject interactionJson = new JSONObject();
//是否最后子卷
interactionJson.put("lastOne", "1");
//木箱最大子卷数
interactionJson.put("maxNo", boxInfo.getNum());
//木箱实际放的子卷数
interactionJson.put("boxNo", pdmBiSubpackagerelation.getQuanlity_in_box());
jo.put("interaction_json", interactionJson);
}
jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("装箱区->装箱对接位")); jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("装箱区->装箱对接位"));
jo.put("acs_task_type", PackageInfoIvtEnum.ACS_TASK_TYPE.code("桁架任务")); jo.put("acs_task_type", PackageInfoIvtEnum.ACS_TASK_TYPE.code("桁架任务"));
jo.put("point_code1", schBaseTask.getPoint_code2()); jo.put("point_code1", schBaseTask.getPoint_code2());

View File

@@ -42,6 +42,7 @@ public enum PackageInfoIvtEnum {
//库存状态 //库存状态
IVT_STATUS(MapOf.of("", "0","空载具", "1","有子卷","2")); IVT_STATUS(MapOf.of("", "0","空载具", "1","有子卷","2"));
private Map<String, String> code; private Map<String, String> code;
public String code(String desc) { public String code(String desc) {