2014年11月10日 星期一

iDempiere Table Alise 要用 funciton 才不會抓錯


        at org.adempiere.webui.part.AbstractUIPart.createPart(AbstractUIPart.jav
a:41)

12:59:43.161-----------> AccessSqlParser.getTableInfo: More than one FROM clause
 - SELECT COUNT(*) FROM 完工入庫品檢單 WHERE (EXISTS ( SELECT 1 FROM 完工入庫品
檢單項次, 品管狀態 WHERE 品管狀態.品管狀態_ID=完工入庫品檢單項次.品管狀態_ID AND
  完工入庫品檢單.完工入庫品檢單_ID=完工入庫品檢單項次.完工入庫品檢單_ID AND 品管
狀態.名稱<>'待驗' )) [76]
12:59:43.164===========> MRole.addAccessSQL: TableName not correctly parsed - Ta
bleNameIn=完工入庫品檢單 - AccessSqlParser[完工入庫品檢單=WHERE,品管狀態|0] - #1
 完工入庫品檢單=WHERE
 = SELECT COUNT(*) FROM 完工入庫品檢單 WHERE (EXISTS ( SELECT 1 FROM 完工入庫品
檢單項次, 品管狀態 WHERE 品管狀態.品管狀態_ID=完工入庫品檢單項次.品管狀態_ID AND
  完工入庫品檢單.完工入庫品檢單_ID=完工入庫品檢單項次.完工入庫品檢單_ID AND 品管
狀態.名稱<>'待驗' )) [76]
12:59:43.181===========> FindWindow.getNoOfRecords: SELECT COUNT(*) FROM 完工入
庫品檢單 WHERE (EXISTS ( SELECT 1 FROM 完工入庫品檢單項次, 品管狀態 WHERE 品管狀
態.品管狀態_ID=完工入庫品檢單項次.品管狀態_ID AND  完工入庫品檢單.完工入庫品檢單
_ID=完工入庫品檢單項次.完工入庫品檢單_ID AND 品管狀態.名稱<>'待驗' )) AND AD_Cli
ent_ID IN(0,11) AND AD_Org_ID IN(50007,0,50004,50005,50006,50000,50001,50002,11,
12) AND  (完工入庫品檢單_ID IS NULL OR 完工入庫品檢單_ID NOT IN ( SELECT Record_
ID FROM AD_Private_Access WHERE AD_Table_ID = 1000116 AND AD_User_ID <> 100 AND
IsActive = 'Y' ))  AND  (品管狀態_ID IS NULL OR 品管狀態_ID NOT IN ( SELECT Reco
rd_ID FROM AD_Private_Access WHERE AD_Table_ID = 1000086 AND AD_User_ID <> 100 A
ND IsActive = 'Y' ))  [76]
org.postgresql.util.PSQLException: 錯誤: 欄位"品管狀態_id"不存在
  Position: 436; State=42703; ErrorCode=0
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryEx
ecutorImpl.java:2157)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutor
Impl.java:1886)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.ja
va:255)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Stat
ement.java:559)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(Abstract
Jdbc2Statement.java:403)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc
2Statement.java:283)
        at com.mchange.v2.c3p0.impl.NewProxyStatement.executeQuery(NewProxyState
ment.java:177)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.compiere.db.StatementProxy.invoke(StatementProxy.java:126)
        at com.sun.proxy.$Proxy30.executeQuery(Unknown Source)
        at org.adempiere.webui.window.FindWindow.getNoOfRecords(FindWindow.java:
1921)
        at org.adempiere.webui.window.FindWindow.initFind(FindWindow.java:680)
        at org.adempiere.webui.window.FindWindow.initialize(FindWindow.java:265)

        at org.adempiere.webui.adwindow.AbstractADWindowContent.doOnFind(Abstrac
tADWindowContent.java:1769)
        at org.adempiere.webui.adwindow.AbstractADWindowContent.access$12(Abstra
ctADWindowContent.java:1758)
        at org.adempiere.webui.adwindow.AbstractADWindowContent$18.onCallback(Ab
stractADWindowContent.java:1752)
        at org.adempiere.webui.adwindow.AbstractADWindowContent$18.onCallback(Ab
stractADWindowContent.java:1)
        at org.adempiere.webui.adwindow.AbstractADWindowContent.onSave0(Abstract
ADWindowContent.java:2001)

12:59:44.755-----------> AccessSqlParser.getTableInfo: More than one FROM clause
 - SELECT COUNT(*) FROM 完工入庫品檢單 WHERE (EXISTS ( SELECT 1 FROM 完工入庫品
檢單項次, 品管狀態 WHERE 品管狀態.品管狀態_ID=完工入庫品檢單項次.品管狀態_ID AND
  完工入庫品檢單.完工入庫品檢單_ID=完工入庫品檢單項次.完工入庫品檢單_ID AND 品管
狀態.名稱<>'待驗' )) AND ((EXISTS ( SELECT 1 FROM 完工入庫品檢單項次, 品管狀態 W
HERE 品管狀態.品管狀態_ID=完工入庫品檢單項次.品管狀態_ID AND  完工入庫品檢單.完
工入庫品檢單_ID=完工入庫品檢單項次.完工入庫品檢單_ID AND 品管狀態.名稱<>'待驗' )
)) [76]
12:59:44.760===========> MRole.addAccessSQL: TableName not correctly parsed - Ta
bleNameIn=完工入庫品檢單 - AccessSqlParser[完工入庫品檢單=WHERE,品管狀態=WHERE,
品管狀態|0] - #1 完工入庫品檢單=WHERE
 = SELECT COUNT(*) FROM 完工入庫品檢單 WHERE (EXISTS ( SELECT 1 FROM 完工入庫品
檢單項次, 品管狀態 WHERE 品管狀態.品管狀態_ID=完工入庫品檢單項次.品管狀態_ID AND
  完工入庫品檢單.完工入庫品檢單_ID=完工入庫品檢單項次.完工入庫品檢單_ID AND 品管
狀態.名稱<>'待驗' )) AND ((EXISTS ( SELECT 1 FROM 完工入庫品檢單項次, 品管狀態 W
HERE 品管狀態.品管狀態_ID=完工入庫品檢單項次.品管狀態_ID AND  完工入庫品檢單.完
工入庫品檢單_ID=完工入庫品檢單項次.完工入庫品檢單_ID AND 品管狀態.名稱<>'待驗' )
)) [76]
12:59:44.784===========> FindWindow.getNoOfRecords: SELECT COUNT(*) FROM 完工入
庫品檢單 WHERE (EXISTS ( SELECT 1 FROM 完工入庫品檢單項次, 品管狀態 WHERE 品管狀
態.品管狀態_ID=完工入庫品檢單項次.品管狀態_ID AND  完工入庫品檢單.完工入庫品檢單
_ID=完工入庫品檢單項次.完工入庫品檢單_ID AND 品管狀態.名稱<>'待驗' )) AND ((EXIS
TS ( SELECT 1 FROM 完工入庫品檢單項次, 品管狀態 WHERE 品管狀態.品管狀態_ID=完工
入庫品檢單項次.品管狀態_ID AND  完工入庫品檢單.完工入庫品檢單_ID=完工入庫品檢單
項次.完工入庫品檢單_ID AND 品管狀態.名稱<>'待驗' ))) AND AD_Client_ID IN(0,11) A
ND AD_Org_ID IN(50007,0,50004,50005,50006,50000,50001,50002,11,12) AND  (完工入
庫品檢單_ID IS NULL OR 完工入庫品檢單_ID NOT IN ( SELECT Record_ID FROM AD_Priva
te_Access WHERE AD_Table_ID = 1000116 AND AD_User_ID <> 100 AND IsActive = 'Y' )
)  AND  (品管狀態_ID IS NULL OR 品管狀態_ID NOT IN ( SELECT Record_ID FROM AD_Pr
ivate_Access WHERE AD_Table_ID = 1000086 AND AD_User_ID <> 100 AND IsActive = 'Y
' ))  AND  (品管狀態_ID IS NULL OR 品管狀態_ID NOT IN ( SELECT Record_ID FROM AD
_Private_Access WHERE AD_Table_ID = 1000086 AND AD_User_ID <> 100 AND IsActive =
 'Y' ))  [76]
