2014年6月28日 星期六
iDempiere Oracle HIS SAP 系統轉換 groovy:ReadParadox_PT_INFO
groovy:ReadParadox_PT_INFO
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
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");
paradox= Sql.newInstance( 'jdbc:Paradox:///c:/Chee/His/CBasic?charSet=big5','com.hxtt.sql.paradox.ParadoxDriver')
// sqlinformix = Sql.newInstance( 'jdbc:informix-sqli://192.168.170.211:1534/hisipddb:informixserver=hisipdsrv','informix','db@w94u6', 'com.informix.jdbc.IfxDriver' )
// sqlOracle = Sql.newInstance( 'jdbc:oracle:thin:@192.168.170.251:1521:orcl', 'adempiere','adempiere', 'oracle.jdbc.OracleDriver' )
postsql = Sql.newInstance('jdbc:postgresql://127.0.0.1/ad20140605','adempiere','adempiere','org.postgresql.Driver' )
ptable= postsql.dataSet("h_paradox_pt_info") //上傳
def isActive='Y'
def H_PT_INFO_ID=0
def m_created = new Timestamp(System.currentTimeMillis())
postsql.execute("delete from adempiere.H_Paradox_PT_INFO")
paradox.eachRow( "select CreateClerk,ptName,IDNo,AdrArea, HLAdrCode, AdrAreaDesc,Address, Birthday,Tel,AreaTel,Sex,Native,Mobil from DownToLocalPtinfo")
// where idno like 'U2208%'")
// sqlinformix.eachRow( 'select * from ptinfo order by chartno' )
{ println " $it.ptName"
int tableID = 0;
postsql.query("select ad_sequence_id from adempiere.ad_sequence where name = 'H_Paradox_PT_Info' ")
{ ResultSet rs1-> if (rs1.next()) {
tableID = rs1.getInt('ad_sequence_id')
} }
postsql.query("select adempiere.nextid("+tableID+" , '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_paradox_pt_info_id:id, h_paradox_pt_info_uu:uu,
CreateClerk:it.CreateClerk,
PTName:it.PTName,
IDNo:it.IDNo,
AdrArea:it.AdrArea,
HLAdrCode:it.HLAdrCode,
AdrAreaDesc:it.AdrAreaDesc,
Address:it.Address,
Birthday:it.Birthday,
Tel:it.Tel,
AreaTel:it.AreaTel,
Sex:it.Sex,
Native:it.Native,
Mobil:it.Mobil
)
// postsql.execute('insert into H_PT_INFO('
// +'H_PT_INFO_ID, AD_Client_ID, AD_Org_ID, Updated, UpdatedBy, Created, CreatedBy, IsActive,'
// +'chartno) values (?, 11, 11, SYSDATE, 0, SYSDATE, 0, ?, ?)', [ H_PT_INFO_ID,isActive, it.chartno])
}
result=""
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言