去除mqtt功能

修改查询接口
This commit is contained in:
2026-01-08 11:02:34 +08:00
parent f3d993b33a
commit 5d227b7b6b
18 changed files with 329 additions and 726 deletions

View File

@@ -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

View File

@@ -170,51 +170,3 @@ mock:
#配送系统中调用大模型进行图片识别
qwen-ocr:
base-url: http://192.168.1.253:8087/ocr/extractErpByBase64
# =========================
# MQTT 配置EMQX 接入)
# =========================
mqtt:
# 是否启用 MQTT 功能
# true系统启动时自动连接 EMQX 并订阅 Topic
# false不初始化 MQTT 客户端
enabled: true
# MQTT Broker 地址
# tcp://IP:1883 —— MQTT TCP
# ws://IP:8083 —— MQTT WebSocket
# ssl://IP:8883 —— MQTT SSL
broker: tcp://192.168.1.29:1883
# MQTT 客户端 ID在 EMQX 中唯一)
# 建议:系统名 + 模块名,避免重复
clientId: zg-wms-backend-test
# MQTT 账号EMQX Dashboard 中配置)
username: demo02
# MQTT 密码
password: admin123
# 是否清除会话
# true :断开后清除订阅和未接收消息(推荐后端使用)
# false :保留会话(适合设备端)
cleanSession: true
# 心跳时间(秒)
# 客户端与 Broker 保持连接的心跳间隔
keepAlive: 30
# 连接超时时间(秒)
timeout: 10
# 默认消息 QoS
# 0最多一次不保证到达性能最好
# 1至少一次推荐业务数据常用
# 2仅一次最严格性能最差
qos: 1
# 订阅的 Topic 列表(支持通配符)
# 建议先使用测试 Topic确认链路正常后再接入真实业务 Topic
topics:
- zg/wms/test/#

View File

