bug修复
This commit is contained in:
@@ -7,9 +7,9 @@ spring:
|
||||
# 主库数据源
|
||||
master:
|
||||
# url: jdbc:mysql://101.132.133.142:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# url: jdbc:mysql://192.168.1.28:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://192.168.1.28:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# url: jdbc:mysql://192.168.1.192:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://192.168.1.251:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# url: jdbc:mysql://192.168.1.251:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# url: jdbc:mysql://localhost:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: shzg
|
||||
|
||||
@@ -183,6 +183,7 @@
|
||||
ck_lihuo_y, ck_type, team_code, ck_remark,
|
||||
ly_time, bill_no_ck, has_moved,
|
||||
gys_jh_id,
|
||||
status,
|
||||
create_by, create_time, update_by, update_time, is_delete
|
||||
) VALUES (
|
||||
#{rkType}, #{wlType}, #{cangku}, #{rkTime}, #{lihuoY},
|
||||
@@ -193,6 +194,7 @@
|
||||
#{ckLihuoY}, #{ckType}, #{teamCode}, #{ckRemark},
|
||||
#{lyTime}, #{billNoCk}, #{hasMoved},
|
||||
#{gysJhId},
|
||||
#{status},
|
||||
#{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{isDelete}
|
||||
)
|
||||
</insert>
|
||||
@@ -393,8 +395,9 @@
|
||||
AND ri.is_delete = 0
|
||||
|
||||
<!-- ✅ 关键:只允许未出库的数据 -->
|
||||
AND ri.is_chuku = '0'
|
||||
|
||||
<if test="isChuku != null and isChuku != ''">
|
||||
AND ri.is_chuku = #{isChuku}
|
||||
</if>
|
||||
<!-- 借料状态 -->
|
||||
<choose>
|
||||
<when test="isBorrowed != null and isBorrowed != ''">
|
||||
@@ -453,27 +456,20 @@
|
||||
a.ck_lihuo_y,
|
||||
u.user_name AS ck_lihuo_y_name,
|
||||
ru.user_name AS lihuo_y_name,
|
||||
a.is_delivery AS is_delivery
|
||||
a.is_delivery AS is_delivery,
|
||||
a.team_code,
|
||||
ct.team_name AS team_name
|
||||
FROM (
|
||||
SELECT
|
||||
MIN(t.id) AS id,
|
||||
|
||||
/* ✅ 单据号:出库/借料出库 -> CK;其它 -> RK(用于页面展示) */
|
||||
t.show_bill_no AS bill_no,
|
||||
|
||||
/* 保留 bill_no_ck 字段(出库态有值) */
|
||||
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,
|
||||
|
||||
/* 时间:你要更合理也可以改成 MAX(COALESCE(ly_time,rk_time)) */
|
||||
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,
|
||||
@@ -484,14 +480,13 @@
|
||||
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,
|
||||
|
||||
/* ✅ 用于 needAudit 子查询判断:本组是 RK 组还是 CK 组 */
|
||||
MIN(t.show_bill_type) AS show_bill_type
|
||||
MIN(t.team_code) AS team_code,
|
||||
MIN(t.show_bill_type) AS show_bill_type,
|
||||
MAX(t.create_time) AS create_time
|
||||
|
||||
FROM (
|
||||
SELECT
|
||||
@@ -520,6 +515,8 @@
|
||||
ri.pcode,
|
||||
ri.is_delete,
|
||||
ri.is_delivery,
|
||||
ri.team_code,
|
||||
ri.create_time,
|
||||
|
||||
CASE
|
||||
WHEN ri.is_chuku IN ('1','3')
|
||||
@@ -528,7 +525,6 @@
|
||||
THEN ri.bill_no_ck
|
||||
ELSE ri.bill_no
|
||||
END AS show_bill_no,
|
||||
|
||||
CASE
|
||||
WHEN ri.is_chuku IN ('1','3')
|
||||
AND ri.bill_no_ck IS NOT NULL
|
||||
@@ -536,162 +532,61 @@
|
||||
THEN 'CK'
|
||||
ELSE 'RK'
|
||||
END AS show_bill_type
|
||||
|
||||
FROM rk_info ri
|
||||
) t
|
||||
|
||||
<where>
|
||||
<!-- 只查未删除 -->
|
||||
<choose>
|
||||
<when test="q.isDelete != null and q.isDelete != ''">
|
||||
AND t.is_delete = #{q.isDelete}
|
||||
</when>
|
||||
<otherwise>
|
||||
AND t.is_delete = 0
|
||||
</otherwise>
|
||||
</choose>
|
||||
AND ri.is_delete = 0
|
||||
|
||||
<!-- is_chuku / isChukuList -->
|
||||
<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>
|
||||
|
||||
<!-- 时间过滤:rk_time -->
|
||||
<if test="q.startTime != null and q.startTime != ''">
|
||||
<![CDATA[ AND t.rk_time >= #{q.startTime} ]]>
|
||||
</if>
|
||||
<if test="q.endTime != null and q.endTime != ''">
|
||||
<![CDATA[ AND t.rk_time <= #{q.endTime} ]]>
|
||||
<!-- isChukuList 优先生效 -->
|
||||
<if test="q.isChukuList != null and q.isChukuList.size() > 0">
|
||||
AND ri.is_chuku IN
|
||||
<foreach collection="q.isChukuList" item="s" open="(" separator="," close=")">
|
||||
#{s}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<!-- 时间过滤:ly_time -->
|
||||
<if test="q.lyStartTime != null and q.lyStartTime != ''">
|
||||
<![CDATA[ AND t.ly_time >= #{q.lyStartTime} ]]>
|
||||
</if>
|
||||
<if test="q.lyEndTime != null and q.lyEndTime != ''">
|
||||
<![CDATA[ AND t.ly_time <= #{q.lyEndTime} ]]>
|
||||
<!-- isChukuList 为空时才用 isChuku 单值 -->
|
||||
<if test="(q.isChukuList == null or q.isChukuList.size() == 0) and q.isChuku != null and q.isChuku != ''">
|
||||
AND ri.is_chuku = #{q.isChuku}
|
||||
</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.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>
|
||||
|
||||
<!-- 单据号(如果你页面输入框叫 billNo,就建议这里也去匹配 show_bill_no) -->
|
||||
<if test="q.billNo != null and q.billNo != ''">
|
||||
AND t.show_bill_no LIKE concat('%', #{q.billNo}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 如果你还保留 billNoCk 入参,也允许精确筛 CK -->
|
||||
<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.pcode != null and q.pcode != ''">
|
||||
AND t.pcode LIKE concat('%', #{q.pcode}, '%')
|
||||
</if>
|
||||
<if test="q.ckType != null and q.ckType != ''">
|
||||
AND t.ck_type LIKE concat('%', #{q.ckType}, '%')
|
||||
</if>
|
||||
|
||||
<if test="q.isDelivery != null and q.isDelivery != ''">
|
||||
AND t.is_delivery = #{q.isDelivery}
|
||||
</if>
|
||||
|
||||
<!-- keyword:建议也命中 show_bill_no(解决用户输入 CK/RK 都能搜到) -->
|
||||
<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}, '%')
|
||||
OR t.bill_no_ck LIKE concat('%', #{q.keyword}, '%')
|
||||
OR t.show_bill_no LIKE concat('%', #{q.keyword}, '%')
|
||||
OR t.ck_type LIKE concat('%', #{q.keyword}, '%')
|
||||
OR t.pcode LIKE concat('%', #{q.keyword}, '%')
|
||||
ri.bill_no LIKE concat('%', #{q.keyword}, '%')
|
||||
OR ri.bill_no_ck LIKE concat('%', #{q.keyword}, '%')
|
||||
OR ri.xm_no LIKE concat('%', #{q.keyword}, '%')
|
||||
OR ri.xm_ms LIKE concat('%', #{q.keyword}, '%')
|
||||
OR ri.wl_no LIKE concat('%', #{q.keyword}, '%')
|
||||
OR ri.wl_ms LIKE concat('%', #{q.keyword}, '%')
|
||||
OR ri.sap_no LIKE concat('%', #{q.keyword}, '%')
|
||||
OR ri.gys_mc LIKE concat('%', #{q.keyword}, '%')
|
||||
)
|
||||
</if>
|
||||
|
||||
<!-- ✅ 审核过滤:按组类型匹配 RK 或 CK -->
|
||||
<if test="needAudit != null and needAudit == 1">
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
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.is_delete = 0
|
||||
AND (
|
||||
(t.show_bill_type = 'RK' AND r2.bill_no = t.show_bill_no)
|
||||
OR (t.show_bill_type = 'CK' AND r2.bill_no_ck = t.show_bill_no)
|
||||
)
|
||||
)
|
||||
<if test="q.cangku != null and q.cangku != ''">
|
||||
AND ri.cangku = #{q.cangku}
|
||||
</if>
|
||||
<if test="q.startTime != null and q.startTime != ''">
|
||||
AND ri.rk_time >= #{q.startTime}
|
||||
</if>
|
||||
|
||||
<if test="q.endTime != null and q.endTime != ''">
|
||||
AND ri.rk_time <= #{q.endTime}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
/* ✅ 关键:按 show_bill_no 分组(出库合并 CK,在库保留 RK) */
|
||||
) t
|
||||
GROUP BY t.show_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 material_type mt ON a.wl_type = mt.type_code
|
||||
LEFT JOIN sys_user ru ON a.lihuo_y = ru.user_id
|
||||
ORDER BY a.rk_time DESC
|
||||
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 material_type mt ON a.wl_type = mt.type_code
|
||||
LEFT JOIN sys_user ru ON a.lihuo_y = ru.user_id
|
||||
LEFT JOIN construction_team ct ON a.team_code = ct.team_code
|
||||
|
||||
ORDER BY a.create_time DESC
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<!-- ================== /按单据分组查询 ================== -->
|
||||
|
||||
<select id="selectRkInfoById" parameterType="Long" resultMap="RkInfoResult">
|
||||
@@ -1011,6 +906,7 @@
|
||||
<if test="borrowTime != null">borrow_time = #{borrowTime},</if>
|
||||
<if test="returnTime != null">return_time = #{returnTime},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="realQty != null">real_qty = #{realQty},</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
Reference in New Issue
Block a user