8AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAYaXc47IOuU6ltmljCrTt9wAAAAAIAAAARABUAFMAAAAQZgAAAAEAACAAAAAkCORNe3vUhr9kRfZEmQJ6E9W/iuF+QLdtBkZTW2ldvQAAAAAOgAAAAAIAACAAAADyBHVtibcZYqdbaRV13DwbrDod1WHZ26IK5fUnDLVTEDAAAAA8LrPTvixw5/J1sCXdTIZHCk1GUfbgiuGXvu5+mWabgbRzoWecfiJwfQZ07swJfqZAAAAARGgtdO9OGZnEkrqxZybiWLafBnLR2Znd3rPiax434VWzHQf8w8/7eMrpP4z816MFtSdxaMKz1hUvlBKvy26aMQ0with t1 as(
select
PERCENT_RANK()
over ( partition by a.LadingBillNumber,f.PublicName
order by datediff(HOUR,d.onlinetime,d.signtime)/24.0) pr
,datediff(HOUR,d.onlinetime,d.signtime)/24.0 as r,
a.LadingBillNumber,d.TrackingNumber,f.PublicName
from
Logistics_LadingBill(nolock)a join Logistics_Box(nolock)b on a.LadingBillNumber=b.LadingBillNumber and a.IsDeleted=0 and b.IsDelete=0
join Logistics_BoxDetail(nolock)c on c.BoxId=b.Id
join Logistics_Trace(nolock)d on d.OrderId=c.OrderId
join Order_Order(nolock)e on e.id=d.OrderId
join Logistics_Channel(nolock) f on f.id=e.ChannelId
join Logistics_Channel(nolock)g on g.id=e.CreateOrderChannelId
join Logistics_Public(nolock)h on h.Code=g.PublicCode
where a.CreateTime>'2022-05-01'
)
select LadingBillNumber,PublicName,MIN(r)time from t1 where pr>=0.95
group by LadingBillNumber,PublicName936false20[dbo].[BaseETL_95P_Ladding_Online]936false3falsefalseTABLOCK,CHECK_CONSTRAINTS21474836470with t1 as(
select
PERCENT_RANK()
over ( partition by a.LadingBillNumber,case when h.name ='美国快线YSW' then '美国快线' else h.name end
order by datediff(HOUR,e.ReceiveTime,d.signtime)/24.0) pr
,datediff(HOUR,e.ReceiveTime,d.signtime)/24.0 as r,
a.LadingBillNumber,d.TrackingNumber,case when h.name ='美国快线YSW' then '美国快线' else h.name end name
from
Logistics_LadingBill(nolock)a join Logistics_Box(nolock)b on a.LadingBillNumber=b.LadingBillNumber and a.IsDeleted=0 and b.IsDelete=0
join Logistics_BoxDetail(nolock)c on c.BoxId=b.Id
join Logistics_Trace(nolock)d on d.OrderId=c.OrderId
join Order_Order(nolock)e on e.id=d.OrderId
join Logistics_Channel(nolock) f on f.id=e.ChannelId
join Logistics_Channel(nolock)g on g.id=e.CreateOrderChannelId
join Logistics_Public(nolock)h on h.Code=g.PublicCode
where a.CreateTime>'2022-05-01'
)
select LadingBillNumber,Name,MIN(r)time from t1 where pr>=0.90
group by LadingBillNumber,Name936false20[dbo].[BaseETL_90P_Ladding_Weight]936false3falsefalseTABLOCK,CHECK_CONSTRAINTS21474836470with t1 as(
select
PERCENT_RANK()
over ( partition by a.LadingBillNumber,case when h.name ='美国快线YSW' then '美国快线' else h.name end
order by datediff(HOUR,e.ReceiveTime,d.signtime)/24.0) pr
,datediff(HOUR,e.ReceiveTime,d.signtime)/24.0 as r,
a.LadingBillNumber,d.TrackingNumber,case when h.name ='美国快线YSW' then '美国快线' else h.name end name
from
Logistics_LadingBill(nolock)a join Logistics_Box(nolock)b on a.LadingBillNumber=b.LadingBillNumber and a.IsDeleted=0 and b.IsDelete=0
join Logistics_BoxDetail(nolock)c on c.BoxId=b.Id
join Logistics_Trace(nolock)d on d.OrderId=c.OrderId
join Order_Order(nolock)e on e.id=d.OrderId
join Logistics_Channel(nolock) f on f.id=e.ChannelId
join Logistics_Channel(nolock)g on g.id=e.CreateOrderChannelId
join Logistics_Public(nolock)h on h.Code=g.PublicCode
where a.CreateTime>'2022-05-01'
)
select LadingBillNumber,Name,MIN(r)time from t1 where pr>=0.95
group by LadingBillNumber,Name936false20with t1 as(
select
PERCENT_RANK()
over ( partition by a.LadingBillNumber,case when h.name ='美国快线YSW' then '美国快线' else h.name end
order by datediff(HOUR,e.ReceiveTime,d.signtime)/24.0) pr
,datediff(HOUR,e.ReceiveTime,d.signtime)/24.0 as r,
a.LadingBillNumber,d.TrackingNumber,case when h.name ='美国快线YSW' then '美国快线' else h.name end name
from
Logistics_LadingBill(nolock)a join Logistics_Box(nolock)b on a.LadingBillNumber=b.LadingBillNumber and a.IsDeleted=0 and b.IsDelete=0
join Logistics_BoxDetail(nolock)c on c.BoxId=b.Id
join Logistics_Trace(nolock)d on d.OrderId=c.OrderId
join Order_Order(nolock)e on e.id=d.OrderId
join Logistics_Channel(nolock) f on f.id=e.ChannelId
join Logistics_Channel(nolock)g on g.id=e.CreateOrderChannelId
join Logistics_Public(nolock)h on h.Code=g.PublicCode
where a.CreateTime>'2022-05-01'
)
select LadingBillNumber,Name,MIN(r)time from t1 where pr>=0.98
group by LadingBillNumber,Name936false20[dbo].[BaseETL_98P_Ladding_Weight]936false3falsefalseTABLOCK,CHECK_CONSTRAINTS21474836470[dbo].[BaseETL_95P_Ladding_Weight]936false3falsefalseTABLOCK,CHECK_CONSTRAINTS2147483647DataSourceViewIDDataSourceViewIDTableInfoObjectTypeTableDataSourceViewIDTableInfoObjectTypeTableDataSourceViewIDDataSourceViewIDDataSourceViewIDTableInfoObjectTypeTableDataSourceViewIDDataSourceViewIDTableInfoObjectTypeTable]]>