查询取消任务返回多条处理

main
judy 9 months ago
parent c14de278bf
commit e50983799d
  1. 26
      shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinOutInPlanServiceImpl.java

@ -141,15 +141,17 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl<BusinOutInPlanMapper,
return Result.err().msg("托盘编码不得为空");
}
//判断添加的托盘是否有未完成的入库记录,如果有直接取消
BusinOutInPlan businOutInPlan = this.getOrderByContainerCode(containerCode, PlanTypeEnum.IN.getValue());
if (businOutInPlan != null) {
List<BusinOutInPlan> inPlanList = this.getOrderByContainerCode(containerCode, PlanTypeEnum.IN.getValue());
if (inPlanList != null && inPlanList.size()>0) {
for (BusinOutInPlan businOutInPlan : inPlanList) {
businOutInPlan.setPlanStatus(PlanStatusEnum.CANCEL.getValue());
this.updateById(businOutInPlan);
}
this.updateBatchById(inPlanList);
}
BusinOutInPlan businOutInPlanOut = this.getOrderByContainerCode(containerCode, PlanTypeEnum.OUT.getValue());
if (businOutInPlanOut != null) {
return Result.err().msg("此托盘存在相关未完成的出库任务单据:" + businOutInPlan.getOrderNo());
List<BusinOutInPlan> outPlanList = this.getOrderByContainerCode(containerCode, PlanTypeEnum.OUT.getValue());
if (outPlanList != null && outPlanList.size()>0) {
return Result.err().msg("此托盘存在相关未完成的出库任务单据:" + outPlanList.get(0).getOrderNo());
}
BaseContainer container = baseContainerService.queryContainerByCode(containerCode);
if (container == null) {
@ -255,7 +257,7 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl<BusinOutInPlanMapper,
* @param planType
* @return
*/
private BusinOutInPlan getOrderByContainerCode(String containerCode, String planType) {
private List<BusinOutInPlan> getOrderByContainerCode(String containerCode, String planType) {
// 如果没有指定计划类型 就默认是入库
if (StringUtils.isBlank(planType)) {
@ -270,9 +272,9 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl<BusinOutInPlanMapper,
}
wq.notIn(BusinOutInPlan::getPlanStatus, PlanStatusEnum.FINISH.getValue(), PlanStatusEnum.CANCEL.getValue());
wq.orderByDesc(BusinOutInPlan::getCreateTime);
wq.last("limit 1");
BusinOutInPlan one = this.getOne(wq);
return one;
// wq.last("limit 1");
List<BusinOutInPlan> list = this.list(wq);
return list;
}
@Override
@ -364,8 +366,8 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl<BusinOutInPlanMapper,
public Result<Boolean> callEmptyContainerByQty(BaseContainerCallBo bo) {
//如果呼叫指定的托盘,先判断是否已有未执行的任务
if (bo.getContainerCode() != null) {
BusinOutInPlan businOutInPlan = this.getOrderByContainerCode(bo.getContainerCode(), PlanTypeEnum.CALL.getValue());
if (businOutInPlan != null) {
List<BusinOutInPlan> planList = this.getOrderByContainerCode(bo.getContainerCode(), PlanTypeEnum.CALL.getValue());
if (planList != null && planList.size()>0) {
return Result.err().msg("此托盘已呼叫,等待出库");
}
}

Loading…
Cancel
Save