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

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

Loading…
Cancel
Save