| | |
| | | } |
| | | |
| | | @Transactional |
| | | public ReturnT<String> deletereadInOrder(List<ExdInstockSource> exdInstockSource) { |
| | | String fbillno = exdInstockSource.get(0).getFbillno(); |
| | | public ReturnT<String> deletereadInOrder(ExdInstockSource exdInstockSource) { |
| | | String fbillno = exdInstockSource.getFbillno(); |
| | | Order order = orderService.selectByNo(fbillno); |
| | | if (!Cools.isEmpty(order)&&order.getStatus()>1) { |
| | | if (!Cools.isEmpty(order)) { |
| | | if (order.getSettle() > 1L) { |
| | | throw new CoolException(fbillno + "单据正在作业中,无法删除"); |
| | | } |
| | | orderService.remove(order.getId()); |
| | | Mat mat = matService.selectBySku(exdInstockSource.getFitemid() + ""); |
| | | boolean delete = orderDetlService.delete(new EntityWrapper<OrderDetl>() |
| | | .eq("order_no", order.getOrderNo()) |
| | | .eq("matnr", mat.getMatnr()) |
| | | .eq("batch", exdInstockSource.getFbatchno()) |
| | | .eq("anfme", exdInstockSource.getFqty())); |
| | | if (delete) { |
| | | log.info("删除订单明细成功,订单号={},物料号={},批号={},数量={}成功",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty()); |
| | | }else { |
| | | log.error("删除订单明细失败,订单号={},物料号={},批号={},数量={}",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty()); |
| | | throw new CoolException(fbillno + "单据明细删除失败"); |
| | | } |
| | | int orderNo = orderDetlService.selectCount(new EntityWrapper<OrderDetl>().eq("order_no", order.getOrderNo())); |
| | | if(orderNo==0){ |
| | | orderService.remove(order.getId()); |
| | | log.info("删除订单主表成功,订单={}",order.getOrderNo()); |
| | | } |
| | | }else if(Cools.isEmpty(order)){ |
| | | throw new CoolException(fbillno + "单据为在WMS中找到"); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | |
| | | @Transactional |
| | | public ReturnT<String> readOutOrder(List<ExdOutstockSource> exdOutstockSource) { |
| | |
| | | } |
| | | |
| | | @Transactional |
| | | public ReturnT<String> deletereadOutOrder(List<ExdOutstockSource> exdInstockSource) { |
| | | String fbillno = exdInstockSource.get(0).getFbillno(); |
| | | public ReturnT<String> deletereadOutOrder(ExdOutstockSource exdInstockSource) { |
| | | String fbillno = exdInstockSource.getFbillno(); |
| | | Order order = orderService.selectByNo(fbillno); |
| | | if (!Cools.isEmpty(order)&&order.getStatus()>1) { |
| | | if (!Cools.isEmpty(order)) { |
| | | if (order.getSettle() > 1L) { |
| | | throw new CoolException(fbillno + "单据正在作业中,无法删除"); |
| | | } |
| | | orderService.remove(order.getId()); |
| | | Mat mat = matService.selectBySku(exdInstockSource.getFitemid() + ""); |
| | | boolean delete = orderDetlService.delete(new EntityWrapper<OrderDetl>() |
| | | .eq("order_no", order.getOrderNo()) |
| | | .eq("matnr", mat.getMatnr()) |
| | | .eq("batch", exdInstockSource.getFbatchno()) |
| | | .eq("anfme", exdInstockSource.getFqty())); |
| | | if (delete) { |
| | | log.info("删除订单明细成功,订单号={},物料号={},批号={},数量={}成功",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty()); |
| | | }else { |
| | | log.error("删除订单明细失败,订单号={},物料号={},批号={},数量={}",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty()); |
| | | throw new CoolException(fbillno + "单据明细删除失败"); |
| | | } |
| | | int orderNo = orderDetlService.selectCount(new EntityWrapper<OrderDetl>().eq("order_no", order.getOrderNo())); |
| | | if(orderNo==0){ |
| | | orderService.remove(order.getId()); |
| | | log.info("删除订单主表成功,订单={}",order.getOrderNo()); |
| | | } |
| | | |
| | | |
| | | }else if (Cools.isEmpty(order)) { |
| | | throw new CoolException(fbillno + "单据未在WMS中找到"); |
| | | } |
| | | return SUCCESS; |
| | | } |