| | |
| | | import com.zy.asrs.entity.param.StockOutParam; |
| | | import com.zy.asrs.mapper.LocMastMapper; |
| | | import com.zy.asrs.entity.result.FindLocNoAttributeVo; |
| | | import com.zy.asrs.mapper.OrderDetlPakoutMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.OrderInAndOutUtil; |
| | | import com.zy.asrs.utils.Utils; |
| | |
| | | |
| | | @Resource |
| | | private OrderPakoutService orderPakOutService; |
| | | |
| | | @Resource |
| | | private OrderDetlPakoutMapper orderDetlPakoutMapper; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | throw new CoolException(firstFrozenLocNo + "库位已被冻结!"); |
| | | } |
| | | |
| | | if (Cools.isEmpty(param.getOutSite())) { |
| | | throw new CoolException("站点不存在"); |
| | | } |
| | | for (String locNo : param.getLocNos()) { |
| | | // 获取工作号 |
| | | int workNo = commonService.getWorkNo(WorkNoType.PAKOUT.type); |
| | | int workNo = commonService.getWorkNo(2); |
| | | // 获取库位 |
| | | LocMast locMast = locMastService.selectById(locNo); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException(locNo+"库位不存在"); |
| | | } |
| | | if (!locMast.getLocSts().equals("D")){ |
| | | throw new CoolException("所选库位存在状态不为D的库位,库位号:"+locMast.getLocNo()+" 、当前状态:"+locMast.getLocSts()+"-"+locMast.getLocSts$()); |
| | | if (!locMast.getLocSts().equals("M") && !locMast.getLocSts().equals("Z")) { |
| | | throw new CoolException("库位状态有误:" + locMast.getLocSts()); |
| | | } |
| | | // 获取源站 |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | |
| | | wrkMast.setWrkNo(workNo); |
| | | wrkMast.setIoTime(now); |
| | | wrkMast.setWrkSts(11L); // 工作状态:11.生成出库ID |
| | | wrkMast.setIoType(110); // 入出库状态: 110.空板出库 |
| | | wrkMast.setIoPri(10D); |
| | | wrkMast.setIoType(110); // 入出库状态 |
| | | wrkMast.setIoPri(14D); |
| | | wrkMast.setSourceStaNo(sourceStaNo); // 源站 |
| | | wrkMast.setStaNo(param.getOutSite()); // 目标站 |
| | | wrkMast.setCrnNo(locMast.getCrnNo()); |
| | |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | // 更新库位状态 D.空板 -> R.出库预约 |
| | | if (locMast.getLocSts().equals("D")){ |
| | | if (locMast.getLocSts().equals("M") || locMast.getLocSts().equals("Z")){ |
| | | locMast.setLocSts("R"); |
| | | locMast.setModiUser(userId); |
| | | locMast.setModiTime(now); |
| | |
| | | throw new CoolException(locDetl.getLocNo() + "," + locDetl.getMatnr() + "," + locDetl.getBatch() + "库存明细已被冻结!"); |
| | | } |
| | | |
| | | if (!loc.getLocSts().equals("O") || (!sourceLoc.getLocSts().equals("F") && !sourceLoc.getLocSts().equals("D"))){ |
| | | if (!loc.getLocSts().equals("O") || (!sourceLoc.getLocSts().equals("F") && !sourceLoc.getLocSts().equals("M") && !sourceLoc.getLocSts().equals("Z"))){ |
| | | throw new CoolException("库位状态已改变"); |
| | | } |
| | | if (!sourceLoc.getCrnNo().equals(loc.getCrnNo())) { |
| | |
| | | wrkMast.setFullPlt(Cools.isEmpty(locDetls)?"N":"Y"); // 满板:Y |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk(sourceLoc.getLocSts().equals("D")?"Y":"N"); // 空板 |
| | | wrkMast.setEmptyMk(sourceLoc.getLocSts().equals("M") ? "M" : sourceLoc.getLocSts().equals("Z") ? "Z" : "N"); // 空板 |
| | | wrkMast.setBarcode(sourceLoc.getBarcode()); // 托盘码 |
| | | wrkMast.setLinkMis("N"); |
| | | wrkMast.setAppeUser(userId); |
| | |
| | | } |
| | | } |
| | | // 修改源库位状态 |
| | | if (sourceLoc.getLocSts().equals("D") || sourceLoc.getLocSts().equals("F")) { |
| | | if (sourceLoc.getLocSts().equals("F") || sourceLoc.getLocSts().equals("M") || sourceLoc.getLocSts().equals("Z")) { |
| | | sourceLoc.setLocSts("R"); // R.出库预约 |
| | | sourceLoc.setModiUser(userId); |
| | | sourceLoc.setModiTime(now); |
| | |
| | | int workNoOther = 0; |
| | | // 入库 + 库位转移 |
| | | if ((wrkMast.getWrkSts() < 4 && wrkMast.getIoType() != 101 && wrkMast.getIoType() != 110) || (wrkMast.getWrkSts() > 10 |
| | | && wrkMast.getIoType()==11) || wrkMast.getIoType() == 10) { |
| | | && wrkMast.getIoType()==11) || wrkMast.getIoType() == 10 || (wrkMast.getIoType() == 3)) { |
| | | wrkMast.setWrkSts(4L); |
| | | workNoOther = wrkMast.getWorkNoOther(); |
| | | // 出库 |
| | |
| | | wrkMast.setWrkSts(14L); |
| | | } |
| | | workNoOther = wrkMast.getWorkNoOther(); |
| | | } else if(wrkMast.getIoType() == 1 && wrkMast.getWrkSts() == 10) { |
| | | wrkMast.setWrkSts(2L); |
| | | wrkMast.setRgvFinishTime(new Date()); |
| | | } |
| | | Date now = new Date(); |
| | | wrkMast.setCrnStrTime(DateUtils.calculate(now, 1L, TimeUnit.SECONDS, true)); |
| | |
| | | } |
| | | if(workNoOther != 0) { |
| | | WrkMast wrkMast1 = wrkMastService.selectById(workNoOther); |
| | | wrkMast1.setWrkSts(wrkMast.getWrkSts()); |
| | | wrkMast1.setCrnStrTime(wrkMast.getCrnStrTime()); |
| | | wrkMast1.setCrnEndTime(now); |
| | | wrkMast1.setModiTime(now); |
| | | wrkMast1.setModiUser(userId); |
| | | wrkMast1.setManuType("手动完成"); |
| | | wrkMastService.updateById(wrkMast1); |
| | | if (wrkMast1 != null) { |
| | | wrkMast1.setWrkSts(wrkMast.getWrkSts()); |
| | | wrkMast1.setCrnStrTime(wrkMast.getCrnStrTime()); |
| | | wrkMast1.setCrnEndTime(now); |
| | | wrkMast1.setModiTime(now); |
| | | wrkMast1.setModiUser(userId); |
| | | wrkMast1.setManuType("手动完成"); |
| | | wrkMastService.updateById(wrkMast1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void adjustLocDetl(LocDetlAdjustParam param, Long userId) { |
| | | param.integrate(); |
| | | // param.integrate(); |
| | | LocMast locMast = locMastService.selectById(param.getLocNo()); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException("库位不存在"); |
| | |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException("取消库位转移失败,源库位不存在:"+ wrkMast.getSourceLocNo()); |
| | | } |
| | | locMast.setLocSts(wrkMast.getFullPlt().equalsIgnoreCase("N")?"D":"F"); |
| | | locMast.setLocSts(wrkMast.getFullPlt().equalsIgnoreCase("N")?wrkMast.getEmptyMk():"F"); |
| | | locMast.setModiTime(now); |
| | | locMast.setModiUser(userId); |
| | | locMastService.updateById(locMast); |
| | |
| | | // if (!orderDetlService.decrease(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getAnfme())) { |
| | | // throw new CoolException("订单数据回滚失败"); |
| | | // } |
| | | OrderInAndOutUtil.decrease(Boolean.FALSE,wrkDetl.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(),wrkDetl.getBrand(), |
| | | wrkDetl.getStandby1(),wrkDetl.getStandby2(),wrkDetl.getStandby3(), |
| | | wrkDetl.getBoxType1(),wrkDetl.getBoxType2(),wrkDetl.getBoxType3(), wrkDetl.getAnfme()); |
| | | // OrderInAndOutUtil.decrease(Boolean.FALSE,wrkDetl.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(),wrkDetl.getBrand(), |
| | | // wrkDetl.getStandby1(),wrkDetl.getStandby2(),wrkDetl.getStandby3(), |
| | | // wrkDetl.getBoxType1(),wrkDetl.getBoxType2(),wrkDetl.getBoxType3(), wrkDetl.getAnfme()); |
| | | orderDetlPakoutMapper.increaseQtyByOrderNoNew(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), |
| | | wrkDetl.getBatch(),wrkDetl.getModel(),wrkDetl.getVolume(),wrkDetl.getAnfme()); |
| | | |
| | | //修改订单主表状态,没有作业数量时才可以修改 |
| | | boolean flag = true; |
| | |
| | | |
| | | |
| | | // 修改库位状态 |
| | | if(locNo != null) { |
| | | LocMast locMast = locMastService.selectById(locNo); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException("取消工作档失败,库位不存在:"+ locNo); |
| | | } |
| | | locMast.setLocSts(locSts); |
| | | locMast.setModiTime(now); |
| | | locMast.setModiUser(userId); |
| | | boolean locMastRes = locMastService.updateById(locMast); |
| | | if (!wrkMastRes || !locMastRes) { |
| | | throw new CoolException("保存数据失败"); |
| | | if (locNo != null) { |
| | | if (wrkMast.getIoType() != 3) { |
| | | LocMast locMast = locMastService.selectById(locNo); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException("取消工作档失败,库位不存在:" + locNo); |
| | | } |
| | | locMast.setLocSts(locSts); |
| | | locMast.setModiTime(now); |
| | | locMast.setModiUser(userId); |
| | | boolean locMastRes = locMastService.updateById(locMast); |
| | | if (!wrkMastRes || !locMastRes) { |
| | | throw new CoolException("保存数据失败"); |
| | | } |
| | | } |
| | | } |
| | | } |