org.postgresql.util.PSQLException: 錯誤: 欄位"品管狀態_id"不存在
  Position: 584; State=42703; ErrorCode=0
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryEx
ecutorImpl.java:2157)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutor
Impl.java:1886)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.ja
va:255)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Stat
ement.java:559)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(Abstract
Jdbc2Statement.java:403)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc
2Statement.java:283)
        at com.mchange.v2.c3p0.impl.NewProxyStatement.executeQuery(NewProxyState
ment.java:177)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.compiere.db.StatementProxy.invoke(StatementProxy.java:126)
        at com.sun.proxy.$Proxy30.executeQuery(Unknown Source)
        at org.adempiere.webui.window.FindWindow.getNoOfRecords(FindWindow.java:
1921)
        at org.adempiere.webui.window.FindWindow.cmd_ok_Simple(FindWindow.java:1
803)
        at org.adempiere.webui.window.FindWindow.onEvent(FindWindow.java:1122)
        at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2742
)
        at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2713
)
        at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2654
)
        at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136)
        at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1717
)

12:59:44.819-----------> AccessSqlParser.getTableInfo: More than one FROM clause
 - SELECT AD_Client_ID,AD_Org_ID,完工入庫品檢單_ID,完工入庫品檢單_UU,品檢人員_ID
,品檢日期,客戶_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy FROM 完工入庫品檢
單 WHERE ((EXISTS ( SELECT 1 FROM 完工入庫品檢單項次, 品管狀態 WHERE 品管狀態.品
管狀態_ID=完工入庫品檢單項次.品管狀態_ID AND  完工入庫品檢單.完工入庫品檢單_ID=
完工入庫品檢單項次.完工入庫品檢單_ID AND 品管狀態.名稱<>'待驗' )) AND  (((EXISTS
 ( SELECT 1 FROM 完工入庫品檢單項次, 品管狀態 WHERE 品管狀態.品管狀態_ID=完工入
庫品檢單項次.品管狀態_ID AND  完工入庫品檢單.完工入庫品檢單_ID=完工入庫品檢單項
次.完工入庫品檢單_ID AND 品管狀態.名稱<>'待驗' ))))) [76]
12:59:44.826===========> MRole.addAccessSQL: TableName not correctly parsed - Ta
bleNameIn=完工入庫品檢單 - AccessSqlParser[完工入庫品檢單=WHERE,品管狀態=WHERE,
品管狀態|0] - #1 完工入庫品檢單=WHERE
 = SELECT AD_Client_ID,AD_Org_ID,完工入庫品檢單_ID,完工入庫品檢單_UU,品檢人員_ID
,品檢日期,客戶_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy FROM 完工入庫品檢
單 WHERE ((EXISTS ( SELECT 1 FROM 完工入庫品檢單項次, 品管狀態 WHERE 品管狀態.品
管狀態_ID=完工入庫品檢單項次.品管狀態_ID AND  完工入庫品檢單.完工入庫品檢單_ID=
完工入庫品檢單項次.完工入庫品檢單_ID AND 品管狀態.名稱<>'待驗' )) AND  (((EXISTS
 ( SELECT 1 FROM 完工入庫品檢單項次, 品管狀態 WHERE 品管狀態.品管狀態_ID=完工入
庫品檢單項次.品管狀態_ID AND  完工入庫品檢單.完工入庫品檢單_ID=完工入庫品檢單項
次.完工入庫品檢單_ID AND 品管狀態.名稱<>'待驗' ))))) [76]
12:59:44.846-----------> AccessSqlParser.getTableInfo: More than one FROM clause
 - SELECT COUNT(*) FROM 完工入庫品檢單 WHERE ((EXISTS ( SELECT 1 FROM 完工入庫品
檢單項次, 品管狀態 WHERE 品管狀態.品管狀態_ID=完工入庫品檢單項次.品管狀態_ID AND
  完工入庫品檢單.完工入庫品檢單_ID=完工入庫品檢單項次.完工入庫品檢單_ID AND 品管
狀態.名稱<>'待驗' )) AND  (((EXISTS ( SELECT 1 FROM 完工入庫品檢單項次, 品管狀態
 WHERE 品管狀態.品管狀態_ID=完工入庫品檢單項次.品管狀態_ID AND  完工入庫品檢單.
完工入庫品檢單_ID=完工入庫品檢單項次.完工入庫品檢單_ID AND 品管狀態.名稱<>'待驗'
 ))))) [76]
12:59:44.852===========> MRole.addAccessSQL: TableName not correctly parsed - Ta
bleNameIn=完工入庫品檢單 - AccessSqlParser[完工入庫品檢單=WHERE,品管狀態=WHERE,
品管狀態|0] - #1 完工入庫品檢單=WHERE
 = SELECT COUNT(*) FROM 完工入庫品檢單 WHERE ((EXISTS ( SELECT 1 FROM 完工入庫品
檢單項次, 品管狀態 WHERE 品管狀態.品管狀態_ID=完工入庫品檢單項次.品管狀態_ID AND
  完工入庫品檢單.完工入庫品檢單_ID=完工入庫品檢單項次.完工入庫品檢單_ID AND 品管
狀態.名稱<>'待驗' )) AND  (((EXISTS ( SELECT 1 FROM 完工入庫品檢單項次, 品管狀態
 WHERE 品管狀態.品管狀態_ID=完工入庫品檢單項次.品管狀態_ID AND  完工入庫品檢單.
完工入庫品檢單_ID=完工入庫品檢單項次.完工入庫品檢單_ID AND 品管狀態.名稱<>'待驗'
 ))))) [76]
12:59:44.874===========> GridTable.open: Count SQL=SELECT COUNT(*) FROM 完工入庫
品檢單 WHERE ((EXISTS ( SELECT 1 FROM 完工入庫品檢單項次, 品管狀態 WHERE 品管狀
態.品管狀態_ID=完工入庫品檢單項次.品管狀態_ID AND  完工入庫品檢單.完工入庫品檢單
_ID=完工入庫品檢單項次.完工入庫品檢單_ID AND 品管狀態.名稱<>'待驗' )) AND  (((EX
ISTS ( SELECT 1 FROM 完工入庫品檢單項次, 品管狀態 WHERE 品管狀態.品管狀態_ID=完
工入庫品檢單項次.品管狀態_ID AND  完工入庫品檢單.完工入庫品檢單_ID=完工入庫品檢
單項次.完工入庫品檢單_ID AND 品管狀態.名稱<>'待驗' ))))) AND 完工入庫品檢單.AD_C
lient_ID IN(0,11) AND 完工入庫品檢單.AD_Org_ID IN(50007,0,50004,50005,50006,5000
0,50001,50002,11,12) AND  (WHERE.完工入庫品檢單_ID IS NULL OR WHERE.完工入庫品檢
單_ID NOT IN ( SELECT Record_ID FROM AD_Private_Access WHERE AD_Table_ID = 10001
16 AND AD_User_ID <> 100 AND IsActive = 'Y' ))  AND  (WHERE.品管狀態_ID IS NULL
OR WHERE.品管狀態_ID NOT IN ( SELECT Record_ID FROM AD_Private_Access WHERE AD_T
able_ID = 1000086 AND AD_User_ID <> 100 AND IsActive = 'Y' ))  AND  (品管狀態.品
管狀態_ID IS NULL OR 品管狀態.品管狀態_ID NOT IN ( SELECT Record_ID FROM AD_Priv
ate_Access WHERE AD_Table_ID = 1000086 AND AD_User_ID <> 100 AND IsActive = 'Y'
))  [76]
org.postgresql.util.PSQLException: 錯誤: 在"語法錯誤"附近發生 WHERE
  Position: 445; State=42601; ErrorCode=0
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryEx
ecutorImpl.java:2157)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutor
Impl.java:1886)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.ja
va:255)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Stat
ement.java:559)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(Abstract
Jdbc2Statement.java:417)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc
2Statement.java:302)
        at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewPr
