How to introduce speed, housekeeper and user data in his own transfer

zhaozj2021-02-11  154

Unit updatesd3000;

Interface

uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, EditForm, KsControls, KsLabels, KsSkinLabels, dxEditor, dxExEdtr, dxEdLib, dxCntner, KsButtons, KsSkinButtons, KsTabs, KsSkinTabs, KsHooks, KsForms, KsSkinForms, KsEdits , KscomboBoxs, KsskinComboBoxs, DB, IBDATABASE, Registry, Syspublic, IbcustomDataSet, Grids, DBGRIDS, ADODB;

type TfrmUpdateSD3000 = class (TfrmEditForm) PageControl: TSeSkinPageControl; TabSD3000: TKsCustomTabSheet; KsCustomTabSheet2: TKsCustomTabSheet; bbOk: TSeSkinButton; bbNo: TSeSkinButton; OpenDlg: TOpenDialog; edtSDData: TdxButtonEdit; SeSkinLabel1: TSeSkinLabel; SeSkinLabel2: TSeSkinLabel; SeSkinLabel3: TSeSkinLabel; SeSkinLabel4: TSeSkinLabel ; SeSkinLabel5: TSeSkinLabel; edtServeName: TdxEdit; SeSkinLabel6: TSeSkinLabel; SeSkinLabel7: TSeSkinLabel; edtLoginName: TdxEdit; SeSkinLabel8: TSeSkinLabel; edtLoginPass: TdxEdit; bbLinkServer: TSeSkinButton; SeSkinLabel9: TSeSkinLabel; SeSkinLabel10: TSeSkinLabel; SeSkinLabel11: TSeSkinLabel; IBDatabase1: TIBDatabase; IBTransaction1 : TIBTransaction; IBDataSet1: TIBDataSet; AdoDataSet: TADODataSet; KsCustomTabSheet3: TKsCustomTabSheet; SeSkinLabel15: TSeSkinLabel; edtYYData: TdxButtonEdit; SeSkinLabel12: TSeSkinLabel; SeSkinLabel13: TSeSkinLabel; Se SkinLabel14: TSeSkinLabel; SeSkinLabel16: TSeSkinLabel; SQLADOConnet: TADOConnection; SQLDataSet: TADODataSet; cbxSQLDB: TdxPickEdit; procedure edtSDDataButtonClick (Sender: TObject; AbsoluteIndex: Integer); procedure bbNoClick (Sender: TObject); procedure bbOkClick (Sender: TObject); procedure edtYYDataButtonClick (Sender: TObject; AbsoluteIndex: Integer); procedure bbLinkServerClick (Sender: TObject); private {Private declarations} bReturn: Boolean; function GetSD3000Path: string; // get speed up installation directory function GetUFERPPath: string; // get the UF installation Directory Function CONECTGRASP (SDATA: STRING): Boolean; Function CONECTSD3000 (SDBPATH: String): Boolean; Function OpenIBDataSet (SDBNAME: STRING): Boolean;

procedure InputGrasp (sSql1, sSql2, sField1, sField2, sConst: string); procedure InputSD3000 (sSql1, sSql2, sField1, sField2, sConst: string); procedure InputAllSD3000Data; // all speed up data procedure InputAllGraspData; // All data housekeeper procedure InputAllUfSoft80Data ; // all user data procedure mainshow; procedure loadData; public {public declarations} End; function updatesd3000show: boolean; importation

Uses dbdata; {$ r * .dfm}

function UpdateSD3000Show: Boolean; var frmUpdateSD3000: TfrmUpdateSD3000; begin frmUpdateSD3000: = TfrmUpdateSD3000.Create (Application); with frmUpdateSD3000 do begin MainShow; Result: = bReturn; Free; end; end;

Procedure tfrmupdatesd3000.mainshow; begin loading;

function TfrmUpdateSD3000.GetSD3000Path: string; var Reg: TRegistry; begin Result: = ''; Reg: = TRegistry.Create; try Reg.RootKey: = HKEY_LOCAL_MACHINE; if Reg.OpenKey ( '/ Software / SuperData / SD3000 / net', FALSE) THEN RESULT: = reg.readstring ('RemoteDbdir') Finally Reg.Closekey; Reg.Free; end; end;

function TfrmUpdateSD3000.GetUFERPPath: string; var Reg: TRegistry; begin Result: = ''; Reg: = TRegistry.Create; try Reg.RootKey: = HKEY_LOCAL_MACHINE; if Reg.OpenKey ( '/ Software / SuperData / SD3000 / net', FALSE) THEN RESULT: = reg.readstring ('RemoteDbdir') Finally Reg.Closekey; Reg.Free; end; end;

