|  |  | 
 |  |  | package com.zy.asrs.controller; | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson.JSON; | 
 |  |  | import com.alibaba.fastjson.JSONArray; | 
 |  |  | import com.alibaba.fastjson.JSONObject; | 
 |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
 |  |  | import com.core.annotations.ManagerAuth; | 
 |  |  | import com.core.common.BaseRes; | 
 |  |  | 
 |  |  |         // 订单预校验  ===>> 1.订单状态; 2.订单带出数量 | 
 |  |  |         List<OrderDto> orderDtos = new ArrayList<>(); | 
 |  |  |         for (LocDto locDto : locDtos) { | 
 |  |  |             if (isJSON(locDto.getOrderNo())) { | 
 |  |  |             if (!isJSON(locDto.getOrderNo())) { | 
 |  |  |                 if (Cools.isEmpty(locDto.getOrderNo())) { continue; } | 
 |  |  |                 OrderDto orderDto = new OrderDto(locDto.getOrderNo(), locDto.getMatnr(), locDto.getAnfme()); | 
 |  |  |                 if (OrderDto.has(orderDtos, orderDto)) { | 
 |  |  | 
 |  |  |                 } | 
 |  |  |             } else { | 
 |  |  |                 // 订单合并出库 | 
 |  |  | //                List<OrderDto> orderDtoList = JSON.parseArray(locDto.getOrderNo(), OrderDto.class); | 
 |  |  |  | 
 |  |  |                 List<OrderDto> orderDtoList = JSON.parseArray(locDto.getOrderNo(), OrderDto.class); | 
 |  |  |  | 
 |  |  |                 for (OrderDto one : orderDtoList) { | 
 |  |  |                     OrderDto orderDto = new OrderDto(one.getOrderNo(), locDto.getMatnr(), one.getAnfme()); | 
 |  |  |                     if (OrderDto.has(orderDtos, orderDto)) { | 
 |  |  | 
 |  |  |         } | 
 |  |  |         for (OrderDto orderDto : orderDtos) { | 
 |  |  |             Order order = orderService.selectByNo(orderDto.getOrderNo()); | 
 |  |  |             if (order.getSettle() > 2) { | 
 |  |  |                 return R.error(orderDto.getOrderNo() + "订单已失效,请及时刷新页面"); | 
 |  |  |             if (!Cools.isEmpty(order)){ | 
 |  |  |                 if (order.getSettle() > 2) { | 
 |  |  |                     return R.error(orderDto.getOrderNo() + "订单已失效,请及时刷新页面"); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             OrderDetl orderDetl = orderDetlService.selectItem(orderDto.getOrderNo(), orderDto.getMatnr(), null); | 
 |  |  |             if (orderDetl.getAnfme() - orderDetl.getQty() < orderDto.getAnfme()) { | 
 |  |  |                 return R.ok(orderDto.getOrderNo() + "订单已作业,请及时刷新页面"); | 
 |  |  |             if (!Cools.isEmpty(orderDetl)){ | 
 |  |  |                 if (orderDetl.getAnfme() - orderDetl.getQty() < orderDto.getAnfme()) { | 
 |  |  |                     return R.ok(orderDto.getOrderNo() + "订单已作业,请及时刷新页面"); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  | 
 |  |  |         for (TaskDto taskDto : taskDtos) { | 
 |  |  |             BasDevp staNo = basDevpService.checkSiteStatus(taskDto.getStaNo()); | 
 |  |  |             workService.stockOut(staNo, taskDto, getUserId()); | 
 |  |  |             locMastService.breakUp(taskDto.getLocNo(), excludeLocNos); | 
 |  |  | //            locMastService.breakUp(taskDto.getLocNo(), excludeLocNos); | 
 |  |  |         } | 
 |  |  |         return R.ok(); | 
 |  |  |     } | 
 |  |  | 
 |  |  |                 if (issued > 0) { | 
 |  |  |                     LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), JSON.toJSONString(vo.getOrderDtos()), | 
 |  |  |                             issued >= locDetl.getAnfme() ? locDetl.getAnfme() : issued); | 
 |  |  |                     int ioType = (issued >= locDetl.getAnfme() && locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("loc_no", locDto.getLocNo())) == 1) ? 101 : 103; | 
 |  |  |                     int count = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("loc_no", locDto.getLocNo())); | 
 |  |  |                     int ioType = (issued >= locDetl.getAnfme() && count == 1 ? 101 : 103); | 
 |  |  |                     List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), ioType); | 
 |  |  |                     locDto.setStaNos(staNos); | 
 |  |  |                     locDtos.add(locDto); |