oxyPreparedStatement.java:116)
        at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.compiere.db.StatementProxy.invoke(StatementProxy.java:126)
        at com.sun.proxy.$Proxy0.executeQuery(Unknown Source)
        at org.compiere.model.GridTable$Loader.open(GridTable.java:3437)
        at org.compiere.model.GridTable.open(GridTable.java:615)
        at org.compiere.model.GridTable.dataRequery(GridTable.java:2942)
        at org.compiere.model.GridTable.dataRequery(GridTable.java:2957)
        at org.compiere.model.GridTab.query(GridTab.java:745)
        at org.adempiere.webui.adwindow.ADTabpanel.query(ADTabpanel.java:916)
        at org.adempiere.webui.adwindow.AbstractADWindowContent$19.onEvent(Abstr
actADWindowContent.java:1791)
        at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2742
)
        at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2713
)

18:13:13.072-----------> AccessSqlParser.getTableInfo: More than one FROM clause
 - SELECT AD_Client_ID,AD_Org_ID,完工入庫品檢單_ID,完工入庫品檢單_UU,品檢人員_ID
,品檢日期,客戶_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy FROM 完工入庫品檢
單 WHERE ((EXISTS ( SELECT 1 FROM 完工入庫品檢單項次 a, 品管狀態 b WHERE a.品管
狀態_ID=b.品管狀態_ID AND  完工入庫品檢單.完工入庫品檢單_ID=a.完工入庫品檢單_ID
AND b.名稱<>'待驗' ))) [79]
18:13:13.077===========> MRole.addAccessSQL: TableName not correctly parsed - Ta
bleNameIn=完工入庫品檢單 - AccessSqlParser[完工入庫品檢單=WHERE,品管狀態=b|0] -
#1 完工入庫品檢單=WHERE
 = SELECT AD_Client_ID,AD_Org_ID,完工入庫品檢單_ID,完工入庫品檢單_UU,品檢人員_ID
,品檢日期,客戶_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy FROM 完工入庫品檢
單 WHERE ((EXISTS ( SELECT 1 FROM 完工入庫品檢單項次 a, 品管狀態 b WHERE a.品管
狀態_ID=b.品管狀態_ID AND  完工入庫品檢單.完工入庫品檢單_ID=a.完工入庫品檢單_ID
AND b.名稱<>'待驗' ))) [79]
18:13:13.134-----------> AccessSqlParser.getTableInfo: More than one FROM clause
 - SELECT COUNT(*) FROM 完工入庫品檢單 WHERE ((EXISTS ( SELECT 1 FROM 完工入庫品
檢單項次 a, 品管狀態 b WHERE a.品管狀態_ID=b.品管狀態_ID AND  完工入庫品檢單.完
工入庫品檢單_ID=a.完工入庫品檢單_ID AND b.名稱<>'待驗' ))) [79]
18:13:13.137===========> MRole.addAccessSQL: TableName not correctly parsed - Ta
bleNameIn=完工入庫品檢單 - AccessSqlParser[完工入庫品檢單=WHERE,品管狀態=b|0] -
#1 完工入庫品檢單=WHERE
 = SELECT COUNT(*) FROM 完工入庫品檢單 WHERE ((EXISTS ( SELECT 1 FROM 完工入庫品
檢單項次 a, 品管狀態 b WHERE a.品管狀態_ID=b.品管狀態_ID AND  完工入庫品檢單.完
工入庫品檢單_ID=a.完工入庫品檢單_ID AND b.名稱<>'待驗' ))) [79]
18:13:13.160===========> GridTable.open: Count SQL=SELECT COUNT(*) FROM 完工入庫
品檢單 WHERE ((EXISTS ( SELECT 1 FROM 完工入庫品檢單項次 a, 品管狀態 b WHERE a.
品管狀態_ID=b.品管狀態_ID AND  完工入庫品檢單.完工入庫品檢單_ID=a.完工入庫品檢單
_ID AND b.名稱<>'待驗' ))) AND 完工入庫品檢單.AD_Client_ID IN(0,11) AND 完工入庫
品檢單.AD_Org_ID IN(50007,0,50004,50005,50006,50000,50001,50002,11,12) AND  (WHE
RE.完工入庫品檢單_ID IS NULL OR WHERE.完工入庫品檢單_ID NOT IN ( SELECT Record_I
D FROM AD_Private_Access WHERE AD_Table_ID = 1000116 AND AD_User_ID <> 100 AND I
sActive = 'Y' ))  AND  (b.品管狀態_ID IS NULL OR b.品管狀態_ID NOT IN ( SELECT R
ecord_ID FROM AD_Private_Access WHERE AD_Table_ID = 1000086 AND AD_User_ID <> 10
0 AND IsActive = 'Y' ))  [79]
org.postgresql.util.PSQLException: 錯誤: 在"語法錯誤"附近發生 WHERE
  Position: 277; State=42601; ErrorCode=0
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryEx
ecutorImpl.java:2157)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutor
Impl.java:1886)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.ja
va:255)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Stat
ement.java:559)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(Abstract
Jdbc2Statement.java:417)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc
2Statement.java:302)
        at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewPr
oxyPreparedStatement.java:116)
        at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.compiere.db.StatementProxy.invoke(StatementProxy.java:126)
        at com.sun.proxy.$Proxy0.executeQuery(Unknown Source)
        at org.compiere.model.GridTable$Loader.open(GridTable.java:3437)
        at org.compiere.model.GridTable.open(GridTable.java:615)
        at org.compiere.model.GridTab.query(GridTab.java:750)
        at org.adempiere.webui.adwindow.ADTabpanel.query(ADTabpanel.java:916)
        at org.adempiere.webui.adwindow.AbstractADWindowContent.initFirstTabpane
l(AbstractADWindowContent.java:603)
        at org.adempiere.webui.adwindow.AbstractADWindowContent.initTab(Abstract
ADWindowContent.java:589)
        at org.adempiere.webui.adwindow.AbstractADWindowContent.initPanel(Abstra
ctADWindowContent.java:343)
        at org.adempiere.webui.adwindow.ADWindow.doCreatePart(ADWindow.java:150)

        at org.adempiere.webui.part.AbstractUIPart.createPart(AbstractUIPart.jav
a:41)

系統轉移用 iDempiere 去監測 SAP Oracle informix 資料庫 存放位置



import groovy.sql.Sql
import java.sql.Timestamp
import java.sql.PreparedStatement
import java.sql.ResultSet
import java.sql.Types
import org.compiere.util.Env
import org.compiere.util.DB
import java.sql.SQLException

int client=Env.getContextAsInt(A_Ctx, "AD_Client_ID");
int org=Env.getContextAsInt(A_Ctx, "AD_Org_ID");
int uid=Env.getContextAsInt(A_Ctx, "#AD_User_ID");

def t_start= System.currentTimeMillis()
String ss= DB.getSQLValueString(null,"select value from h_search where h_search_id = ?", A_Record_ID );
DB.executeUpdateEx( "delete from h_searchline where h_search_id="+A_Record_ID+ " " , A_TrxName);

def postsql = Sql.newInstance('jdbc:postgresql://127.0.0.1/taya1201','adempiere','adempiere','org.postgresql.Driver' )
def ptable= postsql.dataSet("h_searchline")   //上傳
def informix = Sql.newInstance( 'jdbc:informix-sqli://192.168.170.211:1534/hisopddb:informixserver=hisopdsrv;CLIENT_LOCALE=zh_tw.big5;','informix','db@w94u6', 'com.informix.jdbc.IfxDriver' );
def metadata = informix.connection.metaData
String[] tableTypes = ["TABLE"]
ResultSet rs = metadata.getTables(null, null, null, tableTypes );  //"userlist"
// getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types)
// "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
String tblName = null;


