| | |
| | | private TaskService taskService;
|
| | | @Autowired
|
| | | private WaitPakinRuleService waitPakinRuleService;
|
| | | @Autowired
|
| | | private WaitPakinService waitPakinService;
|
| | |
|
| | | @Override
|
| | | public List<WaitPakin> getByOrderDetlId(Long orderDetlId) {
|
| | |
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public boolean comb(WaitPakin waitPakin) {
|
| | | public boolean comb(WaitPakin waitPakin, Long inType) {
|
| | | //组托规则校验
|
| | | waitPakinRuleService.rule(waitPakin);
|
| | |
|
| | |
| | | throw new CoolException("订单明细不存在");
|
| | | }
|
| | |
|
| | | //可用数量
|
| | | Double count = orderDetl.getAnfme() - orderDetl.getWaitQty();
|
| | | if (waitPakin.getAnfme() > count) {
|
| | | throw new CoolException("组托数量超过剩余可用数量");
|
| | | if (inType.equals(OrderType.PK_IN_ORDER.id)) {
|
| | | Double sCount = Math.round((orderDetl.getAnfme() - orderDetl.getWaitQty()) * 1000) / 1000.0;
|
| | | if (waitPakin.getAnfme().compareTo(sCount) > 0) {
|
| | | throw new CoolException("组托数量超过剩余可用数量");
|
| | | }
|
| | | } else {
|
| | | // Double count = orderDetl.getAnfme() - orderDetl.getQty() - orderDetl.getWorkQty() - orderDetl.getWaitQty();
|
| | | Double count = Math.round((orderDetl.getAnfme() - orderDetl.getWorkQty() - orderDetl.getQty()) * 1000) / 1000.0;
|
| | | if (waitPakin.getAnfme().compareTo(count) > 0) {
|
| | | throw new CoolException("组托数量超过剩余可用数量");
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | //查询是否存在相同明细和托盘码的组托通知档
|
| | | WaitPakin waitPakin1 = this.getOne(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, waitPakin.getBarcode()).eq(WaitPakin::getDetlId, waitPakin.getDetlId()));
|
| | | WaitPakin waitPakin1 = this.getOne(new LambdaQueryWrapper<WaitPakin>()
|
| | | .eq(WaitPakin::getBarcode, waitPakin.getBarcode())
|
| | | .eq(WaitPakin::getDetlId, waitPakin.getDetlId()));
|
| | |
|
| | | if (waitPakin1 == null) {
|
| | | //不存在组托通知档,创建
|
| | | waitPakin.setMatnr(orderDetl.getMat$().getMatnr());
|
| | |
| | | throw new CoolException("添加失败");
|
| | | }
|
| | | }else {
|
| | | Double total = waitPakin1.getAnfme() + waitPakin.getAnfme();
|
| | | //存在组托通知档,更新
|
| | | waitPakin1.setAnfme(waitPakin1.getAnfme() + waitPakin.getAnfme());
|
| | | waitPakin1.setAnfme(total);
|
| | | waitPakin1.setUpdateTime(new Date());
|
| | | if (!this.updateById(waitPakin1)) {
|
| | | throw new CoolException("添加失败");
|
| | |
| | | }
|
| | |
|
| | | //如果是平库入库单,修改订单明细执行数量
|
| | | if (order.getOrderType() == OrderType.PK_IN_ORDER.id) {
|
| | | orderDetl.setWorkQty(waitPakin.getAnfme());
|
| | | if (inType.equals(OrderType.PK_IN_ORDER.id)) {
|
| | | Double workQty = Math.round((orderDetl.getWorkQty() + waitPakin.getAnfme()) * 1000) / 1000.0;
|
| | | orderDetl.setWorkQty(workQty);
|
| | | orderDetlService.updateById(orderDetl);
|
| | | }
|
| | |
|
| | | if (orderDetl.getWaitQty().compareTo(orderDetl.getAnfme()) >= 0) {
|
| | | orderDetl.setSorted(0);
|
| | | } else if (orderDetl.getWaitQty().compareTo(0.0) > 0) {
|
| | | orderDetl.setSorted(55);
|
| | | } else {
|
| | | orderDetl.setSorted(49);
|
| | | }
|
| | | orderDetlService.updateById(orderDetl);
|
| | |
|
| | | //更新订单状态
|
| | | if (order.getOrderSettle().equals(OrderSettleType.INIT.val())) {
|
| | | order.setOrderSettle(OrderSettleType.WAIT.val());
|