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.

667 lines
25 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_bb;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, BusinessSkinForm, StdCtrls, bsSkinCtrls,inifiles, DB, ADODB;
type
Tfrm_op_seae_edi_bb = class(TForm)
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
SaveDialog1: TSaveDialog;
Label1: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Label2: TLabel;
bsBusinessSkinForm1: TbsBusinessSkinForm;
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
procedure FormShow(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function FormatListString(Old:TStrings;mCount,Strlength:integer):String;
function FormatEdiString(old:String;Strlength:integer):String;
end;
var
frm_op_seae_edi_bb: Tfrm_op_seae_edi_bb;
implementation
uses u_op_seae, u_main, my_sys_function, u_data_share;
{$R *.dfm}
procedure Tfrm_op_seae_edi_bb.FormShow(Sender: TObject);
var
inifile1:Tinifile;
begin
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
edit1.text:=inifile1.ReadString('BBEDI','SENDCODE','');
edit2.text:=inifile1.ReadString('BBEDI','RECIEVECODE','');
inifile1.free;
end;
procedure Tfrm_op_seae_edi_bb.bsSkinButton2Click(Sender: TObject);
begin
close;
end;
function Tfrm_op_seae_edi_bb.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
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_edi_bb.FormatEdiString(old:String;Strlength:integer):String;
var
i:integer;
begin
Result:=Trim(Old);
Result:=StringReplace(Result,#13#10,'',[rfReplaceAll]);
Result:=StringReplace(Result,#10,'',[rfReplaceAll]);
Result:=StringReplace(Result,'?','??',[rfReplaceAll]);
Result:=StringReplace(Result,':','?:',[rfReplaceAll]);
Result:=StringReplace(Result,'''','?''',[rfReplaceAll]);
Result:=StringReplace(Result,'+','?+',[rfReplaceAll]);
if length(Result)>Strlength then
Result:=Copy(Result,1,Strlength);
end;
procedure Tfrm_op_seae_edi_bb.bsSkinButton1Click(Sender: TObject);
var
str:Tstringlist;
Tempstr : TStrings;
Temprslt : string;
i,j,Count:integer;
strsql,strRmain:string;
rs,aQuery2:Tadoquery;
wide_str:widestring;
k:integer;
inifile1:Tinifile;
strType,XType:string;
strDatetime:string;
SenderCode,ReciverCode:string;
function GetCntrSize(code,Cntr:String):string;
var
aQuery:TADOQuery;
begin
result:=Cntr;
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select EDI<44><49><EFBFBD><EFBFBD> from t_code_ctn where <20><><EFBFBD><EFBFBD>='''+Code+'''');
Open;
if (not IsEmpty) and (FieldByName('EDI<44><49><EFBFBD><EFBFBD>').AsString<>'') then begin
Result:=FieldByName('EDI<44><49><EFBFBD><EFBFBD>').AsString;
end;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Getport(code,port:String):string;
var
aQuery:TADOQuery;
begin
result:=port;
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select <20>ۿ<EFBFBD><DBBF><EFBFBD><EFBFBD><EFBFBD> from t_code_edi_port where EDI<44><49><EFBFBD><EFBFBD>='''+Code+'''');
Open;
if (not IsEmpty) and (FieldByName('<27>ۿ<EFBFBD><DBBF><EFBFBD><EFBFBD><EFBFBD>').AsString<>'') then begin
Result:=FieldByName('<27>ۿ<EFBFBD><DBBF><EFBFBD><EFBFBD><EFBFBD>').AsString;
end;
end;
if Pos(',',Result)>0 then
Result:=Copy(Result,1,Pos(',',Result)-1);
finally
FreeAndNil(aQuery);
end;
end;
function GetPortStr(Port:String):String;
begin
if Pos(',',Port)>0 then
Result:=Copy(Port,1,Pos(',',Port)-1)
else
Result:=Port;
end;
begin
SenderCode:=trim(edit1.Text) ;
ReciverCode:=trim(edit2.Text) ;
strType:='9C';
if frm_op_seae.dxdbgrid1.SelectedCount<=1 then
begin
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.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''');
open;
end;
end;
str:=Tstringlist.Create;
str.Clear;
str.Add('00:IFCSUM:MANIFEST:'+trim(strType)+':'+ SenderCode+':'+ReciverCode+':'+GetDatetime(datetimetostr(now),1)+#39);
Count:=0;
str.Add ('10:'+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString)+':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString) +':'
+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ߴ<EFBFBD><DFB4><EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+ trim(GetDatetime(frm_op_seae.t_op_seae.fieldbyname('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,0)) +':'
+ trim(GetDatetime(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,0)) +':'
+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>۵ص<DBB5><D8B5><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>۵ص<DBB5>').asstring) +':'
+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('<27><>һ<EFBFBD>Ҹ۴<D2B8><DBB4><EFBFBD>').asstring) +':'
+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('<27><>һ<EFBFBD>Ҹ<EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><>TEU').asstring) +':'
+ #39);
str.Add('11::' + trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').AsString)
+ #39);
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring) = 'FREIGHT PREPAID' then
xtype := 'P'
else if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring) = 'FREIGHT COLLECT' then
xtype := 'C'
else
xtype := 'F';
str.add('12:' + trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+ XType +':'
+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+ '::::' +#39);
str.add('13:' + trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵش<C4B5><D8B4><EFBFBD>').asstring)+':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring)+':'
+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('<27><>ת<EFBFBD>۴<EFBFBD><DBB4><EFBFBD>').asstring) +':'
+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('<27><>ת<EFBFBD><D7AA>').asstring) +':'
+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('<27>ᵥǩ<E1B5A5><C7A9><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD>ص<EFBFBD>').asstring) +':'
+ ':' +#39);
try
Temprslt := '';
TempStr:=TStringList.Create;
Tempstr.Clear;
if bsSkinCheckRadioBox2.Checked then
Tempstr.Text:=aQuery2.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').AsString
else
Tempstr.Text:=frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').AsString;
Temprslt := Temprslt + FormatListString(Tempstr,5,35);
str.Add('16::' + Temprslt + ':' + #39);
finally
Tempstr.Free;
end;
try
Temprslt := '';
Tempstr := TStringList.Create;
Tempstr.Clear;
if bsSkinCheckRadioBox2.Checked then
Tempstr.Text:=aQuery2.FieldByName('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').AsString
else
Tempstr.Text:=frm_op_seae.t_op_seae.FieldByName('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').AsString;
Temprslt := Temprslt + FormatListString(Tempstr,5,35);
str.Add('17::' + Temprslt + ':' + #39);
finally
Tempstr.Free;
end;
try
Temprslt := '';
Tempstr := TStringList.Create;
Tempstr.Clear;
// Tempstr.Assign(TGuidField);
// Tempstr.Add(frm_op_seae.t_op_seae.FieldByName('֪ͨ<CDA8><D6AA>').AsString);
// Temprslt := Temprslt + FormatListString(Tempstr,5,35) + ':';
// Tempstr.Clear;
if bsSkinCheckRadioBox2.Checked then
Tempstr.Text:=aQuery2.FieldByName('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').AsString
else
Tempstr.Text:=frm_op_seae.t_op_seae.FieldByName('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').AsString;
Temprslt := Temprslt + FormatListString(Tempstr,5,35);
str.Add('18::' + Temprslt + ':' + #39);
finally
Tempstr.Free;
end;
try
Temprslt := '';
Tempstr := TStringList.Create;
Tempstr.Clear;
if bsSkinCheckRadioBox2.Checked then
Tempstr.Text:=aQuery2.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
else
Tempstr.Text:=frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
Temprslt := Temprslt + FormatListString(Tempstr,5,35);
str.Add('19::' + Temprslt + ':' + #39);
finally
Tempstr.Free;
end;
str.Add ('41:1'
+':0'//+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)+'::'
+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) + '::'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring) + ':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)
+#39);
str.Add ('43:'
+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) +':'
+'none:'//trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒҳ<C6B7><D2B3>').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) +':'
+'none:::::::::'//trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7>ǩ').asstring) +'::::::::'
+#39);
try
Tempstr:=TStringList.Create;
Tempstr.Clear;
if bsSkinCheckRadioBox2.Checked then
Tempstr.Text:=aQuery2.fieldbyname('<27><>ͷ').asstring
else
Tempstr.Text:=frm_op_seae.t_op_seae.fieldbyname('<27><>ͷ').asstring;
str.Add ('44:'
//+ Changestr(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)+ ':'
+ FormatListString(Tempstr,5,300)+ ':'
+'::::' + #39);
finally
Tempstr.Free;
end;
// str.Add ('44:'
// + Changestr(frm_op_seae.t_op_seae.fieldbyname('<27><>ͷ').asstring)+ ':'
// +':::::::::' + #39);
try
Tempstr:=TStringList.Create;
Tempstr.Clear;
if bsSkinCheckRadioBox2.Checked then
Tempstr.Text:=aQuery2.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
else
Tempstr.Text:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
str.Add ('47:'
//+ Changestr(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)+ ':'
+ FormatListString(Tempstr,5,300)+ ':'
+ #39);
finally
Tempstr.Free;
end;
Count:=Count+10;
if trim(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
XType := 'F'
else begin
if trim(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring)='ƴ<><C6B4>' then
XType := 'L'
else
XType := 'E';
end;
strsql:='select t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E>ߴ<EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_code_ctn.EDI<44><49><EFBFBD><EFBFBD> from t_op_ctn '
+'left join t_code_ctn on t_code_ctn.<2E><><EFBFBD><EFBFBD>=t_op_ctn.<2E><><EFBFBD><EFBFBD> WHERE t_op_ctn.<2E><><EFBFBD><EFBFBD>='
+#39+frm_op_seae.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
if XType = 'F' then
begin
str.Add ('51:'
+'1:'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'
+ XType +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+#39);
end
else
begin
str.Add ('51:'
+'1:'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'
+ XType +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+#39);
end;
Count:=Count+1;
rs.Next;
end;
rs.Close;
rs.Destroy;
except
on e:exception do
begin
rs.Close;
rs.Destroy;
exit;
end;
end;
str.Add ('99:'+ inttostr(Count+2)+#39);
end
else
begin
str:=Tstringlist.Create;
str.Clear;
str.Add('00:IFCSUM:MANIFEST:'+trim(strType)+':'+ SenderCode+':'+ReciverCode+':'+GetDatetime(datetimetostr(now),1)+#39);
Count:=0;
for k:=0 to frm_op_seae.dxdbgrid1.SelectedCount-1 do
begin
frm_op_seae.t_op_seae.GotoBookmark(pointer(frm_op_seae.dxdbgrid1.selectedrows[k]));
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.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''');
open;
end;
end;
str.Add ('10:'
+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString)+':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString) +':'
+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ߴ<EFBFBD><DFB4><EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+ trim(GetDatetime(frm_op_seae.t_op_seae.fieldbyname('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,0)) +':'
+ trim(GetDatetime(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,0)) +':'
+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>۵ص<DBB5><D8B5><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>۵ص<DBB5>').asstring) +':'
+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('<27><>һ<EFBFBD>Ҹ۴<D2B8><DBB4><EFBFBD>').asstring) +':'
+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('<27><>һ<EFBFBD>Ҹ<EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><>TEU').asstring) +':'
+ #39);
str.Add('11::' + trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').AsString)
+ #39);
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring) = 'FREIGHT PREPAID' then
xtype := 'P'
else if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring) = 'FREIGHT COLLECT' then
xtype := 'C'
else
xtype := 'F';
str.add('12:' + trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+ xtype +':'
+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+ '::::' +#39);
str.add('13:' + trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵش<C4B5><D8B4><EFBFBD>').asstring)+':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring)+':'
+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('<27><>ת<EFBFBD>۴<EFBFBD><DBB4><EFBFBD>').asstring) +':'
+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('<27><>ת<EFBFBD><D7AA>').asstring) +':'
+ ':'//trim(frm_op_seae.t_op_seae.fieldbyname('<27>ᵥǩ<E1B5A5><C7A9><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD>ص<EFBFBD>').asstring) +':'
+ ':' +#39);
try
Temprslt := '';
TempStr:=TStringList.Create;
Tempstr.Clear;
if bsSkinCheckRadioBox2.Checked then
Tempstr.Text:=aQuery2.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').AsString
else
Tempstr.Text:=frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').AsString;
Temprslt := Temprslt + FormatListString(Tempstr,5,35);
str.Add('16::' + Temprslt + ':' + #39);
finally
Tempstr.Free;
end;
try
Temprslt := '';
Tempstr := TStringList.Create;
Tempstr.Clear;
if bsSkinCheckRadioBox2.Checked then
Tempstr.Text:=aQuery2.FieldByName('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').AsString
else
Tempstr.Text:=frm_op_seae.t_op_seae.FieldByName('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').AsString;
Temprslt := Temprslt + FormatListString(Tempstr,5,35);
str.Add('17::' + Temprslt + ':' + #39);
finally
Tempstr.Free;
end;
try
Temprslt := '';
Tempstr := TStringList.Create;
Tempstr.Clear;
if bsSkinCheckRadioBox2.Checked then
Tempstr.Text:=aQuery2.FieldByName('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').AsString
else
Tempstr.Text:=frm_op_seae.t_op_seae.FieldByName('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').AsString;
Temprslt := Temprslt + FormatListString(Tempstr,5,35);
str.Add('18::' + Temprslt + ':' + #39);
finally
Tempstr.Free;
end;
try
Temprslt := '';
Tempstr := TStringList.Create;
Tempstr.Clear;
if bsSkinCheckRadioBox2.Checked then
Tempstr.Text:=aQuery2.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
else
Tempstr.Text:=frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
Temprslt := Temprslt + FormatListString(Tempstr,5,35);
str.Add('19::' + Temprslt + ':' + #39);
finally
Tempstr.Free;
end;
str.Add ('41:1'
+':0'//+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)+'::'
+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +'::'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)
+#39);
str.Add ('43:'
+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) +':'
+'none:'//trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒҳ<C6B7><D2B3>').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) +':'
+'none:::::::::'//trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7>ǩ').asstring) +'::::::::'
+#39);
try
Tempstr:=TStringList.Create;
Tempstr.Clear;
if bsSkinCheckRadioBox2.Checked then
Tempstr.Text:=aQuery2.fieldbyname('<27><>ͷ').asstring
else
Tempstr.Text:=frm_op_seae.t_op_seae.fieldbyname('<27><>ͷ').asstring;
str.Add ('44:'
//+ Changestr(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)+ ':'
+ FormatListString(Tempstr,5,300)+ ':'
+ #39);
finally
Tempstr.Free;
end;
try
Tempstr:=TStringList.Create;
Tempstr.Clear;
if bsSkinCheckRadioBox2.Checked then
Tempstr.Text:=aQuery2.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
else
Tempstr.Text:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
str.Add ('47:'
//+ Changestr(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)+ ':'
+ FormatListString(Tempstr,5,300)+ ':'
+ #39);
finally
Tempstr.Free;
end;
Count:=Count+10;
if trim(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
XType := 'F'
else begin
if trim(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring)='ƴ<><C6B4>' then
XType := 'L'
else
XType := 'E';
end;
strsql:='select t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E>ߴ<EFBFBD> '
+',t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_code_ctn.EDI<44><49><EFBFBD><EFBFBD> from t_op_ctn '
+'left join t_code_ctn on t_code_ctn.<2E><><EFBFBD><EFBFBD>=t_op_ctn.<2E><><EFBFBD><EFBFBD> WHERE t_op_ctn.<2E><><EFBFBD><EFBFBD>='
+#39+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39;
{
strsql:='select <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C>ߴ<EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD> from t_op_ctn'
+' group by <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C>ߴ<EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD> having <20><><EFBFBD><EFBFBD>='
+#39+frm_op_seae.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
if XType = 'F' then
begin
str.Add ('51:'
+'1:'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'
+ XType +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+#39);
end
else
begin
str.Add ('51:'
+'1:'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'
+ XType +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+#39);
end;
Count:=Count+1;
rs.Next;
end;
rs.Close;
rs.Destroy;
except
on e:exception do
begin
rs.Close;
rs.Destroy;
exit;
end;
end;
if k<>frm_op_seae.dxdbgrid1.SelectedCount-1 then begin
str.Add ('52:'+#39);
Count:=Count+1;
end;
end;
str.Add ('99:'+ inttostr(Count+3)+#39);
end;
SaveDialog1.FileName:=frm_op_seae.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;
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
inifile1.WriteString('BBEDI','SENDCODE',edit1.text);
inifile1.WriteString('BBEDI','RECIEVECODE',edit2.text);
inifile1.free;
close;
end;
end.