|  |  | 
 |  |  | import com.zy.asrs.mapper.WrkMastMapper; | 
 |  |  | import com.zy.asrs.service.*; | 
 |  |  | import com.zy.common.CodeRes; | 
 |  |  | import com.zy.common.model.AgvBasDevpDto; | 
 |  |  | import com.zy.common.model.LocTypeDto; | 
 |  |  | import com.zy.common.model.StartupDto; | 
 |  |  | import com.zy.common.service.CommonService; | 
 |  |  | 
 |  |  |     private WrkMastLogService wrkMastLogService; | 
 |  |  |     @Autowired | 
 |  |  |     private AgvWrkDetlService agvWrkDetlService; | 
 |  |  |     @Autowired | 
 |  |  |     private AgvLocDetlService agvLocDetlService; | 
 |  |  | //    @Autowired | 
 |  |  | //    private ErpService erpService; | 
 |  |  |  | 
 |  |  | 
 |  |  |         String devNo = param.getDevNo(); | 
 |  |  |         String containerCode = currentContainerMap.get(devNo); | 
 |  |  |  | 
 |  |  |         AgvBasDevpDto agvBasDevpDto = new AgvBasDevpDto(); | 
 |  |  |  | 
 |  |  |         //查找该容器的工作档 | 
 |  |  |         AgvWrkMast agvWrkMast = agvWrkMastService.selectByContainerCode(containerCode); | 
 |  |  |         if(!Cools.isEmpty(agvWrkMast)){ | 
 |  |  |             return R.ok(agvWrkDetlService.selectList(new EntityWrapper<AgvWrkDetl>().eq("wrk_no",agvWrkMast.getWrkNo()))); | 
 |  |  |             List<AgvWrkDetl> agvWrkDetlList = agvWrkDetlService.selectList(new EntityWrapper<AgvWrkDetl>().eq("wrk_no", agvWrkMast.getWrkNo())); | 
 |  |  |  | 
 |  |  |             for (AgvWrkDetl agvWrkDetl : AgvWrkDetlList){ | 
 |  |  |                 agvWrkDetl.setVolume(agvWrkDetl.getAnfme()); | 
 |  |  |                 if(agvWrkMast.getIoType() == 103){ | 
 |  |  |                     //寻找是否有相同物料的工作档明细,并返回数量之和 | 
 |  |  |                     double anfme = getAllAnfmeInAgvWrkDetlList(agvWrkDetlList,agvWrkDetl); | 
 |  |  |                     AgvLocDetl agvLocDetl = agvLocDetlService.selectByMatnrAndBatchAndCsocodeAndisoCode(agvWrkMast.getSourceLocNo(), agvWrkDetl.getMatnr(), agvWrkDetl.getBatch(), agvWrkDetl.getThreeCode(), agvWrkDetl.getDeadTime()); | 
 |  |  |                     //用于结余数量显示 | 
 |  |  |                     agvWrkDetl.setVolume(agvLocDetl.getAnfme() - anfme); | 
 |  |  |                 } | 
 |  |  |                 if(agvWrkMast.getIoType() == 53){ | 
 |  |  |                     AgvLocDetl agvLocDetl = agvLocDetlService.selectByMatnrAndBatchAndCsocodeAndisoCode(agvWrkMast.getLocNo(), agvWrkDetl.getMatnr(), agvWrkDetl.getBatch(), agvWrkDetl.getThreeCode(), agvWrkDetl.getDeadTime()); | 
 |  |  |                     if(Cools.isEmpty(agvLocDetl)){ | 
 |  |  |                         agvWrkDetl.setVolume(0.0); | 
 |  |  |                     }else { | 
 |  |  |                         agvWrkDetl.setVolume(agvLocDetl.getAnfme()); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             }; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             return R.ok(agvWrkDetlList).add(agvWrkMast); | 
 |  |  |         } | 
 |  |  |         //查找该容器的入库通知档 | 
 |  |  |         List<AgvWaitPakin> agvWaitPakinList = agvWaitPakinService.selectList(new EntityWrapper<AgvWaitPakin>().eq("supp_code", containerCode)); | 
 |  |  | 
 |  |  |         return R.error("没有该容器的出库、拣料、入库信息等"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     private double getAllAnfmeInAgvWrkDetlList(List<AgvWrkDetl> agvWrkDetlList, AgvWrkDetl wd0) { | 
 |  |  |         double allAnfme = 0; | 
 |  |  |         for (AgvWrkDetl wd1 : agvWrkDetlList){ | 
 |  |  |             if(Cools.eq(wd0.getMatnr(),wd1.getMatnr()) | 
 |  |  |                     && Cools.eq(wd0.getBatch(),wd1.getBatch()) | 
 |  |  |                     && Cools.eq(wd0.getThreeCode(),wd1.getThreeCode()) | 
 |  |  |                     && Cools.eq(wd0.getDeadTime(),wd1.getDeadTime())){ | 
 |  |  |                 allAnfme += wd1.getAnfme(); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return allAnfme; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } |