|  |  |  | 
|---|
|  |  |  | import com.zy.asrs.entity.result.MobileAdjustResult; | 
|---|
|  |  |  | import com.zy.asrs.mapper.ManLocDetlMapper; | 
|---|
|  |  |  | import com.zy.asrs.service.*; | 
|---|
|  |  |  | import com.zy.common.constant.ApiInterfaceConstant; | 
|---|
|  |  |  | import com.zy.common.model.WrkDto; | 
|---|
|  |  |  | import com.zy.common.service.CommonService; | 
|---|
|  |  |  | import com.zy.common.utils.HttpHandler; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private CommonService commonService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //    @PostMapping("/agv/start") | 
|---|
|  |  |  | //    @ManagerAuth | 
|---|
|  |  |  | //    public R pdaStockCheck(@RequestBody StockCheckParam param){ | 
|---|
|  |  |  | // | 
|---|
|  |  |  | // | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping("/agv/start") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R pdaAgvStart(@RequestBody Map<String,Object> map){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (Cools.isEmpty(map.get("sta"))) { | 
|---|
|  |  |  | return R.parse("暂存位不能为空"); | 
|---|
|  |  |  | } else if (Cools.isEmpty(map.get("inSta"))) { | 
|---|
|  |  |  | return R.parse("入库站点不能为空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //        HashMap<String, String> map1 = new HashMap<>(); | 
|---|
|  |  |  | //        map1.put("agv0001","sta0001"); | 
|---|
|  |  |  | //        String sta = map.get("sta").toString(); | 
|---|
|  |  |  | 
|---|
|  |  |  | //            return R.ok(); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | String sta = (String) map.get("sta"); // 暂存位 | 
|---|
|  |  |  | String inSts = "1040"; // 入库站点 | 
|---|
|  |  |  | String inSta = String.valueOf(map.get("inSta")); // 入库站点 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ForwardAGVTaskParam forwardAGVTaskParam = new ForwardAGVTaskParam(); | 
|---|
|  |  |  | forwardAGVTaskParam.setCtnrTyp("2"); | 
|---|
|  |  |  | forwardAGVTaskParam.setPriority("1"); | 
|---|
|  |  |  | List<ForwardAGVTaskParam.PositionCodePaths> positionCodePathsList = new ArrayList<>(); | 
|---|
|  |  |  | positionCodePathsList.add(new ForwardAGVTaskParam.PositionCodePaths(sta,"05")); | 
|---|
|  |  |  | positionCodePathsList.add(new ForwardAGVTaskParam.PositionCodePaths(inSts,"05")); | 
|---|
|  |  |  | forwardAGVTaskParam.setPositionCodePath(positionCodePathsList); | 
|---|
|  |  |  | return mobileService.inLocCallAgv(sta, inSta); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String body = JSON.toJSONString(forwardAGVTaskParam); | 
|---|
|  |  |  | String response = ""; | 
|---|
|  |  |  | boolean success = false; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | response = new HttpHandler.Builder() | 
|---|
|  |  |  | .setUri(ApiInterfaceConstant.AGV_IP) | 
|---|
|  |  |  | .setPath(ApiInterfaceConstant.AGV_CALL_IN_PATH) | 
|---|
|  |  |  | .setJson(body) | 
|---|
|  |  |  | .build() | 
|---|
|  |  |  | .doPost(); | 
|---|
|  |  |  | JSONObject jsonObject = JSON.parseObject(response); | 
|---|
|  |  |  | if (jsonObject.getInteger("code").equals(0)) { | 
|---|
|  |  |  | success = true; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | log.error("入库呼叫agv失败!!!url:{};request:{};response:{}", ApiInterfaceConstant.AGV_IP+ApiInterfaceConstant.AGV_CALL_IN_PATH, body, response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("入库呼叫agv异常", e); | 
|---|
|  |  |  | } finally { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | // 保存接口日志 | 
|---|
|  |  |  | //                apiLogService.save( | 
|---|
|  |  |  | //                        "请求仓储MES盘点单上报接口", | 
|---|
|  |  |  | //                        MesConstant.MES_CC_IP_PORT + MesConstant.MES_CC_SB_URL, | 
|---|
|  |  |  | //                        null, | 
|---|
|  |  |  | //                        "127.0.0.1", | 
|---|
|  |  |  | //                        JSON.toJSONString(collect), | 
|---|
|  |  |  | //                        response, | 
|---|
|  |  |  | //                        success | 
|---|
|  |  |  | //                ); | 
|---|
|  |  |  | } catch (Exception e) { log.error("", e); } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping("/agv/unbind") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R pdaAgvUnbind(@RequestBody Map<String,Object> map){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String site = (String) map.get("site"); // 暂存位 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (Cools.isEmpty(site)) { | 
|---|
|  |  |  | return R.parse("暂存位不能为空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return R.error(); | 
|---|
|  |  |  | return mobileService.unbind(site); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void getAgvTaskParam(ForwardAGVTaskParam agvTaskCreateParam,String agv,String sta){ | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping("/comb/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "组托") | 
|---|
|  |  |  | public R comb(@RequestBody CombParam combParam){ | 
|---|
|  |  |  | mobileService.comb(combParam, getUserId()); | 
|---|
|  |  |  | return R.ok("组托成功"); | 
|---|
|  |  |  | if (Cools.isEmpty(combParam.getBarcode(), combParam.getCombMats())) { | 
|---|
|  |  |  | throw new CoolException(BaseRes.PARAM); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>() | 
|---|
|  |  |  | .eq("barcode", combParam.getBarcode()) | 
|---|
|  |  |  | .eq("io_type", 104) | 
|---|
|  |  |  | .in("wrk_sts", 14,105)); | 
|---|
|  |  |  | if (Cools.isEmpty(wrkMast)) { | 
|---|
|  |  |  | mobileService.comb(combParam, getUserId()); | 
|---|
|  |  |  | return R.ok("组托成功"); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | mobileService.mergeComb(combParam, getUserId()); | 
|---|
|  |  |  | return R.ok("并板成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/pingKu/Shelves/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "平库上架") | 
|---|
|  |  |  | public R pingKuShelves(@RequestBody CombParam combParam){ | 
|---|
|  |  |  | if (Cools.isEmpty(combParam.getLocno(), combParam.getCombMats())) { | 
|---|
|  |  |  | throw new CoolException(BaseRes.PARAM); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | mobileService.pingKuShelves(combParam, getUserId()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/pingKu/unShelves/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "平库下架") | 
|---|
|  |  |  | public R pingKuUnShelves(@RequestBody CombParam combParam){ | 
|---|
|  |  |  | if (Cools.isEmpty(combParam.getLocno(), combParam.getCombMats())) { | 
|---|
|  |  |  | throw new CoolException(BaseRes.PARAM); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | mobileService.pingKuUnShelves(combParam, getUserId()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/pack/get/auth") | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok("盘点成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/pda/adjust/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "pda盘点") | 
|---|
|  |  |  | public R pdaAdjust(@RequestBody pdaAdjustParam param){ | 
|---|
|  |  |  | mobileService.pdaAdjust(param,getUserId()); | 
|---|
|  |  |  | return R.ok("盘点成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping("/order/out/pakout/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "订单出库") | 
|---|
|  |  |  | public synchronized R pakoutByOrder(@RequestBody JSONObject param) { | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok("出库成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @GetMapping("/checkOut/submit/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "盘点上传") | 
|---|
|  |  |  | public R CheckOutUploadERP(@RequestParam String orderId){ | 
|---|
|  |  |  | mobileService.inventoryUpload(orderId); | 
|---|
|  |  |  | return R.ok("盘点成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/ddd/ddd") | 
|---|
|  |  |  | @ManagerAuth() | 
|---|
|  |  |  | public R ddd() { | 
|---|
|  |  |  | int w = 64; | 
|---|
|  |  |  | for (int i = 17; i <= 37; i++) { | 
|---|
|  |  |  | for (int j = 1;j<=14;j++){ | 
|---|
|  |  |  | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", i).eq("bay1", j).eq("lev1", 1)); | 
|---|
|  |  |  | LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", i).eq("bay1", j).eq("lev1", 2)); | 
|---|
|  |  |  | LocMast locMast3 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", i).eq("bay1", j).eq("lev1", 3)); | 
|---|
|  |  |  | for (int j = 1;j<=3;j++){ | 
|---|
|  |  |  | //            LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", i).eq("bay1", 7).eq("lev1", j)); | 
|---|
|  |  |  | LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", i).eq("bay1", 12).eq("lev1", j)); | 
|---|
|  |  |  | LocMast locMast3 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", i).eq("bay1", 14).eq("lev1", j)); | 
|---|
|  |  |  | //            LocMast locMast4 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", 26).eq("bay1", i).eq("lev1", 1)); | 
|---|
|  |  |  | if (locMast.getGro1() == 999){ | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //            if (locMast.getGro1() == 999){ | 
|---|
|  |  |  | //                continue; | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  | //            locMast.setGro1(w); | 
|---|
|  |  |  | locMast2.setGro1(locMast.getGro1()+100); | 
|---|
|  |  |  | locMast3.setGro1(locMast.getGro1()+200); | 
|---|
|  |  |  | //            locMast.setGro1(locMast.getGro1()+1000); | 
|---|
|  |  |  | locMast2.setGro1(locMast2.getGro1()+10000); | 
|---|
|  |  |  | locMast3.setGro1(locMast3.getGro1()+2000); | 
|---|
|  |  |  | //            locMast4.setGro1(w); | 
|---|
|  |  |  | //            locMastService.updateById(locMast); | 
|---|
|  |  |  | locMastService.updateById(locMast2); | 
|---|