|  |  | 
 |  |  |         private String matnr; | 
 |  |  |  | 
 |  |  |         // 序列码 | 
 |  |  |         private String batch; | 
 |  |  |         private String sku; | 
 |  |  |  | 
 |  |  |         // 数量 | 
 |  |  |         private Double count; | 
 
 |  |  | 
 |  |  |                 if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). | 
 |  |  |                         eq("zpallet", param.getBarcode()) | 
 |  |  |                         .eq("io_status", "N") | 
 |  |  |                         .eq("matnr", elem.getMatnr()).eq("three_code", elem.getThreeCode()).eq("batch", elem.getBatch())) > 0) { | 
 |  |  |                         .eq("matnr", elem.getMatnr()).eq("three_code", elem.getThreeCode())) > 0) { | 
 |  |  |                     throw new CoolException(param.getBarcode() + "已有相同数据"); | 
 |  |  |                 } | 
 |  |  |  | 
 
 |  |  | 
 |  |  |         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())); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  | 
 |  |  |         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 (!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() + "批号修改数量失败"); | 
 |  |  |                         } | 
 |  |  |                         // 保存调整记录 | 
 |  |  | 
 |  |  |         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 (WrkDetl wrkDetl : wrkDetls) { | 
 |  |  |  | 
 |  |  |                         LocDetl locDetl = locDetlService.selectItem(locMast.getLocNo(), wrkDetl.getMatnr(), wrkDetl.getBatch()); | 
 |  |  |                         LocDetl locDetl = locDetlService.selectItem(locMast.getLocNo(), wrkDetl.getMatnr(), wrkDetl.getSku()); | 
 |  |  |                         if (null != locDetl) { | 
 |  |  |                             Double anfme = locDetl.getAnfme() + wrkDetl.getAnfme(); | 
 |  |  |                             if (!locDetlService.updateAnfme(anfme, wrkMast.getLocNo(), wrkDetl.getMatnr(), wrkDetl.getBatch())) { | 
 |  |  |                             if (!locDetlService.updateAnfme(anfme, wrkMast.getLocNo(), wrkDetl.getMatnr(), wrkDetl.getSku())) { | 
 |  |  | //                                exceptionHandle("全板入库 ===>> 更新库存明细失败;[workNo={0}],[locNo={1}]", wrkMast.getWrkNo(), wrkMast.getLocNo()); | 
 |  |  |                                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); | 
 |  |  |                                 return FAIL.setMsg("全板入库 ===>> 更新库存明细失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); | 
 
 |  |  | 
 |  |  |  | 
 |  |  |     public static boolean has(List<DetlDto> detlDtos, DetlDto detlDto) { | 
 |  |  |         for (DetlDto dto : detlDtos) { | 
 |  |  |             if (dto.getMatnr().equals(detlDto.getMatnr()) && Cools.eq(dto.getBatch(), detlDto.getBatch()) && dto.getFromOrderNo().equals(detlDto.getFromOrderNo())) { | 
 |  |  |             if (dto.getMatnr().equals(detlDto.getMatnr()) && Cools.eq(dto.getBatch(), detlDto.getBatch()) &&Cools.eq(dto.getFromOrderNo(),detlDto.getFromOrderNo())) { | 
 |  |  |                 return true; | 
 |  |  |             } | 
 |  |  |         } | 
 
 |  |  | 
 |  |  |                     for (LocMast locMastGro1 : locMasts1) { | 
 |  |  |                         if (locMastGro1.getLocSts().equals("F")) { | 
 |  |  |                             LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_No", locMastGro1.getLocNo())); | 
 |  |  |                             if (!locDetl.getMatnr().equals(matnr) || !locDetl.getBatch().equals(batch)) { | 
 |  |  |                                 continue; | 
 |  |  |                             if (!Cools.isEmpty(locDetl.getSku())){ | 
 |  |  |                                 if (!locDetl.getMatnr().equals(matnr) || !locDetl.getSku().equals(batch)) { | 
 |  |  |                                     continue; | 
 |  |  |                                 } | 
 |  |  |                             }else { | 
 |  |  |                                 if (!locDetl.getMatnr().equals(matnr)) { | 
 |  |  |                                     continue; | 
 |  |  |                                 } | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                         if (locMastGro1.getLocSts().equals("P") || locMastGro1.getLocSts().equals("Q") || locMastGro1.getLocSts().equals("R")) { | 
 
 |  |  | 
 |  |  |         BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true); | 
 |  |  |         // 检索库位 | 
 |  |  |         List<String> matnrs = waitPakins.stream().map(WaitPakin::getMatnr).distinct().collect(Collectors.toList()); | 
 |  |  |         List<String> batchs = waitPakins.stream().map(WaitPakin::getBatch).distinct().collect(Collectors.toList()); | 
 |  |  |         List<String> batchs = waitPakins.stream().map(WaitPakin::getSku).distinct().collect(Collectors.toList()); | 
 |  |  |         boolean mixtrue = false; | 
 |  |  |  | 
 |  |  |  | 
 
 |  |  | 
 |  |  |     <sql id="batchSeq"> | 
 |  |  |         <choose> | 
 |  |  |             <when test="batch != null and batch != ''"> | 
 |  |  |                 and batch = #{batch} | 
 |  |  |                 and sku = #{batch} | 
 |  |  |             </when> | 
 |  |  |             <otherwise> | 
 |  |  |                 and (batch IS NULL OR batch = '') | 
 |  |  |                 and (sku IS NULL OR sku = '') | 
 |  |  |             </otherwise> | 
 |  |  |         </choose> | 
 |  |  |     </sql> | 
 |  |  | 
 |  |  |         where 1=1 | 
 |  |  |         and loc_no = #{locNo} | 
 |  |  |         and matnr = #{matnr} | 
 |  |  |         <include refid="batchSeq"></include> | 
 |  |  |         <choose> | 
 |  |  |             <when test="batch != null and batch != ''"> | 
 |  |  |                 and sku = #{batch} | 
 |  |  |             </when> | 
 |  |  |             <otherwise> | 
 |  |  |                 and (sku IS NULL OR sku = '') | 
 |  |  |             </otherwise> | 
 |  |  |         </choose> | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |     <delete id="deleteItem"> | 
 
 |  |  | 
 |  |  |     <sql id="batchSeq"> | 
 |  |  |         <choose> | 
 |  |  |             <when test="batch != null and batch != ''"> | 
 |  |  |                 and batch = #{batch} | 
 |  |  |                 and sku = #{batch} | 
 |  |  |             </when> | 
 |  |  |             <otherwise> | 
 |  |  |                 and (batch IS NULL OR batch = '') | 
 |  |  |                 and (sku IS NULL OR sku = '') | 
 |  |  |             </otherwise> | 
 |  |  |         </choose> | 
 |  |  |     </sql> |