| | |
| | | import com.zy.asrs.entity.result.FindLocNoAttributeVo; |
| | | import com.zy.asrs.mapper.LocMastMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.MatUtils; |
| | | import com.zy.asrs.utils.OrderInAndOutUtil; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.model.*; |
| | |
| | | public void startupFullTakeStore(StockOutParam param, Long userId) { |
| | | // 目标站点状态检测 |
| | | BasDevp staNo = basDevpService.checkSiteStatus(param.getOutSite()); |
| | | if (Cools.isEmpty(param.getItemId())) { |
| | | throw new CoolException("所入仓库不能为空"); |
| | | } |
| | | |
| | | // 获取库位明细 |
| | | List<LocDetlDto> locDetlDtos = new ArrayList<>(); |
| | | for (StockOutParam.LocDetl paramLocDetl : param.getLocDetls()) { |
| | |
| | | ioType = dto.isAll() ? 101 : 103; |
| | | } else if (ioWorkType.equals(IoWorkType.CHECK_OUT)) { |
| | | ioType = 107; |
| | | if (Cools.isEmpty(checkOrderNo)) { |
| | | checkOrderNo = DateUtils.createTimeStamp(); |
| | | InventoryCheckOrder checkOrder = new InventoryCheckOrder(); |
| | | checkOrder.setCreateBy(userId); |
| | | checkOrder.setStatus("1"); |
| | | checkOrder.setCreateTime(new Date()); |
| | | checkOrder.setOrderNo(checkOrderNo); |
| | | checkOrderService.insert(checkOrder); |
| | | } |
| | | } |
| | | assert ioType != null; |
| | | // 获取库位 |
| | |
| | | StaDesc staDesc = staDescService.queryCrnStn(ioType, locMast.getCrnNo(), outSta); |
| | | // 生成工作号 |
| | | int workNo = commonService.getWorkNo(WorkNoType.getWorkNoType(ioType)); |
| | | |
| | | if (ioType == 107) { |
| | | if (Cools.isEmpty(checkOrderNo)) { |
| | | checkOrderNo = DateUtils.createTimeStamp() + "_" + workNo; |
| | | InventoryCheckOrder checkOrder = new InventoryCheckOrder(); |
| | | checkOrder.setCreateBy(userId); |
| | | checkOrder.setStatus("1"); |
| | | checkOrder.setArea(String.valueOf(workNo)); |
| | | checkOrder.setCreateTime(new Date()); |
| | | checkOrder.setOrderNo(checkOrderNo); |
| | | checkOrderService.insert(checkOrder); |
| | | } |
| | | } |
| | | |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo); |
| | |
| | | checkOrderDetl.setBatch(detlDto.getLocDetl().getBatch()); |
| | | checkOrderDetl.setLocNo(detlDto.getLocDetl().getLocNo()); |
| | | checkOrderDetl.setAnfme(detlDto.getLocDetl().getAnfme()); |
| | | checkOrderDetl.setArea(String.valueOf(workNo)); |
| | | checkOrderDetl.setCwarehouseid(wrkDetl.getStandby1()); |
| | | checkOrderDetl.setIoTime(new Date()); |
| | | checkOrderDetl.setStatus("0"); |
| | | checkOrderDetlService.insert(checkOrderDetl); |
| | |
| | | , locDto.getStandby1(), locDto.getStandby2(), locDto.getStandby3(), locDto.getBoxType1(), locDto.getBoxType2(), locDto.getBoxType3()); |
| | | |
| | | } |
| | | |
| | | Wrapper<LocDetl> wrapper = new EntityWrapper<LocDetl>() |
| | | .eq("loc_no", wrkMast.getSourceLocNo()) |
| | | .eq("matnr", orderDetlPakout.getMatnr()); |
| | | if (!Cools.isEmpty(locDto.getBatch())) { |
| | | wrapper.eq("batch", locDto.getBatch()); |
| | | } |
| | | if (!Cools.isEmpty(orderDetlPakout.getSpecs())) { |
| | | wrapper.eq("specs", orderDetlPakout.getSpecs()); |
| | | } |
| | | |
| | | LocDetl locDetl = locDetlService.selectOne(wrapper); |
| | | |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.sync(orderDetlPakout); |
| | | wrkDetl.setZpallet(wrkMast.getBarcode()); |
| | |
| | | wrkDetl.setModiTime(now); |
| | | wrkDetl.setModiUser(userId); |
| | | wrkDetl.setThreeCode(orderDetlPakout.getId() + ""); |
| | | wrkDetl.setSupp(orderPakout.getCstmrName()); |
| | | wrkDetl.setStockNum(locDetl.getAnfme());//库存 |
| | | wrkDetl.setStockNum2(locDetl.getWeight());//辅库存 |
| | | wrkDetl.setKpCstmrName(orderPakout.getKpCstmrName()); |
| | | |
| | | //计算辅数量 |
| | | Double weight = MatUtils.calcWeight(wrkDetl.getMatnr(), wrkDetl.getAnfme()); |
| | | wrkDetl.setWeight(weight); |
| | | if (!wrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作档明细失败"); |
| | | } |