Procedure tfrmupdatesd3000.loaddata; begin pagecontrol.tabindex: = 0; edtsddata.text: = getsd3000path; edtydata.text: = getuferppath; end;

procedure TfrmUpdateSD3000.edtSDDataButtonClick (Sender: TObject; AbsoluteIndex: Integer); var sFileName: string; begin inherited; OpenDlg.FileName: = edtSDData.Text; if OpenDlg.Execute then begin sFileName: = OpenDlg.FileName; edtSDData.Text: = sFileName End; end; function tfrmupdatesd3000.CONECTSD3000 (SDBPATH: STRING): Boolean; Begin Result: = false; if trim (sdbpath) = '' Then Begin Showmsg ('Please enter the database path!'); EXIT; END; if not not FileExists (sDBPath) then begin ShowMsg ( 'database path is incorrect, the system can not find the file specified!'); Exit; end; IBDatabase1.DefaultTransaction: = IBTransaction1; IBDatabase1.DatabaseName: = sDBPath; try IBDatabase1.Open; except end If ibdatabase1.connected the result: = true else showmsg ('connection database error, enter the correct deliver database file!');

function TfrmUpdateSD3000.OpenIBDataSet (sDBName: string): Boolean; begin Result: = True; if IBDataSet1.Active then IBDataSet1.Close; IBDataSet1.SelectSQL.Text: = sDBName; try IBDataSet1.Open; except result: = false; end; end ;

Procedure tfrmupdatesd3000.bbnoclick (sender: TOBJECT); begin inherited;

procedure TfrmUpdateSD3000.bbOkClick (Sender: TObject); begin inherited; if PageControl.TabIndex = 0 then InputAllSD3000Data else if PageControl.TabIndex = 1 then InputAllUfSoft80Data else if PageControl.TabIndex = 2 then InputAllGraspData; end;

Procedure tfrmupdatesd3000.inputallufsoft80Data; Begin Showmsg ('Please select the correct user financial Uferp-m8 "database file!');

procedure TfrmUpdateSD3000.InputAllSD3000Data; var sSql1, sSql2, sField1, sField2, sConst: string; begin if not ConectSD3000 (edtSDData.Text) then Exit; Screen.Cursor: = crHourglass; sSql1: = ''; sSql2: = ''; sField1 : = '; Sfield2: ='; sconst: = ''; // Department ssql1: = 'SELECT * from department "; ssql2: =' select * from baseinfo '; sfield2: =' Mode, Name1 '; sfield1 : = '! Const, name'; sconst: = INTOSTR (base_dept); inputsd3000 (SSQL1, SSQL2, Sfield1, Sfield2, Sconst); // Staff Category SSQL1: = 'SELECT * from Emptype'; ssql2: = 'SELECT * From baseinfo '; sfield2: =' mode, name1 '; sfield1: ='! Const, name '; sconst: = INTOSTR (base_employe_sort); InputSD3000 (SSQL1, SSQL2, Sfield1, Sfield2, Sconst); // Staff SSQL1: = 'Select E. *, S.Name As Department, D.Name As Departmentname, T.Name As Emptypename' 'from Employ E, EMPTYPE T, SEX S, Department D' 'Where E.emptypeId = T.emptyPeid and T. E.EMPTYPTYPEID = T. EMPTYPEID AND E.SEX = S.ID and E.DEPARTMENT = D.ID '; ssql2: =' SELECT * from Employe '; sfield2: =' Usercode, Name, Business , PostalCode, Place, DutyDate, Wage, ID_Card, Address, ' ' Sex, ComeDate, EMail, Learning, PhoneCall, Phone, PhoneMove, Dept, Sort '; sField1: =' EMPCODE, NAME, DUTY, POSTCODE, FOREFATHER, POSTDATE , PAY, IDCARD, ADDRESS, ' ' SEXNAME, BIRTHDAY, EMAIL, CULTURE, BP, TELEPHONE, HOMEPHONE, DEPARTMENTNAME, EMPTYPENAME '; InputSD3000 (sSql1, sSql2, sField1, sField2, sConst); // goods unit sSql1: =' Select * from unit '; ssql2: =' SELECT * from baseinfo '; sfield2: ='

