This commit is contained in:
2024-08-20 20:20:55 +08:00
parent b4df45965c
commit e86234f638

View File

@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.nl.b_lms.pda.service.PrintTableTwoService; import org.nl.b_lms.pda.service.PrintTableTwoService;
import org.nl.b_lms.pdm.info.service.IPdmBiContainerinfoService; import org.nl.b_lms.pdm.info.service.IPdmBiContainerinfoService;
@@ -27,9 +28,6 @@ import org.nl.common.domain.query.PageQuery;
import org.nl.common.enums.PackageInfoIvtEnum; import org.nl.common.enums.PackageInfoIvtEnum;
import org.nl.common.utils.SecurityUtils; import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.system.service.param.impl.SysParamServiceImpl;
import org.nl.wms.ext.mes.service.LmsToMesService; import org.nl.wms.ext.mes.service.LmsToMesService;
import org.nl.wms.sch.manage.TaskStatusEnum; import org.nl.wms.sch.manage.TaskStatusEnum;
import org.redisson.api.RLock; import org.redisson.api.RLock;
@@ -76,6 +74,7 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
@Resource @Resource
private PrintTableTwoService printTableTwoService; private PrintTableTwoService printTableTwoService;
/** /**
* 查询数据分页 * 查询数据分页
* *
@@ -207,13 +206,13 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
updateWrapper.set(SchBaseTask::getPoint_code1, newPoint.getPoint_code()); updateWrapper.set(SchBaseTask::getPoint_code1, newPoint.getPoint_code());
if (StringUtils.isNotBlank(newPoint.getContainer_name())) { if (StringUtils.isNotBlank(newPoint.getContainer_name())) {
//更新子卷号 //更新子卷号
updateWrapper.set(SchBaseTask::getVehicle_code,newPoint.getContainer_name()); updateWrapper.set(SchBaseTask::getVehicle_code, newPoint.getContainer_name());
} }
} else if (PackageInfoIvtEnum.TASK_ACTION_TYPE.code("放货分配").equals(actionType)) { } else if (PackageInfoIvtEnum.TASK_ACTION_TYPE.code("放货分配").equals(actionType)) {
updateWrapper.set(SchBaseTask::getPoint_code2,newPoint.getPoint_code()); updateWrapper.set(SchBaseTask::getPoint_code2, newPoint.getPoint_code());
} }
//标记二次分配已分配过点位 //标记二次分配已分配过点位
updateWrapper.set(SchBaseTask::getResponse_param,IOSEnum.IS_NOTANDYES.code("")); updateWrapper.set(SchBaseTask::getResponse_param, IOSEnum.IS_NOTANDYES.code(""));
taskService.update(null, updateWrapper); taskService.update(null, updateWrapper);
log.info("一楼装箱区二次分配" + taskCode + ",接口返回最新点位:---------------------------------------------" + newPoint.getPoint_code()); log.info("一楼装箱区二次分配" + taskCode + ",接口返回最新点位:---------------------------------------------" + newPoint.getPoint_code());
return newPoint.getPoint_code(); return newPoint.getPoint_code();
@@ -230,12 +229,13 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
/** /**
* 查询没有搬运任务的空的目标点位 * 查询没有搬运任务的空的目标点位
* @param ivtType 点位类型 *
* @param ivtStatus 库存状态 * @param ivtType 点位类型
* @param pointCode 取货还是放货 * @param ivtStatus 库存状态
* @param sortType 点位排序规则1升序2降序 * @param pointCode 取货还是放货
* @param taskType 任务类型 * @param sortType 点位排序规则1升序2降序
* @return List<BstIvtPackageinfoivt> * @param taskType 任务类型
* @return List<BstIvtPackageinfoivt>
*/ */
@Override @Override
public List<BstIvtPackageinfoivt> checkEndPointTask(String ivtType, String ivtStatus, String pointCode, String sortType, String taskType) { public List<BstIvtPackageinfoivt> checkEndPointTask(String ivtType, String ivtStatus, String pointCode, String sortType, String taskType) {
@@ -299,7 +299,7 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
task.getPoint_code1(), task.getPoint_code1(),
task.getPoint_code3() task.getPoint_code3()
)) ))
.filter(point -> point != null && !point.trim().isEmpty() ) .filter(point -> point != null && !point.trim().isEmpty())
.collect(Collectors.toSet()); .collect(Collectors.toSet());
} else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("四个点任务分配"))) { } else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("四个点任务分配"))) {
pointSets = taskList.stream() pointSets = taskList.stream()
@@ -330,7 +330,7 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
task.getPoint_code1(), task.getPoint_code1(),
task.getPoint_code2() task.getPoint_code2()
)) ))
.filter(point -> point != null && !point.trim().isEmpty() ) .filter(point -> point != null && !point.trim().isEmpty())
.collect(Collectors.toSet()); .collect(Collectors.toSet());
} else { } else {
pointSets = taskList.stream() pointSets = taskList.stream()
@@ -340,7 +340,7 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
task.getPoint_code3(), task.getPoint_code3(),
task.getPoint_code4() task.getPoint_code4()
)) ))
.filter(point -> point != null && !point.trim().isEmpty() ) .filter(point -> point != null && !point.trim().isEmpty())
.collect(Collectors.toSet()); .collect(Collectors.toSet());
} }
//符合条件的库存点位过滤掉已存在任务的点位 //符合条件的库存点位过滤掉已存在任务的点位
@@ -490,8 +490,6 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
} }
/** /**
* 获取等待点 * 获取等待点
*/ */
@@ -512,8 +510,6 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
} }
/** /**
* 更新点位状态 * 更新点位状态
* *
@@ -584,7 +580,7 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
UpdateWrapper<SchBaseTask> updateWrapper1 = new UpdateWrapper<>(); UpdateWrapper<SchBaseTask> updateWrapper1 = new UpdateWrapper<>();
updateWrapper1.eq("task_id", baseTask.getTask_id()); updateWrapper1.eq("task_id", baseTask.getTask_id());
updateWrapper1.set("car_no", PackageInfoIvtEnum.TASK_ACTION_TYPE.code("放货完成")); updateWrapper1.set("car_no", PackageInfoIvtEnum.TASK_ACTION_TYPE.code("放货完成"));
taskService.update(null,updateWrapper1); taskService.update(null, updateWrapper1);
log.info("一楼装箱区二次放货完成" + baseTask.getTask_code() + ",放货完成执行成功,放货信息:点位:" + baseTask.getPoint_code2() + "子卷号为:" + baseTask.getVehicle_code()); log.info("一楼装箱区二次放货完成" + baseTask.getTask_code() + ",放货完成执行成功,放货信息:点位:" + baseTask.getPoint_code2() + "子卷号为:" + baseTask.getVehicle_code());
} else { } else {
throw new BadRequestException("该点位已有库存!"); throw new BadRequestException("该点位已有库存!");
@@ -608,7 +604,7 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
UpdateWrapper<SchBaseTask> updateWrapper1 = new UpdateWrapper<>(); UpdateWrapper<SchBaseTask> updateWrapper1 = new UpdateWrapper<>();
updateWrapper1.eq("task_id", baseTask.getTask_id()); updateWrapper1.eq("task_id", baseTask.getTask_id());
updateWrapper1.set("request_param", PackageInfoIvtEnum.TASK_ACTION_TYPE.code("取货完成")); updateWrapper1.set("request_param", PackageInfoIvtEnum.TASK_ACTION_TYPE.code("取货完成"));
taskService.update(null,updateWrapper1); taskService.update(null, updateWrapper1);
log.info("一楼装箱区二次分配取货完成" + baseTask.getTask_code() + ",取货完成信号接收成功,点位:" + pointCode + "子卷号:" + baseTask.getVehicle_code()); log.info("一楼装箱区二次分配取货完成" + baseTask.getTask_code() + ",取货完成信号接收成功,点位:" + pointCode + "子卷号:" + baseTask.getVehicle_code());
} }
@@ -665,7 +661,7 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
/** /**
* 判断点位是否有外层阻挡 * 判断点位是否有外层阻挡
*/ */
private static BstIvtPackageinfoivt getBstIvtPackageinfoivt(List<BstIvtPackageinfoivt> vehicleList,List<BstIvtPackageinfoivt> kzjIvtList) { private static BstIvtPackageinfoivt getBstIvtPackageinfoivt(List<BstIvtPackageinfoivt> vehicleList, List<BstIvtPackageinfoivt> kzjIvtList) {
boolean hasEmptyVehicle; boolean hasEmptyVehicle;
BstIvtPackageinfoivt newPoint = new BstIvtPackageinfoivt(); BstIvtPackageinfoivt newPoint = new BstIvtPackageinfoivt();
if (CollectionUtils.isNotEmpty(vehicleList)) { if (CollectionUtils.isNotEmpty(vehicleList)) {
@@ -776,8 +772,6 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
} }
/** /**
* 创建 * 创建
* *
@@ -808,7 +802,6 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
* 手持子卷质检 * 手持子卷质检
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public JSONObject update(JSONObject whereJson) { public JSONObject update(JSONObject whereJson) {
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
if (StringUtils.isBlank(whereJson.getString("ivt_status"))) { if (StringUtils.isBlank(whereJson.getString("ivt_status"))) {
@@ -820,7 +813,7 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
List<BstIvtPackageinfoivt> dtoList; List<BstIvtPackageinfoivt> dtoList;
UpdateWrapper<BstIvtPackageinfoivt> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<BstIvtPackageinfoivt> updateWrapper = new UpdateWrapper<>();
//LMS获取MES称重后子卷信息 //LMS获取MES称重后子卷信息
JSONObject jo =new JSONObject(); JSONObject jo = new JSONObject();
//子卷质检合格品和管制品 //子卷质检合格品和管制品
if (StringUtils.isNotBlank(whereJson.getString("container_name")) && StringUtils.isBlank(whereJson.getString("pointCode"))) { if (StringUtils.isNotBlank(whereJson.getString("container_name")) && StringUtils.isBlank(whereJson.getString("pointCode"))) {
if (whereJson.getString("ivt_status").equals(PackageInfoIvtEnum.IVT_STATUS.code("")) || whereJson.getString("ivt_status").equals(PackageInfoIvtEnum.IVT_STATUS.code("空载具")) || whereJson.getString("ivt_status").equals(PackageInfoIvtEnum.IVT_STATUS.code("有子卷"))) { if (whereJson.getString("ivt_status").equals(PackageInfoIvtEnum.IVT_STATUS.code("")) || whereJson.getString("ivt_status").equals(PackageInfoIvtEnum.IVT_STATUS.code("空载具")) || whereJson.getString("ivt_status").equals(PackageInfoIvtEnum.IVT_STATUS.code("有子卷"))) {
@@ -829,7 +822,7 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
return result; return result;
} }
dtoList = bstIvtPackageinfoivtMapper.selectList(new LambdaQueryWrapper<BstIvtPackageinfoivt>().eq(BstIvtPackageinfoivt::getContainer_name, whereJson.getString("container_name"))); dtoList = bstIvtPackageinfoivtMapper.selectList(new LambdaQueryWrapper<BstIvtPackageinfoivt>().eq(BstIvtPackageinfoivt::getContainer_name, whereJson.getString("container_name")));
if (CollectionUtils.isEmpty(dtoList)) { if (ObjectUtils.isEmpty(dtoList)) {
result.put("status", org.springframework.http.HttpStatus.BAD_REQUEST.value()); result.put("status", org.springframework.http.HttpStatus.BAD_REQUEST.value());
result.put("message", "子卷号或点位信息有误,请核对是否存在!"); result.put("message", "子卷号或点位信息有误,请核对是否存在!");
return result; return result;
@@ -845,36 +838,11 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
return result; return result;
} }
if (whereJson.getString("ivt_status").equals(PackageInfoIvtEnum.IVT_STATUS.code("合格品"))) { if (whereJson.getString("ivt_status").equals(PackageInfoIvtEnum.IVT_STATUS.code("合格品"))) {
//获取子卷最新信息
jo.put("container_name", whereJson.getString("container_name"));
lmsToMesService.getInspectionResult(jo);
//子卷下料信息MES传递给LMS //子卷下料信息MES传递给LMS
iPdmBiContainerinfoService.createSubInfoByContainer(whereJson.getString("container_name")); iPdmBiContainerinfoService.createSubInfoByContainer(whereJson.getString("container_name"));
jo.put("container_name",whereJson.getString("container_name"));
lmsToMesService.getInspectionResult(jo);
/*
* 调用打印服务进行打印内标管表
*/
// 判断是否自动打标
String auto_table = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("AUTO_PRINT_TABLE").getValue();
if (auto_table.equals(IOSEnum.IS_NOTANDYES.code(""))) {
// 内标默认打印机
String within_table = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("WITHIN_PEINT_TWO").getValue();
JSONObject within_print = WQLObject.getWQLObject("pdm_bi_printinfo")
.query("print_name = '" + within_table + "'")
.uniqueResult(0);
// 管标默认打印机
String pipe_table = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("PIPE_PEINT_TWO").getValue();
JSONObject pipe_print = WQLObject.getWQLObject("pdm_bi_printinfo")
.query("print_name = '" + pipe_table + "'")
.uniqueResult(0);
// 组织数据
JSONObject param = new JSONObject();
param.put("pcsn", whereJson.getString("container_name"));
param.put("print_code", pipe_print.getString("print_id"));
printTableTwoService.pipeTable(param);
param.put("print_code", within_print.getString("print_id"));
printTableTwoService.withinTable(param);
}
} }
updateWrapper.set("container_name", dtoList.get(0).getContainer_name()); updateWrapper.set("container_name", dtoList.get(0).getContainer_name());
updateWrapper.set("ivt_status", whereJson.getString("ivt_status")); updateWrapper.set("ivt_status", whereJson.getString("ivt_status"));
@@ -883,10 +851,11 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
else if (StringUtils.isNotBlank(whereJson.getString("container_name")) && StringUtils.isNotBlank(whereJson.getString("pointCode"))) { 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")); 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("合格品"))) { if (whereJson.getString("ivt_status").equals(PackageInfoIvtEnum.IVT_STATUS.code("合格品"))) {
//获取子卷最新信息
jo.put("container_name", whereJson.getString("container_name"));
lmsToMesService.getInspectionResult(jo);
//子卷下料信息MES传递给LMS //子卷下料信息MES传递给LMS
iPdmBiContainerinfoService.createSubInfoByContainer(whereJson.getString("container_name")); iPdmBiContainerinfoService.createSubInfoByContainer(whereJson.getString("container_name"));
jo.put("container_name",whereJson.getString("container_name"));
lmsToMesService.getInspectionResult(jo);
updateWrapper.set("container_name", whereJson.getString("container_name")); updateWrapper.set("container_name", whereJson.getString("container_name"));
updateWrapper.set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("合格品")); updateWrapper.set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("合格品"));
} else { } else {