|
|
unit u_op_seae_dscangdan;
|
|
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,IdFTP,IdFTPCommon,
|
|
|
Dialogs, BusinessSkinForm, StdCtrls, bsSkinCtrls,inifiles, DB, ADODB,IdHTTP,superobject;
|
|
|
|
|
|
type
|
|
|
Tfrm_op_seae_dscangdan = class(TForm)
|
|
|
bsBusinessSkinForm1: TbsBusinessSkinForm;
|
|
|
Label2: TLabel;
|
|
|
Edit2: TEdit;
|
|
|
Edit1: TEdit;
|
|
|
Label1: TLabel;
|
|
|
SaveDialog1: TSaveDialog;
|
|
|
bsSkinButton2: TbsSkinButton;
|
|
|
bsSkinButton3: TbsSkinButton;
|
|
|
t_op_ctn: TADOQuery;
|
|
|
t_op_ctn1: TDataSource;
|
|
|
Label3: TLabel;
|
|
|
Edit3: TEdit;
|
|
|
t_op_ams: TADOQuery;
|
|
|
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
|
|
|
procedure bsSkinButton2Click(Sender: TObject);
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
|
procedure bsSkinButton3Click(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:string;
|
|
|
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_dscangdan: Tfrm_op_seae_dscangdan;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
uses u_op_seae_edi_data, u_main, my_sys_function, u_data_share, u_op_seae;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
function Tfrm_op_seae_dscangdan.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_dscangdan.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_dscangdan.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_dscangdan.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_dscangdan.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_dscangdan.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_dscangdan.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_dscangdan.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_dscangdan.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_dscangdan.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_dscangdan.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_dscangdan.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_dscangdan.bsSkinButton2Click(Sender: TObject);
|
|
|
begin
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_dscangdan.FormShow(Sender: TObject);
|
|
|
var
|
|
|
inifile1:Tinifile;
|
|
|
begin
|
|
|
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
|
|
|
edit1.text:=inifile1.ReadString('MYSHIPPING','UID','');
|
|
|
edit2.text:=inifile1.ReadString('MYSHIPPING','SKEY','');
|
|
|
edit3.text:=inifile1.ReadString('MYSHIPPING','URL','http://myshipping.net:8654/Interface/CustEDI.ashx');
|
|
|
inifile1.free;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_dscangdan.bsSkinButton1Click(Sender: TObject);
|
|
|
var
|
|
|
Str:string;
|
|
|
inifile1:Tinifile;
|
|
|
i:integer;
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
|
|
|
inifile1.WriteString('MYSHIPPING','UID',edit1.text);
|
|
|
inifile1.WriteString('MYSHIPPING','SKEY',edit2.text);
|
|
|
inifile1.WriteString('MYSHIPPING','URL',edit3.text);
|
|
|
|
|
|
inifile1.free;
|
|
|
|
|
|
|
|
|
try
|
|
|
Str:=CreateSIEdiFile_MBL;
|
|
|
|
|
|
finally
|
|
|
end;
|
|
|
|
|
|
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
function Tfrm_op_seae_dscangdan.isEditrue(DataSet:TDataSet): boolean;
|
|
|
var
|
|
|
cntrs,substr: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('ж<><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('Ŀ<>ĵ<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(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>벻<EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
if (trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˵绰').asstring)='') and (trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='') then begin
|
|
|
result:=false;
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD>˵绰<CBB5><E7BBB0><EFBFBD>䲻<EFBFBD><E4B2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
substr:=trim(DataSet.fieldbyname('<27>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring);
|
|
|
substr:=StringReplace(substr,' ','',[rfReplaceAll]);
|
|
|
substr:=UpperCase(substr);
|
|
|
if ((Length(substr)>=7) and (Copy(substr,1,7)='TOORDER')) OR ((Length(substr)>=10) and (Copy(substr,1,10)='TOTHEORDER')) then begin
|
|
|
|
|
|
if trim(DataSet.fieldbyname('֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>벻<EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
if trim(DataSet.fieldbyname('֪ͨ<CDA8>˹<EFBFBD><CBB9>Ҵ<EFBFBD><D2B4><EFBFBD>').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('֪ͨ<CDA8>˹<EFBFBD><CBB9>Ҵ<EFBFBD><D2B4>벻<EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
end else begin
|
|
|
|
|
|
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>4λ<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_dscangdan.CreateSIEdiFile_MBL:string;
|
|
|
var
|
|
|
str,str2,codetype,codestr,strsql:string;
|
|
|
aAdoQuery:TAdoQuery;
|
|
|
isfirst:Boolean;
|
|
|
TempStr:TStringlist;
|
|
|
function getcustedi(cust:string):string;
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
result:='';
|
|
|
try
|
|
|
aQuery.Close;
|
|
|
aQuery.SQL.Text:='select EDI<44><49><EFBFBD><EFBFBD> from t_crm_client where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+cust+'''';
|
|
|
aQuery.Open;
|
|
|
if not aQuery.IsEmpty then
|
|
|
result:=aQuery.fieldbyname('EDI<44><49><EFBFBD><EFBFBD>').AsString;
|
|
|
if Result='' then result:=cust;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
end;
|
|
|
begin
|
|
|
t_op_ams.Close;
|
|
|
t_op_ams.parameters[0].value:=frm_op_seae.t_op_seae['<27><><EFBFBD><EFBFBD>'];
|
|
|
t_op_ams.open;
|
|
|
aAdoQuery:=CreateAdoQuery;
|
|
|
TempStr:=TStringList.Create;
|
|
|
try
|
|
|
str:=str+'"MBLNO":"'+ frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring+'"';
|
|
|
// str:=str+',"HBLNO":"'+ frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring+'"';
|
|
|
str:=str+',"ETD":"'+ frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+'"';
|
|
|
str:=str+',"FORWARDER":"'+ getcustedi(frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD>').asstring)+'"';
|
|
|
str:=str+',"VESSEL":"'+ frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'"';
|
|
|
str:=str+',"VOYNO":"'+ frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'"';
|
|
|
str:=str+',"CARRIER":"'+ getcustedi(frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD>˾').asstring)+'"';
|
|
|
TempStr.Text:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').AsString;
|
|
|
if TempStr.Count>=1 then
|
|
|
str:=str+',"SHIPPERNAME":"'+StringReplace(StringReplace(TempStr.Strings[0],'&','%26',[rfReplaceAll]),'"','\"',[rfReplaceAll])+'"'
|
|
|
else str:=str+',"SHIPPERNAME":""';
|
|
|
if TempStr.Count>=2 then
|
|
|
str:=str+',"SHIPPERADDR1":"'+StringReplace(StringReplace(TempStr.Strings[1],'&','%26',[rfReplaceAll]),'"','\"',[rfReplaceAll])+'"'
|
|
|
else str:=str+',"SHIPPERADDR1":""';
|
|
|
str:=str+',"SHIPPERCOUNTRY":"'+ t_op_ams.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>˹<EFBFBD><CBB9>Ҵ<EFBFBD><D2B4><EFBFBD>').asstring+'"';
|
|
|
str:=str+',"SHIPPERTEL":"'+t_op_ams.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>绰').asstring+'"';
|
|
|
str2:=t_op_ams.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>').asstring;
|
|
|
codetype:='';
|
|
|
codestr:='';
|
|
|
if Pos('+',str2)>0 then begin
|
|
|
codetype:=Copy(str2,1,Pos('+',str2)-1);
|
|
|
codestr:=Copy(str2,Pos('+',str2)+1,(length(str2)-Pos('+',str2)));
|
|
|
end else codestr:=str2;
|
|
|
str:=str+',"LEIXINGFA":"'+ codetype+'"';
|
|
|
str:=str+',"SHIPPERCODE":"'+ codestr+'"';
|
|
|
TempStr.Text:=frm_op_seae.t_op_seae.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').AsString;
|
|
|
if TempStr.Count>=1 then
|
|
|
str:=str+',"CONSIGNEENAME":"'+StringReplace(StringReplace(TempStr.Strings[0],'&','%26',[rfReplaceAll]),'"','\"',[rfReplaceAll])+'"'
|
|
|
else str:=str+',"CONSIGNEENAME":""';
|
|
|
if TempStr.Count>=2 then
|
|
|
str:=str+',"CONSIGNEEADDR1":"'+StringReplace(StringReplace(TempStr.Strings[1],'&','%26',[rfReplaceAll]),'"','\"',[rfReplaceAll])+'"'
|
|
|
else str:=str+',"CONSIGNEEADDR1":""';
|
|
|
str:=str+',"CONSIGNEECOUNTRY":"'+ t_op_ams.FieldByName('<27>ջ<EFBFBD><D5BB>˹<EFBFBD><CBB9>Ҵ<EFBFBD><D2B4><EFBFBD>').asstring+'"';
|
|
|
str:=str+',"CONSIGNEETEL":"'+ t_op_ams.FieldByName('<27>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>绰').asstring+'"';
|
|
|
str2:=t_op_ams.FieldByName('<27>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>').asstring;
|
|
|
codetype:='';
|
|
|
codestr:='';
|
|
|
if Pos('+',str2)>0 then begin
|
|
|
codetype:=Copy(str2,1,Pos('+',str2)-1);
|
|
|
codestr:=Copy(str2,Pos('+',str2)+1,(length(str2)-Pos('+',str2)));
|
|
|
end else codestr:=str2;
|
|
|
str:=str+',"LEIXINGSHOU":"'+ codetype+'"';
|
|
|
str:=str+',"CONSIGNEECODE":"'+ codestr+'"';
|
|
|
TempStr.Text:=frm_op_seae.t_op_seae.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').AsString;
|
|
|
if TempStr.Count>=1 then
|
|
|
str:=str+',"NOTIFYPARTYNAME":"'+StringReplace(StringReplace(TempStr.Strings[0],'&','%26',[rfReplaceAll]),'"','\"',[rfReplaceAll])+'"'
|
|
|
else str:=str+',"NOTIFYPARTYNAME":""';
|
|
|
if TempStr.Count>=2 then
|
|
|
str:=str+',"NOTIFYPARTYADDR1":"'+StringReplace(StringReplace(TempStr.Strings[1],'&','%26',[rfReplaceAll]),'"','\"',[rfReplaceAll])+'"'
|
|
|
else str:=str+',"NOTIFYPARTYADDR1":""';
|
|
|
str:=str+',"NOTIFYPARTYCOUNTRY":"'+ t_op_ams.FieldByName('֪ͨ<CDA8>˹<EFBFBD><CBB9>Ҵ<EFBFBD><D2B4><EFBFBD>').asstring+'"';
|
|
|
str:=str+',"NOTIFYPARTYTEL":"'+ t_op_ams.FieldByName('֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD>ϵ<EFBFBD>绰').asstring+'"';
|
|
|
str2:=t_op_ams.FieldByName('֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>').asstring;
|
|
|
codetype:='';
|
|
|
codestr:='';
|
|
|
if Pos('+',str2)>0 then begin
|
|
|
codetype:=Copy(str2,1,Pos('+',str2)-1);
|
|
|
codestr:=Copy(str2,Pos('+',str2)+1,(length(str2)-Pos('+',str2)));
|
|
|
end else codestr:=str2;
|
|
|
str:=str+',"LEIXINGTONG":"'+ codetype+'"';
|
|
|
str:=str+',"NOTIFYPARTYCODE":"'+ codestr+'"';
|
|
|
str:=str+',"PORTLOAD":"QINGDAO,CHINA"';
|
|
|
str:=str+',"PORTLOADID":"CNTAO"';
|
|
|
str:=str+',"PORTLOAD":"QINGDAO,CHINA"';
|
|
|
str:=str+',"PORTLOADID":"CNTAO"';
|
|
|
str:=str+',"PORTDISCHARGE":"'+ frm_op_seae.t_op_seae.FieldByName('ж<><D0B6><EFBFBD><EFBFBD>').asstring+'"';
|
|
|
str:=str+',"PORTDISCHARGEID":"'+ frm_op_seae.t_op_seae.FieldByName('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+'"';
|
|
|
str:=str+',"MARKS":"'+ frm_op_seae.t_op_seae.FieldByName('<27><>ͷ').asstring+'"';
|
|
|
str:=str+',"DESCRIPTION":"'+ StringReplace(StringReplace(frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,'&','%26',[rfReplaceAll]),'"','\"',[rfReplaceAll])+'"';
|
|
|
str:=str+',"CARGOID":"'+ frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring+'"';
|
|
|
str:=str+',"KINDPKGS":"'+ frm_op_seae.t_op_seae.FieldByName('<27><>װ').asstring+'"';
|
|
|
str:=str+',"TEMPSET":"'+ frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>').asstring+'"';
|
|
|
str:=str+',"DCLASS":"'+ frm_op_seae.t_op_seae.FieldByName('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring+'"';
|
|
|
str:=str+',"DUNNO":"'+ frm_op_seae.t_op_seae.FieldByName('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring+'"';
|
|
|
str:=str+',"DATTN":"'+t_op_ams.FieldByName('Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD><CFB5>').asstring+'"';
|
|
|
str:=str+',"DTEL":"'+t_op_ams.FieldByName('Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD><CFB5>ʽ').asstring+'"';
|
|
|
if (frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring='R') then
|
|
|
str:=str+',"TEMPID":"C"'
|
|
|
else str:=str+',"TEMPID":""';
|
|
|
str:=str+',"REEFERF":"'+ frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>').asstring+'"';
|
|
|
|
|
|
strsql:='select * from t_op_ctn where <20><><EFBFBD><EFBFBD>='
|
|
|
+#39+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39;
|
|
|
aAdoQuery.Close;
|
|
|
aAdoQuery.SQL.Text:=strsql;
|
|
|
aAdoQuery.Open;
|
|
|
aAdoQuery.First;
|
|
|
str:=str+'},CTNDATA:[';
|
|
|
isfirst:=true;
|
|
|
while not aAdoQuery.Eof do begin
|
|
|
if (isfirst) then str:=str+'{' else str:=str+',{';
|
|
|
str:=str+'"SIZE":"'+aAdoQuery.FieldByName('<27>ߴ<EFBFBD>').asstring+'"';
|
|
|
str:=str+',"CTN":"'+aAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'"';
|
|
|
str:=str+',"CTNALL":"'+StringReplace(aAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').asstring,'''','',[])+'"';
|
|
|
str:=str+',"CNTRNO":"'+aAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'"';
|
|
|
str:=str+',"SEALNO":"'+aAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'"';
|
|
|
str:=str+',"PKGS":"'+aAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'"';
|
|
|
str:=str+',"KINDPKGS":"'+GetpkgsEdi(aAdoQuery.FieldByName('<27><>װ').asstring)+'"';
|
|
|
str:=str+',"KGS":"'+aAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'"';
|
|
|
str:=str+',"CBM":"'+aAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'"';
|
|
|
str:=str+',"APICTNID":"'+aAdoQuery.FieldByName('ctn_id').asstring+'"';
|
|
|
str:=str+'}';
|
|
|
isfirst:=false;
|
|
|
aAdoQuery.Next;
|
|
|
end;
|
|
|
str:=str+']';
|
|
|
|
|
|
finally
|
|
|
FreeAndNil(aAdoQuery);
|
|
|
FreeAndNil(TempStr);
|
|
|
end;
|
|
|
|
|
|
Result:=str;
|
|
|
end;
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_dscangdan.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_dscangdan.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_dscangdan.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_dscangdan.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_dscangdan.bsSkinButton3Click(Sender: TObject);
|
|
|
var
|
|
|
IdHttp : TIdHTTP;
|
|
|
Url,StrL,JSONSTR,errmsg : string;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
|
|
ResponseStream : TStringStream; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
ResponseStr: string;
|
|
|
RequestStr : string; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
RequestStream : TStringStream;
|
|
|
jo: ISuperObject;
|
|
|
inifile1:TIniFile;
|
|
|
i,k:Integer;
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><CBB6><EFBFBD>164866419 //155647655626499408 <20><><EFBFBD><EFBFBD>
|
|
|
begin
|
|
|
|
|
|
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
|
|
|
inifile1.WriteString('MYSHIPPING','UID',edit1.text);
|
|
|
inifile1.WriteString('MYSHIPPING','SKEY',edit2.text);
|
|
|
inifile1.WriteString('MYSHIPPING','URL',edit3.text);
|
|
|
inifile1.free;
|
|
|
|
|
|
try
|
|
|
StrL:=CreateSIEdiFile_MBL;
|
|
|
finally
|
|
|
|
|
|
end;
|
|
|
// StrL:=StringReplace(StrL,'&','%26',[rfReplaceAll]);
|
|
|
// StrL:=StringReplace(StrL,'"','///"',[rfReplaceAll]);
|
|
|
// ShowMessage(StrL);
|
|
|
JSONSTR:='[{MDATA:{'+StrL+'}]';
|
|
|
jo := SO(JSONSTR);
|
|
|
IdHttp := TIdHTTP.Create(nil);
|
|
|
IdHTTP.HTTPOptions := IdHTTP.HTTPOptions + [hoKeepOrigProtocol]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>Э<EFBFBD><D0AD><EFBFBD>汾<EFBFBD><E6B1BE>Ч
|
|
|
IdHTTP.ProtocolVersion := pv1_1;
|
|
|
// IdHttp.IOHandler:=frmMsgSvr.IdSSLIOHandlerSocketOpenSSL1;
|
|
|
IdHttp.Request.UserAgent:='Mozilla/3.0 (compatible; Indy Library)';
|
|
|
idhttp.Request.ContentType:='application/x-www-form-urlencoded';
|
|
|
ResponseStream := TStringStream.Create('');
|
|
|
RequestStream := TStringStream.Create('');
|
|
|
|
|
|
try
|
|
|
Url :=edit3.text;
|
|
|
// Url:='http://localhost:64639/Interface/CustEDI.ashx';
|
|
|
try
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD>ʽ<EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD>
|
|
|
RequestStr:='ac=emf&uid='+edit1.text+'&skey='+edit2.text+'&optype=3&data='+jo.AsJSon(True); //<2F><>С<EFBFBD><D0A1>
|
|
|
RequestStream.WriteString(RequestStr);
|
|
|
IdHttp.post(Url,RequestStream,ResponseStream);
|
|
|
except
|
|
|
on e : Exception do
|
|
|
begin
|
|
|
errmsg:=e.Message;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
ResponseStr := ResponseStream.DataString; //<2F><>ȡ<EFBFBD><C8A1>ҳ<EFBFBD><D2B3><EFBFBD>ص<EFBFBD><D8B5><EFBFBD>Ϣ
|
|
|
|
|
|
ResponseStr := UTF8Decode(ResponseStr); //<2F><>ҳ<EFBFBD>еĴ<D0B5><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>UTF8<46><38><EFBFBD><EFBFBD>
|
|
|
if Pos('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD>!',ResponseStr)>0 then begin
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbOk],0);
|
|
|
end else if Pos('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!',ResponseStr)>0 then begin
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!',mtWarning,[mbOk],0);
|
|
|
end else if Pos('"Success": false',ResponseStr)>0 then begin
|
|
|
i:= Pos('"Message":' ,ResponseStr);
|
|
|
k:=Pos('"Data":' ,ResponseStr);
|
|
|
errmsg :=Copy(ResponseStr ,i+11,k-i-11);
|
|
|
errmsg:=StringReplace(errmsg,'<br />','',[]);
|
|
|
MessageDlg('δ<>ϴ<EFBFBD><CFB4>ɹ<EFBFBD>,'+errmsg,mtWarning,[mbOk],0);
|
|
|
end else
|
|
|
begin
|
|
|
ShowMessage('<27><><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD>')
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
finally
|
|
|
IdHttp.Free;
|
|
|
RequestStream.Free;
|
|
|
ResponseStream.Free;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
end.
|