给商品和单据增加序列号和批次字段

This commit is contained in:
季圣华
2021-09-28 00:28:23 +08:00
parent 06d91f8655
commit 09b603c80e
12 changed files with 519 additions and 11 deletions

View File

@@ -20,6 +20,9 @@
<result column="tax_money" jdbcType="DECIMAL" property="taxMoney" />
<result column="tax_last_money" jdbcType="DECIMAL" property="taxLastMoney" />
<result column="material_type" jdbcType="VARCHAR" property="materialType" />
<result column="sn_list" jdbcType="VARCHAR" property="snList" />
<result column="batch_number" jdbcType="VARCHAR" property="batchNumber" />
<result column="expiration_date" jdbcType="TIMESTAMP" property="expirationDate" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
<result column="delete_flag" jdbcType="VARCHAR" property="deleteFlag" />
</resultMap>
@@ -84,7 +87,8 @@
<sql id="Base_Column_List">
id, header_id, material_id, material_extend_id, material_unit, sku, oper_number,
basic_number, unit_price, tax_unit_price, all_price, remark, depot_id, another_depot_id,
tax_rate, tax_money, tax_last_money, material_type, tenant_id, delete_flag
tax_rate, tax_money, tax_last_money, material_type, sn_list, batch_number, expiration_date,
tenant_id, delete_flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="BaseResultMap">
select
@@ -123,6 +127,7 @@
tax_unit_price, all_price, remark,
depot_id, another_depot_id, tax_rate,
tax_money, tax_last_money, material_type,
sn_list, batch_number, expiration_date,
tenant_id, delete_flag)
values (#{id,jdbcType=BIGINT}, #{headerId,jdbcType=BIGINT}, #{materialId,jdbcType=BIGINT},
#{materialExtendId,jdbcType=BIGINT}, #{materialUnit,jdbcType=VARCHAR}, #{sku,jdbcType=VARCHAR},
@@ -130,6 +135,7 @@
#{taxUnitPrice,jdbcType=DECIMAL}, #{allPrice,jdbcType=DECIMAL}, #{remark,jdbcType=VARCHAR},
#{depotId,jdbcType=BIGINT}, #{anotherDepotId,jdbcType=BIGINT}, #{taxRate,jdbcType=DECIMAL},
#{taxMoney,jdbcType=DECIMAL}, #{taxLastMoney,jdbcType=DECIMAL}, #{materialType,jdbcType=VARCHAR},
#{snList,jdbcType=VARCHAR}, #{batchNumber,jdbcType=VARCHAR}, #{expirationDate,jdbcType=TIMESTAMP},
#{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.DepotItem">
@@ -189,6 +195,15 @@
<if test="materialType != null">
material_type,
</if>
<if test="snList != null">
sn_list,
</if>
<if test="batchNumber != null">
batch_number,
</if>
<if test="expirationDate != null">
expiration_date,
</if>
<if test="tenantId != null">
tenant_id,
</if>
@@ -251,6 +266,15 @@
<if test="materialType != null">
#{materialType,jdbcType=VARCHAR},
</if>
<if test="snList != null">
#{snList,jdbcType=VARCHAR},
</if>
<if test="batchNumber != null">
#{batchNumber,jdbcType=VARCHAR},
</if>
<if test="expirationDate != null">
#{expirationDate,jdbcType=TIMESTAMP},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=BIGINT},
</if>
@@ -322,6 +346,15 @@
<if test="record.materialType != null">
material_type = #{record.materialType,jdbcType=VARCHAR},
</if>
<if test="record.snList != null">
sn_list = #{record.snList,jdbcType=VARCHAR},
</if>
<if test="record.batchNumber != null">
batch_number = #{record.batchNumber,jdbcType=VARCHAR},
</if>
<if test="record.expirationDate != null">
expiration_date = #{record.expirationDate,jdbcType=TIMESTAMP},
</if>
<if test="record.tenantId != null">
tenant_id = #{record.tenantId,jdbcType=BIGINT},
</if>
@@ -353,6 +386,9 @@
tax_money = #{record.taxMoney,jdbcType=DECIMAL},
tax_last_money = #{record.taxLastMoney,jdbcType=DECIMAL},
material_type = #{record.materialType,jdbcType=VARCHAR},
sn_list = #{record.snList,jdbcType=VARCHAR},
batch_number = #{record.batchNumber,jdbcType=VARCHAR},
expiration_date = #{record.expirationDate,jdbcType=TIMESTAMP},
tenant_id = #{record.tenantId,jdbcType=BIGINT},
delete_flag = #{record.deleteFlag,jdbcType=VARCHAR}
<if test="_parameter != null">
@@ -413,6 +449,15 @@
<if test="materialType != null">
material_type = #{materialType,jdbcType=VARCHAR},
</if>
<if test="snList != null">
sn_list = #{snList,jdbcType=VARCHAR},
</if>
<if test="batchNumber != null">
batch_number = #{batchNumber,jdbcType=VARCHAR},
</if>
<if test="expirationDate != null">
expiration_date = #{expirationDate,jdbcType=TIMESTAMP},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
@@ -441,6 +486,9 @@
tax_money = #{taxMoney,jdbcType=DECIMAL},
tax_last_money = #{taxLastMoney,jdbcType=DECIMAL},
material_type = #{materialType,jdbcType=VARCHAR},
sn_list = #{snList,jdbcType=VARCHAR},
batch_number = #{batchNumber,jdbcType=VARCHAR},
expiration_date = #{expirationDate,jdbcType=TIMESTAMP},
tenant_id = #{tenantId,jdbcType=BIGINT},
delete_flag = #{deleteFlag,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}

View File

@@ -14,11 +14,13 @@
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="img_name" jdbcType="VARCHAR" property="imgName" />
<result column="unit_id" jdbcType="BIGINT" property="unitId" />
<result column="expiry_num" jdbcType="INTEGER" property="expiryNum" />
<result column="enabled" jdbcType="BIT" property="enabled" />
<result column="other_field1" jdbcType="VARCHAR" property="otherField1" />
<result column="other_field2" jdbcType="VARCHAR" property="otherField2" />
<result column="other_field3" jdbcType="VARCHAR" property="otherField3" />
<result column="enable_serial_number" jdbcType="VARCHAR" property="enableSerialNumber" />
<result column="enable_batch_number" jdbcType="VARCHAR" property="enableBatchNumber" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
<result column="delete_flag" jdbcType="VARCHAR" property="deleteFlag" />
</resultMap>
@@ -82,8 +84,8 @@
</sql>
<sql id="Base_Column_List">
id, category_id, name, mfrs, safety_stock, model, standard, color, unit, remark,
img_name, unit_id, enabled, other_field1, other_field2, other_field3, enable_serial_number,
tenant_id, delete_flag
img_name, unit_id, expiry_num, enabled, other_field1, other_field2, other_field3,
enable_serial_number, enable_batch_number, tenant_id, delete_flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="BaseResultMap">
select
@@ -120,16 +122,18 @@
mfrs, safety_stock, model,
standard, color, unit,
remark, img_name, unit_id,
enabled, other_field1, other_field2,
other_field3, enable_serial_number, tenant_id,
delete_flag)
expiry_num, enabled, other_field1,
other_field2, other_field3, enable_serial_number,
enable_batch_number, tenant_id, delete_flag
)
values (#{id,jdbcType=BIGINT}, #{categoryId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR},
#{mfrs,jdbcType=VARCHAR}, #{safetyStock,jdbcType=DECIMAL}, #{model,jdbcType=VARCHAR},
#{standard,jdbcType=VARCHAR}, #{color,jdbcType=VARCHAR}, #{unit,jdbcType=VARCHAR},
#{remark,jdbcType=VARCHAR}, #{imgName,jdbcType=VARCHAR}, #{unitId,jdbcType=BIGINT},
#{enabled,jdbcType=BIT}, #{otherField1,jdbcType=VARCHAR}, #{otherField2,jdbcType=VARCHAR},
#{otherField3,jdbcType=VARCHAR}, #{enableSerialNumber,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT},
#{deleteFlag,jdbcType=VARCHAR})
#{expiryNum,jdbcType=INTEGER}, #{enabled,jdbcType=BIT}, #{otherField1,jdbcType=VARCHAR},
#{otherField2,jdbcType=VARCHAR}, #{otherField3,jdbcType=VARCHAR}, #{enableSerialNumber,jdbcType=VARCHAR},
#{enableBatchNumber,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.Material">
insert into jsh_material
@@ -170,6 +174,9 @@
<if test="unitId != null">
unit_id,
</if>
<if test="expiryNum != null">
expiry_num,
</if>
<if test="enabled != null">
enabled,
</if>
@@ -185,6 +192,9 @@
<if test="enableSerialNumber != null">
enable_serial_number,
</if>
<if test="enableBatchNumber != null">
enable_batch_number,
</if>
<if test="tenantId != null">
tenant_id,
</if>
@@ -229,6 +239,9 @@
<if test="unitId != null">
#{unitId,jdbcType=BIGINT},
</if>
<if test="expiryNum != null">
#{expiryNum,jdbcType=INTEGER},
</if>
<if test="enabled != null">
#{enabled,jdbcType=BIT},
</if>
@@ -244,6 +257,9 @@
<if test="enableSerialNumber != null">
#{enableSerialNumber,jdbcType=VARCHAR},
</if>
<if test="enableBatchNumber != null">
#{enableBatchNumber,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=BIGINT},
</if>
@@ -297,6 +313,9 @@
<if test="record.unitId != null">
unit_id = #{record.unitId,jdbcType=BIGINT},
</if>
<if test="record.expiryNum != null">
expiry_num = #{record.expiryNum,jdbcType=INTEGER},
</if>
<if test="record.enabled != null">
enabled = #{record.enabled,jdbcType=BIT},
</if>
@@ -312,6 +331,9 @@
<if test="record.enableSerialNumber != null">
enable_serial_number = #{record.enableSerialNumber,jdbcType=VARCHAR},
</if>
<if test="record.enableBatchNumber != null">
enable_batch_number = #{record.enableBatchNumber,jdbcType=VARCHAR},
</if>
<if test="record.tenantId != null">
tenant_id = #{record.tenantId,jdbcType=BIGINT},
</if>
@@ -337,11 +359,13 @@
remark = #{record.remark,jdbcType=VARCHAR},
img_name = #{record.imgName,jdbcType=VARCHAR},
unit_id = #{record.unitId,jdbcType=BIGINT},
expiry_num = #{record.expiryNum,jdbcType=INTEGER},
enabled = #{record.enabled,jdbcType=BIT},
other_field1 = #{record.otherField1,jdbcType=VARCHAR},
other_field2 = #{record.otherField2,jdbcType=VARCHAR},
other_field3 = #{record.otherField3,jdbcType=VARCHAR},
enable_serial_number = #{record.enableSerialNumber,jdbcType=VARCHAR},
enable_batch_number = #{record.enableBatchNumber,jdbcType=VARCHAR},
tenant_id = #{record.tenantId,jdbcType=BIGINT},
delete_flag = #{record.deleteFlag,jdbcType=VARCHAR}
<if test="_parameter != null">
@@ -384,6 +408,9 @@
<if test="unitId != null">
unit_id = #{unitId,jdbcType=BIGINT},
</if>
<if test="expiryNum != null">
expiry_num = #{expiryNum,jdbcType=INTEGER},
</if>
<if test="enabled != null">
enabled = #{enabled,jdbcType=BIT},
</if>
@@ -399,6 +426,9 @@
<if test="enableSerialNumber != null">
enable_serial_number = #{enableSerialNumber,jdbcType=VARCHAR},
</if>
<if test="enableBatchNumber != null">
enable_batch_number = #{enableBatchNumber,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
@@ -421,11 +451,13 @@
remark = #{remark,jdbcType=VARCHAR},
img_name = #{imgName,jdbcType=VARCHAR},
unit_id = #{unitId,jdbcType=BIGINT},
expiry_num = #{expiryNum,jdbcType=INTEGER},
enabled = #{enabled,jdbcType=BIT},
other_field1 = #{otherField1,jdbcType=VARCHAR},
other_field2 = #{otherField2,jdbcType=VARCHAR},
other_field3 = #{otherField3,jdbcType=VARCHAR},
enable_serial_number = #{enableSerialNumber,jdbcType=VARCHAR},
enable_batch_number = #{enableBatchNumber,jdbcType=VARCHAR},
tenant_id = #{tenantId,jdbcType=BIGINT},
delete_flag = #{deleteFlag,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}

View File

@@ -327,6 +327,14 @@
and id = #{id}
</update>
<update id="setExpiryNumToNull">
update jsh_material
set expiry_num = null
where 1=1
and ifnull(delete_flag,'0') !='1'
and id = #{id}
</update>
<select id="getListWithStock" resultMap="ResultMapListWithStock">
select m.*, me.commodity_unit unitName, mc.name categoryName, me.bar_code,
ifnull(me.purchase_decimal,0) purchase_decimal,