|  |  | 
 |  |  | import com.zy.asrs.entity.*; | 
 |  |  | import com.zy.asrs.entity.param.CombParam; | 
 |  |  | import com.zy.asrs.entity.param.MobileAdjustParam; | 
 |  |  | import com.zy.asrs.entity.param.ModifyPakoutParam; | 
 |  |  | import com.zy.asrs.entity.param.NodePakoutParam; | 
 |  |  | import com.zy.asrs.entity.result.MobileAdjustResult; | 
 |  |  | import com.zy.asrs.service.*; | 
 |  |  | 
 |  |  |     private MatService matService; | 
 |  |  |     @Autowired | 
 |  |  |     private WaitPakinService waitPakinService; | 
 |  |  |     @Autowired | 
 |  |  |     private LocRuleService locRuleService; | 
 |  |  |     @Autowired | 
 |  |  |     private NodeService nodeService; | 
 |  |  |  | 
 |  |  |     // 组托 ---------------------------------------------------------------------------------------------------- | 
 |  |  |  | 
 |  |  | 
 |  |  |     平库 库位推荐 | 
 |  |  |      */ | 
 |  |  |     @RequestMapping("/node/recommend/loc") | 
 |  |  |     @ManagerAuth(memo = "库位推荐") | 
 |  |  |     //@ManagerAuth(memo = "库位推荐") | 
 |  |  |     public R recommendNodeLoc(@RequestBody HashMap<String,String> param){ | 
 |  |  |  | 
 |  |  |         String zpallet = param.get("zpallet"); | 
 |  |  |         List<WaitPakin> waitPakinList = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", zpallet)); | 
 |  |  |         for (WaitPakin waitPakin : waitPakinList){ | 
 |  |  |             List<LocRule> locRules = locRuleService.find(waitPakin.getMatnr()); | 
 |  |  |             if(!Cools.isEmpty(locRules)){ | 
 |  |  |                 if(!Cools.isEmpty(findNodeLoc(locRules))){ | 
 |  |  |                     return R.ok(findNodeLoc(locRules)).add(waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet",zpallet))); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |         return R.ok("DT-C-010202").add(waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet",zpallet))); | 
 |  |  |             if(!Cools.isEmpty(waitPakin.getBrand())){ | 
 |  |  |                 List<LocRule> locCodeRules = locRuleService.find(waitPakin.getBrand().substring(0, 4)); | 
 |  |  |                 if(!Cools.isEmpty(locRules)){ | 
 |  |  |                     if(!Cools.isEmpty(findNodeLoc(locRules))){ | 
 |  |  |                         return R.ok(findNodeLoc(locRules)).add(waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet",zpallet))); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return R.ok("").add(waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet",zpallet))); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |         return R.ok("上架成功"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping("/check/waitPakin/auth") | 
 |  |  |     @ManagerAuth(memo = "查询托盘是否组托") | 
 |  |  |     public R waitPakins(@RequestBody String barcode){ | 
 |  |  |         return R.ok().add(waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode))); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping("/untie/auth") | 
 |  |  |     @ManagerAuth(memo = "解绑") | 
 |  |  |     public R untie(@RequestBody String barcode){ | 
 |  |  |         List<WaitPakin> waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode)); | 
 |  |  |         for (WaitPakin waitPakin : waitPakins) { | 
 |  |  |             if (!waitPakinService.delete(new EntityWrapper<WaitPakin>().eq("zpallet", barcode))) { | 
 |  |  |                 return R.error("解绑失败"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return R.ok().add(waitPakins); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping("/wrkdetl/auth") | 
 |  |  |     //@ManagerAuth(memo = "拣料信息") | 
 |  |  |     public R checkWrkDetl(@RequestBody String barcode){ | 
 |  |  |         WrkMast wrkMast = wrkMastService.selectByBarcode(barcode); | 
 |  |  |         if(Cools.isEmpty(wrkMast)){ | 
 |  |  |             return R.error("该托盘没有工作档"); | 
 |  |  |         } | 
 |  |  |         List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); | 
 |  |  |         return R.ok().add(wrkDetls); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping("/modify/wrkdetl/auth") | 
 |  |  |     //@ManagerAuth(memo = "修改拣料信息") | 
 |  |  |     public R modifyWrkDetl(@RequestBody ModifyPakoutParam param){ | 
 |  |  |  | 
 |  |  |         String barcode = param.getBarcode(); | 
 |  |  |         WrkMast wrkMast = wrkMastService.selectByBarcode(barcode); | 
 |  |  |         List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); | 
 |  |  |  | 
 |  |  |         Double allPakoutAnfme = 0.0; | 
 |  |  |         Double allModifyPakoutAnfme = 0.0; | 
 |  |  |         for (WrkDetl wrkDetl : wrkDetls){ | 
 |  |  |             allPakoutAnfme += wrkDetl.getAnfme(); | 
 |  |  |         } | 
 |  |  |         for (ModifyPakoutParam.CA ca : param.getParams()){ | 
 |  |  |             allModifyPakoutAnfme += ca.getAnfme(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         if(!allPakoutAnfme.equals(allModifyPakoutAnfme)){ | 
 |  |  |             return R.error("修改后拣料的数量与原数量不符合,请重新核对拣料数量"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         mobileService.modifyWrkDetl(wrkDetls,param.getParams(),getUserId()); | 
 |  |  |         return R.ok(); | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     private String findNodeLoc(List<LocRule> locRules){ | 
 |  |  |         for (LocRule locRule : locRules) { | 
 |  |  |             if (Cools.isEmpty(locRule.getOther())) { | 
 |  |  |                 continue; | 
 |  |  |             } | 
 |  |  |             EntityWrapper<Node> wrapper = new EntityWrapper<>(); | 
 |  |  |             wrapper.between("row1", locRule.getRowBeg(), locRule.getRowEnd()) | 
 |  |  |                     .between("bay1", locRule.getBayBeg(), locRule.getBayEnd()) | 
 |  |  |                     .between("lev1", locRule.getLevBeg(), locRule.getLevEnd()) | 
 |  |  |                     .eq("parent_name", locRule.getOther()) | 
 |  |  |                     .eq("status", "1"); | 
 |  |  |  | 
 |  |  |             Node node = nodeService.selectOne(wrapper); | 
 |  |  |             if (Cools.isEmpty(node)) { | 
 |  |  |                 continue; | 
 |  |  |             } | 
 |  |  |             return node.getName(); | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  | } |