demand: TMS系统-运输管理-漏组批次订单-针对从未组批次类型数据取运单始发网点为起始节点 TMS系统-运输管理-漏组批次统计

-针对从未组批次类型数据取运单始发网点为起始节点

committer: heyu
This commit is contained in:
aike 2025-10-20 10:48:36 +08:00
parent 40a41e01bc
commit 19a816afef
2 changed files with 29 additions and 18 deletions

View File

@ -58,7 +58,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectEmisTmsSiteBatchMissVo">
select
m.id, m.bill_code, m.miss_reason, m.create_time, m.update_time, m.remark, m.del_flag,
m.line_code, m.product_type, m.start_site_code, m.next_site_code, m.supplier_code, m.start_date, m.end_date,m.miss_type,
m.line_code, m.product_type,
COALESCE(m.start_site_code, w.start_site_code, w.send_site_code) as start_site_code,
COALESCE(m.next_site_code, w.destination_code) as next_site_code,
m.supplier_code, m.start_date, m.end_date,m.miss_type,
w.send_site_code, s1.site_name as send_site_name,s2.site_name as start_site_name,s3.site_name as next_site_name, w.send_country, c1.name as send_country_name, w.destination_code, s4.site_name as dispatch_underling_site_name,w.bl_is_question,
l.line_name as line_name,
w.receive_country, c2.name as receive_country_name, w.send_date, w.bl_sign, w.sign_date,
@ -77,8 +80,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from emis_tms_site_batch_miss m
left join emis_waybill w on m.bill_code = w.bill_code and w.del_flag='0'
left join emis_site s1 on w.send_site_code=s1.site_code and s1.del_flag=0
left join emis_site s2 on m.start_site_code=s2.site_code and s2.del_flag=0
left join emis_site s3 on m.next_site_code=s3.site_code and s3.del_flag=0
left join emis_site s2 on COALESCE(m.start_site_code, w.start_site_code, w.send_site_code)=s2.site_code and s2.del_flag=0
left join emis_site s3 on COALESCE(m.next_site_code, w.destination_code)=s3.site_code and s3.del_flag=0
left join emis_country c1 on w.send_country=c1.code and c1.del_flag='0'
left join emis_country c2 on w.receive_country=c2.code and c2.del_flag='0'
left join emis_site s4 on w.dispatch_underling_site_code=s4.site_code and s4.del_flag=0
@ -145,7 +148,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
b.bill_code, null as id, '已组批次成功' as miss_reason,
null as create_by, null as create_time, null as update_by, null as update_time,
null as remark, '0' as del_flag,
w.trans_line_type as line_code, w.product_type, w.start_site_code, w.next_site_code,
w.trans_line_type as line_code, w.product_type,
COALESCE(null, w.start_site_code, w.send_site_code) as start_site_code,
COALESCE(null, w.destination_code) as next_site_code,
null as supplier_code, null as start_date, null as end_date, '0' as miss_type,
w.send_site_code, s1.site_name as send_site_name,
w.send_country, c1.name as send_country_name, w.destination_code, s2.site_name as dispatch_underling_site_name, w.bl_is_question,

View File

