优化安全库存,调整为每个仓库的安全库存
This commit is contained in:
@@ -421,10 +421,11 @@
|
||||
<select id="findStockWarningCount" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultStockWarningCount">
|
||||
select m.id MId, m.name MName, me.bar_code, m.mfrs MMfrs, m.model MModel, m.standard MStandard,m.color MColor,
|
||||
m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3,
|
||||
m.unit MaterialUnit, u.name unit_name,mcs.current_number,ifnull(m.safety_stock,0) safetystock,
|
||||
(ifnull(m.safety_stock,0)-mcs.current_number) linjieNumber
|
||||
m.unit MaterialUnit, u.name unit_name,mcs.current_number,ifnull(mis.low_safe_stock,0) safetystock,
|
||||
(ifnull(mis.low_safe_stock,0)-mcs.current_number) linjieNumber
|
||||
from jsh_material m
|
||||
left join jsh_material_extend me on me.material_id=m.id and ifnull(me.delete_Flag,'0') !='1'
|
||||
left join jsh_material_initial_stock mis on mis.material_id=m.id and ifnull(mis.delete_Flag,'0') !='1'
|
||||
left join jsh_material_current_stock mcs on mcs.material_id=m.id and ifnull(mcs.delete_Flag,'0') !='1'
|
||||
left join jsh_depot_item di on di.material_id=m.id and ifnull(di.delete_Flag,'0') !='1'
|
||||
left join jsh_depot_head dh on di.header_id=dh.id and ifnull(dh.delete_flag,'0') !='1'
|
||||
@@ -432,7 +433,7 @@
|
||||
where 1=1
|
||||
and me.default_flag=1
|
||||
and ifnull(m.delete_flag,'0') !='1'
|
||||
and ifnull(m.safety_stock,0) > mcs.current_number
|
||||
and ifnull(mis.low_safe_stock,0) > mcs.current_number
|
||||
<if test="materialParam != null and materialParam !=''">
|
||||
<bind name="bindKey" value="'%'+materialParam+'%'"/>
|
||||
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
|
||||
@@ -452,6 +453,7 @@
|
||||
(select m.id
|
||||
from jsh_material m
|
||||
left join jsh_material_extend me on me.material_id=m.id and ifnull(me.delete_Flag,'0') !='1'
|
||||
left join jsh_material_initial_stock mis on mis.material_id=m.id and ifnull(mis.delete_Flag,'0') !='1'
|
||||
left join jsh_material_current_stock mcs on mcs.material_id=m.id and ifnull(mcs.delete_Flag,'0') !='1'
|
||||
left join jsh_depot_item di on di.material_id=m.id and ifnull(di.delete_Flag,'0') !='1'
|
||||
left join jsh_depot_head dh on di.header_id=dh.id and ifnull(dh.delete_flag,'0') !='1'
|
||||
@@ -459,7 +461,7 @@
|
||||
where 1=1
|
||||
and me.default_flag=1
|
||||
and ifnull(m.delete_flag,'0') !='1'
|
||||
and ifnull(m.safety_stock,0) > mcs.current_number
|
||||
and ifnull(mis.low_safe_stock,0) > mcs.current_number
|
||||
<if test="materialParam != null and materialParam !=''">
|
||||
<bind name="bindKey" value="'%'+materialParam+'%'"/>
|
||||
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
<result column="material_id" jdbcType="BIGINT" property="materialId" />
|
||||
<result column="depot_id" jdbcType="BIGINT" property="depotId" />
|
||||
<result column="number" jdbcType="DECIMAL" property="number" />
|
||||
<result column="low_safe_stock" jdbcType="DECIMAL" property="lowSafeStock" />
|
||||
<result column="high_safe_stock" jdbcType="DECIMAL" property="highSafeStock" />
|
||||
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
|
||||
<result column="delete_flag" jdbcType="VARCHAR" property="deleteFlag" />
|
||||
</resultMap>
|
||||
@@ -68,7 +70,7 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, material_id, depot_id, number, tenant_id, delete_flag
|
||||
id, material_id, depot_id, number, low_safe_stock, high_safe_stock, tenant_id, delete_flag
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.MaterialInitialStockExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@@ -102,11 +104,11 @@
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.MaterialInitialStock">
|
||||
insert into jsh_material_initial_stock (id, material_id, depot_id,
|
||||
number, tenant_id, delete_flag
|
||||
)
|
||||
number, low_safe_stock, high_safe_stock,
|
||||
tenant_id, delete_flag)
|
||||
values (#{id,jdbcType=BIGINT}, #{materialId,jdbcType=BIGINT}, #{depotId,jdbcType=BIGINT},
|
||||
#{number,jdbcType=DECIMAL}, #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR}
|
||||
)
|
||||
#{number,jdbcType=DECIMAL}, #{lowSafeStock,jdbcType=DECIMAL}, #{highSafeStock,jdbcType=DECIMAL},
|
||||
#{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.MaterialInitialStock">
|
||||
insert into jsh_material_initial_stock
|
||||
@@ -123,6 +125,12 @@
|
||||
<if test="number != null">
|
||||
number,
|
||||
</if>
|
||||
<if test="lowSafeStock != null">
|
||||
low_safe_stock,
|
||||
</if>
|
||||
<if test="highSafeStock != null">
|
||||
high_safe_stock,
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
tenant_id,
|
||||
</if>
|
||||
@@ -143,6 +151,12 @@
|
||||
<if test="number != null">
|
||||
#{number,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="lowSafeStock != null">
|
||||
#{lowSafeStock,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="highSafeStock != null">
|
||||
#{highSafeStock,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
#{tenantId,jdbcType=BIGINT},
|
||||
</if>
|
||||
@@ -172,6 +186,12 @@
|
||||
<if test="record.number != null">
|
||||
number = #{record.number,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="record.lowSafeStock != null">
|
||||
low_safe_stock = #{record.lowSafeStock,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="record.highSafeStock != null">
|
||||
high_safe_stock = #{record.highSafeStock,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="record.tenantId != null">
|
||||
tenant_id = #{record.tenantId,jdbcType=BIGINT},
|
||||
</if>
|
||||
@@ -189,6 +209,8 @@
|
||||
material_id = #{record.materialId,jdbcType=BIGINT},
|
||||
depot_id = #{record.depotId,jdbcType=BIGINT},
|
||||
number = #{record.number,jdbcType=DECIMAL},
|
||||
low_safe_stock = #{record.lowSafeStock,jdbcType=DECIMAL},
|
||||
high_safe_stock = #{record.highSafeStock,jdbcType=DECIMAL},
|
||||
tenant_id = #{record.tenantId,jdbcType=BIGINT},
|
||||
delete_flag = #{record.deleteFlag,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
@@ -207,6 +229,12 @@
|
||||
<if test="number != null">
|
||||
number = #{number,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="lowSafeStock != null">
|
||||
low_safe_stock = #{lowSafeStock,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="highSafeStock != null">
|
||||
high_safe_stock = #{highSafeStock,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
tenant_id = #{tenantId,jdbcType=BIGINT},
|
||||
</if>
|
||||
@@ -221,6 +249,8 @@
|
||||
set material_id = #{materialId,jdbcType=BIGINT},
|
||||
depot_id = #{depotId,jdbcType=BIGINT},
|
||||
number = #{number,jdbcType=DECIMAL},
|
||||
low_safe_stock = #{lowSafeStock,jdbcType=DECIMAL},
|
||||
high_safe_stock = #{highSafeStock,jdbcType=DECIMAL},
|
||||
tenant_id = #{tenantId,jdbcType=BIGINT},
|
||||
delete_flag = #{deleteFlag,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
<result column="category_id" jdbcType="BIGINT" property="categoryId" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="mfrs" jdbcType="VARCHAR" property="mfrs" />
|
||||
<result column="safety_stock" jdbcType="DECIMAL" property="safetyStock" />
|
||||
<result column="model" jdbcType="VARCHAR" property="model" />
|
||||
<result column="standard" jdbcType="VARCHAR" property="standard" />
|
||||
<result column="color" jdbcType="VARCHAR" property="color" />
|
||||
@@ -15,6 +14,7 @@
|
||||
<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="weight" jdbcType="DECIMAL" property="weight" />
|
||||
<result column="enabled" jdbcType="BIT" property="enabled" />
|
||||
<result column="other_field1" jdbcType="VARCHAR" property="otherField1" />
|
||||
<result column="other_field2" jdbcType="VARCHAR" property="otherField2" />
|
||||
@@ -83,9 +83,9 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, category_id, name, mfrs, safety_stock, model, standard, color, unit, remark,
|
||||
img_name, unit_id, expiry_num, enabled, other_field1, other_field2, other_field3,
|
||||
enable_serial_number, enable_batch_number, tenant_id, delete_flag
|
||||
id, category_id, name, mfrs, model, standard, color, unit, remark, img_name, unit_id,
|
||||
expiry_num, weight, 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
|
||||
@@ -119,18 +119,18 @@
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.Material">
|
||||
insert into jsh_material (id, category_id, name,
|
||||
mfrs, safety_stock, model,
|
||||
standard, color, unit,
|
||||
remark, img_name, unit_id,
|
||||
expiry_num, enabled, other_field1,
|
||||
mfrs, model, standard,
|
||||
color, unit, remark,
|
||||
img_name, unit_id, expiry_num,
|
||||
weight, 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},
|
||||
#{expiryNum,jdbcType=INTEGER}, #{enabled,jdbcType=BIT}, #{otherField1,jdbcType=VARCHAR},
|
||||
#{mfrs,jdbcType=VARCHAR}, #{model,jdbcType=VARCHAR}, #{standard,jdbcType=VARCHAR},
|
||||
#{color,jdbcType=VARCHAR}, #{unit,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
|
||||
#{imgName,jdbcType=VARCHAR}, #{unitId,jdbcType=BIGINT}, #{expiryNum,jdbcType=INTEGER},
|
||||
#{weight,jdbcType=DECIMAL}, #{enabled,jdbcType=BIT}, #{otherField1,jdbcType=VARCHAR},
|
||||
#{otherField2,jdbcType=VARCHAR}, #{otherField3,jdbcType=VARCHAR}, #{enableSerialNumber,jdbcType=VARCHAR},
|
||||
#{enableBatchNumber,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR}
|
||||
)
|
||||
@@ -150,9 +150,6 @@
|
||||
<if test="mfrs != null">
|
||||
mfrs,
|
||||
</if>
|
||||
<if test="safetyStock != null">
|
||||
safety_stock,
|
||||
</if>
|
||||
<if test="model != null">
|
||||
model,
|
||||
</if>
|
||||
@@ -177,6 +174,9 @@
|
||||
<if test="expiryNum != null">
|
||||
expiry_num,
|
||||
</if>
|
||||
<if test="weight != null">
|
||||
weight,
|
||||
</if>
|
||||
<if test="enabled != null">
|
||||
enabled,
|
||||
</if>
|
||||
@@ -215,9 +215,6 @@
|
||||
<if test="mfrs != null">
|
||||
#{mfrs,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="safetyStock != null">
|
||||
#{safetyStock,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="model != null">
|
||||
#{model,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -242,6 +239,9 @@
|
||||
<if test="expiryNum != null">
|
||||
#{expiryNum,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="weight != null">
|
||||
#{weight,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="enabled != null">
|
||||
#{enabled,jdbcType=BIT},
|
||||
</if>
|
||||
@@ -289,9 +289,6 @@
|
||||
<if test="record.mfrs != null">
|
||||
mfrs = #{record.mfrs,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.safetyStock != null">
|
||||
safety_stock = #{record.safetyStock,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="record.model != null">
|
||||
model = #{record.model,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -316,6 +313,9 @@
|
||||
<if test="record.expiryNum != null">
|
||||
expiry_num = #{record.expiryNum,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.weight != null">
|
||||
weight = #{record.weight,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="record.enabled != null">
|
||||
enabled = #{record.enabled,jdbcType=BIT},
|
||||
</if>
|
||||
@@ -351,7 +351,6 @@
|
||||
category_id = #{record.categoryId,jdbcType=BIGINT},
|
||||
name = #{record.name,jdbcType=VARCHAR},
|
||||
mfrs = #{record.mfrs,jdbcType=VARCHAR},
|
||||
safety_stock = #{record.safetyStock,jdbcType=DECIMAL},
|
||||
model = #{record.model,jdbcType=VARCHAR},
|
||||
standard = #{record.standard,jdbcType=VARCHAR},
|
||||
color = #{record.color,jdbcType=VARCHAR},
|
||||
@@ -360,6 +359,7 @@
|
||||
img_name = #{record.imgName,jdbcType=VARCHAR},
|
||||
unit_id = #{record.unitId,jdbcType=BIGINT},
|
||||
expiry_num = #{record.expiryNum,jdbcType=INTEGER},
|
||||
weight = #{record.weight,jdbcType=DECIMAL},
|
||||
enabled = #{record.enabled,jdbcType=BIT},
|
||||
other_field1 = #{record.otherField1,jdbcType=VARCHAR},
|
||||
other_field2 = #{record.otherField2,jdbcType=VARCHAR},
|
||||
@@ -384,9 +384,6 @@
|
||||
<if test="mfrs != null">
|
||||
mfrs = #{mfrs,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="safetyStock != null">
|
||||
safety_stock = #{safetyStock,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="model != null">
|
||||
model = #{model,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -411,6 +408,9 @@
|
||||
<if test="expiryNum != null">
|
||||
expiry_num = #{expiryNum,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="weight != null">
|
||||
weight = #{weight,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="enabled != null">
|
||||
enabled = #{enabled,jdbcType=BIT},
|
||||
</if>
|
||||
@@ -443,7 +443,6 @@
|
||||
set category_id = #{categoryId,jdbcType=BIGINT},
|
||||
name = #{name,jdbcType=VARCHAR},
|
||||
mfrs = #{mfrs,jdbcType=VARCHAR},
|
||||
safety_stock = #{safetyStock,jdbcType=DECIMAL},
|
||||
model = #{model,jdbcType=VARCHAR},
|
||||
standard = #{standard,jdbcType=VARCHAR},
|
||||
color = #{color,jdbcType=VARCHAR},
|
||||
@@ -452,6 +451,7 @@
|
||||
img_name = #{imgName,jdbcType=VARCHAR},
|
||||
unit_id = #{unitId,jdbcType=BIGINT},
|
||||
expiry_num = #{expiryNum,jdbcType=INTEGER},
|
||||
weight = #{weight,jdbcType=DECIMAL},
|
||||
enabled = #{enabled,jdbcType=BIT},
|
||||
other_field1 = #{otherField1,jdbcType=VARCHAR},
|
||||
other_field2 = #{otherField2,jdbcType=VARCHAR},
|
||||
|
||||
Reference in New Issue
Block a user