入库相关功能

This commit is contained in:
2026-01-21 19:21:07 +08:00
parent 820df3e20a
commit a1be0e4abd
20 changed files with 1051 additions and 362 deletions

View File

@@ -2,17 +2,25 @@
<!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.RkInfoMapper">
<!-- ========================= resultMap ========================= -->
<resultMap type="RkInfo" id="RkInfoResult">
<result property="id" column="id"/>
<result property="operationType" column="operation_type"/>
<result property="operationTypeName" column="operation_type_name"/>
<result property="bizType" column="biz_type"/>
<result property="wlType" column="wl_type"/>
<result property="wlTypeName" column="wl_type_name"/>
<result property="cangku" column="cangku"/>
<result property="warehouseName" column="warehouse_name"/>
<result property="parentWarehouseCode" column="parent_warehouse_code"/>
<result property="parentWarehouseName" column="parent_warehouse_name"/>
<result property="operationTime" column="operation_time"/>
<result property="stockAge" column="stock_age"/>
<result property="operator" column="operator"/>
<result property="operatorName" column="operator_name"/>
<result property="isChuku" column="is_chuku"/>
<result property="status" column="status"/>
<result property="execStatus" column="exec_status"/>
@@ -59,116 +67,114 @@
<result property="isUpdate" column="is_update"/>
</resultMap>
<!-- ========================= 公共查询字段 ========================= -->
<!-- ========================= 公共查询 SQL联表完整版 ========================= -->
<sql id="selectRkInfoVo">
select
id,
operation_type,
biz_type,
wl_type,
cangku,
operation_time,
operator,
is_chuku,
status,
exec_status,
remark,
bill_no,
xj,
xm_no,
xm_ms,
xm_no_ck,
xm_ms_ck,
wl_no,
wl_ms,
gys_no,
gys_mc,
jh_amt,
ht_dj,
sap_no,
xh,
jh_qty,
ht_qty,
dw,
real_qty,
pcode,
pcode_id,
tray_code,
entity_id,
team_code,
borrow_time,
return_time,
has_moved,
is_borrowed,
create_by,
create_time,
update_by,
update_time,
is_delete,
gys_jh_id,
rdid,
rdid_ck,
sid,
is_delivery,
fycde_1,
fycde_2,
is_update,
/* 新增库龄计算 */
DATEDIFF(CURRENT_DATE, operation_time) AS stock_age -- 库龄(天)
from rk_info
SELECT
ri.*,
/* 出入库类型名称 */
COALESCE(sit.type_name, sot.type_name) AS operation_type_name,
/* 物资类型名称 */
mt.type_name AS wl_type_name,
/* 仓库信息 */
wh.warehouse_name,
wh.parent_warehouse_code,
wh.parent_warehouse_name,
/* 理货员 */
su.nick_name AS operator_name,
/* 库龄 */
DATEDIFF(CURRENT_DATE, ri.operation_time) AS stock_age
FROM rk_info ri
LEFT JOIN stock_in_type sit ON ri.operation_type = sit.type_code
LEFT JOIN stock_out_type sot ON ri.operation_type = sot.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 sys_user su ON ri.operator = su.user_id
</sql>
<!-- ========================= 删除 ========================= -->
<delete id="deleteRkInfoById" parameterType="Long">
delete from rk_info where id = #{id}
</delete>
<delete id="deleteRkInfoByIds" parameterType="java.util.List">
delete from rk_info
where id in
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<!-- 查询列表:根据库龄进行过滤 -->
<!-- ========================= 查询列表 ========================= -->
<select id="selectRkInfoList" parameterType="RkInfo" resultMap="RkInfoResult">
<include refid="selectRkInfoVo"/>
<where>
ri.exec_status = 1
<if test="operationType != null and operationType != ''">
and operation_type = #{operationType}
AND ri.operation_type LIKE CONCAT('%', #{operationType}, '%')
</if>
<if test="sapNo != null and sapNo != ''">
AND ri.sap_no LIKE CONCAT('%', #{sapNo}, '%')
</if>
<if test="xmNo != null and xmNo != ''">
AND ri.xm_no LIKE CONCAT('%', #{xmNo}, '%')
</if>
<if test="xmMs != null and xmMs != ''">
AND ri.xm_ms LIKE CONCAT('%', #{xmMs}, '%')
</if>
<if test="wlNo != null and wlNo != ''">
AND ri.wl_no LIKE CONCAT('%', #{wlNo}, '%')
</if>
<if test="wlMs != null and wlMs != ''">
AND ri.wl_ms LIKE CONCAT('%', #{wlMs}, '%')
</if>
<if test="gysMc != null and gysMc != ''">
AND ri.gys_mc LIKE CONCAT('%', #{gysMc}, '%')
</if>
<if test="pcode != null and pcode != ''">
AND ri.pcode LIKE CONCAT('%', #{pcode}, '%')
</if>
<if test="bizType != null and bizType != ''">
and biz_type = #{bizType}
AND ri.biz_type LIKE CONCAT('%', #{bizType}, '%')
</if>
<if test="wlType != null and wlType != ''">
and wl_type = #{wlType}
AND ri.wl_type LIKE CONCAT('%', #{wlType}, '%')
</if>
<if test="cangku != null and cangku != ''">
and cangku = #{cangku}
</if>
<if test="execStatus != null and execStatus != ''">
and exec_status = #{execStatus}
AND ri.cangku LIKE CONCAT('%', #{cangku}, '%')
</if>
<if test="billNo != null and billNo != ''">
and bill_no = #{billNo}
AND ri.bill_no LIKE CONCAT('%', #{billNo}, '%')
</if>
<if test="isDelete != null and isDelete != ''">
and is_delete = #{isDelete}
AND ri.is_delete = #{isDelete}
</if>
<!-- 出入库时间范围 -->
<if test="startDate != null">
AND ri.operation_time &gt;= #{startDate}
</if>
<if test="endDate != null">
AND ri.operation_time &lt;= #{endDate}
</if>
</where>
ORDER BY ri.operation_time DESC
</select>
<!-- ========================= 按 ID 查询 ========================= -->
<select id="selectRkInfoById" parameterType="Long" resultMap="RkInfoResult">
<include refid="selectRkInfoVo"/>
where id = #{id}
WHERE ri.id = #{id}
</select>
<!-- ========================= 删除 ========================= -->
<delete id="deleteRkInfoById" parameterType="Long">
DELETE FROM rk_info WHERE id = #{id}
</delete>
<!-- 插入 rk_info -->
<delete id="deleteRkInfoByIds" parameterType="java.util.List">
DELETE FROM rk_info
WHERE id IN
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<!-- ========================= 插入 ========================= -->
<insert id="insertRkInfo" parameterType="RkInfo" useGeneratedKeys="true" keyProperty="id">
insert into rk_info (
INSERT INTO rk_info (
operation_type, biz_type, wl_type, cangku, operation_time, operator,
is_chuku, status, exec_status, remark, bill_no,
xj, xm_no, xm_ms, xm_no_ck, xm_ms_ck,
@@ -186,7 +192,7 @@
is_update,
create_by, create_time, is_delete
)
values (
VALUES (
#{operationType}, #{bizType}, #{wlType}, #{cangku}, #{operationTime}, #{operator},
#{isChuku}, #{status}, #{execStatus}, #{remark}, #{billNo},
#{xj}, #{xmNo}, #{xmMs}, #{xmNoCk}, #{xmMsCk},
@@ -206,19 +212,69 @@
)
</insert>
<!-- 更新 rk_info -->
<!-- ========================= 更新 ========================= -->
<update id="updateRkInfo" parameterType="RkInfo">
update rk_info
UPDATE rk_info
<trim prefix="SET" suffixOverrides=",">
<if test="operationType != null">operation_type = #{operationType},</if>
<if test="bizType != null">biz_type = #{bizType},</if>
<if test="wlType != null">wl_type = #{wlType},</if>
<if test="cangku != null">cangku = #{cangku},</if>
<if test="operationTime != null">operation_time = #{operationTime},</if>
<if test="operator != null">operator = #{operator},</if>
<if test="isChuku != null">is_chuku = #{isChuku},</if>
<if test="status != null">status = #{status},</if>
<if test="execStatus != null">exec_status = #{execStatus},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="billNo != null">bill_no = #{billNo},</if>
<if test="xj != null">xj = #{xj},</if>
<if test="xmNo != null">xm_no = #{xmNo},</if>
<if test="xmMs != null">xm_ms = #{xmMs},</if>
<if test="xmNoCk != null">xm_no_ck = #{xmNoCk},</if>
<if test="xmMsCk != null">xm_ms_ck = #{xmMsCk},</if>
<if test="wlNo != null">wl_no = #{wlNo},</if>
<if test="wlMs != null">wl_ms = #{wlMs},</if>
<if test="gysNo != null">gys_no = #{gysNo},</if>
<if test="gysMc != null">gys_mc = #{gysMc},</if>
<if test="jhAmt != null">jh_amt = #{jhAmt},</if>
<if test="htDj != null">ht_dj = #{htDj},</if>
<if test="sapNo != null">sap_no = #{sapNo},</if>
<if test="xh != null">xh = #{xh},</if>
<if test="jhQty != null">jh_qty = #{jhQty},</if>
<if test="htQty != null">ht_qty = #{htQty},</if>
<if test="dw != null">dw = #{dw},</if>
<if test="realQty != null">real_qty = #{realQty},</if>
<if test="pcode != null">pcode = #{pcode},</if>
<if test="pcodeId != null">pcode_id = #{pcodeId},</if>
<if test="trayCode != null">tray_code = #{trayCode},</if>
<if test="entityId != null">entity_id = #{entityId},</if>
<if test="teamCode != null">team_code = #{teamCode},</if>
<if test="borrowTime != null">borrow_time = #{borrowTime},</if>
<if test="returnTime != null">return_time = #{returnTime},</if>
<if test="hasMoved != null">has_moved = #{hasMoved},</if>
<if test="isBorrowed != null">is_borrowed = #{isBorrowed},</if>
<if test="gysJhId != null">gys_jh_id = #{gysJhId},</if>
<if test="rdid != null">rdid = #{rdid},</if>
<if test="rdidCk != null">rdid_ck = #{rdidCk},</if>
<if test="sid != null">sid = #{sid},</if>
<if test="isDelivery != null">is_delivery = #{isDelivery},</if>
<if test="fycde1 != null">fycde_1 = #{fycde1},</if>
<if test="fycde2 != null">fycde_2 = #{fycde2},</if>
<if test="isUpdate != null">is_update = #{isUpdate},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
</trim>
where id = #{id}
WHERE id = #{id}
</update>
<update id="updateExecStatusByIds">
UPDATE rk_info
SET exec_status = #{execStatus}
WHERE id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>