@@ -587,6 +587,160 @@
</select>
<select id="selectBillHeaderList" resultMap="RkInfoResult">
SELECT
-- 3. 外层:关联字典表获取名称
a.show_bill_no AS bill_no, -- 最终展示的单据号
a.bill_no AS bill_no, -- 原始入库单号(兼容实体)
a.bill_no_ck AS bill_no_ck, -- 原始出库单号
-- 状态与标识
a.is_chuku,
a.is_delivery,
a.id, -- 取聚合后的最小ID作为主键标识
-- 入库维度的公共字段
a.rk_type,
si.type_name AS rk_type_name,
a.wl_type,
mt.type_name AS wl_type_name,
a.rk_time,
a.lihuo_y,
ru.user_name AS lihuo_y_name,
-- 仓库信息
a.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,
-- 出库维度的公共字段
a.ck_type,
so.type_name AS ck_type_name,
a.ly_time,
a.ck_lihuo_y,
u.user_name AS ck_lihuo_y_name, -- 注意:这里对应 XML 里的 u 表别名
a.team_code,
ct.team_name AS team_name,
-- 创建时间
a.create_time
FROM (
SELECT
-- 2. 中间层:按单据号聚合
t.show_bill_no,
MIN(t.id) AS id,
-- 单据头信息聚合(取最大值或最小值均可,因为同一单据号下这些字段是一致的)
MAX(t.bill_no) AS bill_no,
MAX(t.bill_no_ck) AS bill_no_ck,
MAX(t.is_chuku) AS is_chuku,
MAX(t.is_delivery) AS is_delivery,
MIN(t.rk_type) AS rk_type,
MIN(t.wl_type) AS wl_type,
MIN(t.rk_time) AS rk_time,
MIN(t.lihuo_y) AS lihuo_y,
MIN(t.cangku) AS cangku,
MIN(t.ck_type) AS ck_type,
MIN(t.ly_time) AS ly_time,
MIN(t.ck_lihuo_y) AS ck_lihuo_y,
MIN(t.team_code) AS team_code,
MAX(t.create_time) AS create_time
FROM (
-- 1. 内层:过滤并计算 show_bill_no
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.is_delivery,
ri.ck_type,
ri.ly_time,
ri.ck_lihuo_y,
ri.team_code,
ri.create_time,
-- 计算逻辑:如果是出库状态且有出库单号,则以出库单号为主
CASE
WHEN ri.is_chuku IN ('1','3') AND ri.bill_no_ck IS NOT NULL AND ri.bill_no_ck != ''
THEN ri.bill_no_ck
ELSE ri.bill_no
END AS show_bill_no
FROM rk_info ri
<where>
AND ri.is_delete = 0
<!-- 关键字搜索:依然保留对项目号、物料号等的支持,方便用户查找 -->
<if test="q.keyword != null and q.keyword != ''">
AND (
ri.xm_no LIKE concat('%', #{q.keyword}, '%')
OR ri.wl_no LIKE concat('%', #{q.keyword}, '%')
OR ri.gys_mc LIKE concat('%', #{q.keyword}, '%')
)
</if>
<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>
<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.ckType != null and q.ckType != ''">
AND ri.ck_type = #{q.ckType}
</if>
<if test="q.cangku != null and q.cangku != ''">
AND ri.cangku = #{q.cangku}
</if>
<if test="q.billNoCk != null and q.billNoCk != ''">
AND ri.bill_no_ck = #{q.billNoCk}
</if>
<if test="q.billNo != null and q.billNo != ''">
AND ri.bill_no = #{q.billNo}
</if>
<if test="q.startTime != null">
AND ri.rk_time &gt;= #{q.startTime}
</if>
<if test="q.endTime != null">
AND ri.rk_time &lt;= #{q.endTime}
</if>
<if test="q.statDate != null">
AND ri.ly_time &gt;= #{q.statDate}
</if>
<if test="q.endDate != null">
AND ri.ly_time &lt;= #{q.endDate}
</if>
</where>
) 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 warehouse_info wh ON a.cangku = wh.warehouse_code
LEFT JOIN sys_user u ON a.ck_lihuo_y = u.user_id -- 出库理货员
LEFT JOIN sys_user ru ON a.lihuo_y = ru.user_id -- 入库理货员
LEFT JOIN construction_team ct ON a.team_code = ct.team_code
LEFT JOIN material_type mt ON a.wl_type = mt.type_code
-- 排序优化:优先按出库时间排序;若无出库时间(入库单),则按入库时间排序
ORDER BY COALESCE(a.ly_time, a.rk_time) DESC, a.id DESC
</select>
<!-- ================== /按单据分组查询 ================== -->
<select id="selectRkInfoById" parameterType="Long" resultMap="RkInfoResult">
@@ -1120,148 +1274,6 @@
ORDER BY ri.create_time DESC, ri.id DESC
</select>
<select id="selectStatistics" resultType="java.lang.Long" parameterType="java.lang.Object" >
SELECT sum(ri.ht_dj * ri.real_qty)
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="rkType != null and rkType != ''">
AND ri.rk_type = #{rkType}
</if>
<if test="startTime != null">
AND ri.rk_time <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null">
AND ri.rk_time <![CDATA[ <= ]]> #{endTime}
</if>
<if test="lyStartTime != null and lyStartTime != ''">
AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime}
</if>
<if test="lyEndTime != null and lyEndTime != ''">
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>
<if test="lyStartTime != null and lyStartTime != ''">
AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime}
</if>
<if test="lyEndTime != null and lyEndTime != ''">
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="selectDeliveryCkList"
parameterType="com.zg.project.wisdom.domain.RkInfo"
resultMap="RkInfoResult">
@@ -1326,6 +1338,95 @@
AND bill_no LIKE CONCAT(#{prefix}, '%')
</select>
<!-- 聚合统计:总金额、总数量、库位数 -->
<select id="selectStockStatistics" resultType="java.util.Map">
SELECT
-- 1. 总金额:合同单价 * 实际入库数量 (处理 null 为 0)
COALESCE(SUM(ri.ht_dj * ri.real_qty), 0) AS sumMoney,
-- 2. 总数量:实际入库数量求和
COALESCE(SUM(ri.real_qty), 0) AS sumQty,
-- 3. 库位数:去重统计 pcode
COUNT(DISTINCT ri.pcode) AS pcdeCount
FROM rk_info ri
<where>
-- 基础过滤:未删除
(ri.is_delete = '0' OR ri.is_delete = 0 OR ri.is_delete IS NULL)
-- 核心过滤:在库状态 (由Service传参或此处硬编码 '0')
<if test="isChuku != null and isChuku != ''">
AND ri.is_chuku = #{isChuku}
</if>
<!-- 以下为动态查询条件,直接复用你 selectRkInfoList 的逻辑 -->
<if test="cangku != null and cangku != ''">
AND ri.cangku = #{cangku}
</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>
<!-- 时间范围 -->
<if test="startTime != null">
AND ri.rk_time &gt;= #{startTime}
</if>
<if test="endTime != null">
AND ri.rk_time &lt;= #{endTime}
</if>
<!-- 模糊搜索 (复用原来的逻辑,确保结果与列表一致) -->
<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="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="pcode != null and pcode != ''">
AND ri.pcode LIKE CONCAT('%', #{pcode}, '%')
</if>
</where>
</select>
<update id="updateBillInfo" parameterType="com.zg.project.wisdom.domain.RkInfo">
UPDATE rk_info
<set>