无货主流程;

This commit is contained in:
王奎兴
2026-08-18 16:35:33 +08:00
parent 58e3882ef4
commit 0376f8328c
7 changed files with 41 additions and 6 deletions
@@ -1,5 +1,6 @@
package com.mhd.basic.domain.materialBaseInfo.entity;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
@@ -44,14 +45,17 @@ public class MaterialBaseInfo extends BaseVOEntity{
@ApiModelProperty("货主id")
@Excel(name = "货主id")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private Long shipperId;
@ApiModelProperty("货主名称")
@Excel(name = "货主名称")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String shipperName;
@ApiModelProperty("物料编码")
@Excel(name = "物料编码")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String materialCode;
@ApiModelProperty("物料名称")
@@ -1,5 +1,6 @@
package com.mhd.oms.domain.reserveStockInOrder.repository.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.mhd.oms.domain.reserveStockInOrder.repository.util.StringToBigDecimalConverter;
@@ -72,5 +73,6 @@ public class ReservedInventory {
/**
* WMS物料id(解析预览接口根据货物名称匹配后自动填充,匹配不到为空,不映射Excel)
*/
@ExcelIgnore
private Long materialBaseInfoId;
}
@@ -47,4 +47,8 @@ public class ReservedInventoryOut {
*/
@ExcelIgnore
private Long materialInventoryId;
@ExcelIgnore
private Long materialBaseInfoId;
}
@@ -1385,6 +1385,7 @@ public class ReserveStockOutOrderApplicationService {
BigDecimal allocationQuantity = inventory.getAllocationQuantity() == null ? BigDecimal.ZERO : inventory.getAllocationQuantity();
if (allocationQuantity.compareTo(importQuantity) > 0) {
reservedInventory.setMaterialInventoryId(inventory.getMaterialInventoryId());
reservedInventory.setMaterialBaseInfoId(inventory.getMaterialBaseInfoId());
break;
}
}
@@ -318,6 +318,8 @@ public class MaterialBaseInfoApplicationService {
*/
public Boolean update(MaterialBaseInfoDO materialBaseInfoDO) {
Long shipperId = materialBaseInfoDO.getShipperId();
//设置货主信息
shipperParam(materialBaseInfoDO);
if (shipperId != null&&shipperId!=0l) {
String customerCodeNcJson = materialBaseInfoMapper.getCustomerCodeNcJson(shipperId.toString());
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
@@ -386,6 +388,28 @@ public class MaterialBaseInfoApplicationService {
return true;
}
/**
* @description 封装货主信息
* @author ZhouGY
* @date 2024/5/9 20:43
* @param materialBaseInfoDO
*/
private void shipperParam(MaterialBaseInfoDO materialBaseInfoDO){
Long shipperId = materialBaseInfoDO.getShipperId();
if (shipperId != null && shipperId != 0l) {
AjaxResult ajaxResult = userServiceFeign.getInfo(materialBaseInfoDO.getShipperId());
if(!"200".equals(String.valueOf(ajaxResult.get("code")))){
throw new ServiceException("获取货主信息失败");
}
UserPo userPo = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class);
// 如果原始shipperName不为空保留原始值导入或手动输入时应该保留完整名称
// 只有在原始shipperName为空时才使用查询到的userName
if (materialBaseInfoDO.getShipperName() == null || materialBaseInfoDO.getShipperName().trim().isEmpty()) {
materialBaseInfoDO.setShipperName(userPo.getUserName());
}
}
}
/**
* 编辑物料时从库中反查子表主键避免仅传 batchId 等字段时子表主键为 null 无法 UPDATE
*/
@@ -1,9 +1,6 @@
package com.mhd.wms.domain.materialBaseInfo.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mhd.common.core.annotation.Excel;
import com.mhd.common.core.handler.ListTypeHandler;
@@ -47,14 +44,17 @@ public class MaterialBaseInfo extends BaseVOEntity {
@ApiModelProperty("货主id")
@Excel(name = "货主id")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private Long shipperId;
@ApiModelProperty("货主编码")
@Excel(name = "货主编码")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String shipperCode;
@ApiModelProperty("货主名称")
@Excel(name = "货主名称")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String shipperName;
@ApiModelProperty("物料编码")
@@ -122,7 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and a.top_organization_id = #{topOrganizationId}
</if>
<if test="shipperId != null ">
and a.shipper_id = #{shipperId}
and (a.shipper_id = #{shipperId} or a.shipper_id is null or a.shipper_id = 0)
</if>
<if test="shipperCode != null and shipperCode != ''">
and a.shipper_code like concat('%', #{shipperCode}, '%')
@@ -268,7 +268,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM ... LEFT JOIN material_base_info b ON ...
因此这里所有列名都加上 b. 前缀以避免和主表列名歧义 -->
<if test="shipperId != null ">
and b.shipper_id = #{shipperId}
and (b.shipper_id = #{shipperId} or b.shipper_id is null or b.shipper_id = 0)
</if>
<if test="shipperCode != null and shipperCode != ''">
and b.shipper_code like concat('%', #{shipperCode}, '%')