| | |
| | | public synchronized Re getLocNo(@RequestBody SearchLocParam param) { |
| | | log.info("收到WCS入库接口请求====>>入参:{}", param); |
| | | if (Cools.isEmpty(param.getCargoHeight())) { |
| | | return Re.error("高低库类型不能为空"); |
| | | return Re.error("response.high_low_warehouse_type_not_empty"); |
| | | } |
| | | if (Cools.isEmpty(param.getFromPort()) && !param.getFromPort().equals("1001")) { |
| | | return Re.error("入库站点编号错误:"+param.getFromPort()); |
| | | return Re.error("response.inbound_site_number_error"); |
| | | } |
| | | if(Cools.isEmpty(param.getWarehouse())){ |
| | | return Re.error("仓库编号不能为空"); |
| | | return Re.error("response.warehouse_number_not_empty"); |
| | | } |
| | | if(!param.getWarehouse().equals(warehouse)){ |
| | | return Re.error("仓库编号不匹配"); |
| | | return Re.error("response.warehouse_number_mismatch"); |
| | | } |
| | | List<WaitPakin> waitPakins = null; |
| | | |
| | |
| | | //有空板出库时禁止入库 |
| | | int wrkCount = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 110).eq("sta_no", 1001).notIn("wrk_sts", 7)); |
| | | if(wrkCount > 0){ |
| | | return Re.error("有空板出库到1001站时时禁止入库"); |
| | | return Re.error("response.empty_plate_outbound_forbidden_inbound"); |
| | | } |
| | | |
| | | if (Cools.isEmpty(param.getBarCode())) { |
| | | return Re.error("条码不能为空"); |
| | | return Re.error("response.barcode_not_empty"); |
| | | } |
| | | waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarCode())); |
| | | if (Cools.isEmpty(waitPakins)) { |
| | |
| | | //有满板出库时禁止空板入库 |
| | | int wrkCount = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("sta_no", 1001).andNew().eq("io_type", 101).or().eq("io_type", 110)); |
| | | if (wrkCount > 0) { |
| | | return Re.error("有满板出库时禁止空板入库"); |
| | | return Re.error("response.full_plate_outbound_forbidden_empty_plate_inbound"); |
| | | } |
| | | |
| | | int countLoc = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 10)); |
| | | if (countLoc > 0) { |
| | | return Re.error("已有空板入库任务禁止在入空板"); |
| | | return Re.error("response.empty_plate_inbound_task_exists"); |
| | | } |
| | | } |
| | | if (Cools.isEmpty(param.getCargoHeight())) { |
| | | return Re.error("高低检测信号不能为空"); |
| | | return Re.error("response.high_low_detection_signal_not_empty"); |
| | | } |
| | | // if (!param.getBarCode().startsWith("7")&&!param.getBarCode().startsWith("8")){ |
| | | // return Re.error("未定义的托盘码规则"); |
| | |
| | | // 源站点状态检测 |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(Integer.valueOf(param.getFromPort()), true); |
| | | if(sourceStaNo == null){ |
| | | return Re.error("站点不存在"); |
| | | return Re.error("response.site_not_exist"); |
| | | } |
| | | sourceStaNo.setLocType1(param.getCargoHeight().shortValue()); // 高低库位 |
| | | // if (param.getBarCode().startsWith("7")){ |
| | |
| | | public synchronized Re getLocNo(@RequestBody SearchEmptyParam param) { |
| | | log.info("收到WCS空板入库接口请求====>>入参:{}", param); |
| | | if(Cools.isEmpty(param.getWarehouse())){ |
| | | return Re.error("仓库编号不能为空"); |
| | | return Re.error("response.warehouse_number_not_empty"); |
| | | } |
| | | if(!param.getWarehouse().equals(warehouse)){ |
| | | return Re.error("仓库编号不匹配"); |
| | | return Re.error("response.warehouse_number_mismatch"); |
| | | } |
| | | |
| | | // // 源站点状态检测 |
| | |
| | | public synchronized Re errReport(@RequestBody ErrorMsg param){ |
| | | log.info("收到WCS任务入库异常上报===>>入参:{}",param); |
| | | if(Cools.isEmpty(param.getWarehouse())){ |
| | | return Re.error("仓库编号不能为空"); |
| | | return Re.error("response.warehouse_number_not_empty"); |
| | | } |
| | | if(!param.getWarehouse().equals(warehouse)){ |
| | | return Re.error("仓库编号不匹配"); |
| | | return Re.error("response.warehouse_number_mismatch"); |
| | | } |
| | | return Re.ok(); |
| | | } |
| | |
| | | public synchronized Re applyChangeEnd(@RequestBody ApplyChangeEnd param){ |
| | | log.info("收到WCS申请最终目的位置===>>入参:{}",param); |
| | | if(Cools.isEmpty(param.getWarehouse())){ |
| | | return Re.error("仓库编号不能为空"); |
| | | return Re.error("response.warehouse_number_not_empty"); |
| | | } |
| | | if(!param.getWarehouse().equals(warehouse)){ |
| | | return Re.error("仓库编号不匹配"); |
| | | return Re.error("response.warehouse_number_mismatch"); |
| | | } |
| | | if (Cools.isEmpty(param.getTaskId())){ |
| | | return Re.error("任务编号不能为空"); |
| | | return Re.error("response.task_id_not_empty"); |
| | | } |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", param.getTaskId())); |
| | | if (wrkMast == null){ |
| | | return Re.error("WMS不存在任务号:" + param.getTaskId() + "任务"); |
| | | return Re.error("response.wms_task_not_exist"); |
| | | } |
| | | if (wrkMast.getIoType() > 100){ |
| | | return Re.error("任务号:" + param.getTaskId() + "是出库任务"); |
| | | return Re.error("response.task_is_outbound"); |
| | | } |
| | | if (wrkMast.getWrkSts() == 4 || wrkMast.getWrkSts() == 5 || wrkMast.getWrkSts() == 14 || wrkMast.getWrkSts() == 15){ |
| | | return Re.error("任务号:" + param.getTaskId() + "已结束"); |
| | | return Re.error("response.task_ended"); |
| | | } |
| | | String targetNo = wrkMast.getLocNo(); |
| | | return Re.ok(targetNo); |
| | |
| | | // 操作人员数据 |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiTime(now); |
| | | wrkMast.setMemo("自动空托入库"); |
| | | return wrkMastService.insert(wrkMast) ? R.ok("自动空托入库成功,工作号:" + wrkMast.getWrkNo()) : R.error("生成自动空托入库失败"); |
| | | wrkMast.setMemo("response.auto_empty_in_memo"); |
| | | return wrkMastService.insert(wrkMast) ? R.ok("response.auto_empty_in_success") : R.error("response.auto_empty_in_failed"); |
| | | } |
| | | |
| | | @PostMapping("auto/emptyOut/v1") |
| | | @PostMapping("/auto/emptyOut/v1") |
| | | @ResponseBody |
| | | public R autoEmptyOut() { |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts", "D")); |
| | | if (Cools.isEmpty(locMast)) { |
| | | return R.error("库存没有空板"); |
| | | return R.error("response.no_empty_pallet"); |
| | | } |
| | | EmptyPlateOutParam emptyPlateOutParam = new EmptyPlateOutParam(); |
| | | emptyPlateOutParam.setOutSite(12); |
| | |
| | | add(locMast.getLocNo() + ""); |
| | | }}); |
| | | WrkMast wrkMast = workService.emptyPlateOut(emptyPlateOutParam); |
| | | return R.ok(!Cools.isEmpty(wrkMast) ? R.ok("自动空托出库成功,工作号:" + wrkMast.getWrkNo()) : R.error("生成自动空托出库失败")); |
| | | return !Cools.isEmpty(wrkMast) ? R.ok("response.auto_empty_out_success") : R.error("response.auto_empty_out_failed"); |
| | | } |
| | | |
| | | /** |
| | |
| | | WaitPakin waitPakin1 = waitPakins.get(0); |
| | | FindLocNoAttributeVo findLocNoAttributeVo = new FindLocNoAttributeVo(); |
| | | findLocNoAttributeVo.setMatnr(waitPakin1.getMatnr()); |
| | | |
| | | findLocNoAttributeVo.setAreaId(waitPakin1.getAreaId()); |
| | | findLocNoAttributeVo.setOrderNo(waitPakin1.getOrderNo()); |
| | | // StartupDto dto = commonService.getLocNo(1, devpNo, matnrs.get(0), batchs.get(0), null, locTypeDto); |
| | | StartupDto dto = commonService.getLocNoNew(1, devpNo, findLocNoAttributeVo, locTypeDto,barcode); |
| | | if (dto == null) { |
| | | throw new CoolException("没有检索到空库位"); |
| | | throw new CoolException("response.no_empty_location_found"); |
| | | } |
| | | int workNo = dto.getWorkNo(); |
| | | Date now = new Date(); |
| | |
| | | wrkMast.setAppeUser(waitPakin1.getAppeUser()); |
| | | boolean res = wrkMastService.insert(wrkMast); |
| | | if (!res) { |
| | | throw new CoolException("保存工作档失败"); |
| | | throw new CoolException("response.save_work_master_failed"); |
| | | } |
| | | // 生成工作档明细 |
| | | waitPakins.forEach(waitPakin -> { |
| | |
| | | wrkDetl.setAppeTime(now); |
| | | wrkDetl.setModiTime(now); |
| | | if (!wrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作明细失败"); |
| | | throw new CoolException("response.save_work_detail_failed"); |
| | | } |
| | | }); |
| | | // 更新入库通知档 ioStatus ===>> Y |
| | |
| | | setParam.setIoStatus("Y"); |
| | | setParam.setModiTime(now); |
| | | if (!waitPakinService.update(setParam, wrapper)) { |
| | | throw new CoolException("更新通知档失败"); |
| | | throw new CoolException("response.update_wait_pakin_failed"); |
| | | } |
| | | // 更新源站点信息 |
| | | sourceStaNo.setWrkNo(workNo); |
| | | sourceStaNo.setModiTime(now); |
| | | if (!basDevpService.updateById(sourceStaNo)) { |
| | | throw new CoolException("更新源站失败"); |
| | | throw new CoolException("response.update_source_station_failed"); |
| | | } |
| | | // 更新目标库位状态 |
| | | LocMast locMast = locMastService.selectById(dto.getLocNo()); |
| | |
| | | locMast.setLocSts("S"); // S.入库预约 |
| | | locMast.setModiTime(now); |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException("改变库位状态失败"); |
| | | throw new CoolException("response.change_location_status_failed"); |
| | | } |
| | | } else { |
| | | throw new CoolException(dto.getLocNo() + "目标库位已被占用"); |
| | | throw new CoolException("response.target_location_occupied"); |
| | | } |
| | | return dto; |
| | | } |
| | |
| | | // StartupDto dto = commonService.getLocNo(1, devpNo, matnrs.get(0), batchs.get(0), null, locTypeDto); |
| | | StartupDto dto = commonService.getLocNoNew(1, devpNo, findLocNoAttributeVo, locTypeDto,barcode); |
| | | if (dto == null) { |
| | | throw new CoolException("没有检索到空库位"); |
| | | throw new CoolException("response.no_empty_location_found"); |
| | | } |
| | | Date now = new Date(); |
| | | // 生成工作档 |
| | | try{ |
| | | // 保存工作明细档历史档 |
| | | if (wrkMastMapper.saveWrkDetlLog(wrkMast.getWrkNo()) == 0) { |
| | | throw new CoolException("保存工作明细档历史档失败"); |
| | | throw new CoolException("response.save_work_detail_history_failed"); |
| | | } |
| | | // 保存工作主档历史档 |
| | | if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) { |
| | | throw new CoolException("保存工作主档历史档失败"); |
| | | throw new CoolException("response.save_work_master_history_failed"); |
| | | } |
| | | // 更新工作档数据状态 |
| | | wrkMast.setIoTime(now); |
| | |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiTime(now); |
| | | if (wrkMastMapper.updateById(wrkMast) == 0) { |
| | | throw new CoolException("更新工作档数据状态失败"); |
| | | throw new CoolException("response.update_work_master_status_failed"); |
| | | } |
| | | // 更新明细档io_time (历史档关联使用) |
| | | wrkDetlService.updateIoTime(wrkMast.getWrkNo(), now); |
| | |
| | | sourceStaNo.setWrkNo(wrkMast.getWrkNo()); |
| | | sourceStaNo.setModiTime(now); |
| | | if (!basDevpService.updateById(sourceStaNo)) { |
| | | throw new CoolException("更新源站失败"); |
| | | throw new CoolException("response.update_source_station_failed"); |
| | | } |
| | | // 更新目标库位状态 |
| | | LocMast locMast = locMastService.selectById(dto.getLocNo()); |
| | |
| | | locMast.setLocSts("Q"); // S.入库预约 |
| | | locMast.setModiTime(now); |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException("改变库位状态失败"); |
| | | throw new CoolException("response.change_location_status_failed"); |
| | | } |
| | | } else { |
| | | throw new CoolException(dto.getLocNo() + "目标库位已被占用"); |
| | | throw new CoolException("response.target_location_occupied"); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | WrkDetl wrkDetl = wrkDetlList.get(0); |
| | | findLocNoAttributeVo.setMatnr(wrkDetl.getMatnr()); |
| | | findLocNoAttributeVo.setBatch(wrkDetl.getBatch()); |
| | | findLocNoAttributeVo.setOrderNo(wrkDetl.getOrderNo()); |
| | | // StartupDto dto = commonService.getLocNo(1, devpNo, matnrs.get(0), batchs.get(0), null, locTypeDto); |
| | | StartupDto dto = commonService.getLocNoNew(1, devpNo, findLocNoAttributeVo, locTypeDto,barcode); |
| | | if (dto == null) { |
| | | throw new CoolException("没有检索到空库位"); |
| | | throw new CoolException("response.no_empty_location_found"); |
| | | } |
| | | Date now = new Date(); |
| | | // 生成工作档 |
| | | try{ |
| | | // 保存工作明细档历史档 |
| | | if (wrkMastMapper.saveWrkDetlLog(wrkMast.getWrkNo()) == 0) { |
| | | throw new CoolException("保存工作明细档历史档失败"); |
| | | throw new CoolException("response.save_work_detail_history_failed"); |
| | | } |
| | | // 保存工作主档历史档 |
| | | if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) { |
| | | throw new CoolException("保存工作主档历史档失败"); |
| | | throw new CoolException("response.save_work_master_history_failed"); |
| | | } |
| | | // 更新工作档数据状态 |
| | | wrkMast.setIoTime(now); |
| | |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiTime(now); |
| | | if (wrkMastMapper.updateById(wrkMast) == 0) { |
| | | throw new CoolException("更新工作档数据状态失败"); |
| | | throw new CoolException("response.update_work_master_status_failed"); |
| | | } |
| | | // 更新明细档io_time (历史档关联使用) |
| | | wrkDetlService.updateIoTime(wrkMast.getWrkNo(), now); |
| | |
| | | sourceStaNo.setWrkNo(wrkMast.getWrkNo()); |
| | | sourceStaNo.setModiTime(now); |
| | | if (!basDevpService.updateById(sourceStaNo)) { |
| | | throw new CoolException("更新源站失败"); |
| | | throw new CoolException("response.update_source_station_failed"); |
| | | } |
| | | // 更新目标库位状态 |
| | | LocMast locMast = locMastService.selectById(dto.getLocNo()); |
| | |
| | | locMast.setLocSts("Q"); // S.入库预约 |
| | | locMast.setModiTime(now); |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException("改变库位状态失败"); |
| | | throw new CoolException("response.change_location_status_failed"); |
| | | } |
| | | } else { |
| | | throw new CoolException(dto.getLocNo() + "目标库位已被占用"); |
| | | throw new CoolException("response.target_location_occupied"); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | wrkMast.setModiTime(new Date()); |
| | | boolean res = wrkMastService.insert(wrkMast); |
| | | if (!res) { |
| | | throw new CoolException("保存工作档失败"); |
| | | throw new CoolException("response.save_work_detail_failed"); |
| | | } |
| | | // 更新源站点信息 |
| | | sourceStaNo.setWrkNo(workNo); |
| | | sourceStaNo.setModiTime(new Date()); |
| | | if (!basDevpService.updateById(sourceStaNo)) { |
| | | throw new CoolException("更新源站失败"); |
| | | throw new CoolException("response.update_source_station_failed"); |
| | | } |
| | | // 更新目标库位状态 |
| | | LocMast locMast = locMastService.selectById(dto.getLocNo()); |
| | |
| | | locMast.setLocSts("S"); // S.入库预约 |
| | | locMast.setModiTime(new Date()); |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException("改变库位状态失败"); |
| | | throw new CoolException("response.change_location_status_failed"); |
| | | } |
| | | } else { |
| | | throw new CoolException(dto.getLocNo() + "目标库位已被占用"); |
| | | throw new CoolException("response.target_location_occupied"); |
| | | } |
| | | return dto; |
| | | } |
| | |
| | | public Re status(@RequestBody StatusParam statusParam) { |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", statusParam.getTaskId())); |
| | | if (Cools.isEmpty(wrkMast) && statusParam.getTaskStatus() != 8) { |
| | | return Re.error("没有找到:" + statusParam.getTaskId() + "这条任务"); |
| | | return Re.error("response.task_not_found"); |
| | | } else if (Cools.isEmpty(wrkMast) && statusParam.getTaskStatus() == 8) { |
| | | return Re.ok(); |
| | | } else if (!Cools.isEmpty(wrkMast) && statusParam.getTaskStatus() == 8 && wrkMast.getIoType() == 110) { |
| | |
| | | String sourcecLocNo = wrkMast.getSourceLocNo(); |
| | | //更新工作明细并清空源库位 |
| | | for (WrkDetl wrkDetl : wrkDetls){ |
| | | LocDetl locDetl = locDetlService.selectItem(wrkMast.getSourceLocNo(), wrkDetl.getMatnr(), wrkDetl.getBatch()); |
| | | LocDetl locDetl = locDetlService.selectItemCarton(wrkMast.getSourceLocNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(),wrkDetl.getBarcode()); |
| | | if (null != locDetl && wrkMast.getIoType() == 103) {//拣料 |
| | | if (!wrkDetlService.updateAnfme(locDetl.getAnfme() - wrkDetl.getAnfme(),wrkMast.getWrkNo(), wrkDetl.getMatnr(), wrkDetl.getBatch())) { |
| | | if (!wrkDetlService.updateAnfme(locDetl.getAnfme() - wrkDetl.getAnfme(),wrkMast.getWrkNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(),wrkDetl.getBarcode())) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | throw new CoolException("拣料入库 ===>> 修改库存明细数量失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); |
| | | throw new CoolException("response.picking_inbound_update_detail_failed"); |
| | | } |
| | | }else if(wrkMast.getIoType() == 107){//盘点 |
| | | if (!wrkDetlService.updateAnfme(wrkDetl.getAnfme(), wrkMast.getWrkNo(), wrkDetl.getMatnr(), wrkDetl.getBatch())) { |
| | | if (!wrkDetlService.updateAnfme(wrkDetl.getAnfme(), wrkMast.getWrkNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(),wrkDetl.getBarcode())) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | throw new CoolException("拣料入库 ===>> 修改库存明细数量失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); |
| | | throw new CoolException("response.picking_inbound_update_detail_failed"); |
| | | } |
| | | } |
| | | } |
| | |
| | | locMast1.setModiTime(new Date()); |
| | | if (!locMastService.updateById(locMast1)) { |
| | | |
| | | throw new CoolException("修改库位状态失败"); |
| | | throw new CoolException("response.modify_location_status_failed"); |
| | | } |
| | | wrkMast.setWrkSts(14L);//14.已出库未确认 |
| | | } else if ((wrkMast.getIoType() == 101 || wrkMast.getIoType() == 110) && statusParam.getTaskStatus() != 8) { |
| | |
| | | success = true; |
| | | } else { |
| | | log.error("wms同步wcs库位失败!!!url:{};request:{};response:{}", url + "/" + loc, JSON.toJSONString(mapList), response); |
| | | throw new CoolException("wms同步wcs库位失败"); |
| | | throw new CoolException("response.wms_sync_wcs_location_failed"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | throw new CoolException("wms同步wcs库位失败"); |
| | | throw new CoolException("response.wms_sync_wcs_location_failed"); |
| | | } finally { |
| | | try { |
| | | // 保存接口日志 |