2025-05-30 16:13:27 +08:00
|
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
|
|
<!DOCTYPE mapper
|
2025-10-29 10:15:30 +08:00
|
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<mapper namespace="com.zg.project.wisdom.mapper.RkInfoMapper">
|
2025-07-10 08:40:36 +08:00
|
|
|
|
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<resultMap type="RkInfo" id="RkInfoResult">
|
|
|
|
|
|
<result property="id" column="id" />
|
|
|
|
|
|
<result property="rkType" column="rk_type" />
|
|
|
|
|
|
<result property="wlType" column="wl_type" />
|
|
|
|
|
|
<result property="cangku" column="cangku" />
|
|
|
|
|
|
<result property="rkTime" column="rk_time" />
|
|
|
|
|
|
<result property="lihuoY" column="lihuo_y" />
|
|
|
|
|
|
<result property="isChuku" column="is_chuku" />
|
2025-07-10 08:40:36 +08:00
|
|
|
|
<result property="isBorrowed" column="is_borrowed"/>
|
2025-06-09 15:16:00 +08:00
|
|
|
|
<result property="billNo" column="bill_no"/>
|
2025-06-17 08:39:05 +08:00
|
|
|
|
<result property="billNoCk" column="bill_no_ck"/>
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<result property="rkTypeName" column="rk_type_name"/>
|
|
|
|
|
|
<result property="wlTypeName" column="wl_type_name"/>
|
|
|
|
|
|
<result property="cangkuName" column="cangku_name"/>
|
2025-12-12 14:52:48 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 新增:大仓/小仓编码和名称 -->
|
|
|
|
|
|
<result property="parentWarehouseCode" column="parent_warehouse_code"/>
|
|
|
|
|
|
<result property="parentWarehouseName" column="parent_warehouse_name"/>
|
|
|
|
|
|
<result property="warehouseCode" column="warehouse_code"/>
|
|
|
|
|
|
<result property="warehouseName" column="warehouse_name"/>
|
|
|
|
|
|
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<result property="remark" column="remark" />
|
|
|
|
|
|
<result property="xj" column="xj" />
|
|
|
|
|
|
<result property="xmNo" column="xm_no" />
|
2025-07-18 08:08:37 +08:00
|
|
|
|
<result property="gysJhId" column="gys_jh_id"/>
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<result property="xmMs" column="xm_ms" />
|
2025-07-10 08:40:36 +08:00
|
|
|
|
<result property="xmNoCk" column="xm_no_ck"/>
|
|
|
|
|
|
<result property="xmMsCk" column="xm_ms_ck"/>
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<result property="wlNo" column="wl_no" />
|
|
|
|
|
|
<result property="wlMs" column="wl_ms" />
|
|
|
|
|
|
<result property="gysNo" column="gys_no" />
|
|
|
|
|
|
<result property="gysMc" column="gys_mc" />
|
|
|
|
|
|
<result property="jhAmt" column="jh_amt" />
|
|
|
|
|
|
<result property="htDj" column="ht_dj" />
|
|
|
|
|
|
<result property="sapNo" column="sap_no" />
|
|
|
|
|
|
<result property="xh" column="xh" />
|
|
|
|
|
|
<result property="jhQty" column="jh_qty" />
|
|
|
|
|
|
<result property="htQty" column="ht_qty" />
|
|
|
|
|
|
<result property="dw" column="dw" />
|
|
|
|
|
|
<result property="realQty" column="real_qty" />
|
|
|
|
|
|
<result property="pcode" column="pcode" />
|
2025-06-09 15:16:00 +08:00
|
|
|
|
<result property="pcodeId" column="pcode_id"/>
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<result property="trayCode" column="tray_code" />
|
|
|
|
|
|
<result property="entityId" column="entity_id" />
|
2025-06-09 15:16:00 +08:00
|
|
|
|
<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"/>
|
2025-07-10 08:40:36 +08:00
|
|
|
|
<result property="borrowTime" column="borrow_time"/>
|
|
|
|
|
|
<result property="returnTime" column="return_time"/>
|
2025-06-09 15:16:00 +08:00
|
|
|
|
<result property="ckRemark" column="ck_remark"/>
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<result property="createBy" column="create_by" />
|
|
|
|
|
|
<result property="createTime" column="create_time" />
|
|
|
|
|
|
<result property="updateBy" column="update_by" />
|
|
|
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
|
|
|
<result property="isDelete" column="is_delete" />
|
2025-07-10 08:40:36 +08:00
|
|
|
|
<result property="hasMoved" column="has_moved"/>
|
2025-07-17 08:37:27 +08:00
|
|
|
|
<result property="lihuoYName" column="lihuo_y_name"/>
|
2025-10-29 10:15:30 +08:00
|
|
|
|
<result property="fycde1" column="fycde_1"/>
|
|
|
|
|
|
<result property="fycde2" column="fycde_2"/>
|
2025-10-17 09:26:24 +08:00
|
|
|
|
<result property="isDelivery" column="is_delivery"/>
|
2025-05-30 16:13:27 +08:00
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<!-- 明细查询SQL(包含多表JOIN,用于普通明细分页等) -->
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<sql id="selectRkInfoVo">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
ri.id,
|
2025-06-09 15:16:00 +08:00
|
|
|
|
ri.bill_no,
|
2025-06-17 08:39:05 +08:00
|
|
|
|
ri.bill_no_ck,
|
2025-05-30 16:13:27 +08:00
|
|
|
|
ri.rk_type, st.type_name AS rk_type_name,
|
|
|
|
|
|
ri.wl_type, mt.type_name AS wl_type_name,
|
2025-12-12 14:52:48 +08:00
|
|
|
|
|
|
|
|
|
|
ri.cangku,
|
|
|
|
|
|
wh.warehouse_name AS cangku_name,
|
|
|
|
|
|
|
|
|
|
|
|
-- 新增:大仓/小仓编码和名称
|
|
|
|
|
|
wh.parent_warehouse_code AS parent_warehouse_code,
|
|
|
|
|
|
wh.parent_warehouse_name AS parent_warehouse_name,
|
|
|
|
|
|
wh.warehouse_code AS warehouse_code,
|
|
|
|
|
|
wh.warehouse_name AS warehouse_name,
|
|
|
|
|
|
|
2025-10-17 09:26:24 +08:00
|
|
|
|
ri.rk_time, ri.lihuo_y, ri.is_chuku, ri.is_borrowed, ri.is_delivery,ri.remark,
|
2025-06-17 08:39:05 +08:00
|
|
|
|
ri.ck_lihuo_y, ri.ck_type, sot.type_name AS ck_type_name,
|
2025-06-09 15:16:00 +08:00
|
|
|
|
ri.team_code, ct.team_name,
|
|
|
|
|
|
ri.ck_remark,
|
|
|
|
|
|
ri.ly_time,
|
2025-10-29 10:15:30 +08:00
|
|
|
|
ri.fycde_1, ri.fycde_2,
|
2025-07-10 08:40:36 +08:00
|
|
|
|
ri.borrow_time, ri.return_time,
|
2025-08-05 14:54:55 +08:00
|
|
|
|
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,
|
2025-05-30 16:13:27 +08:00
|
|
|
|
ri.jh_qty, ri.ht_qty, ri.dw, ri.real_qty,
|
2025-06-09 15:16:00 +08:00
|
|
|
|
ri.pcode, ri.pcode_id, ri.tray_code, ri.entity_id,
|
2025-08-05 14:54:55 +08:00
|
|
|
|
ri.status, ri.has_moved,
|
2025-07-17 08:37:27 +08:00
|
|
|
|
ri.create_by, ri.create_time, ri.update_by, ri.update_time, ri.is_delete,
|
|
|
|
|
|
u.user_name AS lihuo_y_name
|
2025-05-30 16:13:27 +08:00
|
|
|
|
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
|
2025-06-17 08:39:05 +08:00
|
|
|
|
LEFT JOIN stock_out_type sot ON ri.ck_type = sot.type_code
|
2025-06-09 15:16:00 +08:00
|
|
|
|
LEFT JOIN construction_team ct ON ri.team_code = ct.team_code
|
2025-07-17 08:37:27 +08:00
|
|
|
|
LEFT JOIN sys_user u ON ri.lihuo_y = u.user_id
|
2025-05-30 16:13:27 +08:00
|
|
|
|
</sql>
|
|
|
|
|
|
|
2025-10-29 10:15:30 +08:00
|
|
|
|
<!-- 轻量分组专用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>
|
|
|
|
|
|
|
2025-07-16 11:03:25 +08:00
|
|
|
|
<insert id="batchInsertRkInfo"
|
|
|
|
|
|
parameterType="java.util.List"
|
|
|
|
|
|
useGeneratedKeys="true"
|
|
|
|
|
|
keyProperty="id">
|
2025-07-10 08:40:36 +08:00
|
|
|
|
INSERT INTO rk_info (
|
2025-06-09 15:16:00 +08:00
|
|
|
|
bill_no,
|
2025-05-30 16:13:27 +08:00
|
|
|
|
rk_type, wl_type, cangku, lihuo_y, rk_time,
|
2025-07-10 08:40:36 +08:00
|
|
|
|
wl_no, wl_ms, xm_no, xm_ms,
|
|
|
|
|
|
xm_no_ck, xm_ms_ck, xj, sap_no, gys_no, gys_mc,
|
2025-06-04 11:34:07 +08:00
|
|
|
|
jh_qty, ht_qty, jh_amt, ht_dj, dw,
|
2025-07-17 08:37:27 +08:00
|
|
|
|
borrow_time, return_time, status,
|
2025-10-29 10:15:30 +08:00
|
|
|
|
pcode, pcode_id, tray_code, real_qty, entity_id, fycde_1, fycde_2,
|
2025-07-17 08:37:27 +08:00
|
|
|
|
remark, is_chuku, is_borrowed, gys_jh_id,
|
2025-07-14 09:28:10 +08:00
|
|
|
|
is_delete, create_by, create_time
|
2025-05-30 16:13:27 +08:00
|
|
|
|
)
|
2025-07-10 08:40:36 +08:00
|
|
|
|
VALUES
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<foreach collection="list" item="item" separator=",">
|
|
|
|
|
|
(
|
2025-06-09 15:16:00 +08:00
|
|
|
|
#{item.billNo},
|
2025-05-30 16:13:27 +08:00
|
|
|
|
#{item.rkType}, #{item.wlType}, #{item.cangku}, #{item.lihuoY}, #{item.rkTime},
|
2025-07-10 08:40:36 +08:00
|
|
|
|
#{item.wlNo}, #{item.wlMs}, #{item.xmNo}, #{item.xmMs},
|
|
|
|
|
|
#{item.xmNoCk}, #{item.xmMsCk}, #{item.xj}, #{item.sapNo}, #{item.gysNo}, #{item.gysMc},
|
2025-06-04 11:34:07 +08:00
|
|
|
|
#{item.jhQty}, #{item.htQty}, #{item.jhAmt}, #{item.htDj}, #{item.dw},
|
2025-07-17 08:37:27 +08:00
|
|
|
|
#{item.borrowTime}, #{item.returnTime}, #{item.status},
|
2025-12-12 14:52:48 +08:00
|
|
|
|
#{item.pcode}, #{item.pcodeId}, #{item.trayCode}, #{item.realQty}, #{item.entityId},
|
|
|
|
|
|
#{item.fycde1}, #{item.fycde2},
|
2025-07-17 08:37:27 +08:00
|
|
|
|
#{item.remark}, #{item.isChuku}, #{item.isBorrowed}, #{item.gysJhId},
|
2025-07-14 09:28:10 +08:00
|
|
|
|
#{item.isDelete}, #{item.createBy}, #{item.createTime}
|
2025-05-30 16:13:27 +08:00
|
|
|
|
)
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</insert>
|
2025-07-17 08:37:27 +08:00
|
|
|
|
|
2025-07-10 08:40:36 +08:00
|
|
|
|
<!--还料入库-->
|
|
|
|
|
|
<insert id="insertRkInfo" parameterType="RkInfo" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
|
INSERT INTO rk_info (
|
|
|
|
|
|
rk_type, wl_type, cangku, rk_time, lihuo_y,
|
2025-08-05 14:54:55 +08:00
|
|
|
|
is_chuku, remark, bill_no, xj, xm_no, xm_ms, is_borrowed,
|
2025-07-10 08:40:36 +08:00
|
|
|
|
wl_no, wl_ms, gys_no, gys_mc, jh_amt, ht_dj,
|
|
|
|
|
|
sap_no, xh, jh_qty, ht_qty, dw, real_qty,
|
|
|
|
|
|
pcode, tray_code, entity_id,
|
|
|
|
|
|
ck_lihuo_y, ck_type, team_code, ck_remark,
|
|
|
|
|
|
ly_time, bill_no_ck, has_moved,
|
2025-08-05 14:54:55 +08:00
|
|
|
|
gys_jh_id,
|
2025-07-10 08:40:36 +08:00
|
|
|
|
create_by, create_time, update_by, update_time, is_delete
|
|
|
|
|
|
) VALUES (
|
|
|
|
|
|
#{rkType}, #{wlType}, #{cangku}, #{rkTime}, #{lihuoY},
|
2025-08-05 14:54:55 +08:00
|
|
|
|
#{isChuku}, #{remark}, #{billNo}, #{xj}, #{xmNo}, #{xmMs}, #{isBorrowed},
|
2025-07-10 08:40:36 +08:00
|
|
|
|
#{wlNo}, #{wlMs}, #{gysNo}, #{gysMc}, #{jhAmt}, #{htDj},
|
|
|
|
|
|
#{sapNo}, #{xh}, #{jhQty}, #{htQty}, #{dw}, #{realQty},
|
|
|
|
|
|
#{pcode}, #{trayCode}, #{entityId},
|
|
|
|
|
|
#{ckLihuoY}, #{ckType}, #{teamCode}, #{ckRemark},
|
|
|
|
|
|
#{lyTime}, #{billNoCk}, #{hasMoved},
|
2025-08-05 14:54:55 +08:00
|
|
|
|
#{gysJhId},
|
2025-07-10 08:40:36 +08:00
|
|
|
|
#{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{isDelete}
|
|
|
|
|
|
)
|
|
|
|
|
|
</insert>
|
2025-05-30 16:13:27 +08:00
|
|
|
|
|
2025-06-17 08:39:05 +08:00
|
|
|
|
<update id="cancelStockOut">
|
|
|
|
|
|
UPDATE rk_info
|
|
|
|
|
|
SET
|
|
|
|
|
|
is_chuku = '0',
|
|
|
|
|
|
bill_no_ck = NULL,
|
|
|
|
|
|
ck_lihuo_y = NULL,
|
|
|
|
|
|
ck_type = NULL,
|
|
|
|
|
|
team_code = NULL,
|
|
|
|
|
|
ly_time = NULL,
|
|
|
|
|
|
ck_remark = NULL,
|
2025-07-10 08:40:36 +08:00
|
|
|
|
is_borrowed = NULL,
|
2025-06-17 08:39:05 +08:00
|
|
|
|
update_time = NOW()
|
|
|
|
|
|
WHERE bill_no_ck = #{billNoCk}
|
|
|
|
|
|
</update>
|
2025-07-24 14:19:42 +08:00
|
|
|
|
|
2025-07-21 11:17:44 +08:00
|
|
|
|
<delete id="deleteByBillNo">
|
|
|
|
|
|
DELETE FROM rk_info
|
|
|
|
|
|
WHERE bill_no = #{billNo}
|
|
|
|
|
|
</delete>
|
2025-06-17 08:39:05 +08:00
|
|
|
|
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<select id="selectRkInfoList" parameterType="RkInfo" resultMap="RkInfoResult">
|
|
|
|
|
|
<include refid="selectRkInfoVo"/>
|
|
|
|
|
|
<where>
|
2025-12-09 15:54:39 +08:00
|
|
|
|
<!-- is_chuku 多状态 / 单状态 -->
|
2025-08-01 09:27:07 +08:00
|
|
|
|
<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>
|
2025-07-25 17:04:11 +08:00
|
|
|
|
|
2025-12-09 15:54:39 +08:00
|
|
|
|
<!-- 关键字搜索 -->
|
2025-06-05 09:05:08 +08:00
|
|
|
|
<if test="keyword != null and keyword != ''">
|
2025-08-01 09:27:07 +08:00
|
|
|
|
AND (
|
2025-12-12 14:52:48 +08:00
|
|
|
|
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}, '%')
|
|
|
|
|
|
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}, '%')
|
2025-06-05 09:05:08 +08:00
|
|
|
|
)
|
|
|
|
|
|
</if>
|
2025-07-25 17:04:11 +08:00
|
|
|
|
|
|
|
|
|
|
<if test="rkType != null and rkType != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.rk_type LIKE concat('%', #{rkType}, '%')
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="wlType != null and wlType != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.wl_type LIKE concat('%', #{wlType}, '%')
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="cangku != null and cangku != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.cangku LIKE concat('%', #{cangku}, '%')
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
2025-10-29 10:15:30 +08:00
|
|
|
|
<if test="fycde1 != null and fycde1 != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.fycde_1 LIKE concat('%', #{fycde1}, '%')
|
2025-10-29 10:15:30 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="fycde2 != null and fycde2 != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.fycde_2 LIKE concat('%', #{fycde2}, '%')
|
2025-10-29 10:15:30 +08:00
|
|
|
|
</if>
|
2025-12-09 15:54:39 +08:00
|
|
|
|
|
2025-07-24 15:47:47 +08:00
|
|
|
|
<if test="ids != null and ids.size > 0">
|
|
|
|
|
|
AND ri.id IN
|
|
|
|
|
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
|
|
|
|
|
#{id}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
2025-07-25 17:04:11 +08:00
|
|
|
|
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<if test="startTime != null">
|
|
|
|
|
|
<![CDATA[
|
|
|
|
|
|
AND ri.rk_time >= #{startTime}
|
|
|
|
|
|
]]>
|
2025-12-09 15:54:39 +08:00
|
|
|
|
</if>
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<if test="endTime != null">
|
|
|
|
|
|
<![CDATA[
|
|
|
|
|
|
AND ri.rk_time < DATE_ADD(#{endTime}, INTERVAL 1 DAY)
|
|
|
|
|
|
]]>
|
2025-08-01 09:27:07 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
|
|
<if test="lyStartTime != null">
|
|
|
|
|
|
<![CDATA[ AND ri.ly_time >= #{lyStartTime} ]]>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="lyEndTime != null">
|
|
|
|
|
|
<![CDATA[ AND ri.ly_time <= #{lyEndTime} ]]>
|
2025-07-10 08:40:36 +08:00
|
|
|
|
</if>
|
2025-07-25 17:04:11 +08:00
|
|
|
|
|
|
|
|
|
|
<if test="lihuoY != null and lihuoY != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.lihuo_y LIKE concat('%', #{lihuoY}, '%')
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="xj != null and xj != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.xj LIKE concat('%', #{xj}, '%')
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="billNo != null and billNo != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.bill_no LIKE concat('%', #{billNo}, '%')
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="billNoCk != null and billNoCk != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.bill_no_ck LIKE concat('%', #{billNoCk}, '%')
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="xmNo != null and xmNo != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.xm_no LIKE concat('%', #{xmNo}, '%')
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="xmMs != null and xmMs != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.xm_ms LIKE concat('%', #{xmMs}, '%')
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="wlNo != null and wlNo != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.wl_no LIKE concat('%', #{wlNo}, '%')
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="wlMs != null and wlMs != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.wl_ms LIKE concat('%', #{wlMs}, '%')
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="gysNo != null and gysNo != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.gys_no LIKE concat('%', #{gysNo}, '%')
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="gysMc != null and gysMc != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.gys_mc LIKE concat('%', #{gysMc}, '%')
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
|
|
<if test="jhAmt != null">
|
2025-08-01 09:27:07 +08:00
|
|
|
|
AND ri.jh_amt = #{jhAmt}
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="htDj != null">
|
2025-08-01 09:27:07 +08:00
|
|
|
|
AND ri.ht_dj = #{htDj}
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
|
|
<if test="sapNo != null and sapNo != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.sap_no LIKE concat('%', #{sapNo}, '%')
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="xh != null and xh != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.xh LIKE concat('%', #{xh}, '%')
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="jhQty != null">
|
2025-08-01 09:27:07 +08:00
|
|
|
|
AND ri.jh_qty = #{jhQty}
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="htQty != null">
|
2025-08-01 09:27:07 +08:00
|
|
|
|
AND ri.ht_qty = #{htQty}
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="dw != null and dw != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.dw LIKE concat('%', #{dw}, '%')
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="realQty != null">
|
2025-08-01 09:27:07 +08:00
|
|
|
|
AND ri.real_qty = #{realQty}
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
|
|
<if test="pcode != null and pcode != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.pcode LIKE concat('%', #{pcode}, '%')
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="lyTime != null">
|
2025-08-01 09:27:07 +08:00
|
|
|
|
AND ri.ly_time = #{lyTime}
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="returnTime != null">
|
2025-08-01 09:27:07 +08:00
|
|
|
|
AND ri.return_time = #{returnTime}
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="trayCode != null and trayCode != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.tray_code LIKE concat('%', #{trayCode}, '%')
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="entityId != null and entityId != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.entity_id LIKE concat('%', #{entityId}, '%')
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="ckType != null and ckType != ''">
|
2025-12-12 14:52:48 +08:00
|
|
|
|
AND ri.ck_type LIKE concat('%', #{ckType}, '%')
|
2025-07-25 17:04:11 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
|
2025-08-01 09:27:07 +08:00
|
|
|
|
<choose>
|
|
|
|
|
|
<when test="isDelete != null and isDelete != ''">
|
|
|
|
|
|
AND ri.is_delete = #{isDelete}
|
|
|
|
|
|
</when>
|
|
|
|
|
|
<otherwise>
|
|
|
|
|
|
AND ri.is_delete = 0
|
|
|
|
|
|
</otherwise>
|
|
|
|
|
|
</choose>
|
2025-05-30 16:13:27 +08:00
|
|
|
|
</where>
|
2025-08-01 09:27:07 +08:00
|
|
|
|
ORDER BY ri.rk_time DESC
|
2025-05-30 16:13:27 +08:00
|
|
|
|
</select>
|
2025-06-04 11:34:07 +08:00
|
|
|
|
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<select id="selectBorrowAndReturnList"
|
|
|
|
|
|
parameterType="RkInfo"
|
|
|
|
|
|
resultMap="RkInfoResult">
|
|
|
|
|
|
|
|
|
|
|
|
<include refid="selectRkInfoVo"/>
|
|
|
|
|
|
|
|
|
|
|
|
<where>
|
|
|
|
|
|
<!-- 只查未删除 -->
|
|
|
|
|
|
<choose>
|
|
|
|
|
|
<when test="isDelete != null and isDelete != ''">
|
|
|
|
|
|
AND ri.is_delete = #{isDelete}
|
|
|
|
|
|
</when>
|
|
|
|
|
|
<otherwise>
|
|
|
|
|
|
AND ri.is_delete = 0
|
|
|
|
|
|
</otherwise>
|
|
|
|
|
|
</choose>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 借料/还料状态:0 否,1 借料中,2 已归还 -->
|
|
|
|
|
|
<choose>
|
|
|
|
|
|
<when test="isBorrowed != null and isBorrowed != ''">
|
|
|
|
|
|
AND ri.is_borrowed = #{isBorrowed}
|
|
|
|
|
|
</when>
|
|
|
|
|
|
<otherwise>
|
|
|
|
|
|
AND ri.is_borrowed IN ('1','2')
|
|
|
|
|
|
</otherwise>
|
|
|
|
|
|
</choose>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 时间范围:根据 isBorrowed 选择 borrow_time / return_time -->
|
|
|
|
|
|
<!-- 先添加通用时间条件,如果isBorrowed为1或2时使用对应的时间字段 -->
|
|
|
|
|
|
<if test="startTime != null">
|
|
|
|
|
|
<choose>
|
|
|
|
|
|
<when test="isBorrowed != null and (isBorrowed == '1' or isBorrowed == 1)">
|
|
|
|
|
|
<![CDATA[
|
|
|
|
|
|
AND ri.borrow_time >= #{startTime}
|
|
|
|
|
|
]]>
|
|
|
|
|
|
</when>
|
|
|
|
|
|
<when test="isBorrowed != null and (isBorrowed == '2' or isBorrowed == 2)">
|
|
|
|
|
|
<![CDATA[
|
|
|
|
|
|
AND ri.return_time >= #{startTime}
|
|
|
|
|
|
]]>
|
|
|
|
|
|
</when>
|
|
|
|
|
|
<otherwise>
|
|
|
|
|
|
<![CDATA[
|
|
|
|
|
|
AND ri.rk_time >= #{startTime}
|
|
|
|
|
|
]]>
|
|
|
|
|
|
</otherwise>
|
|
|
|
|
|
</choose>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="endTime != null">
|
|
|
|
|
|
<choose>
|
|
|
|
|
|
<when test="isBorrowed != null and (isBorrowed == '1' or isBorrowed == 1)">
|
|
|
|
|
|
<![CDATA[
|
|
|
|
|
|
AND ri.borrow_time < DATE_ADD(#{endTime}, INTERVAL 1 DAY)
|
|
|
|
|
|
]]>
|
|
|
|
|
|
</when>
|
|
|
|
|
|
<when test="isBorrowed != null and (isBorrowed == '2' or isBorrowed == 2)">
|
|
|
|
|
|
<![CDATA[
|
|
|
|
|
|
AND ri.return_time < DATE_ADD(#{endTime}, INTERVAL 1 DAY)
|
|
|
|
|
|
]]>
|
|
|
|
|
|
</when>
|
|
|
|
|
|
<otherwise>
|
|
|
|
|
|
<![CDATA[
|
|
|
|
|
|
AND ri.rk_time < DATE_ADD(#{endTime}, INTERVAL 1 DAY)
|
|
|
|
|
|
]]>
|
|
|
|
|
|
</otherwise>
|
|
|
|
|
|
</choose>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
|
|
<if test="xmNo != null and xmNo != ''">
|
|
|
|
|
|
AND ri.xm_no LIKE concat('%', #{xmNo}, '%')
|
|
|
|
|
|
</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>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
|
|
|
|
|
|
ORDER BY ri.borrow_time DESC, ri.return_time DESC, ri.id DESC
|
|
|
|
|
|
</select>
|
2025-12-09 15:54:39 +08:00
|
|
|
|
|
2025-09-04 16:55:56 +08:00
|
|
|
|
<select id="selectGroupedByBill" resultMap="RkInfoResult" parameterType="map">
|
|
|
|
|
|
SELECT
|
2025-09-15 15:17:16 +08:00
|
|
|
|
a.id,
|
|
|
|
|
|
a.bill_no,
|
|
|
|
|
|
a.bill_no_ck,
|
|
|
|
|
|
a.rk_type,
|
|
|
|
|
|
si.type_name AS rk_type_name,
|
|
|
|
|
|
a.wl_type,
|
2025-11-04 14:38:08 +08:00
|
|
|
|
mt.type_name AS wl_type_name,
|
2025-09-15 15:17:16 +08:00
|
|
|
|
a.cangku,
|
|
|
|
|
|
a.rk_time,
|
|
|
|
|
|
a.lihuo_y,
|
|
|
|
|
|
a.is_chuku,
|
|
|
|
|
|
a.xj,
|
|
|
|
|
|
a.xm_no,
|
|
|
|
|
|
a.xm_ms,
|
|
|
|
|
|
a.xm_no_ck,
|
|
|
|
|
|
a.xm_ms_ck,
|
2025-09-19 11:23:51 +08:00
|
|
|
|
a.gys_mc,
|
2025-09-15 15:17:16 +08:00
|
|
|
|
a.wl_no,
|
|
|
|
|
|
a.wl_ms,
|
|
|
|
|
|
a.gys_no,
|
|
|
|
|
|
a.sap_no,
|
|
|
|
|
|
a.ck_type,
|
|
|
|
|
|
so.type_name AS ck_type_name,
|
|
|
|
|
|
a.ly_time,
|
|
|
|
|
|
a.ck_lihuo_y,
|
2025-11-04 10:43:53 +08:00
|
|
|
|
u.user_name AS ck_lihuo_y_name,
|
2025-11-25 16:30:46 +08:00
|
|
|
|
ru.user_name AS lihuo_y_name,
|
|
|
|
|
|
a.is_delivery AS is_delivery
|
2025-09-15 15:17:16 +08:00
|
|
|
|
FROM (
|
|
|
|
|
|
SELECT
|
2025-11-25 16:30:46 +08:00
|
|
|
|
MIN(t.id) AS 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,
|
|
|
|
|
|
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.ck_lihuo_y) AS ck_lihuo_y,
|
|
|
|
|
|
MIN(t.is_delivery) AS is_delivery
|
2025-09-04 16:55:56 +08:00
|
|
|
|
FROM (
|
2025-11-25 16:30:46 +08:00
|
|
|
|
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,
|
|
|
|
|
|
ri.is_delivery
|
|
|
|
|
|
FROM rk_info ri
|
2025-09-04 16:55:56 +08:00
|
|
|
|
) t
|
|
|
|
|
|
<where>
|
2025-11-25 16:30:46 +08:00
|
|
|
|
<!-- is_delete -->
|
2025-10-29 10:15:30 +08:00
|
|
|
|
<choose>
|
|
|
|
|
|
<when test="q.isDelete != null and q.isDelete != ''">
|
|
|
|
|
|
AND t.is_delete = #{q.isDelete}
|
|
|
|
|
|
</when>
|
|
|
|
|
|
<otherwise>
|
|
|
|
|
|
AND t.is_delete = 0
|
|
|
|
|
|
</otherwise>
|
|
|
|
|
|
</choose>
|
|
|
|
|
|
|
2025-11-25 16:30:46 +08:00
|
|
|
|
<!-- is_chuku / isChukuList -->
|
2025-09-04 16:55:56 +08:00
|
|
|
|
<choose>
|
|
|
|
|
|
<when test="q.isChukuList != null and q.isChukuList.size > 0">
|
|
|
|
|
|
AND t.is_chuku IN
|
|
|
|
|
|
<foreach collection="q.isChukuList" item="val" open="(" separator="," close=")">
|
|
|
|
|
|
#{val}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</when>
|
|
|
|
|
|
<when test="q.isChuku != null and q.isChuku != ''">
|
|
|
|
|
|
AND t.is_chuku = #{q.isChuku}
|
|
|
|
|
|
</when>
|
|
|
|
|
|
</choose>
|
|
|
|
|
|
|
2025-11-25 16:30:46 +08:00
|
|
|
|
<!-- keyword -->
|
2025-09-04 16:55:56 +08:00
|
|
|
|
<if test="q.keyword != null and q.keyword != ''">
|
|
|
|
|
|
AND (
|
2025-10-29 10:15:30 +08:00
|
|
|
|
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}, '%')
|
2025-09-15 15:17:16 +08:00
|
|
|
|
OR t.bill_no_ck LIKE concat('%', #{q.keyword}, '%')
|
2025-10-29 10:15:30 +08:00
|
|
|
|
OR t.ck_type LIKE concat('%', #{q.keyword}, '%')
|
|
|
|
|
|
OR t.pcode LIKE concat('%', #{q.keyword}, '%')
|
2025-09-04 16:55:56 +08:00
|
|
|
|
)
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
2025-11-25 16:30:46 +08:00
|
|
|
|
<!-- 维度 -->
|
2025-10-29 10:15:30 +08:00
|
|
|
|
<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>
|
|
|
|
|
|
|
2025-11-25 16:30:46 +08:00
|
|
|
|
<!-- 时间 -->
|
2025-10-29 10:15:30 +08:00
|
|
|
|
<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>
|
|
|
|
|
|
|
2025-11-25 16:30:46 +08:00
|
|
|
|
<!-- 模糊字段 -->
|
|
|
|
|
|
<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>
|
2025-10-29 10:15:30 +08:00
|
|
|
|
<if test="q.billNoCk != null and q.billNoCk != ''"> AND t.bill_no_ck LIKE concat('%', #{q.billNoCk}, '%') </if>
|
2025-11-25 16:30:46 +08:00
|
|
|
|
<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.pcode != null and q.pcode != ''"> AND t.pcode LIKE concat('%', #{q.pcode}, '%') </if>
|
2025-12-09 15:54:39 +08:00
|
|
|
|
<if test="q.ckType != null and q.ckType != ''"> AND t.ck_type LIKE concat('%', #{q.ckType}, '%') </if>
|
2025-11-25 16:30:46 +08:00
|
|
|
|
|
|
|
|
|
|
<if test="q.isDelivery != null and q.isDelivery != ''">
|
|
|
|
|
|
AND t.is_delivery = #{q.isDelivery}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<!-- 出库才要 bill_no_ck 非空 -->
|
2025-11-25 16:30:46 +08:00
|
|
|
|
<if test="(q.isChuku != null and q.isChuku == '1')
|
|
|
|
|
|
or (q.isChukuList != null and q.isChukuList.size > 0 and q.isChukuList.contains('1'))">
|
2025-09-04 16:55:56 +08:00
|
|
|
|
AND t.bill_no_ck IS NOT NULL
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
2025-11-25 16:30:46 +08:00
|
|
|
|
<!-- 审核 -->
|
2025-09-04 16:55:56 +08:00
|
|
|
|
<if test="needAudit != null and needAudit == 1">
|
|
|
|
|
|
AND NOT EXISTS (
|
|
|
|
|
|
SELECT 1
|
2025-10-29 10:15:30 +08:00
|
|
|
|
FROM rk_info r2
|
|
|
|
|
|
JOIN audit_signature asg
|
|
|
|
|
|
ON asg.rk_id = r2.id
|
2025-09-04 16:55:56 +08:00
|
|
|
|
AND asg.approver_id IS NOT NULL
|
|
|
|
|
|
AND (asg.audit_result IS NOT NULL AND asg.audit_result != '1')
|
2025-10-29 10:15:30 +08:00
|
|
|
|
WHERE r2.bill_no = t.bill_no
|
|
|
|
|
|
AND r2.is_delete = 0
|
2025-09-04 16:55:56 +08:00
|
|
|
|
)
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
GROUP BY t.bill_no
|
2025-09-15 15:17:16 +08:00
|
|
|
|
) a
|
2025-10-29 10:15:30 +08:00
|
|
|
|
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
|
2025-11-25 16:30:46 +08:00
|
|
|
|
LEFT JOIN material_type mt ON a.wl_type = mt.type_code
|
|
|
|
|
|
LEFT JOIN sys_user ru ON a.lihuo_y = ru.user_id
|
2025-09-15 15:17:16 +08:00
|
|
|
|
ORDER BY a.rk_time DESC
|
2025-09-04 16:55:56 +08:00
|
|
|
|
</select>
|
2025-11-25 16:30:46 +08:00
|
|
|
|
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<!-- ================== /按单据分组查询 ================== -->
|
2025-09-04 16:55:56 +08:00
|
|
|
|
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<select id="selectRkInfoById" parameterType="Long" resultMap="RkInfoResult">
|
|
|
|
|
|
<include refid="selectRkInfoVo"/>
|
2025-06-04 11:34:07 +08:00
|
|
|
|
where ri.id = #{id} and ri.is_delete = 0
|
2025-05-30 16:13:27 +08:00
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-06-03 14:27:17 +08:00
|
|
|
|
<select id="countRkInfoByLocationCode" resultType="int">
|
|
|
|
|
|
SELECT COUNT(1)
|
2025-06-09 15:16:00 +08:00
|
|
|
|
FROM rk_info ri
|
|
|
|
|
|
WHERE ri.pcode = #{locationCode} AND ri.is_delete = 0
|
2025-06-03 14:27:17 +08:00
|
|
|
|
</select>
|
2025-06-04 11:34:07 +08:00
|
|
|
|
|
|
|
|
|
|
<select id="selectUsedPcodes" resultType="java.lang.String">
|
|
|
|
|
|
SELECT DISTINCT pcode
|
2025-06-09 15:16:00 +08:00
|
|
|
|
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
|
2025-07-10 08:40:36 +08:00
|
|
|
|
WHERE is_delete = 0 AND is_chuku = 0
|
2025-10-29 10:15:30 +08:00
|
|
|
|
<![CDATA[
|
2025-06-09 15:16:00 +08:00
|
|
|
|
AND DATE(rk_time) <= DATE_SUB(CURDATE(), INTERVAL 20 DAY)
|
|
|
|
|
|
]]>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectTopOverdueStock" resultMap="RkInfoResult">
|
|
|
|
|
|
SELECT * FROM rk_info
|
2025-07-10 08:40:36 +08:00
|
|
|
|
WHERE is_delete = 0 AND is_chuku = 0
|
2025-10-29 10:15:30 +08:00
|
|
|
|
<![CDATA[
|
2025-06-09 15:16:00 +08:00
|
|
|
|
AND DATE(rk_time) <= DATE_SUB(CURDATE(), INTERVAL 20 DAY)
|
2025-10-29 10:15:30 +08:00
|
|
|
|
]]>
|
|
|
|
|
|
ORDER BY rk_time DESC
|
2025-06-09 15:16:00 +08:00
|
|
|
|
LIMIT #{limit}
|
2025-06-04 11:34:07 +08:00
|
|
|
|
</select>
|
2025-10-29 10:15:30 +08:00
|
|
|
|
|
2025-06-17 08:39:05 +08:00
|
|
|
|
<select id="selectSapNoByCkBillNo" resultType="java.lang.String">
|
|
|
|
|
|
SELECT DISTINCT sap_no FROM rk_info
|
|
|
|
|
|
WHERE bill_no = #{billNo} AND sap_no IS NOT NULL
|
|
|
|
|
|
</select>
|
2025-06-04 11:34:07 +08:00
|
|
|
|
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<!-- 正常数据:扫描到的库位(限定场景) -->
|
2025-09-15 15:17:16 +08:00
|
|
|
|
<select id="getByPcodeIdList" parameterType="map" resultMap="RkInfoResult">
|
2025-07-10 08:40:36 +08:00
|
|
|
|
SELECT
|
|
|
|
|
|
ri.id, ri.rk_type, ri.wl_type, ri.cangku, ri.rk_time, ri.lihuo_y,
|
|
|
|
|
|
ri.is_chuku, ri.bill_no, ri.bill_no_ck,
|
2025-07-14 09:28:10 +08:00
|
|
|
|
ri.remark, ri.xj, ri.xm_no, ri.xm_ms, ri.wl_no, ri.wl_ms, ri.is_borrowed,
|
2025-07-10 08:40:36 +08:00
|
|
|
|
ri.gys_no, ri.gys_mc, ri.jh_amt, ri.ht_dj, ri.sap_no, ri.xh,
|
2025-07-14 09:28:10 +08:00
|
|
|
|
ri.jh_qty, ri.ht_qty, ri.dw, ri.real_qty, ri.borrow_time, ri.return_time,
|
2025-07-10 08:40:36 +08:00
|
|
|
|
ri.pcode, ri.pcode_id, ri.tray_code, ri.entity_id,
|
|
|
|
|
|
ri.ck_lihuo_y, ri.ck_type, ri.team_code, ri.ly_time, ri.ck_remark,
|
|
|
|
|
|
ri.create_by, ri.create_time, ri.update_by, ri.update_time, ri.is_delete
|
|
|
|
|
|
FROM rk_info ri
|
2025-09-15 15:17:16 +08:00
|
|
|
|
JOIN pcde_detail pd ON ri.pcode_id = pd.encoded_id
|
2025-07-10 08:40:36 +08:00
|
|
|
|
WHERE ri.is_delete = '0'
|
2025-09-15 15:17:16 +08:00
|
|
|
|
AND pd.is_delete = '0'
|
|
|
|
|
|
AND ri.is_chuku = '0'
|
|
|
|
|
|
AND pd.scene = #{sceneId}
|
2025-07-10 08:40:36 +08:00
|
|
|
|
AND ri.pcode_id IN
|
|
|
|
|
|
<foreach collection="list" item="id" open="(" separator="," close=")">
|
|
|
|
|
|
#{id}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<!-- 未扫描到的数据(限定场景) -->
|
2025-09-15 15:17:16 +08:00
|
|
|
|
<select id="getMissedPcodeIds" parameterType="map" resultMap="RkInfoResult">
|
2025-07-10 08:40:36 +08:00
|
|
|
|
SELECT
|
2025-09-15 15:17:16 +08:00
|
|
|
|
ri.id, ri.rk_type, ri.wl_type, ri.cangku, ri.rk_time, ri.lihuo_y,
|
|
|
|
|
|
ri.is_chuku, ri.bill_no, ri.bill_no_ck,
|
|
|
|
|
|
ri.remark, ri.xj, ri.xm_no, ri.xm_ms, ri.wl_no, ri.wl_ms, ri.is_borrowed,
|
|
|
|
|
|
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.pcode_id, ri.tray_code, ri.entity_id,
|
|
|
|
|
|
ri.ck_lihuo_y, ri.ck_type, ri.team_code, ri.ly_time, ri.ck_remark,
|
|
|
|
|
|
ri.create_by, ri.create_time, ri.update_by, ri.update_time, ri.is_delete
|
|
|
|
|
|
FROM rk_info ri
|
|
|
|
|
|
JOIN pcde_detail pd ON ri.pcode_id = pd.encoded_id
|
|
|
|
|
|
WHERE ri.is_delete = '0'
|
|
|
|
|
|
AND ri.is_chuku = '0'
|
|
|
|
|
|
AND pd.is_delete = '0'
|
|
|
|
|
|
AND pd.scene = #{sceneId}
|
2025-07-10 08:40:36 +08:00
|
|
|
|
<if test="list != null and list.size() > 0">
|
2025-09-15 15:17:16 +08:00
|
|
|
|
AND ri.pcode_id NOT IN
|
2025-07-10 08:40:36 +08:00
|
|
|
|
<foreach collection="list" item="id" open="(" separator="," close=")">
|
|
|
|
|
|
#{id}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-09-15 15:17:16 +08:00
|
|
|
|
<!-- 判断某个库位在场景内是否存在 -->
|
|
|
|
|
|
<select id="existsByPcodeId" parameterType="map" resultType="java.lang.Integer">
|
2025-07-10 08:40:36 +08:00
|
|
|
|
SELECT COUNT(1)
|
2025-09-15 15:17:16 +08:00
|
|
|
|
FROM rk_info ri
|
|
|
|
|
|
JOIN pcde_detail pd ON ri.pcode_id = pd.encoded_id
|
|
|
|
|
|
WHERE ri.is_delete = '0'
|
|
|
|
|
|
AND pd.is_delete = '0'
|
|
|
|
|
|
AND ri.is_chuku = '0'
|
|
|
|
|
|
AND ri.pcode_id = #{pcodeId}
|
|
|
|
|
|
AND pd.scene = #{sceneId}
|
2025-07-10 08:40:36 +08:00
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="countGetByWh" resultType="java.lang.Integer" parameterType="java.lang.String">
|
|
|
|
|
|
SELECT COUNT(1) FROM rk_info
|
|
|
|
|
|
WHERE is_delete = '0'
|
|
|
|
|
|
AND cangku = #{warehouse}
|
|
|
|
|
|
AND is_chuku = '0'
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-09-16 15:23:04 +08:00
|
|
|
|
<select id="getUnscannedPcodeByScene"
|
2025-12-12 14:52:48 +08:00
|
|
|
|
resultType="com.zg.project.inventory.domain.vo.RkInfoMatchVO">
|
2025-07-10 08:40:36 +08:00
|
|
|
|
SELECT
|
2025-09-16 15:23:04 +08:00
|
|
|
|
r.pcode AS rkPcode,
|
|
|
|
|
|
COALESCE(SUM(r.real_qty), 0) AS realQty
|
|
|
|
|
|
FROM pcde_detail d
|
2025-10-29 10:15:30 +08:00
|
|
|
|
JOIN rk_info r ON r.pcode = d.pcode
|
2025-09-16 15:23:04 +08:00
|
|
|
|
LEFT JOIN (
|
|
|
|
|
|
SELECT DISTINCT pcode
|
|
|
|
|
|
FROM inventory_match_scan
|
|
|
|
|
|
WHERE task_id = #{taskId}
|
|
|
|
|
|
AND status = '0'
|
2025-10-29 10:15:30 +08:00
|
|
|
|
) s ON s.pcode = r.pcode
|
2025-09-16 15:23:04 +08:00
|
|
|
|
WHERE (d.is_delete IS NULL OR d.is_delete = '0')
|
|
|
|
|
|
AND d.scene = #{sceneId}
|
|
|
|
|
|
AND r.is_chuku = '0'
|
|
|
|
|
|
AND s.pcode IS NULL
|
|
|
|
|
|
GROUP BY r.pcode
|
|
|
|
|
|
ORDER BY MAX(r.create_time) DESC
|
2025-07-10 08:40:36 +08:00
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<select id="selectPcdeCntFromRkInfo" resultType="com.zg.project.inventory.domain.vo.PcdeCntVO">
|
2025-07-10 08:40:36 +08:00
|
|
|
|
SELECT pcode AS pcde,
|
|
|
|
|
|
COUNT(*) AS cnt
|
|
|
|
|
|
FROM rk_info
|
|
|
|
|
|
WHERE pcode_id IN
|
|
|
|
|
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
|
|
|
|
|
#{id}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
GROUP BY pcode
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-07-16 11:03:25 +08:00
|
|
|
|
<select id="selectOneForEachBillNo" parameterType="java.util.List" resultType="com.zg.project.wisdom.domain.RkInfo">
|
|
|
|
|
|
SELECT
|
2025-07-21 11:17:44 +08:00
|
|
|
|
COALESCE(r.bill_no_ck, r.bill_no) AS billNo,
|
2025-12-12 14:52:48 +08:00
|
|
|
|
MAX(r.lihuo_y) AS lihuoY,
|
|
|
|
|
|
MAX(u.user_name) AS lihuoYName,
|
|
|
|
|
|
MAX(rkType.type_name) AS rkTypeName,
|
|
|
|
|
|
MAX(cangku.warehouse_name) AS cangkuName,
|
|
|
|
|
|
|
|
|
|
|
|
-- 新增:大仓/小仓编码和名称
|
|
|
|
|
|
MAX(cangku.parent_warehouse_code) AS parentWarehouseCode,
|
|
|
|
|
|
MAX(cangku.parent_warehouse_name) AS parentWarehouseName,
|
|
|
|
|
|
MAX(cangku.warehouse_code) AS warehouseCode,
|
|
|
|
|
|
MAX(cangku.warehouse_name) AS warehouseName,
|
|
|
|
|
|
|
|
|
|
|
|
MAX(wlType.type_name) AS wlTypeName,
|
|
|
|
|
|
MAX(ckType.type_name) AS ckTypeName,
|
|
|
|
|
|
MAX(team.team_name) AS teamName
|
2025-07-16 11:03:25 +08:00
|
|
|
|
FROM rk_info r
|
2025-12-12 14:52:48 +08:00
|
|
|
|
LEFT JOIN stock_in_type rkType ON r.rk_type = rkType.type_code
|
2025-07-21 11:17:44 +08:00
|
|
|
|
LEFT JOIN stock_out_type ckType ON r.ck_type = ckType.type_code
|
2025-12-12 14:52:48 +08:00
|
|
|
|
LEFT JOIN warehouse_info cangku ON r.cangku = cangku.warehouse_code
|
|
|
|
|
|
LEFT JOIN material_type wlType ON r.wl_type = wlType.type_code
|
2025-07-21 11:17:44 +08:00
|
|
|
|
LEFT JOIN construction_team team ON r.team_code = team.team_code
|
2025-07-17 08:37:27 +08:00
|
|
|
|
LEFT JOIN sys_user u ON r.lihuo_y = u.user_id
|
2025-07-16 11:03:25 +08:00
|
|
|
|
WHERE r.is_delete = '0'
|
2025-07-21 11:17:44 +08:00
|
|
|
|
AND (
|
|
|
|
|
|
r.bill_no IN
|
2025-07-16 11:03:25 +08:00
|
|
|
|
<foreach collection="billNos" item="billNo" open="(" separator="," close=")">
|
|
|
|
|
|
#{billNo}
|
|
|
|
|
|
</foreach>
|
2025-07-21 11:17:44 +08:00
|
|
|
|
OR
|
|
|
|
|
|
r.bill_no_ck IN
|
|
|
|
|
|
<foreach collection="billNos" item="billNo" open="(" separator="," close=")">
|
|
|
|
|
|
#{billNo}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
)
|
|
|
|
|
|
GROUP BY COALESCE(r.bill_no_ck, r.bill_no)
|
2025-07-16 11:03:25 +08:00
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-07-18 08:08:37 +08:00
|
|
|
|
<select id="selectRkInfoListByBillNo" resultMap="RkInfoResult"
|
|
|
|
|
|
parameterType="java.lang.String">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
*
|
|
|
|
|
|
FROM rk_info
|
|
|
|
|
|
WHERE is_delete = '0'
|
|
|
|
|
|
AND bill_no = #{billNo}
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-07-21 11:17:44 +08:00
|
|
|
|
<select id="selectRkInfoListByBillNoCk" resultMap="RkInfoResult" parameterType="java.lang.String">
|
|
|
|
|
|
SELECT *
|
|
|
|
|
|
FROM rk_info
|
|
|
|
|
|
WHERE is_delete = '0'
|
|
|
|
|
|
AND bill_no_ck = #{billNo}
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-08-01 09:27:07 +08:00
|
|
|
|
<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>
|
|
|
|
|
|
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<update id="updateRkInfo" parameterType="RkInfo">
|
2025-10-29 10:15:30 +08:00
|
|
|
|
UPDATE rk_info
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
|
<if test="rkType != null">rk_type = #{rkType},</if>
|
|
|
|
|
|
<if test="wlType != null">wl_type = #{wlType},</if>
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<if test="warehouseCode != null and warehouseCode != ''">
|
|
|
|
|
|
cangku = #{warehouseCode},
|
|
|
|
|
|
</if>
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<if test="rkTime != null">rk_time = #{rkTime},</if>
|
|
|
|
|
|
<if test="lihuoY != null">lihuo_y = #{lihuoY},</if>
|
|
|
|
|
|
<if test="isChuku != null">is_chuku = #{isChuku},</if>
|
2025-07-10 08:40:36 +08:00
|
|
|
|
<if test="isBorrowed != null">is_borrowed = #{isBorrowed},</if>
|
2025-10-29 10:15:30 +08:00
|
|
|
|
|
2025-06-09 15:16:00 +08:00
|
|
|
|
<if test="billNo != null">bill_no = #{billNo},</if>
|
2025-10-29 10:15:30 +08:00
|
|
|
|
<if test="billNoCk != null">bill_no_ck = #{billNoCk},</if>
|
|
|
|
|
|
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<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>
|
2025-07-10 08:40:36 +08:00
|
|
|
|
<if test="xmNoCk != null">xm_no_ck = #{xmNoCk},</if>
|
|
|
|
|
|
<if test="xmMsCk != null">xm_ms_ck = #{xmMsCk},</if>
|
2025-10-29 10:15:30 +08:00
|
|
|
|
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<if test="wlNo != null">wl_no = #{wlNo},</if>
|
|
|
|
|
|
<if test="wlMs != null">wl_ms = #{wlMs},</if>
|
2025-10-29 10:15:30 +08:00
|
|
|
|
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<if test="gysNo != null">gys_no = #{gysNo},</if>
|
|
|
|
|
|
<if test="gysMc != null">gys_mc = #{gysMc},</if>
|
2025-10-29 10:15:30 +08:00
|
|
|
|
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<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>
|
2025-10-29 10:15:30 +08:00
|
|
|
|
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<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>
|
2025-10-29 10:15:30 +08:00
|
|
|
|
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<if test="pcode != null">pcode = #{pcode},</if>
|
2025-10-29 10:15:30 +08:00
|
|
|
|
<if test="pcodeId != null">pcode_id = #{pcodeId},</if>
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<if test="trayCode != null">tray_code = #{trayCode},</if>
|
|
|
|
|
|
<if test="entityId != null">entity_id = #{entityId},</if>
|
2025-10-29 10:15:30 +08:00
|
|
|
|
|
2025-06-09 15:16:00 +08:00
|
|
|
|
<if test="ckLihuoY != null">ck_lihuo_y = #{ckLihuoY},</if>
|
|
|
|
|
|
<if test="ckType != null">ck_type = #{ckType},</if>
|
2025-10-29 10:15:30 +08:00
|
|
|
|
<if test="teamCode != null">team_code = #{teamCode},</if>
|
|
|
|
|
|
|
2025-06-09 15:16:00 +08:00
|
|
|
|
<if test="lyTime != null">ly_time = #{lyTime},</if>
|
2025-07-10 08:40:36 +08:00
|
|
|
|
<if test="borrowTime != null">borrow_time = #{borrowTime},</if>
|
|
|
|
|
|
<if test="returnTime != null">return_time = #{returnTime},</if>
|
2025-06-09 15:16:00 +08:00
|
|
|
|
<if test="ckRemark != null">ck_remark = #{ckRemark},</if>
|
2025-10-29 10:15:30 +08:00
|
|
|
|
|
|
|
|
|
|
<if test="isDelivery != null">is_delivery = #{isDelivery},</if>
|
2025-07-10 08:40:36 +08:00
|
|
|
|
<if test="hasMoved != null">has_moved = #{hasMoved},</if>
|
2025-10-29 10:15:30 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 新增:封样号 -->
|
|
|
|
|
|
<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>
|
|
|
|
|
|
|
2025-05-30 16:13:27 +08:00
|
|
|
|
<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>
|
2025-10-29 10:15:30 +08:00
|
|
|
|
WHERE id = #{id}
|
2025-05-30 16:13:27 +08:00
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
|
|
<update id="deleteRkInfoById" parameterType="Long">
|
|
|
|
|
|
update rk_info
|
2025-07-10 08:40:36 +08:00
|
|
|
|
<set>
|
|
|
|
|
|
is_delete = 1
|
|
|
|
|
|
</set>
|
2025-05-30 16:13:27 +08:00
|
|
|
|
where id = #{id}
|
|
|
|
|
|
</update>
|
|
|
|
|
|
|
2025-07-10 08:40:36 +08:00
|
|
|
|
<update id="deleteRkInfoByIds" parameterType="java.util.List">
|
2025-05-30 16:13:27 +08:00
|
|
|
|
update rk_info
|
2025-07-10 08:40:36 +08:00
|
|
|
|
set is_delete = 1
|
2025-05-30 16:13:27 +08:00
|
|
|
|
where id in
|
2025-07-10 08:40:36 +08:00
|
|
|
|
<foreach item="id" collection="list" open="(" separator="," close=")">
|
2025-05-30 16:13:27 +08:00
|
|
|
|
#{id}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</update>
|
|
|
|
|
|
|
2025-07-10 08:40:36 +08:00
|
|
|
|
<update id="updateById" parameterType="com.zg.project.wisdom.domain.RkInfo">
|
2025-06-10 09:37:37 +08:00
|
|
|
|
UPDATE rk_info
|
2025-06-17 08:39:05 +08:00
|
|
|
|
<set>
|
|
|
|
|
|
<if test="isChuku != null">is_chuku = #{isChuku},</if>
|
2025-07-10 08:40:36 +08:00
|
|
|
|
<if test="isBorrowed != null">is_borrowed = #{isBorrowed},</if>
|
|
|
|
|
|
<if test="billNoCk != null">bill_no_ck = #{billNoCk},</if>
|
2025-06-17 08:39:05 +08:00
|
|
|
|
<if test="ckType != null">ck_type = #{ckType},</if>
|
2025-10-17 09:26:24 +08:00
|
|
|
|
<if test="isDelivery != null">is_delivery = #{isDelivery},</if>
|
2025-06-17 08:39:05 +08:00
|
|
|
|
<if test="ckLihuoY != null">ck_lihuo_y = #{ckLihuoY},</if>
|
|
|
|
|
|
<if test="teamCode != null">team_code = #{teamCode},</if>
|
2025-07-10 08:40:36 +08:00
|
|
|
|
<if test="ckRemark != null">ck_remark = #{ckRemark},</if>
|
|
|
|
|
|
<if test="xmNoCk != null">xm_no_ck = #{xmNoCk},</if>
|
|
|
|
|
|
<if test="xmMsCk != null">xm_ms_ck = #{xmMsCk},</if>
|
2025-06-17 08:39:05 +08:00
|
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
2025-07-10 08:40:36 +08:00
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</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>
|
2025-07-21 11:17:44 +08:00
|
|
|
|
<if test="status != null">status = #{status},</if>
|
2025-06-17 08:39:05 +08:00
|
|
|
|
</set>
|
2025-06-10 09:37:37 +08:00
|
|
|
|
WHERE id = #{id}
|
2025-06-09 15:16:00 +08:00
|
|
|
|
</update>
|
|
|
|
|
|
|
2025-07-14 09:28:10 +08:00
|
|
|
|
<update id="updateStatusByBillNo" parameterType="RkInfo">
|
|
|
|
|
|
UPDATE rk_info
|
2025-07-21 11:17:44 +08:00
|
|
|
|
<set>
|
|
|
|
|
|
<if test="status != null">status = #{status},</if>
|
|
|
|
|
|
<if test="isChuku != null">is_chuku = #{isChuku},</if>
|
|
|
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
|
|
</set>
|
|
|
|
|
|
<where>
|
|
|
|
|
|
<if test="billNo != null">
|
|
|
|
|
|
bill_no = #{billNo}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="billNo == null and billNoCk != null">
|
|
|
|
|
|
bill_no_ck = #{billNoCk}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
|
|
<update id="markDeleteByBillNo" parameterType="RkInfo">
|
|
|
|
|
|
UPDATE rk_info
|
|
|
|
|
|
SET is_delete = #{isDelete},
|
|
|
|
|
|
status = #{status},
|
2025-07-14 09:28:10 +08:00
|
|
|
|
update_by = #{updateBy},
|
|
|
|
|
|
update_time = #{updateTime}
|
|
|
|
|
|
WHERE bill_no = #{billNo}
|
2025-07-21 11:17:44 +08:00
|
|
|
|
AND status IN ('0', '2')
|
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
|
|
<update id="markDeleteByBillNoCk" parameterType="RkInfo">
|
|
|
|
|
|
UPDATE rk_info
|
|
|
|
|
|
SET is_delete = #{isDelete},
|
|
|
|
|
|
status = #{status},
|
|
|
|
|
|
update_by = #{updateBy},
|
|
|
|
|
|
update_time = #{updateTime}
|
|
|
|
|
|
WHERE bill_no_ck = #{billNoCk}
|
|
|
|
|
|
AND status IN ('0', '2')
|
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
|
|
<update id="revertRkInfoStatusByBillNoCk" parameterType="RkInfo">
|
|
|
|
|
|
UPDATE rk_info
|
|
|
|
|
|
SET status = #{status},
|
|
|
|
|
|
is_chuku = #{isChuku},
|
|
|
|
|
|
update_by = #{updateBy},
|
|
|
|
|
|
update_time = #{updateTime}
|
|
|
|
|
|
WHERE bill_no_ck = #{billNoCk}
|
2025-07-14 09:28:10 +08:00
|
|
|
|
AND is_delete = '0'
|
2025-07-21 11:17:44 +08:00
|
|
|
|
AND bill_no IS NOT NULL
|
2025-07-14 09:28:10 +08:00
|
|
|
|
</update>
|
|
|
|
|
|
|
2025-09-15 15:17:16 +08:00
|
|
|
|
<select id="listRkInfoByPcode"
|
|
|
|
|
|
parameterType="string"
|
|
|
|
|
|
resultMap="RkInfoResult">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
t.*,
|
2025-12-12 14:52:48 +08:00
|
|
|
|
wh.warehouse_name AS cangku_name,
|
|
|
|
|
|
|
|
|
|
|
|
-- 新增:大仓/小仓编码和名称
|
|
|
|
|
|
wh.parent_warehouse_code AS parent_warehouse_code,
|
|
|
|
|
|
wh.parent_warehouse_name AS parent_warehouse_name,
|
|
|
|
|
|
wh.warehouse_code AS warehouse_code,
|
|
|
|
|
|
wh.warehouse_name AS warehouse_name
|
2025-09-15 15:17:16 +08:00
|
|
|
|
FROM rk_info t
|
|
|
|
|
|
LEFT JOIN warehouse_info wh
|
|
|
|
|
|
ON wh.warehouse_code = t.cangku
|
|
|
|
|
|
WHERE t.is_delete = 0
|
|
|
|
|
|
AND t.is_chuku = 0
|
|
|
|
|
|
AND t.pcode = #{pcode}
|
|
|
|
|
|
ORDER BY t.rk_time DESC, t.id DESC
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-10-17 12:01:58 +08:00
|
|
|
|
<select id="selectAllRkInfo"
|
|
|
|
|
|
parameterType="com.zg.project.wisdom.domain.RkInfo"
|
|
|
|
|
|
resultMap="RkInfoResult">
|
|
|
|
|
|
<include refid="selectRkInfoVo"/>
|
|
|
|
|
|
<where>
|
|
|
|
|
|
(ri.is_delete = '0' OR ri.is_delete = 0 OR ri.is_delete IS NULL)
|
|
|
|
|
|
|
|
|
|
|
|
<if test="isChuku != null and isChuku != ''">
|
|
|
|
|
|
AND ri.is_chuku = #{isChuku}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<if test="warehouseCode != null and warehouseCode != ''">
|
|
|
|
|
|
AND ri.cangku = #{warehouseCode}
|
2025-10-17 12:01:58 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<if test="startTime != null and startTime != ''">
|
2025-10-17 12:01:58 +08:00
|
|
|
|
AND ri.rk_time <![CDATA[ >= ]]> #{startTime}
|
|
|
|
|
|
</if>
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<if test="endTime != null and endTime != ''">
|
2025-10-17 12:01:58 +08:00
|
|
|
|
AND ri.rk_time <![CDATA[ <= ]]> #{endTime}
|
|
|
|
|
|
</if>
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<if test="statDate != null and statDate != ''">
|
2025-12-09 15:54:39 +08:00
|
|
|
|
AND ri.return_time <![CDATA[ >= ]]> #{statDate}
|
|
|
|
|
|
</if>
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<if test="endDate != null and endDate != ''">
|
2025-12-09 15:54:39 +08:00
|
|
|
|
AND ri.return_time <![CDATA[ <= ]]> #{endDate}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="rkType != null and rkType != ''">
|
|
|
|
|
|
AND ri.rk_type = #{rkType}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="wlType != null and wlType != ''">
|
|
|
|
|
|
AND ri.wl_type = #{wlType}
|
|
|
|
|
|
</if>
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<if test="lyStartTime != null and lyStartTime != ''">
|
2025-10-17 12:01:58 +08:00
|
|
|
|
AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime}
|
|
|
|
|
|
</if>
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<if test="lyEndTime != null and lyEndTime != ''">
|
2025-10-17 12:01:58 +08:00
|
|
|
|
AND ri.ly_time <![CDATA[ <= ]]> #{lyEndTime}
|
|
|
|
|
|
</if>
|
2025-10-29 10:15:30 +08:00
|
|
|
|
|
|
|
|
|
|
<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>
|
2025-10-17 12:01:58 +08:00
|
|
|
|
</where>
|
|
|
|
|
|
ORDER BY ri.create_time DESC, ri.id DESC
|
|
|
|
|
|
</select>
|
2025-07-21 11:17:44 +08:00
|
|
|
|
|
2025-11-03 15:42:45 +08:00
|
|
|
|
<select id="selectStatistics" resultType="java.lang.Long" parameterType="java.lang.Object" >
|
2025-12-09 15:54:39 +08:00
|
|
|
|
SELECT sum(ri.ht_dj * ri.real_qty)
|
2025-11-03 15:42:45 +08:00
|
|
|
|
FROM rk_info ri
|
|
|
|
|
|
<where>
|
|
|
|
|
|
(ri.is_delete = '0' OR ri.is_delete = 0 OR ri.is_delete IS NULL)
|
|
|
|
|
|
|
|
|
|
|
|
<if test="isChuku != null and isChuku != ''">
|
|
|
|
|
|
AND ri.is_chuku = #{isChuku}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
|
|
<if test="cangku != null and cangku != ''">
|
|
|
|
|
|
AND ri.cangku = #{cangku}
|
|
|
|
|
|
</if>
|
2025-12-09 15:54:39 +08:00
|
|
|
|
<if test="rkType != null and rkType != ''">
|
|
|
|
|
|
AND ri.rk_type = #{rkType}
|
|
|
|
|
|
</if>
|
2025-11-03 15:42:45 +08:00
|
|
|
|
<if test="startTime != null">
|
|
|
|
|
|
AND ri.rk_time <![CDATA[ >= ]]> #{startTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="endTime != null">
|
|
|
|
|
|
AND ri.rk_time <![CDATA[ <= ]]> #{endTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<if test="lyStartTime != null and lyStartTime != ''">
|
2025-11-03 15:42:45 +08:00
|
|
|
|
AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime}
|
|
|
|
|
|
</if>
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<if test="lyEndTime != null and lyEndTime != ''">
|
2025-11-03 15:42:45 +08:00
|
|
|
|
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>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectPcde" resultType="java.lang.Long" parameterType="java.lang.Object" >
|
|
|
|
|
|
SELECT count(distinct pcode)
|
|
|
|
|
|
FROM rk_info ri
|
|
|
|
|
|
<where>
|
|
|
|
|
|
(ri.is_delete = '0' OR ri.is_delete = 0 OR ri.is_delete IS NULL)
|
|
|
|
|
|
|
|
|
|
|
|
<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>
|
|
|
|
|
|
<if test="endTime != null">
|
|
|
|
|
|
AND ri.rk_time <![CDATA[ <= ]]> #{endTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<if test="lyStartTime != null and lyStartTime != ''">
|
2025-11-03 15:42:45 +08:00
|
|
|
|
AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime}
|
|
|
|
|
|
</if>
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<if test="lyEndTime != null and lyEndTime != ''">
|
2025-11-03 15:42:45 +08:00
|
|
|
|
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>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-11-25 16:30:46 +08:00
|
|
|
|
<select id="selectDeliveryCkList"
|
|
|
|
|
|
resultType="com.zg.project.wisdom.domain.RkInfo">
|
|
|
|
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
id,
|
|
|
|
|
|
gys_jh_id AS gysJhId,
|
|
|
|
|
|
rk_type AS rkType,
|
|
|
|
|
|
wl_type AS wlType,
|
|
|
|
|
|
cangku,
|
|
|
|
|
|
rk_time AS rkTime,
|
|
|
|
|
|
borrow_time AS borrowTime,
|
|
|
|
|
|
return_time AS returnTime,
|
|
|
|
|
|
lihuo_y AS lihuoY,
|
|
|
|
|
|
is_chuku AS isChuku,
|
|
|
|
|
|
bill_no AS billNo,
|
|
|
|
|
|
bill_no_ck AS billNoCk,
|
|
|
|
|
|
is_delivery AS isDelivery,
|
|
|
|
|
|
remark,
|
|
|
|
|
|
xj,
|
|
|
|
|
|
xm_no AS xmNo,
|
|
|
|
|
|
xm_ms AS xmMs,
|
|
|
|
|
|
xm_no_ck AS xmNoCk,
|
|
|
|
|
|
xm_ms_ck AS xmMsCk,
|
|
|
|
|
|
wl_no AS wlNo,
|
|
|
|
|
|
wl_ms AS wlMs,
|
|
|
|
|
|
gys_no AS gysNo,
|
|
|
|
|
|
gys_mc AS gysMc,
|
|
|
|
|
|
jh_amt AS jhAmt,
|
|
|
|
|
|
ht_dj AS htDj,
|
|
|
|
|
|
sap_no AS sapNo,
|
|
|
|
|
|
xh,
|
|
|
|
|
|
jh_qty AS jhQty,
|
|
|
|
|
|
ht_qty AS htQty,
|
|
|
|
|
|
dw,
|
|
|
|
|
|
real_qty AS realQty,
|
|
|
|
|
|
pcode,
|
|
|
|
|
|
pcode_id AS pcodeId,
|
|
|
|
|
|
tray_code AS trayCode,
|
|
|
|
|
|
entity_id AS entityId,
|
|
|
|
|
|
ck_lihuo_y AS ckLihuoY,
|
|
|
|
|
|
ck_type AS ckType,
|
|
|
|
|
|
team_code AS teamCode,
|
|
|
|
|
|
ck_remark AS ckRemark,
|
|
|
|
|
|
ly_time AS lyTime,
|
|
|
|
|
|
has_moved AS hasMoved,
|
|
|
|
|
|
is_borrowed AS isBorrowed,
|
|
|
|
|
|
fycde_1 AS fycde1,
|
|
|
|
|
|
fycde_2 AS fycde2,
|
|
|
|
|
|
is_delete AS isDelete,
|
|
|
|
|
|
create_by AS createBy,
|
|
|
|
|
|
create_time AS createTime,
|
|
|
|
|
|
update_by AS updateBy,
|
|
|
|
|
|
update_time AS updateTime
|
|
|
|
|
|
FROM rk_info
|
|
|
|
|
|
WHERE is_delete = '0'
|
|
|
|
|
|
AND is_chuku = '1'
|
|
|
|
|
|
AND is_delivery = '1'
|
|
|
|
|
|
|
|
|
|
|
|
<if test="q.xj != null and q.xj != ''">
|
|
|
|
|
|
AND xj = #{q.xj}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="q.xmNoCk != null and q.xmNoCk != ''">
|
|
|
|
|
|
AND xm_no_ck = #{q.xmNoCk}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="q.teamCode != null and q.teamCode != ''">
|
|
|
|
|
|
AND team_code = #{q.teamCode}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="q.lyStartTime != null">
|
|
|
|
|
|
AND ly_time >= #{q.lyStartTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="q.lyEndTime != null">
|
|
|
|
|
|
AND ly_time <= #{q.lyEndTime}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
|
|
ORDER BY bill_no_ck, ly_time, id
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<!-- 根据入库单号查询单据头公共信息 -->
|
|
|
|
|
|
<select id="selectHeaderByBillNo"
|
|
|
|
|
|
parameterType="java.lang.String"
|
|
|
|
|
|
resultMap="RkInfoResult">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
ri.id,
|
|
|
|
|
|
ri.bill_no,
|
|
|
|
|
|
ri.bill_no_ck,
|
|
|
|
|
|
ri.is_chuku,
|
|
|
|
|
|
ri.rk_type,
|
|
|
|
|
|
st.type_name AS rk_type_name,
|
|
|
|
|
|
ri.wl_type,
|
|
|
|
|
|
mt.type_name AS wl_type_name,
|
|
|
|
|
|
ri.rk_time,
|
|
|
|
|
|
ri.ly_time,
|
|
|
|
|
|
ri.lihuo_y,
|
|
|
|
|
|
u.user_name AS lihuo_y_name,
|
|
|
|
|
|
|
|
|
|
|
|
ri.cangku,
|
|
|
|
|
|
wh.warehouse_name AS cangku_name,
|
|
|
|
|
|
wh.parent_warehouse_code AS parent_warehouse_code,
|
|
|
|
|
|
wh.parent_warehouse_name AS parent_warehouse_name,
|
|
|
|
|
|
wh.warehouse_code AS warehouse_code,
|
|
|
|
|
|
wh.warehouse_name AS warehouse_name
|
|
|
|
|
|
|
|
|
|
|
|
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 sys_user u ON ri.lihuo_y = u.user_id
|
|
|
|
|
|
WHERE ri.is_delete = '0'
|
|
|
|
|
|
AND ri.bill_no = #{billNo}
|
|
|
|
|
|
ORDER BY ri.rk_time ASC, ri.id ASC
|
|
|
|
|
|
LIMIT 1
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-11-04 10:43:53 +08:00
|
|
|
|
<update id="updateBillInfo" parameterType="com.zg.project.wisdom.domain.RkInfo">
|
|
|
|
|
|
UPDATE rk_info
|
|
|
|
|
|
<set>
|
2025-12-12 14:52:48 +08:00
|
|
|
|
<if test="rkType != null">
|
|
|
|
|
|
rk_type = #{rkType},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="wlType != null">
|
|
|
|
|
|
wl_type = #{wlType},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
|
|
<if test="warehouseCode != null and warehouseCode != ''">
|
|
|
|
|
|
cangku = #{warehouseCode},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
|
|
<if test="rkTime != null">
|
|
|
|
|
|
rk_time = #{rkTime},
|
|
|
|
|
|
</if>
|
2025-11-04 10:43:53 +08:00
|
|
|
|
</set>
|
|
|
|
|
|
WHERE bill_no = #{billNo}
|
|
|
|
|
|
</update>
|
|
|
|
|
|
|
2025-11-25 16:30:46 +08:00
|
|
|
|
<update id="updateDeliveryStatus">
|
|
|
|
|
|
UPDATE rk_info
|
|
|
|
|
|
SET is_delivery = #{isDelivery}
|
2025-12-05 16:04:35 +08:00
|
|
|
|
WHERE is_delete = '0'
|
|
|
|
|
|
AND id IN
|
|
|
|
|
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
|
|
|
|
|
#{id}
|
|
|
|
|
|
</foreach>
|
2025-11-25 16:30:46 +08:00
|
|
|
|
</update>
|
2025-10-29 10:15:30 +08:00
|
|
|
|
</mapper>
|