@ -13,16 +13,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectStatisticsList" parameterType="EmisTmsSiteBatchMissStatistics" resultMap="EmisTmsSiteBatchMissStatisticsResult">
SELECT
bm.start_site_code,
COALESCE(bm.start_site_code, w.start_site_code, w.send_site_code) as start_site_code,
s.site_name as start_site_name,
STR_TO_DATE(CONCAT(DATE_FORMAT(w.send_date, '%Y-%m'), '-01'), '%Y-%m-%d') as bill_month,
COUNT(*) as ticket_count
FROM emis_tms_site_batch_miss bm
LEFT JOIN emis_waybill w ON bm.bill_code = w.bill_code AND w.del_flag = '0'
LEFT JOIN emis_site s ON bm.start_site_code = s.site_code AND s.del_flag = '0'
LEFT JOIN emis_site s ON COALESCE(bm.start_site_code, w.start_site_code, w.send_site_code) = s.site_code AND s.del_flag = '0'
WHERE bm.del_flag = '0'
<if test="startSiteCode != null and startSiteCode != ''">
AND bm.start_site_code = #{startSiteCode}
AND COALESCE(bm.start_site_code, w.start_site_code, w.send_site_code) = #{startSiteCode}
</if>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(w.send_date, '%Y-%m') <![CDATA[ >= ]]> #{startTime}
@ -35,14 +35,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND DATE_FORMAT(w.send_date, '%Y-%m') = DATE_FORMAT(#{billMonth}, '%Y-%m')
</if>
</if>
GROUP BY bm.start_site_code, s.site_name, DATE_FORMAT(w.send_date, '%Y-%m')
ORDER BY w.send_date,bm.start_site_code
GROUP BY COALESCE(bm.start_site_code, w.start_site_code, w.send_site_code), s.site_name, DATE_FORMAT(w.send_date, '%Y-%m')
ORDER BY w.send_date, COALESCE(bm.start_site_code, w.start_site_code, w.send_site_code)
</select>
<select id="selectDetailDataByMonth" parameterType="EmisTmsSiteBatchMiss" resultMap="com.xdadan.erp.emis.mapper.EmisTmsSiteBatchMissMapper.EmisTmsSiteBatchMissResult">
select
m.id, m.bill_code, m.miss_reason, m.create_time, m.update_time, m.remark, m.del_flag,
m.line_code, m.product_type, m.start_site_code, m.next_site_code, m.supplier_code, m.start_date, m.end_date,m.miss_type,
m.line_code, m.product_type,
COALESCE(m.start_site_code, w.start_site_code, w.send_site_code) as start_site_code,
COALESCE(m.next_site_code, w.destination_code) as next_site_code,
m.supplier_code, m.start_date, m.end_date,m.miss_type,
w.send_site_code, s1.site_name as send_site_name,s2.site_name as start_site_name,s3.site_name as next_site_name, w.send_country, c1.name as send_country_name, w.destination_code, s4.site_name as dispatch_underling_site_name,w.bl_is_question,
l.line_name as line_name,
w.receive_country, c2.name as receive_country_name, w.send_date, w.bl_sign, w.sign_date,
@ -63,8 +66,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from emis_tms_site_batch_miss m
left join emis_waybill w on m.bill_code = w.bill_code and w.del_flag='0'
left join emis_site s1 on w.send_site_code=s1.site_code and s1.del_flag='0'
left join emis_site s2 on m.start_site_code=s2.site_code and s2.del_flag='0'
left join emis_site s3 on m.next_site_code=s3.site_code and s3.del_flag='0'
left join emis_site s2 on COALESCE(m.start_site_code, w.start_site_code, w.send_site_code)=s2.site_code and s2.del_flag='0'
left join emis_site s3 on COALESCE(m.next_site_code, w.destination_code)=s3.site_code and s3.del_flag='0'
left join emis_country c1 on w.send_country=c1.code and c1.del_flag='0'
left join emis_country c2 on w.receive_country=c2.code and c2.del_flag='0'
left join emis_site s4 on w.dispatch_underling_site_code=s4.site_code and s4.del_flag='0'
@ -74,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join sys_user u on w.register_man_code=u.emp_code and u.del_flag='0'
WHERE m.del_flag = '0'
<if test="startSiteCode != null and startSiteCode != ''">
AND m.start_site_code = #{startSiteCode}
AND COALESCE(m.start_site_code, w.start_site_code, w.send_site_code) = #{startSiteCode}
</if>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(w.send_date, '%Y-%m') <![CDATA[ >= ]]> #{startTime}
@ -94,7 +97,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDetailDataByMonthWithPaging" resultMap="com.xdadan.erp.emis.mapper.EmisTmsSiteBatchMissMapper.EmisTmsSiteBatchMissResult">
select
m.id, m.bill_code, m.miss_reason, m.create_time, m.update_time, m.remark, m.del_flag,
m.line_code, m.product_type, m.start_site_code, m.next_site_code, m.supplier_code, m.start_date, m.end_date,m.miss_type,
m.line_code, m.product_type,
COALESCE(m.start_site_code, w.start_site_code, w.send_site_code) as start_site_code,
COALESCE(m.next_site_code, w.destination_code) as next_site_code,
m.supplier_code, m.start_date, m.end_date,m.miss_type,
w.send_site_code, s1.site_name as send_site_name,s2.site_name as start_site_name,s3.site_name as next_site_name, w.send_country, c1.name as send_country_name, w.destination_code, s4.site_name as dispatch_underling_site_name,w.bl_is_question,
l.line_name as line_name,
w.receive_country, c2.name as receive_country_name, w.send_date, w.bl_sign, w.sign_date,
@ -115,8 +121,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from emis_tms_site_batch_miss m
left join emis_waybill w on m.bill_code = w.bill_code and w.del_flag='0'
left join emis_site s1 on w.send_site_code=s1.site_code and s1.del_flag='0'
left join emis_site s2 on m.start_site_code=s2.site_code and s2.del_flag='0'
left join emis_site s3 on m.next_site_code=s3.site_code and s3.del_flag='0'
left join emis_site s2 on COALESCE(m.start_site_code, w.start_site_code, w.send_site_code)=s2.site_code and s2.del_flag='0'
left join emis_site s3 on COALESCE(m.next_site_code, w.destination_code)=s3.site_code and s3.del_flag='0'
left join emis_country c1 on w.send_country=c1.code and c1.del_flag='0'
left join emis_country c2 on w.receive_country=c2.code and c2.del_flag='0'
left join emis_site s4 on w.dispatch_underling_site_code=s4.site_code and s4.del_flag='0'
@ -126,7 +132,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join sys_user u on w.register_man_code=u.emp_code and u.del_flag='0'
WHERE m.del_flag = '0'
<if test="query.startSiteCode != null and query.startSiteCode != ''">
AND m.start_site_code = #{query.startSiteCode}
AND COALESCE(m.start_site_code, w.start_site_code, w.send_site_code) = #{query.startSiteCode}
</if>
<if test="query.startTime != null and query.startTime != ''">
AND DATE_FORMAT(w.send_date, '%Y-%m') <![CDATA[ >= ]]> #{query.startTime}
@ -150,7 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN emis_waybill w ON m.bill_code = w.bill_code AND w.del_flag='0'
WHERE m.del_flag = '0'
<if test="startSiteCode != null and startSiteCode != ''">
AND m.start_site_code = #{startSiteCode}
AND COALESCE(m.start_site_code, w.start_site_code, w.send_site_code) = #{startSiteCode}
</if>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(w.send_date, '%Y-%m') <![CDATA[ >= ]]> #{startTime}