|  |  | 
 |  |  |             throw new CoolException("参数:托盘码 barcode为空"); | 
 |  |  |         }else if (Cools.isEmpty(param.getPalletizingNo())){ | 
 |  |  |             throw new CoolException("参数:码垛位编号 palletizingNo为空"); | 
 |  |  |         }else if (Cools.isEmpty(param.getBoxType())){ | 
 |  |  |             throw new CoolException("参数:木箱类型 boxType为空"); | 
 |  |  |         }else if (Cools.isEmpty(param.getMatLists()) || param.getMatLists().size()==0){ | 
 |  |  |             throw new CoolException("参数:物料明细 matLists为空"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         ArrayList<String> positions = new ArrayList<>();   //木箱位置查重      (orgin) | 
 |  |  |         ArrayList<String> boxNos = new ArrayList<>();   //木箱唯一编码查重  (batch) | 
 |  |  |         //判断matLists参数 | 
 |  |  |         for (PalletizingCompleteParam.MatList matList:param.getMatLists()){ | 
 |  |  |             if (Cools.isEmpty(matList.getMatnr())){ | 
 |  |  | 
 |  |  |                 throw new CoolException("物料编码:"+matList.getMatnr()+"、参数:木箱中铜箔数量 anfme为空"); | 
 |  |  |             }else if (Cools.isEmpty(matList.getWeight()) || matList.getWeight().equals(0D)){ | 
 |  |  |                 throw new CoolException("物料编码:"+matList.getMatnr()+"、参数:重量 weight为空"); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             if (!positions.contains(matList.getPosition())){ | 
 |  |  |                 positions.add(matList.getPosition()); | 
 |  |  |             }else { | 
 |  |  |                 throw new CoolException("参数:木箱编号 boxNo:"+matList.getBoxNo()+",木箱位置存在重复:"+matList.getPosition()); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             if (!boxNos.contains(matList.getBoxNo())){ | 
 |  |  |                 boxNos.add(matList.getBoxNo()); | 
 |  |  |             }else { | 
 |  |  |                 throw new CoolException("参数:木箱编号 boxNo:"+matList.getBoxNo()+",木箱编码存在重复"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  | 
 |  |  |             } | 
 |  |  |             WaitPakin waitPakin = new WaitPakin(); | 
 |  |  |             waitPakin.sync(mat); | 
 |  |  |             waitPakin.setBatch(matList.getBatch());     //批次 | 
 |  |  |             waitPakin.setModel(matList.getBatch());     //批次 | 
 |  |  |             waitPakin.setSpecs(matList.getSpecs());     //规格 | 
 |  |  |             waitPakin.setSku(matList.getBoxNo());       //木箱编码 | 
 |  |  |             waitPakin.setBatch(matList.getBoxNo());       //木箱编码 | 
 |  |  |             waitPakin.setBrand(param.getBoxType());     //木箱类型 | 
 |  |  |             waitPakin.setZpallet(param.getBarcode());   //托盘码 | 
 |  |  |             waitPakin.setOrigin(matList.getPosition()); //木箱在托盘上的位置 | 
 |  |  |             waitPakin.setIoStatus("N");     // 入出状态 | 
 |  |  | 
 |  |  |             } | 
 |  |  |             boolean sign=true; | 
 |  |  |             for (WrkDetl wrkDetl:wrkDetls){ | 
 |  |  |                 if (wrkDetl.getSku().equals(matList.getBoxNo())){//木箱编码 | 
 |  |  |                 if (wrkDetl.getBatch().equals(matList.getBoxNo())){//木箱编码 | 
 |  |  |                     wrkDetl.setInspect(1); | 
 |  |  |                     wrkDetlService.updateById(wrkDetl); | 
 |  |  |                     wrkDetlsNew.add(wrkDetl); | 
 |  |  | 
 |  |  |         wrkMast.setAppeTime(now); | 
 |  |  |         wrkMast.setModiUser(userId); | 
 |  |  |         wrkMast.setModiTime(now); | 
 |  |  |         boolean res = wrkMastService.insert(wrkMast); | 
 |  |  |         if (!res) { | 
 |  |  |             throw new CoolException("生成工作档失败"); | 
 |  |  |         if (!wrkMastService.insert(wrkMast)) { | 
 |  |  |             throw new CoolException("生成工作档失败==》桁架上位软件:单次拆垛完成通知"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         for (WrkDetl wrkDetl : wrkDetlsNew){ | 
 |  |  | 
 |  |  |             wrkDetl.setAppeTime(now); | 
 |  |  |             wrkDetl.setModiTime(now); | 
 |  |  |             if (!wrkDetlService.insert(wrkDetl)) { | 
 |  |  |                 throw new CoolException("保存工作明细失败"); | 
 |  |  |                 throw new CoolException("保存工作明细失败==》桁架上位软件:单次拆垛完成通知"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  | 
 |  |  |     @Transactional | 
 |  |  |     public void singleMountUnstackingComplete(SingleMountUnstackingCompleteParam param) { | 
 |  |  |         Long userId = 8888L;//桁架上位软件 | 
 |  |  |         //判断param参数 | 
 |  |  |         if (Cools.isEmpty(param.getBarcode())){ | 
 |  |  |             throw new CoolException("参数:托盘码 barcode为空"); | 
 |  |  |         }else if (Cools.isEmpty(param.getPalletizingNo())){ | 
 |  |  |             throw new CoolException("参数:码垛位编号 palletizingNo为空"); | 
 |  |  |         } | 
 |  |  |         WrkMast wrkMastMatrix = wrkMastService.selectByBarcode(param.getBarcode()); | 
 |  |  |         if (Cools.isEmpty(wrkMastMatrix)){ | 
 |  |  |             throw new CoolException("参数:托盘码查询工作档失败:"+param.getBarcode()); | 
 |  |  |         }else { | 
 |  |  |             if (!wrkMastMatrix.getIoType().equals(101)){ | 
 |  |  |                 List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNoUnstacking(wrkMastMatrix.getWrkNo()); | 
 |  |  |                 if (Cools.isEmpty(param.getMatLists()) || param.getMatLists().size()==0 || param.getMatLists().size()!=wrkDetls.size()){ | 
 |  |  |                     throw new CoolException("返回物料明细数为"+param.getMatLists().size()+",托盘码:"+param.getBarcode()+"应剩余物料数:"+wrkDetls.size()); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 ArrayList<String> orgin = new ArrayList<>(); | 
 |  |  |                 //判断matLists参数 | 
 |  |  |                 for (SingleMountUnstackingCompleteParam.MatList matList : param.getMatLists()){ | 
 |  |  |                     if (Cools.isEmpty(matList.getPosition())){ | 
 |  |  |                         throw new CoolException("参数:码垛位置 position为空"); | 
 |  |  |                     }else if (Cools.isEmpty(matList.getBoxNo())){ | 
 |  |  |                         throw new CoolException("参数:木箱编号 boxNo为空"); | 
 |  |  |                     } | 
 |  |  |                     if (!orgin.contains(matList.getPosition())){ | 
 |  |  |                         orgin.add(matList.getPosition()); | 
 |  |  |                     }else { | 
 |  |  |                         throw new CoolException("参数:木箱编号 boxNo:"+matList.getBoxNo()+",木箱位置存在重复"); | 
 |  |  |                     } | 
 |  |  |                     boolean sign=true; | 
 |  |  |                     for (WrkDetl wrkDetl:wrkDetls){ | 
 |  |  |                         if (wrkDetl.getBatch().equals(matList.getBoxNo())){//木箱编码 | 
 |  |  |                             wrkDetl.setOrigin(matList.getPosition()); | 
 |  |  |                             wrkDetlService.updateById(wrkDetl); | 
 |  |  |                             sign=false; | 
 |  |  |                             break; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                     if (sign){ | 
 |  |  |                         throw new CoolException("参数:木箱编号 boxNo:"+matList.getBoxNo()+"未查询到对应的工作明细!"); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         wrkMastMatrix.setSheetNo("1"); | 
 |  |  |         if (!wrkMastService.updateById(wrkMastMatrix)){ | 
 |  |  |             throw new CoolException("更新工作档失败==》桁架上位软件:单托拆垛完成通知"); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /*...........................上饶江铜..............以上.............徐工汉云...........................*/ |