|
|
unit u_op_seae_edi_waiyun;
|
|
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,IdFTP,IdFTPCommon,
|
|
|
Dialogs, BusinessSkinForm, StdCtrls, bsSkinCtrls,inifiles, DB, ADODB,
|
|
|
IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,IdGlobal,
|
|
|
FtpCli, IdExplicitTLSClientServerBase;
|
|
|
|
|
|
type
|
|
|
Tfrm_op_seae_edi_WAIYUN = class(TForm)
|
|
|
bsBusinessSkinForm1: TbsBusinessSkinForm;
|
|
|
Label2: TLabel;
|
|
|
Edit2: TEdit;
|
|
|
Edit1: TEdit;
|
|
|
Label1: TLabel;
|
|
|
SaveDialog1: TSaveDialog;
|
|
|
bsSkinButton1: TbsSkinButton;
|
|
|
bsSkinButton2: TbsSkinButton;
|
|
|
bsSkinButton3: TbsSkinButton;
|
|
|
t_op_ctn: TADOQuery;
|
|
|
t_op_ctn1: TDataSource;
|
|
|
bsSkinRadioGroup1: TbsSkinRadioGroup;
|
|
|
Label3: TLabel;
|
|
|
Edit3: TEdit;
|
|
|
bsSkinGroupBox1: TbsSkinGroupBox;
|
|
|
bsSkinButton4: TbsSkinButton;
|
|
|
Label4: TLabel;
|
|
|
Edit4: TEdit;
|
|
|
Edit5: TEdit;
|
|
|
Label5: TLabel;
|
|
|
Label6: TLabel;
|
|
|
Edit6: TEdit;
|
|
|
Label7: TLabel;
|
|
|
Edit7: TEdit;
|
|
|
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
|
|
|
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
|
|
|
FtpClient1: TFtpClient;
|
|
|
bsSkinButton5: TbsSkinButton;
|
|
|
IdFTP1: TIdFTP;
|
|
|
CheckBox1: TCheckBox;
|
|
|
Memo1: TMemo;
|
|
|
Label8: TLabel;
|
|
|
procedure bsSkinButton2Click(Sender: TObject);
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
|
procedure bsSkinButton3Click(Sender: TObject);
|
|
|
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
|
|
procedure bsSkinButton4Click(Sender: TObject);
|
|
|
procedure FtpClient1Error(Sender: TObject; var Msg: String);
|
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
|
private
|
|
|
function isEditrue(DataSet:TDataSet): boolean;
|
|
|
function GetStrNum(str:String):integer;
|
|
|
function FormatListString(Old:TStrings;mCount,Strlength:integer):String;
|
|
|
function FormatEdiString(old:String;Strlength:integer):String;
|
|
|
function CreateEdiFile:TStrings;
|
|
|
function GetCntrEdi(cntrsize: String):String;
|
|
|
function GetpkgsEdi(pkgs:String):String;
|
|
|
function GetDELIVERYTERMEdiNo(names:String):String;
|
|
|
function GetlineEdi(aline:String):String;
|
|
|
procedure GetLengthTString(var sl: TStringList; l: integer);
|
|
|
function GetLengthword(var s: String; l: Integer;str:String): String;
|
|
|
function GetcustEdi(cust: String): String;
|
|
|
function GetvesselEdi(avessel: String): String;
|
|
|
function GetShipEdiNO(Ship:String): String;
|
|
|
function GetShipEName(Ship:String): String;
|
|
|
function SCNVaild(cust: String): boolean;
|
|
|
|
|
|
{ Private declarations }
|
|
|
public
|
|
|
{ Public declarations }
|
|
|
end;
|
|
|
|
|
|
var
|
|
|
frm_op_seae_edi_WAIYUN: Tfrm_op_seae_edi_WAIYUN;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
uses u_op_seae, u_main, my_sys_function, u_data_share, u_op_seae_assistant;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_WAIYUN.GetShipEdiNO(Ship:String): String;
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('Select <20><><EFBFBD><EFBFBD>,EDI<44><49><EFBFBD><EFBFBD>,<2C><><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>,<2C>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,<2C>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,¼<><C2BC><EFBFBD><EFBFBD>,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_crm_client');
|
|
|
SQL.Add('where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+Ship+'''');
|
|
|
SQL.Add('order by <20><><EFBFBD><EFBFBD>');
|
|
|
Open;
|
|
|
if not IsEmpty then
|
|
|
Result:=Trim(FieldByName('<27><><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring)
|
|
|
else
|
|
|
Result:='';
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
function Tfrm_op_seae_edi_WAIYUN.GetShipEName(Ship:String): String;
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('Select Ӣ<><D3A2>ȫ<EFBFBD><C8AB> from t_crm_client');
|
|
|
SQL.Add('where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+Ship+'''');
|
|
|
SQL.Add('order by <20><><EFBFBD><EFBFBD>');
|
|
|
Open;
|
|
|
if not IsEmpty then
|
|
|
Result:=Trim(FieldByName('Ӣ<><D3A2>ȫ<EFBFBD><C8AB>').asstring)
|
|
|
else
|
|
|
Result:='';
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
function Tfrm_op_seae_edi_WAIYUN.GetvesselEdi(avessel: String): String;
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('Select <20><><EFBFBD><EFBFBD> from t_code_vessel where Ӣ<>Ĵ<EFBFBD><C4B4><EFBFBD>='''+avessel+'''');
|
|
|
Open;
|
|
|
if IsEmpty then
|
|
|
Result:='a'
|
|
|
else
|
|
|
Result:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_WAIYUN.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_WAIYUN.GetLengthword(var s: String; l: Integer;str:String): String;
|
|
|
var
|
|
|
i:Integer;
|
|
|
b:Boolean;
|
|
|
begin
|
|
|
s:='';
|
|
|
if Length(str)<l then begin
|
|
|
result:=str;
|
|
|
end else begin
|
|
|
b:=true;
|
|
|
s:=Copy(str,l+1,Length(str)-l);
|
|
|
str:=Copy(str,1,l);
|
|
|
result:='';
|
|
|
for i:=Length(str) downto 1 do begin
|
|
|
if ( not (str[i] in [' ',',','.',':','(',')'])) and b then
|
|
|
s:=str[i]+s
|
|
|
else begin
|
|
|
b:=false;
|
|
|
result:=str[i]+Result;
|
|
|
end;
|
|
|
end;
|
|
|
s:=s+' ';
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
function Tfrm_op_seae_edi_WAIYUN.FormatEdiString(old:String;Strlength:integer):String;
|
|
|
var
|
|
|
i:integer;
|
|
|
begin
|
|
|
|
|
|
Result:=Trim(Old);
|
|
|
Result:=StringReplace(Result,'?','??',[rfReplaceAll]);
|
|
|
Result:=StringReplace(Result,':','?:',[rfReplaceAll]);
|
|
|
Result:=StringReplace(Result,'''','?''',[rfReplaceAll]);
|
|
|
// Result:=StringReplace(Result,'+','?+',[rfReplaceAll]);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_WAIYUN.FormatListString(Old:TStrings;mCount,Strlength:integer):String;
|
|
|
var
|
|
|
i:integer;
|
|
|
NewStrs:TStrings;
|
|
|
mStr:String;
|
|
|
begin
|
|
|
Result:='';
|
|
|
NewStrs:=TStringList.Create;
|
|
|
for i:=0 to old.Count-1 do begin
|
|
|
if Length(old.Strings[i])<=Strlength then begin
|
|
|
if (Trim(old.Strings[i])<>'') and (Trim(old.Strings[i])<>#10) then
|
|
|
NewStrs.Add(old.Strings[i]);
|
|
|
end else begin
|
|
|
mStr:=old.Strings[i];
|
|
|
while length(mStr)>Strlength do begin
|
|
|
newStrs.Add(copy(mStr,1,Strlength));
|
|
|
system.Delete(mStr,1,Strlength);
|
|
|
end;
|
|
|
newStrs.Add(mStr);
|
|
|
end;
|
|
|
end;
|
|
|
try
|
|
|
for i:=0 to mCount-1 do begin
|
|
|
if i<NewStrs.Count then begin
|
|
|
Result:=Result+FormatEdiString(NewStrs.Strings[i],Strlength);
|
|
|
end;
|
|
|
if i<mCount-1 then
|
|
|
Result:=Result+':';
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(NewStrs);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
function Tfrm_op_seae_edi_WAIYUN.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_WAIYUN.bsSkinButton2Click(Sender: TObject);
|
|
|
begin
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_WAIYUN.FormShow(Sender: TObject);
|
|
|
var
|
|
|
inifile1:Tinifile;
|
|
|
begin
|
|
|
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
|
|
|
edit1.text:=inifile1.ReadString('waiyunEDI','SEND','');
|
|
|
edit2.text:=inifile1.ReadString('waiyunEDI','RECIEVE','');
|
|
|
edit3.text:=inifile1.ReadString('waiyunEDI','SENDNAME','');
|
|
|
edit4.text:=inifile1.ReadString('waiyunEDI','FTPSERVER','');
|
|
|
edit5.text:=inifile1.ReadString('waiyunEDI','FTPPATH','/');
|
|
|
edit6.text:=inifile1.ReadString('waiyunEDI','FTPNAME','');
|
|
|
edit7.text:=inifile1.ReadString('waiyunEDI','FTPPASS','');
|
|
|
inifile1.free;
|
|
|
if FileExists(ExtractFilePath(application.ExeName)+'carriercode.ini') then
|
|
|
Memo1.Lines.LoadFromFile(ExtractFilePath(application.ExeName)+'carriercode.ini');
|
|
|
Edit2.Text:=Memo1.Lines.Values[frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').AsString];
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_WAIYUN.bsSkinButton1Click(Sender: TObject);
|
|
|
var
|
|
|
Str:TStrings;
|
|
|
inifile1:Tinifile;
|
|
|
i:integer;
|
|
|
SenderCode,ReciverCode,strType,FileType:String;
|
|
|
begin
|
|
|
frm_op_seae.t_op_ams.Open;
|
|
|
if bsSkinCheckRadioBox2.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;
|
|
|
|
|
|
if frm_op_seae.dxdbgrid1.SelectedCount>1 then
|
|
|
begin
|
|
|
for i:=0 to frm_op_seae.dxdbgrid1.SelectedCount-1 do
|
|
|
begin
|
|
|
frm_op_seae.t_op_seae.GotoBookmark(pointer(frm_op_seae.dxdbgrid1.selectedrows[i]));
|
|
|
if not isEditrue(frm_op_seae.t_op_seae) then exit;
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if not isEditrue(frm_op_seae.t_op_seae) then exit;
|
|
|
end;
|
|
|
|
|
|
|
|
|
str:=Tstringlist.Create;
|
|
|
try
|
|
|
SenderCode:=trim(edit1.Text) ;
|
|
|
ReciverCode:=trim(edit2.Text) ;
|
|
|
if bsSkinRadioGroup1.ItemIndex=0 then
|
|
|
strType:='9'
|
|
|
else if bsSkinRadioGroup1.ItemIndex=1 then
|
|
|
strType:='2'
|
|
|
else if bsSkinRadioGroup1.ItemIndex=2 then
|
|
|
strType:='3'
|
|
|
else if bsSkinRadioGroup1.ItemIndex=3 then
|
|
|
strType:='4'
|
|
|
else strType:='9';
|
|
|
|
|
|
|
|
|
if bsSkinCheckRadioBox1.Checked then
|
|
|
str.Add('00:IFTMBF:SI:'+trim(strType)+':'+ SenderCode+':'+ReciverCode+':'+GetDatetime(datetimetostr(now),1)+':2.1'+#39)
|
|
|
else
|
|
|
str.Add('00:IFTMBF:BK:'+trim(strType)+':'+ SenderCode+':'+ReciverCode+':'+GetDatetime(datetimetostr(now),1)+':2.1'+#39);
|
|
|
|
|
|
if frm_op_seae.dxdbgrid1.SelectedCount>1 then
|
|
|
begin
|
|
|
for i:=0 to frm_op_seae.dxdbgrid1.SelectedCount-1 do
|
|
|
begin
|
|
|
frm_op_seae.t_op_seae.GotoBookmark(pointer(frm_op_seae.dxdbgrid1.selectedrows[i]));
|
|
|
if Trim(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
|
|
|
Str.AddStrings(CreateEdiFile)
|
|
|
else
|
|
|
Exit;
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if Trim(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
|
|
|
Str.AddStrings(CreateEdiFile)
|
|
|
else
|
|
|
Exit;
|
|
|
end;
|
|
|
|
|
|
|
|
|
I:=str.Count;
|
|
|
str.Add('99:'+intToStr(i+1)+'''');
|
|
|
|
|
|
for i:=0 to Str.Count-1 do begin
|
|
|
if IsZhongwen(Str[i]) then begin
|
|
|
MessageDlg('<27><>Ʊҵ<C6B1><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41>Ȳ<EFBFBD><C8B2>淶<EFBFBD>ַ<EFBFBD>'+Str[i]+',<2C><>ȥ<EFBFBD><C8A5><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD>',mtWarning,[mbYes],0);
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if bsSkinCheckRadioBox1.Checked then
|
|
|
FileType:='SI_'
|
|
|
else FileType:='BK_';
|
|
|
|
|
|
SaveDialog1.FileName:=FileType+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring;
|
|
|
if SaveDialog1.Execute then
|
|
|
begin
|
|
|
str.SaveToFile(SaveDialog1.FileName+'.txt');
|
|
|
showmessage('<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ɳɹ<C9B3><C9B9><EFBFBD>');
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
showmessage('<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(Str);
|
|
|
end;
|
|
|
|
|
|
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
function Tfrm_op_seae_edi_WAIYUN.isEditrue(DataSet:TDataSet): boolean;
|
|
|
var
|
|
|
cntrs:String;
|
|
|
begin
|
|
|
result:=true;
|
|
|
|
|
|
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring)='<27><>Զ' then begin
|
|
|
if not bsSkinCheckRadioBox2.Checked then
|
|
|
begin
|
|
|
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;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring)='' then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('<27>ᵥ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
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('װ<>۴<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>').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('<27><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װƤ<D7B0>ز<EFBFBD><D8B2><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('<27><><EFBFBD><EFBFBD>').asstring)<>'' then begin
|
|
|
if (GetvesselEdi(trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)))='' then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
}
|
|
|
{
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('<27>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˱<EFBFBD><CBB1><EFBFBD>').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('EDI<44><49>ע').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDI<44><49>ע<EFBFBD><D7A2><EFBFBD><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 not bsSkinCheckRadioBox2.Checked then
|
|
|
begin
|
|
|
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;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if trim(GetpkgsEdi(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><>װ').asstring))='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('<27><>װEDI<44><49><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD><EFBFBD>!',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
if trim(frm_op_seae_assistant.t_op_seae_assistant.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(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><>ͷ').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('<27><>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
if frm_op_seae_assistant.t_op_seae_assistant.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 frm_op_seae_assistant.t_op_seae_assistant.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 frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asFloat=0 then begin
|
|
|
result:=false;
|
|
|
MessageDlg('<27>ܳ<EFBFBD><DCB3>벻<EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
if trim(frm_op_seae.t_op_seae.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(frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='D' then begin
|
|
|
if Trim(frm_op_seae.t_op_seae.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(frm_op_seae.t_op_seae.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(frm_op_seae.t_op_seae.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(frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='R' then begin
|
|
|
|
|
|
if Trim(frm_op_seae.t_op_seae.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(frm_op_seae.t_op_seae.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
|
|
|
else
|
|
|
begin
|
|
|
|
|
|
end;
|
|
|
if Trim(frm_op_seae.t_op_seae.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(frm_op_seae.t_op_seae.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;
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
if not bsSkinCheckRadioBox2.Checked then
|
|
|
begin
|
|
|
t_op_ctn.Close;t_op_ctn.SQL.Clear;
|
|
|
t_op_ctn.SQL.Add('select * from t_op_ctn');
|
|
|
t_op_ctn.SQL.Add('where <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
|
|
|
t_op_ctn.SQL.Add('order by <20><><EFBFBD><EFBFBD>');
|
|
|
t_op_ctn.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_op_ctn.Close;t_op_ctn.SQL.Clear;
|
|
|
t_op_ctn.SQL.Add('select * from t_op_ctn_fendan');
|
|
|
t_op_ctn.SQL.Add('where AS_ID=:AS_ID');
|
|
|
t_op_ctn.SQL.Add('order by <20><><EFBFBD><EFBFBD>');
|
|
|
t_op_ctn.Parameters.ParamByName('AS_ID').Value:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('AS_ID').AsInteger;
|
|
|
end;
|
|
|
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(GetCntrEdi(t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring))='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('<27><>װ<EFBFBD><D7B0>EDI<44><49><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD>ڣ<EFBFBD>',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
t_op_ctn.Next;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
function Tfrm_op_seae_edi_WAIYUN.CreateEdiFile:TStrings;
|
|
|
var
|
|
|
str,sl1:Tstringlist;
|
|
|
sl:TStrings;
|
|
|
i,j,Count,l,M:integer;
|
|
|
strsql,strRmain,strtemp,S,tmpDate:string;
|
|
|
rs,aQuery2:Tadoquery;
|
|
|
wide_str:widestring;
|
|
|
k:integer;
|
|
|
strType,strorderno,ctnsource:string;
|
|
|
strDatetime:string;
|
|
|
SenderCode,ReciverCode,shipname,shipaddr,SM:string;
|
|
|
|
|
|
|
|
|
function GetRemarksString:String;
|
|
|
var
|
|
|
TempStr:TStrings;
|
|
|
begin
|
|
|
TempStr:=TStringList.Create;
|
|
|
try
|
|
|
if not bsSkinCheckRadioBox2.Checked then
|
|
|
TempStr.Text:=frm_op_seae.t_op_seae.fieldbyname('EDI<44><49>ע').AsString
|
|
|
else TempStr.Text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('EDI<44><49>ע').AsString;
|
|
|
Result:='17:';
|
|
|
Result:=Result+FormatListString(TempStr,5,35)+'''';
|
|
|
finally
|
|
|
FreeAndNil(TempStr);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
function GetShipperString:String;
|
|
|
var
|
|
|
TempStr:TStringlist;
|
|
|
aQuery:TADOQuery;
|
|
|
M,L:integer;
|
|
|
S:String;
|
|
|
begin
|
|
|
TempStr:=TStringList.Create;
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
if bsSkinCheckRadioBox2.Checked then
|
|
|
TempStr.Text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').AsString
|
|
|
else
|
|
|
TempStr.Text:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').AsString;
|
|
|
GetLengthTString(TempStr,35);
|
|
|
|
|
|
if Tempstr.Count<=9 then begin
|
|
|
Result:='18:';
|
|
|
Result:=Result+':';
|
|
|
Result:=Result+FormatListString(TempStr,9,35)+'''';
|
|
|
end else begin
|
|
|
M:=1;
|
|
|
for L:=0 to Tempstr.Count-1 do begin
|
|
|
if M<=9 then begin
|
|
|
if M=1 then begin
|
|
|
s:='20:'+FormatEdiString(Tempstr.Strings[L],0)+':';
|
|
|
end else begin
|
|
|
if M=9 then
|
|
|
s:=s+FormatEdiString(Tempstr.Strings[L],0)
|
|
|
else
|
|
|
s:=s+FormatEdiString(Tempstr.Strings[L],0)+':';
|
|
|
end;
|
|
|
end else begin
|
|
|
S:=S+'''';
|
|
|
Str.Add(S);
|
|
|
M:=1;
|
|
|
s:='20:'+FormatEdiString(Tempstr.Strings[L],0)+':';
|
|
|
end;
|
|
|
M:=M+1;
|
|
|
end;
|
|
|
S:=S+'''';
|
|
|
Str.Add(S);
|
|
|
result:='';
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(TempStr);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
function GetConsigneString:String;
|
|
|
var
|
|
|
TempStr:TStringlist;
|
|
|
M,L:integer;
|
|
|
S:String;
|
|
|
|
|
|
begin
|
|
|
TempStr:=TStringList.Create;
|
|
|
try
|
|
|
if bsSkinCheckRadioBox2.Checked then
|
|
|
begin
|
|
|
TempStr.Text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').AsString;
|
|
|
end
|
|
|
else
|
|
|
TempStr.Text:=frm_op_seae.t_op_seae.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').AsString;
|
|
|
GetLengthTString(TempStr,35);
|
|
|
|
|
|
|
|
|
if Tempstr.Count<=9 then begin
|
|
|
Result:='19:';
|
|
|
Result:=Result+':';
|
|
|
Result:=Result+FormatListString(TempStr,9,35)+'''';
|
|
|
end else begin
|
|
|
M:=1;
|
|
|
for L:=0 to Tempstr.Count-1 do begin
|
|
|
if M<=9 then begin
|
|
|
if M=1 then begin
|
|
|
s:='21:'+FormatEdiString(Tempstr.Strings[L],0)+':';
|
|
|
end else begin
|
|
|
if M=9 then
|
|
|
s:=s+FormatEdiString(Tempstr.Strings[L],0)
|
|
|
else
|
|
|
s:=s+FormatEdiString(Tempstr.Strings[L],0)+':';
|
|
|
end;
|
|
|
end else begin
|
|
|
S:=S+'''';
|
|
|
Str.Add(S);
|
|
|
M:=1;
|
|
|
s:='21:'+FormatEdiString(Tempstr.Strings[L],0)+':';
|
|
|
end;
|
|
|
M:=M+1;
|
|
|
end;
|
|
|
S:=S+'''';
|
|
|
Str.Add(S);
|
|
|
result:='';
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
FreeAndNil(TempStr);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
function GetNOTIFYString:String;
|
|
|
var
|
|
|
TempStr:TStringlist;
|
|
|
M,L:integer;
|
|
|
S:String;
|
|
|
|
|
|
begin
|
|
|
TempStr:=TStringList.Create;
|
|
|
try
|
|
|
if bsSkinCheckRadioBox2.Checked then
|
|
|
begin
|
|
|
TempStr.Text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').AsString;
|
|
|
end
|
|
|
else
|
|
|
TempStr.Text:=frm_op_seae.t_op_seae.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').AsString;
|
|
|
GetLengthTString(TempStr,35);
|
|
|
|
|
|
if Tempstr.Count<=9 then begin
|
|
|
Result:='20:';
|
|
|
Result:=Result+':';
|
|
|
Result:=Result+FormatListString(TempStr,9,35)+'''';
|
|
|
end else begin
|
|
|
M:=1;
|
|
|
for L:=0 to Tempstr.Count-1 do begin
|
|
|
if M<=9 then begin
|
|
|
if M=1 then begin
|
|
|
s:='22:'+FormatEdiString(Tempstr.Strings[L],0)+':';
|
|
|
end else begin
|
|
|
if M=9 then
|
|
|
s:=s+FormatEdiString(Tempstr.Strings[L],0)
|
|
|
else
|
|
|
s:=s+FormatEdiString(Tempstr.Strings[L],0)+':';
|
|
|
end;
|
|
|
end else begin
|
|
|
S:=S+'''';
|
|
|
Str.Add(S);
|
|
|
M:=1;
|
|
|
s:='22:'+FormatEdiString(Tempstr.Strings[L],0)+':';
|
|
|
end;
|
|
|
M:=M+1;
|
|
|
end;
|
|
|
S:=S+'''';
|
|
|
Str.Add(S);
|
|
|
result:='';
|
|
|
end;
|
|
|
|
|
|
|
|
|
finally
|
|
|
FreeAndNil(TempStr);
|
|
|
end;
|
|
|
end;
|
|
|
//
|
|
|
|
|
|
function GetNOTIFYTwoString:String;
|
|
|
var
|
|
|
TempStr:TStringlist;
|
|
|
aQuery:TADOQuery;
|
|
|
M,L:integer;
|
|
|
S:String;
|
|
|
|
|
|
begin
|
|
|
TempStr:=TStringList.Create;
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('<27>ڶ<EFBFBD>֪ͨ<CDA8><D6AA>').AsString)='' then Exit;
|
|
|
TempStr.Text:=frm_op_seae.t_op_seae.fieldbyname('<27>ڶ<EFBFBD>֪ͨ<CDA8><D6AA>').AsString;
|
|
|
GetLengthTString(TempStr,35);
|
|
|
|
|
|
if Tempstr.Count<=6 then begin
|
|
|
Result:='23:';
|
|
|
Result:=Result+':';
|
|
|
Result:=Result+FormatListString(TempStr,9,35)+'''';
|
|
|
end else begin
|
|
|
M:=1;
|
|
|
for L:=0 to Tempstr.Count-1 do begin
|
|
|
if M<=6 then begin
|
|
|
if M=1 then begin
|
|
|
s:='21:'+FormatEdiString(Tempstr.Strings[L],0)+':';
|
|
|
end else begin
|
|
|
if M=6 then
|
|
|
s:=s+FormatEdiString(Tempstr.Strings[L],0)
|
|
|
else
|
|
|
s:=s+FormatEdiString(Tempstr.Strings[L],0)+':';
|
|
|
end;
|
|
|
end else begin
|
|
|
S:=S+'''';
|
|
|
Str.Add(S);
|
|
|
M:=1;
|
|
|
s:='23:'+FormatEdiString(Tempstr.Strings[L],0)+':';
|
|
|
end;
|
|
|
M:=M+1;
|
|
|
end;
|
|
|
S:=S+'''';
|
|
|
Str.Add(S);
|
|
|
result:='';
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(TempStr);
|
|
|
end;
|
|
|
end;
|
|
|
begin
|
|
|
|
|
|
SenderCode:=trim(edit1.Text) ;
|
|
|
ReciverCode:=trim(edit2.Text) ;
|
|
|
if bsSkinRadioGroup1.ItemIndex=0 then
|
|
|
strType:='9'
|
|
|
else if bsSkinRadioGroup1.ItemIndex=1 then
|
|
|
strType:='2'
|
|
|
else if bsSkinRadioGroup1.ItemIndex=2 then
|
|
|
strType:='3'
|
|
|
else if bsSkinRadioGroup1.ItemIndex=3 then
|
|
|
strType:='4'
|
|
|
else strType:='9';
|
|
|
|
|
|
str:=Tstringlist.Create;
|
|
|
sl:=Tstringlist.Create;
|
|
|
sl1:=Tstringlist.Create;
|
|
|
|
|
|
str.Clear;
|
|
|
Count:=0;
|
|
|
strorderno:='';
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asstring<>'' then
|
|
|
strorderno:=Trim(frm_op_seae.t_op_seae.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asstring)
|
|
|
else strorderno:=Trim(frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring);
|
|
|
|
|
|
if not bsSkinCheckRadioBox2.Checked then //<2F><><EFBFBD><EFBFBD>
|
|
|
begin
|
|
|
str.Add ('02:'+ strorderno //2 <20>˱<EFBFBD><CBB1><EFBFBD>
|
|
|
+':'+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring) //3 <20>ᵥ<EFBFBD><E1B5A5>
|
|
|
+':'+ GetDELIVERYTERMEdiNo(trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)) //4 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
+':'+ trim(Edit3.Text) //5 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>
|
|
|
+':'+ ReciverCode //6 <20><><EFBFBD><EFBFBD><EFBFBD>ܶ<EFBFBD><DCB6>յ<EFBFBD><D5B5>˵Ĵ<CBB5><C4B4><EFBFBD>
|
|
|
+'::::::::::'+trim(frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>').asstring) //16
|
|
|
+':::' //17 18 19
|
|
|
+':' //20
|
|
|
+#39);
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
str.Add ('02:'+ strorderno //2 <20>˱<EFBFBD><CBB1><EFBFBD>
|
|
|
+':'+ trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring) //3 <20>ᵥ<EFBFBD><E1B5A5>
|
|
|
+':'+ GetDELIVERYTERMEdiNo(trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)) //4 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
+':'+ trim(Edit3.Text) //5 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>
|
|
|
+':'+ ReciverCode //6 <20><><EFBFBD><EFBFBD><EFBFBD>ܶ<EFBFBD><DCB6>յ<EFBFBD><D5B5>˵Ĵ<CBB5><C4B4><EFBFBD>
|
|
|
+'::::::::::'+trim(frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>').asstring) //16
|
|
|
+':::' // 17 18 19
|
|
|
+':' //20
|
|
|
+#39);
|
|
|
end;
|
|
|
|
|
|
if not bsSkinCheckRadioBox2.Checked then //<2F><><EFBFBD><EFBFBD>
|
|
|
begin
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
|
|
|
strtemp:='ORI'
|
|
|
else
|
|
|
strtemp:='EXP';
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
|
|
|
strtemp:='ORI'
|
|
|
else
|
|
|
strtemp:='EXP';
|
|
|
end;
|
|
|
str.add('03:'+strtemp //2 <20>ᵥ<EFBFBD><E1B5A5><EFBFBD><EFBFBD>
|
|
|
+':' //3 <20>ᵥǩ<E1B5A5><C7A9><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>
|
|
|
+':'+ trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD>ص<EFBFBD>').asstring) //4<>ᵥǩ<E1B5A5><C7A9><EFBFBD><EFBFBD>
|
|
|
+':'+ GetDatetime(trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring),0) //5ǩ<35><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
+':'+ get_fenshu(trim(frm_op_seae.t_op_seae.fieldbyname('<27>ᵥ<EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring)) //6<><36><EFBFBD><EFBFBD><EFBFBD>ᵥ<EFBFBD><E1B5A5><EFBFBD><EFBFBD>
|
|
|
+':'+ trim(frm_op_seae.t_op_seae.fieldbyname('Ԥ<><D4A4><EFBFBD>ص<EFBFBD>').asstring) //7Ԥ<37><D4A4><EFBFBD>ص<EFBFBD>
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('Ԥ<><D4A4><EFBFBD>ص<EFBFBD>').asstring) //8<><38><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>
|
|
|
+':' +frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>').asstring
|
|
|
+#39);
|
|
|
|
|
|
|
|
|
|
|
|
if (trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)='') and (trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)='') then
|
|
|
tmpDate:=GetDatetime(trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring),0)
|
|
|
else tmpDate:='';
|
|
|
str.Add('11:' + trim(GetvesselEdi(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)) //2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
+':'+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //3 <20><><EFBFBD><EFBFBD>
|
|
|
+':'+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //4<><34><EFBFBD><EFBFBD>
|
|
|
+':' //
|
|
|
+':' //
|
|
|
+':'+GetShipEdiNO(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring) //5<><35><EFBFBD><EFBFBD>˾(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<29><><EFBFBD><EFBFBD>
|
|
|
+':' +GetShipEName(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring)//6
|
|
|
+':'+tmpDate //9
|
|
|
+':::::' //6-14 <20><><EFBFBD><EFBFBD>˾(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<29><><EFBFBD><EFBFBD>
|
|
|
+#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
|
|
|
|
|
|
str.Add ('12:'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring) // 2<>ջ<EFBFBD><D5BB>ش<EFBFBD><D8B4><EFBFBD>
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring) //3
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring) //4
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring) //5
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) //6
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring) //7
|
|
|
+':' //8
|
|
|
+':' //9
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) //10
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>').asstring) //11
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵش<C4B5><D8B4><EFBFBD>').asstring) //12
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring) //13
|
|
|
+':'+trim(GetcustEdi(frm_op_seae.t_op_seae.fieldbyname('<27><>վ').asstring)) //14
|
|
|
+'::' // 15 16
|
|
|
+#39);
|
|
|
|
|
|
|
|
|
if not bsSkinCheckRadioBox2.Checked then //<2F><><EFBFBD><EFBFBD>
|
|
|
begin
|
|
|
if frm_data_share.t_code_free.locate('<27><><EFBFBD>ѷ<EFBFBD>ʽ',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring,[]) then
|
|
|
begin
|
|
|
str.Add ('14:'+frm_data_share.t_code_free.fieldbyname('<27><><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)+#39);
|
|
|
|
|
|
str.Add('15:' //2
|
|
|
+':' //3
|
|
|
+':'+trim(frm_data_share.t_code_free.fieldbyname('<27><><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring) //4 PREPAID OR COLLECT <20><><EFBFBD>ʽ P/C/F/R/E/L
|
|
|
+':::::::'
|
|
|
+#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if frm_data_share.t_code_free.locate('<27><><EFBFBD>ѷ<EFBFBD>ʽ',frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring,[]) then
|
|
|
begin
|
|
|
str.Add ('14:'+frm_data_share.t_code_free.fieldbyname('<27><><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring
|
|
|
+':'+trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)+#39);
|
|
|
|
|
|
str.Add('15:' //2
|
|
|
+':' //3
|
|
|
+':'+trim(frm_data_share.t_code_free.fieldbyname('<27><><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring) //4 PREPAID OR COLLECT <20><><EFBFBD>ʽ P/C/F/R/E/L
|
|
|
+':::::::' //6-11
|
|
|
+#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if not bsSkinCheckRadioBox2.Checked then //<2F><><EFBFBD><EFBFBD>
|
|
|
begin
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('EDI<44><49>ע').asstring)<>'' then
|
|
|
Str.Add(GetRemarksString);
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('EDI<44><49>ע').asstring)<>'' then
|
|
|
Str.Add(GetRemarksString);
|
|
|
|
|
|
end;
|
|
|
|
|
|
strtemp:=GetShipperString;
|
|
|
if strtemp<>'' then
|
|
|
Str.Add(strtemp);
|
|
|
|
|
|
strtemp:=GetConsigneString;
|
|
|
if strtemp<>'' then
|
|
|
Str.Add(strtemp);
|
|
|
|
|
|
strtemp:=GetNOTIFYString;
|
|
|
if strtemp<>'' then
|
|
|
Str.Add(strtemp);
|
|
|
{
|
|
|
strtemp:=GetNOTIFYTwoString;
|
|
|
if strtemp<>'' then
|
|
|
Str.Add(strtemp);
|
|
|
}
|
|
|
|
|
|
strRmain:='';
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
|
|
|
begin
|
|
|
if frm_data_share.t_crm_client_changzhan.locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',frm_op_seae.t_op_seae.fieldbyname('<27><>վ').asstring,[])then
|
|
|
begin
|
|
|
if not bsSkinCheckRadioBox2.Checked then
|
|
|
strRmain:=strRmain+'F:'+':'+':'+frm_data_share.t_crm_client_changzhan.fieldbyname('EDI<44><49><EFBFBD><EFBFBD>').asstring+':'+':'+ctnsource+#39 // 5 6 7 8 9
|
|
|
else strRmain:=strRmain+'L:'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring)+':'+':'+frm_data_share.t_crm_client_changzhan.fieldbyname('EDI<44><49><EFBFBD><EFBFBD>').asstring+':'+':'+ctnsource+#39;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if not bsSkinCheckRadioBox2.Checked then
|
|
|
strRmain:=strRmain+'F:'+':'+':'+':'+':'+ctnsource+#39
|
|
|
else strRmain:=strRmain+'L:'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring)+':'+':'+':'+':'+ctnsource+#39;
|
|
|
end;
|
|
|
|
|
|
|
|
|
strsql:='';
|
|
|
if not bsSkinCheckRadioBox2.Checked then
|
|
|
begin
|
|
|
strsql:='select <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,sum(<28><><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD> from t_op_ctn group by <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD> having <20><><EFBFBD><EFBFBD>='
|
|
|
+#39+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39; //4
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
strsql:='select <20><><EFBFBD><EFBFBD>,sum(<28><><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD> from t_op_ctn_fendan where AS_ID='
|
|
|
+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('AS_ID').AsString
|
|
|
+' group by <20><><EFBFBD><EFBFBD>';
|
|
|
|
|
|
end;
|
|
|
try
|
|
|
rs:=CreateAdoQuery;
|
|
|
rs.Close;
|
|
|
rs.sql.clear;
|
|
|
rs.sql.add(strsql);
|
|
|
rs.Open;rs.First;
|
|
|
while not rs.Eof do
|
|
|
begin
|
|
|
str.Add ('40:'+Trim(GetCntrEdi(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)) //2 CTN. SIZE & TYPE <20><>װ<EFBFBD><D7B0><EFBFBD>ߴ<EFBFBD><DFB4><EFBFBD><EFBFBD><EFBFBD>
|
|
|
+':'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //3 CTN. NUMBERS <20><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
+':'+strRmain);
|
|
|
Count:=Count+1;
|
|
|
rs.Next;
|
|
|
end;
|
|
|
|
|
|
rs.Close;
|
|
|
rs.Free;
|
|
|
except
|
|
|
on e:exception do
|
|
|
begin
|
|
|
rs.Close;
|
|
|
rs.Destroy;
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not bsSkinCheckRadioBox2.Checked then
|
|
|
begin
|
|
|
str.Add ('41'
|
|
|
+':1' // 2
|
|
|
+':' // 3
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring) // 4 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ S/R/D/O
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) // 5
|
|
|
+':'+trim(GetpkgsEdi(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring)) // 6
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring) // 7
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ˵<D7B0><CBB5> 8
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ˵<D7B0><CBB5> 9
|
|
|
+':' // 10
|
|
|
+':' // 11
|
|
|
+':' // 12
|
|
|
+':' // 13
|
|
|
+':' // 14
|
|
|
+':' // 15
|
|
|
+':' // 16
|
|
|
+':' // 17
|
|
|
+':' // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD> // 18
|
|
|
+':' // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD> // 19
|
|
|
+':' // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD> // 20
|
|
|
+':' // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD> // 21
|
|
|
+#39);
|
|
|
end
|
|
|
else
|
|
|
begin //2 3
|
|
|
|
|
|
str.Add ('41'
|
|
|
+':1' // 2
|
|
|
+':' // 3
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring) // 4 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ S/R/D/O
|
|
|
+':'+trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) // 5
|
|
|
+':'+trim(GetpkgsEdi(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><>װ').asstring)) // 6
|
|
|
+':'+trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><>װ').asstring) // 7
|
|
|
+':'+trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ˵<D7B0><CBB5> 8
|
|
|
+':'+trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ˵<D7B0><CBB5> 9
|
|
|
+':' // 10
|
|
|
+':' // 11
|
|
|
+':' // 12
|
|
|
+':' // 13
|
|
|
+':' // 14
|
|
|
+':' // 15
|
|
|
+':' // 16
|
|
|
+':' // 17
|
|
|
+':' // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD> // 18
|
|
|
+':' // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD> // 19
|
|
|
+':' // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD> // 20
|
|
|
+':' // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD> // 21
|
|
|
+#39);
|
|
|
|
|
|
end;
|
|
|
|
|
|
IF trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='R' THEN
|
|
|
BEGIN
|
|
|
str.Add ('43:' // 2 Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>䶳
|
|
|
+':' //3
|
|
|
+':' //4
|
|
|
+':' //5
|
|
|
+':' //6
|
|
|
+':' //7
|
|
|
+':' //8
|
|
|
+':' //9
|
|
|
+':' //10
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>').asstring) //11
|
|
|
+':' +'C' //12
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>').asstring) //13
|
|
|
+':' //14
|
|
|
+':' //15
|
|
|
+':' //16
|
|
|
+'::::::::' // 17 18 19 20--24
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('ʪ<><CAAA>').asstring) //25 //
|
|
|
+#39);
|
|
|
END;
|
|
|
IF trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='D'THEN
|
|
|
BEGIN
|
|
|
str.Add ('43:'+trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) //2
|
|
|
+':' //3
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) //4
|
|
|
+':' //5
|
|
|
+':' //6
|
|
|
+':' //7
|
|
|
+':' //8
|
|
|
+':' //9
|
|
|
+'::' //10
|
|
|
+':' //11
|
|
|
+':' // 12
|
|
|
+':' // 13
|
|
|
+':' // 14
|
|
|
+'::::::::::' // 15---24
|
|
|
+#39);
|
|
|
END;
|
|
|
if bsSkinCheckRadioBox2.Checked then
|
|
|
sl1.Text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><>ͷ').AsString
|
|
|
else
|
|
|
sl1.Text:=frm_op_seae.t_op_seae.fieldbyname('<27><>ͷ').AsString;
|
|
|
GetLengthTString(sl1,35);
|
|
|
sl.text:='';
|
|
|
for L:=0 to sl1.Count-1 do begin
|
|
|
if Trim(sl1.Strings[L])<>'' then
|
|
|
sl.Add(sl1.Strings[L]);
|
|
|
end;
|
|
|
|
|
|
M:=1;
|
|
|
for L:=0 to sl.Count-1 do begin
|
|
|
if M<=10 then begin
|
|
|
if M=1 then begin
|
|
|
s:='44:'+FormatEdiString(sl.Strings[L],0)+':';
|
|
|
end else begin
|
|
|
if M=10 then
|
|
|
s:=s+FormatEdiString(sl.Strings[L],0)
|
|
|
else
|
|
|
s:=s+FormatEdiString(sl.Strings[L],0)+':';
|
|
|
end;
|
|
|
end else begin
|
|
|
S:=S+'''';
|
|
|
Str.Add(S);
|
|
|
M:=1;
|
|
|
s:='44:'+FormatEdiString(sl.Strings[L],0)+':';
|
|
|
end;
|
|
|
M:=M+1;
|
|
|
end;
|
|
|
S:=S+'''';
|
|
|
Str.Add(S);
|
|
|
|
|
|
if bsSkinCheckRadioBox2.Checked then
|
|
|
sl1.Text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
|
|
|
else
|
|
|
sl1.Text:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
GetLengthTString(sl1,70);
|
|
|
sl.text:='';
|
|
|
for L:=0 to sl1.Count-1 do begin
|
|
|
if Trim(sl1.Strings[L])<>'' then
|
|
|
sl.Add(sl1.Strings[L]);
|
|
|
end;
|
|
|
|
|
|
M:=1;
|
|
|
for L:=0 to sl.Count-1 do begin
|
|
|
if M<=5 then begin
|
|
|
if M=1 then begin
|
|
|
s:='47:'+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);
|
|
|
|
|
|
// Str.Add(GetCARGODESCRIPTIONString);
|
|
|
|
|
|
ctnsource:='N';
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsBoolean then
|
|
|
ctnsource:='Y';
|
|
|
|
|
|
strsql:='';
|
|
|
Count:=Count+11;
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
|
|
|
begin
|
|
|
if bsSkinCheckRadioBox1.Checked then
|
|
|
begin
|
|
|
if not bsSkinCheckRadioBox2.Checked then
|
|
|
begin
|
|
|
strsql:='select * from t_op_ctn where <20><><EFBFBD><EFBFBD>='
|
|
|
+#39+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
strsql:='select * from t_op_ctn_fendan where AS_ID='
|
|
|
+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('AS_ID').AsString;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if trim(strsql)<>'' then
|
|
|
try
|
|
|
rs:=CreateAdoQuery;
|
|
|
rs.Close;rs.sql.clear;
|
|
|
rs.sql.add(strsql);
|
|
|
rs.Open;
|
|
|
if not rs.IsEmpty then
|
|
|
begin
|
|
|
if rs.FieldByName('<27><><EFBFBD><EFBFBD>').AsInteger>0 then
|
|
|
begin
|
|
|
rs.First;
|
|
|
while not rs.Eof do begin
|
|
|
|
|
|
if bsSkinCheckRadioBox1.Checked then begin
|
|
|
if Trim(rs.fieldbyname('<27><><EFBFBD>ط<EFBFBD>ʽ').asstring)='<27>ۼ<EFBFBD>' then
|
|
|
SM:='SM2'
|
|
|
else if Trim(rs.fieldbyname('<27><><EFBFBD>ط<EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
|
|
|
SM:='SM1';
|
|
|
|
|
|
sl1.Text:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring;
|
|
|
GetLengthTString(sl1,35);
|
|
|
|
|
|
shipname:='';
|
|
|
if sl1.Count>=1 then
|
|
|
shipname:=Copy(sl1[0],1,20);
|
|
|
shipaddr:='';
|
|
|
if sl1.Count>=2 then
|
|
|
shipaddr:=sl1[1];
|
|
|
|
|
|
str.Add ('51:'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //2<><32><EFBFBD><EFBFBD>
|
|
|
+':'+Trim(GetCntrEdi(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)) //3<><33><EFBFBD>ͳߴ<CDB3>
|
|
|
+':'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //4Ǧ<34><C7A6><EFBFBD><EFBFBD>
|
|
|
+':'+'M' //5 <20><>־<EFBFBD><D6BE><EFBFBD><EFBFBD>
|
|
|
+':'+'CA' //6 ʩ<>ӷ<EFBFBD>־<EFBFBD><D6BE>
|
|
|
+':'+'F' //7 <20><>״̬
|
|
|
+':'+trim(IntToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger)) //8 <20><><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat)) //9 <20><><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD>
|
|
|
+':' //10
|
|
|
+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat)) //11<31><31><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
+':'
|
|
|
+':'+rs.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring //15
|
|
|
+':'+GetDatetime(rs.fieldbyname('VGM<47><4D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asString,1) //16
|
|
|
+':'+SM //17
|
|
|
+'::'+rs.fieldbyname('<27><><EFBFBD>صص<D8B5>').asString //18 //12 <20><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>
|
|
|
+''''
|
|
|
);
|
|
|
str.Add ('58:'+shipname //2
|
|
|
+':'+shipaddr //3
|
|
|
+':'+rs.fieldbyname('VGM<47><4D>ϵ<EFBFBD><CFB5>').asString // 4
|
|
|
+':'+'' //5
|
|
|
+':'+rs.fieldbyname('VGM<47><4D>ϵ<EFBFBD><CFB5>ϵ<EFBFBD><CFB5>ʽ').asString //6
|
|
|
+':'+'' //7
|
|
|
+':' +rs.fieldbyname('ǩ<><C7A9>').asString //8
|
|
|
+'''');
|
|
|
|
|
|
end else
|
|
|
str.Add ('51:'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //2<><32><EFBFBD><EFBFBD>
|
|
|
+':'+Trim(GetCntrEdi(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)) //3<><33><EFBFBD>ͳߴ<CDB3>
|
|
|
+':'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //4Ǧ<34><C7A6><EFBFBD><EFBFBD>
|
|
|
+':'+'M' //5 <20><>־<EFBFBD><D6BE><EFBFBD><EFBFBD>
|
|
|
+':'+'CA' //6 ʩ<>ӷ<EFBFBD>־<EFBFBD><D6BE>
|
|
|
+':'+'F' //7 <20><>״̬
|
|
|
+':'+trim(IntToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger)) //8 <20><><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat)) //9 <20><><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD>
|
|
|
+':' //10
|
|
|
+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat)) //11<31><31><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
+':' //12 <20><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>
|
|
|
+''''
|
|
|
);
|
|
|
rs.Next;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
rs.Close;
|
|
|
rs.Free;
|
|
|
except
|
|
|
on e:exception do
|
|
|
begin
|
|
|
rs.Close;
|
|
|
rs.Destroy;
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if frm_data_share.t_crm_client_changzhan.locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',frm_op_seae.t_op_seae.fieldbyname('<27><>վ').asstring,[])then
|
|
|
begin
|
|
|
strRmain:=strRmain+'L:'+':'+':'+frm_data_share.t_crm_client_changzhan.fieldbyname('EDI<44><49><EFBFBD><EFBFBD>').asstring+':'+':'+'N'+#39;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
strRmain:=strRmain+'L:'+':'+':'+':'+':'+'N'+#39;
|
|
|
end;
|
|
|
str.Add('48:'+':'+':'+strRmain);
|
|
|
Count:=Count+1;
|
|
|
end;
|
|
|
|
|
|
|
|
|
Result:=str;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_WAIYUN.GetCntrEdi(cntrsize: String):String;
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('Select <20><><EFBFBD><EFBFBD>Edi<64><69><EFBFBD><EFBFBD> from t_code_ctn where <20><><EFBFBD><EFBFBD>='''+cntrsize+'''');
|
|
|
Open;
|
|
|
if IsEmpty then
|
|
|
Result:=''
|
|
|
else
|
|
|
Result:=FieldByName('<27><><EFBFBD><EFBFBD>Edi<64><69><EFBFBD><EFBFBD>').AsString;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
function Tfrm_op_seae_edi_WAIYUN.GetpkgsEdi(pkgs: String): String;
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('Select <20><><EFBFBD>˴<EFBFBD><CBB4><EFBFBD> from t_code_package where <20><><EFBFBD><EFBFBD>='''+pkgs+'''');
|
|
|
Open;
|
|
|
if IsEmpty then
|
|
|
Result:=''
|
|
|
else
|
|
|
Result:=FieldByName('<27><><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').AsString;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_WAIYUN.GetDELIVERYTERMEdiNo(names:String):String;
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('Select <20><><EFBFBD>˴<EFBFBD><CBB4><EFBFBD> from t_code_items where <20><><EFBFBD><EFBFBD>='''+names+'''');
|
|
|
Open;
|
|
|
if IsEmpty then
|
|
|
Result:=''
|
|
|
else
|
|
|
Result:=FieldByName('<27><><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').AsString;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_WAIYUN.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;
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_WAIYUN.bsSkinButton3Click(Sender: TObject);
|
|
|
var
|
|
|
str:widestring;
|
|
|
str_file:widestring;
|
|
|
ftpar,ftpname,ftppass,ftppath,ScriptPath:String;
|
|
|
StrL:TStrings;
|
|
|
i:integer;
|
|
|
SenderCode,ReciverCode,strType:String;
|
|
|
begin
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
FtpClient1.UserName:=ftpname;
|
|
|
FtpClient1.PassWord:=ftppass;
|
|
|
FtpClient1.HostName:=ftpar;
|
|
|
FtpClient1.Passive:=CheckBox1.Checked;
|
|
|
FtpClient1.MultiThreaded:=True;
|
|
|
FtpClient1.Port:='21';
|
|
|
FtpClient1.DisplayFileFlag:=True;
|
|
|
FtpClient1.Timeout:=5;
|
|
|
|
|
|
try
|
|
|
if (FtpClient1.Open) and (FtpClient1.User) and (FtpClient1.Pass) then
|
|
|
begin
|
|
|
//<2F><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
|
|
|
frm_op_seae_edi_waiyun.Caption:='<27>û<EFBFBD><C3BB><EFBFBD><EFBFBD>ӳɹ<D3B3><C9B9><EFBFBD>';
|
|
|
FtpClient1.HostDirName:=ftppath;
|
|
|
if FtpClient1.Cwd then
|
|
|
end else begin
|
|
|
showmessage('<27>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!');
|
|
|
end;
|
|
|
except
|
|
|
on e:exception do
|
|
|
begin
|
|
|
FtpClient1.Abort;
|
|
|
frm_op_seae_edi_waiyun.Caption:='<27>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>';
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
with idftp1 do
|
|
|
begin
|
|
|
Username:=ftpname;
|
|
|
Password:=ftppass;
|
|
|
Host:=ftpar;
|
|
|
Passive:=CheckBox1.Checked;
|
|
|
try
|
|
|
finally
|
|
|
Connect;
|
|
|
end;
|
|
|
if Connected then
|
|
|
begin
|
|
|
showmessage('Ftp<74><70><EFBFBD>ӳɹ<D3B3><C9B9><EFBFBD>');
|
|
|
ChangeDir(ftppath);
|
|
|
TransferType:=ftBinary;
|
|
|
end
|
|
|
else
|
|
|
showmessage('Ftp<74><70><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD>');
|
|
|
end;
|
|
|
}
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_WAIYUN.FormCloseQuery(Sender: TObject;
|
|
|
var CanClose: Boolean);
|
|
|
var
|
|
|
inifile1:Tinifile;
|
|
|
begin
|
|
|
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
|
|
|
inifile1.WriteString('waiyunEDI','SEND',edit1.text);
|
|
|
inifile1.WriteString('waiyunEDI','RECIEVE',edit2.text);
|
|
|
inifile1.WriteString('waiyunEDI','SENDNAME',edit3.text);
|
|
|
inifile1.WriteString('waiyunEDI','FTPSERVER',edit4.text);
|
|
|
inifile1.WriteString('waiyunEDI','FTPPATH',edit5.text);
|
|
|
inifile1.WriteString('waiyunEDI','FTPNAME',edit6.text);
|
|
|
inifile1.WriteString('waiyunEDI','FTPPASS',edit7.text);
|
|
|
|
|
|
inifile1.free;
|
|
|
Memo1.Lines.SaveToFile(ExtractFilePath(application.ExeName)+'carriercode.ini');
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_WAIYUN.bsSkinButton4Click(Sender: TObject);
|
|
|
begin
|
|
|
if frm_op_seae_edi_waiyun.Height=301 then
|
|
|
frm_op_seae_edi_waiyun.Height:=162
|
|
|
else
|
|
|
frm_op_seae_edi_waiyun.Height:=301;
|
|
|
|
|
|
end;
|
|
|
|
|
|
function Tfrm_op_seae_edi_WAIYUN.GetcustEdi(cust: String): String;
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.CLEAR;
|
|
|
SQL.Add('Select <20><><EFBFBD>˴<EFBFBD><CBB4><EFBFBD> from t_crm_client where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+Cust+'''');
|
|
|
Open;
|
|
|
if not IsEmpty then
|
|
|
result:=fieldbyname('<27><><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').AsString;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_WAIYUN.FtpClient1Error(Sender: TObject;
|
|
|
var Msg: String);
|
|
|
begin
|
|
|
ShowMessage(Msg);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_WAIYUN.bsSkinButton5Click(Sender: TObject);
|
|
|
var
|
|
|
str:widestring;
|
|
|
str_file:widestring;
|
|
|
ftpar,ftpname,ftppass,ftppath,ScriptPath:String;
|
|
|
StrL:TStrings;
|
|
|
i,i_soi:integer;
|
|
|
SenderCode,ReciverCode,strType,filetype:String;
|
|
|
begin
|
|
|
i_soi:=0;
|
|
|
if bsSkinCheckRadioBox2.Checked then
|
|
|
begin
|
|
|
if frm_op_seae_assistant=nil then
|
|
|
begin
|
|
|
ShowMessage('<27><><EFBFBD><EFBFBD>(ί<>к<EFBFBD><D0BA>ᵥ)<29><><EFBFBD>淢<EFBFBD>ͷֵ<CDB7>Edi');
|
|
|
exit;
|
|
|
end
|
|
|
end;
|
|
|
|
|
|
if frm_op_seae.dxdbgrid1.SelectedCount>1 then
|
|
|
begin
|
|
|
for i:=0 to frm_op_seae.dxdbgrid1.SelectedCount-1 do
|
|
|
begin
|
|
|
frm_op_seae.t_op_seae.GotoBookmark(pointer(frm_op_seae.dxdbgrid1.selectedrows[i]));
|
|
|
if not isEditrue(frm_op_seae.t_op_seae) then exit;
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if not isEditrue(frm_op_seae.t_op_seae) then exit;
|
|
|
end;
|
|
|
|
|
|
|
|
|
ScriptPath:=ExtractFilePath(ParamStr(0))+'EDIFILE\';
|
|
|
if not DirectoryExists(ScriptPath) then
|
|
|
CreateDir(ScriptPath);
|
|
|
|
|
|
ftpar:=Trim(edit4.Text);
|
|
|
if ftpar='' then begin
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FTP<54><50>ַ<EFBFBD><D6B7>',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
ftpname:=Trim(edit6.Text);
|
|
|
if ftpar='' then begin
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FTP<54>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
ftppass:=Trim(edit7.Text);
|
|
|
if ftpar='' then begin
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FTP<54><50><EFBFBD>룡',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
ftppath:=Trim(edit5.Text);
|
|
|
|
|
|
if bsSkinCheckRadioBox1.Checked then
|
|
|
FileType:='SI_'
|
|
|
else FileType:='BK_';
|
|
|
|
|
|
|
|
|
|
|
|
str:=ScriptPath
|
|
|
+FileType+frm_op_seae.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:=FileType+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring
|
|
|
+FormatDateTime('yyyy',now)
|
|
|
+FormatDateTime('mm',now)
|
|
|
+FormatDateTime('dd',now)
|
|
|
+FormatDateTime('hh',now)
|
|
|
+FormatDateTime('nn',now)+'.txt';
|
|
|
|
|
|
|
|
|
|
|
|
strL:=Tstringlist.Create;
|
|
|
try
|
|
|
SenderCode:=trim(edit1.Text) ;
|
|
|
ReciverCode:=trim(edit2.Text) ;
|
|
|
if bsSkinRadioGroup1.ItemIndex=0 then
|
|
|
strType:='9'
|
|
|
else if bsSkinRadioGroup1.ItemIndex=1 then
|
|
|
strType:='2'
|
|
|
else if bsSkinRadioGroup1.ItemIndex=2 then
|
|
|
strType:='3'
|
|
|
else if bsSkinRadioGroup1.ItemIndex=3 then
|
|
|
strType:='4'
|
|
|
else strType:='9';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if bsSkinCheckRadioBox1.Checked then
|
|
|
strL.Add('00:IFTMBF:SI:'+trim(strType)+':'+ SenderCode+':'+ReciverCode+':'+GetDatetime(datetimetostr(now),1)+':2.1'+#39)
|
|
|
else
|
|
|
strL.Add('00:IFTMBF:BK:'+trim(strType)+':'+ SenderCode+':'+ReciverCode+':'+GetDatetime(datetimetostr(now),1)+':2.1'+#39);
|
|
|
|
|
|
|
|
|
|
|
|
if frm_op_seae.dxdbgrid1.SelectedCount>1 then
|
|
|
begin
|
|
|
for i:=0 to frm_op_seae.dxdbgrid1.SelectedCount-1 do
|
|
|
begin
|
|
|
frm_op_seae.t_op_seae.GotoBookmark(pointer(frm_op_seae.dxdbgrid1.selectedrows[i]));
|
|
|
if Trim(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
|
|
|
StrL.AddStrings(CreateEdiFile)
|
|
|
else
|
|
|
Exit;
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if Trim(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
|
|
|
StrL.AddStrings(CreateEdiFile)
|
|
|
else
|
|
|
Exit;
|
|
|
end;
|
|
|
|
|
|
|
|
|
I:=strL.Count;
|
|
|
strL.Add('99:'+intToStr(i+1)+'''');
|
|
|
|
|
|
for i:=0 to StrL.Count-1 do begin
|
|
|
if IsZhongwen(StrL[i]) then begin
|
|
|
MessageDlg('<27><>Ʊҵ<C6B1><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41>Ȳ<EFBFBD><C8B2>淶<EFBFBD>ַ<EFBFBD>'+StrL[i]+',<2C><>ȥ<EFBFBD><C8A5><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD>',mtWarning,[mbYes],0);
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
strL.SaveToFile(str);
|
|
|
finally
|
|
|
FreeAndNil(StrL)
|
|
|
end;
|
|
|
|
|
|
|
|
|
if FtpClient1.Connected then
|
|
|
begin
|
|
|
try
|
|
|
FtpClient1.TransferMode := ftpTransModeStream;
|
|
|
FtpClient1.LocalFileName:=str;
|
|
|
// showmessage(FtpClient1.LocalFileName);
|
|
|
FtpClient1.HostFileName:= str_file;
|
|
|
// showmessage(FtpClient1.HostFileName);
|
|
|
// Exit;
|
|
|
try
|
|
|
if FtpClient1.Put then
|
|
|
begin
|
|
|
ShowMessage('<27>ϴ<EFBFBD><CFB4>ɹ<EFBFBD>');
|
|
|
frm_op_seae_edi_waiyun.Caption:='<27>ϴ<EFBFBD><CFB4>ɹ<EFBFBD><C9B9><EFBFBD>';
|
|
|
end;
|
|
|
except
|
|
|
FtpClient1.Abort;
|
|
|
ShowMessage('<27>ϴ<EFBFBD>ʧ<EFBFBD><CAA7>!');
|
|
|
frm_op_seae_edi_waiyun.Caption:='<27>ϴ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>';
|
|
|
i_soi:=1;
|
|
|
end;
|
|
|
finally
|
|
|
FtpClient1.Abort;
|
|
|
end;
|
|
|
end;
|
|
|
{
|
|
|
if i_soi=0 then
|
|
|
if bsSkinCheckRadioBox1.Checked then
|
|
|
UpdateSOIStatus(1,frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)
|
|
|
else UpdateSOIStatus(0,frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring);
|
|
|
}
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_WAIYUN.SCNVaild(cust: String): boolean;
|
|
|
var i :integer;
|
|
|
ls:TStringList;
|
|
|
begin
|
|
|
result:=false;
|
|
|
try
|
|
|
ls:=TStringList.Create;
|
|
|
ls.Clear;
|
|
|
ls.Text:=frm_op_seae.t_op_seae.fieldbyname(cust).asstring;
|
|
|
for i:=0 to ls.Count-1 do
|
|
|
begin
|
|
|
if IsZhongwen(ls[i]) then
|
|
|
begin
|
|
|
MessageDlg('EDI<44><49>Ϣ<EFBFBD><CFA2>'+cust+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42>!',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
if Length(ls[i])>35 then
|
|
|
begin
|
|
|
result:=true;
|
|
|
MessageDlg('EDI<44><49>Ϣ<EFBFBD><CFA2>'+cust+'<27><>ÿ<EFBFBD><C3BF><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>35<33><35><EFBFBD>ַ<EFBFBD>!',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
end;
|
|
|
if ls.Count>5 then
|
|
|
begin
|
|
|
result:=true;
|
|
|
MessageDlg('EDI<44><49>Ϣ<EFBFBD><CFA2>'+cust+'<27><><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>5<EFBFBD><35>,<2C>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
finally
|
|
|
ls.Free;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
end.
|