更改型号规格,以适配详细设计

This commit is contained in:
刘名喜 2024-10-30 11:14:32 +08:00
parent 28ea8e77ea
commit d283e5fa5e
3 changed files with 333 additions and 175 deletions

View File

@ -140,9 +140,11 @@ public class MdItemController extends BaseController {
if (StringUtils.isNotNull(measure)) {
mdItem.setUnitName(measure.getMeasureName());
}
mdItem.setCreateBy(getUsername());
mdItemService.insertMdItem(mdItem);
barcodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_ITEM, mdItem.getItemId(), mdItem.getItemCode(), mdItem.getItemName());
return AjaxResult.success(mdItem.getItemId());
}

View File

@ -17,8 +17,10 @@ public class MdItem extends BaseEntity {
private String itemCode;
@Excel(name = "物料/产品名称")
private String itemName;
@Excel(name = "规格型号")
@Excel(name = "规格")
private String specification;
@Excel(name = "型号")
private String modelNumber;
@Excel(name = "单位编码")
private String unitOfMeasure;
@Excel(name = "单位名称")
@ -46,7 +48,7 @@ public class MdItem extends BaseEntity {
this.itemId = itemId;
}
@Size(min = 0,max = 64,message = "物料产品编码长度不能超过64个字符")
@Size(min = 0, max = 64, message = "物料产品编码长度不能超过64个字符")
public String getItemCode() {
return itemCode;
}
@ -56,7 +58,7 @@ public class MdItem extends BaseEntity {
}
@NotBlank(message = "物料产品名称不能为空")
@Size(min = 0,max = 255,message = "物料产品编码名称不能超过255个字符")
@Size(min = 0, max = 255, message = "物料产品编码名称不能超过255个字符")
public String getItemName() {
return itemName;
}
@ -65,7 +67,7 @@ public class MdItem extends BaseEntity {
this.itemName = itemName;
}
@Size(min = 0,max = 500,message = "规格型号不能超过255个字符")
@Size(min = 0, max = 500, message = "规格不能超过255个字符")
public String getSpecification() {
return specification;
}
@ -74,6 +76,15 @@ public class MdItem extends BaseEntity {
this.specification = specification;
}
@Size(min = 0, max = 500, message = "型号不能超过255个字符")
public String getModelNumber() {
return modelNumber;
}
public void setModelNumber(String modelNumber) {
this.modelNumber = modelNumber;
}
@NotBlank(message = "单位编码不能为空")
public String getUnitOfMeasure() {
return unitOfMeasure;
@ -204,6 +215,7 @@ public class MdItem extends BaseEntity {
", itemCode='" + itemCode + '\'' +
", itemName='" + itemName + '\'' +
", specification='" + specification + '\'' +
", modelNumber='" + modelNumber + '\'' +
", unitOfMeasure='" + unitOfMeasure + '\'' +
", itemOrProduct='" + itemOrProduct + '\'' +
", itemTypeId=" + itemTypeId +

View File

@ -1,186 +1,330 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ktg.mes.md.mapper.MdItemMapper">
<resultMap type="MdItem" id="MdItemResult">
<id property="itemId" column="item_id"/>
<result property="itemCode" column="item_code"/>
<result property="itemName" column="item_name"/>
<result property="specification" column="specification"/>
<result property="modelNumber" column="model_number"/>
<result property="unitOfMeasure" column="unit_of_measure"/>
<result property="unitName" column="unit_name"/>
<result property="itemOrProduct" column="item_or_product"/>
<result property="itemTypeId" column="item_type_id"/>
<result property="itemTypeCode" column="item_type_code"/>
<result property="itemTypeName" column="item_type_name"/>
<result property="enableFlag" column="enable_flag"/>
<result property="safeStockFlag" column="safe_stock_flag"/>
<result property="minStock" column="min_stock"/>
<result property="maxStock" column="max_stock"/>
<result property="highValue" column="high_value"/>
<result property="attr1" column="attr1"/>
<result property="attr2" column="attr2"/>
<result property="attr3" column="attr3"/>
<result property="attr4" column="attr4"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<resultMap type="MdItem" id="MdItemResult">
<id property="itemId" column="item_id" />
<result property="itemCode" column="item_code" />
<result property="itemName" column="item_name" />
<result property="specification" column="specification" />
<result property="unitOfMeasure" column="unit_of_measure" />
<result property="unitName" column="unit_name" />
<result property="itemOrProduct" column="item_or_product" />
<result property="itemTypeId" column="item_type_id" />
<result property="itemTypeCode" column="item_type_code" />
<result property="itemTypeName" column="item_type_name" />
<result property="enableFlag" column="enable_flag" />
<result property="safeStockFlag" column="safe_stock_flag" />
<result property="minStock" column="min_stock" />
<result property="maxStock" column="max_stock" />
<result property="highValue" column="high_value" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectMdItemVo">
select item_id, item_code, item_name, specification, unit_of_measure,unit_name, item_or_product,
item_type_id,item_type_code,item_type_name,enable_flag,safe_stock_flag,min_stock,max_stock,high_value, create_by, create_time, remark
from md_item
<sql id="selectMdItemVo">
select item_id,
item_code,
item_name,
specification,
model_number,
unit_of_measure,
unit_name,
item_or_product,
item_type_id,
item_type_code,
item_type_name,
enable_flag,
safe_stock_flag,
min_stock,
max_stock,
high_value,
create_by,
create_time,
remark
from md_item
</sql>
<select id="selectMdItemList" parameterType="MdItem" resultMap="MdItemResult">
<include refid="selectMdItemVo"/>
<where>
<if test="itemCode != null and itemCode != ''">
AND item_code like concat('%', #{itemCode}, '%')
</if>
<if test="itemTypeId != null and itemTypeId != 0 ">
AND (item_type_id = #{itemTypeId} OR item_type_id in (select item_type_id from md_item_type where find_in_set(#{itemTypeId},ancestors)))
</if>
<if test="itemName != null and itemName != ''">
AND item_name like concat('%', #{itemName}, '%')
</if>
<if test="enableFlag != null and enableFlag != ''">
AND enable_flag = #{enableFlag}
</if>
</where>
</select>
<select id="getExeportList" parameterType="MdItem" resultMap="MdItemResult">
select i.item_id, i.item_code, i.item_name, i.specification, i.unit_of_measure,i.unit_name, i.item_or_product,
i.item_type_id,i.item_type_code,i.enable_flag,i.safe_stock_flag,i.min_stock,i.max_stock,i.high_value, i.create_by, i.create_time, i.remark,CONCAT((select group_concat(item_type_name separator '/') from md_item_type b where FIND_IN_SET(CAST(item_type_id as CHAR),a.ancestors)>0),'/',a.item_type_name) as item_type_name
from md_item i
left join md_item_type a
on i.item_type_id = a.item_type_id
<where>
<if test="itemCode != null and itemCode != ''">
AND i.item_code like concat('%', #{itemCode}, '%')
</if>
<if test="itemTypeId != null and itemTypeId != 0 ">
AND (i.item_type_id = #{itemTypeId} OR i.item_type_id in (select item_type_id from md_item_type where find_in_set(#{itemTypeId},ancestors)))
</if>
<if test="itemName != null and itemName != ''">
AND i.item_name like concat('%', #{itemName}, '%')
</if>
<if test="enableFlag != null and enableFlag != ''">
AND i.enable_flag = #{enableFlag}
</if>
</where>
</select>
<select id="selectMdItemList" parameterType="MdItem" resultMap="MdItemResult">
<include refid="selectMdItemVo"/>
<where>
<if test="itemCode != null and itemCode != ''">
AND item_code like concat('%', #{itemCode}, '%')
</if>
<if test="itemTypeId != null and itemTypeId != 0">
AND (item_type_id = #{itemTypeId} OR item_type_id in (select item_type_id
from md_item_type
where find_in_set(#{itemTypeId}, ancestors)))
</if>
<if test="itemName != null and itemName != ''">
AND item_name like concat('%', #{itemName}, '%')
</if>
<if test="enableFlag != null and enableFlag != ''">
AND enable_flag = #{enableFlag}
</if>
</where>
</select>
<select id="selectMdItemAll" resultMap="MdItemResult">
<include refid="selectMdItemVo"></include>
</select>
<select id="getExeportList" parameterType="MdItem" resultMap="MdItemResult">
select i.item_id,
i.item_code,
i.item_name,
i.specification,
i.model_number,
i.unit_of_measure,
i.unit_name,
i.item_or_product,
i.item_type_id,
i.item_type_code,
i.enable_flag,
i.safe_stock_flag,
i.min_stock,
i.max_stock,
i.high_value,
i.create_by,
i.create_time,
i.remark,
CONCAT((select group_concat(item_type_name separator '/')
from md_item_type b
where FIND_IN_SET(CAST(item_type_id as CHAR), a.ancestors) > 0), '/',
a.item_type_name) as item_type_name
from md_item i
left join md_item_type a
on i.item_type_id = a.item_type_id
<where>
<if test="itemCode != null and itemCode != ''">
AND i.item_code like concat('%', #{itemCode}, '%')
</if>
<if test="itemTypeId != null and itemTypeId != 0">
AND (i.item_type_id = #{itemTypeId} OR i.item_type_id in (select item_type_id
from md_item_type
where find_in_set(#{itemTypeId}, ancestors)))
</if>
<if test="itemName != null and itemName != ''">
AND i.item_name like concat('%', #{itemName}, '%')
</if>
<if test="enableFlag != null and enableFlag != ''">
AND i.enable_flag = #{enableFlag}
</if>
</where>
</select>
<select id="selectMdItemById" parameterType="Long" resultMap="MdItemResult">
<include refid="selectMdItemVo"></include>
where item_id = #{itemId}
</select>
<select id="selectMdItemAll" resultMap="MdItemResult">
<include refid="selectMdItemVo">
</include>
</select>
<select id="checkItemCodeUnique" parameterType="MdItem" resultMap="MdItemResult">
<include refid="selectMdItemVo"/>
where item_code = #{itemCode} limit 1
</select>
<select id="selectMdItemById" parameterType="Long" resultMap="MdItemResult">
<include refid="selectMdItemVo">
</include>
where item_id = #{itemId}
</select>
<select id="checkItemNameUnique" parameterType="MdItem" resultMap="MdItemResult">
<include refid="selectMdItemVo"/>
where item_code = #{itemName} limit 1
</select>
<select id="checkItemCodeUnique" parameterType="MdItem" resultMap="MdItemResult">
<include refid="selectMdItemVo"/>
where item_code = #{itemCode} limit 1
</select>
<insert id="insertMdItem" parameterType="MdItem" useGeneratedKeys="true" keyProperty="itemId">
insert into md_item(
item_code,
item_name,
<if test="specification !=null and specification !=''">specification,</if>
unit_of_measure,
<if test="unitName != null and unitName !=''">unit_name,</if>
item_or_product,
item_type_id,
<if test="itemTypeCode !=null and itemTypeCode !=''">item_type_code,</if>
<if test="itemTypeName !=null and itemTypeName !=''">item_type_name,</if>
<if test="enableFlag !=null and enableFlag !=''">enable_flag,</if>
safe_stock_flag,
<if test="safeStockFlag =='Y'.toString()">min_stock,</if>
<if test="safeStockFlag =='Y'.toString()">max_stock,</if>
<if test="highValue !=null and highValue !=''">high_value,</if>
<if test="remark !=null and remark !=''">remark,</if>
<if test="attr1 !=null and attr1 !=''">attr1,</if>
<if test="attr2 !=null and attr2 !=''">attr2,</if>
<if test="attr3 !=null and attr3 !=0">attr3,</if>
<if test="attr4 !=null and attr4 !=0">attr4,</if>
<if test="createBy !=null and createBy !=''">create_by,</if>
create_time
)
values (
#{itemCode},
#{itemName},
<if test="specification !=null and specification !=''">#{specification},</if>
#{unitOfMeasure},
<if test="unitName != null and unitName !=''">#{unitName},</if>
#{itemOrProduct},
#{itemTypeId},
<if test="itemTypeCode !=null and itemTypeCode !=''">#{itemTypeCode},</if>
<if test="itemTypeName !=null and itemTypeName !=''">#{itemTypeName},</if>
<if test="enableFlag !=null and enableFlag !=''">#{enableFlag},</if>
#{safeStockFlag},
<if test="safeStockFlag =='Y'.toString() and minStock !=null ">#{minStock},</if>
<if test="safeStockFlag =='Y'.toString() and safeStockFlag !=null ">#{maxStock},</if>
<if test="highValue !=null and highValue !=''">#{highValue},</if>
<if test="remark !=null and remark !=''">#{remark},</if>
<if test="attr1 !=null and attr1 !=''">#{attr1},</if>
<if test="attr2 !=null and attr2 !=''">#{attr2},</if>
<if test="attr3 !=null and attr3 !=0">#{attr3},</if>
<if test="attr4 !=null and attr4 !=0">#{attr4},</if>
<if test="createBy !=null and createBy !=''">#{createBy},</if>
sysdate()
)
</insert>
<select id="checkItemNameUnique" parameterType="MdItem" resultMap="MdItemResult">
<include refid="selectMdItemVo"/>
where item_code = #{itemName} limit 1
</select>
<update id="updateMdItem" parameterType="MdItem">
update md_item
<set>
<if test="itemName !=null and itemName !=''">item_name = #{itemName},</if>
<if test="itemTypeId != null and itemTypeId != 0 "> item_type_id = #{itemTypeId},</if>
<if test="itemTypeCode !=null and itemTypeCode !=''">item_type_code = #{itemTypeCode},</if>
<if test="itemTypeName !=null and itemTypeName !=''">item_type_name = #{itemTypeName},</if>
<if test="specification !=null and specification !=''">specification = #{specification},</if>
<if test="unitOfMeasure !=null and unitOfMeasure !=''">unit_of_measure = #{unitOfMeasure},</if>
<if test="unitName != null and unitName !=''">unit_name = #{unitName},</if>
<if test="itemOrProduct !=null and itemOrProduct !=''">item_or_product = #{itemOrProduct},</if>
<if test="enableFlag !=null and enableFlag !=''">enable_flag = #{enableFlag},</if>
<if test="safeStockFlag !=null and safeStockFlag !=''">safe_stock_flag = #{safeStockFlag},</if>
<if test="minStock !=null and minStock !=''">min_stock = #{minStock},</if>
<if test="maxStock !=null and maxStock !=''">max_stock = #{maxStock},</if>
<if test="highValue !=null and highValue !=''">high_value = #{highValue},</if>
<if test="remark !=null and remark !=''">remark = #{remark},</if>
<if test="attr1 !=null and attr1 !=''">attr1=#{attr1},</if>
<if test="attr2 !=null and attr2 !=''">attr2=#{attr2},</if>
<if test="attr3 !=null and attr3 !=0">attr3=#{attr3},</if>
<if test="attr4 !=null and attr4 !=0">attr4=#{attr4},</if>
<if test="updateBy !=null and updateBy !=''">update_by=#{updateBy},</if>
update_time = sysdate()
</set>
where item_id = #{itemId}
</update>
<insert id="insertMdItem" parameterType="MdItem" useGeneratedKeys="true" keyProperty="itemId">
insert into md_item(item_code,
item_name,
<if test="specification != null and specification != ''">
specification,
</if>
<if test="modelNumber != null and modelNumber != ''">
model_number,
</if>
unit_of_measure,
<if test="unitName != null and unitName != ''">
unit_name,
</if>
item_or_product,
item_type_id,
<if test="itemTypeCode != null and itemTypeCode != ''">
item_type_code,
</if>
<if test="itemTypeName != null and itemTypeName != ''">
item_type_name,
</if>
<if test="enableFlag != null and enableFlag != ''">
enable_flag,
</if>
safe_stock_flag,
<if test="safeStockFlag == 'Y'.toString()">
min_stock,
</if>
<if test="safeStockFlag == 'Y'.toString()">
max_stock,
</if>
<if test="highValue != null and highValue != ''">
high_value,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
<if test="attr1 != null and attr1 != ''">
attr1,
</if>
<if test="attr2 != null and attr2 != ''">
attr2,
</if>
<if test="attr3 != null and attr3 != 0">
attr3,
</if>
<if test="attr4 != null and attr4 != 0">
attr4,
</if>
<if test="createBy != null and createBy != ''">
create_by,
</if>
create_time)
values (#{itemCode},
#{itemName},
<if test="specification != null and specification != ''">
#{specification},
</if>
<if test="modelNumber != null and modelNumber != ''">
#{modelNumber},
</if>
#{unitOfMeasure},
<if test="unitName != null and unitName != ''">
#{unitName},
</if>
#{itemOrProduct},
#{itemTypeId},
<if test="itemTypeCode != null and itemTypeCode != ''">
#{itemTypeCode},
</if>
<if test="itemTypeName != null and itemTypeName != ''">
#{itemTypeName},
</if>
<if test="enableFlag != null and enableFlag != ''">
#{enableFlag},
</if>
#{safeStockFlag},
<if test="safeStockFlag == 'Y'.toString() and minStock != null">
#{minStock},
</if>
<if test="safeStockFlag == 'Y'.toString() and safeStockFlag != null">
#{maxStock},
</if>
<if test="highValue != null and highValue != ''">
#{highValue},
</if>
<if test="remark != null and remark != ''">
#{remark},
</if>
<if test="attr1 != null and attr1 != ''">
#{attr1},
</if>
<if test="attr2 != null and attr2 != ''">
#{attr2},
</if>
<if test="attr3 != null and attr3 != 0">
#{attr3},
</if>
<if test="attr4 != null and attr4 != 0">
#{attr4},
</if>
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
sysdate())
</insert>
<delete id="deleteMdItemById" parameterType="Long">
delete from md_item where item_id =#{itemId}
</delete>
<update id="updateMdItem" parameterType="MdItem">
update md_item
<set>
<if test="itemName != null and itemName != ''">
item_name = #{itemName},
</if>
<if test="itemTypeId != null and itemTypeId != 0">
item_type_id = #{itemTypeId},
</if>
<if test="itemTypeCode != null and itemTypeCode != ''">
item_type_code = #{itemTypeCode},
</if>
<if test="itemTypeName != null and itemTypeName != ''">
item_type_name = #{itemTypeName},
</if>
<if test="specification != null and specification != ''">
specification = #{specification},
</if>
<if test="modelNumber != null and modelNumber != ''">
model_number = #{modelNumber},
</if>
<if test="unitOfMeasure != null and unitOfMeasure != ''">
unit_of_measure = #{unitOfMeasure},
</if>
<if test="unitName != null and unitName != ''">
unit_name = #{unitName},
</if>
<if test="itemOrProduct != null and itemOrProduct != ''">
item_or_product = #{itemOrProduct},
</if>
<if test="enableFlag != null and enableFlag != ''">
enable_flag = #{enableFlag},
</if>
<if test="safeStockFlag != null and safeStockFlag != ''">
safe_stock_flag = #{safeStockFlag},
</if>
<if test="minStock != null and minStock != ''">
min_stock = #{minStock},
</if>
<if test="maxStock != null and maxStock != ''">
max_stock = #{maxStock},
</if>
<if test="highValue != null and highValue != ''">
high_value = #{highValue},
</if>
<if test="remark != null and remark != ''">
remark = #{remark},
</if>
<if test="attr1 != null and attr1 != ''">
attr1=#{attr1},
</if>
<if test="attr2 != null and attr2 != ''">
attr2=#{attr2},
</if>
<if test="attr3 != null and attr3 != 0">
attr3=#{attr3},
</if>
<if test="attr4 != null and attr4 != 0">
attr4=#{attr4},
</if>
<if test="updateBy != null and updateBy != ''">
update_by=#{updateBy},
</if>
update_time = sysdate()
</set>
where item_id = #{itemId}
</update>
<delete id="deleteMdItemByIds" parameterType="Long">
delete from md_item where item_id in
<foreach collection="array" item="itemId" open="(" separator="," close=")" >
#{itemId}
</foreach>
</delete>
<delete id="deleteMdItemById" parameterType="Long">
delete
from md_item
where item_id = #{itemId}
</delete>
</mapper>
<delete id="deleteMdItemByIds" parameterType="Long">
delete
from md_item where item_id in
<foreach collection="array" item="itemId" open="(" separator="," close=")">
#{itemId}
</foreach>
</delete>
</mapper>