新增配送物料字段

优化u其他逻辑
This commit is contained in:
2025-10-29 10:15:30 +08:00
parent 69d07fcdf4
commit db8e6c514c
21 changed files with 1069 additions and 206 deletions

View File

@@ -1,7 +1,7 @@
<?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">
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 type="RkInfo" id="RkInfoResult">
@@ -57,9 +57,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="isDelete" column="is_delete" />
<result property="hasMoved" column="has_moved"/>
<result property="lihuoYName" column="lihuo_y_name"/>
<result property="fycde1" column="fycde_1"/>
<result property="fycde2" column="fycde_2"/>
<result property="isDelivery" column="is_delivery"/>
</resultMap>
<!-- 明细查询SQL包含多表JOIN用于普通明细/分页等) -->
<sql id="selectRkInfoVo">
SELECT
ri.id,
@@ -73,6 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ri.team_code, ct.team_name,
ri.ck_remark,
ri.ly_time,
ri.fycde_1, ri.fycde_2,
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_jh_id,
@@ -90,6 +94,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN sys_user u ON ri.lihuo_y = u.user_id
</sql>
<!-- 轻量分组专用SQL仅rk_info字段不做JOIN供按单据分组内层使用 -->
<sql id="selectRkInfoForGroup">
SELECT
ri.id,
ri.bill_no,
ri.bill_no_ck,
ri.rk_type,
ri.wl_type,
ri.cangku,
ri.rk_time,
ri.lihuo_y,
ri.is_chuku,
ri.xj,
ri.xm_no,
ri.xm_ms,
ri.xm_no_ck,
ri.xm_ms_ck,
ri.gys_mc,
ri.wl_no,
ri.wl_ms,
ri.gys_no,
ri.sap_no,
ri.ck_type,
ri.ly_time,
ri.ck_lihuo_y,
ri.pcode,
ri.is_delete
FROM rk_info ri
</sql>
<insert id="batchInsertRkInfo"
parameterType="java.util.List"
useGeneratedKeys="true"
@@ -101,7 +135,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
xm_no_ck, xm_ms_ck, xj, sap_no, gys_no, gys_mc,
jh_qty, ht_qty, jh_amt, ht_dj, dw,
borrow_time, return_time, status,
pcode, pcode_id, tray_code, real_qty, entity_id,
pcode, pcode_id, tray_code, real_qty, entity_id, fycde_1, fycde_2,
remark, is_chuku, is_borrowed, gys_jh_id,
is_delete, create_by, create_time
)
@@ -114,7 +148,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.xmNoCk}, #{item.xmMsCk}, #{item.xj}, #{item.sapNo}, #{item.gysNo}, #{item.gysMc},
#{item.jhQty}, #{item.htQty}, #{item.jhAmt}, #{item.htDj}, #{item.dw},
#{item.borrowTime}, #{item.returnTime}, #{item.status},
#{item.pcode}, #{item.pcodeId}, #{item.trayCode}, #{item.realQty}, #{item.entityId},
#{item.pcode}, #{item.pcodeId}, #{item.trayCode}, #{item.realQty}, #{item.entityId}, #{item.fycde1}, #{item.fycde2},
#{item.remark}, #{item.isChuku}, #{item.isBorrowed}, #{item.gysJhId},
#{item.isDelete}, #{item.createBy}, #{item.createTime}
)
@@ -146,7 +180,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</insert>
<update id="cancelStockOut">
UPDATE rk_info
SET
@@ -186,6 +219,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND (
ri.xm_no like concat('%', #{keyword}, '%')
or ri.xm_ms like concat('%', #{keyword}, '%')
or ri.fycde_1 like concat('%', #{keyword}, '%')
or ri.fycde_2 like concat('%', #{keyword}, '%')
or ri.wl_no like concat('%', #{keyword}, '%')
or ri.wl_ms like concat('%', #{keyword}, '%')
or ri.gys_no like concat('%', #{keyword}, '%')
@@ -207,7 +242,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="cangku != null and cangku != ''">
AND ri.cangku like concat('%', #{cangku}, '%')
</if>
<if test="fycde1 != null and fycde1 != ''">
AND ri.fycde_1 like concat('%', #{fycde1}, '%')
</if>
<if test="fycde2 != null and fycde2 != ''">
AND ri.fycde_2 like concat('%', #{fycde2}, '%')
</if>
<if test="ids != null and ids.size > 0">
AND ri.id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
@@ -318,12 +358,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY ri.rk_time DESC
</select>
<!--
按单据分组bill_no列表
复用 <sql id="selectRkInfoVo"> 作为子查询,外层分组聚合
返回字段bill_no、bill_no_ck + 你指定的通用字段rk_type、wl_type、cangku、rk_time、lihuo_y、is_chuku、xj、
xm_no、xm_ms、xm_no_ck、xm_ms_ck、wl_no、wl_ms、gys_no、sap_no
-->
<!-- ================== 这里是已优化的按单据分组查询(替换旧版本) ================== -->
<select id="selectGroupedByBill" resultMap="RkInfoResult" parameterType="map">
SELECT
a.id,
@@ -353,33 +388,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
u.user_name AS ck_lihuo_y_name
FROM (
SELECT
MIN(t.id) AS id, -- 代表ID
t.bill_no AS bill_no, -- 分组键
MIN(t.bill_no_ck) AS bill_no_ck, -- 代表值
MIN(t.rk_type) AS rk_type,
MIN(t.wl_type) AS wl_type,
MIN(t.cangku) AS cangku,
MIN(t.rk_time) AS rk_time, -- 单据内最早入库时间
MIN(t.lihuo_y) AS lihuo_y,
MAX(t.is_chuku) AS is_chuku, -- 单据内只要有出库则为1
MIN(t.xj) AS xj,
MIN(t.xm_no) AS xm_no,
MIN(t.xm_ms) AS xm_ms,
MIN(t.xm_no_ck) AS xm_no_ck,
MIN(t.xm_ms_ck) AS xm_ms_ck,
MIN(t.id) AS id, -- 代表ID
t.bill_no AS bill_no, -- 分组键
MIN(t.bill_no_ck) AS bill_no_ck,
MIN(t.rk_type) AS rk_type,
MIN(t.wl_type) AS wl_type,
MIN(t.cangku) AS cangku,
MIN(t.rk_time) AS rk_time, -- 单据内最早入库时间
MIN(t.lihuo_y) AS lihuo_y,
MAX(t.is_chuku) AS is_chuku, -- 单据内只要有出库则为1
MIN(t.xj) AS xj,
MIN(t.xm_no) AS xm_no,
MIN(t.xm_ms) AS xm_ms,
MIN(t.xm_no_ck) AS xm_no_ck,
MIN(t.xm_ms_ck) AS xm_ms_ck,
MIN(t.gys_mc) AS gys_mc,
MIN(t.wl_no) AS wl_no,
MIN(t.wl_ms) AS wl_ms,
MIN(t.gys_no) AS gys_no,
MIN(t.sap_no) AS sap_no,
MIN(t.ck_type) AS ck_type,
MAX(t.ly_time) AS ly_time,
MIN(t.wl_no) AS wl_no,
MIN(t.wl_ms) AS wl_ms,
MIN(t.gys_no) AS gys_no,
MIN(t.sap_no) AS sap_no,
MIN(t.ck_type) AS ck_type,
MAX(t.ly_time) AS ly_time,
MIN(t.ck_lihuo_y) AS ck_lihuo_y
FROM (
<!-- 复用已有的明细查询(列别名与 RkInfoResult 一致) -->
<include refid="selectRkInfoVo"/>
<include refid="selectRkInfoForGroup"/>
) t
<where>
<!-- 删除标记默认0 -->
<choose>
<when test="q.isDelete != null and q.isDelete != ''">
AND t.is_delete = #{q.isDelete}
</when>
<otherwise>
AND t.is_delete = 0
</otherwise>
</choose>
<!-- is_chuku 优先列表,其次单值 -->
<choose>
<when test="q.isChukuList != null and q.isChukuList.size > 0">
@@ -396,153 +440,74 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 关键词模糊 -->
<if test="q.keyword != null and q.keyword != ''">
AND (
t.xm_no LIKE concat('%', #{q.keyword}, '%')
OR t.xm_ms LIKE concat('%', #{q.keyword}, '%')
OR t.wl_no LIKE concat('%', #{q.keyword}, '%')
OR t.wl_ms LIKE concat('%', #{q.keyword}, '%')
OR t.gys_no LIKE concat('%', #{q.keyword}, '%')
OR t.gys_mc LIKE concat('%', #{q.keyword}, '%')
OR t.sap_no LIKE concat('%', #{q.keyword}, '%')
OR t.bill_no LIKE concat('%', #{q.keyword}, '%')
t.xm_no LIKE concat('%', #{q.keyword}, '%')
OR t.xm_ms LIKE concat('%', #{q.keyword}, '%')
OR t.wl_no LIKE concat('%', #{q.keyword}, '%')
OR t.wl_ms LIKE concat('%', #{q.keyword}, '%')
OR t.gys_no LIKE concat('%', #{q.keyword}, '%')
OR t.gys_mc LIKE concat('%', #{q.keyword}, '%')
OR t.sap_no LIKE concat('%', #{q.keyword}, '%')
OR t.bill_no LIKE concat('%', #{q.keyword}, '%')
OR t.bill_no_ck LIKE concat('%', #{q.keyword}, '%')
OR t.ck_type LIKE concat('%', #{q.keyword}, '%')
OR t.pcode LIKE concat('%', #{q.keyword}, '%')
OR t.ck_type LIKE concat('%', #{q.keyword}, '%')
OR t.pcode LIKE concat('%', #{q.keyword}, '%')
)
</if>
<!-- 维度筛选 -->
<if test="q.rkType != null and q.rkType != ''">
AND t.rk_type LIKE concat('%', #{q.rkType}, '%')
</if>
<if test="q.wlType != null and q.wlType != ''">
AND t.wl_type LIKE concat('%', #{q.wlType}, '%')
</if>
<if test="q.cangku != null and q.cangku != ''">
AND t.cangku LIKE concat('%', #{q.cangku}, '%')
</if>
<if test="q.rkType != null and q.rkType != ''"> AND t.rk_type LIKE concat('%', #{q.rkType}, '%') </if>
<if test="q.wlType != null and q.wlType != ''"> AND t.wl_type LIKE concat('%', #{q.wlType}, '%') </if>
<if test="q.cangku != null and q.cangku != ''"> AND t.cangku LIKE concat('%', #{q.cangku}, '%') </if>
<!-- ID 列表 -->
<if test="q.ids != null and q.ids.size > 0">
AND t.id IN
<foreach collection="q.ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<!-- 入库/领用时间范围(闭区间) -->
<if test="q.startTime != null"><![CDATA[ AND t.rk_time >= #{q.startTime} ]]></if>
<if test="q.endTime != null"><![CDATA[ AND t.rk_time <= #{q.endTime} ]]></if>
<if test="q.lyStartTime!= null"><![CDATA[ AND t.ly_time >= #{q.lyStartTime}]]></if>
<if test="q.lyEndTime != null"><![CDATA[ AND t.ly_time <= #{q.lyEndTime} ]]></if>
<!-- 入库时间范围(闭区间) -->
<if test="q.startTime != null"><![CDATA[
AND t.rk_time >= #{q.startTime}
]]></if>
<if test="q.endTime != null"><![CDATA[
AND t.rk_time <= #{q.endTime}
]]></if>
<!-- 领用时间范围(闭区间) -->
<if test="q.lyStartTime != null"><![CDATA[
AND t.ly_time >= #{q.lyStartTime}
]]></if>
<if test="q.lyEndTime != null"><![CDATA[
AND t.ly_time <= #{q.lyEndTime}
]]></if>
<!-- 其它模糊/等值 -->
<if test="q.lihuoY != null and q.lihuoY != ''">
AND t.lihuo_y LIKE concat('%', #{q.lihuoY}, '%')
</if>
<if test="q.xj != null and q.xj != ''">
AND t.xj LIKE concat('%', #{q.xj}, '%')
</if>
<if test="q.billNo != null and q.billNo != ''">
AND t.bill_no LIKE concat('%', #{q.billNo}, '%')
</if>
<if test="q.billNoCk != null and q.billNoCk != ''">
AND t.bill_no_ck LIKE concat('%', #{q.billNoCk}, '%')
</if>
<if test="q.xmNo != null and q.xmNo != ''">
AND t.xm_no LIKE concat('%', #{q.xmNo}, '%')
</if>
<if test="q.xmMs != null and q.xmMs != ''">
AND t.xm_ms LIKE concat('%', #{q.xmMs}, '%')
</if>
<if test="q.wlNo != null and q.wlNo != ''">
AND t.wl_no LIKE concat('%', #{q.wlNo}, '%')
</if>
<if test="q.wlMs != null and q.wlMs != ''">
AND t.wl_ms LIKE concat('%', #{q.wlMs}, '%')
</if>
<if test="q.gysNo != null and q.gysNo != ''">
AND t.gys_no LIKE concat('%', #{q.gysNo}, '%')
</if>
<if test="q.gysMc != null and q.gysMc != ''">
AND t.gys_mc LIKE concat('%', #{q.gysMc}, '%')
</if>
<if test="q.jhAmt != null"> AND t.jh_amt = #{q.jhAmt} </if>
<if test="q.htDj != null"> AND t.ht_dj = #{q.htDj} </if>
<if test="q.sapNo != null and q.sapNo != ''">
AND t.sap_no LIKE concat('%', #{q.sapNo}, '%')
</if>
<if test="q.xh != null and q.xh != ''">
AND t.xh LIKE concat('%', #{q.xh}, '%')
</if>
<if test="q.jhQty != null"> AND t.jh_qty = #{q.jhQty} </if>
<if test="q.htQty != null"> AND t.ht_qty = #{q.htQty} </if>
<if test="q.dw != null and q.dw != ''">
AND t.dw LIKE concat('%', #{q.dw}, '%')
</if>
<if test="q.realQty != null"> AND t.real_qty = #{q.realQty} </if>
<if test="q.pcode != null and q.pcode != ''">
AND t.pcode LIKE concat('%', #{q.pcode}, '%')
</if>
<if test="q.lyTime != null"> AND t.ly_time = #{q.lyTime} </if>
<if test="q.returnTime != null"> AND t.return_time = #{q.returnTime} </if>
<if test="q.trayCode != null and q.trayCode != ''">
AND t.tray_code LIKE concat('%', #{q.trayCode}, '%')
</if>
<if test="q.entityId != null and q.entityId != ''">
AND t.entity_id LIKE concat('%', #{q.entityId}, '%')
</if>
<if test="q.ckType != null and q.ckType != ''">
AND t.ck_type LIKE concat('%', #{q.ckType}, '%')
</if>
<!-- 其它等值/模糊 -->
<if test="q.lihuoY != null and q.lihuoY != ''"> AND t.lihuo_y LIKE concat('%', #{q.lihuoY}, '%') </if>
<if test="q.xj != null and q.xj != ''"> AND t.xj LIKE concat('%', #{q.xj}, '%') </if>
<if test="q.billNo != null and q.billNo != ''"> AND t.bill_no LIKE concat('%', #{q.billNo}, '%') </if>
<if test="q.billNoCk != null and q.billNoCk != ''"> AND t.bill_no_ck LIKE concat('%', #{q.billNoCk}, '%') </if>
<if test="q.xmNo != null and q.xmNo != ''"> AND t.xm_no LIKE concat('%', #{q.xmNo}, '%') </if>
<if test="q.xmMs != null and q.xmMs != ''"> AND t.xm_ms LIKE concat('%', #{q.xmMs}, '%') </if>
<if test="q.wlNo != null and q.wlNo != ''"> AND t.wl_no LIKE concat('%', #{q.wlNo}, '%') </if>
<if test="q.wlMs != null and q.wlMs != ''"> AND t.wl_ms LIKE concat('%', #{q.wlMs}, '%') </if>
<if test="q.gysNo != null and q.gysNo != ''"> AND t.gys_no LIKE concat('%', #{q.gysNo}, '%') </if>
<if test="q.gysMc != null and q.gysMc != ''"> AND t.gys_mc LIKE concat('%', #{q.gysMc}, '%') </if>
<if test="q.sapNo != null and q.sapNo != ''"> AND t.sap_no LIKE concat('%', #{q.sapNo}, '%') </if>
<if test="q.xh != null and q.xh != ''"> AND t.xh LIKE concat('%', #{q.xh}, '%') </if>
<if test="q.pcode != null and q.pcode != ''"> AND t.pcode LIKE concat('%', #{q.pcode}, '%') </if>
<!-- 若查询出库单据,则要求已生成出库单号 -->
<if test="(q.isChuku != null and q.isChuku == 1)
or (q.isChukuList != null and q.isChukuList.size > 0 and q.isChukuList.contains(1))">
or (q.isChukuList != null and q.isChukuList.size > 0 and q.isChukuList.contains(1))">
AND t.bill_no_ck IS NOT NULL
</if>
<!-- 删除标记默认0 -->
<choose>
<when test="q.isDelete != null and q.isDelete != ''">
AND t.is_delete = #{q.isDelete}
</when>
<otherwise>
AND t.is_delete = 0
</otherwise>
</choose>
<!-- 审核开启:剔除审核失败(不使用 &lt;&gt;,而用 != 或 CDATA -->
<!-- 审核开启:剔除该 bill_no 下任意一条“审核失败”的明细 -->
<if test="needAudit != null and needAudit == 1">
AND NOT EXISTS (
SELECT 1
FROM audit_signature asg
WHERE asg.rk_id = t.id
FROM rk_info r2
JOIN audit_signature asg
ON asg.rk_id = r2.id
AND asg.approver_id IS NOT NULL
AND (asg.audit_result IS NOT NULL AND asg.audit_result != '1')
WHERE r2.bill_no = t.bill_no
AND r2.is_delete = 0
)
</if>
</where>
GROUP BY t.bill_no
) a
LEFT JOIN stock_in_type si ON a.rk_type = si.type_code
LEFT JOIN stock_out_type so ON a.ck_type = so.type_code
LEFT JOIN sys_user u ON a.ck_lihuo_y = u.user_id
LEFT JOIN stock_in_type si ON a.rk_type = si.type_code
LEFT JOIN stock_out_type so ON a.ck_type = so.type_code
LEFT JOIN sys_user u ON a.ck_lihuo_y = u.user_id
ORDER BY a.rk_time DESC
</select>
<!-- ================== /按单据分组查询 ================== -->
<select id="selectRkInfoById" parameterType="Long" resultMap="RkInfoResult">
<include refid="selectRkInfoVo"/>
@@ -569,7 +534,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="countOverdueStock" resultType="int">
SELECT COUNT(*) FROM rk_info
WHERE is_delete = 0 AND is_chuku = 0
<![CDATA[
<![CDATA[
AND DATE(rk_time) <= DATE_SUB(CURDATE(), INTERVAL 20 DAY)
]]>
</select>
@@ -577,12 +542,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTopOverdueStock" resultMap="RkInfoResult">
SELECT * FROM rk_info
WHERE is_delete = 0 AND is_chuku = 0
<![CDATA[
<![CDATA[
AND DATE(rk_time) <= DATE_SUB(CURDATE(), INTERVAL 20 DAY)
]]>
ORDER BY rk_time DESC
]]>
ORDER BY rk_time DESC
LIMIT #{limit}
</select>
<select id="selectSapNoByCkBillNo" resultType="java.lang.String">
SELECT DISTINCT sap_no FROM rk_info
WHERE bill_no = #{billNo} AND sap_no IS NOT NULL
@@ -648,7 +614,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND pd.scene = #{sceneId}
</select>
<select id="countGetByWh" resultType="java.lang.Integer" parameterType="java.lang.String">
SELECT COUNT(1) FROM rk_info
WHERE is_delete = '0'
@@ -662,15 +627,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
r.pcode AS rkPcode,
COALESCE(SUM(r.real_qty), 0) AS realQty
FROM pcde_detail d
JOIN rk_info r
ON r.pcode = d.pcode
JOIN rk_info r ON r.pcode = d.pcode
LEFT JOIN (
SELECT DISTINCT pcode
FROM inventory_match_scan
WHERE task_id = #{taskId}
AND status = '0'
) s
ON s.pcode = r.pcode
) s ON s.pcode = r.pcode
WHERE (d.is_delete IS NULL OR d.is_delete = '0')
AND d.scene = #{sceneId}
AND r.is_chuku = '0'
@@ -722,8 +685,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY COALESCE(r.bill_no_ck, r.bill_no)
</select>
<select id="selectRkInfoListByBillNo" resultMap="RkInfoResult"
parameterType="java.lang.String">
SELECT
@@ -750,7 +711,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<update id="updateRkInfo" parameterType="RkInfo">
update rk_info
UPDATE rk_info
<trim prefix="SET" suffixOverrides=",">
<if test="rkType != null">rk_type = #{rkType},</if>
<if test="wlType != null">wl_type = #{wlType},</if>
@@ -759,40 +720,62 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="lihuoY != null">lihuo_y = #{lihuoY},</if>
<if test="isChuku != null">is_chuku = #{isChuku},</if>
<if test="isBorrowed != null">is_borrowed = #{isBorrowed},</if>
<if test="billNo != null">bill_no = #{billNo},</if>
<if test="billNoCk != null">bill_no_ck = #{billNoCk},</if>
<if test="remark != null">remark = #{remark},</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="ckLihuoY != null">ck_lihuo_y = #{ckLihuoY},</if>
<if test="ckType != null">ck_type = #{ckType},</if>
<if test="teamCode != null">team_code = #{teamCode},</if>
<if test="lyTime != null">ly_time = #{lyTime},</if>
<if test="borrowTime != null">borrow_time = #{borrowTime},</if>
<if test="returnTime != null">return_time = #{returnTime},</if>
<if test="ckRemark != null">ck_remark = #{ckRemark},</if>
<if test="isDelivery != null">is_delivery = #{isDelivery},</if>
<if test="hasMoved != null">has_moved = #{hasMoved},</if>
<!-- 新增:封样号 -->
<if test="fycde1 != null">fycde_1 = #{fycde1},</if>
<if test="fycde2 != null">fycde_2 = #{fycde2},</if>
<!-- 关联计划 -->
<if test="gysJhId != null">gys_jh_id = #{gysJhId},</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="deleteRkInfoById" parameterType="Long">
@@ -907,7 +890,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ri.is_delete = '0'
AND ri.is_delivery = '1'
<!-- 可选筛选:按你当前 RkInfo 实体常用查询项补充 -->
<if test="billNoCk != null and billNoCk != ''">
AND ri.bill_no_ck = #{billNoCk}
</if>
@@ -921,7 +903,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND ri.status = #{status}
</if>
<!-- 领用(出库)时间范围 -->
<if test="lyStartTime != null">
AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime}
</if>
@@ -929,7 +910,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND ri.ly_time <![CDATA[ <= ]]> #{lyEndTime}
</if>
<!-- 关键字模糊(项目/物料/供应商/出库单号等) -->
<if test="keyword != null and keyword != ''">
AND (
ri.xm_no_ck LIKE CONCAT('%', #{keyword}, '%')
@@ -953,34 +933,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
(ri.is_delete = '0' OR ri.is_delete = 0 OR ri.is_delete IS NULL)
<!-- keyword 模糊 -->
<if test="keyword != null and 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="isChuku != null and isChuku != ''">
AND ri.is_chuku = #{isChuku}
</if>
<!-- 仓库 -->
<if test="cangku != null and cangku != ''">
AND ri.cangku = #{cangku}
</if>
<!-- 入库时间范围 -->
<if test="startTime != null">
AND ri.rk_time <![CDATA[ >= ]]> #{startTime}
</if>
@@ -988,15 +948,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND ri.rk_time <![CDATA[ <= ]]> #{endTime}
</if>
<!-- 领用(出库)时间范围 -->
<if test="lyStartTime != null">
AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime}
</if>
<if test="lyEndTime != null">
AND ri.ly_time <![CDATA[ <= ]]> #{lyEndTime}
</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="gysNo != null and gysNo != ''">
AND ri.gys_no LIKE CONCAT('%', #{gysNo}, '%')
</if>
<if test="gysMc != null and gysMc != ''">
AND ri.gys_mc LIKE CONCAT('%', #{gysMc}, '%')
</if>
<if test="sapNo != null and sapNo != ''">
AND ri.sap_no LIKE CONCAT('%', #{sapNo}, '%')
</if>
<if test="billNo != null and billNo != ''">
AND ri.bill_no LIKE CONCAT('%', #{billNo}, '%')
</if>
<if test="billNoCk != null and billNoCk != ''">
AND ri.bill_no_ck LIKE CONCAT('%', #{billNoCk}, '%')
</if>
<if test="ckType != null and ckType != ''">
AND ri.ck_type LIKE CONCAT('%', #{ckType}, '%')
</if>
<if test="pcode != null and pcode != ''">
AND ri.pcode LIKE CONCAT('%', #{pcode}, '%')
</if>
<if test="fycde1 != null and fycde1 != ''">
AND ri.fycde_1 LIKE CONCAT('%', #{fycde1}, '%')
</if>
<if test="fycde2 != null and fycde2 != ''">
AND ri.fycde_2 LIKE CONCAT('%', #{fycde2}, '%')
</if>
</where>
ORDER BY ri.create_time DESC, ri.id DESC
</select>
</mapper>
</mapper>