<?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">
|
<mapper namespace="cn.iocoder.yudao.module.mes.dal.mysql.home.MesBagCodeHomeStatisticsMapper">
|
|
<!-- ========== 基础数据 ========== -->
|
|
<!-- 统计品种总数(mdm_item) -->
|
<select id="selectMdmItemCount" resultType="java.lang.Long">
|
SELECT COUNT(*)
|
FROM mdm_item
|
WHERE deleted = 0
|
</select>
|
|
<!-- 统计 MES 品种数(mes_md_item) -->
|
<select id="selectMesItemCount" resultType="java.lang.Long">
|
SELECT COUNT(*)
|
FROM mes_md_item
|
WHERE deleted = 0
|
</select>
|
|
<!-- 统计品种分类数(mes_md_item_type) -->
|
<select id="selectItemTypeCount" resultType="java.lang.Long">
|
SELECT COUNT(*)
|
FROM mes_md_item_type
|
WHERE deleted = 0
|
</select>
|
|
<!-- 统计计量单位数(mdm_unit_measure) -->
|
<select id="selectUnitMeasureCount" resultType="java.lang.Long">
|
SELECT COUNT(*)
|
FROM mdm_unit_measure
|
WHERE deleted = 0
|
</select>
|
|
<!-- ========== 一袋一码 ========== -->
|
|
<!-- 统计产线数(mes_pro_line) -->
|
<select id="selectLineCount" resultType="java.lang.Long">
|
SELECT COUNT(*)
|
FROM mes_pro_line
|
WHERE deleted = 0
|
</select>
|
|
<!-- 统计批次总数(mes_pro_batch) -->
|
<select id="selectBatchCount" resultType="java.lang.Long">
|
SELECT COUNT(*)
|
FROM mes_pro_batch
|
WHERE deleted = 0
|
</select>
|
|
<!-- 统计袋码总数(mes_pro_bag_code) -->
|
<select id="selectBagCodeCount" resultType="java.lang.Long">
|
SELECT COUNT(*)
|
FROM mes_pro_bag_code
|
WHERE deleted = 0
|
</select>
|
|
<!-- 统计托盘码总数(mes_pro_pallet) -->
|
<select id="selectPalletCount" resultType="java.lang.Long">
|
SELECT COUNT(*)
|
FROM mes_pro_pallet
|
WHERE deleted = 0
|
</select>
|
|
<!-- ========== 状态分布 ========== -->
|
|
<!-- 按状态统计批次数量 -->
|
<select id="selectBatchCountGroupByStatus" resultType="java.util.Map">
|
SELECT status, COUNT(*) AS count
|
FROM mes_pro_batch
|
WHERE deleted = 0
|
GROUP BY status
|
</select>
|
|
<!-- 按状态统计袋码数量 -->
|
<select id="selectBagCodeCountGroupByStatus" resultType="java.util.Map">
|
SELECT status, COUNT(*) AS count
|
FROM mes_pro_bag_code
|
WHERE deleted = 0
|
GROUP BY status
|
</select>
|
|
<!-- 按天聚合袋码生成量 -->
|
<select id="selectDailyBagCodeTrend" resultType="java.util.Map">
|
SELECT DATE_FORMAT(create_time, '%Y-%m-%d') AS date,
|
COUNT(*) AS count
|
FROM mes_pro_bag_code
|
WHERE deleted = 0
|
AND create_time >= #{beginTime}
|
<if test="endTime != null">
|
AND create_time < #{endTime}
|
</if>
|
GROUP BY DATE_FORMAT(create_time, '%Y-%m-%d')
|
ORDER BY date
|
</select>
|
|
</mapper>
|