| | |
| | | import com.zy.asrs.entity.param.OpenOrderPakinParam; |
| | | import com.zy.asrs.mapper.ManLocDetlMapper; |
| | | import com.zy.asrs.mapper.OrderDetlMapper; |
| | | import com.zy.asrs.mapper.OrderReportMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.MatUtils; |
| | | import com.zy.asrs.utils.SaasUtils; |
| | |
| | | @Resource |
| | | private OrderDetlMapper orderDetlMapper; |
| | | |
| | | @Resource |
| | | private OrderReportMapper orderReportMapper; |
| | | |
| | | @Override |
| | | @Transactional |
| | | public R WarehouseOut(CombParam combParam, Long userId) { |
| | |
| | | if (order.getSettle() == 1) { |
| | | orderService.updateSettle(order.getId(), 2L, userId); |
| | | } |
| | | OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), combMat.getMatnr(), combMat.getBatch()); |
| | | OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), combMat.getMatnr(), ""); |
| | | if (Cools.isEmpty(orderDetl)) { |
| | | continue; |
| | | } |
| | | if (orderDetl.getAnfme() < orderDetl.getWorkQty() + combMat.getAnfme()) { |
| | | combMat.setAnfme(orderDetl.getAnfme() - orderDetl.getWorkQty()); |
| | | } |
| | | // 修改订单明细作业数量 |
| | | if (orderDetlMapper.increaseWorkQtyByOrderNo(combParam.getOrderNo(), combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme()) <= 0) { |
| | | // 修改订单明细完成数量 |
| | | if (orderDetlMapper.increaseWorkQtyByOrderNo(combParam.getOrderNo(), combMat.getMatnr(), "", combMat.getAnfme()) <= 0) { |
| | | throw new CoolException("修改单据明细工作数量失败"); |
| | | } |
| | | // 修改订单明细完成数量 |
| | | if (!orderDetlService.increase(order.getId(), combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme())) { |
| | | throw new CoolException("修改单据明细完成数量失败"); |
| | | } |
| | | // // 修改订单明细完成数量 |
| | | // if (!orderDetlService.increase(order.getId(), combMat.getMatnr(), "", combMat.getAnfme())) { |
| | | // throw new CoolException("修改单据明细完成数量失败"); |
| | | // } |
| | | // 插入上报表 |
| | | combMat.setOrderNo(combParam.getOrderNo()); |
| | | OrderReport orderReport = new OrderReport(); |
| | | orderReport.sync(combMat); |
| | | orderReportMapper.insert(orderReport); |
| | | |
| | | // 修改订单状态 作业中 ===>> 已完成 |
| | | orderService.checkComplete(combParam.getOrderNo()); |
| | | } |
| | |
| | | if (Cools.isEmpty(order)){ |
| | | throw new CoolException("平库上架查询订单失败"); |
| | | } |
| | | OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), waitPakin.getMatnr(), waitPakin.getBatch()); |
| | | OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), waitPakin.getMatnr(), ""); |
| | | if (Cools.isEmpty(orderDetl)){ |
| | | throw new CoolException("平库上架查询订单明细失败"); |
| | | } |
| | | // 修改订单明细完成数量 |
| | | if (!orderDetlService.increase(order.getId(),waitPakin.getMatnr(), waitPakin.getBatch(), waitPakin.getAnfme())) { |
| | | if (!orderDetlService.increase(order.getId(),waitPakin.getMatnr(), "", waitPakin.getAnfme())) { |
| | | throw new CoolException("修改单据明细数量失败"); |
| | | } |
| | | // 插入上报表 |
| | | OrderReport orderReport = new OrderReport(); |
| | | orderReport.sync(waitPakin); |
| | | orderReportMapper.insert(orderReport); |
| | | |
| | | // 修改订单状态 作业中 ===>> 已完成 |
| | | orderService.checkComplete(waitPakin.getOrderNo()); |
| | | |
| | |
| | | throw new CoolException("单据编号已完成:" + elem.getOrderNo()); |
| | | } |
| | | // 订单明细数量校验 |
| | | OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), elem.getBatch()); |
| | | OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), ""); |
| | | if (elem.getAnfme() > orderDetl.getEnableQty()) { |
| | | throw new CoolException(orderDetl.getMatnr() + "入库数量不合法"); |
| | | } |
| | | // 修改订单明细数量 |
| | | if (!orderDetlService.increaseWorkQty(order.getId(), elem.getMatnr(), elem.getBatch(), elem.getAnfme())) { |
| | | if (!orderDetlService.increaseWorkQty(order.getId(), elem.getMatnr(), "", elem.getAnfme())) { |
| | | throw new CoolException("修改单据明细数量失败"); |
| | | } |
| | | |