opt:成品入库修改空载具任务触发逻辑
This commit is contained in:
@@ -5,10 +5,13 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.b_lms.pda.service.VehicleTwoService;
|
||||
import org.nl.b_lms.sch.point.dao.SchBasePoint;
|
||||
import org.nl.b_lms.sch.point.service.IschBasePointService;
|
||||
import org.nl.b_lms.sch.tasks.TwoInEmpExcepTask;
|
||||
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.service.iostorInv.util.service.InBoxManageService;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.InBussManageService;
|
||||
@@ -16,6 +19,7 @@ import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.InVehicleM
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.ext.mes.service.LmsToMesService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -42,6 +46,14 @@ public class VehicleTwoServiceImpl implements VehicleTwoService {
|
||||
@Autowired
|
||||
private WmsToAcsService wmsToAcsService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private IBstIvtBoxinfoService iBstIvtBoxinfoService;
|
||||
|
||||
@Autowired
|
||||
private LmsToMesService lmsToMesService;
|
||||
|
||||
|
||||
/**
|
||||
* 点位服务
|
||||
*/
|
||||
@@ -169,16 +181,19 @@ public class VehicleTwoServiceImpl implements VehicleTwoService {
|
||||
@Override
|
||||
public JSONObject reback(JSONObject whereJson) {
|
||||
String bill_type = whereJson.getString("bill_type");
|
||||
whereJson.put("material_barcode",whereJson.getString("box_no"));
|
||||
whereJson.put("device_code",whereJson.getString("point_code"));
|
||||
//1-返检入库;2-改切入库
|
||||
if (bill_type.equals("1")){
|
||||
whereJson.put("material_barcode", whereJson.getString("box_no"));
|
||||
whereJson.put("device_code", whereJson.getString("point_code"));
|
||||
//todo 检查 1-返检入库;2-改切入库
|
||||
if (bill_type.equals("1")) {
|
||||
whereJson.put("bill_type", IOSEnum.IN_TYPE.code("返检入库"));
|
||||
}else if (bill_type.equals("2")){
|
||||
} else if (bill_type.equals("2")) {
|
||||
whereJson.put("bill_type", IOSEnum.IN_TYPE.code("改切入库"));
|
||||
} else if (bill_type.equals("0001")) {
|
||||
whereJson.put("bill_type", IOSEnum.IN_TYPE.code("生产入库"));
|
||||
} else if (bill_type.equals("0009")) {
|
||||
whereJson.put("bill_type", IOSEnum.IN_TYPE.code("手工入库"));
|
||||
}
|
||||
whereJson.put("box_no", whereJson.getString("box_no"));
|
||||
|
||||
JSONArray resultJSONArray = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + whereJson.getString("material_barcode") + "' AND status = '0'").getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(resultJSONArray)) {
|
||||
throw new BadRequestException("未查询到子卷包装信息!");
|
||||
@@ -186,15 +201,39 @@ public class VehicleTwoServiceImpl implements VehicleTwoService {
|
||||
String material_barcode = "";
|
||||
for (int i = 0; i < resultJSONArray.size(); i++) {
|
||||
JSONObject resultObj = resultJSONArray.getJSONObject(i);
|
||||
if (i==0){
|
||||
if (i == 0) {
|
||||
material_barcode = resultObj.getString("container_name");
|
||||
}else {
|
||||
} else {
|
||||
material_barcode += "," + resultObj.getString("container_name");
|
||||
}
|
||||
}
|
||||
whereJson.put("material_barcode", material_barcode);
|
||||
if (StringUtils.isBlank(resultJSONArray.getJSONObject(0).getString("package_box_sn"))) {
|
||||
throw new BadRequestException("木箱号不能为空!");
|
||||
}
|
||||
String boxNo = resultJSONArray.getJSONObject(0).getString("package_box_sn");
|
||||
BstIvtBoxinfo boxDao = iBstIvtBoxinfoService.getOne(
|
||||
new QueryWrapper<BstIvtBoxinfo>().lambda()
|
||||
.eq(BstIvtBoxinfo::getBox_no, boxNo)
|
||||
);
|
||||
if (boxDao != null) {
|
||||
whereJson.put("vehicleType", boxDao.getVehicle_type());
|
||||
} else {
|
||||
//查询mes木箱信息,插入木箱信息表
|
||||
try {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("box_no", boxNo);
|
||||
lmsToMesService.momGetPackingInfo(jo);
|
||||
} catch (Exception ex) {
|
||||
throw new BadRequestException("MES系统未查询到木箱信息!");
|
||||
}
|
||||
BstIvtBoxinfo boxDao1 = iBstIvtBoxinfoService.getOne(
|
||||
new QueryWrapper<BstIvtBoxinfo>().lambda()
|
||||
.eq(BstIvtBoxinfo::getBox_no, boxNo)
|
||||
);
|
||||
whereJson.put("vehicleType", boxDao1.getVehicle_type());
|
||||
}
|
||||
inBussManageService.inTask(whereJson);
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("message", "入库成功!");
|
||||
return result;
|
||||
|
||||
@@ -284,7 +284,7 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
|
||||
}
|
||||
}
|
||||
}
|
||||
BstIvtPackageinfoivt newPoint = new BstIvtPackageinfoivt();
|
||||
BstIvtPackageinfoivt newPoint;
|
||||
String taskPointType = null;
|
||||
//空载具缓存位特殊二次分配逻辑:先判断是否有执行中的行架任务,有就分配行架搬运起点,无就按顺序排序分配点位
|
||||
if (baseTask.getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("补空(管制区->空载具缓存位)")) ||
|
||||
@@ -298,20 +298,13 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
|
||||
.or()
|
||||
.eq(SchBaseTask::getTask_type, PackageInfoIvtEnum.TASK_TYPE.code("放空(空载具缓存位->输送线)")
|
||||
)));
|
||||
if (CollectionUtils.isNotEmpty(taskList)) {
|
||||
if (taskList.get(0).getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("输送线四个点任务"))) {
|
||||
if (!checkIvtSBlock(taskList.get(0).getPoint_code3())) {
|
||||
newPoint.setPoint_code(taskList.get(0).getPoint_code3());
|
||||
}
|
||||
} else {
|
||||
if (!checkIvtSBlock(taskList.get(0).getPoint_code1())) {
|
||||
newPoint.setPoint_code(taskList.get(0).getPoint_code1());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//newPoint = getBstIvtPackageinfoivt(actionType, taskPointType, baseTask);
|
||||
newPoint = checkIvtSBlock();
|
||||
}
|
||||
// if (CollectionUtils.isNotEmpty(taskList)) {
|
||||
// //todo 桁架任务取空载具动作完成
|
||||
// if (!taskList.get(0).getRequest_param().equals(IOSEnum.IS_SEND.code("是"))) {
|
||||
// throw new BadRequestException("请等待桁架任务取空载具动作执行完成,再分配空载具点位");
|
||||
// }
|
||||
// }
|
||||
newPoint = checkIvtSBlock();
|
||||
} else {
|
||||
newPoint = getBstIvtPackageinfoivt(actionType, taskPointType, baseTask);
|
||||
}
|
||||
@@ -334,16 +327,68 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 实时判断点位外层是否有空载具
|
||||
*/
|
||||
|
||||
private boolean checkIvtSBlock(String pointCode) {
|
||||
List<BstIvtPackageinfoivt> kzjIvtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("空载具缓存位"), null, null, PackageInfoIvtEnum.SORT_TYPE.code("降序"), "");
|
||||
BigDecimal sortSeq = kzjIvtList.stream().filter(r -> r.getPoint_code().equals(pointCode)).collect(Collectors.toList()).get(0).getSort_seq();
|
||||
return kzjIvtList.stream()
|
||||
.anyMatch(r -> r.getSort_seq().compareTo(sortSeq) < 0 &&
|
||||
r.getIvt_status().equals(PackageInfoIvtEnum.IVT_STATUS.code("空载具")));
|
||||
/**
|
||||
* 更新点位状态
|
||||
*
|
||||
* @param taskCode 任务编码
|
||||
* @param actionType 动作类型
|
||||
*/
|
||||
private void updatePointStatus(String taskCode, String actionType) {
|
||||
//执行中的任务
|
||||
SchBaseTask baseTask = taskService.getOne(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_code, taskCode)
|
||||
.eq(SchBaseTask::getIs_delete, IOSEnum.IS_SEND.code("否"))
|
||||
.eq(SchBaseTask::getTask_status, TaskStatusEnum.EXECUTING.getCode()));
|
||||
if (baseTask == null) {
|
||||
throw new BadRequestException("该任务未执行或不存在!");
|
||||
}
|
||||
//取货任务
|
||||
if (actionType.equals(PackageInfoIvtEnum.TASK_ACTION_TYPE.code("取货完成"))) {
|
||||
UpdateWrapper<BstIvtPackageinfoivt> updateWrapper = new UpdateWrapper<>();
|
||||
//取满轴
|
||||
if (baseTask.getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("满轴缓存位->待检区"))) {
|
||||
List<BstIvtPackageinfoivt> ivtList = packageinfoivtService.list(new LambdaQueryWrapper<BstIvtPackageinfoivt>()
|
||||
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
|
||||
.eq(BstIvtPackageinfoivt::getPoint_code, baseTask.getPoint_code1()));
|
||||
if (CollectionUtils.isEmpty(ivtList)) {
|
||||
throw new BadRequestException("任务编号为:" + baseTask.getTask_code() + "取货完成的目标点位不存在!");
|
||||
}
|
||||
//只有子卷号相同才能清除库存
|
||||
if (baseTask.getVehicle_code().equals(ivtList.get(0).getContainer_name())) {
|
||||
updateWrapper.eq("point_code", baseTask.getPoint_code1());
|
||||
}
|
||||
} else if (baseTask.getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("输送线四个点任务"))) {
|
||||
//取空轴
|
||||
updateWrapper.eq("point_code", baseTask.getPoint_code3());
|
||||
} else if (baseTask.getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("放空(空载具缓存位->输送线)"))) {
|
||||
//取空轴
|
||||
updateWrapper.eq("point_code", baseTask.getPoint_code1());
|
||||
}
|
||||
updateWrapper.setSql("ivt_status = '0', container_name = null");
|
||||
//清空起点库存状态
|
||||
bstIvtPackageinfoivtMapper.update(null, updateWrapper);
|
||||
//标记桁架任务取空载具完成
|
||||
baseTask.setRequest_param(IOSEnum.IS_SEND.code("是"));
|
||||
taskService.update();
|
||||
} else {
|
||||
//放货任务
|
||||
List<BstIvtPackageinfoivt> ivtList = packageinfoivtService.list(new LambdaQueryWrapper<BstIvtPackageinfoivt>()
|
||||
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
|
||||
.eq(BstIvtPackageinfoivt::getPoint_code, baseTask.getPoint_code2()));
|
||||
if (CollectionUtils.isEmpty(ivtList)) {
|
||||
throw new BadRequestException("任务编号为:" + baseTask.getTask_code() + "放货完成的目标点位不存在!");
|
||||
}
|
||||
if (ivtList.get(0).getIvt_status().equals(PackageInfoIvtEnum.IVT_STATUS.code("空"))) {
|
||||
//增加点位库存
|
||||
bstIvtPackageinfoivtMapper.update(null, new UpdateWrapper<BstIvtPackageinfoivt>()
|
||||
.set("container_name", baseTask.getVehicle_code())
|
||||
.set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("有子卷"))
|
||||
.eq("point_code", baseTask.getPoint_code2()));
|
||||
} else {
|
||||
throw new BadRequestException("该点位已有库存!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private BstIvtPackageinfoivt getBstIvtPackageinfoivt(String actionType, String taskPointType, SchBaseTask baseTask) {
|
||||
@@ -377,22 +422,34 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
|
||||
if (CollectionUtils.isEmpty(kzjIvtList)) {
|
||||
return newPoint;
|
||||
}
|
||||
boolean hasEmptyVehicle = true;
|
||||
Optional<BstIvtPackageinfoivt> emptyList = kzjIvtList.stream()
|
||||
.filter(n -> n.getIvt_status().equals(PackageInfoIvtEnum.IVT_STATUS.code("空")))
|
||||
.findFirst();
|
||||
//判断点位外层是否有空载具
|
||||
if (emptyList.isPresent()) {
|
||||
BigDecimal sortSeq = emptyList.get().getSort_seq();
|
||||
boolean hasEmptyVehicle;
|
||||
//判断有空载具
|
||||
List<BstIvtPackageinfoivt> vehicleList = kzjIvtList.stream()
|
||||
.filter(n -> n.getIvt_status().equals(PackageInfoIvtEnum.IVT_STATUS.code("空载具")))
|
||||
.sorted(Comparator.comparing(BstIvtPackageinfoivt::getSort_seq))
|
||||
.collect(Collectors.toList());
|
||||
//判断空载具点位外层是否有空载具
|
||||
if (CollectionUtils.isNotEmpty(vehicleList)) {
|
||||
BigDecimal sortSeq = vehicleList.get(0).getSort_seq();
|
||||
hasEmptyVehicle = kzjIvtList.stream()
|
||||
.anyMatch(r -> r.getSort_seq().compareTo(sortSeq) < 0 &&
|
||||
.noneMatch(r -> r.getSort_seq().compareTo(sortSeq) < 0 &&
|
||||
r.getIvt_status().equals(PackageInfoIvtEnum.IVT_STATUS.code("空载具")));
|
||||
//有阻挡
|
||||
if (!hasEmptyVehicle) {
|
||||
return newPoint;
|
||||
} else {
|
||||
List<BstIvtPackageinfoivt> pointCodeList = kzjIvtList.stream()
|
||||
.filter(r -> r.getSort_seq().compareTo(sortSeq) < 0)
|
||||
.sorted(Comparator.comparing(BstIvtPackageinfoivt::getSort_seq).reversed())
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(pointCodeList)) {
|
||||
return newPoint;
|
||||
}
|
||||
return pointCodeList.get(0);
|
||||
}
|
||||
} else {
|
||||
return kzjIvtList.get(0);
|
||||
}
|
||||
if (hasEmptyVehicle) {
|
||||
//有阻挡,无可以放货空位
|
||||
return newPoint;
|
||||
}
|
||||
return emptyList.get();
|
||||
}
|
||||
|
||||
|
||||
@@ -480,54 +537,6 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新点位状态
|
||||
*
|
||||
* @param taskCode 任务编码
|
||||
* @param actionType 动作类型
|
||||
*/
|
||||
private void updatePointStatus(String taskCode, String actionType) {
|
||||
//执行中的任务
|
||||
SchBaseTask baseTask = taskService.getOne(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_code, taskCode)
|
||||
.eq(SchBaseTask::getIs_delete, IOSEnum.IS_SEND.code("否"))
|
||||
.eq(SchBaseTask::getTask_status, TaskStatusEnum.EXECUTING.getCode()));
|
||||
if (baseTask == null) {
|
||||
throw new BadRequestException("该任务未执行或不存在!");
|
||||
}
|
||||
//取货任务
|
||||
if (actionType.equals(PackageInfoIvtEnum.TASK_ACTION_TYPE.code("取货完成"))) {
|
||||
List<BstIvtPackageinfoivt> ivtList = packageinfoivtService.list(new LambdaQueryWrapper<BstIvtPackageinfoivt>()
|
||||
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
|
||||
.eq(BstIvtPackageinfoivt::getPoint_code, baseTask.getPoint_code1()));
|
||||
if (CollectionUtils.isEmpty(ivtList)) {
|
||||
throw new BadRequestException("任务编号为:" + baseTask.getTask_code() + "取货完成的目标点位不存在!");
|
||||
}
|
||||
//只有子卷号相同才能清除库存
|
||||
if (baseTask.getVehicle_code().equals(ivtList.get(0).getContainer_name())) {
|
||||
//清空起点库存状态
|
||||
bstIvtPackageinfoivtMapper.update(null, new UpdateWrapper<BstIvtPackageinfoivt>()
|
||||
.setSql("ivt_status = '0', container_name = null")
|
||||
.eq("point_code", baseTask.getPoint_code1()));
|
||||
}
|
||||
} else {
|
||||
List<BstIvtPackageinfoivt> ivtList = packageinfoivtService.list(new LambdaQueryWrapper<BstIvtPackageinfoivt>()
|
||||
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
|
||||
.eq(BstIvtPackageinfoivt::getPoint_code, baseTask.getPoint_code2()));
|
||||
if (CollectionUtils.isEmpty(ivtList)) {
|
||||
throw new BadRequestException("任务编号为:" + baseTask.getTask_code() + "取货完成的目标点位不存在!");
|
||||
}
|
||||
if (ivtList.get(0).getIvt_status().equals(PackageInfoIvtEnum.IVT_STATUS.code("空"))) {
|
||||
//增加点位库存
|
||||
bstIvtPackageinfoivtMapper.update(null, new UpdateWrapper<BstIvtPackageinfoivt>()
|
||||
.set("container_name", baseTask.getVehicle_code())
|
||||
.set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("有子卷"))
|
||||
.eq("point_code", baseTask.getPoint_code2()));
|
||||
} else {
|
||||
throw new BadRequestException("该点位已有库存!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -101,7 +101,16 @@ public class DjqTask extends AbstractAcsTask {
|
||||
//packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code1()));
|
||||
//2.更新库存记录
|
||||
//管制品重新质检
|
||||
String ivtStatus = StringUtils.isBlank(schBaseTask.getRequest_param()) ? PackageInfoIvtEnum.IVT_STATUS.code("有子卷") : schBaseTask.getRequest_param();
|
||||
String ivtStatus;
|
||||
if (StringUtils.isNotBlank(schBaseTask.getRequest_param())) {
|
||||
if (schBaseTask.getRequest_param().equals(PackageInfoIvtEnum.IVT_STATUS.code("合格品"))) {
|
||||
ivtStatus = PackageInfoIvtEnum.IVT_STATUS.code("合格品");
|
||||
} else {
|
||||
ivtStatus = PackageInfoIvtEnum.IVT_STATUS.code("有子卷");
|
||||
}
|
||||
} else {
|
||||
ivtStatus = PackageInfoIvtEnum.IVT_STATUS.code("有子卷");
|
||||
}
|
||||
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", ivtStatus).set("container_name", schBaseTask.getVehicle_code()).eq("point_code", schBaseTask.getPoint_code2()));
|
||||
//3.更改任务状态为完成
|
||||
schBaseTask.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||
|
||||
@@ -16,8 +16,8 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -90,22 +90,39 @@ public class AutoSendVehicleToKzj {
|
||||
if (CollectionUtils.isEmpty(kzjIvtList)) {
|
||||
return;
|
||||
}
|
||||
String pointCode1 = null;
|
||||
JSONObject task = new JSONObject();
|
||||
boolean hasEmptyVehicle = true;
|
||||
Optional<BstIvtPackageinfoivt> emptyList = kzjIvtList.stream()
|
||||
String pointCode1 = null;
|
||||
String pointCode2;
|
||||
boolean hasEmptyVehicle;
|
||||
//判断有空载具
|
||||
List<BstIvtPackageinfoivt> vehicleList = kzjIvtList.stream()
|
||||
.filter(n -> n.getIvt_status().equals(PackageInfoIvtEnum.IVT_STATUS.code("空载具")))
|
||||
.findFirst();
|
||||
//判断点位外层是否有空载具
|
||||
if (emptyList.isPresent()) {
|
||||
BigDecimal sortSeq = emptyList.get().getSort_seq();
|
||||
.sorted(Comparator.comparing(BstIvtPackageinfoivt::getSort_seq))
|
||||
.collect(Collectors.toList());
|
||||
//判断空载具点位外层是否有空载具
|
||||
if (CollectionUtils.isNotEmpty(vehicleList)) {
|
||||
BigDecimal sortSeq = vehicleList.get(0).getSort_seq();
|
||||
hasEmptyVehicle = kzjIvtList.stream()
|
||||
.anyMatch(r -> r.getSort_seq().compareTo(sortSeq) < 0 &&
|
||||
.noneMatch(r -> r.getSort_seq().compareTo(sortSeq) < 0 &&
|
||||
r.getIvt_status().equals(PackageInfoIvtEnum.IVT_STATUS.code("空载具")));
|
||||
//有阻挡
|
||||
if (!hasEmptyVehicle) {
|
||||
return;
|
||||
} else {
|
||||
List<BstIvtPackageinfoivt> pointCodeList = kzjIvtList.stream()
|
||||
.filter(r -> r.getSort_seq().compareTo(sortSeq) < 0)
|
||||
.sorted(Comparator.comparing(BstIvtPackageinfoivt::getSort_seq).reversed())
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(pointCodeList)) {
|
||||
return;
|
||||
}
|
||||
pointCode2 = pointCodeList.get(0).getPoint_code();
|
||||
}
|
||||
} else {
|
||||
pointCode2 = kzjIvtList.get(0).getPoint_code();
|
||||
}
|
||||
if (hasEmptyVehicle) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//待检区有空载具且过滤未完成任务
|
||||
List<BstIvtPackageinfoivt> djqPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("待检区"), PackageInfoIvtEnum.IVT_STATUS.code("空载具"), PackageInfoIvtEnum.TASK_POINT_TYPE.code("取货任务"), PackageInfoIvtEnum.SORT_TYPE.code("升序"), "");
|
||||
if (CollectionUtils.isNotEmpty(djqPackageinfoivtList)) {
|
||||
@@ -125,7 +142,7 @@ public class AutoSendVehicleToKzj {
|
||||
if (pointCode1 != null) {
|
||||
task.put("point_code1", pointCode1);
|
||||
//送空二次分配,目标点分配等待点
|
||||
task.put("point_code4", emptyList.get().getPoint_code());
|
||||
task.put("point_code4", pointCode2);
|
||||
task.put("point_code2", packageinfoivtService.getWaitPoint(kzjIvtList.get(0).getBlock(), kzjIvtList.get(0).getWait_point_type()));
|
||||
if (task.getString("task_type").equals(PackageInfoIvtEnum.TASK_TYPE.code("补空(待检区->空载具缓存位)"))) {
|
||||
djqToKzjhcwTask.createTask(task);
|
||||
|
||||
@@ -11,8 +11,6 @@ import lombok.extern.log4j.Log4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||
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.service.iostorInv.IStIvtIostorinvService;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvdisService;
|
||||
@@ -24,7 +22,6 @@ import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.InBussMana
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.ext.mes.service.LmsToMesService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -59,12 +56,6 @@ public class InBussManageServiceImpl implements InBussManageService {
|
||||
@Autowired
|
||||
private IschBaseTaskService ischBaseTaskService;
|
||||
|
||||
@Autowired
|
||||
private IBstIvtBoxinfoService iBstIvtBoxinfoService;
|
||||
|
||||
@Autowired
|
||||
private LmsToMesService lmsToMesService;
|
||||
|
||||
|
||||
/**
|
||||
* 不需要查询的排集合
|
||||
@@ -229,10 +220,7 @@ public class InBussManageServiceImpl implements InBussManageService {
|
||||
public void inTask(JSONObject jsonObject) {
|
||||
// 子卷包装关系表
|
||||
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||
// 载具扩展属性表
|
||||
WQLObject veExtTab = WQLObject.getWQLObject("md_pb_storagevehicleext");
|
||||
// 载具表
|
||||
WQLObject vehicleTab = WQLObject.getWQLObject("MD_PB_StorageVehicleInfo");
|
||||
|
||||
// 处理子卷号
|
||||
String material_barcode = jsonObject.getString("material_barcode");
|
||||
if (ObjectUtil.isEmpty(material_barcode)) {
|
||||
@@ -251,51 +239,6 @@ public class InBussManageServiceImpl implements InBussManageService {
|
||||
if (StringUtils.isBlank(subList.get(0).getString("package_box_sn"))) {
|
||||
throw new BadRequestException("木箱号不能为空!");
|
||||
}
|
||||
BstIvtBoxinfo boxDao = iBstIvtBoxinfoService.getOne(
|
||||
new QueryWrapper<BstIvtBoxinfo>().lambda()
|
||||
.eq(BstIvtBoxinfo::getBox_no, subList.get(0).getString("package_box_sn"))
|
||||
);
|
||||
String vehicleType;
|
||||
if (boxDao != null) {
|
||||
vehicleType = boxDao.getVehicle_type();
|
||||
} else {
|
||||
//查询mes木箱信息,插入木箱信息表
|
||||
try {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("box_no", subList.get(0).getString("package_box_sn"));
|
||||
lmsToMesService.momGetPackingInfo(jo);
|
||||
} catch (Exception ex) {
|
||||
throw new BadRequestException("MES系统未查询到木箱信息!");
|
||||
}
|
||||
BstIvtBoxinfo boxDao1 = iBstIvtBoxinfoService.getOne(
|
||||
new QueryWrapper<BstIvtBoxinfo>().lambda()
|
||||
.eq(BstIvtBoxinfo::getBox_no, subList.get(0).getString("package_box_sn"))
|
||||
);
|
||||
vehicleType = boxDao1.getVehicle_type();
|
||||
}
|
||||
//处理托盘扩展信息
|
||||
JSONObject jsonVehicle = vehicleTab.query("storagevehicle_code = '" + jsonObject.getString("vehicle_code") + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonVehicle)) {
|
||||
throw new BadRequestException("载具不存在!");
|
||||
}
|
||||
JSONObject ext_jo = veExtTab.query("storagevehicle_code = '" + jsonVehicle.getString("storagevehicle_code") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(ext_jo)) {
|
||||
JSONObject jsonVeExt = new JSONObject();
|
||||
jsonVeExt.put("storagevehicleext_id", org.nl.common.utils.IdUtil.getLongId());
|
||||
jsonVeExt.put("storagevehicle_id", jsonVehicle.getLongValue("storagevehicle_id"));
|
||||
jsonVeExt.put("storagevehicle_code", jsonVehicle.getString("storagevehicle_code"));
|
||||
jsonVeExt.put("storagevehicle_type", jsonVehicle.getString("storagevehicle_type"));
|
||||
jsonVeExt.put("pcsn", subList.get(0).getString("package_box_sn"));
|
||||
jsonVeExt.put("device_uuid", org.nl.common.utils.IdUtil.getLongId());
|
||||
jsonVeExt.put("update_time", DateUtil.now());
|
||||
veExtTab.insert(jsonVeExt);
|
||||
} else {
|
||||
ext_jo.put("pcsn", subList.get(0).getString("package_box_sn"));
|
||||
ext_jo.put("device_uuid", org.nl.common.utils.IdUtil.getLongId());
|
||||
ext_jo.put("update_time", DateUtil.now());
|
||||
veExtTab.update(ext_jo);
|
||||
}
|
||||
// 主表
|
||||
JSONObject mst = new JSONObject();
|
||||
mst.put("stor_id", IOSEnum.STOR_ID.code("二期"));
|
||||
@@ -364,7 +307,7 @@ public class InBussManageServiceImpl implements InBussManageService {
|
||||
jsonDiv.put("stor_id", IOSEnum.STOR_ID.code("二期"));
|
||||
jsonDiv.put("material_barcode", jsonObject.getString("material_barcode"));
|
||||
jsonDiv.put("vehicle_code", jsonObject.getString("vehicle_code"));
|
||||
jsonDiv.put("vehicle_type", vehicleType);
|
||||
jsonDiv.put("vehicle_type", jsonObject.getString("vehicleType"));
|
||||
iStIvtIostorinvService.divStruct(jsonDiv);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user