| | |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private PltBarcodeService pltBarcodeService; |
| | | |
| | | @PostMapping("/pakin/loc/v1") |
| | | @ResponseBody |
| | | public R getLocNo(@RequestBody SearchLocParam param) { |
| | | public synchronized R getLocNo(@RequestBody SearchLocParam param) { |
| | | log.info("收到WCS入库接口请求====>>入参:{}", param); |
| | | if (Cools.isEmpty(param.getIoType())) { |
| | | return R.error("入出库类型不能为空"); |
| | | } |
| | |
| | | } |
| | | pltBarcodes = pltBarcodeService.selectList(new EntityWrapper<PltBarcode>().eq("barcode", param.getBarcode())); |
| | | if (Cools.isEmpty(pltBarcodes)) { |
| | | return R.error("条码数据错误"); |
| | | return R.error("条码未组托:" + param.getBarcode()); |
| | | } |
| | | int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode())); |
| | | int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",param.getBarcode())); |
| | | int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", param.getBarcode())); |
| | | int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet", param.getBarcode())); |
| | | if (countLoc > 0 || countWrk > 0) { |
| | | return R.error("工作档/库存条码数据已存在"); |
| | | } |
| | | } |
| | | if (Cools.isEmpty(param.getLocType1())){ |
| | | if (Cools.isEmpty(param.getLocType1())) { |
| | | return R.error("高低检测信号不能为空"); |
| | | } |
| | | |
| | | |
| | | // 源站点状态检测 |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(param.getSourceStaNo(), true); |
| | | if (Cools.isEmpty(sourceStaNo)){ |
| | | if (Cools.isEmpty(sourceStaNo)) { |
| | | return R.error("入库站点不存在"); |
| | | } |
| | | sourceStaNo.setLocType1(param.getLocType1()); |
| | | LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo); |
| | | locTypeDto.setLocType1(param.getLocType1()); |
| | | |
| | | // 限制只能有一个在设备上走状态 |
| | | int count = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("wrk_sts", 2).eq("source_sta_no", param.getSourceStaNo())); |
| | | if (count > 0) { |
| | | return R.error("已有在设备上走工作档"); |
| | | } |
| | | |
| | | StartupDto dto = null; |
| | | switch (param.getIoType()) { |
| | |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | log.info("WCS入库接口返参:{},托盘码:{}", dto.toString(), param.getBarcode()); |
| | | return R.ok().add(dto); |
| | | } |
| | | |
| | |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true); |
| | | // 检索库位 |
| | | List<String> matNos = pltBarcodes.stream().map(PltBarcode::getMatNo).distinct().collect(Collectors.toList()); |
| | | StartupDto dto = commonService.getLocNo(1, 1, devpNo, false, matNos, locTypeDto,0); |
| | | |
| | | // 获取类别标识(1原材料,2成品) |
| | | List<String> str5 = pltBarcodes.stream().map(PltBarcode::getStr5).distinct().collect(Collectors.toList()); |
| | | if (str5.isEmpty() || str5.get(0) == null) { |
| | | throw new CoolException("物料类别获取失败"); |
| | | } |
| | | |
| | | StartupDto dto = new StartupDto(); |
| | | if (devpNo == 304) { |
| | | dto = commonService.getLocNoBy304(str5.get(0)); |
| | | } else if (devpNo == 311) { |
| | | dto = commonService.getLocNoBy311(str5.get(0)); |
| | | } else { |
| | | // dto = commonService.getLocNo(1, 1, devpNo, false, matNos, locTypeDto,0); |
| | | dto = commonService.getLocNoNew(1, devpNo, barcode); |
| | | } |
| | | int workNo = dto.getWorkNo(); |
| | | |
| | | // 生成工作档 |
| | |
| | | } |
| | | // 生成工作档明细 |
| | | List<MatCodeCountDto> matDtos = new ArrayList<>(); |
| | | StartupDto finalDto = dto; |
| | | pltBarcodes.forEach(elem -> { |
| | | matDtos.add(new MatCodeCountDto(elem.getBillNo(), elem.getSeqNo(), elem.getMatNo(), elem.getQty())); |
| | | matDtos.add(new MatCodeCountDto(elem.getBillNo(), elem.getSeqNo(), elem.getMatNo(), elem.getSupplier(), elem.getQty(), elem.getSource(), elem.getVendor(), elem.getMemo())); |
| | | |
| | | //更新组托数据状态为入库中 |
| | | Wrapper<PltBarcode> wrapper = new EntityWrapper<PltBarcode>().eq("barcode", elem.getBarcode()) |
| | | .eq("bill_no", elem.getBillNo()).eq("seq_no", elem.getSeqNo()).eq("mat_no", elem.getMatNo()); |
| | | PltBarcode pltBarcode = pltBarcodeService.selectOne(wrapper); |
| | | pltBarcode.setLocNo(dto.getLocNo()); |
| | | pltBarcode.setLocNo(finalDto.getLocNo()); |
| | | pltBarcode.setIoStatus(1);//入库中 |
| | | pltBarcodeService.update(pltBarcode,wrapper); |
| | | pltBarcodeService.update(pltBarcode, wrapper); |
| | | }); |
| | | wrkDetlService.createWorkDetail(workNo, matDtos, barcode, null); |
| | | // 更新源站点信息 |
| | | sourceStaNo.setWrkNo(workNo); |
| | | sourceStaNo.setModiTime(new Date()); |
| | | if (!basDevpService.updateById(sourceStaNo)){ |
| | | if (!basDevpService.updateById(sourceStaNo)) { |
| | | throw new CoolException("更新源站失败"); |
| | | } |
| | | // 更新目标库位状态 |
| | | LocMast locMast = locMastService.selectById(dto.getLocNo()); |
| | | if (locMast.getLocSts().equals("O")){ |
| | | if (locMast.getLocSts().equals("O")) { |
| | | locMast.setLocSts("S"); // S.入库预约 |
| | | locMast.setModiTime(new Date()); |
| | | if (!locMastService.updateById(locMast)){ |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException("改变库位状态失败"); |
| | | } |
| | | } else { |
| | | throw new CoolException(dto.getLocNo()+"目标库位已被占用"); |
| | | throw new CoolException(dto.getLocNo() + "目标库位已被占用"); |
| | | } |
| | | return dto; |
| | | } |
| | |
| | | // 源站点状态检测 |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true); |
| | | // 检索库位 |
| | | StartupDto dto = commonService.getLocNo(1, 10, devpNo, true, null, locTypeDto,0); |
| | | StartupDto dto; |
| | | // if (devpNo >= 300) { |
| | | dto = commonService.emptyIngetLocNo(devpNo); |
| | | // } else { |
| | | // dto = commonService.getLocNo(1, 10, devpNo, true, null, locTypeDto, 0); |
| | | // } |
| | | int workNo = dto.getWorkNo(); |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | |
| | | // 更新源站点信息 |
| | | sourceStaNo.setWrkNo(workNo); |
| | | sourceStaNo.setModiTime(new Date()); |
| | | if (!basDevpService.updateById(sourceStaNo)){ |
| | | if (!basDevpService.updateById(sourceStaNo)) { |
| | | throw new CoolException("更新源站失败"); |
| | | } |
| | | // 更新目标库位状态 |
| | | LocMast locMast = locMastService.selectById(dto.getLocNo()); |
| | | if (locMast.getLocSts().equals("O")){ |
| | | if (locMast.getLocSts().equals("O")) { |
| | | locMast.setLocSts("S"); // S.入库预约 |
| | | locMast.setModiTime(new Date()); |
| | | if (!locMastService.updateById(locMast)){ |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException("改变库位状态失败"); |
| | | } |
| | | } else { |
| | | throw new CoolException(dto.getLocNo()+"目标库位已被占用"); |
| | | throw new CoolException(dto.getLocNo() + "目标库位已被占用"); |
| | | } |
| | | return dto; |
| | | } |