58123000
发表于 2013-4-14 10:30:08
怎么弄???
yuzhe529
发表于 2013-4-14 10:32:56
看看,歇息
龙之魂
发表于 2013-4-14 10:32:57
{:soso_e100:}
悲秋残月
发表于 2013-4-14 10:45:55
{:soso_e101:}
达摩
发表于 2013-4-14 11:06:31
楼主好人啊楼主好人啊
hua9xin
发表于 2013-4-14 20:05:45
【三国Ⅱ】汉之殇›强大的外交,完美的皇叔开局! ...›参与/回复主题
道友丶请留步
发表于 2013-4-14 20:31:20
看看看看
twsango
发表于 2013-4-14 20:52:26
Thanks!! 謝謝{:soso_e100:}
嗨知
发表于 2013-4-15 18:58:01
谢谢楼主
chriszzm
发表于 2013-4-15 21:09:47
啊啊啊
李豪
发表于 2013-4-16 04:51:05
11111111111111
ketl_888
发表于 2013-4-16 11:22:25
..........................
txx260
发表于 2013-4-16 11:34:17
111111111111111111
2276960970
发表于 2013-4-16 12:38:02
CREATE or REPLACE VIEW scm_rpt_o_0270_vw /*t4品番表(SCM_MTL_MATERIAL_TBL)
t1库存明细单(SCM_WMS_INV_PROC_DTL_TBL)t2库存处理单(SCM_WMS_INV_PROC_TBL)
t3采购订单(SCM_PO_ORDER_TBL)*/
AS
SELECT t4.RETROFIT_TYPE ,t4.DIST_TYPE,
DATE_FORMAT(CONVERT(CONCAT(t1.YYYYMM,'01'),datetime),'%Y') as YYYY,
CASE WHEN mid(A.YYYYMM,5,2) = '01' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_01,
CASE WHEN mid(A.YYYYMM,5,2) = '01' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_01,
CASE WHEN mid(A.YYYYMM,5,2) = '02' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_02,
CASE WHEN mid(A.YYYYMM,5,2) = '02' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_02,
CASE WHEN mid(A.YYYYMM,5,2) = '03' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_03,
CASE WHEN mid(A.YYYYMM,5,2) = '03' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_03,
CASE WHEN mid(A.YYYYMM,5,2) = '04' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_04,
CASE WHEN mid(A.YYYYMM,5,2) = '04' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_04,
CASE WHEN mid(A.YYYYMM,5,2) = '05' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_05,
CASE WHEN mid(A.YYYYMM,5,2) = '05' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_05,
CASE WHEN mid(A.YYYYMM,5,2) = '06' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_06,
CASE WHEN mid(A.YYYYMM,5,2) = '06' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_06,
CASE WHEN mid(A.YYYYMM,5,2) = '07' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_07,
CASE WHEN mid(A.YYYYMM,5,2) = '07' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_07,
CASE WHEN mid(A.YYYYMM,5,2) = '08' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_08,
CASE WHEN mid(A.YYYYMM,5,2) = '08' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_08,
CASE WHEN mid(A.YYYYMM,5,2) = '09' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_09,
CASE WHEN mid(A.YYYYMM,5,2) = '09' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_09,
CASE WHEN mid(A.YYYYMM,5,2) = '10' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_10,
CASE WHEN mid(A.YYYYMM,5,2) = '10' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_10,
CASE WHEN mid(A.YYYYMM,5,2) = '11' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_11,
CASE WHEN mid(A.YYYYMM,5,2) = '11' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_11,
CASE WHEN mid(A.YYYYMM,5,2) = '12' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_12,
CASE WHEN mid(A.YYYYMM,5,2) = '12' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_12,
t1.ID
FROM SCM_WMS_INV_PROC_DTL_TBL t1 INNER JOIN
SCM_WMS_INV_PROC_TBL t2 ON t1.BILL_ID=t2.ID
INNER JOIN SCM_PO_ORDER_TBL t3 ON t1.DATA_SOURCE_ID=t3.ID
INNER JOIN SCM_MTL_MATERIAL_TBL t4 ON t1.ITEM_ID=t4.ID
WHERE t1.DATA_SOURCE_BILL='PO_ORDER'
CREATE or REPLACE VIEW scm_rpt_o_0270_vw /*t4品番表(SCM_MTL_MATERIAL_TBL)
t1库存明细单(SCM_WMS_INV_PROC_DTL_TBL)t2库存处理单(SCM_WMS_INV_PROC_TBL)
t3采购订单(SCM_PO_ORDER_TBL)*/
AS
SELECT t4.RETROFIT_TYPE ,t4.DIST_TYPE,
DATE_FORMAT(CONVERT(CONCAT(t1.YYYYMM,'01'),datetime),'%Y') as YYYY,
CASE WHEN mid(A.YYYYMM,5,2) = '01' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_01,
CASE WHEN mid(A.YYYYMM,5,2) = '01' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_01,
CASE WHEN mid(A.YYYYMM,5,2) = '02' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_02,
CASE WHEN mid(A.YYYYMM,5,2) = '02' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_02,
CASE WHEN mid(A.YYYYMM,5,2) = '03' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_03,
CASE WHEN mid(A.YYYYMM,5,2) = '03' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_03,
CASE WHEN mid(A.YYYYMM,5,2) = '04' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_04,
CASE WHEN mid(A.YYYYMM,5,2) = '04' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_04,
CASE WHEN mid(A.YYYYMM,5,2) = '05' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_05,
CASE WHEN mid(A.YYYYMM,5,2) = '05' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_05,
CASE WHEN mid(A.YYYYMM,5,2) = '06' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_06,
CASE WHEN mid(A.YYYYMM,5,2) = '06' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_06,
CASE WHEN mid(A.YYYYMM,5,2) = '07' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_07,
CASE WHEN mid(A.YYYYMM,5,2) = '07' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_07,
CASE WHEN mid(A.YYYYMM,5,2) = '08' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_08,
CASE WHEN mid(A.YYYYMM,5,2) = '08' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_08,
CASE WHEN mid(A.YYYYMM,5,2) = '09' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_09,
CASE WHEN mid(A.YYYYMM,5,2) = '09' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_09,
CASE WHEN mid(A.YYYYMM,5,2) = '10' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_10,
CASE WHEN mid(A.YYYYMM,5,2) = '10' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_10,
CASE WHEN mid(A.YYYYMM,5,2) = '11' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_11,
CASE WHEN mid(A.YYYYMM,5,2) = '11' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_11,
CASE WHEN mid(A.YYYYMM,5,2) = '12' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)>=t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_WITHIN_12,
CASE WHEN mid(A.YYYYMM,5,2) = '12' THEN (CASE WHEN DATE_SUB(t3.CREATE_DATE,INTERVAL 30 DAY)<t1.ACT_RCPT_DATE THEN t1.PO_RECONCIL_QTY ELSE NULL END) ELSE NULL END AS
SELL_BEYOND_12,
t1.ID
FROM SCM_WMS_INV_PROC_DTL_TBL t1 INNER JOIN
SCM_WMS_INV_PROC_TBL t2 ON t1.BILL_ID=t2.ID
INNER JOIN SCM_PO_ORDER_TBL t3 ON t1.DATA_SOURCE_ID=t3.ID
INNER JOIN SCM_MTL_MATERIAL_TBL t4 ON t1.ITEM_ID=t4.ID
WHERE t1.DATA_SOURCE_BILL='PO_ORDER'
563201431
发表于 2013-4-16 12:43:47
路过看看
偏执的依赖
发表于 2013-4-16 16:46:20
又要回复~~~~~~~
长门有希
发表于 2013-4-16 23:45:22
{:5_127:}{:5_127:}{:5_127:}{:5_127:}
miugor
发表于 2013-4-16 23:48:21
{:soso_e102:}
色彩110
发表于 2013-4-17 12:00:40
看看什么情况
挽挽挽她丶
发表于 2013-4-17 12:17:23
而 阿达的