| | |
| | | private OutboundOrderMapper outboundOrderMapper; |
| | | @Autowired |
| | | private OutboundDetailMapper outboundDetailMapper; |
| | | @Autowired |
| | | private OutboundOrderConvert outboundOrderConvert; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void addTotal(OutboundOrderAndDetailDto outboundOrder) { |
| | | OutboundOrder order = OutboundOrderConvert.INSTANCE.convert(outboundOrder); |
| | | OutboundOrder order = outboundOrderConvert.convert(outboundOrder); |
| | | order.setHandler(Objects.requireNonNull(getCurrentUser()).getId()); |
| | | order.setOutNum(businessCodeRuleService.generateBusinessCodeSeq("outBoundOrder")); |
| | | order.setOrderStatus(OutBillStatus.DRAFT.getValue()); |
| | |
| | | //删除所有明细 |
| | | outboundDetailService.remove(new LambdaQueryWrapper<OutboundDetail>() |
| | | .eq(OutboundDetail::getOutStorehouseId, outboundOrder.getId())); |
| | | OutboundOrder outboundOrderUpdate = OutboundOrderConvert.INSTANCE.convert(outboundOrder); |
| | | OutboundOrder outboundOrderUpdate = outboundOrderConvert.convert(outboundOrder); |
| | | outboundOrderMapper.updateById(outboundOrderUpdate); |
| | | List<OutboundDetail> detailList = CollectionUtil.newArrayList(); |
| | | outboundOrder.getOutboundDetailList().forEach(item->{ |
| | |
| | | if (!Objects.equals(outboundOrder.getOrderStatus(), OutBillStatus.DRAFT.getValue())) { |
| | | throw new JeecgBootException("无法提交非草稿状态的出库申请单!"); |
| | | } |
| | | //锁定申请单明细中工具库存 |
| | | if (lockOutboundStock(id)) { |
| | | //启动流程 |
| | | if (triggerProcess(outboundOrder)) { |
| | | outboundOrder.setOrderStatus(OutBillStatus.SUBMITTED.getValue()); |
| | | updateById(outboundOrder); |
| | | } |
| | | if (!OutStorehouseType.PREPARATION_OUTBOUND.getValue().equals(outboundOrder.getOutStorehouseType())) { |
| | | //不是从准备单转入的出库申请,执行锁库 |
| | | lockOutboundStock(id); |
| | | } |
| | | //启动流程 |
| | | if (triggerProcess(outboundOrder)) { |
| | | outboundOrder.setOrderStatus(OutBillStatus.SUBMITTED.getValue()); |
| | | updateById(outboundOrder); |
| | | } |
| | | } |
| | | |