sql emydex产品追踪
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql emydex产品追踪相关的知识,希望对你有一定的参考价值。
-- SUMMARY OF PRODUCTS PRODUCTION BETWEEN DATES
select
convert(date,transactiondatetime) ProductionDate,code PLUCode,Text1 PLUText,count(uid) Produced
from
vw_ce_dms_transactions vw
join datafiles_data dd
on vw.PLUID=dd.DatafileDataID
where
TransactionType like '%PACKING%'
and TransactionDateTime between '2017-01-10 17:00:00' and '2017-01-10 17:46:00'
and Date6='2017-01-26'
and pluid in (24196)
and cancelled=0
group by
convert(date,transactiondatetime),code,text1
order by
convert(date,transactiondatetime), PLUCode
-- SUMMARY OF EACH TRANSACTION TYPE AFTER PRODUCT WAS PACKED
declare @PLU as varchar(6)=116500
declare @date1 as datetime='2017-01-10'
declare @date2 as datetime=dateadd(dd,1,@date1)
select
TransactionType,CASE TransactionType WHEN 'BOX_WRITE_ON' THEN Count(DISTINCT(UID))*-1 else COUNT(DISTINCT(UID)) end as Qty,
ISNULL(WONo,'') OrderNo,convert(date,transactiondatetime) TransactionDate,ISNULL(cu.Code,'') CustomerNo,ISNULL(Cu.Text1,'') Customer,
pl.Code PLUCode,pl.Text1 PLUText, ISNULL(dp.Code,'') DepotCode, ISNULL(dp.Text1,'') DepotName
from
vw_ce_dms_transactions vw
left join oms_order_header oh
on oh.OrderType='SO'
and oh.OrderNo=vw.WONo
and oh.OrderVersion=0
left join datafiles_data cu
on oh.TraderID=cu.DatafileDataID
join datafiles_data pl
on vw.PLUID=pl.DatafileDataID
LEFT JOIN datafiles_data dp
ON dp.DatafileDataID = oh.DepotID
where UID
IN (
select
UID
from
vw_ce_dms_transactions vw
join datafiles_data dd
on vw.PLUID=dd.DatafileDataID
where
TransactionType like '%PACKING%'
--and TransactionDateTime between @date1 and @date2
and TransactionDateTime between '2017-01-10 17:00:00' and '2017-01-10 17:46:00'
and code=@PLU
and cancelled=0
and Date6='2017-01-26'
)
and TransactionType in ('BOX_WRITE_OFF','BOX_REWORK','PALLET_DISPATCH_PICKING','BOX_WRITE_ON')
and Cancelled=0
group by
TransactionType,wono,convert(date,transactiondatetime),cu.Code,cu.Text1,
pl.Code,pl.Text1, dp.Code, dp.Text1
order by
TransactionType,
convert(date,transactiondatetime),CustomerNo
-- CHECK IF PRODUCTS STILL EXIST IN STOCK
declare @PLU as varchar(6)=116500
declare @date1 as datetime='2017-01-10'
declare @date2 as datetime=dateadd(dd,1,@date1)
select *
from vw_ce_ims_items
where itemid in (
select
UID
from
vw_ce_dms_transactions vw
join datafiles_data dd
on vw.PLUID=dd.DatafileDataID
where
TransactionType like '%PACKING%'
and TransactionDateTime between @date1 and @date2
and code=@PLU
and cancelled=0
and Date6='2017-01-26'
)
and Destroyed=0
以上是关于sql emydex产品追踪的主要内容,如果未能解决你的问题,请参考以下文章
阿里云产品专家解读链路追踪(Tracing Analysis)