|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | log.info("启动入库,{}", JSON.toJSONString(params)); | 
|---|
|  |  |  | // 组托 | 
|---|
|  |  |  | if (params.getBarcode().startsWith("31")) { | 
|---|
|  |  |  | //箱壳入库,货架上只能装一种 | 
|---|
|  |  |  | if (!Cools.isEmpty(params.getCombParams())) { | 
|---|
|  |  |  | if (params.getCombParams().size() > 1) { | 
|---|
|  |  |  | return R.error("半成品箱壳入库,货架上只能装一种物料"); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | List<CombParam.CombMat> combMats = params.getCombParams().get(0).getCombMats(); | 
|---|
|  |  |  | if (!Cools.isEmpty(combMats) && combMats.size() > 1) { | 
|---|
|  |  |  | return R.error("半成品箱壳入库,货架上只能装一种物料"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | params.getCombParams().forEach(combParam -> { | 
|---|
|  |  |  | agvMobileService.comb(combParam, getUserId()); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | params.setContainerType(Short.valueOf(params.getContainerCode().substring(0, 2))); | 
|---|
|  |  |  | workService.emptyPlateIn(params.getDevNo(), params.getContainerCode(), params.getContainerType(), getUserId(), false); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return R.ok("生成工作档成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* | 
|---|
|  |  |  | 启动入库,组托 + 生成工作档,主要用于吸塑一楼的入库 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @PostMapping("/start/pakin/auth/v2") | 
|---|
|  |  |  | @Synchronized | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | @ManagerAuth(memo = "启动入库v2") | 
|---|
|  |  |  | public R startPakinV2(@RequestBody AgvMobileStartPakin params) { | 
|---|
|  |  |  | if (params == null) { | 
|---|
|  |  |  | return R.error("缺少参数"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | log.info("启动入库v2,{}", JSON.toJSONString(params)); | 
|---|
|  |  |  | // 组托 | 
|---|
|  |  |  | if (params.getBarcode().startsWith("30")) { | 
|---|
|  |  |  | //箱壳入库,货架上只能装一种 | 
|---|
|  |  |  | if (!Cools.isEmpty(params.getCombParams())) { | 
|---|
|  |  |  | if (params.getCombParams().size() > 1) { | 
|---|
|  |  |  | return R.error("箱壳入库,货架上只能装一种物料"); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | List<CombParam.CombMat> combMats = params.getCombParams().get(0).getCombMats(); | 
|---|
|  |  |  | if (!Cools.isEmpty(combMats) && combMats.size() > 1) { | 
|---|
|  |  |  | return R.error("箱壳入库,货架上只能装一种物料"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | params.getCombParams().forEach(combParam -> { | 
|---|
|  |  |  | agvMobileService.comb(combParam, getUserId()); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | params.setContainerType(Short.valueOf(params.getContainerCode().substring(0, 2))); | 
|---|
|  |  |  | workService.emptyPlateInV2(params.getDevNo(), params.getContainerCode(), params.getContainerType(), getUserId(), false, params.getFactory()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return R.ok("生成工作档成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.error("缺少容器参数"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | pda.setContainerType(Short.valueOf(pda.getContainerCode().substring(0, 2))); | 
|---|
|  |  |  | workService.emptyPlateIn(pda.getDevNo(), pda.getContainerCode(), pda.getContainerType(), getUserId(), false); | 
|---|
|  |  |  | workService.emptyPlateInV3(pda.getDevNo(), pda.getContainerCode(), pda.getContainerType(), getUserId(), false); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!Cools.isEmpty(locNo)) { | 
|---|
|  |  |  | listByLocNo = agvLocDetlService.selectList(new EntityWrapper<AgvLocDetl>().eq("loc_no", locNo)); | 
|---|
|  |  |  | if (listByLocNo != null) { | 
|---|
|  |  |  | for (AgvLocDetl agvLocDetl : listByLocNo) { | 
|---|
|  |  |  | agvLocDetl.setCount(agvLocDetl.getAnfme()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!Cools.isEmpty(locNo)) { | 
|---|
|  |  |  | if (!Cools.isEmpty(containerCode)) { | 
|---|
|  |  |  | listByContainerCode = agvLocDetlService.selectList(new EntityWrapper<AgvLocDetl>().eq("supp_code", containerCode)); | 
|---|
|  |  |  | if (listByContainerCode != null) { | 
|---|
|  |  |  | for (AgvLocDetl agvLocDetl : listByContainerCode) { | 
|---|
|  |  |  | agvLocDetl.setCount(agvLocDetl.getAnfme()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> result = new HashMap<String, Object>(); | 
|---|
|  |  |  | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | @ManagerAuth(memo = "调拨单任务下发") | 
|---|
|  |  |  | @Synchronized | 
|---|
|  |  |  | @Deprecated //不用了 | 
|---|
|  |  |  | public R agvLocMove(@RequestBody HashMap<String, Object> params) { | 
|---|
|  |  |  | String fl = String.valueOf(params.get("floor")); | 
|---|
|  |  |  | short floor = (short) Integer.parseInt(fl.substring(0, 1)); | 
|---|
|  |  |  | 
|---|
|  |  |  | String locNo = map.get("locNo"); | 
|---|
|  |  |  | String barcode = map.get("suppCode"); | 
|---|
|  |  |  | AgvWrkMast source_loc_no = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("source_loc_no", locNo)); | 
|---|
|  |  |  | if (!Cools.isEmpty(source_loc_no)) { | 
|---|
|  |  |  | if (!Cools.isEmpty(source_loc_no) && source_loc_no.getWrkSts() < 204) { | 
|---|
|  |  |  | throw new CoolException("当前库位已生成任务!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | AgvLocMast locMastS = agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_no", locNo).eq("loc_sts", "F")); | 
|---|
|  |  |  | if (Cools.isEmpty(locMastS)) { | 
|---|
|  |  |  | throw new CoolException("当前库位非在库状态!库位号=" + locNo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | AgvWrkMast wrkMast = createWrkMast(ioType, 22L, locNo, "", barcode, now, getUserId(), 30, floor); | 
|---|
|  |  |  | AgvWrkMast wrkMast = createWrkMast(ioType, 22L, locNo, "", barcode, now, getUserId(), Integer.parseInt(barcode.substring(0, 2)), floor); | 
|---|
|  |  |  | // 同步调拨单 | 
|---|
|  |  |  | long flowId = snowflakeIdWorker.nextId(); | 
|---|
|  |  |  | List<AgvLocDetl> agvLocDetls = agvLocDetlService.selectList(new EntityWrapper<AgvLocDetl>().eq("loc_no", locNo)); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (Cools.isEmpty(locMastS)) { | 
|---|
|  |  |  | throw new CoolException("当前库位非在库状态!库位号=" + locNo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | AgvWrkMast wrkMast = createWrkMast(114, 22L, locNo, "", barcode, now, getUserId(), 30, 1); | 
|---|
|  |  |  | AgvWrkMast wrkMast = createWrkMast(114, 22L, locNo, "", barcode, now, getUserId(), Integer.parseInt(barcode.substring(0,2)), 1); | 
|---|
|  |  |  | // 同步调拨单 | 
|---|
|  |  |  | List<AgvLocDetl> agvLocDetls = agvLocDetlService.selectList(new EntityWrapper<AgvLocDetl>().eq("loc_no", locNo)); | 
|---|
|  |  |  | for (AgvLocDetl agvLocDetl : agvLocDetls) { | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping("/hand/control/processed/v2") | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | @ManagerAuth(memo = "确认加工完成V2") | 
|---|
|  |  |  | @Synchronized | 
|---|
|  |  |  | public R processedV2(@RequestBody AgvMobileStartPakin param) { | 
|---|
|  |  |  | agvMobileService.processedV2(param, getUserId()); | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static void main(String[] args) { | 
|---|
|  |  |  | List<AgvLocDetl> agvLocDetls1 = new ArrayList<>(); | 
|---|