groovy:getShipSchedulerBackup
程序
======================
import groovy.sql.Sql
import java.sql.Timestamp
import org.compiere.util.DB
// MSSQL jdbc:sqlserver://" + dbHost + ":" + dbPort + ";databaseName=" + dbName + ";";
mssql =Sql.newInstance('jdbc:sqlserver://192.72.1.42:1433;databaseName=Origin','aaa','111111',
'com.microsoft.sqlserver.jdbc.SQLServerDriver' )
// PostgreSQL
postsql =Sql.newInstance('jdbc:postgresql://127.0.0.1/taya1028','adempiere','adempiere','org.postgresql.Driver' )
def ptable= postsql.dataSet("船期與貨況追蹤上傳")
def isActive='Y'
def H_ID=1000000
def m_created = new Timestamp(System.currentTimeMillis());
def t_start = System.currentTimeMillis()
mssql.eachRow( 'SELECT ShipmentID, InvoiceNo, 客戶單號, 料號, 船公司, 船名, 航次, 貨況追蹤.序號, 貨櫃號碼, 起運港, 結關日, 預定開航日, 實際開航日, 抵達港, 預計抵港日, 實際抵港日, 清關日 FROM 貨況追蹤' )
{
println " ${it.ShipmentID} ${it.InvoiceNo} "
/// postsql.execute('INSERT INTO z_sstock(sk_no, sk_name) VALUES (?,?)', [it.sk_no,it.sk_name])
ptable.add(
PLNo:it.ShipmentID, "客戶單號":it.客戶單號 ,"料號":it.料號,"船公司":it.船公司, "船名":it.船名, "航次":it.航次, // SONo:
"貨櫃號碼":it.貨櫃號碼, "起運港":it.起運港, "結關日":it.結關日, "預定開航日":it.預定開航日, "實際開航日":it.實際開航日,
"抵達港":it.抵達港, "預計抵港日":it.預計抵港日,"實際抵港日":it.實際抵港日,
"清關日":it.清關日
)
}
def t_end = System.currentTimeMillis()
result="執行完成: " + (t_end - t_start)
沒有留言:
張貼留言