|
|
|
|
@@ -1,14 +1,20 @@
|
|
|
|
|
package org.nl.b_lms.pda.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import com.alibaba.druid.util.StringUtils;
|
|
|
|
|
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.toolkit.Wrappers;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.nl.b_lms.pda.service.ProductOutTwoService;
|
|
|
|
|
import org.nl.b_lms.pdm.info.dao.PdmBiOrderbominfo;
|
|
|
|
|
import org.nl.b_lms.pdm.info.service.IPdmBiOrderbominfoService;
|
|
|
|
|
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
|
|
|
|
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
|
|
|
|
|
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.IBstIvtBoxlashboundService;
|
|
|
|
|
import org.nl.b_lms.storage_manage.database.service.dao.BstIvtBoxlashbound;
|
|
|
|
|
@@ -52,6 +58,12 @@ public class ProductOutTwoServiceImpl implements ProductOutTwoService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private OutBoxManageService outBoxManageService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IpdmBiSubpackagerelationService ipdmBiSubpackagerelationService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IschBaseTaskService ischBaseTaskService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject ivtQuery(JSONObject whereJson) {
|
|
|
|
|
@@ -238,4 +250,64 @@ public class ProductOutTwoServiceImpl implements ProductOutTwoService {
|
|
|
|
|
result.put("message", "成功放行!");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject vehicleUnbind(JSONObject whereJson) {
|
|
|
|
|
String vehicle_code = whereJson.getString("vehicle_code");
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(vehicle_code)) {
|
|
|
|
|
throw new BadRequestException("托盘号不能为空!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WQLObject vehicle_ext = WQLObject.getWQLObject("md_pb_storagevehicleext");
|
|
|
|
|
|
|
|
|
|
JSONObject vehicle_info = vehicle_ext.query("storagevehicle_code = '" + vehicle_code + "'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isEmpty(vehicle_info)) {
|
|
|
|
|
throw new BadRequestException("未查询到载具【" + vehicle_code + "】对应的绑定关系");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String box_no = vehicle_info.getString("pcsn");
|
|
|
|
|
if (StringUtils.isEmpty(box_no)) {
|
|
|
|
|
throw new BadRequestException("载具【" + vehicle_code + "】上未绑定木箱!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<PdmBiSubpackagerelation> list = ipdmBiSubpackagerelationService.list(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getPackage_box_sn, box_no));
|
|
|
|
|
if (ObjectUtil.isNotEmpty(list)) {
|
|
|
|
|
boolean anyMatch = list.stream().anyMatch(sub -> sub.getStatus().equals("1") || sub.getStatus().equals("2"));
|
|
|
|
|
if (anyMatch) {
|
|
|
|
|
throw new BadRequestException("载具上木箱【" + box_no + "】的包装关系为包装或者入库状态!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String collect = list.stream().map(sub -> sub.getContainer_name()).collect(Collectors.joining("','"));
|
|
|
|
|
|
|
|
|
|
JSONArray ivt_arr = WQLObject.getWQLObject("st_ivt_structivt").query("pcsn IN ('" + collect + "')").getResultJSONArray(0);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(ivt_arr)) {
|
|
|
|
|
throw new BadRequestException("载具【" + vehicle_code + "】上绑定的木箱【" + box_no + "】存在库存,不能进行解绑!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int hasTask = ischBaseTaskService.count(new QueryWrapper<SchBaseTask>()
|
|
|
|
|
.eq("is_delete", "0")
|
|
|
|
|
.eq("vehicle_code2", vehicle_code)
|
|
|
|
|
.lt("task_status", TaskStatusEnum.FINISHED.getCode()));
|
|
|
|
|
|
|
|
|
|
if (hasTask > 0) {
|
|
|
|
|
throw new BadRequestException("该托盘【" + vehicle_code + "】存在正在执行中的任务,不能进行解绑!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int hasTask2 = ischBaseTaskService.count(new QueryWrapper<SchBaseTask>()
|
|
|
|
|
.eq("is_delete", "0")
|
|
|
|
|
.eq("vehicle_code", box_no)
|
|
|
|
|
.lt("task_status", TaskStatusEnum.FINISHED.getCode()));
|
|
|
|
|
|
|
|
|
|
if (hasTask2 > 0) {
|
|
|
|
|
throw new BadRequestException("该木箱【" + box_no + "】存在正在执行中的任务,不能进行解绑!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vehicle_info.put("pcsn", "");
|
|
|
|
|
vehicle_ext.update(vehicle_info);
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
result.put("message", "操作成功!");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|