| | |
| | | import com.zy.asrs.entity.param.LocDetlAdjustParam; |
| | | import com.zy.asrs.entity.param.StockOutParam; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.VersionUtils; |
| | | import com.zy.common.model.LocDetlDto; |
| | | import com.zy.common.model.OutLocDto; |
| | | import com.zy.common.model.StartupDto; |
| | |
| | | |
| | | // 工作号生成规则默认类型 |
| | | private static final int DEFAULT_WORK_NO_TYPE = 0; |
| | | // 库位排号分配默认类别 |
| | | private static final int DEFAULT_ROW_NO_TYPE = 1; |
| | | |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | |
| | | private MatCodeService matCodeService; |
| | | @Autowired |
| | | private AdjDetlService adjDetlService; |
| | | @Autowired |
| | | private WrkMastLogService wrkMastLogService; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | // 生成工作号 |
| | | int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE); |
| | | // 检索库位 |
| | | StartupDto dto = commonService.getLocNo(1, 1, param.getDevpNo()); |
| | | StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo()); |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo); |
| | |
| | | wrkMast.setSourceStaNo(dto.getSourceStaNo()); |
| | | wrkMast.setStaNo(dto.getStaNo()); |
| | | wrkMast.setLocNo(dto.getLocNo()); |
| | | wrkMast.setBarcode(param.getBarcode()); // 托盘码 |
| | | wrkMast.setFullPlt("Y"); // 满板:Y |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | |
| | | } |
| | | if (!locDetlDtos.isEmpty()) { |
| | | // 启动出库开始 101.出库 |
| | | stockOut(staNo, locDetlDtos, 101, userId); |
| | | stockOut(staNo, locDetlDtos, null, userId); |
| | | } else { |
| | | throw new CoolException("库位物料不存在"); |
| | | } |
| | |
| | | } |
| | | // 生成工作档 |
| | | for (OutLocDto dto : dtos) { |
| | | // 判断入出库类型:101.全板出库 or 103.拣料出库 |
| | | if (ioType == null) { |
| | | ioType = dto.isAll() ? 101 : 103; |
| | | } |
| | | // 获取库位 |
| | | LocMast locMast = locMastService.selectById(dto.getLocNo()); |
| | | // 获取路径 |
| | |
| | | wrkMast.setWrkNo(workNo); |
| | | wrkMast.setIoTime(new Date()); |
| | | wrkMast.setWrkSts(11L); // 工作状态:11.生成出库ID |
| | | wrkMast.setIoType(ioType); // 入出库状态:101.出库 |
| | | wrkMast.setIoType(ioType); // 入出库状态 |
| | | wrkMast.setIoPri(13D); // 优先级:13 |
| | | wrkMast.setCrnNo(locMast.getCrnNo()); |
| | | wrkMast.setSourceStaNo(staDesc.getCrnStn()); // 源站 |
| | |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.setWrkNo(workNo); |
| | | wrkDetl.setIoTime(new Date()); |
| | | wrkDetl.setMatnr(detlDto.getLocDetl().getMatnr()); |
| | | Double anfme = ioType==101?detlDto.getCount():detlDto.getLocDetl().getAnfme(); |
| | | wrkDetl.setAnfme(anfme); // 数量 |
| | | wrkDetl.setZmatid(detlDto.getLocDetl().getZmatid()); |
| | | wrkDetl.setTbpos(detlDto.getLocDetl().getTbpos()); |
| | | wrkDetl.setTbnum(detlDto.getLocDetl().getTbnum()); |
| | | wrkDetl.setLgnum(detlDto.getLocDetl().getLgnum()); |
| | | wrkDetl.setAltme(detlDto.getLocDetl().getAltme()); |
| | | wrkDetl.setBname(detlDto.getLocDetl().getBname()); |
| | | wrkDetl.setMaktx(detlDto.getLocDetl().getMaktx()); |
| | | VersionUtils.setWrkDetl(wrkDetl, detlDto.getLocDetl()); // 版本控制 |
| | | wrkDetl.setAppeTime(new Date()); |
| | | wrkDetl.setAppeUser(userId); |
| | | wrkDetl.setModiTime(new Date()); |
| | |
| | | throw new CoolException("保存工作档明细失败"); |
| | | } |
| | | } |
| | | // 修改库位状态: F.在库 ====>>> R.出库预约 |
| | | // 修改库位状态: F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中 |
| | | locMast = locMastService.selectById(dto.getLocNo()); |
| | | if (locMast.getLocType().equals("F")) { |
| | | locMast.setLocType("R"); |
| | | locMast.setLocType(ioType==101?"R":"P"); |
| | | locMast.setModiUser(userId); |
| | | locMast.setModiTime(new Date()); |
| | | if (!locMastService.updateById(locMast)) { |
| | |
| | | // 生成工作号 |
| | | int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE); |
| | | // 检索库位 |
| | | StartupDto dto = commonService.getLocNo(1, 10, devpNo); |
| | | StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 10, devpNo); |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo); |
| | |
| | | wrkMast.setWrkNo(workNo); |
| | | wrkMast.setIoTime(new Date()); |
| | | wrkMast.setWrkSts(11L); // 工作状态:11.生成出库ID |
| | | wrkMast.setIoType(110); // 入出库状态: 110.空板出库 |
| | | wrkMast.setIoType(11); // 入出库状态: 11.库格移载 |
| | | wrkMast.setIoPri(10D); |
| | | wrkMast.setCrnNo(sourceLoc.getCrnNo()); |
| | | wrkMast.setSourceLocNo(sourceLocNo); // 源库位 |
| | |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk(sourceLoc.getLocType().equals("D")?"Y":"N"); // 空板 |
| | | wrkMast.setBarcode(sourceLoc.getBarcode()); // 托盘码 |
| | | wrkMast.setLinkMis("N"); |
| | | wrkMast.setAppeUser(userId); |
| | | wrkMast.setAppeTime(new Date()); |
| | |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.setWrkNo(workNo); |
| | | wrkDetl.setIoTime(new Date()); |
| | | wrkDetl.setMatnr(locDetl.getMatnr()); |
| | | wrkDetl.setAnfme(locDetl.getAnfme()); |
| | | wrkDetl.setZmatid(locDetl.getZmatid()); |
| | | wrkDetl.setTbpos(locDetl.getTbpos()); |
| | | wrkDetl.setTbnum(locDetl.getTbnum()); |
| | | wrkDetl.setLgnum(locDetl.getLgnum()); |
| | | wrkDetl.setAltme(locDetl.getAltme()); |
| | | wrkDetl.setBname(locDetl.getBname()); |
| | | wrkDetl.setMaktx(locDetl.getMaktx()); |
| | | VersionUtils.setWrkDetl(wrkDetl, locDetl); // 版本控制 |
| | | wrkDetl.setAppeTime(new Date()); |
| | | wrkDetl.setAppeUser(userId); |
| | | wrkDetl.setModiTime(new Date()); |
| | |
| | | MatCode matCode = matCodeService.selectById(adjust.getMatnr()); |
| | | LocDetl locDetl = new LocDetl(); |
| | | locDetl.setLocNo(locMast.getLocNo()); |
| | | locDetl.setMatnr(matCode.getMatNo()); |
| | | locDetl.setMaktx(matCode.getMatName()); // 物料描述 |
| | | locDetl.setAnfme(adjust.getCount()); // 数量 |
| | | locDetl.setAltme(matCode.getStr1()); // 单位 |
| | | // todo:luxiaoao |
| | | locDetl.setLgnum("待定"); // 仓库号 |
| | | locDetl.setTbnum(0); // 转储请求编号 |
| | | locDetl.setTbpos(0); // 行项目 |
| | | locDetl.setZmatid("待定"); // 物料标签ID |
| | | locDetl.setZpallet("待定"); // 托盘条码 |
| | | |
| | | VersionUtils.setLocDetl(locDetl, matCode); // 版本控制 |
| | | locDetl.setModiUser(userId); // 操作人员信息 |
| | | locDetl.setModiTime(new Date()); |
| | | locDetl.setAppeUser(userId); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void pickWrkMast(String workNo, Long userId) { |
| | | WrkMast wrkMast = wrkMastService.selectById(workNo); |
| | | if (Cools.isEmpty(wrkMast)){ |
| | | throw new CoolException(workNo+"工作档不存在"); |
| | | } |
| | | // 入出库类型判断 |
| | | if (wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107) { |
| | | throw new CoolException("当前入出库类型无法进行操作"); |
| | | } |
| | | // 工作状态判断 |
| | | if (wrkMast.getWrkSts() < 11 || wrkMast.getWrkSts() == 15) { |
| | | throw new CoolException("当前工作状态无法进行操作"); |
| | | } |
| | | // 保存工作明细档历史档 |
| | | // if (!wrkDetlLogService.save(wrkMast.getWrkNo())) { |
| | | // throw new CoolException("保存工作明细档历史档失败"); |
| | | // } |
| | | // 保存工作主档历史档 |
| | | if (!wrkMastLogService.save(wrkMast.getWrkNo())) { |
| | | throw new CoolException("保存工作主档历史档失败"); |
| | | } |
| | | // 获取目标站 |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", wrkMast.getIoType() - 50) |
| | | .eq("stn_no", wrkMast.getStaNo()) // 作业站点 = 拣料出库的目标站 |
| | | .eq("crn_no", wrkMast.getCrnNo()); // 堆垛机号 |
| | | StaDesc staDesc = staDescService.selectOne(wrapper); |
| | | if (Cools.isEmpty(staDesc)) { |
| | | throw new CoolException("入库路径不存在"); |
| | | } |
| | | // 堆垛机站点(目标站) |
| | | Integer staNo = staDesc.getCrnStn(); |
| | | // 更新工作档数据状态 |
| | | wrkMast.setIoType(wrkMast.getIoType() - 50); // 入出库类型: 103->53,104->54,107->57 |
| | | wrkMast.setWrkSts(2L); // 工作状态: 2.设备上走 |
| | | wrkMast.setSourceStaNo(wrkMast.getStaNo()); // 源站 |
| | | wrkMast.setStaNo(staNo); // 目标站 |
| | | wrkMast.setLocNo(wrkMast.getSourceLocNo()); // 目标库位 = 出库时的源库位 |
| | | wrkMast.setSourceLocNo(""); // 源库位清空 |
| | | wrkMast.setModiTime(new Date()); |
| | | wrkMast.setModiUser(userId); |
| | | if (!wrkMastService.updateById(wrkMast)) { |
| | | throw new CoolException("更新工作档数据状态失败"); |
| | | } |
| | | // 修改库位状态 Q.拣料/盘点/并板再入库 |
| | | LocMast locMast = locMastService.selectById(wrkMast.getLocNo()); |
| | | locMast.setLocType("Q"); |
| | | locMast.setModiTime(new Date()); |
| | | locMast.setModiUser(userId); |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException("修改库位状态失败"); |
| | | } |
| | | } |
| | | |
| | | } |