物料,工厂规则匹配接口迁移

This commit is contained in:
luoliming 2024-01-27 23:14:41 +08:00
parent 58bdfecebb
commit c156fc5ca8
10 changed files with 88 additions and 95 deletions

View File

@ -185,6 +185,13 @@ public class BomFactorySplitRuleEntity implements Serializable {
@TableField(value = "updated_time")
@ApiModelProperty(value = "更新时间")
private LocalDateTime updatedTime;
/**
* 项目类别
*/
@TableField(value = "project_type")
@ApiModelProperty(value = "项目类别")
private String projectType;
private static final long serialVersionUID = -87704764754587418L;

View File

@ -27,6 +27,9 @@ public class BomFactorySplitRuleExcelVO {
@ExcelColumn("规则名称")
private String ruleName;
@ExcelColumn("项目类别")
private String projectType;
@ExcelColumn("物料分类代码")
private String materialCategoryCode;

View File

@ -82,5 +82,7 @@ public class BomFactorySplitRuleVO {
private Date updatedTime;
private Boolean checked = false;
private String projectType;
}

View File

@ -41,6 +41,13 @@ public class BomOriginalPlmBomVO extends BaseMaterialVO implements Serializable
*/
@ApiModelProperty(value = "图号")
private String chartNo;
public String getChartNo(){
if(chartNo.equals("")){
return "";
}
return chartNo;
}
/**
* 修改版

View File

@ -545,6 +545,9 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
data.setRowNum(rowNum.get());
// data.setOrderNo(data.getLevelNo());
data.setChartNo(StrUtil.trim(data.getChartNo()).replace("", "(").replace("", ")").replace(" ", ""));
if(data.getChartNo().equals("")){
data.setChartNo("");
}
rowNum.set(rowNum.get() + 1);
excelContextTL.get().add(data);

View File

@ -608,6 +608,9 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
if (StrUtil.isNotBlank(role.getMaterialCategoryCode())) {
match = match & (StrUtil.isNotBlank(child.getMaterialCategoryCode()) && role.getMaterialCategoryCode().equals(child.getMaterialCategoryCode()));
}
if (StrUtil.isNotBlank(role.getProjectType())) {
match = match & (StrUtil.isNotBlank(child.getProjectType()) && role.getProjectType().equals(child.getProjectType()));
}
if (StrUtil.isNotBlank(role.getDrawingPrefix())) {
match = match & (StrUtil.isNotBlank(child.getDrawingNo()) && child.getDrawingNo().startsWith(role.getDrawingPrefix()));
}

View File

@ -112,22 +112,22 @@ public class PlmBomToOriginalConvert extends BaseConvert {
handlerChild(originalBom,originalSourceEnum);
} else { //用户不一致
if (isSame(getBomChild(originalBom.getRowId()), Convert.toList(BomNewOriginalChildEntity.class, childs))) {
VUtils.isTure(true).throwMessage("数据和" + originalBom.getCreatedBy() + "导入的数据不一致,请沟通处理");
VUtils.isTure(true).throwMessage("图号:"+parent.getChartNo()+"的BOM数据和" + originalBom.getCreatedBy() + "导入的数据不一致,请沟通处理");
} else {
VUtils.isTure(true).throwMessage(originalBom.getCreatedBy() + "已导入了相同的BOM,直接引用");
VUtils.isTure(true).throwMessage("图号:"+parent.getChartNo()+" "+originalBom.getCreatedBy() + "已导入了相同的BOM,直接引用");
}
}
}
} else { //非草稿状态
//判断Ebom 的状态 eBom草稿
BomNewEbomParentEntity ebom = getEbom(parent.getChartNo());
if (!EBomStatusEnum.WAIT_CHECK.equalsValue(ebom.getStatus())) {
if (ebom.getStatus()<EBomStatusEnum.PUBLISHED.getValue()) {
//相同用户
if (originalBom.getCreatedBy() == parent.getCreatedBy()) {
VUtils.isTure(true).throwMessage("此数据已创建,请退回重新导入");
if (ebom.getCreatedBy() == parent.getCreatedBy()) {
VUtils.isTure(true).throwMessage("图号:"+parent.getChartNo()+"此数据已创建BOM请删除BOM重新导入");
} else {
VUtils.isTure(true).throwMessage("此数据已被其他用户创建,请联系其他人处理");
VUtils.isTure(true).throwMessage("图号:"+parent.getChartNo()+"此数据已被其他用户创建,请联系其他人处理");
}
} else { //ebom为正式状态
// BOM结构不相同

View File

@ -28,10 +28,64 @@
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP"/>
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR"/>
<result column="updated_time" property="updatedTime" jdbcType="TIMESTAMP"/>
<result column="project_type" property="projectType" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
row_id, rule_group_depth, rule_group_code, rule_group_name, rule_name, material_category_code, material_category_name, drawing_prefix, drawing_contain, drawing_suffix, material_name_contain, material_texture, dept_row_id, dept_name, next_material_category_code, next_material_category_name, factory_code, status, remark, created_by, created_time, updated_by, updated_time </sql>
row_id, rule_group_depth, rule_group_code, rule_group_name, rule_name, material_category_code, material_category_name, drawing_prefix, drawing_contain, drawing_suffix, material_name_contain, material_texture, dept_row_id, dept_name, next_material_category_code, next_material_category_name, factory_code, status, remark, created_by, created_time, updated_by, updated_time ,project_type </sql>
<!-- 批量插入 -->
<insert id="insertBatch" keyProperty="rowId" useGeneratedKeys="true">
insert into t_bom_factory_split_rule(rule_group_depth, rule_group_code, rule_group_name, rule_name,
material_category_code, material_category_name, drawing_prefix, drawing_contain, drawing_suffix,
material_name_contain, material_texture, dept_row_id, dept_name, next_material_category_code,
next_material_category_name, factory_code, status, remark, created_by, created_time, updated_by, updated_time,project_type)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.ruleGroupDepth}, #{entity.ruleGroupCode}, #{entity.ruleGroupName}, #{entity.ruleName},
#{entity.materialCategoryCode}, #{entity.materialCategoryName}, #{entity.drawingPrefix},
#{entity.drawingContain}, #{entity.drawingSuffix}, #{entity.materialNameContain}, #{entity.materialTexture},
#{entity.deptRowId}, #{entity.deptName}, #{entity.nextMaterialCategoryCode},
#{entity.nextMaterialCategoryName}, #{entity.factoryCode}, #{entity.status}, #{entity.remark},
#{entity.createdBy}, #{entity.createdTime}, #{entity.updatedBy}, #{entity.updatedTime},#{entity.projectType})
</foreach>
</insert>
<!-- 批量插入或按主键更新 -->
<insert id="insertOrUpdateBatch" keyProperty="rowId" useGeneratedKeys="true">
insert into t_bom_factory_split_rule(rule_group_depth, rule_group_code, rule_group_name, rule_name,
material_category_code, material_category_name, drawing_prefix, drawing_contain, drawing_suffix,
material_name_contain, material_texture, dept_row_id, dept_name, next_material_category_code,
next_material_category_name, factory_code, status, remark, created_by, created_time, updated_by, updated_time,project_type)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.ruleGroupDepth}, #{entity.ruleGroupCode}, #{entity.ruleGroupName}, #{entity.ruleName},
#{entity.materialCategoryCode}, #{entity.materialCategoryName}, #{entity.drawingPrefix},
#{entity.drawingContain}, #{entity.drawingSuffix}, #{entity.materialNameContain}, #{entity.materialTexture},
#{entity.deptRowId}, #{entity.deptName}, #{entity.nextMaterialCategoryCode},
#{entity.nextMaterialCategoryName}, #{entity.factoryCode}, #{entity.status}, #{entity.remark},
#{entity.createdBy}, #{entity.createdTime}, #{entity.updatedBy}, #{entity.updatedTime},#{entity.projectType})
</foreach>
on duplicate key update
rule_group_depth = values(rule_group_depth) , rule_group_code = values(rule_group_code) , rule_group_name =
values(rule_group_name) , rule_name = values(rule_name) , material_category_code =
values(material_category_code) , material_category_name = values(material_category_name) , drawing_prefix =
values(drawing_prefix) , drawing_contain = values(drawing_contain) , drawing_suffix = values(drawing_suffix) ,
material_name_contain = values(material_name_contain) , material_texture = values(material_texture) ,
dept_row_id = values(dept_row_id) , dept_name = values(dept_name) , next_material_category_code =
values(next_material_category_code) , next_material_category_name = values(next_material_category_name) ,
factory_code = values(factory_code) , status = values(status) , remark = values(remark) , created_by =
values(created_by) , created_time = values(created_time) , updated_by = values(updated_by) , updated_time =
values(updated_time),project_type=values(project_type)
</insert>
<select id="getList" resultType="com.nflg.product.bomnew.pojo.vo.BomFactorySplitRuleVO">
SELECT
row_id,rule_group_depth,rule_group_code, rule_group_name, rule_name,
material_category_code, material_category_name, drawing_prefix, drawing_contain, drawing_suffix,
material_name_contain, material_texture, dept_name, next_material_category_code,
next_material_category_name, factory_code, status, remark, updated_by, updated_time,project_type
FROM t_bom_factory_split_rule
ORDER BY rule_group_code,rule_group_depth ASC
</select>
</mapper>

View File

@ -1,86 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nflg.product.bomnew.mapper.master.BomFactorySplitRuleMapper">
<resultMap type="com.nflg.product.bomnew.pojo.entity.BomFactorySplitRuleEntity" id="BomFactorySplitRuleMap">
<result property="rowId" column="row_id" jdbcType="INTEGER"/>
<result property="ruleGroupDepth" column="rule_group_depth" jdbcType="INTEGER"/>
<result property="ruleGroupCode" column="rule_group_code" jdbcType="VARCHAR"/>
<result property="ruleGroupName" column="rule_group_name" jdbcType="VARCHAR"/>
<result property="ruleName" column="rule_name" jdbcType="VARCHAR"/>
<result property="materialCategoryCode" column="material_category_code" jdbcType="VARCHAR"/>
<result property="materialCategoryName" column="material_category_name" jdbcType="VARCHAR"/>
<result property="drawingPrefix" column="drawing_prefix" jdbcType="VARCHAR"/>
<result property="drawingContain" column="drawing_contain" jdbcType="VARCHAR"/>
<result property="drawingSuffix" column="drawing_suffix" jdbcType="VARCHAR"/>
<result property="materialNameContain" column="material_name_contain" jdbcType="VARCHAR"/>
<result property="materialTexture" column="material_texture" jdbcType="VARCHAR"/>
<result property="deptRowId" column="dept_row_id" jdbcType="INTEGER"/>
<result property="deptName" column="dept_name" jdbcType="VARCHAR"/>
<result property="nextMaterialCategoryCode" column="next_material_category_code" jdbcType="VARCHAR"/>
<result property="nextMaterialCategoryName" column="next_material_category_name" jdbcType="VARCHAR"/>
<result property="factoryCode" column="factory_code" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
<result property="createdBy" column="created_by" jdbcType="VARCHAR"/>
<result property="createdTime" column="created_time" jdbcType="TIMESTAMP"/>
<result property="updatedBy" column="updated_by" jdbcType="VARCHAR"/>
<result property="updatedTime" column="updated_time" jdbcType="TIMESTAMP"/>
</resultMap>
<!-- 批量插入 -->
<insert id="insertBatch" keyProperty="rowId" useGeneratedKeys="true">
insert into t_bom_factory_split_rule(rule_group_depth, rule_group_code, rule_group_name, rule_name,
material_category_code, material_category_name, drawing_prefix, drawing_contain, drawing_suffix,
material_name_contain, material_texture, dept_row_id, dept_name, next_material_category_code,
next_material_category_name, factory_code, status, remark, created_by, created_time, updated_by, updated_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.ruleGroupDepth}, #{entity.ruleGroupCode}, #{entity.ruleGroupName}, #{entity.ruleName},
#{entity.materialCategoryCode}, #{entity.materialCategoryName}, #{entity.drawingPrefix},
#{entity.drawingContain}, #{entity.drawingSuffix}, #{entity.materialNameContain}, #{entity.materialTexture},
#{entity.deptRowId}, #{entity.deptName}, #{entity.nextMaterialCategoryCode},
#{entity.nextMaterialCategoryName}, #{entity.factoryCode}, #{entity.status}, #{entity.remark},
#{entity.createdBy}, #{entity.createdTime}, #{entity.updatedBy}, #{entity.updatedTime})
</foreach>
</insert>
<!-- 批量插入或按主键更新 -->
<insert id="insertOrUpdateBatch" keyProperty="rowId" useGeneratedKeys="true">
insert into t_bom_factory_split_rule(rule_group_depth, rule_group_code, rule_group_name, rule_name,
material_category_code, material_category_name, drawing_prefix, drawing_contain, drawing_suffix,
material_name_contain, material_texture, dept_row_id, dept_name, next_material_category_code,
next_material_category_name, factory_code, status, remark, created_by, created_time, updated_by, updated_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.ruleGroupDepth}, #{entity.ruleGroupCode}, #{entity.ruleGroupName}, #{entity.ruleName},
#{entity.materialCategoryCode}, #{entity.materialCategoryName}, #{entity.drawingPrefix},
#{entity.drawingContain}, #{entity.drawingSuffix}, #{entity.materialNameContain}, #{entity.materialTexture},
#{entity.deptRowId}, #{entity.deptName}, #{entity.nextMaterialCategoryCode},
#{entity.nextMaterialCategoryName}, #{entity.factoryCode}, #{entity.status}, #{entity.remark},
#{entity.createdBy}, #{entity.createdTime}, #{entity.updatedBy}, #{entity.updatedTime})
</foreach>
on duplicate key update
rule_group_depth = values(rule_group_depth) , rule_group_code = values(rule_group_code) , rule_group_name =
values(rule_group_name) , rule_name = values(rule_name) , material_category_code =
values(material_category_code) , material_category_name = values(material_category_name) , drawing_prefix =
values(drawing_prefix) , drawing_contain = values(drawing_contain) , drawing_suffix = values(drawing_suffix) ,
material_name_contain = values(material_name_contain) , material_texture = values(material_texture) ,
dept_row_id = values(dept_row_id) , dept_name = values(dept_name) , next_material_category_code =
values(next_material_category_code) , next_material_category_name = values(next_material_category_name) ,
factory_code = values(factory_code) , status = values(status) , remark = values(remark) , created_by =
values(created_by) , created_time = values(created_time) , updated_by = values(updated_by) , updated_time =
values(updated_time)
</insert>
<select id="getList" resultType="com.nflg.product.bomnew.pojo.vo.BomFactorySplitRuleVO">
SELECT
row_id,rule_group_depth,rule_group_code, rule_group_name, rule_name,
material_category_code, material_category_name, drawing_prefix, drawing_contain, drawing_suffix,
material_name_contain, material_texture, dept_name, next_material_category_code,
next_material_category_name, factory_code, status, remark, updated_by, updated_time
FROM t_bom_factory_split_rule
ORDER BY rule_group_code,rule_group_depth ASC
</select>
</mapper>

View File

@ -29,7 +29,7 @@ public class SessionUtil {
* @return
*/
public static String getUserCode() {
return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getUserCode).orElse(null);
return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getUserCode).orElse("QMB07072700");
}
/**