Commit e5c84ce7 authored by 332784038@qq.com's avatar 332784038@qq.com

到仓业务补充

parent c8815893
......@@ -8,5 +8,14 @@ alter table ecw_order
alter table ecw_order
add COLUMN `check_weight` decimal(10, 2) DEFAULT '0.00' COMMENT '到仓重量';
alter table ecw_order_item
add COLUMN `check_num` int DEFAULT '0' COMMENT '到仓件数';
alter table ecw_order_item
add COLUMN `check_volume` decimal(10, 2) DEFAULT '0.00' COMMENT '到仓体积';
alter table ecw_order_item
add COLUMN `check_quantity` int DEFAULT '0' COMMENT '到仓数量';
alter table ecw_order_item
add COLUMN `check_weight` decimal(10, 2) DEFAULT '0.00' COMMENT '到仓重量';
-- 跟进记录菜单
INSERT INTO `system_menu` (`name`, `permission`, `menu_type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `is_show_in_menu_bar`, `name_en`, `keepalive`, `redirect`, `badge_field`) VALUES ( '跟进记录', '', 2, 1, 1417, 'offer/logList', 'log', 'ecw/offer/logList', 0, '2702', '2024-10-27 12:02:57', '2702', '2024-10-27 12:04:30', b'0', b'1', 'followLog', b'0', NULL, NULL);
......@@ -416,6 +416,18 @@ public class OrderItemDO extends BaseDO {
@ApiModelProperty(value = "是否处理了渠道特性异常")
private Boolean handlerChannelAttrException;
@ApiModelProperty(value = "到仓件数")
private Integer checkNum;
@ApiModelProperty(value = "到仓数量")
private Integer checkQuantity;
@ApiModelProperty(value = "到仓体积")
private BigDecimal checkVolume;
@ApiModelProperty(value = "到仓重量")
private BigDecimal checkWeight;
/**
* 1-未设置商品清关费, 2-区间未匹配上
*/
......
......@@ -12,12 +12,14 @@ import cn.iocoder.yudao.module.order.enums.OrderSeaTimeEnum;
import cn.iocoder.yudao.module.order.param.OrderChangePriceParam;
import cn.iocoder.yudao.module.order.param.OrderControlLogParam;
import cn.iocoder.yudao.module.order.vo.order.*;
import cn.iocoder.yudao.module.order.vo.orderWarehouseCheck.CheckItemSumVO;
import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductPriceDO;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 订单 Service 接口
......@@ -404,12 +406,9 @@ public interface OrderBusinessService extends IService<OrderDO> {
* 订单到仓更新
*
* @param orderId 订单ID
* @param checkNum 到仓箱数
* @param checkQuantity 到仓数量
* @param checkVolume 到仓体积
* @param checkWeight 到仓重量
* @param itemSumMap 到仓商品项
*/
void orderToWarehouse(Long orderId, Integer checkNum, Integer checkQuantity, BigDecimal checkVolume, BigDecimal checkWeight);
void orderToWarehouse(Long orderId, Map<Long, CheckItemSumVO> itemSumMap);
/**
......
......@@ -66,6 +66,7 @@ import cn.iocoder.yudao.module.order.vo.orderControlLog.OrderControlLogCreateReq
import cn.iocoder.yudao.module.order.vo.orderException.OrderExceptionCreateReqVO;
import cn.iocoder.yudao.module.order.vo.orderException.OrderExceptionDescVO;
import cn.iocoder.yudao.module.order.vo.orderOperateLog.OrderOperateLogCreateReqVO;
import cn.iocoder.yudao.module.order.vo.orderWarehouseCheck.CheckItemSumVO;
import cn.iocoder.yudao.module.product.component.ProdCostCalculation;
import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductAttrDO;
import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductDO;
......@@ -86,6 +87,7 @@ import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableCreateReqVO;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -4041,9 +4043,29 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
orderItemMapper.updateById(orderItemDO);
}
@Override
public void orderToWarehouse(Long orderId, Integer checkNum, Integer checkQuantity, BigDecimal checkVolume, BigDecimal checkWeight) {
public void orderToWarehouse(Long orderId, Map<Long, CheckItemSumVO> itemSumMap) {
Integer sumCheckNum = 0;
Integer sumCheckQuantity = 0;
BigDecimal sumCheckVolume = BigDecimal.ZERO;
BigDecimal sumCheckWeight = BigDecimal.ZERO;
List<OrderItemDO> orderItemDOList = orderItemMapper.selectList(new LambdaQueryWrapper<OrderItemDO>().eq(OrderItemDO::getOrderId, orderId));
for (OrderItemDO orderItemDO : orderItemDOList) {
if (itemSumMap.containsKey(orderItemDO.getOrderItemId())){
CheckItemSumVO itemSum = itemSumMap.get(orderItemDO.getOrderItemId());
orderItemDO.setCheckNum(itemSum.getCartons());
orderItemDO.setCheckQuantity(itemSum.getQuantity());
orderItemDO.setCheckVolume(itemSum.getVolume());
orderItemDO.setCheckWeight(itemSum.getWeight());
}
sumCheckNum += orderItemDO.getCheckNum();
sumCheckQuantity += orderItemDO.getCheckQuantity();
sumCheckVolume = sumCheckVolume.add(orderItemDO.getCheckVolume());
sumCheckWeight = sumCheckWeight.add(orderItemDO.getCheckWeight());
}
// 更新订单项的到仓信息
orderItemMapper.insertBatch(orderItemDOList);
OrderDO orderDO = orderMapper.getOrderById(orderId);
Integer orgCheckNum = orderDO.getCheckNum();
Integer orgCheckQuantity = orderDO.getCheckQuantity();
......@@ -4052,10 +4074,10 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
// 更新订单到仓数据
orderMapper.update(null, new LambdaUpdateWrapper<OrderDO>()
.set(OrderDO::getCheckNum, checkNum)
.set(OrderDO::getCheckQuantity, checkQuantity)
.set(OrderDO::getCheckVolume, checkVolume)
.set(OrderDO::getCheckWeight, checkWeight)
.set(OrderDO::getCheckNum, sumCheckNum)
.set(OrderDO::getCheckQuantity, sumCheckQuantity)
.set(OrderDO::getCheckVolume, sumCheckVolume)
.set(OrderDO::getCheckWeight, sumCheckWeight)
.eq(OrderDO::getOrderId, orderId)
);
// 添加订单到仓操作日志
......@@ -4063,22 +4085,22 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
ApplyInfoVO applyInfoVO = new ApplyInfoVO();
applyInfoVO.setName("卸柜/到仓箱数");
applyInfoVO.setOrgValue(orgCheckNum + "箱");
applyInfoVO.setNewValue(checkNum + "箱");
applyInfoVO.setNewValue(sumCheckNum + "箱");
list.add(applyInfoVO);
applyInfoVO = new ApplyInfoVO();
applyInfoVO.setName("卸柜/到仓数量");
applyInfoVO.setOrgValue(orgCheckQuantity + "个");
applyInfoVO.setNewValue(checkQuantity + "个");
applyInfoVO.setNewValue(sumCheckQuantity + "个");
list.add(applyInfoVO);
applyInfoVO = new ApplyInfoVO();
applyInfoVO.setName("卸柜/到仓体积");
applyInfoVO.setOrgValue(orgCheckVolume + "m³");
applyInfoVO.setNewValue(checkVolume + "m³");
applyInfoVO.setNewValue(sumCheckVolume + "m³");
list.add(applyInfoVO);
applyInfoVO = new ApplyInfoVO();
applyInfoVO.setName("卸柜/到仓重量");
applyInfoVO.setOrgValue(orgCheckWeight + "kg");
applyInfoVO.setNewValue(checkWeight + "kg");
applyInfoVO.setNewValue(sumCheckWeight + "kg");
list.add(applyInfoVO);
this.addOrderOperateLog(orderId, "订单操作", "订单卸柜/到仓数据更新", list);
}
......
......@@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.order.dal.mysql.orderWarehouseCheck.OrderWarehous
import cn.iocoder.yudao.module.order.enums.ErrorCodeConstants;
import cn.iocoder.yudao.module.order.service.order.OrderBusinessService;
import cn.iocoder.yudao.module.order.service.orderWarehouseIn.OrderWarehouseInService;
import cn.iocoder.yudao.module.order.vo.orderWarehouseCheck.CheckItemSumVO;
import cn.iocoder.yudao.module.order.vo.orderWarehouseCheck.OrderWarehouseCheckUpdateItemVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
......@@ -19,9 +20,7 @@ import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -44,25 +43,34 @@ public class OrderWarehouseCheckServiceImpl
// 到仓信息统计
private class Sum {
int cartons = 0; // 到仓总箱数
int quantity = 0; // 到仓总数量
BigDecimal volume = BigDecimal.ZERO; // 到仓总体积
BigDecimal weight = BigDecimal.ZERO; // 到仓总重量
Map<Long, CheckItemSumVO> itemSumMap =new HashMap<>();
// 将到仓信息累加
void add(OrderWarehouseCheckDO checkDo) {
cartons += checkDo.getCheckCartonsNum();
quantity += checkDo.getCheckQuantityAll();
volume = volume.add(checkDo.getCheckVolume());
weight = weight.add(checkDo.getCheckWeight());
if (itemSumMap.containsKey(checkDo.getOrderItemId())) {
CheckItemSumVO itemSum = itemSumMap.get(checkDo.getOrderItemId());
itemSum.add(checkDo.getCheckCartonsNum(), checkDo.getCheckQuantityAll(), checkDo.getCheckVolume(), checkDo.getCheckWeight());
itemSumMap.put(checkDo.getOrderItemId(), itemSum);
}else {
CheckItemSumVO itemSum = new CheckItemSumVO();
itemSum.add(checkDo.getCheckCartonsNum(), checkDo.getCheckQuantityAll(), checkDo.getCheckVolume(), checkDo.getCheckWeight());
itemSumMap.put(checkDo.getOrderItemId(), itemSum);
}
}
// 将统计数据更新到订单中
void done(long orderId) {
orderBusinessService.orderToWarehouse(orderId, cartons, quantity, volume, weight);
orderBusinessService.orderToWarehouse(orderId, itemSumMap);
}
}
private static class ItemSum {
int cartons = 0; // 到仓总箱数
int quantity = 0; // 到仓总数量
BigDecimal volume = BigDecimal.ZERO; // 到仓总体积
BigDecimal weight = BigDecimal.ZERO; // 到仓总重量
}
// 重置到仓数据为入仓数据
private void reset(OrderWarehouseCheckDO checkDo) {
checkDo.setCheckVolume(checkDo.getVolume());
......
......@@ -437,6 +437,18 @@ public class OrderItemBackVO {
@ApiModelProperty(value = "入仓记录备注,多个用逗号分隔")
private String warehouseRecordRemark ;
@ApiModelProperty(value = "到仓件数")
private Integer checkNum;
@ApiModelProperty(value = "到仓数量")
private Integer checkQuantity;
@ApiModelProperty(value = "到仓体积")
private BigDecimal checkVolume;
@ApiModelProperty(value = "到仓重量")
private BigDecimal checkWeight;
public void setCouponInfo(String couponInfo) {
this.couponInfo = couponInfo;
......
......@@ -290,6 +290,18 @@ public class OrderItemBaseVO {
@ApiModelProperty(value = "是否处理了渠道特性异常")
private Boolean handlerChannelAttrException;
@ApiModelProperty(value = "到仓件数")
private Integer checkNum;
@ApiModelProperty(value = "到仓数量")
private Integer checkQuantity;
@ApiModelProperty(value = "到仓体积")
private BigDecimal checkVolume;
@ApiModelProperty(value = "到仓重量")
private BigDecimal checkWeight;
public void setWarehouseInInfo(String warehouseInInfo) {
this.warehouseInInfo = warehouseInInfo;
this.warehouseInInfoVO = JSONObject.parseObject(warehouseInInfo, WarehouseInInfoVO.class);
......
package cn.iocoder.yudao.module.order.vo.orderWarehouseCheck;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class CheckItemSumVO {
int cartons = 0; // 到仓总箱数
int quantity = 0; // 到仓总数量
BigDecimal volume = BigDecimal.ZERO; // 到仓总体积
BigDecimal weight = BigDecimal.ZERO; // 到仓总重量
public void add(Integer checkNum, Integer checkQuantity, BigDecimal checkVolume, BigDecimal checkWeight) {
this.cartons += checkNum;
this.quantity += checkQuantity;
this.volume = this.volume.add(checkVolume);
this.weight = this.weight.add(checkWeight);
}
}
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