This commit is contained in:
linfso 2025-01-08 08:33:15 +08:00
parent dd7f0bdfb0
commit 28aed16a79

View File

@ -182,7 +182,7 @@
select bill_code from emis_waybill_problem_info ewpi where ewpi.del_flag='0' and ewpi.`problem_type` in(151,173,170)
)-->
<select id="queryScanStatList" parameterType="EmisTmsScanRecord" resultMap="ScanStatDataInfoResult">
<select id="queryScanStatListOld" parameterType="EmisTmsScanRecord" resultMap="ScanStatDataInfoResult">
select t1.scan_site_code,t1.scan_count,ifnull(t2.sign_count,0) as sign_count,round(round(ifnull(t2.sign_count,0)/t1.scan_count,3)*100,1) as sign_rate
from (
select a.scan_site_code ,count(DISTINCT a.main_bill_code) as scan_count
@ -251,6 +251,41 @@
</select>
<select id="queryScanStatList" parameterType="EmisTmsScanRecord" resultMap="ScanStatDataInfoResult">
select t1.scan_site_code,t1.scan_count,ifnull(t1.sign_count,0) as sign_count,round(round(ifnull(t1.sign_count,0)/t1.scan_count,3)*100,1) as sign_rate
from (
select a.scan_site_code ,count(DISTINCT a.main_bill_code) as scan_count,sum(if(b.bl_sign=1,1,0)) as sign_count
from emis_tms_scan_record a,emis_waybill b
where a.del_flag='0' and b.del_flag='0' and a.main_bill_code=b.bill_code and a.bl_sub_bill='0'
and not EXISTS (
select 1 from emis_waybill_problem_info ewpi where ewpi.bill_code=b.bill_code and ewpi.del_flag='0' and ewpi.`problem_type` in(151,173,170)
)
and a.scan_type=#{scanType}
<if test="scanType != null and scanType == '20'">
and a.scan_site_code=b.send_site_code
</if>
<if test="scanSiteCode != null and scanSiteCode != ''"> and a.scan_site_code=#{scanSiteCode}</if>
<if test="preOrNextStationCode != null and preOrNextStationCode != ''"> and a.pre_or_next_station_code=#{preOrNextStationCode}</if>
<if test="scanManCode != null and scanManCode != ''"> and a.scan_man_code=#{scanManCode}</if>
<if test="params.beginScanDate != null and params.beginScanDate != ''">and a.scan_date <![CDATA[ >= ]]> #{params.beginScanDate}</if>
<if test="params.endScanDate != null and params.endScanDate != ''">and a.scan_date <![CDATA[ <= ]]> #{params.endScanDate}</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and a.scan_site_code in (
SELECT t1.site_code FROM (
SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid :=
#{params.privSiteCode} ) pd
WHERE FIND_IN_SET( parent_site_code, @pid ) > 0 AND @pid := concat(@pid,',',site_code)
UNION
SELECT #{params.privSiteCode} FROM dual
)
</if>
GROUP BY a.scan_site_code
) t1
</select>
<select id="queryScanStatRecordList" parameterType="EmisTmsScanRecord" resultMap="EmisTmsScanRecordResult">
select a.main_bill_code as bill_code,a.main_bill_code,a.bl_sub_bill,a.scan_type,scan_date as scan_date,
a.pre_or_next_station,a.pre_or_next_station_code,a.scan_site, a.scan_site_code,a.scan_man,a.scan_man_code