8AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAYaXc47IOuU6ltmljCrTt9wAAAAAIAAAARABUAFMAAAAQZgAAAAEAACAAAABYPcU39KZa+ot5ngGHTykipBlnYBCZ6n0ZvML9qSSsQAAAAAAOgAAAAAIAACAAAACfjM8Y/BAJqo0685r5XVeQHb4n6EWKZVSPK2bZRHeq1zAAAABufcQGxVtXMQnoTfxK0Dgp0GhXpiDN2IKvBq8sReJ9twsVTbvlBZQsmTRv54fBbd9AAAAA905pHbUehIAKIYttbcDHyZR5h653ETFi8VZX/jN5+mP9JStMnSCrOf6FnrEvp6shOdoj0vzBWf+bXZLaEXmZQQ0with 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[BaseETL_95P_Ladding_DeliveryChanne_Online]936false3falsefalseTABLOCK,CHECK_CONSTRAINTS21474836470with t1 as(
select
PERCENT_RANK()
over ( partition by a.LadingBillNumber,f.PublicName
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,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 Name,MIN(r)time from t1 where pr>=0.90
group by LadingBillNumber,PublicName936false20[dbo].[BaseETL_90P_Ladding_DeliveryChanne_Weight]936false3falsefalseTABLOCK,CHECK_CONSTRAINTS21474836470with t1 as(
select
PERCENT_RANK()
over ( partition by a.LadingBillNumber,f.PublicName
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,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 Name,MIN(r)time from t1 where pr>=0.95
group by LadingBillNumber,PublicName936false20with t1 as(
select
PERCENT_RANK()
over ( partition by a.LadingBillNumber,f.PublicName
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,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 Name,MIN(r)time from t1 where pr>=0.98
group by LadingBillNumber,PublicName936false20[dbo].[BaseETL_98P_Ladding_DeliveryChanne_Weight]936false3falsefalseTABLOCK,CHECK_CONSTRAINTS21474836470[BaseETL_95P_Ladding_DeliveryChanne_Weight]936false3falsefalseTABLOCK,CHECK_CONSTRAINTS2147483647DataSourceViewIDDataSourceViewIDTableInfoObjectTypeTableDataSourceViewIDTableInfoObjectTypeTableDataSourceViewIDDataSourceViewIDDataSourceViewIDTableInfoObjectTypeTableDataSourceViewIDDataSourceViewIDTableInfoObjectTypeTable]]>