新增物料字典模块

修改出入库单据号逻辑
新增出入库撤销和恢复功能
This commit is contained in:
2025-08-01 09:27:07 +08:00
parent 20f6be7790
commit ef833bec2f
18 changed files with 788 additions and 230 deletions

View File

@@ -1,66 +1,97 @@
<?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">
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zg.project.information.mapper.MtdMapper">
<resultMap id="MtdResultMap" type="com.zg.project.information.domain.Mtd">
<id property="id" column="id"/>
<result property="mid" column="mid"/>
<result property="desMat" column="des_mat"/>
<result property="grp" column="grp"/>
<result property="unt" column="unt"/>
<result property="uprc" column="uprc"/>
<result property="btpe" column="btpe"/>
<result property="mtpe" column="mtpe"/>
<result property="stpe" column="stpe"/>
<resultMap type="Mtd" id="MtdResult">
<result property="Id" column="Id" />
<result property="mid" column="mid" />
<result property="desMat" column="des_mat" />
<result property="grp" column="grp" />
<result property="unt" column="unt" />
<result property="uprc" column="uprc" />
<result property="btpe" column="btpe" />
<result property="mtpe" column="mtpe" />
<result property="stpe" column="stpe" />
</resultMap>
<select id="selectMtdById" parameterType="Long" resultMap="MtdResultMap">
SELECT * FROM mtd WHERE id = #{id}
</select>
<sql id="selectMtdVo">
select Id, mid, des_mat, grp, unt, uprc, btpe, mtpe, stpe from mtd
</sql>
<select id="selectMtdList" parameterType="Mtd" resultMap="MtdResultMap">
SELECT * FROM mtd
<select id="selectMtdList" parameterType="Mtd" resultMap="MtdResult">
<include refid="selectMtdVo"/>
<where>
<if test="mid != null and mid != ''">AND mid = #{mid}</if>
<if test="desMat != null and desMat != ''">AND des_mat like concat('%', #{desMat}, '%')</if>
<if test="grp != null and grp != ''">AND grp = #{grp}</if>
<if test="unt != null and unt != ''">AND unt = #{unt}</if>
<if test="mid != null and mid != ''"> AND mid LIKE CONCAT('%', #{mid}, '%')</if>
<if test="desMat != null and desMat != ''"> AND des_mat LIKE CONCAT('%', #{desMat}, '%')</if>
<if test="grp != null and grp != ''"> AND grp LIKE CONCAT('%', #{grp}, '%')</if>
<if test="unt != null and unt != ''"> AND unt LIKE CONCAT('%', #{unt}, '%')</if>
<if test="uprc != null and uprc != ''"> AND uprc LIKE CONCAT('%', #{uprc}, '%')</if>
<if test="btpe != null and btpe != ''"> AND btpe LIKE CONCAT('%', #{btpe}, '%')</if>
<if test="mtpe != null and mtpe != ''"> AND mtpe LIKE CONCAT('%', #{mtpe}, '%')</if>
<if test="stpe != null and stpe != ''"> AND stpe LIKE CONCAT('%', #{stpe}, '%')</if>
</where>
</select>
<select id="selectMtdById" parameterType="Long" resultMap="MtdResult">
<include refid="selectMtdVo"/>
where Id = #{Id}
</select>
<select id="selectWlmsByWlbh" resultType="java.lang.String" parameterType="java.lang.String">
SELECT des_mat FROM mtd WHERE mid = #{materialCode}
SELECT des_mat
FROM mtd
WHERE mid = #{materialCode}
</select>
<insert id="insertMtd" parameterType="Mtd">
INSERT INTO mtd (mid, des_mat, grp, unt, uprc, btpe, mtpe, stpe)
VALUES (#{mid}, #{desMat}, #{grp}, #{unt}, #{uprc}, #{btpe}, #{mtpe}, #{stpe})
<insert id="insertMtd" parameterType="Mtd" useGeneratedKeys="true" keyProperty="Id">
insert into mtd
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="mid != null">mid,</if>
<if test="desMat != null">des_mat,</if>
<if test="grp != null">grp,</if>
<if test="unt != null">unt,</if>
<if test="uprc != null">uprc,</if>
<if test="btpe != null">btpe,</if>
<if test="mtpe != null">mtpe,</if>
<if test="stpe != null">stpe,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="mid != null">#{mid},</if>
<if test="desMat != null">#{desMat},</if>
<if test="grp != null">#{grp},</if>
<if test="unt != null">#{unt},</if>
<if test="uprc != null">#{uprc},</if>
<if test="btpe != null">#{btpe},</if>
<if test="mtpe != null">#{mtpe},</if>
<if test="stpe != null">#{stpe},</if>
</trim>
</insert>
<update id="updateMtd" parameterType="Mtd">
UPDATE mtd
SET mid = #{mid},
des_mat = #{desMat},
grp = #{grp},
unt = #{unt},
uprc = #{uprc},
btpe = #{btpe},
mtpe = #{mtpe},
stpe = #{stpe}
WHERE id = #{id}
update mtd
<trim prefix="SET" suffixOverrides=",">
<if test="mid != null">mid = #{mid},</if>
<if test="desMat != null">des_mat = #{desMat},</if>
<if test="grp != null">grp = #{grp},</if>
<if test="unt != null">unt = #{unt},</if>
<if test="uprc != null">uprc = #{uprc},</if>
<if test="btpe != null">btpe = #{btpe},</if>
<if test="mtpe != null">mtpe = #{mtpe},</if>
<if test="stpe != null">stpe = #{stpe},</if>
</trim>
where Id = #{Id}
</update>
<delete id="deleteMtdById" parameterType="Long">
DELETE FROM mtd WHERE id = #{id}
delete from mtd where Id = #{Id}
</delete>
<delete id="deleteMtdByIds" parameterType="Long">
DELETE FROM mtd WHERE id IN
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
<delete id="deleteMtdByIds" parameterType="String">
delete from mtd where Id in
<foreach item="Id" collection="array" open="(" separator="," close=")">
#{Id}
</foreach>
</delete>
</mapper>
</mapper>

View File

@@ -37,13 +37,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectGysJhList" parameterType="GysJh" resultMap="GysJhResult">
<include refid="selectGysJhVo"/>
<where>
<if test="xmNo != null and xmNo != ''"> and xm_no like concat('%', #{xmNo}, '%')</if>
<if test="wlNo != null and wlNo != ''"> and wl_no like concat('%', #{wlNo}, '%')</if>
<if test="gysMc != null and gysMc != ''"> and gys_mc like concat('%', #{gysMc}, '%')</if>
<if test="sapNo != null and sapNo != ''"> and sap_no like concat('%', #{sapNo}, '%')</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="isDelete != null and isDelete != ''"> and is_delete = #{isDelete}</if>
<where>
<if test="xmNo != null and xmNo != ''">
and xm_no like concat('%', #{xmNo}, '%')
</if>
<if test="xmMs != null and xmMs != ''">
and xm_ms like concat('%', #{xmMs}, '%')
</if>
<if test="wlNo != null and wlNo != ''">
and wl_no like concat('%', #{wlNo}, '%')
</if>
<if test="wlMs != null and wlMs != ''">
and wl_ms like concat('%', #{wlMs}, '%')
</if>
<if test="gysMc != null and gysMc != ''">
and gys_mc like concat('%', #{gysMc}, '%')
</if>
<if test="sapNo != null and sapNo != ''">
and sap_no like concat('%', #{sapNo}, '%')
</if>
<if test="status != null and status != ''">
and status = #{status}
</if>
<if test="isDelete != null and isDelete != ''">
and is_delete = #{isDelete}
</if>
</where>
</select>

View File

@@ -74,7 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ri.ly_time,
ri.borrow_time, ri.return_time,
ri.xj, ri.xm_no, ri.xm_ms, ri.wl_no, ri.wl_ms,ri.xm_no_ck, ri.xm_ms_ck,
ri.gys_no, ri.gys_mc, ri.jh_amt, ri.ht_dj, ri.sap_no, ri.xh,
ri.gys_no, ri.gys_mc, ri.jh_amt, ri.ht_dj, ri.sap_no, ri.xh,ri.gys_jh_id,
ri.jh_qty, ri.ht_qty, ri.dw, ri.real_qty,
ri.pcode, ri.pcode_id, ri.tray_code, ri.entity_id,
ri.create_by, ri.create_time, ri.update_by, ri.update_time, ri.is_delete,
@@ -166,34 +166,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectRkInfoList" parameterType="RkInfo" resultMap="RkInfoResult">
<include refid="selectRkInfoVo"/>
<where>
<if test="isChuku != null and isChuku != ''">
and is_chuku = #{isChuku}
</if>
<choose>
<when test="isChukuList != null and isChukuList.size > 0">
AND ri.is_chuku IN
<foreach collection="isChukuList" item="val" open="(" separator="," close=")">
#{val}
</foreach>
</when>
<when test="isChuku != null and isChuku != ''">
AND ri.is_chuku = #{isChuku}
</when>
</choose>
<if test="keyword != null and keyword != ''">
and (
xm_no like concat('%', #{keyword}, '%')
or xm_ms like concat('%', #{keyword}, '%')
or wl_no like concat('%', #{keyword}, '%')
or wl_ms like concat('%', #{keyword}, '%')
or gys_no like concat('%', #{keyword}, '%')
or gys_mc like concat('%', #{keyword}, '%')
or sap_no like concat('%', #{keyword}, '%')
or bill_no like concat('%', #{keyword}, '%')
or bill_no_ck like concat('%', #{keyword}, '%')
or ck_type like concat('%', #{keyword}, '%')
or pcode like concat('%', #{keyword}, '%')
AND (
ri.xm_no like concat('%', #{keyword}, '%')
or ri.xm_ms like concat('%', #{keyword}, '%')
or ri.wl_no like concat('%', #{keyword}, '%')
or ri.wl_ms like concat('%', #{keyword}, '%')
or ri.gys_no like concat('%', #{keyword}, '%')
or ri.gys_mc like concat('%', #{keyword}, '%')
or ri.sap_no like concat('%', #{keyword}, '%')
or ri.bill_no like concat('%', #{keyword}, '%')
or ri.bill_no_ck like concat('%', #{keyword}, '%')
or ri.ck_type like concat('%', #{keyword}, '%')
or ri.pcode like concat('%', #{keyword}, '%')
)
</if>
<if test="rkType != null and rkType != ''">
and rk_type like concat('%', #{rkType}, '%')
AND ri.rk_type like concat('%', #{rkType}, '%')
</if>
<if test="wlType != null and wlType != ''">
and wl_type like concat('%', #{wlType}, '%')
AND ri.wl_type like concat('%', #{wlType}, '%')
</if>
<if test="cangku != null and cangku != ''">
and cangku like concat('%', #{cangku}, '%')
AND ri.cangku like concat('%', #{cangku}, '%')
</if>
<if test="ids != null and ids.size > 0">
@@ -204,100 +212,109 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
<if test="startTime != null">
<![CDATA[ and rk_time >= #{startTime} ]]>
<![CDATA[ AND ri.rk_time >= #{startTime} ]]>
</if>
<if test="endTime != null">
<![CDATA[ and rk_time <= #{endTime} ]]>
<![CDATA[ AND ri.rk_time <= #{endTime} ]]>
</if>
<if test="lyStartTime != null">
<![CDATA[ AND ri.ly_time >= #{lyStartTime} ]]>
</if>
<if test="lyEndTime != null">
<![CDATA[ AND ri.ly_time <= #{lyEndTime} ]]>
</if>
<if test="lihuoY != null and lihuoY != ''">
and lihuo_y like concat('%', #{lihuoY}, '%')
AND ri.lihuo_y like concat('%', #{lihuoY}, '%')
</if>
<if test="xj != null and xj != ''">
and xj like concat('%', #{xj}, '%')
AND ri.xj like concat('%', #{xj}, '%')
</if>
<if test="billNo != null and billNo != ''">
and bill_no like concat('%', #{billNo}, '%')
AND ri.bill_no like concat('%', #{billNo}, '%')
</if>
<if test="billNoCk != null and billNoCk != ''">
and bill_no_ck like concat('%', #{billNoCk}, '%')
AND ri.bill_no_ck like concat('%', #{billNoCk}, '%')
</if>
<if test="xmNo != null and xmNo != ''">
and xm_no like concat('%', #{xmNo}, '%')
AND ri.xm_no like concat('%', #{xmNo}, '%')
</if>
<if test="xmMs != null and xmMs != ''">
and xm_ms like concat('%', #{xmMs}, '%')
AND ri.xm_ms like concat('%', #{xmMs}, '%')
</if>
<if test="wlNo != null and wlNo != ''">
and wl_no like concat('%', #{wlNo}, '%')
AND ri.wl_no like concat('%', #{wlNo}, '%')
</if>
<if test="wlMs != null and wlMs != ''">
and wl_ms like concat('%', #{wlMs}, '%')
AND ri.wl_ms like concat('%', #{wlMs}, '%')
</if>
<if test="gysNo != null and gysNo != ''">
and gys_no like concat('%', #{gysNo}, '%')
AND ri.gys_no like concat('%', #{gysNo}, '%')
</if>
<if test="gysMc != null and gysMc != ''">
and gys_mc like concat('%', #{gysMc}, '%')
AND ri.gys_mc like concat('%', #{gysMc}, '%')
</if>
<if test="jhAmt != null">
and jh_amt = #{jhAmt}
AND ri.jh_amt = #{jhAmt}
</if>
<if test="htDj != null">
and ht_dj = #{htDj}
AND ri.ht_dj = #{htDj}
</if>
<if test="sapNo != null and sapNo != ''">
and sap_no like concat('%', #{sapNo}, '%')
AND ri.sap_no like concat('%', #{sapNo}, '%')
</if>
<if test="xh != null and xh != ''">
and xh like concat('%', #{xh}, '%')
AND ri.xh like concat('%', #{xh}, '%')
</if>
<if test="jhQty != null">
and jh_qty = #{jhQty}
AND ri.jh_qty = #{jhQty}
</if>
<if test="htQty != null">
and ht_qty = #{htQty}
AND ri.ht_qty = #{htQty}
</if>
<if test="dw != null and dw != ''">
and dw like concat('%', #{dw}, '%')
AND ri.dw like concat('%', #{dw}, '%')
</if>
<if test="realQty != null">
and real_qty = #{realQty}
AND ri.real_qty = #{realQty}
</if>
<if test="pcode != null and pcode != ''">
and pcode like concat('%', #{pcode}, '%')
AND ri.pcode like concat('%', #{pcode}, '%')
</if>
<if test="lyTime != null">
and ri.ly_time = #{lyTime}
AND ri.ly_time = #{lyTime}
</if>
<if test="returnTime != null">
and ri.return_time = #{returnTime}
AND ri.return_time = #{returnTime}
</if>
<if test="trayCode != null and trayCode != ''">
and tray_code like concat('%', #{trayCode}, '%')
AND ri.tray_code like concat('%', #{trayCode}, '%')
</if>
<if test="entityId != null and entityId != ''">
and entity_id like concat('%', #{entityId}, '%')
AND ri.entity_id like concat('%', #{entityId}, '%')
</if>
<if test="ckType != null and ckType != ''">
and ck_type like concat('%', #{ckType}, '%')
AND ri.ck_type like concat('%', #{ckType}, '%')
</if>
<if test="isDelete != null and isDelete != ''">
and ri.is_delete = #{isDelete}
</if>
<if test="isDelete == null or isDelete == ''">
and ri.is_delete = 0
</if>
<choose>
<when test="isDelete != null and isDelete != ''">
AND ri.is_delete = #{isDelete}
</when>
<otherwise>
AND ri.is_delete = 0
</otherwise>
</choose>
</where>
order by rk_time desc
ORDER BY ri.rk_time DESC
</select>
<select id="selectRkInfoById" parameterType="Long" resultMap="RkInfoResult">
<include refid="selectRkInfoVo"/>
where ri.id = #{id} and ri.is_delete = 0
@@ -470,6 +487,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND bill_no_ck = #{billNo}
</select>
<select id="selectRkInfoByIds" resultMap="RkInfoResult">
SELECT * FROM rk_info
WHERE is_delete = '0'
AND id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<update id="updateRkInfo" parameterType="RkInfo">
update rk_info
<trim prefix="SET" suffixOverrides=",">