feat(wms): 添加业务员相关代码

- 在WmsCoilContractRelMapper中新增selectSalesmanByOrderId方法
- 在WmsCoilContractRelMapper.xml中添加对应的SQL查询语句
- 在WmsMaterialCoilServiceImpl中新增setSaleNameFromContract私有方法
- 在多个钢卷创建场景中调用setSaleNameFromContract方法设置销售员姓名
- 实现了根据合同ID自动获取并设置业务员信息的功能
This commit is contained in:
2026-06-21 10:14:26 +08:00
parent 491eed3dad
commit 6910278ba7
6 changed files with 47 additions and 10 deletions

View File

@@ -198,10 +198,11 @@ public class WmsMaterialCoilExportVo {
@ExcelProperty(value = "操作完成时间")
private Date actionCompleteTime;
// /**
// * 销售人员
// */
// private String saleName;
/**
* 销售人员
*/
@ExcelProperty(value = "业务员")
private String saleName;
/**
* 调拨类型

View File

@@ -232,8 +232,8 @@ public class WmsMaterialCoilVo extends BaseEntity {
// //销售id
// private Long saleId;
// // 销售昵称
// private String saleName;
// 销售昵称
private String saleName;
//新增长度字段
private Long length;

View File

@@ -24,4 +24,9 @@ public interface WmsCoilContractRelMapper extends BaseMapperPlus<WmsCoilContract
* 批量根据钢卷ID列表查询关联的订单完整信息
*/
List<WmsCoilContractRelVo> selectOrdersByCoilIds(@Param("coilIds") List<Long> coilIds);
/**
* 根据订单ID查询销售员业务员姓名
*/
String selectSalesmanByOrderId(@Param("orderId") Long orderId);
}

View File

@@ -1020,10 +1020,10 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
// }
// }
// // 销售人员姓名模糊查询
// if (bo.getSaleName() != null && !bo.getSaleName().isEmpty()) {
// qw.like("su.nick_name", bo.getSaleName());
// }
// 销售人员姓名模糊查询
if (bo.getSaleName() != null && !bo.getSaleName().isEmpty()) {
qw.like("su.nick_name", bo.getSaleName());
}
// 仅查询废品:质量状态为 D+、D、D-
if (Boolean.TRUE.equals(bo.getOnlyScrap())) {
@@ -2104,6 +2104,8 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
// 把老记录的coilId赋值给新纪录的parentCoilId
newCoil.setParentCoilId(String.valueOf(oldCoil.getCoilId()));
// 根据合同ID获取业务员信息
setSaleNameFromContract(newCoil, bo.getContractId());
// 插入新记录
boolean flag = baseMapper.insert(newCoil) > 0;
@@ -2416,6 +2418,8 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
validEntityBeforeSave(newCoil);
// 把老记录的coilId赋值给新纪录的parentCoilId
newCoil.setParentCoilId(String.valueOf(oldCoil.getCoilId()));
// 根据合同ID获取业务员信息
setSaleNameFromContract(newCoil, newCoilBo.getContractId());
baseMapper.insert(newCoil);
// 插入合同关联记录
@@ -2575,6 +2579,8 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
.collect(Collectors.joining(","));
newCoil.setParentCoilId(parentCoilIdsStr);
// 根据合同ID获取业务员信息
setSaleNameFromContract(newCoil, bo.getContractId());
baseMapper.insert(newCoil);
// 插入合同关联记录
@@ -3068,6 +3074,18 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
}
}
/**
* 根据合同ID从订单中获取业务员姓名并设置到钢卷实体
*/
private void setSaleNameFromContract(WmsMaterialCoil coil, Long contractId) {
if (contractId != null) {
String saleName = coilContractRelMapper.selectSalesmanByOrderId(contractId);
if (StringUtils.isNotBlank(saleName)) {
coil.setSaleName(saleName);
}
}
}
/**
* 保存前的数据校验
*/
@@ -5464,6 +5482,8 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
validateCoilWeight(childCoil.getGrossWeight(), childCoil.getNetWeight());
validEntityBeforeSave(childCoil);
childCoil.setParentCoilId(String.valueOf(parentCoilId));
// 根据合同ID获取业务员信息
setSaleNameFromContract(childCoil, childCoilBo.getContractId());
baseMapper.insert(childCoil);
// 插入合同关联记录

View File

@@ -137,4 +137,12 @@
AND rel.del_flag = 0
</select>
<!-- 根据订单ID查询销售员业务员姓名 -->
<select id="selectSalesmanByOrderId" resultType="String">
SELECT co.salesman
FROM crm_order co
WHERE co.order_id = #{orderId} AND co.del_flag = 0
LIMIT 1
</select>
</mapper>

View File

@@ -135,6 +135,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mc.schedule_thickness,
mc.theoretical_length,
mc.chrome_plate_coil_no,
mc.sale_name AS saleName,
w.warehouse_name AS warehouseName,
nw.warehouse_name AS nextWarehouseName,
aw.actual_warehouse_name AS actualWarehouseName,
@@ -503,6 +504,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-- 打包状态(直接展示原始值)
mc.packing_status AS packingStatus,
-- 销售
mc.sale_name AS saleName,
-- 调拨类型
mc.transfer_type AS transferType,
-- 理论厚度
@@ -598,6 +600,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mc.packaging_requirement AS packagingRequirement,
mc.quality_status AS qualityStatus,
mc.packing_status AS packingStatus,
mc.sale_name AS saleName,
mc.transfer_type AS transferType,
mc.theoretical_thickness AS theoreticalThickness,
mc.schedule_thickness AS scheduleThickness,