|  |  | 
 |  |  | package com.zy.asrs.controller; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
 |  |  | import com.core.annotations.ManagerAuth; | 
 |  |  | import com.core.common.*; | 
 |  |  | import com.core.exception.CoolException; | 
 |  |  | 
 |  |  | import com.zy.common.model.LocDto; | 
 |  |  | import com.zy.common.model.TaskDto; | 
 |  |  | import com.zy.common.web.BaseController; | 
 |  |  | import org.slf4j.Logger; | 
 |  |  | import org.slf4j.LoggerFactory; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.web.bind.annotation.PostMapping; | 
 |  |  | import org.springframework.web.bind.annotation.RequestBody; | 
 |  |  | 
 |  |  | @RestController | 
 |  |  | public class OutController extends BaseController { | 
 |  |  |  | 
 |  |  |     private static final Logger log = LoggerFactory.getLogger(OutController.class); | 
 |  |  |     @Autowired | 
 |  |  |     private OrderService orderService; | 
 |  |  |     @Autowired | 
 |  |  | 
 |  |  |         StockOutParam param = new StockOutParam(); | 
 |  |  |         ArrayList<StockOutParam.LocDetl> locDetls = new ArrayList<>(); | 
 |  |  |         for (LocDto locDto:locDtos){ | 
 |  |  |             Order order = orderService.selectByNo(locDto.getOrderNo()); | 
 |  |  |             OrderDetl orderDetl = orderDetlService.selectById(locDto.getOrderDetlId()); | 
 |  |  |  | 
 |  |  |             StockOutParam.LocDetl locDetl = new StockOutParam.LocDetl(); | 
 |  |  |             locDetl.setBrand(locDto.getBrand()); | 
 |  |  |             locDetl.setLocNo(locDto.getLocNo()); | 
 |  |  |             try{ | 
 |  |  |                 LocDetl locDetl1 = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("batch", locDto.getBatch())); | 
 |  |  |                 locDetl.setLocNo(locDetl1.getLocNo()); | 
 |  |  |             }catch (Exception e){ | 
 |  |  |                 log.error("订单出库库位号处理异常:"+e); | 
 |  |  |                 locDetl.setLocNo(locDto.getLocNo()); | 
 |  |  |             } | 
 |  |  |             locDetl.setAnfme(locDto.getAnfme()); | 
 |  |  |             locDetl.setMatnr(locDto.getMatnr()); | 
 |  |  |             locDetl.setBatch(locDto.getBatch()); | 
 |  |  |             locDetl.setModel(locDto.getModel()); | 
 |  |  |             locDetl.setSpecs(locDto.getSpecs()); | 
 |  |  |             locDetl.setZpallet(locDto.getZpallet()); | 
 |  |  |             locDetl.setMemo(orderDetl.getMemo()); | 
 |  |  |             locDetl.setColor(order.getCstmrName()); | 
 |  |  |  | 
 |  |  |             param.setOrderNo(locDto.getOrderNo()); | 
 |  |  |  | 
 |  |  | 
 |  |  |         param.setLocDetls(locDetls); | 
 |  |  |  | 
 |  |  |         List<StockOutParam> stockOutParams = OutboundAllocationUtil.OutboundClassification(param); | 
 |  |  |         Date now = new Date(); | 
 |  |  |         for (StockOutParam stockOutParam : stockOutParams){ | 
 |  |  |             stockOutParam.setNowTime(now); | 
 |  |  |             workService.startupFullTakeStore(stockOutParam, getUserId()); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  | 
 |  |  |         } | 
 |  |  |         // 单据明细档 | 
 |  |  |         int i=0; | 
 |  |  |         List<LocDto> locDtosList = new ArrayList<>(); | 
 |  |  |         List<String> batchList = new ArrayList<>(); | 
 |  |  |         for (LocDto locDto : locDtos) { | 
 |  |  |             if (!batchList.contains(locDto.getBatch())){ | 
 |  |  |                 batchList.add(locDto.getBatch()); | 
 |  |  |                 locDtosList.add(locDto); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         for (LocDto locDto : locDtosList) { | 
 |  |  |             i++; | 
 |  |  |             Mat mat = matService.selectByMatnr(locDto.getMatnr()); | 
 |  |  |             if (Cools.isEmpty(mat)) { |