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.

739 lines
23 KiB
Plaintext

11 months ago
unit u_op_seae_edi_yd;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, BusinessSkinForm, StdCtrls, bsSkinCtrls,inifiles, DB, ADODB;
type
Tfrm_op_seae_edi_yd = class(TForm)
bsBusinessSkinForm1: TbsBusinessSkinForm;
Label2: TLabel;
Edit2: TEdit;
Edit1: TEdit;
Label1: TLabel;
SaveDialog1: TSaveDialog;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
Label3: TLabel;
Label4: TLabel;
Edit3: TEdit;
Edit4: TEdit;
bsck: TCheckBox;
procedure bsSkinButton2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
private
function FormatListString(Old:TStrings;mCount,Strlength:integer):String;
function FormatEdiString(str:String;Strlength:integer=0):String;
function GetLengthword(var s: String; l: Integer;str:String): String;
procedure GetLengthTString(var sl:TStringList;l:integer);
function GetCntrEdi(cntrsize: String):String;
function GetLoadPortEdiID(Port:String): String;
function GetCtnCode(ctnkind,ctnsize:String):String;
{ Private declarations }
public
{ Public declarations }
end;
var
frm_op_seae_edi_yd: Tfrm_op_seae_edi_yd;
implementation
uses u_op_seae, u_main, my_sys_function, u_data_share, u_op_seae_assistant;
{$R *.dfm}
function Tfrm_op_seae_edi_yd.GetLoadPortEdiID(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_loaport 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;
function Tfrm_op_seae_edi_yd.GetCtnCode(ctnkind,ctnsize:String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
ctnsize:=StringReplace(ctnsize,'''','''''',[rfReplaceAll]);
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select EDI<44><49><EFBFBD><EFBFBD> from t_code_ctn where <20><><EFBFBD><EFBFBD>='''+ctnkind+''' and <20>ߴ<EFBFBD>='''+ctnsize+'''');
Open;
if not IsEmpty then
Result:=Trim(FieldByName('EDI<44><49><EFBFBD><EFBFBD>').asstring)
else
Result:='';
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_edi_yd.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;
procedure Tfrm_op_seae_edi_yd.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_edi_yd.FormatEdiString(str:String;Strlength:integer=0):String;
var
i:integer;
strC:widestring;
begin
strC:='';
for i:=1 to length(str) do
begin
if ((str[i]=#39) or (str[i]=':') or (str[i]='+') or (str[i]='?') or (str[i]=';')) then
begin
strC:=strC+'?'+str[i];
end
else
begin
strC:=strC+str[i];
end;
end;
result:=strC;
end;
function Tfrm_op_seae_edi_yd.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+NewStrs.Strings[i];
end;
if i<mCount-1 then
Result:=Result+':';
end;
finally
FreeAndNil(NewStrs);
end;
end;
procedure Tfrm_op_seae_edi_yd.bsSkinButton2Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_op_seae_edi_yd.FormShow(Sender: TObject);
var
inifile1:Tinifile;
begin
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
edit1.text:=inifile1.ReadString('EDI','YDSEND','');
edit2.text:=inifile1.ReadString('EDI','YDRECIEVE','QDAGENT');
edit4.text:=inifile1.ReadString('EDI','YDPORTLOAD','CNTAO');
edit3.text:=inifile1.ReadString('EDI','YDPORTDISCHARG','');
inifile1.free;
end;
function Tfrm_op_seae_edi_yd.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;
procedure Tfrm_op_seae_edi_yd.bsSkinButton1Click(Sender: TObject);
var
str,sl,sl1:Tstringlist;
i,j,Count,L,M:integer;
strsql,strRmain,strtemp,S:string;
rs:Tadoquery;
wide_str:widestring;
k:integer;
inifile1:Tinifile;
strType:string;
strDatetime:string;
SenderCode,ReciverCode:string;
function GetShipperString:String;
var
TempStr:TStringList;
begin
TempStr:=TStringList.Create;
try
if not bsck.Checked then
TempStr.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').AsString)
else TempStr.Text:=FormatEdiString(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').AsString);
GetLengthTString(TempStr,35);
Result:='16:';
Result:=Result+':';
Result:=Result+FormatListString(TempStr,6,35)+'''';
finally
FreeAndNil(TempStr);
end;
end;
function GetConsigneString:String;
var
TempStr:TStringList;
begin
TempStr:=TStringList.Create;
try
if not bsck.Checked then
TempStr.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').AsString)
else TempStr.Text:=FormatEdiString(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').AsString);
GetLengthTString(TempStr,35);
Result:='17:';
Result:=Result+':';
Result:=Result+FormatListString(TempStr,6,35)+'''';
finally
FreeAndNil(TempStr);
end;
end;
function GetNOTIFYString:String;
var
TempStr:TStringList;
begin
TempStr:=TStringList.Create;
try
if not bsck.Checked then
TempStr.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').AsString)
else TempStr.Text:=FormatEdiString(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').AsString);
GetLengthTString(TempStr,35);
Result:='18:';
Result:=Result+':';
Result:=Result+FormatListString(TempStr,6,35)+'''';
finally
FreeAndNil(TempStr);
end;
end;
function GetMARKSString:String;
var
TempStr:TStringList;
begin
TempStr:=TStringList.Create;
try
if not bsck.Checked then
TempStr.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('<27><>ͷ').AsString)
else TempStr.Text:=FormatEdiString(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><>ͷ').AsString);
GetLengthTString(TempStr,35);
Result:='44:';
Result:=Result+FormatListString(TempStr,10,35)+'''';
finally
FreeAndNil(TempStr);
end;
end;
begin
if bsck.Checked then
begin
if frm_op_seae_assistant=nil then
begin
ShowMessage('<27><><EFBFBD><EFBFBD><>к<EFBFBD><D0BA>ᵥ)<29><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>ͷֵ<CDB7>Edi');
exit;
end
end;
SenderCode:=trim(edit1.Text) ;
ReciverCode:=trim(edit2.Text) ;
strType:='9';
sl:=Tstringlist.Create;
sl1:=Tstringlist.Create;
if frm_op_seae.dxdbgrid1.SelectedCount<=1 then
begin
str:=Tstringlist.Create;
str.Clear;
str.Add('00:IFCSUM:MANIFEST:'+trim(strType)+':'+ SenderCode+':'+ReciverCode+':'+FormatDateTime('YYMMDDHHMM', Now)+#39);
Count:=0;
str.Add('10::'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)
+ '::::'
+ FormatDateTime('YYYYMMDD',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asdatetime)+':'
+trim(edit4.text)+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring)
+#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
str.Add('11:'
+'SOF'+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring)
+#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
if frm_data_share.t_code_free.locate('<27><><EFBFBD><EFBFBD>',frm_op_seae.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;
if not bsck.Checked then
begin
str.Add ('12:'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring)+':'
+':::::' // <20>ջ<EFBFBD><D5BB><EFBFBD>
+trim(edit4.text)+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring)+':'
// +trim(edit4.text)+':'
// +trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring)+':'
+'CY-CY'+':'
+strtemp+':'
+FormatDateTime('YYYYMMDD',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asdatetime)+#39);
end
else
begin
str.Add ('12:'+trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring)+':'
+':::::' // <20>ջ<EFBFBD><D5BB><EFBFBD>
+trim(edit4.text)+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring)+':'
// +trim(edit4.text)+':'
// +trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring)+':'
+'CY-CY'+':'
+strtemp+':'
+FormatDateTime('YYYYMMDD',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asdatetime)+#39);
end;
str.Add ('13:'+trim(edit3.text)+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring)+':'
+trim(edit3.Text)+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>').asstring)
+GetLoadPortEdiID(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD≯ۿ<CCB8>').asstring)+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD≯ۿ<CCB8>').asstring)
+#39);
Str.Add(GetShipperString);
Str.Add(GetConsigneString);
Str.Add(GetNOTIFYString);
IF trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='' THEN
strtemp:='S'
else
strtemp:=trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring);
if not bsck.Checked then
begin
str.Add ('41:001:'+strtemp+':' // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ S/R/D/O
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +'::'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring) +':' //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ˵<D7B0><CBB5>
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +'::' // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װƤ<D7B0><C6A4>
+#39);
end
else
begin
str.Add ('41:001:'+strtemp+':' // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ S/R/D/O
+trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +'::'
+trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><>װ').asstring) +':' //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ˵<D7B0><CBB5>
+trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +'::' // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>
+trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װƤ<D7B0><C6A4>
+#39);
end;
IF trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='R'THEN
BEGIN
str.Add ('43:' // Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>
+trim(frm_op_seae.t_op_seae.fieldbyname('<27>¶ȵ<C2B6>λ').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><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('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)
+#39);
END;
IF trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='D'THEN
BEGIN
str.Add ('43:' // Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>
+trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) +':'
+':'
+':'
+#39);
END;
Str.Add(GetMARKSString);
if not bsck.Checked then
sl1.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString)
else sl1.Text:=FormatEdiString(frm_op_seae_assistant.t_op_seae_assistant.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:'+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:'+FormatEdiString(sl.Strings[L],0)+':';
end;
M:=M+1;
end;
S:=S+'''';
Str.Add(S);
Count:=Count+11;
strRmain:='';
try
rs:=Tadoquery.Create(application);
rs.Connection := frm_main.db;
strsql:='select * from t_op_ctn where <20><><EFBFBD><EFBFBD>='
+#39+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39;
rs.Close;
rs.sql.clear;
rs.sql.add(strsql);
rs.Open;
if not rs.IsEmpty then begin
rs.First;
while not rs.Eof do begin
if rs.fieldbyname('<27><>ע').asstring='' then
strtemp:='F'
else
strtemp:=copy(rs.fieldbyname('<27><>ע').asstring,1,1);
str.Add ('51:001:'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+GetCtnCode(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,rs.fieldbyname('<27>ߴ<EFBFBD>').asstring)+':'+strtemp+':'
+trim(IntToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger))+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat))+':'+''''
);
rs.Next;
end;
end;
rs.Close;
rs.Destroy;
except
on e:exception do
begin
rs.Close;
rs.Destroy;
exit;
end;
end;
count:=str.count;
str.Add ('99:'+ inttostr(count+1)+#39);
end
else
begin
str:=Tstringlist.Create;
str.Clear;
str.Add('00:IFCSUM:MANIFEST:'+trim(strType)+':'+ SenderCode+':'+ ReciverCode +':'+FormatDateTime('YYMMDDHHMM', Now)+#39);
str.Add('10::'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)
+ '::::'
+ FormatDateTime('YYYYMMDD',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asdatetime)+':'
+trim(edit4.Text)+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring)
+#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
str.Add('11:'
+'SOF'+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring)
+#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
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]));
{
str.Add('11::'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+ 'V.'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)
+ '::::::::::' +#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
}
if frm_data_share.t_code_free.locate('<27><><EFBFBD><EFBFBD>',frm_op_seae.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;
if not bsck.Checked then
begin
str.Add ('12:'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring)+':'
+':::::' // <20>ջ<EFBFBD><D5BB><EFBFBD>
+trim(edit4.Text)+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring)+':'
+'CY-CY'+':'
+strtemp+':'
+FormatDateTime('YYYYMMDD',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asdatetime)+#39);
end
else
begin
str.Add ('12:'+trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring)+':'
+':::::' // <20>ջ<EFBFBD><D5BB><EFBFBD>
+trim(edit4.Text)+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring)+':'
+'CY-CY'+':'
+strtemp+':'
+FormatDateTime('YYYYMMDD',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asdatetime)+#39);
end;
str.Add ('13:'+trim(edit3.text)+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring)+':'
+trim(edit3.Text)+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>').asstring)
+GetLoadPortEdiID(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD≯ۿ<CCB8>').asstring)+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD≯ۿ<CCB8>').asstring)
+#39);
Str.Add(GetShipperString);
Str.Add(GetConsigneString);
Str.Add(GetNOTIFYString);
IF trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='' THEN
strtemp:='S'
else
strtemp:=trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring);
if not bsck.Checked then
begin
str.Add ('41:001:'+strtemp+':' // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ S/R/D/O
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +'::'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring) +':' //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ˵<D7B0><CBB5>
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +'::' // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װƤ<D7B0><C6A4>
+#39);
end
else
begin
str.Add ('41:001:'+strtemp+':' // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ S/R/D/O
+trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +'::'
+trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><>װ').asstring) +':' //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ˵<D7B0><CBB5>
+trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +'::' // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>
+trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װƤ<D7B0><C6A4>
+#39);
end;
IF trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='R'THEN
BEGIN
str.Add ('43:' // Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>
+trim(frm_op_seae.t_op_seae.fieldbyname('<27>¶ȵ<C2B6>λ').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><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('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)
+#39);
END;
IF trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='D'THEN
BEGIN
str.Add ('43:' // Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>
+trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) +':'
+':'
+':'
+#39);
END;
Str.Add(GetMARKSString);
// Str.Add(GetCARGODESCRIPTIONString);
if not bsck.Checked then
sl1.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString)
else sl1.Text:=FormatEdiString(frm_op_seae_assistant.t_op_seae_assistant.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:'+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:'+FormatEdiString(sl.Strings[L],0)+':';
end;
M:=M+1;
end;
S:=S+'''';
Str.Add(S);
Count:=Count+11;
strRmain:='';
try
rs:=Tadoquery.Create(application);
rs.Connection := frm_main.db;
strsql:='select * from t_op_ctn where <20><><EFBFBD><EFBFBD>='
+#39+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39;
rs.Close;
rs.sql.clear;
rs.sql.add(strsql);
rs.Open;
if not rs.IsEmpty then begin
rs.First;
while not rs.Eof do begin
if rs.fieldbyname('<27><>ע').asstring='' then
strtemp:='F'
else
strtemp:=copy(rs.fieldbyname('<27><>ע').asstring,1,1);
str.Add ('51:001:'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+GetCtnCode(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,rs.fieldbyname('<27>ߴ<EFBFBD>').asstring)+':'+strtemp+':'
+trim(IntToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger))+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat))+':'+''''
);
rs.Next;
end;
end;
rs.Close;
rs.Destroy;
except
on e:exception do
begin
rs.Close;
rs.Destroy;
exit;
end;
end;
end;
count:=str.count;
str.Add ('99:'+ inttostr(count+1)+#39);
end;
freeandnil(sl);
freeandnil(sl1);
SaveDialog1.FileName:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').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('EDI','YDSEND',edit1.text);
inifile1.WriteString('EDI','YDRECIEVE',edit2.text);
inifile1.WriteString('EDI','YDPORTLOAD',edit4.text);
inifile1.WriteString('EDI','YDPORTDISCHARG',edit3.text);
inifile1.free;
close;
end;
end.