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_zh.pas

1407 lines
52 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_zh;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,IdFTP,IdFTPCommon,
Dialogs, BusinessSkinForm, StdCtrls, bsSkinCtrls,inifiles, DB, ADODB;
type
Tfrm_op_seae_edi_custom_zh = 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;
bsSkinRadioGroup2: TbsSkinRadioGroup;
bsSkinButton4: TbsSkinButton;
bsSkinGroupBox1: TbsSkinGroupBox;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
t_op_ams: TADOQuery;
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
Label8: TLabel;
Edit8: TEdit;
Label9: TLabel;
Edit9: TEdit;
Label10: TLabel;
Edit10: TEdit;
Label11: TLabel;
Edit11: TEdit;
Label12: TLabel;
Edit12: TEdit;
Label15: TLabel;
Edit15: TEdit;
procedure bsSkinButton2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
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(str:String;Strlength:integer=0):String;
function CreateSIEdiFile_MBL:TStrings;
function GetCntrEdi(cntrsize: String):String;
function GetpkgsEdi(pkgs:String):String;
function GetlineEdi(aline:String):String;
function GetvesselEdi(avessel:String):String;
function GetLengthword(var s: String; l: Integer;str:String): String;
procedure GetLengthTString(var sl:TStringList;l:integer);
function IsZhongwen(Str:String):Boolean;
function Changestr(str:widestring):string;
{ Private declarations }
public
{ Public declarations }
function GetPortStr(Port:String):String;
function GetPPCC(aFree:String):string;
function GetCntrSize(code,Cntr:String):string;
function Getport(code,port:String):string;
function GetCarrCustomNO(sanme:String):string;
end;
var
frm_op_seae_edi_custom_zh: Tfrm_op_seae_edi_custom_zh;
implementation
uses u_op_seae_edi_data, u_main, my_sys_function, u_data_share;
{$R *.dfm}
function Tfrm_op_seae_edi_custom_zh.Changestr(str:widestring):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_custom_zh.GetCarrCustomNO(sanme:String):string;
var
aQuery:TADOQuery;
begin
result:='';
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>ر<EFBFBD><D8B1><EFBFBD> from t_crm_client where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:<3A>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=sanme;
Open;
if (not IsEmpty) and (FieldByName('<27><><EFBFBD>ر<EFBFBD><D8B1><EFBFBD>').AsString<>'') then begin
Result:=FieldByName('<27><><EFBFBD>ر<EFBFBD><D8B1><EFBFBD>').AsString;
end;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_edi_custom_zh.GetPPCC(aFree:String):string;
var
aQuery:TADOQuery;
begin
result:='';
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select <20><><EFBFBD><EFBFBD> from t_code_FREE where <20><><EFBFBD>ѷ<EFBFBD>ʽ=:FREE');
Parameters.ParamByName('FREE').Value:=aFree;
Open;
if (not IsEmpty) and (FieldByName('<27><><EFBFBD><EFBFBD>').AsString<>'') then begin
Result:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
end;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_edi_custom_zh.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 Tfrm_op_seae_edi_custom_zh.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 Tfrm_op_seae_edi_custom_zh.GetPortStr(Port:String):String;
begin
if Pos(',',Port)>0 then
Result:=Copy(Port,1,Pos(',',Port)-1)
else
Result:=Port;
end;
function Tfrm_op_seae_edi_custom_zh.IsZhongwen(Str: String): Boolean;
var
i:Integer;
begin
Result:=false;
if Str='' then Exit;
for i:=1 to Length(Str) do begin
// if Str[i]>Chr(127) then begin
if bytetype(Str[i],1)<>mbsinglebyte then begin
Result:=True;
Exit;
end;
end;
end;
function Tfrm_op_seae_edi_custom_zh.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_custom_zh.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_custom_zh.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_custom_zh.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;
function Tfrm_op_seae_edi_custom_zh.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_edi_custom_zh.bsSkinButton2Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_op_seae_edi_custom_zh.FormShow(Sender: TObject);
var
inifile1:Tinifile;
begin
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
edit1.text:=inifile1.ReadString('customzh','SEND','');
edit2.text:=inifile1.ReadString('customzh','RECIEVE','');
edit3.text:=inifile1.ReadString('customzh','SENDNAME','');
edit4.text:=inifile1.ReadString('customzh','FTPSERVER','');
edit5.text:=inifile1.ReadString('customzh','FTPPATH','/');
edit6.text:=inifile1.ReadString('customzh','FTPNAME','');
edit7.text:=inifile1.ReadString('customzh','FTPPASS','');
edit8.text:=inifile1.ReadString('customzh','SENDDEPT','');
edit9.text:=inifile1.ReadString('customzh','SENDATTN','');
edit10.text:=inifile1.ReadString('customzh','SENDTEL','');
edit11.text:=inifile1.ReadString('customzh','SENDFAX','');
edit12.text:=inifile1.ReadString('customzh','SENDEMAIL','');
// edit13.text:=inifile1.ReadString('customzh','ESINAME','');
// edit14.text:=inifile1.ReadString('customzh','ESIPASS','');
inifile1.free;
//82916891 л
t_op_ams.close;
t_op_ams.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
t_op_ams.open;
end;
procedure Tfrm_op_seae_edi_custom_zh.bsSkinButton1Click(Sender: TObject);
var
Str:TStrings;
inifile1:Tinifile;
i:integer;
begin
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
inifile1.WriteString('customzh','SEND',edit1.text);
inifile1.WriteString('customzh','RECIEVE',edit2.text);
inifile1.WriteString('customzh','SENDNAME',edit3.text);
inifile1.WriteString('customzh','FTPSERVER',edit4.text);
inifile1.WriteString('customzh','FTPPATH',edit5.text);
inifile1.WriteString('customzh','FTPNAME',edit6.text);
inifile1.WriteString('customzh','FTPPASS',edit7.text);
inifile1.WriteString('customzh','SENDDEPT',edit8.text);
inifile1.WriteString('customzh','SENDATTN',edit9.text);
inifile1.WriteString('customzh','SENDTEL',edit10.text);
inifile1.WriteString('customzh','SENDFAX',edit11.text);
inifile1.WriteString('customzh','SENDEMAIL',edit12.text);
// inifile1.WriteString('customzh','ESINAME',edit13.text);
// inifile1.WriteString('customzh','ESIPASS',edit14.text);
inifile1.free;
str:=Tstringlist.Create;
try
Str:=CreateSIEdiFile_MBL;
for i:=0 to Str.Count-1 do begin
if IsZhongwen(Str[i]) then begin
if MessageDlg('<27><>Ʊҵ<C6B1><D2B5><EFBFBD><EFBFBD><EFBFBD>ܺ<EFBFBD><DCBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>,ȷʵҪ<CAB5><D2AA><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbYes,mbNo],0)=mrNo then
exit;
end;
end;
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_edi_custom_zh.isEditrue(DataSet:TDataSet): boolean;
var
cntrs:String;
begin
result:=true;
if trim(Edit1.text)='' then
begin
result:=false;
MessageDlg('<27><><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(Edit2.text)='' then
begin
result:=false;
MessageDlg('<27><><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>').AsString='' then
begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring)='' then
begin
result:=false;
MessageDlg('<27><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)='' then
begin
result:=false;
MessageDlg('<27><><EFBFBD>ѷ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD>β<EFBFBD><CEB2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('װ<>۴<EFBFBD><DBB4><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('װ<><D7B0><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD>ص㲻<D8B5><E3B2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('Ŀ<>ĵز<C4B5><D8B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('ǩ<><C7A9><EFBFBD>ص<EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('ǩ<><C7A9><EFBFBD>ص㲻<D8B5><E3B2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(GetpkgsEdi(DataSet.fieldbyname('<27><>װ').asstring))='' then begin
result:=false;
MessageDlg('<27><>װEDI<44><49><EFBFBD><EFBFBD><EBB2BB><EFBFBD><EFBFBD>!',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('<27><>ͷ').asstring)='' then begin
result:=false;
MessageDlg('<27><>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asinteger=0 then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asFloat=0 then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asFloat=0 then begin
result:=false;
MessageDlg('<27>ܳ<EFBFBD><DCB3><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='D' then
begin
if Trim(DataSet.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('Σ<><CEA3>Ʒ<EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if Trim(DataSet.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if GetStrNum(Trim(DataSet.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring))<>4 then begin
result:=false;
MessageDlg('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>ű<EFBFBD><C5B1><EFBFBD><EFBFBD><EFBFBD><34><CEBB><EFBFBD><EFBFBD>',mtWarning,[mbOk],0);
exit;
end;
end;
if trim(DataSet.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='R' then begin
if Trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD>¶Ȳ<C2B6><C8B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if Trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
end;
t_op_ctn.close;
t_op_ctn.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
t_op_ctn.open;
if t_op_ctn.IsEmpty then begin
result:=false;
MessageDlg('<27><>װ<EFBFBD><EFBFBD><E4B2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
t_op_ctn.First;
while not t_op_ctn.Eof do begin
if Trim(t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>',mtWarning,[mbOk],0);
exit;
end;
if Trim(t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>',mtWarning,[mbOk],0);
exit;
end;
t_op_ctn.Next;
end;
if iszhongwen(dataset.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').AsString) then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>',mtWarning,[mbOk],0);
exit;
end;
if iszhongwen(dataset.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').AsString) then begin
result:=false;
MessageDlg('<27>ջ<EFBFBD><D5BB>˲<EFBFBD><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>',mtWarning,[mbOk],0);
exit;
end;
if iszhongwen(dataset.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').AsString) then begin
result:=false;
MessageDlg('֪ͨ<CDA8>˲<EFBFBD><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>',mtWarning,[mbOk],0);
exit;
end;
if iszhongwen(dataset.fieldbyname('<27><>ͷ').AsString) then begin
result:=false;
MessageDlg('<27><>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>',mtWarning,[mbOk],0);
exit;
end;
if iszhongwen(dataset.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString) then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>',mtWarning,[mbOk],0);
exit;
end;
end;
function Tfrm_op_seae_edi_custom_zh.CreateSIEdiFile_MBL:TStrings;
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,TransType:string;
strDatetime:string;
SenderCode,ReciverCode:string;
aAdoQuery:TAdoQuery;
begin
if not isEditrue(frm_op_seae_edi_data.t_op_seae) then
begin
Exit;
end;
aAdoQuery:=CreateAdoQuery;
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:='5'
else strType:='9';
// ShowMessage(IntToStr(frm_op_seae_edi_data.dxdbgrid1.SelectedCount));
if frm_op_seae_edi_data.dxdbgrid1.SelectedCount<=1 then
begin
str:=Tstringlist.Create;
str.Clear;
str.Add('00:IFCSUM:MANIFEST:'+trim(strType)+':'+ SenderCode+':'+ReciverCode+':'+GetDatetime(datetimetostr(now),4)+':1.0'+#39);
//
Count:=0;
str.Add ('10'
+':'+frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>IMO').asstring // 2 <20><><EFBFBD><EFBFBD>IMO<4D><4F><EFBFBD><EFBFBD>
+':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString) //3<><33><EFBFBD><EFBFBD>
+':' //4<><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //5<><35><EFBFBD><EFBFBD>
+#39);
str.Add('11'
+':'+frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>').AsString //2 <20><><EFBFBD><EFBFBD>˾(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<29><><EFBFBD><EFBFBD>
+':' //3 <20><><EFBFBD><EFBFBD>˾(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
+ #39);
if pos('FREIGHT PREPAID',trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)) >0 then
xtype := 'PO'
else if pos('FREIGHT COLLECT',trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)) >0 then
xtype := 'CC'
else xtype := 'PO';
if uppercase(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='CY-CY' then
TransType:='10'
else if uppercase(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='DOOR-DOOR' then
TransType:='27'
else if uppercase(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='DOOR-PIER' then
TransType:='28'
else if uppercase(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='PIER-DOOR' then
TransType:='29'
else TransType:='10'; // PIER TO PIER
str.add('12:' + trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring) //2<><32><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>
+':' //3 ǰ<><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4B4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //4 ǰ<><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4B4AC>
+':' //5 ǰ<><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4BABD>
+':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('Ŀ<>Ĵ<EFBFBD><C4B4><EFBFBD>').asstring) //6 <20>ջ<EFBFBD><D5BB>ش<EFBFBD><D8B4><EFBFBD>
+':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring) //7<>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring) //8װ<38><D7B0><EFBFBD>۴<EFBFBD><DBB4><EFBFBD>
+':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring) //9װ<39><D7B0><EFBFBD><EFBFBD>
+':'+TransType //10<31><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+ XType //11<31><31><EFBFBD>ʽ<EEB7BD><CABD><EFBFBD>˷<EFBFBD>֧<EFBFBD><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+ GetDatetime(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,1) +'086'//12 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ں<EFBFBD>ʱ<EFBFBD>
+':' //13<31><33><EFBFBD>ߴ<EFBFBD><DFB4><EFBFBD>
+':' //14ǩ<34><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //15<31><35><EFBFBD>֣<EFBFBD><D6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CDB4>
+':' //16 <20><><EFBFBD><EFBFBD>
+':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring) //17 <20><><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>
+#39);
str.add('13:' + trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) //2ж<32><D0B6><EFBFBD>ش<EFBFBD><D8B4><EFBFBD> ???
+':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring) //3ж<33><D0B6><EFBFBD><EFBFBD>
+':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('Ŀ<>Ĵ<EFBFBD><C4B4><EFBFBD>').asstring) //4<><34><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>
+':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring) //5<><35><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+ ':' // 6 <20><>ת<EFBFBD>۴<EFBFBD><DBB4><EFBFBD>
+ ':' // 7 <20><>ת<EFBFBD><D7AA>
+ ':CN' // 8 <20>ᵥǩ<E1B5A5><C7A9><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EBA3A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵ػ<CBB5><D8BB>߹<EFBFBD><DFB9>Ҵ<EFBFBD><D2B4>
+':' // 9
+':' // 10
+#39);
str.add('16'
+':' //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<><34><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ֵ<EFBFBD>,<2C><><EFBFBD>
+#39);
str.add('17'
+':' //2 <20>ջ<EFBFBD><D5BB>˴<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<>ջ<EFBFBD><D5BB>˵<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ֵ<EFBFBD>,<2C><><EFBFBD>
+#39);
str.add('18'
+':' //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>˵<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ֵ<EFBFBD>,<2C><><EFBFBD>
+#39);
str.Add ('41:1' //2<><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //3<><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //4 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+trim(GetpkgsEdi(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><>װ').asstring)) //5 <20><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><>װ').asstring) // 6 <20><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>
+':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) // 7<><37>ë<EFBFBD><C3AB>
+':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) // 8<><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) // 9<><39><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD>ʽ').asstring)// 10<31><30><EFBFBD><EFBFBD>˰<EFBFBD><CBB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' // 11<31><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' // 12ԭ<32><D4AD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>
+#39);
with aAdoQuery do
begin
Close;sql.Clear;
sql.Add('select <20><><EFBFBD><EFBFBD>');
sql.Add('from t_op_ctn_edi');
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>').asstring;
Open;First;
while not Eof do
begin
str.Add ('42'
+':'+trim(fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //2 <20><><EFBFBD><EFBFBD>
+#39);
Count:=Count+1;
Next;
end;
end;
if trim(frm_op_seae_edi_data.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='D' then
begin
str.Add ('43:'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) //2Σ<32><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
+':none' //3Σ<33><CEA3>Ʒҳ<C6B7><D2B3>
+':' +trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) //4<><34><EFBFBD>Ϲ<EFBFBD>Σ<EFBFBD><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
+':none' //5Σ<35><CEA3>Ʒ<EFBFBD><C6B7>ǩ
+':' //6 Σ<>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //7 <20><><EFBFBD><EFBFBD>Σ<EFBFBD><CEA3>ƷӦ<C6B7><D3A6><EFBFBD><EFBFBD>ʩ<EFBFBD><CAA9>
+':' //8 ҽ<>Ƽ<EFBFBD><C6BC><EFBFBD>ָ<EFBFBD>Ϻ<EFBFBD>
+':' //9 Ӧ<><D3A6><EFBFBD><EFBFBD>ϵ
+':' //10 <20>¶ȼ<C2B6><C8BC><EFBFBD><EFBFBD><EFBFBD>λ
+':' //11 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //12 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //13 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //14 Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //15 Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD>˵绰
+':' //16 Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD><CFB5>EMAIL
+':' //17 Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD>˴<EFBFBD><CBB4><EFBFBD>
+#39);
end
else
if trim(frm_op_seae_edi_data.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='R' then
begin
str.Add ('43:' //2Σ<32><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
+':' //3Σ<33><CEA3>Ʒҳ<C6B7><D2B3>
+':' //4<><34><EFBFBD>Ϲ<EFBFBD>Σ<EFBFBD><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
+':' //5Σ<35><CEA3>Ʒ<EFBFBD><C6B7>ǩ
+':' //6 Σ<>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //7 <20><><EFBFBD><EFBFBD>Σ<EFBFBD><CEA3>ƷӦ<C6B7><D3A6><EFBFBD><EFBFBD>ʩ<EFBFBD><CAA9>
+':' //8 ҽ<>Ƽ<EFBFBD><C6BC><EFBFBD>ָ<EFBFBD>Ϻ<EFBFBD>
+':' //9 Ӧ<><D3A6><EFBFBD><EFBFBD>ϵ
+':C' //10 <20>¶ȼ<C2B6><C8BC><EFBFBD><EFBFBD><EFBFBD>λ
+':'+frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring //11 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //12 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //13 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //14 Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //15 Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD>˵绰
+':' //16 Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD><CFB5>EMAIL
+':' //17 Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD>˴<EFBFBD><CBB4><EFBFBD>
+#39);
end;
Temprslt:=Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><>ͷ').asstring);
Temprslt:=StringReplace(Temprslt,#13#10,' ',[rfReplaceAll]);
str.Add ('44:'
+Temprslt
+ #39);
Temprslt:=Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring);
Temprslt:=StringReplace(Temprslt,#13#10,' ',[rfReplaceAll]);
str.Add ('47:'
+ Temprslt+ ':'
+ #39);
Count:=Count+10;
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
rs.First;
while not rs.Eof do
begin
str.Add ('51:001' //2<><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //3<><33><EFBFBD><EFBFBD>
+':'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //4<><34>Ǧ<EFBFBD><C7A6><EFBFBD><EFBFBD>
+':'+Trim(rs.fieldbyname('<27>ߴ<EFBFBD>').asstring+rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //5<><35>װ<EFBFBD><D7B0><EFBFBD>ߴ<EFBFBD><DFB4><EFBFBD><EFBFBD><EFBFBD>
+':8' //6<><36>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD><DFBF><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD>
+':' +trim(IntToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger)) //7<><37><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat)) //8<><38><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD>
+':0' //9<><39>Ƥ<EFBFBD><C6A4>
+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat)) //10<31><30><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //11
+':' //12
+':' //13
+':' // 14
+':' // 15
+':' // 16
+':2' // 17
+#39);
str.Add ('52'
+':'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //2 <20><>־<EFBFBD><D6BE>
+':M' //3 <20><>־<EFBFBD><D6BE><EFBFBD><EFBFBD>
+':CA' //4 ʩ<>ӷ<EFBFBD>־<EFBFBD><D6BE>
+#39);
Count:=Count+1;
rs.Next;
end;
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);
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;
end
else
begin
str:=Tstringlist.Create;
str.Clear;
str.Add('00:IFCSUM:MANIFEST:'+trim(strType)+':'+ SenderCode+':'+ReciverCode+':'+GetDatetime(datetimetostr(now),4)+':1.0'+#39);
Count:=0;
str.Add ('10'
+':'+frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>IMO').asstring // 2 <20><><EFBFBD><EFBFBD>IMO<4D><4F><EFBFBD><EFBFBD>
+':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString) //3<><33><EFBFBD><EFBFBD>
+':' //4<><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //5<><35><EFBFBD><EFBFBD>
+#39);
str.Add('11'
+':'+frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>').AsString //2 <20><><EFBFBD><EFBFBD>˾(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<29><><EFBFBD><EFBFBD>
+':' //3 <20><><EFBFBD><EFBFBD>˾(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
+ #39);
if pos('FREIGHT PREPAID',trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)) >0 then
xtype := 'PO'
else if pos('FREIGHT COLLECT',trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)) >0 then
xtype := 'CC'
else xtype := 'PO';
for k:=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[k]));
if uppercase(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='CY-CY' then
TransType:='10'
else if uppercase(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='DOOR-DOOR' then
TransType:='27'
else if uppercase(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='DOOR-PIER' then
TransType:='28'
else if uppercase(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='PIER-DOOR' then
TransType:='29'
else TransType:='10'; // PIER TO PIER
str.add('12:' + trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring) //2<><32><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>
+':' //3 ǰ<><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4B4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //4 ǰ<><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4B4AC>
+':' //5 ǰ<><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4BABD>
+':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('Ŀ<>Ĵ<EFBFBD><C4B4><EFBFBD>').asstring) //6 <20>ջ<EFBFBD><D5BB>ش<EFBFBD><D8B4><EFBFBD>
+':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring) //7<>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring) //8װ<38><D7B0><EFBFBD>۴<EFBFBD><DBB4><EFBFBD>
+':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring) //9װ<39><D7B0><EFBFBD><EFBFBD>
+':'+TransType //10<31><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+ XType //11<31><31><EFBFBD>ʽ<EEB7BD><CABD><EFBFBD>˷<EFBFBD>֧<EFBFBD><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+ GetDatetime(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,1) +'086'//12 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ں<EFBFBD>ʱ<EFBFBD>
+':' //13<31><33><EFBFBD>ߴ<EFBFBD><DFB4><EFBFBD>
+':' //14ǩ<34><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //15<31><35><EFBFBD>֣<EFBFBD><D6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CDB4>
+':' //16 <20><><EFBFBD><EFBFBD>
+':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring) //17 <20><><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>
+#39);
str.add('13:' + trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) //2ж<32><D0B6><EFBFBD>ش<EFBFBD><D8B4><EFBFBD> ???
+':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring) //3ж<33><D0B6><EFBFBD><EFBFBD>
+':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('Ŀ<>Ĵ<EFBFBD><C4B4><EFBFBD>').asstring) //4<><34><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>
+':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring) //5<><35><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+ ':' // 6 <20><>ת<EFBFBD>۴<EFBFBD><DBB4><EFBFBD>
+ ':' // 7 <20><>ת<EFBFBD><D7AA>
+ ':CN' // 8 <20>ᵥǩ<E1B5A5><C7A9><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EBA3A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵ػ<CBB5><D8BB>߹<EFBFBD><DFB9>Ҵ<EFBFBD><D2B4>
+':' // 9
+':' // 10
+#39);
str.add('16'
+':' //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<><34><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ֵ<EFBFBD>,<2C><><EFBFBD>
+#39);
str.add('17'
+':' //2 <20>ջ<EFBFBD><D5BB>˴<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<>ջ<EFBFBD><D5BB>˵<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ֵ<EFBFBD>,<2C><><EFBFBD>
+#39);
str.add('18'
+':' //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>˵<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ֵ<EFBFBD>,<2C><><EFBFBD>
+#39);
str.Add ('41:1' //2<><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //3<><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //4 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+trim(GetpkgsEdi(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><>װ').asstring)) //5 <20><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><>װ').asstring) // 6 <20><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>
+':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) // 7<><37>ë<EFBFBD><C3AB>
+':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) // 8<><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) // 9<><39><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD>ʽ').asstring) // 10<31><30><EFBFBD><EFBFBD>˰<EFBFBD><CBB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' // 11<31><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' // 12ԭ<32><D4AD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>
+#39);
with aAdoQuery do
begin
Close;sql.Clear;
sql.Add('select <20><><EFBFBD><EFBFBD>');
sql.Add('from t_op_ctn_edi');
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>').asstring;
Open;First;
while not Eof do
begin
str.Add ('42'
+':'+trim(fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //2 <20><><EFBFBD><EFBFBD>
+#39);
Count:=Count+1;
Next;
end;
end;
if trim(frm_op_seae_edi_data.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='D' then
begin
str.Add ('43:'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) //2Σ<32><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
+':none' //3Σ<33><CEA3>Ʒҳ<C6B7><D2B3>
+':' +trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) //4<><34><EFBFBD>Ϲ<EFBFBD>Σ<EFBFBD><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
+':none' //5Σ<35><CEA3>Ʒ<EFBFBD><C6B7>ǩ
+':' //6 Σ<>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //7 <20><><EFBFBD><EFBFBD>Σ<EFBFBD><CEA3>ƷӦ<C6B7><D3A6><EFBFBD><EFBFBD>ʩ<EFBFBD><CAA9>
+':' //8 ҽ<>Ƽ<EFBFBD><C6BC><EFBFBD>ָ<EFBFBD>Ϻ<EFBFBD>
+':' //9 Ӧ<><D3A6><EFBFBD><EFBFBD>ϵ
+':' //10 <20>¶ȼ<C2B6><C8BC><EFBFBD><EFBFBD><EFBFBD>λ
+':' //11 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //12 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //13 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //14 Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //15 Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD>˵绰
+':' //16 Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD><CFB5>EMAIL
+':' //17 Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD>˴<EFBFBD><CBB4><EFBFBD>
+#39);
end
else
if trim(frm_op_seae_edi_data.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='R' then
begin
str.Add ('43:' //2Σ<32><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
+':' //3Σ<33><CEA3>Ʒҳ<C6B7><D2B3>
+':' //4<><34><EFBFBD>Ϲ<EFBFBD>Σ<EFBFBD><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
+':' //5Σ<35><CEA3>Ʒ<EFBFBD><C6B7>ǩ
+':' //6 Σ<>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //7 <20><><EFBFBD><EFBFBD>Σ<EFBFBD><CEA3>ƷӦ<C6B7><D3A6><EFBFBD><EFBFBD>ʩ<EFBFBD><CAA9>
+':' //8 ҽ<>Ƽ<EFBFBD><C6BC><EFBFBD>ָ<EFBFBD>Ϻ<EFBFBD>
+':' //9 Ӧ<><D3A6><EFBFBD><EFBFBD>ϵ
+':C' //10 <20>¶ȼ<C2B6><C8BC><EFBFBD><EFBFBD><EFBFBD>λ
+':'+frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring //11 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //12 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //13 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //14 Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //15 Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD>˵绰
+':' //16 Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD><CFB5>EMAIL
+':' //17 Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD>˴<EFBFBD><CBB4><EFBFBD>
+#39);
end;
Temprslt:=Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><>ͷ').asstring);
Temprslt:=StringReplace(Temprslt,#13#10,' ',[rfReplaceAll]);
str.Add ('44:'
+Temprslt
+ #39);
Temprslt:=Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring);
Temprslt:=StringReplace(Temprslt,#13#10,' ',[rfReplaceAll]);
str.Add ('47:'
+ Temprslt+ ':'
+ #39);
Count:=Count+10;
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
rs.First;
while not rs.Eof do
begin
str.Add ('51:001' //2<><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //3<><33><EFBFBD><EFBFBD>
+':'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //4<><34>Ǧ<EFBFBD><C7A6><EFBFBD><EFBFBD>
+':'+Trim(rs.fieldbyname('<27>ߴ<EFBFBD>').asstring+rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //5<><35>װ<EFBFBD><D7B0><EFBFBD>ߴ<EFBFBD><DFB4><EFBFBD><EFBFBD><EFBFBD>
+':8' //6<><36>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD><DFBF><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD>
+':' +trim(IntToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger)) //7<><37><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat)) //8<><38><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD>
+':0' //9<><39>Ƥ<EFBFBD><C6A4>
+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat)) //10<31><30><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':' //11
+':' //12
+':' //13
+':' // 14
+':' // 15
+':' // 16
+':2' // 17
+#39);
str.Add ('52'
+':'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //2 <20><>־<EFBFBD><D6BE>
+':M' //3 <20><>־<EFBFBD><D6BE><EFBFBD><EFBFBD>
+':CA' //4 ʩ<>ӷ<EFBFBD>־<EFBFBD><D6BE>
+#39);
Count:=Count+1;
rs.Next;
end;
end;
rs.Close;
rs.Destroy;
except
on e:exception do
begin
rs.Close;
rs.Destroy;
exit;
end;
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;
end;
str.Add ('99:'+ inttostr(Count+2)+#39);
end;
Result:=str;
close;
end;
function Tfrm_op_seae_edi_custom_zh.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_edi_custom_zh.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_edi_custom_zh.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_edi_custom_zh.GetvesselEdi(avessel: String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_code_vessel where Ӣ<>Ĵ<EFBFBD><C4B4><EFBFBD>='''+avessel+'''');
Open;
if IsEmpty then
Result:=''
else
Result:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
procedure Tfrm_op_seae_edi_custom_zh.bsSkinButton3Click(Sender: TObject);
var
IdFTP1:TIdFTP;
str:widestring;
str_file:widestring;
ftpar,ftpname,ftppass,ftppath,ScriptPath:String;
StrL:TStrings;
inifile1:Tinifile;
i:integer;
begin
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
inifile1.WriteString('customzh','SEND',edit1.text);
inifile1.WriteString('customzh','RECIEVE',edit2.text);
inifile1.WriteString('customzh','SENDNAME',edit3.text);
inifile1.WriteString('customzh','FTPSERVER',edit4.text);
inifile1.WriteString('customzh','FTPPATH',edit5.text);
inifile1.WriteString('customzh','FTPNAME',edit6.text);
inifile1.WriteString('customzh','FTPPASS',edit7.text);
inifile1.WriteString('customzh','SENDDEPT',edit8.text);
inifile1.WriteString('customzh','SENDATTN',edit9.text);
inifile1.WriteString('customzh','SENDTEL',edit10.text);
inifile1.WriteString('customzh','SENDFAX',edit11.text);
inifile1.WriteString('customzh','SENDEMAIL',edit12.text);
// inifile1.WriteString('customzh','SINAME',edit13.text);
// inifile1.WriteString('customzh','SIPASS',edit14.text);
inifile1.free;
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
StrL:=CreateSIEdiFile_MBL;
for i:=0 to StrL.Count-1 do begin
if IsZhongwen(StrL[i]) then begin
if MessageDlg('<27><>Ʊҵ<C6B1><D2B5><EFBFBD><EFBFBD><EFBFBD>ܺ<EFBFBD><DCBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>,ȷʵҪ<CAB5><D2AA><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbYes,mbNo],0)=mrNo then
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_edi_custom_zh.bsSkinButton4Click(Sender: TObject);
begin
if frm_op_seae_edi_custom_zh.Height=349 then
frm_op_seae_edi_custom_zh.Height:=200
else
frm_op_seae_edi_custom_zh.Height:=349;
end;
end.