| | |
| | | // } |
| | | // 判断是否有相同条码的数据 |
| | | if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). |
| | | eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) { |
| | | throw new CoolException(param.getBarcode() + "数据正在进行入库"); |
| | | eq("zpallet", param.getBarcode())) > 0) { |
| | | throw new CoolException(param.getBarcode() + "条码已组托"); |
| | | } |
| | | try{ |
| | | param.setOrderNo(param.getCombMats().get(0).getOrderNo()); |
| | |
| | | OrderDetl orderDetl = orderDetlService.selectOne(orderDetlWrapper); |
| | | if (Cools.isEmpty(orderDetl)){ |
| | | return R.error("订单中未查询到下架数据"); |
| | | |
| | | } |
| | | EntityWrapper<ManLocDetl> manLocDetlWrapper = new EntityWrapper<>(); |
| | | manLocDetlWrapper.eq("zpallet",jsonBarcode); |
| | | manLocDetlWrapper.eq("matnr",jsonManLocDetl.getMatnr()); |
| | | ManLocDetl manLocDetl = manLocDetlService.selectOne(manLocDetlWrapper); |
| | | if (Cools.isEmpty(manLocDetl)){ |
| | | return R.error("托盘码未查询到库存信息"); |
| | | |
| | | } |
| | | BigDecimal orderQty = new BigDecimal(orderDetl.getQty()); |
| | | BigDecimal orderWorkQty = new BigDecimal(orderDetl.getWorkQty()); |
| | |
| | | if (diffWorkQty.doubleValue() > orderDetl.getAnfme()){ |
| | | return R.error("工作数量大于订单数量"); |
| | | } |
| | | orderDetl.setQty(diffQty.doubleValue()); |
| | | orderDetl.setWorkQty(diffWorkQty.doubleValue()); |
| | | if (!orderDetlService.updateById(orderDetl)){ |
| | | return R.error("订单明细更新失败"); |
| | | } |
| | | EntityWrapper<ManLocDetl> manLocDetlWrapper = new EntityWrapper<>(); |
| | | manLocDetlWrapper.eq("zpallet",jsonBarcode); |
| | | manLocDetlWrapper.eq("matnr",jsonManLocDetl.getMatnr()); |
| | | ManLocDetl manLocDetl = manLocDetlService.selectOne(manLocDetlWrapper); |
| | | BigDecimal locDetlAnfme = new BigDecimal(manLocDetl.getAnfme()); |
| | | |
| | | BigDecimal diffAnfme = locDetlAnfme.subtract(anfme); |
| | |
| | | } |
| | | if (diffAnfme.doubleValue() == 0){ |
| | | if (!manLocDetlService.delete(manLocDetlWrapper)){ |
| | | return R.error("删除库存明细失败"); |
| | | throw new RuntimeException("删除库存明细失败"); |
| | | } |
| | | |
| | | } else if (diffAnfme.doubleValue() > 0) { |
| | | manLocDetl.setAnfme(diffAnfme.doubleValue()); |
| | | if (!manLocDetlService.update(manLocDetl,manLocDetlWrapper)){ |
| | | return R.error("更新库存明细失败"); |
| | | throw new RuntimeException("更新库存明细失败"); |
| | | } |
| | | |
| | | |
| | | } |
| | | orderDetl.setQty(diffQty.doubleValue()); |
| | | orderDetl.setWorkQty(diffWorkQty.doubleValue()); |
| | | if (!orderDetlService.updateById(orderDetl)){ |
| | | return R.error("订单明细更新失败"); |
| | | } |
| | | Order order = orderService.selectByNo(jsonOrderNo); |
| | | if (IsOrderStatus(jsonOrderNo)){ |
| | |
| | | throw new RuntimeException("更新订单状态失败"); |
| | | } |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |