| | |
| | | import com.zy.asrs.service.impl.*; |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.common.service.CommonService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private BasStationDetlService basStationDetlService; |
| | | @Autowired |
| | | private BasAreasService basAreasService; |
| | | @Autowired |
| | | private CommonService commonService; |
| | | |
| | | public ReturnT<String> start(WrkMast wrkMast) { |
| | | // 4.入库完成 |
| | |
| | | } |
| | | } |
| | | } catch (Exception ignore) { |
| | | |
| | | |
| | | } |
| | | } |
| | | // 修改库位状态 S ====>> F |
| | |
| | | locDetl.setAnfme(checkOrderDetl.getDiffQty() |
| | | .compareTo(BigDecimal.ZERO) == 0 |
| | | || checkOrderDetl.getDiffQty() |
| | | .compareTo(BigDecimal.ZERO) > 0 |
| | | ? oriAnfme.doubleValue() |
| | | : oriAnfme.add(checkOrderDetl.getDiffQty()).doubleValue()); |
| | | .compareTo(BigDecimal.ZERO) > 0 |
| | | ? oriAnfme.doubleValue() |
| | | : oriAnfme.add(checkOrderDetl.getDiffQty()).doubleValue()); |
| | | locDetl.setBookQty(oriAnfme); |
| | | locDetl.setDiffQty(checkOrderDetl.getDiffQty()); |
| | | if (!locDetlService.updateById(locDetl)) { |
| | |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ReturnT<String> agvDoOut(Task task) { |
| | | LocCache locMast = locCacheService |
| | | .selectOne(new EntityWrapper<LocCache>().eq("loc_no", task.getSourceLocNo())); |
| | | Date now = new Date(); |
| | | |
| | | if (task.getIoType().equals(101)) { |
| | | Date now = new Date(); |
| | | LocCache locMast = locCacheService |
| | | .selectOne(new EntityWrapper<LocCache>().eq("loc_no", task.getSourceLocNo())); |
| | | if (Objects.isNull(locMast)) { |
| | | throw new RuntimeException("数据错误:库位信息不能为空!!"); |
| | | } |
| | |
| | | return FAIL.setMsg( |
| | | "全板出库 ===>> 工作明细档为空; [workNo=" + task.getWrkNo() + "],[locNo=" + task.getSourceLocNo() + "]"); |
| | | } |
| | | |
| | | BasStation devNo = basStationService |
| | | .selectOne(new EntityWrapper<BasStation>().eq("dev_no", task.getStaNo())); |
| | | if (Objects.isNull(devNo)) { |
| | |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | } else if (task.getIoType().equals(110)) { |
| | | Date now = new Date(); |
| | | LocCache locMast = locCacheService |
| | | .selectOne(new EntityWrapper<LocCache>().eq("loc_no", task.getSourceLocNo())); |
| | | if (Objects.isNull(locMast)) { |
| | | throw new RuntimeException("数据错误:库位信息不能为空!!"); |
| | | } |
| | |
| | | if (!taskService.updateById(task)) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | } else { |
| | | } else if (task.getIoType().equals(103)) { |
| | | List<TaskDetl> wrkDetls103 = taskDetlService |
| | | .selectList(new EntityWrapper<TaskDetl>().eq("wrk_no", task.getWrkNo())); |
| | | if (wrkDetls103.isEmpty()) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg("拣料出库 ===>> 工作明细档为空; [workNo=" + task.getWrkNo() + "],[locNo=" |
| | | + task.getSourceLocNo() + "]"); |
| | | } |
| | | for (TaskDetl wrkDetl : wrkDetls103) { |
| | | // 更新订单完成数量 |
| | | OrderDetlPakout orderDetlPakout = orderDetlPakoutService. |
| | | selectOne(new EntityWrapper<OrderDetlPakout>() |
| | | .eq("matnr", wrkDetl.getMatnr()) |
| | | .eq("supp_code", wrkDetl.getSuppCode()) |
| | | .eq("order_no", wrkDetl.getOrderNo())); |
| | | try { |
| | | if (!Cools.isEmpty(orderDetlPakout)) { |
| | | if (!orderDetlPakoutService.increaseQtyByOrderNo(wrkDetl.getOrderNo(), |
| | | wrkDetl.getMatnr(), |
| | | orderDetlPakout.getBatch(), wrkDetl.getBrand(), wrkDetl.getStandby1(), |
| | | wrkDetl.getStandby2(), wrkDetl.getStandby3(), |
| | | wrkDetl.getBoxType1(), wrkDetl.getBoxType2(), wrkDetl.getBoxType3(), |
| | | wrkDetl.getAnfme())) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg("拣料出库 ===>> 更新订单完成数量失败; [workNo=" + task.getWrkNo() |
| | | + "],[locNo=" + task.getSourceLocNo() + "]"); |
| | | } |
| | | } |
| | | //TODO 修改站点状态预约目标库位,以及站点库位信息 |
| | | LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>() |
| | | .eq("matnr", wrkDetl.getMatnr()) |
| | | .eq("supp_code", wrkDetl.getSuppCode()) |
| | | .eq("loc_no", task.getSourceLocNo())); |
| | | if (Objects.isNull(locDetl) ) { |
| | | throw new CoolException("库存数据错误,请联系管理员!!"); |
| | | } |
| | | Double sulp = Math.round((locDetl.getAnfme() - wrkDetl.getAnfme()) * 10000) / 10000.0; |
| | | locDetl.setAnfme(sulp); |
| | | if (!locDetlService.update(locDetl, new EntityWrapper<LocDetl>().eq("loc_no", locDetl.getLocNo()) |
| | | .eq("matnr", locDetl.getMatnr()) |
| | | .eq("supp_code", locDetl.getSuppCode()))) { |
| | | return FAIL.setMsg("拣料出库 ===>> 更新订单完成数量失败; [workNo=" + task.getWrkNo() |
| | | + "],[locNo=" + task.getSourceLocNo() + "]"); |
| | | } |
| | | } catch (Exception ignore) { |
| | | log.error(ignore.getMessage()); |
| | | } |
| | | } |
| | | // int workNo = commonService.getWorkNo(0); |
| | | task.setIoType(task.getIoType() - 50); |
| | | task.setLocNo(task.getSourceLocNo()); |
| | | task.setWrkSts(TaskStatusType.AGV_IN_START.type); |
| | | |
| | | if (!taskService.update(task, new EntityWrapper<Task>().eq("wrk_no", task.getWrkNo()))) { |
| | | throw new CoolException("任务拣货完成状态更新失败!!"); |
| | | } |
| | | |
| | | // 修改源库位状态 R ===>> O |
| | | if (locMast.getLocSts().equals(LocStsType.LOC_STS_TYPE_R.type)) { |
| | | locMast.setLocSts(LocStsType.LOC_STS_TYPE_S.type); |
| | | locMast.setBarcode(""); |
| | | locMast.setModiTime(now); |
| | | locMast.setIoTime(now); |
| | | if (!locCacheService.updateById(locMast)) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg("拣料出库 ===>> 修改源库位状态失败; [workNo=" + task.getWrkNo() + "],[locNo=" |
| | | + task.getSourceLocNo() + "]"); |
| | | } |
| | | } else { |
| | | throw new CoolException("当前库位状态" + locMast.getLocSts() + ", 无法执行出库操作!!"); |
| | | } |
| | | } |
| | | return SUCCESS; |
| | | } |
| | |
| | | station.setLocSts(LocStsType.LOC_STS_TYPE_O.type); |
| | | } |
| | | station.setBarcode(""); |
| | | if (!basStationService.updateById(station)) { |
| | | basStationDetlService.delete(new EntityWrapper<BasStationDetl>().eq("dev_no", station.getDevNo())); |
| | | } |
| | | if (!basStationService.updateById(station)) { |
| | | basStationDetlService.delete(new EntityWrapper<BasStationDetl>().eq("dev_no", station.getDevNo())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(wrkMast.getIoType().equals(1)){ |
| | | if (wrkMast.getIoType().equals(1)) { |
| | | if (Objects.isNull(locCache)) { |
| | | throw new CoolException("数据错误,库位不存在!!"); |
| | | } |
| | |
| | | |
| | | List<WaitPakin> apallets = waitPakinService |
| | | .selectList(new EntityWrapper<WaitPakin>().eq("zpallet", wrkMast.getBarcode())); |
| | | for (WaitPakin pakin : apallets){ |
| | | for (WaitPakin pakin : apallets) { |
| | | WaitPakinLog waitPakinLog = new WaitPakinLog(); |
| | | BeanUtils.copyProperties(pakin, waitPakinLog); |
| | | waitPakinLogService.insert(waitPakinLog); |
| | |
| | | // if (Objects.isNull(pakins) || pakins.isEmpty()) { |
| | | //// throw new CoolException("单据不存在!!"); |
| | | // } |
| | | }else if(wrkMast.getIoType().equals(53)){ |
| | | } else if (wrkMast.getIoType().equals(53)) { |
| | | // 根据工作号,查询工作明细档 |
| | | List<TaskDetl> wrkDetls53 = taskDetlService |
| | | .selectList(new EntityWrapper<TaskDetl>().eq("wrk_no", wrkMast.getWrkNo())); |