| | |
| | | import com.zy.asrs.common.domain.entity.StaDesc; |
| | | import com.zy.asrs.common.domain.enums.IoWorkType; |
| | | import com.zy.asrs.common.domain.enums.WorkNoType; |
| | | import com.zy.asrs.common.domain.param.EmptyPlateOutParam; |
| | | import com.zy.asrs.common.domain.param.FullStoreParam; |
| | | import com.zy.asrs.common.domain.param.LocDetlAdjustParam; |
| | | import com.zy.asrs.common.domain.param.StockOutParam; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void emptyPlateOut(EmptyPlateOutParam param, Long userId, Long hostId) { |
| | | if (Cools.isEmpty(param.getOutSite())) { |
| | | throw new CoolException("站点不存在"); |
| | | } |
| | | for (String locNo : param.getLocNos()) { |
| | | // 获取工作号 |
| | | int workNo = commonService.getWorkNo(WorkNoType.PAKOUT.type); |
| | | // 获取库位 |
| | | LocMast locMast = locMastService.getOne(new LambdaQueryWrapper<LocMast>() |
| | | .eq(LocMast::getLocNo, locNo) |
| | | .eq(LocMast::getHostId, hostId)); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException(locNo+"库位不存在"); |
| | | } |
| | | if (!locMast.getLocSts().equals("D")){ |
| | | throw new CoolException("所选库位存在状态不为D的库位,库位号:"+locMast.getLocNo()+" 、当前状态:"+locMast.getLocSts()+"-"+locMast.getLocSts$()); |
| | | } |
| | | // 获取源站 |
| | | StaDesc staDesc = staDescService.getOne(new LambdaQueryWrapper<StaDesc>() |
| | | .eq(StaDesc::getTypeNo, 110) |
| | | .eq(StaDesc::getStnNo, param.getOutSite()) |
| | | .eq(StaDesc::getDeviceNo, locMast.getCrnNo())); |
| | | Integer sourceStaNo = staDesc.getDeviceStn(); |
| | | if (Cools.isEmpty(sourceStaNo)) { |
| | | throw new CoolException("检索源站失败"); |
| | | } |
| | | Date now = new Date(); |
| | | // 保存工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo); |
| | | wrkMast.setIoTime(now); |
| | | wrkMast.setWrkSts(101L); // 工作状态:101.生成出库ID |
| | | wrkMast.setIoType(110); // 入出库状态: 110.空板出库 |
| | | wrkMast.setIoPri(10D); |
| | | wrkMast.setSourceStaNo(sourceStaNo); // 源站 |
| | | wrkMast.setStaNo(param.getOutSite()); // 目标站 |
| | | wrkMast.setCrnNo(locMast.getCrnNo()); |
| | | wrkMast.setSourceLocNo(locNo); // 源库位 |
| | | wrkMast.setFullPlt("N"); // 满板:Y |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk("Y"); // 空板 |
| | | wrkMast.setAppeUser(String.valueOf(userId)); |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiUser(String.valueOf(userId)); |
| | | wrkMast.setModiTime(now); |
| | | wrkMast.setHostId(hostId); |
| | | boolean res = wrkMastService.save(wrkMast); |
| | | if (!res) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | // 更新库位状态 D.空板 -> R.出库预约 |
| | | if (locMast.getLocSts().equals("D")){ |
| | | locMast.setLocSts("R"); |
| | | locMast.setModiUser(userId); |
| | | locMast.setModiTime(now); |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException("更新库位状态失败"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void stockOut(Integer staNo, List<LocDetlDto> locDetlDtos, IoWorkType ioWorkType, Long userId, Long hostId) { |
| | | Date now = new Date(); |