| | |
| | | // 生成工作档明细 |
| | | List<MatCodeCountDto> matDtos = new ArrayList<>(); |
| | | param.getList().forEach(elem -> { |
| | | matDtos.add(new MatCodeCountDto(elem.getMatNo(), elem.getCount())); |
| | | matDtos.add(new MatCodeCountDto(elem.getMatNo(), elem.getSupplier(), elem.getCount(),elem.getMemo(),elem.getSource(),elem.getVendor())); |
| | | }); |
| | | wrkDetlService.createWorkDetail(workNo, matDtos, param.getBarcode(), userId); |
| | | // 更新源站点信息 |
| | |
| | | } |
| | | int workNo = commonService.getWorkNo(rok); |
| | | |
| | | // 当深库位出库时,查找对应的浅库位是否也有出库任务,如果有,就增加其优先级 |
| | | boolean reduce = false; |
| | | if (Utils.isDeepLoc(slaveProperties, dto.getLocNo())) { |
| | | String shallowLoc = Utils.getShallowLoc(slaveProperties, dto.getLocNo()); |
| | | if (locNos.contains(shallowLoc)) { |
| | | reduce = true; |
| | | if(locMast.getCrnNo().equals(1) && dto.getLocNo().substring(0,2).equals("01")) {//1号货架才判断 |
| | | // 当深库位出库时,查找对应的浅库位是否也有出库任务,如果有,就增加其优先级 |
| | | if (Utils.isDeepLoc(slaveProperties, dto.getLocNo())) { |
| | | String shallowLoc = Utils.getShallowLoc(slaveProperties, dto.getLocNo()); |
| | | if (locNos.contains(shallowLoc)) { |
| | | reduce = true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 深库位移库 |
| | | if (!reduce) { |
| | | moveLocForDeepLoc(locMast.getCrnNo(), dto.getLocNo()); |
| | | // 深库位移库 |
| | | if (!reduce) { |
| | | moveLocForDeepLoc(locMast.getCrnNo(), dto.getLocNo()); |
| | | } |
| | | } |
| | | |
| | | // 生成工作档 |
| | |
| | | wrkMast.setIoTime(new Date()); |
| | | wrkMast.setWrkSts(11L); // 工作状态:11.生成出库ID |
| | | wrkMast.setIoType(ioType); // 入出库状态 |
| | | wrkMast.setIoPri(13D); // 优先级:13 |
| | | wrkMast.setIoPri(reduce?13D:15D); // 优先级:13 |
| | | wrkMast.setCrnNo(locMast.getCrnNo()); |
| | | wrkMast.setSourceStaNo(staDesc.getCrnStn()); // 源站 |
| | | wrkMast.setStaNo(staDesc.getStnNo()); // 目标站 |
| | |
| | | wrkDetl.setAppeUser(userId); |
| | | wrkDetl.setModiTime(new Date()); |
| | | wrkDetl.setModiUser(userId); |
| | | wrkDetl.setMemo(detlDto.getLocDetl().getMemo()); |
| | | if (!wrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作档明细失败"); |
| | | } |
| | |
| | | for (String locNo : param.getLocNos()) { |
| | | // 获取工作号 |
| | | int workNo = commonService.getWorkNo(1); |
| | | |
| | | // 获取库位 |
| | | LocMast locMast = locMastService.selectById(locNo); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException(locNo+"库位不存在"); |
| | | } |
| | | |
| | | boolean reduce = false; |
| | | if(locMast.getCrnNo().equals(1) && locNo.substring(0,2).equals("01")) {//1号货架才判断 |
| | | // 当深库位出库时,查找对应的浅库位是否也有出库任务,如果有,就增加其优先级 |
| | | if (Utils.isDeepLoc(slaveProperties, locNo)) { |
| | | String shallowLoc = Utils.getShallowLoc(slaveProperties, locNo); |
| | | if (param.getLocNos().contains(shallowLoc)) { |
| | | reduce = true; |
| | | } |
| | | } |
| | | |
| | | // 深库位移库 |
| | | if (!reduce) { |
| | | moveLocForDeepLoc(locMast.getCrnNo(), locNo); |
| | | } |
| | | } |
| | | |
| | | // 获取源站 |
| | |
| | | wrkMast.setIoTime(new Date()); |
| | | wrkMast.setWrkSts(11L); // 工作状态:11.生成出库ID |
| | | wrkMast.setIoType(110); // 入出库状态: 110.空板出库 |
| | | wrkMast.setIoPri(10D); |
| | | wrkMast.setIoPri(reduce?13D:15D); |
| | | wrkMast.setSourceStaNo(sourceStaNo); // 源站 |
| | | wrkMast.setStaNo(param.getOutSite()); // 目标站 |
| | | wrkMast.setCrnNo(locMast.getCrnNo()); |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | //移库 |
| | | public void locMove(String sourceLocNo, String locNo, Long userId) { |
| | | LocMast sourceLoc = locMastService.selectById(sourceLocNo); |
| | | if (Cools.isEmpty(sourceLoc)){ |
| | |
| | | } |
| | | // 获取工作号 |
| | | int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE); |
| | | |
| | | if(loc.getCrnNo().equals(1) && sourceLocNo.substring(0,2).equals("01")) {//1号货架才判断 |
| | | // 当深库位出库时,查找对应的浅库位是否也有出库任务,如果有,就增加其优先级 |
| | | if (Utils.isDeepLoc(slaveProperties, sourceLocNo)) { |
| | | String shallowLoc = Utils.getShallowLoc(slaveProperties, sourceLocNo); |
| | | LocMast locShallow = locMastService.selectById(shallowLoc); |
| | | if(!Cools.isEmpty(locShallow) && (locShallow.getLocSts().equals("F") || locShallow.getLocSts().equals("D"))){ |
| | | moveLocForDeepLoc(loc.getCrnNo(), sourceLocNo); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 保存工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo); |
| | |
| | | LocDetl sqlParam = new LocDetl(); |
| | | sqlParam.setLocNo(locMast.getLocNo()); |
| | | sqlParam.setMatNo(adjust.getMatNo()); |
| | | sqlParam.setSupplier(adjust.getSupplier()); |
| | | LocDetl one = locDetlService.selectOne(new EntityWrapper<>(sqlParam)); |
| | | // 保存新库存明细 |
| | | if (Cools.isEmpty(one)) { |
| | |
| | | locDetl.setLocNo(locMast.getLocNo()); |
| | | locDetl.setQty(adjust.getCount()); // 数量 |
| | | VersionUtils.setLocDetl(locDetl, matCode); // 版本控制 |
| | | |
| | | if (Cools.isEmpty(adjust.getSupplier())){ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); |
| | | locDetl.setSupplier(sdf.format(new Date())); |
| | | }else { |
| | | locDetl.setSupplier(adjust.getSupplier()); |
| | | } |
| | | |
| | | |
| | | locDetl.setModiUser(userId); // 操作人员信息 |
| | | locDetl.setModiTime(new Date()); |
| | | locDetl.setAppeUser(userId); |
| | | locDetl.setAppeTime(new Date()); |
| | | locDetl.setZpallet(param.getZpallet());//托盘号 |
| | | locDetl.setVendor(adjust.getVendor()); |
| | | locDetl.setSource(adjust.getSource()); |
| | | locDetl.setSupplier(adjust.getSupplier()); |
| | | locDetl.setQtyBox(matCode.getStr6()); |
| | | locDetl.setAllQty(matCode.getStr6()*adjust.getCount()); |
| | | locDetl.setAllWeight(matCode.getWeight()*adjust.getCount()+30); |
| | | if (!locDetlService.insert(locDetl)) { |
| | | throw new CoolException("保存库存明细失败"); |
| | | } |
| | |
| | | throw new CoolException("清除库存明细失败"); |
| | | } |
| | | } else { |
| | | MatCode matCode = matCodeService.selectById(adjust.getMatNo()); |
| | | LocDetl sqlParam1 = new LocDetl(); |
| | | sqlParam1.setQty(adjust.getCount()); |
| | | sqlParam1.setSupplier(adjust.getSupplier()); |
| | | sqlParam1.setModiTime(new Date()); |
| | | sqlParam1.setModiUser(userId); |
| | | sqlParam1.setVendor(adjust.getVendor()); |
| | | sqlParam1.setSource(adjust.getSource()); |
| | | sqlParam1.setSupplier(adjust.getSupplier()); |
| | | sqlParam1.setQtyBox(matCode.getStr6()); |
| | | sqlParam1.setAllQty(matCode.getStr6()*adjust.getCount()); |
| | | sqlParam1.setAllWeight(matCode.getWeight()*adjust.getCount()+30); |
| | | if (!locDetlService.update(sqlParam1, new EntityWrapper<LocDetl>() |
| | | .eq("loc_no", locMast.getLocNo()) |
| | | .eq("mat_no", adjust.getMatNo()))) { |
| | | .eq("mat_no", adjust.getMatNo()) |
| | | .eq("supplier",adjust.getSupplier()))) { |
| | | throw new CoolException("修改库存明细失败"); |
| | | } |
| | | } |