while(rs.next()){
   tblName = rs.getString('TABLE_NAME');
   println ">>>>>> "+tblName
   ResultSet tblMetadata = metadata.getColumns(null, '%', tblName, null);
// ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern)  throws SQLException
   while(tblMetadata.next()){
      String TABLE_SCHEM= tblMetadata.getString("TABLE_SCHEM");
      String TABLE_NAME= tblMetadata.getString("TABLE_NAME");
      String COLUMN_NAME= tblMetadata.getString("COLUMN_NAME");
      int DATA_TYPE= tblMetadata.getInt("DATA_TYPE");
      def v1 = 0
      def vline = 0

     if (DATA_TYPE==java.sql.Types.BIGINT    || DATA_TYPE==java.sql.Types.DECIMAL ||
         DATA_TYPE==java.sql.Types.DOUBLE || DATA_TYPE==java.sql.Types.FLOAT      ||
         DATA_TYPE==java.sql.Types.INTEGER || DATA_TYPE==java.sql.Types.NUMERIC)
     {
      def sqlcount = "SELECT COUNT(*)  as v1 FROM "+TABLE_SCHEM+"."+TABLE_NAME+" WHERE "+COLUMN_NAME+"="+ ss +" "
      try{
       informix .query(sqlcount )
        { ResultSet rscount ->
              while(rscount .next())
                    v1 = rscount .getInt('v1')
        }
      }catch(SQLException e){
         e.printStackTrace();
      }finally{
      }
    }
     if (DATA_TYPE==java.sql.Types.VARCHAR || DATA_TYPE==java.sql.Types.CHAR ||
         DATA_TYPE==java.sql.Types.NVARCHAR || DATA_TYPE==java.sql.Types.NCHAR  )
     {
      def sqlcount = "SELECT COUNT(*)  as v1 FROM "+TABLE_SCHEM+"."+TABLE_NAME+" WHERE "+COLUMN_NAME+" LIKE '%"+ ss +"%' "
      try{
       informix .query(sqlcount )
       { ResultSet rscount ->
              while(rscount .next())
                    v1 = rscount .getInt('v1')
        }
    }catch(SQLException e){
      e.printStackTrace();
    }finally{
   }

        if (v1 > 0){
                 String vsql =  sqlcount + "  ::  " + v1
                  vline = vline  + 10
                 int id = 0
                 String uu = null
     // select * from adempiere.ad_sequence where name like 'H_Search' --1000353
     postsql.query("select adempiere.nextid(1000353, 'N') as id , adempiere.generate_uuid() as uu ")
     { ResultSet rsuu -> if (rsuu.next()){
                 id = rsuu.getInt('id')
                 uu = rsuu.getString('uu')  }
  }

       ptable.add(
       ad_client_id:client, ad_org_id:org,  isactive: 'Y', createdby:uid,  updatedby:uid,
       h_search_id:A_Record_ID,
       h_searchline_id:id, h_searchline_uu:uu,
       line:vline,
       value:ss,
       name:ss,
       description:" [OPD] "+TABLE_SCHEM+"."+TABLE_NAME+"."+COLUMN_NAME+ "  找到:"+v1+"筆 : "
       )
                println  vsql  + "\t"
        }// if (v1 > 0){
        }// if (DATA_TYPE
   } // while(tblMetadata.next())
} // while(rs.next())
def t_end = System.currentTimeMillis()
result="執行完成: " + (t_end - t_start)

2014年11月8日 星期六

剛剛編譯最新 iDempiere 3.0 成功訊息

