| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.vincent.rsf.framework.common.R; |
| | |
| | | @Override |
| | | public R queryOrderStatus(QueryOrderParam queryParams) { |
| | | WkOrder wkOrders = asnOrderService.getOne(new LambdaQueryWrapper<WkOrder>() |
| | | .eq(WkOrder::getCode, queryParams.getOrderNo()) |
| | | .in(WkOrder::getCode, queryParams.getOrderNo()) |
| | | .eq(WkOrder::getType, queryParams.getType())); |
| | | if (Objects.isNull(wkOrders)) { |
| | | throw new CoolException("单据不存在!!"); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/8/20 |
| | | * @description: 单据修改--收货通知单/出库单/盘点单 |
| | | * @version 1.0 |
| | | */ |
| | | @Override |
| | | @Transactional(timeout = 60, rollbackFor = Exception.class) |
| | | public R syncOrderUpdate(SyncOrderParams orders) { |
| | | //入库单修改 |
| | | if (orders.getType().equals(OrderType.ORDER_IN.type)) { |
| | | orders.getItems().forEach(orderItem -> { |
| | | WkOrder order = asnOrderService.getOne(new LambdaQueryWrapper<WkOrder>() |
| | | .eq(WkOrder::getCode, orderItem.getOrderCode())); |
| | | if (Objects.isNull(order)) { |
| | | throw new CoolException("单据不存在!!"); |
| | | } |
| | | |
| | | if (!asnOrderItemService.update(new LambdaUpdateWrapper<WkOrderItem>() |
| | | .eq(WkOrderItem::getOrderCode, orderItem.getOrderCode()) |
| | | .eq(WkOrderItem::getMatnrCode, orderItem.getMatnrCode()) |
| | | .eq(WkOrderItem::getSplrBatch, orderItem.getBatch()) |
| | | .set(WkOrderItem::getAnfme, orderItem.getAnfme()))) { |
| | | throw new CoolException("单据修改失败!!"); |
| | | } |
| | | |
| | | List<WkOrderItem> orderItems = asnOrderItemService.list(new LambdaQueryWrapper<WkOrderItem>() |
| | | .eq(WkOrderItem::getOrderId, order.getId())); |
| | | if (orderItems.isEmpty()) { |
| | | throw new CoolException("单据明细不存在!!"); |
| | | } |
| | | |
| | | Double summed = orderItems.stream().mapToDouble(WkOrderItem::getAnfme).sum(); |
| | | order.setAnfme(summed); |
| | | |
| | | if (!asnOrderService.updateById(order)) { |
| | | throw new CoolException("单据修改失败!!"); |
| | | } |
| | | //TODO 添加操作日志 |
| | | }); |
| | | } else { |
| | | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |