You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
D6HECHUAN/海关EDI/u_op_seae_edi_custom_zt.pas

1223 lines
34 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

unit u_op_seae_edi_custom_zt;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,IdFTP,IdFTPCommon,
Dialogs, BusinessSkinForm, StdCtrls, bsSkinCtrls,inifiles, DB, ADODB;
type
Tfrm_op_seae_custom_edi_zt = class(TForm)
bsBusinessSkinForm1: TbsBusinessSkinForm;
Label2: TLabel;
Edit2: TEdit;
Edit1: TEdit;
Label1: TLabel;
SaveDialog1: TSaveDialog;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
t_op_ctn: TADOQuery;
t_op_ctn1: TDataSource;
bsSkinRadioGroup1: TbsSkinRadioGroup;
Label3: TLabel;
Edit3: TEdit;
bsSkinGroupBox1: TbsSkinGroupBox;
bsSkinButton4: TbsSkinButton;
Label4: TLabel;
Edit4: TEdit;
Edit5: TEdit;
Label5: TLabel;
Label6: TLabel;
Edit6: TEdit;
Label7: TLabel;
Edit7: TEdit;
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
Label8: TLabel;
Edit8: TEdit;
Label9: TLabel;
Edit9: TEdit;
Label10: TLabel;
Edit10: TEdit;
procedure bsSkinButton2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure bsSkinButton4Click(Sender: TObject);
private
function isEditrue(DataSet:TDataSet): boolean;
function GetStrNum(str:String):integer;
function FormatListString(Old:TStrings;mCount,Strlength:integer):String;
function FormatEdiString(old:String;Strlength:integer):String;
function CreateEdiFile:TStrings;
function GetCntrEdi(cntrsize: String):String;
function GetCntrkgs(cntrsize: String):String;
function GetpkgsEdi(pkgs:String):String;
function GetlineEdi(aline:String):String;
function GetclientEdi(aline:String):String;
procedure GetLengthTString(var sl: TStringList; l: integer);
function GetLengthword(var s: String; l: Integer;str:String): String;
function GetcustEdi(cust: String): String;
function GetFieldName(aField:string): String;
function GetPortEdiID(Port:String): String;
{ Private declarations }
public
{ Public declarations }
end;
var
frm_op_seae_custom_edi_zt: Tfrm_op_seae_custom_edi_zt;
implementation
uses u_op_seae_edi_data, u_main, my_sys_function, u_data_share;
{$R *.dfm}
function Tfrm_op_seae_custom_edi_zt.GetFieldName(aField:string): String;
var
aQuery:TADOQuery;
begin
result:='';
aQuery:=CreateAdoQuery;
with aQuery do
try
Close;
SQL.Add('Select '+aField +' From t_op_seae');
SQL.Add('where <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
Open;
result:=fieldbyname(aField).AsString;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_custom_edi_zt.GetPortEdiID(Port:String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select EDI<44><49><EFBFBD><EFBFBD> from t_code_disport where Ӣ<><D3A2><EFBFBD><EFBFBD>='''+Port+'''');
Open;
if not IsEmpty then
Result:=Trim(FieldByName('EDI<44><49><EFBFBD><EFBFBD>').asstring)
else
Result:='';
end;
finally
FreeAndNil(aQuery);
end;
end;
procedure Tfrm_op_seae_custom_edi_zt.GetLengthTString(var sl: TStringList; l: integer);
var
i:integer;
str_head,S:String;
Stemp:TStrings;
begin
Stemp:=TStringList.Create;
try
str_head:='';
S:='';
for i:=0 to sl.Count-1 do begin
if sl[i]<>'' then
stemp.add(GetLengthword(str_head,l,s+sl[i]));
S:=Str_head;
end;
while S<>'' do begin
stemp.add(GetLengthword(str_head,l,s));
S:=Str_head;
end;
SL.Assign(Stemp);
finally
FreeAndNil(Stemp);
end;
end;
function Tfrm_op_seae_custom_edi_zt.GetLengthword(var s: String; l: Integer;str:String): String;
var
i:Integer;
b:Boolean;
begin
s:='';
if Length(str)<l then begin
result:=str;
end else begin
b:=true;
s:=Copy(str,l+1,Length(str)-l);
str:=Copy(str,1,l);
result:='';
for i:=Length(str) downto 1 do begin
if ( not (str[i] in [' ',',','.',':','(',')'])) and b then
s:=str[i]+s
else begin
b:=false;
result:=str[i]+Result;
end;
end;
s:=s+' ';
end;
end;
function Tfrm_op_seae_custom_edi_zt.FormatEdiString(old:String;Strlength:integer):String;
var
i:integer;
begin
Result:=Trim(Old);
Result:=StringReplace(Result,'?','??',[rfReplaceAll]);
Result:=StringReplace(Result,':','?:',[rfReplaceAll]);
Result:=StringReplace(Result,'''','?''',[rfReplaceAll]);
Result:=StringReplace(Result,'+','?+',[rfReplaceAll]);
end;
function Tfrm_op_seae_custom_edi_zt.FormatListString(Old:TStrings;mCount,Strlength:integer):String;
var
i:integer;
NewStrs:TStrings;
mStr:String;
begin
Result:='';
NewStrs:=TStringList.Create;
for i:=0 to old.Count-1 do begin
if Length(old.Strings[i])<=Strlength then begin
if (Trim(old.Strings[i])<>'') and (Trim(old.Strings[i])<>#10) then
NewStrs.Add(old.Strings[i]);
end else begin
mStr:=old.Strings[i];
while length(mStr)>Strlength do begin
newStrs.Add(copy(mStr,1,Strlength));
system.Delete(mStr,1,Strlength);
end;
newStrs.Add(mStr);
end;
end;
try
for i:=0 to mCount-1 do begin
if i<NewStrs.Count then begin
Result:=Result+FormatEdiString(NewStrs.Strings[i],Strlength);
end;
if i<mCount-1 then
Result:=Result+':';
end;
finally
FreeAndNil(NewStrs);
end;
end;
function Tfrm_op_seae_custom_edi_zt.GetStrNum(str:String):integer;
var
i:integer;
begin
result:=0;
if str='' then exit;
for i:=1 to length(Str) do begin
if str[i] in ['0','1','2','3','4','5','6','7','8','9'] then
result:=result+1;
end;
end;
procedure Tfrm_op_seae_custom_edi_zt.bsSkinButton2Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_op_seae_custom_edi_zt.FormShow(Sender: TObject);
var
inifile1:Tinifile;
begin
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
edit1.text:=inifile1.ReadString('ZTCUSTOMEDI','SEND','');
edit2.text:=inifile1.ReadString('ZTCUSTOMEDI','RECIEVE','');
edit3.text:=inifile1.ReadString('ZTCUSTOMEDI','SENDNAME','');
edit4.text:=inifile1.ReadString('ZTCUSTOMEDI','FTPSERVER','');
edit5.text:=inifile1.ReadString('ZTCUSTOMEDI','FTPPATH','/');
edit6.text:=inifile1.ReadString('ZTCUSTOMEDI','FTPNAME','');
edit7.text:=inifile1.ReadString('ZTCUSTOMEDI','FTPPASS','');
edit8.text:=inifile1.ReadString('ZTCUSTOMEDI','RECIEVEOP','');
edit9.text:=inifile1.ReadString('ZTCUSTOMEDI','RECIEVESALE','');
edit10.text:=inifile1.ReadString('ZTCUSTOMEDI','RECIEVEDEPT','');
inifile1.free;
end;
procedure Tfrm_op_seae_custom_edi_zt.bsSkinButton1Click(Sender: TObject);
var
Str:TStrings;
inifile1:Tinifile;
i:integer;
SenderCode,ReciverCode,strType:String;
begin
if frm_op_seae_edi_data.dxdbgrid1.SelectedCount>1 then
begin
for i:=0 to frm_op_seae_edi_data.dxdbgrid1.SelectedCount-1 do
begin
frm_op_seae_edi_data.t_op_seae.GotoBookmark(pointer(frm_op_seae_edi_data.dxdbgrid1.selectedrows[i]));
if not isEditrue(frm_op_seae_edi_data.t_op_seae) then exit;
end;
end
else
begin
if not isEditrue(frm_op_seae_edi_data.t_op_seae) then exit;
end;
str:=Tstringlist.Create;
try
SenderCode:=trim(edit1.Text) ;
ReciverCode:=trim(edit2.Text) ;
if bsSkinRadioGroup1.ItemIndex=0 then
strType:='9'
else if bsSkinRadioGroup1.ItemIndex=1 then
strType:='5'
else if bsSkinRadioGroup1.ItemIndex=2 then
strType:='6'
else strType:='9';
str.Add('00:KMST:MANIFEST:'+trim(strType)+':'+ Edit3.text+':'+ReciverCode+':'+GetDatetime(datetimetostr(now),1)+#39);
if frm_op_seae_edi_data.dxdbgrid1.SelectedCount>1 then
begin
for i:=0 to frm_op_seae_edi_data.dxdbgrid1.SelectedCount-1 do
begin
frm_op_seae_edi_data.t_op_seae.GotoBookmark(pointer(frm_op_seae_edi_data.dxdbgrid1.selectedrows[i]));
Str.AddStrings(CreateEdiFile)
end;
end
else
begin
Str.AddStrings(CreateEdiFile)
end;
I:=str.Count;
str.Add('99:'+intToStr(i+1)+'''');
SaveDialog1.FileName:=frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring;
if SaveDialog1.Execute then
begin
str.SaveToFile(SaveDialog1.FileName+'.txt');
showmessage('<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ɳɹ<C9B3><C9B9><EFBFBD>');
end
else
begin
showmessage('<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
exit;
end;
finally
FreeAndNil(Str);
end;
close;
end;
function Tfrm_op_seae_custom_edi_zt.isEditrue(DataSet:TDataSet): boolean;
var
cntrs:String;
begin
result:=true;
{
if trim(t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)='' then
begin
s:=s+' <20><><EFBFBD>ѷ<EFBFBD>ʽ';
end;
if trim(t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˱<EFBFBD><CBB1><EFBFBD>').asstring)='' then
begin
s:=s+' EDIҵ<49><D2B5>״̬';
end;
if GetlineEdi(t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)='' then
begin
s:=s+' <20><><EFBFBD>ߴ<EFBFBD><DFB4><EFBFBD>';
end;
if trim(t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then
begin
s:=s+' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end;
if trim(t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then
begin
s:=s+' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end;
if trim(t_op_seae.fieldbyname('<27><>ͷ').asstring)='' then
begin
s:=s+' <20><>ͷ';
end;
if t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asinteger=0 then
begin
s:=s+' <20><><EFBFBD><EFBFBD>';
end;
if trim(t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='' then
begin
s:=s+' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ';
end;
if Trim(s)<>'' then
begin
MessageDlg(s+#13#10+'<27><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
result:=false;
end;
}
end;
function Tfrm_op_seae_custom_edi_zt.CreateEdiFile:TStrings;
var
str,sl1:Tstringlist;
sl:TStrings;
i,j,Count,l,M:integer;
strsql,strRmain,strtemp,S:string;
rs,aQuery2:Tadoquery;
wide_str:widestring;
k:integer;
strType:string;
strDatetime:string;
SenderCode,ReciverCode:string;
function GetRemarksString:String;
var
TempStr:TStrings;
begin
TempStr:=TStringList.Create;
try
TempStr.Text:=GetFieldName('EDI<44><49>ע');
Result:='71:';
Result:=Result+FormatListString(TempStr,10,70)+'''';
finally
FreeAndNil(TempStr);
end;
end;
function GetShipperString:String;
var
TempStr:TStringlist;
aQuery:TADOQuery;
M,L:integer;
S:String;
begin
TempStr:=TStringList.Create;
aQuery:=CreateAdoQuery;
try
if bsSkinCheckRadioBox2.Checked then begin
with aQuery do begin
Close;
SQL.Clear;
SQL.Add('select <20><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD> from t_op_seae_assistant where <20><><EFBFBD><EFBFBD>='''+frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''');
open;
if not IsEmpty then
TempStr.Text:=fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').AsString
else
TempStr.Text:=frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').AsString;
end;
end else
TempStr.Text:=frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').AsString;
GetLengthTString(TempStr,70);
if Tempstr.Count<=9 then begin
Result:='16:';
Result:=Result+edit1.text+':'+edit3.Text+':';
Result:=Result+FormatListString(TempStr,9,70)+'''';
end else begin
M:=1;
for L:=0 to Tempstr.Count-1 do begin
if M<=9 then begin
if M=1 then begin
s:='16:'+edit1.text+':'+edit3.Text+':'+FormatEdiString(Tempstr.Strings[L],0)+':';
end else begin
if M=9 then
s:=s+FormatEdiString(Tempstr.Strings[L],0)
else
s:=s+FormatEdiString(Tempstr.Strings[L],0)+':';
end;
end else begin
S:=S+'''';
Str.Add(S);
M:=1;
s:='16:'+edit1.text+':'+edit3.Text+':'+FormatEdiString(Tempstr.Strings[L],0)+':';
end;
M:=M+1;
end;
S:=S+'''';
Str.Add(S);
result:='';
end;
finally
FreeAndNil(TempStr);
end;
end;
function GetConsigneString:String;
var
TempStr:TStringlist;
aQuery:TADOQuery;
M,L:integer;
S:String;
begin
TempStr:=TStringList.Create;
aQuery:=CreateAdoQuery;
try
if bsSkinCheckRadioBox2.Checked then begin
with aQuery do begin
Close;
SQL.Clear;
SQL.Add('select <20>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD> from t_op_seae_assistant where <20><><EFBFBD><EFBFBD>='''+frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''');
open;
if not IsEmpty then
TempStr.Text:=fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').AsString
else
TempStr.Text:=frm_op_seae_edi_data.t_op_seae.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').AsString;
end;
end else
TempStr.Text:=frm_op_seae_edi_data.t_op_seae.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').AsString;
GetLengthTString(TempStr,70);
if Tempstr.Count<=9 then begin
Result:='17:';
Result:=Result+'::';
Result:=Result+FormatListString(TempStr,9,70)+'''';
end else begin
M:=1;
for L:=0 to Tempstr.Count-1 do begin
if M<=9 then begin
if M=1 then begin
s:='17:::'+FormatEdiString(Tempstr.Strings[L],0)+':';
end else begin
if M=9 then
s:=s+FormatEdiString(Tempstr.Strings[L],0)
else
s:=s+FormatEdiString(Tempstr.Strings[L],0)+':';
end;
end else begin
S:=S+'''';
Str.Add(S);
M:=1;
s:='17:::'+FormatEdiString(Tempstr.Strings[L],0)+':';
end;
M:=M+1;
end;
S:=S+'''';
Str.Add(S);
result:='';
end;
finally
FreeAndNil(TempStr);
end;
end;
function GetNOTIFYString:String;
var
TempStr:TStringlist;
aQuery:TADOQuery;
M,L:integer;
S:String;
begin
TempStr:=TStringList.Create;
aQuery:=CreateAdoQuery;
try
if bsSkinCheckRadioBox2.Checked then begin
with aQuery do begin
Close;
SQL.Clear;
SQL.Add('select ֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD> from t_op_seae_assistant where <20><><EFBFBD><EFBFBD>='''+frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''');
open;
if not IsEmpty then
TempStr.Text:=fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').AsString
else
TempStr.Text:=frm_op_seae_edi_data.t_op_seae.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').AsString;
end;
end else
TempStr.Text:=frm_op_seae_edi_data.t_op_seae.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').AsString;
GetLengthTString(TempStr,70);
if Tempstr.Count<=9 then begin
Result:='18::';
Result:=Result+':';
Result:=Result+FormatListString(TempStr,9,70)+'''';
end else begin
M:=1;
for L:=0 to Tempstr.Count-1 do begin
if M<=9 then begin
if M=1 then begin
s:='18:::'+FormatEdiString(Tempstr.Strings[L],0)+':';
end else begin
if M=9 then
s:=s+FormatEdiString(Tempstr.Strings[L],0)
else
s:=s+FormatEdiString(Tempstr.Strings[L],0)+':';
end;
end else begin
S:=S+'''';
Str.Add(S);
M:=1;
s:='18:::'+FormatEdiString(Tempstr.Strings[L],0)+':';
end;
M:=M+1;
end;
S:=S+'''';
Str.Add(S);
result:='';
end;
finally
FreeAndNil(TempStr);
end;
end;
function GetDAgentString:String;
var
TempStr:TStringlist;
aQuery:TADOQuery;
M,L:integer;
S,Agent:String;
begin
TempStr:=TStringList.Create;
aQuery:=CreateAdoQuery;
try
TempStr.Text:=GetFieldName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
GetLengthTString(TempStr,70);
Agent:=GetFieldName('<27><><EFBFBD><EFBFBD>');
if Tempstr.Count<=9 then begin
Result:='20:'+GetclientEdi(Agent)+':';
Result:=Result+Agent+':';
Result:=Result+FormatListString(TempStr,9,70)+'''';
end else begin
M:=1;
for L:=0 to Tempstr.Count-1 do begin
if M<=9 then begin
if M=1 then begin
S:='20:'+GetclientEdi(Agent)+':';
S:=S+Agent+':';
s:=S+FormatEdiString(Tempstr.Strings[L],0)+':';
end else begin
if M=9 then
s:=s+FormatEdiString(Tempstr.Strings[L],0)
else
s:=s+FormatEdiString(Tempstr.Strings[L],0)+':';
end;
end else begin
S:=S+'''';
Str.Add(S);
M:=1;
S:='20:'+GetclientEdi(Agent)+':';
S:=S+Agent+':';
s:=S+FormatEdiString(Tempstr.Strings[L],0)+':';
end;
M:=M+1;
end;
S:=S+'''';
Str.Add(S);
result:='';
end;
finally
FreeAndNil(TempStr);
end;
end;
begin
SenderCode:=trim(edit1.Text) ;
ReciverCode:=trim(edit2.Text) ;
str:=Tstringlist.Create;
sl:=Tstringlist.Create;
sl1:=Tstringlist.Create;
if bsSkinCheckRadioBox2.Checked then begin
aQuery2:=CreateAdoQuery;
with aQuery2 do begin
Close;
SQL.Clear;
SQL.Add('select * from t_op_seae_assistant where <20><><EFBFBD><EFBFBD>='''+frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''');
open;
end;
end;
{
if bsSkinCheckRadioBox1.Checked then
if not frm_op_seae.t_op_ams.Active then frm_op_seae.t_op_ams.open;
}
str.Clear;
Count:=0;
if frm_data_share.t_code_free.locate('<27><><EFBFBD><EFBFBD>',frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring,[]) then
begin
strtemp:=copy(frm_data_share.t_code_free.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,1,1);
end
else
begin
strtemp:='P';
end;
str.Add('12:'
+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring) +':::'
+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'
+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +'::'
+ FormatDateTime('YYYYMMDD',frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asdatetime)+':'
+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'+strtemp+':'
+':'
// + GetDatetime(trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring),0)+':'
+'CCL:CCL:'
+'3'+#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
str.Add ('13:'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring)+':'
+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring)+':'
+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring)+':'
+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring)+':'
+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring)
+':'+trim(GetFieldName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'))
+':'+trim(GetFieldName('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>'))
+':::'
{ +trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>').asstring) +':::' //<2F><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>
}
+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('Ŀ<>Ĵ<EFBFBD><C4B4><EFBFBD>').asstring) +':'
+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring)
+':'+GetPortEdiID(frm_op_seae_edi_data.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD>ص<EFBFBD>').asstring)
+':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD>ص<EFBFBD>').asstring)+#39);
str.add('14:'+GetlineEdi(trim(GetFieldName('<27><><EFBFBD><EFBFBD>')))+':'+edit9.text+':'+edit8.text+':'+edit10.text+':'+GetclientEdi(trim(trim(GetFieldName('<27><>վ'))))
+':ZLH:F:'+trim(GetFieldName('<27><><EFBFBD><EFBFBD><EFBFBD>˱<EFBFBD><CBB1><EFBFBD>'))
+':3:'+edit1.text
+':'+edit3.text
+':'+GetFieldName('<27><><EFBFBD><EFBFBD><E1B5A5>')
+#39);
strtemp:=GetShipperString;
if strtemp<>'' then
Str.Add(strtemp);
strtemp:=GetConsigneString;
if strtemp<>'' then
Str.Add(strtemp);
strtemp:=GetNOTIFYString;
if strtemp<>'' then
Str.Add(strtemp);
strtemp:=GetDAgentString;
if strtemp<>'' then
Str.Add(strtemp);
str.add('23:'
+':' //2 <20><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>
+':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString) //3<><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>ַ1').AsString) //4 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>ַ
+':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˵绰').AsString) //
+#39);
str.add('24:'
+':' //2 <20><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>
+':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString) //3<>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27>ջ<EFBFBD><D5BB>˵<EFBFBD>ַ1').AsString) //4 <20>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>ַ
+':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27>ջ<EFBFBD><D5BB>˵绰').AsString) //
+#39);
str.add('25:'
+':' //2 ֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>
+':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString) //3֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('֪ͨ<CDA8>˵<EFBFBD>ַ1').AsString) //4 ֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>ַ
+':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('֪ͨ<CDA8>˵绰').AsString) //
+#39);
strsql:='select <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,sum(<28><><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD> from t_op_ctn_edi group by <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD> having <20><><EFBFBD><EFBFBD>='
+#39+frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39;
try
rs:=Tadoquery.Create(application);
rs.Connection := frm_main.db;
rs.sql.clear;
rs.sql.add(strsql);
rs.Open;
rs.First;
while not rs.Eof do
begin
str.Add ('31:'+Trim(GetCntrEdi(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring))+':'+
trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+
'F');
Count:=Count+1;
rs.Next;
end;
finally
freeandnil(rs);
end;
str.Add ('41:1::'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(GetpkgsEdi(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><>װ').asstring))+':'
+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><>װ').asstring) +':' //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ˵<D7B0><CBB5>
+trim(floattostr(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat))+':' //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ˵<D7B0><CBB5>
+trim(floattostr(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat))
+':'+GetFieldName('<27><><EFBFBD>ʽ')
+#39);
IF trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='R' THEN
BEGIN
str.Add ('43:' // Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>
+':'
+':'
+':'
+':'
+':'
+':'
+':'
+':'
+'C:'
+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+'::'
+#39);
END;
if bsSkinCheckRadioBox2.Checked then
sl1.Text:=aQuery2.fieldbyname('<27><>ͷ').AsString
else
sl1.Text:=frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><>ͷ').AsString;
GetLengthTString(sl1,70);
sl.text:='';
for L:=0 to sl1.Count-1 do begin
if Trim(sl1.Strings[L])<>'' then
sl.Add(sl1.Strings[L]);
end;
M:=1;
for L:=0 to sl.Count-1 do begin
if M<=10 then begin
if M=1 then begin
s:='44:1:'+FormatEdiString(sl.Strings[L],0)+':';
end else begin
if M=10 then
s:=s+FormatEdiString(sl.Strings[L],0)
else
s:=s+FormatEdiString(sl.Strings[L],0)+':';
end;
end else begin
S:=S+'''';
Str.Add(S);
M:=1;
s:='44:1:'+FormatEdiString(sl.Strings[L],0)+':';
end;
M:=M+1;
end;
S:=S+'''';
Str.Add(S);
if bsSkinCheckRadioBox2.Checked then
sl1.Text:=aQuery2.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
else
sl1.Text:=frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
GetLengthTString(sl1,70);
sl.text:='';
for L:=0 to sl1.Count-1 do begin
if Trim(sl1.Strings[L])<>'' then
sl.Add(sl1.Strings[L]);
end;
M:=1;
for L:=0 to sl.Count-1 do begin
if M<=5 then begin
if M=1 then begin
s:='47:1:'+FormatEdiString(sl.Strings[L],0)+':';
end else begin
if M=5 then
s:=s+FormatEdiString(sl.Strings[L],0)
else
s:=s+FormatEdiString(sl.Strings[L],0)+':';
end;
end else begin
S:=S+'''';
Str.Add(S);
M:=1;
s:='47:1:'+FormatEdiString(sl.Strings[L],0)+':';
end;
M:=M+1;
end;
S:=S+'''';
Str.Add(S);
// Str.Add(GetCARGODESCRIPTIONString);
Count:=Count+11;
strRmain:='';
strsql:='select * from t_op_ctn_edi where <20><><EFBFBD><EFBFBD>='
+#39+frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39;
try
rs:=Tadoquery.Create(application);
rs.Connection := frm_main.db;
rs.sql.clear;
rs.sql.add(strsql);
rs.Open;
rs.First;
if not rs.IsEmpty then begin
if rs.FieldByName('<27><><EFBFBD><EFBFBD>').Asstring<>'' then begin
rs.First;
while not rs.Eof do begin
str.Add ('51:1:'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+Trim(GetCntrEdi(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring))+':F:'
+trim(IntToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger))+':'+GetpkgsEdi(rs.fieldbyname('<27><>װ').asstring)+':'+trim(rs.fieldbyname('<27><>װ').asstring)+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat))
+':'+GetCntrKGS(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+trim(floattostr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat))+'''');
rs.Next;
end;
end;
end;
finally
freeandnil(rs);
end;
if trim(GetFieldName('EDI<44><49>ע'))<>'' then
Str.Add(GetRemarksString);
if bsSkinCheckRadioBox2.Checked then begin
FreeAndNil(aQuery2);
end;
frm_op_seae_edi_data.t_op_seae.Edit;
frm_op_seae_edi_data.t_op_seae.FieldByName('EDI״̬').AsString:='<27>ѷ<EFBFBD><D1B7><EFBFBD>';
frm_op_seae_edi_data.t_op_seae.Post;
Result:=str;
end;
function Tfrm_op_seae_custom_edi_zt.GetCntrEdi(cntrsize: String):String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select Edi<64><69><EFBFBD><EFBFBD> from t_code_ctn where <20><><EFBFBD><EFBFBD>='''+cntrsize+'''');
Open;
if IsEmpty then
Result:=''
else
Result:=FieldByName('Edi<64><69><EFBFBD><EFBFBD>').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_custom_edi_zt.GetCntrKGS(cntrsize: String):String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select <20><>Ƥ<EFBFBD><C6A4> from t_code_ctn where <20><><EFBFBD><EFBFBD>='''+cntrsize+'''');
Open;
if IsEmpty then
Result:=''
else
Result:=floattostr(FieldByName('<27><>Ƥ<EFBFBD><C6A4>').AsFloat*10);
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_custom_edi_zt.GetpkgsEdi(pkgs: String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select Edi<64><69><EFBFBD><EFBFBD> from t_code_package where <20><><EFBFBD><EFBFBD>='''+pkgs+'''');
Open;
if IsEmpty then
Result:=''
else
Result:=FieldByName('Edi<64><69><EFBFBD><EFBFBD>').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_custom_edi_zt.GetlineEdi(aline: String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select Edi<64><69><EFBFBD><EFBFBD> from t_code_trade where <20><><EFBFBD><EFBFBD>='''+aline+'''');
Open;
if IsEmpty then
Result:=''
else
Result:=FieldByName('Edi<64><69><EFBFBD><EFBFBD>').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_custom_edi_zt.GetclientEdi(aline: String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select Edi<64><69><EFBFBD><EFBFBD> from t_crm_client where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+aline+'''');
Open;
if IsEmpty then
Result:=''
else
Result:=FieldByName('Edi<64><69><EFBFBD><EFBFBD>').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
procedure Tfrm_op_seae_custom_edi_zt.bsSkinButton3Click(Sender: TObject);
var
IdFTP1:TIdFTP;
str:widestring;
str_file:widestring;
ftpar,ftpname,ftppass,ftppath,ScriptPath:String;
StrL:TStrings;
i:integer;
SenderCode,ReciverCode,strType:String;
begin
if frm_op_seae_edi_data.dxdbgrid1.SelectedCount>1 then
begin
for i:=0 to frm_op_seae_edi_data.dxdbgrid1.SelectedCount-1 do
begin
frm_op_seae_edi_data.t_op_seae.GotoBookmark(pointer(frm_op_seae_edi_data.dxdbgrid1.selectedrows[i]));
if not isEditrue(frm_op_seae_edi_data.t_op_seae) then exit;
end;
end
else
begin
if not isEditrue(frm_op_seae_edi_data.t_op_seae) then exit;
end;
ScriptPath:=ExtractFilePath(ParamStr(0))+'EDIFILE\';
if not DirectoryExists(ScriptPath) then
CreateDir(ScriptPath);
ftpar:=Trim(edit4.Text);
if ftpar='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FTP<54><50>ַ<EFBFBD><D6B7>',mtWarning,[mbOk],0);
exit;
end;
ftpname:=Trim(edit6.Text);
if ftpar='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FTP<54>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbOk],0);
exit;
end;
ftppass:=Trim(edit7.Text);
if ftpar='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FTP<54><50><EFBFBD>룡',mtWarning,[mbOk],0);
exit;
end;
ftppath:=Trim(edit5.Text);
str:=ScriptPath
+frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring
+FormatDateTime('yyyy',now)
+FormatDateTime('mm',now)
+FormatDateTime('dd',now)
+FormatDateTime('hh',now)
+FormatDateTime('nn',now)+'.txt';
str_file:=frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring
+FormatDateTime('yyyy',now)
+FormatDateTime('mm',now)
+FormatDateTime('dd',now)
+FormatDateTime('hh',now)
+FormatDateTime('nn',now)+'.txt';
strL:=Tstringlist.Create;
try
SenderCode:=trim(edit1.Text) ;
ReciverCode:=trim(edit2.Text) ;
if bsSkinRadioGroup1.ItemIndex=0 then
strType:='9'
else if bsSkinRadioGroup1.ItemIndex=1 then
strType:='2'
else if bsSkinRadioGroup1.ItemIndex=2 then
strType:='3'
else if bsSkinRadioGroup1.ItemIndex=3 then
strType:='4'
else strType:='9';
strL.Add('00:KMST:MANIFEST:'+trim(strType)+':'+ SenderCode+':'+ReciverCode+':'+formatdatetime('YYMMDDHHMM',now)+#39);
if frm_op_seae_edi_data.dxdbgrid1.SelectedCount>1 then
begin
for i:=0 to frm_op_seae_edi_data.dxdbgrid1.SelectedCount-1 do
begin
frm_op_seae_edi_data.t_op_seae.GotoBookmark(pointer(frm_op_seae_edi_data.dxdbgrid1.selectedrows[i]));
// if Trim(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
StrL.AddStrings(CreateEdiFile)
// else if Pos('<27><>Ʊ',(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring))>0 then
// StrL:=CreateZHUEdiFile
// else begin
// Exit;
// end;
end;
end
else
begin
// if Trim(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
StrL.AddStrings(CreateEdiFile)
// else if Pos('<27><>Ʊ',(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring))>0 then
// StrL:=CreateZHUEdiFile
// else begin
// Exit;
// end;
end;
I:=strL.Count;
strL.Add('99:'+intToStr(i+1)+'''');
{
for i:=0 to StrL.Count-1 do begin
if IsZhongwen(StrL[i]) then begin
MessageDlg('<27><>Ʊҵ<C6B1><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41>Ȳ<EFBFBD><C8B2><EFBFBD>ַ<EFBFBD>,<2C><>ȥ<EFBFBD><C8A5><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD>',mtWarning,[mbYes],0);
exit;
end;
end;
}
strL.SaveToFile(str);
finally
FreeAndNil(StrL)
end;
try
IdFTP1:=TIdFTP.Create(application);
with idftp1 do
begin
Username:=ftpname;
Password:=ftppass;
Host:=ftpar;
Connect;
end;
idftp1.ChangeDir(ftppath);
idftp1.TransferType:=ftBinary;
idftp1.Put(str,str_file);
idftp1.Disconnect;
showmessage('<27>ļ<EFBFBD><C4BC>ϴ<EFBFBD><CFB4>ɹ<EFBFBD><C9B9><EFBFBD>');
except
deletefile(str);
showmessage('<27>ļ<EFBFBD><C4BC>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
idftp1.Free;
end;
procedure Tfrm_op_seae_custom_edi_zt.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
var
inifile1:Tinifile;
begin
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
inifile1.WriteString('ZTCUSTOMEDI','SEND',edit1.text);
inifile1.WriteString('ZTCUSTOMEDI','RECIEVE',edit2.text);
inifile1.WriteString('ZTCUSTOMEDI','SENDNAME',edit3.text);
inifile1.WriteString('ZTCUSTOMEDI','FTPSERVER',edit4.text);
inifile1.WriteString('ZTCUSTOMEDI','FTPPATH',edit5.text);
inifile1.WriteString('ZTCUSTOMEDI','FTPNAME',edit6.text);
inifile1.WriteString('ZTCUSTOMEDI','FTPPASS',edit7.text);
inifile1.WriteString('ZTCUSTOMEDI','RECIEVEOP',edit8.text);
inifile1.WriteString('ZTCUSTOMEDI','RECIEVESALE',edit9.text);
inifile1.WriteString('ZTCUSTOMEDI','RECIEVEDEPT',edit10.text);
inifile1.free;
end;
procedure Tfrm_op_seae_custom_edi_zt.bsSkinButton4Click(Sender: TObject);
begin
if frm_op_seae_custom_edi_zt.Height=301 then
frm_op_seae_custom_edi_zt.Height:=162
else
frm_op_seae_custom_edi_zt.Height:=301;
end;
function Tfrm_op_seae_custom_edi_zt.GetcustEdi(cust: String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.CLEAR;
SQL.Add('Select EDI<44><49><EFBFBD><EFBFBD> from t_crm_client where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+Cust+'''');
Open;
if not IsEmpty then
result:=fieldbyname('EDI<44><49><EFBFBD><EFBFBD>').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
end.