[start org.adempiere.base:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.adempiere.base:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.adempiere.server:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.adempiere.server:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.adempiere.replication:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.adempiere.replication:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.adempiere.replication.server:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.adempiere.replication.server:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.adempiere.ui:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.adempiere.ui:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.zkoss.zk.library:osgi.bundle$7.0.3.qualifier#eclipse.build]
[end org.zkoss.zk.library:osgi.bundle$7.0.3.qualifier#eclipse.build]
[start org.adempiere.ui.zk:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.adempiere.ui.zk:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.adempiere.report.jasper.webapp:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.adempiere.report.jasper.webapp:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.adempiere.webstore:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.adempiere.webstore:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.adempiere.webstore.resource:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.adempiere.webstore.resource:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.adempiere.webstore.servlet:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.adempiere.webstore.servlet:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.idempiere.felix.webconsole:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.idempiere.felix.webconsole:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.adempiere.report.jasper.library:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.adempiere.report.jasper.library:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.adempiere.report.jasper:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.adempiere.report.jasper:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.w3c.dom.fragment:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.w3c.dom.fragment:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.adempiere.pipo:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.adempiere.pipo:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.adempiere.pipo.handlers:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.adempiere.pipo.handlers:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.adempiere.plugin.utils:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.adempiere.plugin.utils:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.idempiere.hazelcast.service:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.idempiere.hazelcast.service:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.idempiere.hazelcast.service.config:osgi.bundle$3.0.0#eclipse.build]
[end org.idempiere.hazelcast.service.config:osgi.bundle$3.0.0#eclipse.build]
[start org.adempiere.install:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.adempiere.install:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.compiere.db.oracle.provider:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.compiere.db.oracle.provider:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.compiere.db.postgresql.provider:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.compiere.db.postgresql.provider:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.adempiere.payment.processor:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.adempiere.payment.processor:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.adempiere.base.callout:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.adempiere.base.callout:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.adempiere.base.process:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.adempiere.base.process:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.adempiere.extend:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.adempiere.extend:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.apache.ecs:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.apache.ecs:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.adempiere.eclipse.equinox.http.servlet:osgi.bundle$1.1.0.v20100503#eclipse.build]
[end org.adempiere.eclipse.equinox.http.servlet:osgi.bundle$1.1.0.v20100503#eclipse.build]
[start org.adempiere.eclipse.equinox.http.servletbridge:osgi.bundle$1.0.200.v20100503#eclipse.build]
[end org.adempiere.eclipse.equinox.http.servletbridge:osgi.bundle$1.0.200.v20100503#eclipse.build]
[start org.adempiere.eclipse.equinox.servletbridge:osgi.bundle$1.2.0.v20100503#eclipse.build]
[end org.adempiere.eclipse.equinox.servletbridge:osgi.bundle$1.2.0.v20100503#eclipse.build]
[start org.idempiere.webservices:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.idempiere.webservices:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.idempiere.fitnesse.fixture:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.idempiere.fitnesse.fixture:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.idempiere.fitnesse.server:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.idempiere.fitnesse.server:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.idempiere.ui.zk.selenium:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.idempiere.ui.zk.selenium:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.idempiere.fitrecorder:osgi.bundle$3.0.0.qualifier#eclipse.build]
[end org.idempiere.fitrecorder:osgi.bundle$3.0.0.qualifier#eclipse.build]
[start org.adempiere.replication.server:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.adempiere.replication.server:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.adempiere.ui.zk:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.adempiere.ui.zk:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.zkoss.zk.library:osgi.bundle$7.0.3.qualifier#source.bundle.jar]
[end org.zkoss.zk.library:osgi.bundle$7.0.3.qualifier#source.bundle.jar]
[start org.adempiere.webstore:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.adempiere.webstore:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.adempiere.webstore.resource:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.adempiere.webstore.resource:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.adempiere.webstore.servlet:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.adempiere.webstore.servlet:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.idempiere.felix.webconsole:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.idempiere.felix.webconsole:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.adempiere.report.jasper:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.adempiere.report.jasper:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.w3c.dom.fragment:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.w3c.dom.fragment:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.adempiere.pipo:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.adempiere.pipo:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.adempiere.pipo.handlers:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.adempiere.pipo.handlers:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.adempiere.plugin.utils:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.adempiere.plugin.utils:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.idempiere.hazelcast.service:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.idempiere.hazelcast.service:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.idempiere.hazelcast.service.config:osgi.bundle$3.0.0#source.bundle.jar]
[end org.idempiere.hazelcast.service.config:osgi.bundle$3.0.0#source.bundle.jar]
[start org.compiere.db.oracle.provider:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.compiere.db.oracle.provider:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.compiere.db.postgresql.provider:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.compiere.db.postgresql.provider:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.adempiere.payment.processor:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.adempiere.payment.processor:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.adempiere.replication:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.adempiere.replication:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.adempiere.base:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.adempiere.base:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.adempiere.base.callout:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.adempiere.base.callout:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.adempiere.base.process:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.adempiere.base.process:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.adempiere.extend:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.adempiere.extend:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.adempiere.ui:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.adempiere.ui:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.apache.ecs:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.apache.ecs:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.adempiere.install:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.adempiere.install:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.adempiere.report.jasper.webapp:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.adempiere.report.jasper.webapp:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.adempiere.server:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.adempiere.server:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.adempiere.eclipse.equinox.http.servlet:osgi.bundle$1.1.0.v20100503#source.bundle.jar]
[end org.adempiere.eclipse.equinox.http.servlet:osgi.bundle$1.1.0.v20100503#source.bundle.jar]
[start org.adempiere.eclipse.equinox.http.servletbridge:osgi.bundle$1.0.200.v20100503#source.bundle.jar]
[end org.adempiere.eclipse.equinox.http.servletbridge:osgi.bundle$1.0.200.v20100503#source.bundle.jar]
[start org.adempiere.eclipse.equinox.servletbridge:osgi.bundle$1.2.0.v20100503#source.bundle.jar]
[end org.adempiere.eclipse.equinox.servletbridge:osgi.bundle$1.2.0.v20100503#source.bundle.jar]
[start org.idempiere.webservices:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[end org.idempiere.webservices:osgi.bundle$3.0.0.qualifier#source.bundle.jar]
[start org.slf4j.jdk14:osgi.bundle$1.7.2.qualifier#source.bundle.jar]
[end org.slf4j.jdk14:osgi.bundle$1.7.2.qualifier#source.bundle.jar]
[start org.adempiere.server:eclipse.feature$3.0.0.qualifier#create.product]
[ant] C:\eclipse-standard-kepler-SR2-win32-x86_64\eclipse\plugins\org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
[ant] file:/C:/Users/Albert/buckminster.output/org.adempiere.server_3.0.0-eclipse.feature/site.p2/
[ant] C:\Users\Albert\buckminster.output\org.adempiere.server_3.0.0-eclipse.feature\idempiere.win32.win32.x86_64
[end org.adempiere.server:eclipse.feature$3.0.0.qualifier#create.product]
[start org.adempiere.server:eclipse.feature$3.0.0.qualifier#create.product.zip]
[end org.adempiere.server:eclipse.feature$3.0.0.qualifier#create.product.zip]

剛剛編譯最新 iDempiere 3.0 這些都沒在 lib 裡面要自己抓下來




commits...@bitbucket.org
10月16日
1 new commit in iDempiere:

https://bitbucket.org/idempiere/idempiere/commits/faaca50ff715/
Changeset:   faaca50ff715
Branch:      zk7
User:        hengsin
Date:        2014-10-16 03:44:36+00:00
Summary:     IDEMPIERE-2245 Platform Upgrade for r3. Increase max retries to 5 to reduce possibilities of materialization aborted with read timeout exception.
Affected #:  2 files

diff -r 2c72b16aea429b12301d7297674b6a27dfd485a3 -r faaca50ff71573f4a763dc7d76bbdf36f429beba org.zkoss.zk.library/copyjars.xml
--- a/org.zkoss.zk.library/copyjars.xml
+++ b/org.zkoss.zk.library/copyjars.xml
@@ -1,19 +1,19 @@
 <project name="zklibrary" basedir=".." default="copy"><target name="copy">
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zk/zk/7.0.3/zk-7.0.3.jar" dest="lib" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zk/zul/7.0.3/zul-7.0.3.jar" dest="lib" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zk/zhtml/7.0.3/zhtml-7.0.3.jar" dest="lib" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zk/zkplus/7.0.3/zkplus-7.0.3.jar" dest="lib" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zk/zkbind/7.0.3/zkbind-7.0.3.jar" dest="lib" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/common/zcommon/7.0.3/zcommon-7.0.3.jar" dest="lib" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/common/zel/7.0.3/zel-7.0.3.jar" dest="lib" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/common/zweb/7.0.3/zweb-7.0.3.jar" dest="lib" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zkforge/ckez/4.3.3.0/ckez-4.3.3.0.jar" dest="lib" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zkforge/gmapsz/3.0.3/gmapsz-3.0.3.jar" dest="lib" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zkforge/timelinez/2.3.1_50/timelinez-2.3.1_50.jar" dest="lib" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zkforge/timeplotz/1.1_50/timeplotz-1.1_50.jar" dest="lib" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/calendar/calendar/2.1.4/calendar-2.1.4.jar" dest="lib" usetimestamp="true"/>
-              <get src="http://repo1.maven.org/maven2/org/python/jython/2.5.3/jython-2.5.3.jar" dest="lib" usetimestamp="true"/>
-              <get src="http://repo1.maven.org/maven2/org/jruby/jruby-complete/1.7.15/jruby-complete-1.7.15.jar" dest="lib" usetimestamp="true"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zk/zk/7.0.3/zk-7.0.3.jar" dest="lib" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zk/zul/7.0.3/zul-7.0.3.jar" dest="lib" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zk/zhtml/7.0.3/zhtml-7.0.3.jar" dest="lib" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zk/zkplus/7.0.3/zkplus-7.0.3.jar" dest="lib" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zk/zkbind/7.0.3/zkbind-7.0.3.jar" dest="lib" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/common/zcommon/7.0.3/zcommon-7.0.3.jar" dest="lib" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/common/zel/7.0.3/zel-7.0.3.jar" dest="lib" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/common/zweb/7.0.3/zweb-7.0.3.jar" dest="lib" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zkforge/ckez/4.3.3.0/ckez-4.3.3.0.jar" dest="lib" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zkforge/gmapsz/3.0.3/gmapsz-3.0.3.jar" dest="lib" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zkforge/timelinez/2.3.1_50/timelinez-2.3.1_50.jar" dest="lib" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zkforge/timeplotz/1.1_50/timeplotz-1.1_50.jar" dest="lib" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/calendar/calendar/2.1.4/calendar-2.1.4.jar" dest="lib" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://repo1.maven.org/maven2/org/python/jython/2.5.3/jython-2.5.3.jar" dest="lib" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://repo1.maven.org/maven2/org/jruby/jruby-complete/1.7.15/jruby-complete-1.7.15.jar" dest="lib" usetimestamp="true" verbose="true" retries="5"/></target></project>

diff -r 2c72b16aea429b12301d7297674b6a27dfd485a3 -r faaca50ff71573f4a763dc7d76bbdf36f429beba org.zkoss.zk.library/copysources.xml
--- a/org.zkoss.zk.library/copysources.xml
+++ b/org.zkoss.zk.library/copysources.xml
@@ -1,19 +1,19 @@
 <project name="zklibrary" basedir=".." default="copy"><target name="copy">
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zk/zk/7.0.3/zk-7.0.3-sources.jar" dest="lib/src" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zk/zul/7.0.3/zul-7.0.3-sources.jar" dest="lib/src" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zk/zhtml/7.0.3/zhtml-7.0.3-sources.jar" dest="lib/src" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zk/zkplus/7.0.3/zkplus-7.0.3-sources.jar" dest="lib/src" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zk/zkbind/7.0.3/zkbind-7.0.3-sources.jar" dest="lib/src" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/common/zcommon/7.0.3/zcommon-7.0.3-sources.jar" dest="lib/src" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/common/zel/7.0.3/zel-7.0.3-sources.jar" dest="lib/src" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/common/zweb/7.0.3/zweb-7.0.3-sources.jar" dest="lib/src" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zkforge/ckez/4.3.3.0/ckez-4.3.3.0-sources.jar" dest="lib/src" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zkforge/gmapsz/3.0.3/gmapsz-3.0.3-sources.jar" dest="lib/src" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zkforge/timelinez/2.3.1_50/timelinez-2.3.1_50-sources.jar" dest="lib/src" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zkforge/timeplotz/1.1_50/timeplotz-1.1_50-sources.jar" dest="lib/src" usetimestamp="true"/>
-              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/calendar/calendar/2.1.4/calendar-2.1.4-sources.jar" dest="lib/src" usetimestamp="true"/>
-              <get src="http://repo1.maven.org/maven2/org/python/jython/2.5.3/jython-2.5.3-sources.jar" dest="lib/src" usetimestamp="true"/>
-              <get src="http://repo1.maven.org/maven2/org/jruby/jruby-complete/1.7.15/jruby-complete-1.7.15-sources.jar" dest="lib/src" usetimestamp="true"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zk/zk/7.0.3/zk-7.0.3-sources.jar" dest="lib/src" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zk/zul/7.0.3/zul-7.0.3-sources.jar" dest="lib/src" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zk/zhtml/7.0.3/zhtml-7.0.3-sources.jar" dest="lib/src" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zk/zkplus/7.0.3/zkplus-7.0.3-sources.jar" dest="lib/src" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zk/zkbind/7.0.3/zkbind-7.0.3-sources.jar" dest="lib/src" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/common/zcommon/7.0.3/zcommon-7.0.3-sources.jar" dest="lib/src" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/common/zel/7.0.3/zel-7.0.3-sources.jar" dest="lib/src" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/common/zweb/7.0.3/zweb-7.0.3-sources.jar" dest="lib/src" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zkforge/ckez/4.3.3.0/ckez-4.3.3.0-sources.jar" dest="lib/src" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zkforge/gmapsz/3.0.3/gmapsz-3.0.3-sources.jar" dest="lib/src" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zkforge/timelinez/2.3.1_50/timelinez-2.3.1_50-sources.jar" dest="lib/src" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/zkforge/timeplotz/1.1_50/timeplotz-1.1_50-sources.jar" dest="lib/src" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://mavensync.zkoss.org/maven2/org/zkoss/calendar/calendar/2.1.4/calendar-2.1.4-sources.jar" dest="lib/src" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://repo1.maven.org/maven2/org/python/jython/2.5.3/jython-2.5.3-sources.jar" dest="lib/src" usetimestamp="true" verbose="true" retries="5"/>
+              <get src="http://repo1.maven.org/maven2/org/jruby/jruby-complete/1.7.15/jruby-complete-1.7.15-sources.jar" dest="lib/src" usetimestamp="true" verbose="true" retries="5"/></target></project>

Repository URL: https://bitbucket.org/idempiere/idempiere/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.

2014年11月2日 星期日

IDempiere Function: adempiere."內外銷出口成品折合原料彙總表_p"(numeric)

-- Function: adempiere."內外銷出口成品折合原料彙總表_p"(numeric)

-- DROP FUNCTION adempiere."內外銷出口成品折合原料彙總表_p"(numeric);

CREATE OR REPLACE FUNCTION adempiere."內外銷出口成品折合原料彙總表_p"(p_instance numeric)
  RETURNS SETOF adempiere."內外銷出口成品折合原料彙總表" AS
$BODY$ 
/*
科學工業園區  xx科技股份有限公司
xxx年度內外銷出口成品折合原料彙總表
期間:xxx/xx/xx~xxx/xx/xx
原料料號  , 原料名稱/規格/型號 , 單位 , 清冊編號 , 成品料號 , 成品名稱/規格/型號 , 單位 , 成品折合數量 , 使用量 , 原料使用量
CURRENT_LANG =  en_US , zh_CN , zh_TW
set search_path=adempiere
select * from adempiere.內外銷出口成品折合原料彙總表_p(1000000);
"程式失敗::值對型別 character varying(20) 而言太長 ,SQLSTATE=22001 ,v_message=開始讀取::BOM"
select * from adempiere.ad_pinstance where ad_pinstance_id=1000000
select * from adempiere.ad_pinstance_para where ad_pinstance_id = 1000000
DROP table adempiere.tg_sk_fgjh_t1 CASCADE
SELECT * FROM adempiere.tg_sk_fgjh_i1(1000000)
SELECT * FROM adempiere.tg_fgtransaction
SELECT * FROM adempiere.tg_rmtransaction
*/
DECLARE

   p RECORD;
   q RECORD;
   r RECORD;
   v_message              VARCHAR (2000);
   ResultStr              VARCHAR (2000);
  
   p_Record_ID            NUMERIC(10)   := null;
   p_AD_User_ID           NUMERIC(10)   := null;
   p_AD_Process_ID        NUMERIC(10)   := null;
   p_AD_Client_ID         NUMERIC(10)   := null;
   p_AD_Org_ID            NUMERIC(10)   := null;
   p_DocDate              DATE;
   p_DocDateTo            DATE;
   p_DocumentNo           VARCHAR (200); --起迄
   p_DocumentNoTo         VARCHAR (200);
   p_DateOrdered          DATE;          --起迄
   p_DateOrderedTo        DATE;
   p_M_Product_ID         NUMERIC(10)   := 0; --起迄
   p_M_ProductTo_ID       NUMERIC(10)   := 0;
   p_C_BPartner_ID        NUMERIC(10)   := 0; --起迄
   p_C_BPartnerTo_ID      NUMERIC(10)   := 0;
   p_SK_NO                VARCHAR (40); --起迄
   p_SK_NOTo              VARCHAR (40); --起迄
   p_M_Product_Value      VARCHAR (40); --起迄
   p_M_ProductEnd_Value   VARCHAR (40);
   p_C_BPartner_Value     VARCHAR (40); --起迄
   p_C_BPartnerEnd_Value  VARCHAR (40);
   p_instance_id          NUMERIC (10)   := 0;
   o_nextid               NUMERIC (10)   := 0;
   o_headid               NUMERIC (10)   := 0;
   v_sk_no                VARCHAR (40);
   v_BOP                  NUMERIC (10,4)   := 0;
   v_AOP                  NUMERIC (10,4)   := 0;
   v_OOP                  NUMERIC (10,4)   := 0;
   v_QtyCount             NUMERIC (10,4)   := 0;
   v_In_Qty               NUMERIC (10,4)   := 0;
   v_Out_Qty              NUMERIC (10,4)   := 0;
   v_SK_NowQty            NUMERIC (10,4)   := 0;
   v_SK_AfterQty          NUMERIC (10,4)   := 0;
   v_ID                   NUMERIC (10,0)   := 0;
   v_UU                   VARCHAR (36)     := 0;
   v_H_ID                 NUMERIC (10,0)   := 0;
   v_H_UU                 NUMERIC (10,0)   := 0;
BEGIN
   IF p_instance is null THEN
      p_instance_id:=0;
   ELSE
      p_instance_id:=p_instance;
   END IF;
   v_message :='程式開始..';

   IF p_instance_id > 0 THEN
      BEGIN
         ResultStr := 'p_instanceNotFound';
         UPDATE adempiere.ad_pinstance
            SET updated      = NOW(),
                isprocessing = 'Y',
                result       = 0,
                errormsg     = ResultStr
          WHERE ad_pinstance_id = p_instance_id;
      EXCEPTION
           WHEN OTHERS THEN NULL;
      END;
   END IF;

   FOR p IN (
       SELECT i.ad_pinstance_id, i.ad_process_id,
              i.record_id,       i.ad_user_id,
              i.ad_client_id,    i.ad_org_id,
              pp.seqno,          pp.parametername,
              pp.p_string,       pp.p_string_to,
              pp.p_number,       pp.p_number_to,
              pp.p_date,         pp.p_date_to,
              pp.info,           pp.info_to
         FROM adempiere.ad_pinstance i
   INNER JOIN adempiere.ad_pinstance_para pp ON pp.ad_pinstance_id=i.ad_pinstance_id
        WHERE i.ad_pinstance_id=p_instance_id
     ORDER BY pp.seqno
   ) LOOP
      v_message := '讀取傳遞參數表';
      p_Record_ID    :=p.record_id;
      p_AD_Process_ID:=p.ad_process_id;
      p_AD_User_ID   :=p.ad_user_id;
      p_AD_Client_ID :=p.ad_client_id;  
      p_AD_Org_ID    :=p.ad_org_id;
      IF p.parametername = 'DocDate' THEN
         p_DocDate   :=p.p_date;
         p_DocDateTo :=p.p_date_to;
      ELSE IF p.parametername = 'SK_NO' THEN
         p_SK_NO   :=p.p_string;
         p_SK_NOTo :=p.p_string_to;
      END IF;
      END IF;
   END LOOP;

   IF COALESCE(p_instance,1000000) = 1000000 THEN --OR p_Record_ID = 0 THEN
      p_DocDate   := '2014.01.01'::DATE;
      p_DocDateTo := date_trunc('month',p_DocDate)+'12month'::interval-'1day'::interval;
      FOR r IN (
          SELECT x.vcount , x.sk_no
            FROM (SELECT COUNT(*) AS vcount,
                         f.sd_skno AS sk_no
                       --f.sp_date,f.doc_no,f.name,f.value,f.exp_qty,f.bomname,f.bomvalue,f.documentno,f.version,f.sk_bom_id,f.bomqty,f.effectivedate,f.expireddate
                    FROM adempiere.sk_bom_fg f
                GROUP BY f.sd_skno

              /*  SELECT COUNT(*) AS vcount , b.Value AS sk_no
                    FROM adempiere.TG_FGTransaction a
              INNER JOIN adempiere.M_Product b ON a.M_Product_ID = b.M_Product_ID
                   WHERE a.MovementDate BETWEEN p_DocDate AND p_DocDateTo
                GROUP BY b.Value */
                  ) x
           ORDER BY vcount DESC LIMIT 1
      ) LOOP
      --   v_message := '如果沒資料抓一筆來測試';
      --   p_Record_ID := r.sk_fgjh_id;
           p_SK_NO     := r.sk_no;
           p_SK_NOTo   := r.sk_no;
      END LOOP;
      v_message := 'p_DocDate:'||p_DocDate||'<->'||p_DocDateTo||' ,p_SK_NO:'||p_SK_NO;
      RAISE NOTICE '%', v_message;
      p_DocDate   := '2014.01.01'::DATE;
      p_DocDateTo := date_trunc('month',p_DocDate)+'12month'::interval-'1day'::interval;
      --p_SK_NO   := '2Z-F8050-B070-1';
      --p_SK_NOTo := '2Z-F8050-B070-1';
   END IF;
  
   IF p_DocDateTo IS NULL AND p_DocDate IS NOT NULL THEN
      p_DocDateTo := p_DocDate;
   END IF;
   IF p_SK_NOTo IS NULL AND p_SK_NO IS NOT NULL THEN
      p_SK_NOTo := p_SK_NO;
   END IF;
  
   -- 1) TABLE
   -- alter table adempiere.tg_sk_fgjh_t1 add docdateto date
  
   --DELETE FROM adempiere.tg_sk_fgjh_t1 WHERE ad_pinstance_id = p_instance;
   --DELETE FROM adempiere.SK_FGJL       WHERE (date_trunc('day',DocDate)   >= date_trunc('day',p_DocDate) AND
   --                                           date_trunc('day',DocDate)   <= date_trunc('day',p_DocDateTo))
   --                                      AND (TRIM(SK_NO) BETWEEN TRIM(p_SK_NO) AND TRIM(p_SK_NOTo));
   -- 2)  INSERT INOT TABLE SELECT
   -- 一成品個料號只取一次
      FOR r IN (
   --  SELECT sum(x.exp_qty) as exp_qty,x.sd_skno,x.value,x.name,x.effectivedate,x.version,x.sk_bom_id FROM (
       SELECT
   --  ad_pinstance_id  -- numeric(10,0) NOT NULL,
       f.sp_date,       -- date,
       f.doc_no,        -- character varying(40),
       f.sd_skno,       -- character varying(40),
       f.name,          -- character varying(40),
       f.value,         -- character varying(40),
       f.exp_qty,       -- numeric(14,4),
       f.bomname,       -- character varying(40),
       f.bomvalue,      -- character varying(40),
       f.documentno,    -- character varying(40),
       f.version,
       f.sk_bom_id,     -- numeric(10,0),
       f.bomqty,        -- numeric(14,4),
       f.effectivedate, -- date,
       f.expireddate    -- date,
       FROM adempiere.sk_bom_fg f
      WHERE 1=1 
       -- AND f.sp_date BETWEEN p_DocDate AND p_DocDateTo
       -- AND f.sd_skno BETWEEN p_SK_NO AND p_SK_NOTo
        AND f.isactive = 'Y'
   ORDER BY f.bomvalue,f.sp_date,f.sd_skno --用料料號, 銷售日期
     -- ) x GROUP BY x.sd_skno,x.value,x.name,x.effectivedate,x.version,x.sk_bom_id
     --     ORDER BY x.sd_skno,x.value,x.name,x.effectivedate,x.version,x.sk_bom_id
   )LOOP
       v_message :='開始讀取::BOM';
       SELECT adempiere.nextid(1000195, 'N') INTO v_ID;
       SELECT adempiere.generate_uuid()      INTO v_UU;
       INSERT INTO adempiere."內外銷出口成品折合原料彙總表"(
       AD_Pinstance_ID                  ,-- numeric(10,0),
       "內外銷出口成品折合原料彙總表_ID",-- numeric(10,0),
       "內外銷出口成品折合原料彙總表_UU",-- varchar(36),
       "原料料號", "原料名稱/規格/型號", "原料單位",
       "清冊編號",
       "成品料號", "成品名稱/規格/型號", "成品單位",
       "成品折合數量"                   ,-- numeric(10,2),
       "使用量"                         ,-- numeric(10,4),
       "原料使用量"                     ,-- numeric(10,2)
       AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy
       )VALUES(p_instance,v_ID,v_UU,
       r.value,  r.name,'',
       r.documentno||r.doc_no,
       r.bomValue,r.bomName,'',
       r.exp_qty,r.exp_qty,r.bomqty,
       p_AD_Client_ID,p_AD_Org_ID,'Y',NOW(),p_AD_User_ID,NOW(),p_AD_User_ID);
   --RAISE NOTICE '用料: % ,銷售日期 % ,成品: %', r.bomvalue,r.sp_date,r.sd_skno;
   END LOOP;
   /*
 --SELECT * FROM adempiere.AD_Sequence WHERE Name='SK_BOM_FGHead'--1000195<<請修正>>
   SELECT adempiere.nextid(1000195, 'N') INTO v_H_ID;
   SELECT adempiere.generate_uuid()      INTO v_H_UU;
   INSERT INTO SK_BOM_FGHead(
   SK_BOM_FGHead_ID  ,--numeric(10,0) NOT NULL,
   SK_BOM_FGHead_UU  ,--character varying(36),
   AD_PInstance_ID   ,--numeric(10,0) NOT NULL,
   DocDate           ,--date,
   DocDateTo         ,--date,
   SP_Date           ,--date,
   Doc_No            ,--character varying(40),
   SD_SKNo           ,--character varying(40),
   Name              ,--character varying(40),
   Value             ,--character varying(40),
   Exp_Qty           ,--numeric(14,4),
   Version           ,--character varying(40),
   SK_BOM_ID         ,--numeric(10,0),
   EffectiveDate     ,--date,
   ExpiredDate       ,--date,
   AD_Client_ID      ,--numeric(10,0) NOT NULL,
   AD_Org_ID         ,--numeric(10,0) NOT NULL,
   IsActive          ,--character(1) NOT NULL DEFAULT 'Y'::bpchar,
   Created           ,--timestamp without time zone NOT NULL DEFAULT now(),
   CreatedBy         ,--numeric(10,0) NOT NULL,
   Updated           ,--timestamp without time zone NOT NULL DEFAULT now(),
   Updatedby          --numeric(10,0) NOT NULL
   )VALUES(
   SK_BOM_FGHead_ID  ,--numeric(10,0) NOT NULL,
   SK_BOM_FGHead_UU  ,--character varying(36),
   AD_PInstance_ID   ,--numeric(10,0) NOT NULL,
   DocDate           ,--date,
   DocDateTo         ,--date,
   SP_Date           ,--date,
   Doc_No            ,--character varying(40),
   SD_SKNo           ,--character varying(40),
   Name              ,--character varying(40),
   Value             ,--character varying(40),
   Exp_Qty           ,--numeric(14,4),
   Version           ,--character varying(40),
   SK_BOM_ID         ,--numeric(10,0),
   EffectiveDate     ,--date,
   ExpiredDate       ,--date,
   p_AD_Client_ID    ,--AD_Client_ID      ,--numeric(10,0) NOT NULL,
   p_AD_Org_ID       ,--AD_Org_ID         ,--numeric(10,0) NOT NULL,
   'Y'               ,--IsActive          ,--character(1) NOT NULL DEFAULT 'Y'::bpchar,
   NOW()             ,--Created           ,--timestamp without time zone NOT NULL DEFAULT now(),
   p_AD_User_ID      ,--CreatedBy         ,--numeric(10,0) NOT NULL,
   NOW()             ,--Updated           ,--timestamp without time zone NOT NULL DEFAULT now(),
   p_AD_User_ID     );--Updatedby         ,--numeric(10,0) NOT NULL

   INSERT INTO adempiere.SK_BOM_FG(
   SK_BOM_FGHead_ID ,--numeric(10,0) NOT NULL,
   AD_PInstance_ID  ,--numeric(10,0) NOT NULL,
   DocDate          ,--date,
   DocDateTo        ,--date,
   SK_BOM_FG_ID     ,--numeric(10,0) NOT NULL,
   SK_BOM_FG_UU     ,--character varying(36),
   SP_Date          ,--date,
   Doc_No           ,--character varying(40),
   SD_SKNo          ,--character varying(40),
   Name             ,--character varying(40),
   Value            ,--character varying(40),
   Exp_Qty          ,--numeric(14,4),
   BOMName          ,--character varying(40),
   BOMValue         ,--character varying(40),
   DocumentNo       ,--character varying(40),
   Version          ,--character varying(40),
   SK_BOM_ID        ,--numeric(10,0),
   SK_BOMLine_ID    ,--numeric(10,0),
   BOMQty           ,--numeric(14,4),
   LineName         ,--character varying(40),
   LineValue        ,--character varying(40),
   LineQty          ,--numeric(14,4),
   EffectiveDate    ,--date,
   ExpiredDate      ,--date,
   SK_BOMAlternative_ID ,--numeric(10,0),
   AlternativeName  ,--character varying(40),
   AD_Client_ID     ,--numeric(10,0) NOT NULL,
   AD_Org_idID      ,--numeric(10,0) NOT NULL,
   IsActive         ,--character(1) NOT NULL DEFAULT 'Y'::bpchar,
   Created          ,--timestamp without time zone NOT NULL DEFAULT now(),
   CreatedBy        ,--numeric(10,0) NOT NULL,
   Updated          ,--timestamp without time zone NOT NULL DEFAULT now(),
   UpdatedBy         --numeric(10,0) NOT NULL
   )VALUES(
   v_H_ID           ,--SK_BOM_FGHead_ID ,--numeric(10,0) NOT NULL,
   v_ID             ,--SK_BOM_FG_ID     ,--numeric(10,0) NOT NULL,
   v_UU             ,--SK_BOM_FG_UU     ,--character varying(36),
   pinstance_id     ,--AD_PInstance_ID  ,--numeric(10,0) NOT NULL,
   DocDate          ,--date,
   DocDateTo        ,--date,
   SP_Date          ,--date,
   Doc_No           ,--character varying(40),
   SD_SKNo          ,--character varying(40),
   Name             ,--character varying(40),
   Value            ,--character varying(40),
   Exp_Qty          ,--numeric(14,4),
   BOMName          ,--character varying(40),
   BOMValue         ,--character varying(40),
   DocumentNo       ,--character varying(40),
   Version          ,--character varying(40),
   SK_BOM_ID        ,--numeric(10,0),
   SK_BOMLine_ID    ,--numeric(10,0),
   BOMQty           ,--numeric(14,4),
   LineName         ,--character varying(40),
   LineValue        ,--character varying(40),
   LineQty          ,--numeric(14,4),
   EffectiveDate    ,--date,
   ExpiredDate      ,--date,
   SK_BOMAlternative_ID ,--numeric(10,0),
   AlternativeName  ,--character varying(40),
   p_AD_Client_ID    ,--AD_Client_ID      ,--numeric(10,0) NOT NULL,
   p_AD_Org_ID       ,--AD_Org_ID         ,--numeric(10,0) NOT NULL,
   'Y'               ,--IsActive          ,--character(1) NOT NULL DEFAULT 'Y'::bpchar,
   NOW()             ,--Created           ,--timestamp without time zone NOT NULL DEFAULT now(),
   p_AD_User_ID      ,--CreatedBy         ,--numeric(10,0) NOT NULL,
   NOW()             ,--Updated           ,--timestamp without time zone NOT NULL DEFAULT now(),
   p_AD_User_ID     );--Updatedby         ,--numeric(10,0) NOT NULL
SELECT * FROM adempiere.sk_bom_fg
DROP TABLE  adempiere."內外銷出口成品折合原料彙總表"
CREATE TABLE adempiere."內外銷出口成品折合原料彙總表"(
AD_Pinstance_ID                   numeric(10,0),
"內外銷出口成品折合原料彙總表_ID" numeric(10,0),
"內外銷出口成品折合原料彙總表_UU" varchar(36),
"原料料號"                        varchar(40),  
"原料名稱/規格/型號"              varchar(80), 
"原料單位"                        varchar(10),
"清冊編號"                        varchar(40),
"成品料號"                        varchar(40),
"成品名稱/規格/型號"              varchar(40),
"成品單位"                        varchar(10),
"成品折合數量"                    numeric(10,2),
"使用量"                          numeric(10,4),
"原料使用量"                      numeric(10,2),
  ad_client_id numeric(10,0),
  ad_org_id numeric(10,0),
  isactive character(1) NOT NULL DEFAULT 'Y'::bpchar,
  created timestamp without time zone NOT NULL DEFAULT now(),
  createdby numeric(10,0),
  updated timestamp without time zone NOT NULL DEFAULT now(),
  updatedby numeric(10,0) NOT NULL
)
*/


   v_message :='程式完成::'||' p_instance='||p_instance||' ,p_Record_ID='||p_Record_ID
   ||' ,p_DocDate='||p_DocDate||' - '||p_DocDateTo||' ,p_SK_NO='||p_SK_NO||' - '||p_SK_NOTo;

   IF p_instance_id > 0 THEN
     BEGIN
        UPDATE adempiere.ad_pinstance
           SET updated         = NOW(),
               isprocessing    = 'N',
               result          = 1,
               errormsg        = v_message
         WHERE ad_pinstance_id = p_instance_id;
     EXCEPTION
          WHEN OTHERS THEN NULL;
     END;
   END IF;

  -- 3) RETURN
  RETURN QUERY SELECT *
             FROM adempiere.內外銷出口成品折合原料彙總表
            WHERE ad_pinstance_id = p_instance;


   --raise notice 'Yo this is good! --> % %', SQLERRM, SQLSTATE;
EXCEPTION WHEN OTHERS THEN
   v_message :='程式失敗::'||SQLERRM||' ,SQLSTATE='||SQLSTATE||' ,v_message='||v_message;
   IF p_instance_id > 0 THEN
     BEGIN
        ResultStr := v_message;
        UPDATE adempiere.ad_pinstance
         SET updated      = NOW(),
             isprocessing = 'N',
             result       = 0,
             errormsg     = ResultStr
         WHERE ad_pinstance_id = p_instance_id;
     EXCEPTION
          WHEN OTHERS THEN NULL;
     END;
   END IF;
END;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100
  ROWS 1000;
ALTER FUNCTION adempiere."內外銷出口成品折合原料彙總表_p"(numeric)
  OWNER TO adempiere;