Commit 74452a3b authored by 332784038@qq.com's avatar 332784038@qq.com

订单到仓数据更新业务

parent cb9c07af
......@@ -398,4 +398,24 @@ public interface OrderBusinessService extends IService<OrderDO> {
void updateItem(OrderItemDO orderItemDO);
/**
* 订单到仓更新
*
* @param orderId 订单ID
* @param checkNum 到仓箱数
* @param checkQuantity 到仓数量
* @param checkVolume 到仓体积
* @param checkWeight 到仓重量
*/
void orderToWarehouse(Long orderId, Integer checkNum, Integer checkQuantity, BigDecimal checkVolume, BigDecimal checkWeight);
/**
* 撤销到仓
*
* @param orderId 订单id
*/
void revokeToWarehouse(Long orderId);
}
......@@ -107,6 +107,8 @@ import static cn.iocoder.yudao.framework.apollo.core.constants.Constants.NOT_ACC
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.ecw.enums.ErrorCodeConstants.EXCHANGE_RATE_NOT_EXISTS_PARAM;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.order.enums.OrderAirTimeEnum.AIR_UNLOADED_CABINET;
import static cn.iocoder.yudao.module.order.enums.OrderSeaTimeEnum.SEA_UNLOADED_CABINET;
/**
* 订单 Service 实现类
......@@ -2623,7 +2625,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
null,
CollectionUtil.newArrayList(OrderExceptionEnum.LINE_WEIGHT_EXCEPTION.getKey()));
if (CollectionUtil.isNotEmpty(lineOverweightExceptionDOList) ||
lineOverweightExceptionDOList.isEmpty()){
lineOverweightExceptionDOList.isEmpty()) {
overweightExceptionDOList.addAll(lineOverweightExceptionDOList);
}
orderDO.setIsAutomaticHandleNoCanShipmentChannelException(false);
......@@ -2638,7 +2640,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
orderItemDO.getProdId(),
CollectionUtil.newArrayList(OrderExceptionEnum.GOODS_OVERWEIGHT_EXCEPTION.getKey()));
if (CollectionUtil.isNotEmpty(goodsOverweightExceptionDOList) ||
goodsOverweightExceptionDOList.isEmpty()){
goodsOverweightExceptionDOList.isEmpty()) {
overweightExceptionDOList.addAll(goodsOverweightExceptionDOList);
}
//生成未报价异常 (草稿订单除外)
......@@ -2769,7 +2771,6 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
}
private void airShipmentStateUpdate(Integer type,
List<FeeDto> newFeeDtoList,
OrderDO newOrder) {
......@@ -4039,4 +4040,85 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
orderItemMapper.updateById(orderItemDO);
}
@Override
public void orderToWarehouse(Long orderId, Integer checkNum, Integer checkQuantity, BigDecimal checkVolume, BigDecimal checkWeight) {
OrderDO orderDO = orderMapper.getOrderById(orderId);
Integer orgCheckNum = orderDO.getCheckNum();
Integer orgCheckQuantity = orderDO.getCheckQuantity();
BigDecimal orgCheckVolume = orderDO.getCheckVolume();
BigDecimal orgCheckWeight = orderDO.getCheckWeight();
// 更新订单到仓数据
orderMapper.update(null, new LambdaUpdateWrapper<OrderDO>()
.set(OrderDO::getCheckNum, checkNum)
.set(OrderDO::getCheckQuantity, checkQuantity)
.set(OrderDO::getCheckVolume, checkVolume)
.set(OrderDO::getCheckWeight, checkWeight)
.eq(OrderDO::getOrderId, orderId)
);
// 添加订单到仓操作日志
List<ApplyInfoVO> list = new ArrayList<>();
ApplyInfoVO applyInfoVO = new ApplyInfoVO();
applyInfoVO.setName("卸柜/到仓箱数");
applyInfoVO.setOrgValue(orgCheckNum + "箱");
applyInfoVO.setNewValue(checkNum + "箱");
list.add(applyInfoVO);
applyInfoVO = new ApplyInfoVO();
applyInfoVO.setName("卸柜/到仓数量");
applyInfoVO.setOrgValue(orgCheckQuantity + "个");
applyInfoVO.setNewValue(checkQuantity + "个");
list.add(applyInfoVO);
applyInfoVO = new ApplyInfoVO();
applyInfoVO.setName("卸柜/到仓体积");
applyInfoVO.setOrgValue(orgCheckVolume + "m³");
applyInfoVO.setNewValue(checkVolume + "m³");
list.add(applyInfoVO);
applyInfoVO = new ApplyInfoVO();
applyInfoVO.setName("卸柜/到仓重量");
applyInfoVO.setOrgValue(orgCheckWeight + "kg");
applyInfoVO.setNewValue(checkWeight + "kg");
list.add(applyInfoVO);
this.addOrderOperateLog(orderId, "订单操作", "订单卸柜/到仓数据更新", list);
}
@Override
public void revokeToWarehouse(Long orderId) {
OrderDO orderDO = orderMapper.getOrderById(orderId);
Integer orgCheckNum = orderDO.getCheckNum();
Integer orgCheckQuantity = orderDO.getCheckQuantity();
BigDecimal orgCheckVolume = orderDO.getCheckVolume();
BigDecimal orgCheckWeight = orderDO.getCheckWeight();
Integer orderStatus = orderDO.getStatus();
Integer orderInWarehouseState = orderDO.getInWarehouseState();
Integer orderShipmentState = orderDO.getShipmentState();
// 更新订单到仓数据,回滚订单状态
orderMapper.update(null, new LambdaUpdateWrapper<OrderDO>()
.set(OrderDO::getCheckNum, 0)
.set(OrderDO::getCheckQuantity, 0)
.set(OrderDO::getCheckVolume, 0)
.set(OrderDO::getCheckWeight, 0)
.set(OrderDO::getUnloadTime, null)
.set(OrderDO::getStatus, 15)
.set(OrderDO::getOldStatus, orderStatus)
.set(OrderDO::getInWarehouseState, 0)
.set(OrderDO::getOldInWarehouseState, orderInWarehouseState)
.set(OrderDO::getShipmentState, 330) // 回滚为已清关,待卸柜/到仓
.set(OrderDO::getOldShipmentState, orderShipmentState)
.eq(OrderDO::getOrderId, orderId)
);
// 回滚订单动态日志
OrderTimeDO orderTimeDO = orderTimeMapper.selectOne(new LambdaQueryWrapper<OrderTimeDO>()
.eq(OrderTimeDO::getOrderId, orderId)
.eq(OrderTimeDO::getStatus, orderDO.getTransportId() == 1 ? SEA_UNLOADED_CABINET.getValue() : AIR_UNLOADED_CABINET.getValue())
.orderByDesc(OrderTimeDO::getId)
.last("limit 1")
);
if (Objects.nonNull(orderTimeDO)) {
orderTimeMapper.deleteById(orderTimeDO.getId());
}
// 添加订单到仓操作日志
this.addOrderOperateLog(orderId, "订单操作", "撤销订单卸柜/到仓,清空到仓数据", "");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment