入库模块开发

This commit is contained in:
2025-06-09 15:16:00 +08:00
parent e27d187b7a
commit 4d6d670bf4
31 changed files with 2123 additions and 30 deletions

View File

@@ -0,0 +1,86 @@
<?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.zg.project.information.mapper.ConstructionTeamMapper">
<resultMap type="ConstructionTeam" id="ConstructionTeamResult">
<result property="id" column="id" />
<result property="teamName" column="team_name" />
<result property="teamCode" column="team_code" />
<result property="createdBy" column="created_by" />
<result property="createdAt" column="created_at" />
<result property="updatedBy" column="updated_by" />
<result property="updatedAt" column="updated_at" />
<result property="isDelete" column="is_delete" />
</resultMap>
<sql id="selectConstructionTeamVo">
select id, team_name, team_code, created_by, created_at, updated_by, updated_at, is_delete from construction_team
</sql>
<select id="selectConstructionTeamList" parameterType="ConstructionTeam" resultMap="ConstructionTeamResult">
<include refid="selectConstructionTeamVo"/>
<where>
<if test="teamName != null and teamName != ''"> and team_name like concat('%', #{teamName}, '%')</if>
<if test="teamCode != null and teamCode != ''"> and team_code = #{teamCode}</if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if>
<if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if>
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
<if test="isDelete != null and isDelete != ''"> and is_delete = #{isDelete}</if>
</where>
</select>
<select id="selectConstructionTeamById" parameterType="Long" resultMap="ConstructionTeamResult">
<include refid="selectConstructionTeamVo"/>
where id = #{id}
</select>
<insert id="insertConstructionTeam" parameterType="ConstructionTeam" useGeneratedKeys="true" keyProperty="id">
insert into construction_team
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="teamName != null and teamName != ''">team_name,</if>
<if test="teamCode != null and teamCode != ''">team_code,</if>
<if test="createdBy != null">created_by,</if>
<if test="createdAt != null">created_at,</if>
<if test="updatedBy != null">updated_by,</if>
<if test="updatedAt != null">updated_at,</if>
<if test="isDelete != null">is_delete,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="teamName != null and teamName != ''">#{teamName},</if>
<if test="teamCode != null and teamCode != ''">#{teamCode},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedAt != null">#{updatedAt},</if>
<if test="isDelete != null">#{isDelete},</if>
</trim>
</insert>
<update id="updateConstructionTeam" parameterType="ConstructionTeam">
update construction_team
<trim prefix="SET" suffixOverrides=",">
<if test="teamName != null and teamName != ''">team_name = #{teamName},</if>
<if test="teamCode != null and teamCode != ''">team_code = #{teamCode},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteConstructionTeamById" parameterType="Long">
delete from construction_team where id = #{id}
</delete>
<delete id="deleteConstructionTeamByIds" parameterType="String">
delete from construction_team where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,86 @@
<?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.zg.project.information.mapper.StockOutTypeMapper">
<resultMap type="StockOutType" id="StockOutTypeResult">
<result property="id" column="id" />
<result property="ckTypeName" column="ck_type_name" />
<result property="ckTypeCode" column="ck_type_code" />
<result property="createdBy" column="created_by" />
<result property="createdAt" column="created_at" />
<result property="updatedBy" column="updated_by" />
<result property="updatedAt" column="updated_at" />
<result property="isDelete" column="is_delete" />
</resultMap>
<sql id="selectStockOutTypeVo">
select id, ck_type_name, ck_type_code, created_by, created_at, updated_by, updated_at, is_delete from stock_out_type
</sql>
<select id="selectStockOutTypeList" parameterType="StockOutType" resultMap="StockOutTypeResult">
<include refid="selectStockOutTypeVo"/>
<where>
<if test="ckTypeName != null and ckTypeName != ''"> and ck_type_name like concat('%', #{ckTypeName}, '%')</if>
<if test="ckTypeCode != null and ckTypeCode != ''"> and ck_type_code = #{ckTypeCode}</if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if>
<if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if>
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
<if test="isDelete != null and isDelete != ''"> and is_delete = #{isDelete}</if>
</where>
</select>
<select id="selectStockOutTypeById" parameterType="Long" resultMap="StockOutTypeResult">
<include refid="selectStockOutTypeVo"/>
where id = #{id}
</select>
<insert id="insertStockOutType" parameterType="StockOutType" useGeneratedKeys="true" keyProperty="id">
insert into stock_out_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="ckTypeName != null and ckTypeName != ''">ck_type_name,</if>
<if test="ckTypeCode != null and ckTypeCode != ''">ck_type_code,</if>
<if test="createdBy != null">created_by,</if>
<if test="createdAt != null">created_at,</if>
<if test="updatedBy != null">updated_by,</if>
<if test="updatedAt != null">updated_at,</if>
<if test="isDelete != null">is_delete,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ckTypeName != null and ckTypeName != ''">#{ckTypeName},</if>
<if test="ckTypeCode != null and ckTypeCode != ''">#{ckTypeCode},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedAt != null">#{updatedAt},</if>
<if test="isDelete != null">#{isDelete},</if>
</trim>
</insert>
<update id="updateStockOutType" parameterType="StockOutType">
update stock_out_type
<trim prefix="SET" suffixOverrides=",">
<if test="ckTypeName != null and ckTypeName != ''">ck_type_name = #{ckTypeName},</if>
<if test="ckTypeCode != null and ckTypeCode != ''">ck_type_code = #{ckTypeCode},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteStockOutTypeById" parameterType="Long">
delete from stock_out_type where id = #{id}
</delete>
<delete id="deleteStockOutTypeByIds" parameterType="String">
delete from stock_out_type where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -144,6 +144,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<update id="resetGysJhStatusBySapNos">
UPDATE gys_jh
SET status = 0
WHERE sap_no IN
<foreach collection="sapNos" item="sapNo" open="(" separator="," close=")">
#{sapNo}
</foreach>
</update>
<delete id="deleteGysJhById" parameterType="Long">
delete from gys_jh where id = #{id}
</delete>

View File

@@ -0,0 +1,105 @@
<?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.zg.project.wisdom.mapper.RkBillMapper">
<!-- 新增单据主表 -->
<insert id="insertRkBill" parameterType="com.zg.project.wisdom.domain.RkBill">
INSERT INTO rk_bill (
rk_type, wl_type, cangku, rk_time, lihuo_y,
bill_no, is_chuku, is_delete,
created_by, created_at
) VALUES (
#{rkType}, #{wlType}, #{cangku}, #{rkTime}, #{lihuoY},
#{billNo}, #{isChuku}, #{isDelete},
#{createBy}, #{createTime}
)
</insert>
<!-- 查询列表(可用于分页或展示) -->
<select id="selectRkBillList"
parameterType="com.zg.project.wisdom.domain.RkBill"
resultType="com.zg.project.wisdom.domain.RkBill">
SELECT
rb.id,
rb.rk_type AS rkType,
st.type_name AS rkTypeName,
rb.wl_type AS wlType,
mt.type_name AS wlTypeName,
rb.cangku AS cangku,
wh.warehouse_name AS cangkuName,
rb.lihuo_y AS lihuoY,
rb.rk_time AS rkTime,
rb.bill_no AS billNo,
rb.is_chuku AS isChuku,
rb.is_delete AS isDelete,
rb.created_by AS createBy,
rb.created_at AS createTime,
rb.updated_by AS updateBy,
rb.updated_at AS updateTime
FROM rk_bill rb
LEFT JOIN stock_in_type st ON rb.rk_type = st.type_code
LEFT JOIN material_type mt ON rb.wl_type = mt.type_code
LEFT JOIN warehouse_info wh ON rb.cangku = wh.warehouse_code
WHERE rb.is_delete = '0'
<if test="billNo != null and billNo != ''">
AND rb.bill_no LIKE CONCAT('%', #{billNo}, '%')
</if>
ORDER BY rb.rk_time DESC
</select>
<!-- 根据单据号查询单条 -->
<select id="selectRkBillByBillNo" resultType="com.zg.project.wisdom.domain.RkBill">
SELECT
id, rk_type, wl_type, cangku, rk_time, lihuo_y,
bill_no, is_chuku, is_delete,
created_by AS createBy, created_at AS createTime,
updated_by AS updateBy, updated_at AS updateTime,
remark
FROM rk_bill
WHERE bill_no = #{billNo}
LIMIT 1
</select>
<!-- 查询详情 -->
<select id="selectRkBillById" resultType="com.zg.project.wisdom.domain.RkBill">
SELECT * FROM rk_bill WHERE id = #{id} AND is_delete = '0'
</select>
<!-- 修改 -->
<update id="updateRkBill" parameterType="com.zg.project.wisdom.domain.RkBill">
UPDATE rk_bill
SET rk_type = #{rkType},
wl_type = #{wlType},
cangku = #{cangku},
rk_time = #{rkTime},
lihuo_y = #{lihuoY},
bill_no = #{billNo},
is_chuku = #{isChuku},
remark = #{remark},
updated_by = #{updateBy},
updated_at = #{updateTime}
WHERE id = #{id}
</update>
<!-- 批量逻辑删除 -->
<update id="logicDeleteRkBillByIds">
UPDATE rk_bill
SET is_delete = '1'
WHERE id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<update id="updateOutStock" parameterType="list">
UPDATE rk_bill
SET is_chuku = '1'
WHERE id IN
<foreach collection="list" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>

View File

@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="rkTime" column="rk_time" />
<result property="lihuoY" column="lihuo_y" />
<result property="isChuku" column="is_chuku" />
<result property="billNo" column="bill_no"/>
<result property="rkTypeName" column="rk_type_name"/>
<result property="wlTypeName" column="wl_type_name"/>
<result property="cangkuName" column="cangku_name"/>
@@ -32,8 +33,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="dw" column="dw" />
<result property="realQty" column="real_qty" />
<result property="pcode" column="pcode" />
<result property="pcodeId" column="pcode_id"/>
<result property="trayCode" column="tray_code" />
<result property="entityId" column="entity_id" />
<result property="ckLihuoY" column="ck_lihuo_y"/>
<result property="ckType" column="ck_type"/>
<result property="ckTypeName" column="ck_type_name"/>
<result property="teamCode" column="team_code"/>
<result property="teamName" column="team_name"/>
<result property="lyTime" column="ly_time"/>
<result property="ckRemark" column="ck_remark"/>
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
@@ -44,23 +53,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectRkInfoVo">
SELECT
ri.id,
ri.bill_no,
ri.rk_type, st.type_name AS rk_type_name,
ri.wl_type, mt.type_name AS wl_type_name,
ri.cangku, wh.warehouse_name AS cangku_name,
ri.rk_time, ri.lihuo_y, ri.is_chuku, ri.remark,
ri.ck_lihuo_y, ri.ck_type, sot.ck_type_name,
ri.team_code, ct.team_name,
ri.ck_remark,
ri.ly_time,
ri.xj, ri.xm_no, ri.xm_ms, ri.wl_no, ri.wl_ms,
ri.gys_no, ri.gys_mc, ri.jh_amt, ri.ht_dj, ri.sap_no, ri.xh,
ri.jh_qty, ri.ht_qty, ri.dw, ri.real_qty,
ri.pcode, ri.tray_code, ri.entity_id,
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
FROM rk_info ri
LEFT JOIN stock_in_type st ON ri.rk_type = st.type_code
LEFT JOIN material_type mt ON ri.wl_type = mt.type_code
LEFT JOIN warehouse_info wh ON ri.cangku = wh.warehouse_code
LEFT JOIN stock_out_type sot ON ri.ck_type = sot.ck_type_code
LEFT JOIN construction_team ct ON ri.team_code = ct.team_code
</sql>
<insert id="batchInsertRkInfo" parameterType="java.util.List">
insert into rk_info (
bill_no,
rk_type, wl_type, cangku, lihuo_y, rk_time,
wl_no, wl_ms, xm_no, xm_ms, xj, sap_no, gys_no, gys_mc,
jh_qty, ht_qty, jh_amt, ht_dj, dw,
@@ -70,6 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
values
<foreach collection="list" item="item" separator=",">
(
#{item.billNo},
#{item.rkType}, #{item.wlType}, #{item.cangku}, #{item.lihuoY}, #{item.rkTime},
#{item.wlNo}, #{item.wlMs}, #{item.xmNo}, #{item.xmMs}, #{item.xj}, #{item.sapNo}, #{item.gysNo}, #{item.gysMc},
#{item.jhQty}, #{item.htQty}, #{item.jhAmt}, #{item.htDj}, #{item.dw},
@@ -79,11 +97,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</insert>
<delete id="deleteByBillNo">
DELETE FROM rk_info WHERE bill_no = #{billNo}
</delete>
<select id="selectRkInfoList" parameterType="RkInfo" resultMap="RkInfoResult">
<include refid="selectRkInfoVo"/>
<where>
and is_chuku = 0
<if test="isChuku != null and isChuku != ''">
and is_chuku = #{isChuku}
</if>
<if test="keyword != null and keyword != ''">
and (
@@ -94,6 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
or gys_no like concat('%', #{keyword}, '%')
or gys_mc like concat('%', #{keyword}, '%')
or sap_no like concat('%', #{keyword}, '%')
or bill_no like concat('%', #{keyword}, '%')
)
</if>
@@ -102,10 +127,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="cangku != null and cangku != ''"> and cangku = #{cangku}</if>
<if test="rkTime != null "> and rk_time = #{rkTime}</if>
<if test="lihuoY != null and lihuoY != ''"> and lihuo_y = #{lihuoY}</if>
<!-- ✅ 删除这个条件,否则会与强制条件冲突 -->
<!-- <if test="isChuku != null and isChuku != ''"> and is_chuku = #{isChuku}</if> -->
<if test="xj != null and xj != ''"> and xj = #{xj}</if>
<if test="billNo != null and billNo != ''">
and bill_no = #{billNo}
</if>
<if test="xmNo != null and xmNo != ''"> and xm_no = #{xmNo}</if>
<if test="xmMs != null and xmMs != ''"> and xm_ms = #{xmMs}</if>
<if test="wlNo != null and wlNo != ''"> and wl_no = #{wlNo}</if>
@@ -121,13 +147,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dw != null and dw != ''"> and dw = #{dw}</if>
<if test="realQty != null "> and real_qty = #{realQty}</if>
<if test="pcode != null and pcode != ''"> and pcode = #{pcode}</if>
<if test="lyTime != null"> and ri.ly_time = #{lyTime}</if>
<if test="trayCode != null and trayCode != ''"> and tray_code = #{trayCode}</if>
<if test="entityId != null and entityId != ''"> and entity_id = #{entityId}</if>
<if test="isDelete != null and isDelete != ''">
and is_delete = #{isDelete}
and ri.is_delete = #{isDelete}
</if>
<if test="isDelete == null or isDelete == ''">
and is_delete = 0
and ri.is_delete = 0
</if>
</where>
</select>
@@ -139,14 +166,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="countRkInfoByLocationCode" resultType="int">
SELECT COUNT(1)
FROM rk_info
WHERE pcode = #{locationCode} AND is_delete = 0
FROM rk_info ri
WHERE ri.pcode = #{locationCode} AND ri.is_delete = 0
</select>
<select id="selectUsedPcodes" resultType="java.lang.String">
SELECT DISTINCT pcode
FROM rk_info
WHERE is_delete = '0' AND is_chuku != '1'
FROM rk_info ri
WHERE ri.is_delete = '0' AND ri.is_chuku != '1'
</select>
<select id="selectSapNoByBillNo" resultType="java.lang.String">
SELECT DISTINCT sap_no FROM rk_info
WHERE bill_no = #{billNo} AND sap_no IS NOT NULL
</select>
<select id="countOverdueStock" resultType="int">
SELECT COUNT(*) FROM rk_info
WHERE ri.is_delete = 0 AND ri.is_chuku = 0
<![CDATA[
AND DATE(rk_time) <= DATE_SUB(CURDATE(), INTERVAL 20 DAY)
]]>
</select>
<select id="selectTopOverdueStock" resultMap="RkInfoResult">
SELECT * FROM rk_info
WHERE ri.is_delete = 0 AND ri.is_chuku = 0
<![CDATA[
AND DATE(rk_time) <= DATE_SUB(CURDATE(), INTERVAL 20 DAY)
]]>
ORDER BY rk_time DESC
LIMIT #{limit}
</select>
<update id="updateRkInfo" parameterType="RkInfo">
@@ -158,6 +208,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="rkTime != null">rk_time = #{rkTime},</if>
<if test="lihuoY != null">lihuo_y = #{lihuoY},</if>
<if test="isChuku != null">is_chuku = #{isChuku},</if>
<if test="billNo != null">bill_no = #{billNo},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="xj != null">xj = #{xj},</if>
<if test="xmNo != null">xm_no = #{xmNo},</if>
@@ -177,6 +228,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="pcode != null">pcode = #{pcode},</if>
<if test="trayCode != null">tray_code = #{trayCode},</if>
<if test="entityId != null">entity_id = #{entityId},</if>
<if test="ckLihuoY != null">ck_lihuo_y = #{ckLihuoY},</if>
<if test="ckType != null">ck_type = #{ckType},</if>
<if test="ckTypeName != null">ck_type_name = #{ckTypeName},</if>
<if test="sgdCode != null">sgd_code = #{sgdCode},</if>
<if test="sgdName != null">sgd_name = #{sgdName},</if>
<if test="lyTime != null">ly_time = #{lyTime},</if>
<if test="ckRemark != null">ck_remark = #{ckRemark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
@@ -194,11 +252,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="deleteRkInfoByIds" parameterType="String">
update rk_info
set is_delete = 1
set ri.is_delete = 1
where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<update id="batchUpdateOutStock" parameterType="java.util.List">
<foreach collection="list" item="item" separator=";">
UPDATE rk_info
SET
is_chuku = 1,
ck_time = #{item.ckTime},
ck_type = #{item.ckType},
team_code = #{item.teamCode},
ck_lihuo_y = #{item.ckLihuoY},
update_by = #{item.updateBy},
update_time = #{item.updateTime}
WHERE id = #{item.id} AND is_delete = 0
</foreach>
</update>
</mapper>