Mode, Name1 '; sfield1: ='! Const, name '; sconst: = INTOSTR (base_ware_unit); inputsd3000 (ssql1, ssql2, sfield1, sfield2, sconst); // Warehouse SSQL1: =' Select * from store '; ssql2 : = 'Select * from depot'; sfield2: = 'usercode, name, address, memo'; sfield1: = 'storeid, name, location, memo'; inputsd3000 (ssql1, ssql2, sfield1, sfield2, sconst); // Category SSQL1: = 'Select * from goodstype'; ssql2: = 'select * from baseinfo'; sfield2: = 'mode, name1, name2'; sfield1: = '! Const, name, description'; sconst: = INTOSTR BASE_WARE_SORT); InputSD3000 (sSql1, sSql2, sField1, sField2, sConst); // goods sSql1: = '. SELECT g *, t.name as GTypeName FROM gOODS g, GOODSTYPE t WHERE g.goodstypeid = t.goodstypeid'; sSql2 : = 'SELECT * FROM Ware'; sField2: = 'UserCode, name, ShortName, Sort, Unit, price1, ConstPrice'; sField1: = 'goodsid, name, name, GTypeName, Unit, sprice, Pprice'; InputSD3000 (sSql1 , ssql2, sfield1, sfield2, sconst); // Region ssql1: = 'select * from area'; ssql2: = 'select * from baseinfo'; sfield2: = ' Mode, name1 '; sfield1: ='! Const, name '; sconst: = INTOSTR (base_area); inputsd3000 (SSQL1, SSQL2, Sfield1, sfield2, sconst); // Customer ssql1: =' SELECT C. *, A. Name as area a on a.areaid = c.areaid '; ssql2: =' select * from unit '; sfield2: =' Mode, Usercode, ShortName, Name, Areaname, Linkman, Phone, Phonemove, Phonefax, Postalcode, ' ' Address, Memo, Banking, Accounts, WWW, Email, Receive '; sfield1: ='

! CONST, ClientID, ShortName, Name, AreaName, CONTATOR, Phone, MOBILEPHONE, Fax, zip, ' ' Address, memo, bank, bankID, URL, EMail, BALANCE '; sConst: = IntToStr (BASE_CLIENT); InputSD3000 (sSql1 , SSQL2, Sfield1, Sfield2, Sconst); // Supplier SSQL1: = 'SELECT C. *, A.NAME AS AREANAM VENDOR C Left Join Area A on A.areAid = C.AreAID'; SSQL2: = 'SELECT * FROM Unit '; sField2: =' Mode, UserCode, ShortName, Name, AreaName, LinkMan, Phone, PhoneMove, PhoneFax, PostalCode, ' ' Address, Memo, Banking, Accounts, WWW, EMail, Payable '; sField1: = '! CONST, VENDORID, ShortName, Name, AreaName, CONTATOR, Phone, mOBILEPHONE, Fax, zip,' 'Address, memo, bank, bankID, URL, EMail, BALANCE'; sConst: = IntToStr (BASE_PROVIDE); InputSD3000 ( SSQL1, SSQL2, Sfield1, Sfield2, Sconst; Showmsg ('Import Data Success!'); Screen.cursor: = Crdefault;

procedure TfrmUpdateSD3000.InputAllGraspData; var sSqlData: string; sSql1, sSql2, sField1, sField2, sConst: string; begin sSql1: = ''; sSql2: = ''; sField1: = ''; sField2: = ''; sConst: = '; If cbxsqldb.itemindex <0 THEN EXIT; SSQLDATA: = cbxsqldb.Items.Strings [cbxsqldb.itemindex]; if ssqldata =' 'Then Begin Showmsg (' Please connect SQL Server Database! '); EXIT; End; IF NOT CONECTGRASP (SSQLDATA) THEN BEGIN SHOWMSG ('connection SQLServer database error, please re-enter the server name, username, password!'); exit; end; screen.cursor: = cr Hourglass; // Warehouse SSQL1: = 'SELECT * FROM Stock where typeid <> '' 00000 ''; ssql2: = 'SELECT * from Depot'; sfield1: = 'Usercode, FullName, Comment'; sfield2: = 'Usercode, Name, Memo'; InputGrasp (SSQL1, SSQL2, Sfield1, sfield2, sconst); // Products SSQL1: = 'Select * from ptype where typeid <>' 00000 '' '; ssql2: =' SELECT * from Ware '; sfield1: =' Usercode, Fullname, Name, Unit1 Preprice2, preprice1 '; sfield2: =' Usercode, Name, ShortName, Unit, Price1, Constprice; InputGrasp (SSQL1, SSQL2, Sfield1, Sfiel D2, SCONST); // Department SSQL1: = 'SELECT * from Department WHERE TYPEID <>' 00000 ''; SSQL2: = 'SELECT * from Baseinfo'; sfield1: = '! const, fullname'; sfield2: = 'Mode, Name1'; sConst: = intToStr (BASE_DEPT); InputGrasp (sSql1, sSql2, sField1, sField2, sConst); // staff sSql1: = 'SELECT D.FullName AS DepName, E. * FROM employee E LEFT OUTER JOIN ' ' Department D on E.DEPARTMENT =

