|  |  | 
 |  |  |     @Autowired | 
 |  |  |     private SnowflakeIdWorker snowflakeIdWorker; | 
 |  |  |     @Autowired | 
 |  |  |     private OrderService orderService; | 
 |  |  |     private OrderPakoutService orderPakoutService; | 
 |  |  |     @Autowired | 
 |  |  |     private OrderDetlService orderDetlService; | 
 |  |  |     private OrderPakinService orderPakinService; | 
 |  |  |     @Autowired | 
 |  |  |     private OrderDetlPakoutService orderDetlPakoutService; | 
 |  |  |     @Autowired | 
 |  |  |     private OrderDetlPakinService orderDetlPakinService; | 
 |  |  |     @Autowired | 
 |  |  |     private WcsController wcsController; | 
 |  |  |     @Autowired | 
 |  |  | 
 |  |  |     private SlaveProperties slaveProperties; | 
 |  |  |     @Autowired | 
 |  |  |     private WaitPakinService waitPakinService; | 
 |  |  |     @Autowired | 
 |  |  |     private InventoryCheckOrderDetlService inventoryCheckOrderDetlService; | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     @Transactional | 
 |  |  | 
 |  |  |         List<LocDetlDto> locDetlDtos = new ArrayList<>(); | 
 |  |  |         for (StockOutParam.LocDetl paramLocDetl : param.getLocDetls()) { | 
 |  |  |             if (!Cools.isEmpty(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getCount())) { | 
 |  |  |                 LocDetl one = locDetlService.selectItem(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getBatch()); | 
 |  |  |                 LocDetl one = locDetlService.selectItem(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getSku()); | 
 |  |  |                 if (null != one) locDetlDtos.add(new LocDetlDto(one, paramLocDetl.getCount())); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  | 
 |  |  |                 if (staNo.getDevNo() == 1135 && locMast.getLocType1() == 2) { | 
 |  |  |                     throw new CoolException("所选库位不是低库位无法调拨,库位号:{}" + locMast.getLocNo()); | 
 |  |  |                 } | 
 |  |  |                 // 启动出库开始 101.出库 | 
 |  |  |                 stockOut(staNo, locDetlDtos, null, userId); | 
 |  |  |                 if (staNo.getDevNo() >= 1100) { | 
 |  |  |                     // 启动出库开始 101.出库 | 
 |  |  |                     stockOut(staNo, locDetlDtos, null, userId); | 
 |  |  |                 } else { | 
 |  |  |                     stockOutSXK(staNo, locDetlDtos, null, userId); | 
 |  |  |                 } | 
 |  |  |             } else { | 
 |  |  |                 throw new CoolException("所选库位存在状态不为F、D的库位,库位号:" + locMast.getLocNo() + " 、当前状态:" + locMast.getLocSts() + "-" + locMast.getLocSts$()); | 
 |  |  |             } | 
 |  |  | 
 |  |  |             // 生成工作档明细 | 
 |  |  |             for (LocDetlDto detlDto : dto.getLocDetlDtos()) { | 
 |  |  |  | 
 |  |  |                 InventoryCheckOrderDetl inventoryCheckOrderDetl = new InventoryCheckOrderDetl(); | 
 |  |  |                 inventoryCheckOrderDetl.setOrderNo(param.getOrderNo()); | 
 |  |  |                 inventoryCheckOrderDetl.setMatnr(detlDto.getLocDetl().getMatnr()); | 
 |  |  |                 inventoryCheckOrderDetl.setMaktx(detlDto.getLocDetl().getMaktx()); | 
 |  |  |                 inventoryCheckOrderDetl.setBatch(detlDto.getLocDetl().getBatch()); | 
 |  |  |                 inventoryCheckOrderDetl.setLocNo(detlDto.getLocDetl().getLocNo()); | 
 |  |  |                 inventoryCheckOrderDetl.setArea(detlDto.getLocDetl().getOrigin()); | 
 |  |  |                 inventoryCheckOrderDetl.setAnfme(detlDto.getLocDetl().getAnfme()); | 
 |  |  |                 inventoryCheckOrderDetl.setIoTime(now); | 
 |  |  |                 inventoryCheckOrderDetl.setStatus("1"); | 
 |  |  |                 if (!inventoryCheckOrderDetlService.insert(inventoryCheckOrderDetl)) { | 
 |  |  |                     throw new CoolException("保存盘点明细失败"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 if (detlDto.getCount() == null || detlDto.getCount() <= 0.0D) { | 
 |  |  |                     continue; | 
 |  |  | 
 |  |  |             if (locDto.getAnfme() == null || locDto.getAnfme() <= 0.0D) { | 
 |  |  |                 continue; | 
 |  |  |             } | 
 |  |  |             OrderDetl orderDetl = orderDetlService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), locDto.getBatch()); | 
 |  |  |             if (orderDetl == null) { | 
 |  |  |                 orderDetl = orderDetlService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), null); | 
 |  |  |             OrderDetlPakout orderDetlPakout = orderDetlPakoutService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), locDto.getBatch()); | 
 |  |  |             if (orderDetlPakout == null) { | 
 |  |  |                 orderDetlPakout = orderDetlPakoutService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), null); | 
 |  |  |             } | 
 |  |  |             WrkDetl wrkDetl = new WrkDetl(); | 
 |  |  |             wrkDetl.sync(orderDetl); | 
 |  |  |             wrkDetl.sync(orderDetlPakout); | 
 |  |  |             wrkDetl.setZpallet(wrkMast.getBarcode()); | 
 |  |  |             wrkDetl.setIoTime(now); | 
 |  |  |             wrkDetl.setWrkNo(workNo); | 
 |  |  | 
 |  |  |                 throw new CoolException("保存工作档明细失败"); | 
 |  |  |             } | 
 |  |  |             // 修改订单明细 | 
 |  |  |             if (!orderDetlService.increaseWorkQty(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), locDto.getAnfme())) { | 
 |  |  |             if (!orderDetlPakoutService.increaseWorkQtyById(orderDetlPakout.getId(), locDto.getAnfme())) { | 
 |  |  |                 throw new CoolException("修改订单明细数量失败"); | 
 |  |  |             } | 
 |  |  |             orderService.updateSettle(orderDetl.getOrderId(), 2L, userId); | 
 |  |  |             orderPakoutService.updateSettle(orderDetlPakout.getOrderId(), 2L, userId); | 
 |  |  |         } | 
 |  |  |         // 修改库位状态:   F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中 | 
 |  |  |         locMast = locMastService.selectById(taskDto.getLocNo()); | 
 |  |  | 
 |  |  |         LocMast locMast = locMastService.selectById(taskDto.getLocNo()); | 
 |  |  |  | 
 |  |  |         List<LocMast> locMasts = new ArrayList<>(); | 
 |  |  |         if ((locMast.getBay1() >= 1 && locMast.getBay1() <= 2) || (locMast.getBay1() >= 6 && locMast.getBay1() <= 7 && locMast.getRow1() != 36 && locMast.getRow1() != 29) || (locMast.getBay1() >= 11 && locMast.getBay1() <= 12)) { | 
 |  |  |         if ((locMast.getBay1() >= 3 && locMast.getBay1() <= 6)) { | 
 |  |  |             locMasts = locMastService.selectList(new EntityWrapper<LocMast>() | 
 |  |  |                     .eq("gro1", locMast.getGro1()) | 
 |  |  |                     .eq("crn_no", 7) | 
 |  |  |                     .eq("loc_type1", locMast.getLocType1()) | 
 |  |  |                     .orderBy("bay1", false)); | 
 |  |  |         } else { | 
 |  |  |             locMasts = locMastService.selectList(new EntityWrapper<LocMast>() | 
 |  |  |                     .eq("gro1", locMast.getGro1()) | 
 |  |  |                     .eq("row1", locMast.getBay1()) | 
 |  |  |                     .in("bay1", 3, 4, 5, 6) | 
 |  |  |                     .eq("crn_no", 7) | 
 |  |  |                     .eq("loc_type1", locMast.getLocType1()) | 
 |  |  |                     .orderBy("bay1", true)); | 
 |  |  |         } | 
 |  |  |         for (LocMast locMast1 : locMasts) { | 
 |  |  |             if (locMast1.getLocNo().equals(taskDto.getLocNo())) { | 
 |  |  |                 break; | 
 |  |  |             } | 
 |  |  |             if (locMast1.getLocSts().equals("X")) { | 
 |  |  |                 throw new CoolException(taskDto.getLocNo() + "库位前方有锁定库位,禁止出库"); | 
 |  |  |             } | 
 |  |  |             if (locMast1.getLocSts().equals("F")) { | 
 |  |  |                 moveLocForDeepLoc(locMast1); | 
 |  |  |             for (LocMast locMast1 : locMasts) { | 
 |  |  |                 if (locMast1.getLocNo().equals(taskDto.getLocNo())) { | 
 |  |  |                     break; | 
 |  |  |                 } | 
 |  |  |                 if (locMast1.getLocSts().equals("X")) { | 
 |  |  |                     throw new CoolException(taskDto.getLocNo() + "库位前方有锁定库位,禁止出库"); | 
 |  |  |                 } | 
 |  |  |                 if (locMast1.getLocSts().equals("F")) { | 
 |  |  |                     locMast = locMast1; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         // 获取路径 | 
 |  |  |         int ioType = taskDto.isAll() ? 101 : 103; | 
 |  |  | 
 |  |  |             if (locDto.getAnfme() == null || locDto.getAnfme() <= 0.0D) { | 
 |  |  |                 continue; | 
 |  |  |             } | 
 |  |  |             OrderDetl orderDetl = orderDetlService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), locDto.getBatch()); | 
 |  |  |             if (orderDetl == null) { | 
 |  |  |                 orderDetl = orderDetlService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), null); | 
 |  |  |             OrderDetlPakout orderDetlPakout = orderDetlPakoutService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), locDto.getBatch()); | 
 |  |  |             if (orderDetlPakout == null) { | 
 |  |  |                 orderDetlPakout = orderDetlPakoutService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), null); | 
 |  |  |             } | 
 |  |  |             WrkDetl wrkDetl = new WrkDetl(); | 
 |  |  |             wrkDetl.sync(orderDetl); | 
 |  |  |             wrkDetl.sync(orderDetlPakout); | 
 |  |  |             wrkDetl.setZpallet(wrkMast.getBarcode()); | 
 |  |  |             wrkDetl.setIoTime(now); | 
 |  |  |             wrkDetl.setWrkNo(workNo); | 
 |  |  | 
 |  |  |                 throw new CoolException("保存工作档明细失败"); | 
 |  |  |             } | 
 |  |  |             // 修改订单明细 | 
 |  |  |             if (!orderDetlService.increaseWorkQty(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), locDto.getAnfme())) { | 
 |  |  |             if (!orderDetlPakoutService.increaseWorkQty(orderDetlPakout.getOrderId(), orderDetlPakout.getMatnr(), orderDetlPakout.getBatch(), locDto.getAnfme())) { | 
 |  |  |                 throw new CoolException("修改订单明细数量失败"); | 
 |  |  |             } | 
 |  |  |             orderService.updateSettle(orderDetl.getOrderId(), 2L, userId); | 
 |  |  |             orderPakoutService.updateSettle(orderDetlPakout.getOrderId(), 2L, userId); | 
 |  |  |         } | 
 |  |  |         // 修改库位状态:   F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中 | 
 |  |  |         locMast = locMastService.selectById(taskDto.getLocNo()); | 
 |  |  | 
 |  |  |         List<LocDetlDto> locDetlDtos = new ArrayList<>(); | 
 |  |  |         for (StockOutParam.LocDetl paramLocDetl : param.getLocDetls()) { | 
 |  |  |             if (!Cools.isEmpty(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getCount())) { | 
 |  |  |                 LocDetl one = locDetlService.selectItem(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getBatch()); | 
 |  |  |                 LocDetl one = locDetlService.selectItem(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getSku()); | 
 |  |  |                 if (null != one) locDetlDtos.add(new LocDetlDto(one, paramLocDetl.getCount())); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  | 
 |  |  |         List<LocDetlDto> locDetlDtos = new ArrayList<>(); | 
 |  |  |         for (StockOutParam.LocDetl paramLocDetl : param.getLocDetls()) { | 
 |  |  |             if (!Cools.isEmpty(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getCount())) { | 
 |  |  |                 LocDetl one = locDetlService.selectItem(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getBatch()); | 
 |  |  |                 LocDetl one = locDetlService.selectItem(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getSku()); | 
 |  |  |                 if (null != one) locDetlDtos.add(new LocDetlDto(one, paramLocDetl.getCount())); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  | 
 |  |  |             // 生成工作档明细 | 
 |  |  |             for (LocDetlDto detlDto : dto.getLocDetlDtos()) { | 
 |  |  |  | 
 |  |  |                 InventoryCheckOrderDetl inventoryCheckOrderDetl = new InventoryCheckOrderDetl(); | 
 |  |  |                 inventoryCheckOrderDetl.setOrderNo(param.getOrderNo()); | 
 |  |  |                 inventoryCheckOrderDetl.setMatnr(detlDto.getLocDetl().getMatnr()); | 
 |  |  |                 inventoryCheckOrderDetl.setMaktx(detlDto.getLocDetl().getMaktx()); | 
 |  |  |                 inventoryCheckOrderDetl.setBatch(detlDto.getLocDetl().getBatch()); | 
 |  |  |                 inventoryCheckOrderDetl.setLocNo(detlDto.getLocDetl().getLocNo()); | 
 |  |  |                 inventoryCheckOrderDetl.setArea(detlDto.getLocDetl().getOrigin()); | 
 |  |  |                 inventoryCheckOrderDetl.setAnfme(detlDto.getLocDetl().getAnfme()); | 
 |  |  |                 inventoryCheckOrderDetl.setIoTime(now); | 
 |  |  |                 inventoryCheckOrderDetl.setStatus("1"); | 
 |  |  |                 if (!inventoryCheckOrderDetlService.insert(inventoryCheckOrderDetl)) { | 
 |  |  |                     throw new CoolException("保存盘点明细失败"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 if (detlDto.getCount() == null || detlDto.getCount() <= 0.0D) { | 
 |  |  |                     continue; | 
 |  |  | 
 |  |  |         if (Cools.isEmpty(wrkMast)) { | 
 |  |  |             throw new CoolException(workNo + "工作档不存在"); | 
 |  |  |         } | 
 |  |  |         if (wrkMast.getWrkSts() == 4 || wrkMast.getWrkSts() == 14) { | 
 |  |  |         if (wrkMast.getWrkSts() == 4 || wrkMast.getWrkSts() == 5 || wrkMast.getWrkSts() == 14 || wrkMast.getWrkSts() == 15) { | 
 |  |  |             throw new CoolException("当前工作档已完成"); | 
 |  |  |         } | 
 |  |  |         // 入库 + 库位转移 | 
 |  |  | 
 |  |  |         if (Cools.isEmpty(locMast)) { | 
 |  |  |             throw new CoolException("库位不存在"); | 
 |  |  |         } | 
 |  |  |         if (!(locMast.getLocSts().equals("F") || locMast.getLocSts().equals("D") || locMast.getLocSts().equals("O"))) { | 
 |  |  |         if (!(locMast.getLocSts().equals("P") || locMast.getLocSts().equals("F") || locMast.getLocSts().equals("D") || locMast.getLocSts().equals("O"))) { | 
 |  |  |             throw new CoolException("当前库位不可调整!库位状态:" + locMast.getLocSts$()); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  | 
 |  |  |                     if (!locDetl.getAnfme().equals(adjust.getCount())) { | 
 |  |  |                         // todo 盘点记录 | 
 |  |  |                         // 修改库存 | 
 |  |  |                         if (!locDetlService.updateAnfme(adjust.getCount(), locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getBatch())) { | 
 |  |  |                         if (!locDetlService.updateAnfme(adjust.getCount(), locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getSku())) { | 
 |  |  |                             throw new CoolException(locDetl.getLocNo() + "库位," + locDetl.getMatnr() + "商品," + locDetl.getBatch() + "批号修改数量失败"); | 
 |  |  |                         } | 
 |  |  |                         // 保存调整记录 | 
 |  |  | 
 |  |  |             Mat mat = matService.selectByMatnr(adjust.getMatnr()); | 
 |  |  |             LocDetl locDetl = new LocDetl(); | 
 |  |  |             locDetl.sync(mat); | 
 |  |  |             locDetl.setBatch(adjust.getBatch()); | 
 |  |  |             locDetl.setDanger(adjust.getDanger()); | 
 |  |  |             locDetl.setSku(adjust.getBatch()); | 
 |  |  |             locDetl.setLocNo(locMast.getLocNo()); | 
 |  |  |             locDetl.setAnfme(adjust.getCount()); // 数量 | 
 |  |  |             locDetl.setModiUser(userId); // 操作人员信息 | 
 |  |  | 
 |  |  |         } | 
 |  |  |         locMast.setModiUser(userId); | 
 |  |  |         locMast.setModiTime(now); | 
 |  |  |         if (locMast.getLocSts().equals("O")) { | 
 |  |  |             locMast.setBarcode(""); | 
 |  |  |         } | 
 |  |  |         if (!locMastService.updateById(locMast)) { | 
 |  |  |             throw new CoolException("更新库位状态失败"); | 
 |  |  |         } | 
 |  |  | 
 |  |  |             List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); | 
 |  |  |             for (WrkDetl wrkDetl : wrkDetls) { | 
 |  |  |                 if (!Cools.isEmpty(wrkDetl.getOrderNo())) { | 
 |  |  |                     if (!orderDetlService.decrease(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getAnfme())) { | 
 |  |  |                     if (!orderDetlPakoutService.decrease(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getAnfme())) { | 
 |  |  |                         throw new CoolException("订单数据回滚失败"); | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     //修改订单主表状态,没有作业数量时才可以修改 | 
 |  |  |                     boolean flag = true; | 
 |  |  |                     List<OrderDetl> orderDetls = orderDetlService.selectList(new EntityWrapper<OrderDetl>().eq("order_no", wrkDetl.getOrderNo())); | 
 |  |  |                     for (OrderDetl orderDetl : orderDetls) { | 
 |  |  |                         if (orderDetl.getWorkQty() > 0) { | 
 |  |  |                     List<OrderDetlPakout> orderDetlPakouts = orderDetlPakoutService.selectList(new EntityWrapper<OrderDetlPakout>().eq("order_no", wrkDetl.getOrderNo())); | 
 |  |  |                     for (OrderDetlPakout orderDetlPakout : orderDetlPakouts) { | 
 |  |  |                         if (orderDetlPakout.getWorkQty() > 0) { | 
 |  |  |                             flag = false; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                     if (flag) { | 
 |  |  |                         Order order = orderService.selectOne(new EntityWrapper<Order>().eq("order_no", wrkDetl.getOrderNo())); | 
 |  |  |                         OrderPakout order = orderPakoutService.selectOne(new EntityWrapper<OrderPakout>().eq("order_no", wrkDetl.getOrderNo())); | 
 |  |  |                         if (!Cools.isEmpty(order) && order.getSettle() == 2) { | 
 |  |  |                             order.setSettle(1L); | 
 |  |  |                             order.setUpdateBy(userId); | 
 |  |  |                             order.setUpdateTime(now); | 
 |  |  |                         } | 
 |  |  |                         if (!orderService.update(order, new EntityWrapper<Order>().eq("order_no", wrkDetl.getOrderNo()))) { | 
 |  |  |                         if (!orderPakoutService.update(order, new EntityWrapper<OrderPakout>().eq("order_no", wrkDetl.getOrderNo()))) { | 
 |  |  |                             throw new CoolException("修改订单状态失败"); | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  | 
 |  |  |         // 获取目标站 | 
 |  |  |         Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() | 
 |  |  |                 .eq("type_no", wrkMast.getIoType() - 50) | 
 |  |  |                 .eq("stn_no", wrkMast.getStaNo()) // 作业站点 = 拣料出库的目标站 | 
 |  |  |                 .eq("stn_no", wrkMast.getSourceStaNo()) // 作业站点 = 拣料出库的目标站 | 
 |  |  |                 .eq("crn_no", wrkMast.getCrnNo()); // 堆垛机号 | 
 |  |  |         StaDesc staDesc = staDescService.selectOne(wrapper); | 
 |  |  |         if (Cools.isEmpty(staDesc)) { | 
 |  |  | 
 |  |  |         List<LocDetlDto> locDetlDtos = new ArrayList<>(); | 
 |  |  |         for (StockOutParam.LocDetl paramLocDetl : param.getLocDetls()) { | 
 |  |  |             if (!Cools.isEmpty(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getCount())) { | 
 |  |  |                 LocDetl one = locDetlService.selectItem(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getBatch()); | 
 |  |  |                 LocDetl one = locDetlService.selectItem(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getSku()); | 
 |  |  |                 if (null != one) locDetlDtos.add(new LocDetlDto(one, paramLocDetl.getCount())); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  | 
 |  |  |         List<LocDetlDto> locDetlDtos = new ArrayList<>(); | 
 |  |  |         for (StockOutParam.LocDetl paramLocDetl : param.getLocDetls()) { | 
 |  |  |             if (!Cools.isEmpty(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getCount())) { | 
 |  |  |                 LocDetl one = locDetlService.selectItem(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getBatch()); | 
 |  |  |                 LocDetl one = locDetlService.selectItem(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getSku()); | 
 |  |  |                 if (null != one) locDetlDtos.add(new LocDetlDto(one, paramLocDetl.getCount())); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  | 
 |  |  |             LocMast locMast = locMastService.selectById(dto.getLocNo()); | 
 |  |  |  | 
 |  |  |             List<LocMast> locMasts = new ArrayList<>(); | 
 |  |  |             if ((locMast.getBay1() >= 1 && locMast.getBay1() <= 2) || (locMast.getBay1() >= 6 && locMast.getBay1() <= 7 && locMast.getRow1() != 36 && locMast.getRow1() != 29) || (locMast.getBay1() >= 11 && locMast.getBay1() <= 12)) { | 
 |  |  | //            if ((locMast.getBay1() >= 1 && locMast.getBay1() <= 2) || (locMast.getBay1() >= 6 && locMast.getBay1() <= 7 && locMast.getRow1() != 36 && locMast.getRow1() != 29) || (locMast.getBay1() >= 11 && locMast.getBay1() <= 12)) { | 
 |  |  | //                locMasts = locMastService.selectList(new EntityWrapper<LocMast>() | 
 |  |  | //                        .eq("gro1", locMast.getGro1()) | 
 |  |  | //                        .eq("crn_no", 7) | 
 |  |  | //                        .eq("loc_type1", locMast.getLocType1()) | 
 |  |  | //                        .orderBy("bay1", false)); | 
 |  |  | //            } else { | 
 |  |  | //                locMasts = locMastService.selectList(new EntityWrapper<LocMast>() | 
 |  |  | //                        .eq("gro1", locMast.getGro1()) | 
 |  |  | //                        .eq("crn_no", 7) | 
 |  |  | //                        .eq("loc_type1", locMast.getLocType1()) | 
 |  |  | //                        .orderBy("bay1", true)); | 
 |  |  | //            } | 
 |  |  | //            for (LocMast locMast1 : locMasts) { | 
 |  |  | //                if (locMast1.getLocNo().equals(dto.getLocNo())) { | 
 |  |  | //                    break; | 
 |  |  | //                } | 
 |  |  | //                if (locMast1.getLocSts().equals("X")) { | 
 |  |  | //                    throw new CoolException(dto.getLocNo() + "库位前方有锁定库位,禁止出库"); | 
 |  |  | //                } | 
 |  |  | //                if (locMast1.getLocSts().equals("F")) { | 
 |  |  | //                    moveLocForDeepLoc(locMast1); | 
 |  |  | //                } | 
 |  |  | //            } | 
 |  |  |             if ((locMast.getBay1() >= 3 && locMast.getBay1() <= 6)) { | 
 |  |  |                 locMasts = locMastService.selectList(new EntityWrapper<LocMast>() | 
 |  |  |                         .eq("gro1", locMast.getGro1()) | 
 |  |  |                         .eq("crn_no", 7) | 
 |  |  |                         .eq("loc_type1", locMast.getLocType1()) | 
 |  |  |                         .orderBy("bay1", false)); | 
 |  |  |             } else { | 
 |  |  |                 locMasts = locMastService.selectList(new EntityWrapper<LocMast>() | 
 |  |  |                         .eq("gro1", locMast.getGro1()) | 
 |  |  |                         .eq("row1", locMast.getBay1()) | 
 |  |  |                         .in("bay1", 3, 4, 5, 6) | 
 |  |  |                         .eq("crn_no", 7) | 
 |  |  |                         .eq("loc_type1", locMast.getLocType1()) | 
 |  |  |                         .orderBy("bay1", true)); | 
 |  |  |             } | 
 |  |  |             for (LocMast locMast1 : locMasts) { | 
 |  |  |                 if (locMast1.getLocNo().equals(dto.getLocNo())) { | 
 |  |  |                     break; | 
 |  |  |                 } | 
 |  |  |                 if (locMast1.getLocSts().equals("X")) { | 
 |  |  |                     throw new CoolException(dto.getLocNo() + "库位前方有锁定库位,禁止出库"); | 
 |  |  |                 } | 
 |  |  |                 if (locMast1.getLocSts().equals("F")) { | 
 |  |  |                     moveLocForDeepLoc(locMast1); | 
 |  |  |                 for (LocMast locMast1 : locMasts) { | 
 |  |  |                     if (locMast1.getLocNo().equals(locMast.getLocNo())) { | 
 |  |  |                         break; | 
 |  |  |                     } | 
 |  |  |                     if (locMast1.getLocSts().equals("X")) { | 
 |  |  |                         throw new CoolException(locMast.getLocNo() + "库位前方有锁定库位,禁止出库"); | 
 |  |  |                     } | 
 |  |  |                     if (locMast1.getLocSts().equals("F")) { | 
 |  |  |                         locMast = locMast1; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             Integer outSta = staNo.getDevNo(); | 
 |  |  | //            //2号堆垛机全板出库站指定为204站,拣料站指定为202 | 
 |  |  | 
 |  |  |         wrkMast.setEmptyMk("Y"); // 空板 | 
 |  |  |         wrkMast.setBarcode(wrkMastold.getBarcode()); // 托盘码 | 
 |  |  |         wrkMast.setLinkMis("N"); | 
 |  |  |         wrkMast.setPltType(wrkMastold.getWrkNo()); | 
 |  |  |         wrkMast.setAppeTime(new Date()); | 
 |  |  |         wrkMast.setModiTime(new Date()); | 
 |  |  |         boolean res = wrkMastService.insert(wrkMast); | 
 |  |  | 
 |  |  |         wrkMast.setEmptyMk(wrkDetls != null ? "N" : "Y"); // 空板 | 
 |  |  |         wrkMast.setBarcode(wrkMastold.getBarcode()); // 托盘码 | 
 |  |  |         wrkMast.setLinkMis("N"); | 
 |  |  |         wrkMast.setPltType(wrkMastold.getWrkNo()); | 
 |  |  |         wrkMast.setAppeTime(new Date()); | 
 |  |  |         wrkMast.setModiTime(new Date()); | 
 |  |  |         boolean res = wrkMastService.insert(wrkMast); |