D. Typeid WHERE E.TYPEID <> '00000' '; ssql2: =' SELECT * from Employe '; sfield1: =' Usercode, Fullname, Address, Tel, DepName, Comment '; sfield2: =' Usercode, Name , Address, Phone, DEPT, MEMO '; InputGrasp (SSQL1, SSQL2, Sfield1, Sfield2, Sconst); // Region SSQL1: =' SELECT * AREATYPE WHERE TYPEID <> '00000' ''; ssql2: = 'SELECT * From baseinfo '; sfield1: ='! Const, fullname '; sfield2: =' mode, name1 '; sconst: = INTOSTR (Base_Area); InputGrasp (SSQL1, SSQL2, Sfield1, sfield2, sconst); // Customer ssql1: = 'SELECT A.FULLNAME AS AREANAME, B. * from bType B Left Outer Join Areatype A' 'on b.areatypeId = a.Typeid Where B.TypeId <>' 00000 '' '; ssql2: =' SELECT * FROM Unit '; sField1: ='! CONST, UserCode, Name, FullName, AreaName, PERSON, TELANDADDRESS, FAX, pOSTCODE, AREA, Comment, BANKANDACOUNT, BANKANDACOUNT, ARTotal '; sField2: =' Mode, UserCode, ShortName, Name, Areaname, Linkman, Phone, Phonefax, Postalcode, Address, Memo, Banking, Accounts, Receive '; Sconst: = INTOSTR (Base_Client); InputGrasp (SSQL1, SSQL2, Sfield1, sfield2, sconst; // supplier SSQL1: = 'SELECT A.FULLNAME AS AREANAME, B. * from btype b Left Outer Join Areatype A' 'on B.AreatypeId = a.Typeid Where B.TypeId <> '' 00000 '' '; sSql2: =' SELECT * FROM Unit '; sField1: =' CONST, UserCode, Name, FullName, AreaName, PERSON, TELANDADDRESS, FAX, pOSTCODE, AREA, Comment, BANKANDACOUNT, BANKANDACOUNT, APTotal! ' ; Sfield2: = '

Mode, UserCode, ShortName, Name, AreaName, LinkMan, Phone, PhoneFax, PostalCode, Address, Memo, Banking, Accounts, Payable '; sConst: = intToStr (BASE_PROVIDE); InputGrasp (sSql1, sSql2, sField1, sField2, sConst); ShowMsg ( 'data is successfully imported!'); Screen.Cursor: = crDefault; end; procedure TfrmUpdateSD3000.InputGrasp (sSql1, sSql2, sField1, sField2, sConst: string); begin if OpenDataSetEx (SQLADOConnet, SQLDataSet, sSql1) and OpenDataSet ( Adodataset, SSQL2) THEN DATASETINPUT (SqlDataSet, Adodataset, Sfield1, Sfield2, Sconst);

procedure TfrmUpdateSD3000.InputSD3000 (sSql1, sSql2, sField1, sField2, sConst: string); begin if OpenIBDataSet (sSql1) and OpenDataSet (AdoDataSet, sSql2) then DataSetInput (IBDataSet1, AdoDataSet, sField1, sField2, sConst); end;

procedure TfrmUpdateSD3000.edtYYDataButtonClick (Sender: TObject; AbsoluteIndex: Integer); var sFileName: string; begin inherited; OpenDlg.FileName: = edtYYData.Text; if OpenDlg.Execute then begin sFileName: = OpenDlg.FileName; edtYYData.Text: = sFileName ;

function TfrmUpdateSD3000.ConectGrasp (sData: string): Boolean; var sServer, sName, sPass: string; begin sServer: = edtServeName.Text; sName: = edtLoginName.Text; sPass: = edtLoginPass.Text; if Trim (sServer) = ' 'then sServer: =' LocalHost '; if Trim (sName) =' 'then sName: =' sa '; with SQLADOConnet do begin if Connected = True then Close; ConnectionString: = GetSQLConnectionString (sServer, sData, sName, sPass); LoginPrompt: = false; open (sname, spass); result: = conne;

procedure TfrmUpdateSD3000.bbLinkServerClick (Sender: TObject); var sSql, sName, sTmp: string; begin inherited; sSql: = 'SELECT * FROM sysdatabases WHERE (dbid> 5)'; sName: = 'Name'; sTmp: = '' ; if ConectGrasp ( 'Master') then begin if OpenDataSetEx (SQLADOConnet, SQLDataSet, sSql) then begin TableToStrings2 (SQLDataSet, sName, sTmp, sTmp, # 13); cbxSQLDB.Items.Text: = sName; if cbxSQLDB.Items.Count > 0 THEN CBXSQLDB.ItemIndex: = 0; End; END ELSE Showmsg ('Connecting SQLServer Database Error, please re-enter the server name, username, password!'); End; end.

转载请注明原文地址:https://www.9cbs.com/read-5825.html

New Post(0)