|
|
unit u_op_seae_edi_swi;
|
|
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
Dialogs, BusinessSkinForm, bsSkinCtrls, StdCtrls,inifiles, DB, ADODB,IdFTP,IdFTPCommon,
|
|
|
ExtCtrls,IdHTTP,superobject,ActiveX,IdMultipartFormData,IdGlobalProtocols;
|
|
|
|
|
|
type
|
|
|
|
|
|
TCarrier = Record //ÏûÏ¢¿Í»§¶ËÏûÏ¢½á¹¹
|
|
|
EdiNo :String;
|
|
|
CarrierName :String;
|
|
|
end;
|
|
|
|
|
|
Tfrm_op_seae_edi_swi = class(TForm)
|
|
|
Label2: TLabel;
|
|
|
Label1: TLabel;
|
|
|
Edit2: TEdit;
|
|
|
Edit1: TEdit;
|
|
|
bsSkinButton1: TbsSkinButton;
|
|
|
bsSkinButton2: TbsSkinButton;
|
|
|
bsBusinessSkinForm1: TbsBusinessSkinForm;
|
|
|
SaveDialog1: TSaveDialog;
|
|
|
Label3: TLabel;
|
|
|
Label4: TLabel;
|
|
|
Edit3: TEdit;
|
|
|
Edit4: TEdit;
|
|
|
t_op_ctn: TADOQuery;
|
|
|
Label5: TLabel;
|
|
|
Label6: TLabel;
|
|
|
Label7: TLabel;
|
|
|
Edit5: TEdit;
|
|
|
Edit6: TEdit;
|
|
|
Edit7: TEdit;
|
|
|
RadioGroup1: TRadioGroup;
|
|
|
bsSkinButton3: TbsSkinButton;
|
|
|
bsSkinButton4: TbsSkinButton;
|
|
|
GroupBox1: TGroupBox;
|
|
|
Label8: TLabel;
|
|
|
Edit8: TEdit;
|
|
|
Edit9: TEdit;
|
|
|
Edit10: TEdit;
|
|
|
Label9: TLabel;
|
|
|
Label10: TLabel;
|
|
|
Edit11: TEdit;
|
|
|
Label11: TLabel;
|
|
|
t_op_edi: TADOQuery;
|
|
|
Label12: TLabel;
|
|
|
Edit12: TEdit;
|
|
|
RadioGroup3: TRadioGroup;
|
|
|
bsck: TbsSkinCheckRadioBox;
|
|
|
t_op_edictn: TADOQuery;
|
|
|
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
|
|
|
bsSkinButton7: TbsSkinButton;
|
|
|
bsSkinButton5: TbsSkinButton;
|
|
|
GroupBox2: TGroupBox;
|
|
|
Label15: TLabel;
|
|
|
Label16: TLabel;
|
|
|
Label17: TLabel;
|
|
|
Label18: TLabel;
|
|
|
Edit15: TEdit;
|
|
|
Edit16: TEdit;
|
|
|
Edit17: TEdit;
|
|
|
Edit18: TEdit;
|
|
|
Label13: TLabel;
|
|
|
Edit13: TEdit;
|
|
|
bsSkinButton6: TbsSkinButton;
|
|
|
CheckBox1: TCheckBox;
|
|
|
CheckBox2: TCheckBox;
|
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
|
|
|
|
function get_txtBooking(str:Tstringlist):integer;
|
|
|
function get_txtSI(str:Tstringlist):integer;
|
|
|
function get_goods(str:widestring):widestring;
|
|
|
|
|
|
function get_txtvgm_cargo(str:Tstringlist):integer;
|
|
|
|
|
|
// function get_txtvgm_intrra(str:Tstringlist):integer;
|
|
|
|
|
|
procedure bsSkinButton3Click(Sender: TObject);
|
|
|
|
|
|
function isEditrue:boolean;
|
|
|
|
|
|
function GetCtnCode(ctnkind,ctnsize:String):String;
|
|
|
function GetPkgCode(Pkg:String):String;
|
|
|
function GetPort(PortID:String): String;
|
|
|
function GetLoadPortEdiID(Port:String): String;
|
|
|
function GetPortEdiID(Port:String): String;
|
|
|
function GetPortEdiIDBYEDICODE(Port:String): String;
|
|
|
function GetShipEdiNO(Ship:String): String;
|
|
|
function Changestr(str:widestring):string;
|
|
|
|
|
|
function GetCtnGoods(bsno:String):String;
|
|
|
|
|
|
function get_txtvgm_intrra(str:Tstringlist):integer;
|
|
|
|
|
|
|
|
|
|
|
|
function GetLengthword(var s: String; l: Integer;str:String): String;
|
|
|
procedure GetLengthTString(var sl:TStringList;l:integer);
|
|
|
function GetStrNum(str:String):integer;
|
|
|
function GetCharNum(str:String):integer;
|
|
|
function IsZhongwen(Str:String):Boolean;
|
|
|
procedure bsSkinButton4Click(Sender: TObject);
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
procedure bsSkinButton7Click(Sender: TObject);
|
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
|
procedure bsSkinButton6Click(Sender: TObject);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private
|
|
|
{ Private declarations }
|
|
|
public
|
|
|
{ Public declarations }
|
|
|
aCarrier:TCarrier;
|
|
|
SelectCarrier:Boolean;
|
|
|
function ControlLines(LinesCount,CorpTypeid,BsTypeid:Integer;SName:string):String;
|
|
|
|
|
|
function GetCarrier(i:integer):TCarrier;
|
|
|
|
|
|
function get_txtvgm_cma(str:Tstringlist):integer;
|
|
|
function CreateSIEdiFile_MBL:string;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
var
|
|
|
frm_op_seae_edi_swi: Tfrm_op_seae_edi_swi;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
uses u_op_seae, my_sys_function, u_main, u_data_share, u_op_seae_assistant;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_swi.get_txtvgm_intrra(str:Tstringlist):integer;
|
|
|
var
|
|
|
str_all,sl:Tstringlist;
|
|
|
i,count:integer;
|
|
|
SM,Carrer:string;
|
|
|
|
|
|
begin
|
|
|
i:=0;
|
|
|
|
|
|
Carrer:='SWI';
|
|
|
str_all:=Tstringlist.Create;
|
|
|
count:=0;
|
|
|
|
|
|
str.Add('UNB+UNOC:3+'+Edit1.TEXT+':ZZZ+'+'INTTRA'
|
|
|
+':ZZZ+'+GetDatetime(datetimetostr(now),2)+'+'
|
|
|
+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
|
|
|
str.Add('UNH+001+VERMAS:D:16A:UN:1.0'+#39);
|
|
|
count:=count+1;
|
|
|
if RadioGroup3.ItemIndex=0 then
|
|
|
str.Add('BGM+VGM+'+frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'+9'+#39) //9Ôʼ 5 ¸üÐÂ
|
|
|
else if RadioGroup3.ItemIndex=2 then
|
|
|
str.Add('BGM+VGM+'+frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'+1'+#39) //9Ôʼ 5 ¸üÐÂ
|
|
|
else str.Add('BGM+VGM+'+frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'+5'+#39); //9Ôʼ 5 ¸üÐÂ
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('DTM+137:'+GetDatetime(datetimetostr(now),1)+':203'+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('NAD+TB+'+Edit1.TEXT+'::192++'+Edit1.TEXT+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('CTA+IC+:'+edit7.text+'''');
|
|
|
count:=count+1;
|
|
|
str.Add('COM+'+Edit5.text+':TE'+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
|
|
|
t_op_ctn.close;
|
|
|
t_op_ctn.Parameters.ParamByName('񅧏').Value:=frm_op_seae.t_op_seae.fieldbyname('񅧏').asstring;
|
|
|
t_op_ctn.open;
|
|
|
t_op_ctn.first;
|
|
|
while not t_op_ctn.eof do
|
|
|
begin
|
|
|
if (t_op_ctn.fieldbyname('³ÆÖØ·½Ê½').asstring<>'') or (t_op_ctn.fieldbyname('³ÆÖØ·½Ê½').asstring<>'ÎÞ') then
|
|
|
begin
|
|
|
i:=i+1;
|
|
|
|
|
|
|
|
|
|
|
|
str.Add('EQD+CN+'+t_op_ctn.fieldbyname('ÏäºÅ').asstring+':6346:5'+#39); //ÊýÁ¿
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('RFF+BN:'+frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('RFF+AOW:'+frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('SEL+'+t_op_ctn.fieldbyname('·âºÅ').asstring+'+CA'+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('MEA+AAE+VGM+KGM:'+t_op_ctn.fieldbyname('³ÆÖØÖØÁ¿').asstring+#39); ////ÀÛ¼Ó ÎÞ
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
str.Add('DTM+798:'+GetDatetime(datetimetostr(now),2)+'203'+#39); ////
|
|
|
count:=count+1;
|
|
|
|
|
|
if Trim(t_op_ctn.fieldbyname('³ÆÖØ·½Ê½').asstring)='ÀÛ¼Ó' then
|
|
|
SM:='SM2'
|
|
|
else if Trim(t_op_ctn.fieldbyname('³ÆÖØ·½Ê½').asstring)='×ÜÖØ' then
|
|
|
SM:='SM1';
|
|
|
|
|
|
str.Add('DOC+SHP:VGM:306+'+SM+#39); ////ÀÛ¼Ó ÎÞ
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('DTM+225:'+GetDatetime(datetimetostr(now),2)+'203'+#39); ////
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
str.Add('NAD+SPC+++'+Changestr(Edit2.Text)+#39); ////ÀÛ¼Ó ÎÞ
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('CTA+RP+:'+UpperCase(Edit1.TEXT)+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
str.Add('NAD+CA+'+GetShipEdiNO(frm_op_seae.t_op_seae.fieldbyname('´¬¹«Ë¾').asstring)+'::192++SWI'+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('NAD+CZ+'+Edit1.TEXT+'::192++'+Edit2.TEXT+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
// str.Add('UNT+31+'+IntToStr(i)+#39);
|
|
|
//count:=count+1;
|
|
|
end;
|
|
|
t_op_ctn.next;
|
|
|
end;
|
|
|
result:=count;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_swi.GetCarrier(i:integer):TCarrier;
|
|
|
begin
|
|
|
Result.EdiNo:='SWI';
|
|
|
Result.CarrierName:='SWI LINE';
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_swi.ControlLines(LinesCount,CorpTypeid,BsTypeid:Integer;SName:string):String;
|
|
|
begin
|
|
|
Result:='';
|
|
|
if LinesCount>5 then
|
|
|
begin
|
|
|
case CorpTypeid of
|
|
|
0:begin
|
|
|
case BsTypeid of
|
|
|
0: Result:=SName+'ÏêϸÐÅÏ¢³¬¹ý5ÐÐ,³¬³ö²¿·ÖÇëÔÚ»ù±¾ÐÅÏ¢»õÃèÖÐÌîд¸ñʽΪ:*¼Ó¶à³ö²¿·Ö';
|
|
|
1: Result:=SName+'ÏêϸÐÅÏ¢³¬¹ý5ÐÐ,³¬³ö²¿·ÖÇëÔÚ×°ÏäÃ÷ϸ×îºóÒ»¸ö»õÃèÖÐÌîд¸ñʽΪ:*¼Ó¶à³ö²¿·Ö';
|
|
|
end;
|
|
|
end;
|
|
|
1:begin
|
|
|
case BsTypeid of
|
|
|
0: Result:=SName+'ÏêϸÐÅÏ¢³¬¹ý5ÐÐ,³¬³ö²¿·ÖÇëÔÚ»ù±¾ÐÅÏ¢»õÃèÖÐÌîд¸ñʽΪ:**¼Ó¶à³ö²¿·Ö';
|
|
|
1: Result:=SName+'ÏêϸÐÅÏ¢³¬¹ý5ÐÐ,³¬³ö²¿·ÖÇëÔÚ×°ÏäÃ÷ϸ×îºóÒ»¸ö»õÃèÖÐÌîд¸ñʽΪ:**¼Ó¶à³ö²¿·Ö';
|
|
|
end;
|
|
|
end;
|
|
|
2:begin
|
|
|
case BsTypeid of
|
|
|
0: Result:=SName+'ÏêϸÐÅÏ¢³¬¹ý5ÐÐ,³¬³ö²¿·ÖÇëÔÚ»ù±¾ÐÅÏ¢»õÃèÖÐÌîд¸ñʽΪ:***¼Ó¶à³ö²¿·Ö';
|
|
|
1: Result:=SName+'ÏêϸÐÅÏ¢³¬¹ý5ÐÐ,³¬³ö²¿·ÖÇëÔÚ×°ÏäÃ÷ϸ×îºóÒ»¸ö»õÃèÖÐÌîд¸ñʽΪ:***¼Ó¶à³ö²¿·Ö';
|
|
|
end;
|
|
|
end;
|
|
|
3:begin
|
|
|
case BsTypeid of
|
|
|
0: Result:=SName+'ÏêϸÐÅÏ¢²»Äܳ¬¹ý5ÐÐ';
|
|
|
1: Result:=SName+'ÏêϸÐÅÏ¢²»Äܳ¬¹ý5ÐÐ';
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_swi.GetCtnGoods(bsno:String):String;
|
|
|
var at_op_ctn,at_op_ctndetail :TADOQuery;
|
|
|
ctnlist:TStringList;
|
|
|
b_ctncount:Boolean;
|
|
|
begin
|
|
|
result:='';
|
|
|
|
|
|
at_op_ctn:=CreateAdoQuery;
|
|
|
at_op_ctndetail:=CreateAdoQuery;
|
|
|
ctnlist:=TStringList.Create;
|
|
|
ctnlist.Clear;
|
|
|
with at_op_ctn do
|
|
|
begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('select ctn_id from t_op_ctn');
|
|
|
SQL.Add('where 񅧏=:bsno');
|
|
|
Parameters.ParamByName('bsno').Value:=bsno;
|
|
|
open;First;
|
|
|
while not eof do
|
|
|
begin
|
|
|
ctnlist.Add(FieldByName('ctn_id').AsString);
|
|
|
Next;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if Trim(ctnlist.CommaText)<>'' then
|
|
|
with at_op_ctndetail do
|
|
|
begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('select count(ctn_id) ctn_id from t_op_ctn_detail');
|
|
|
SQL.Add('where ctn_id in ('+ctnlist.CommaText+')');
|
|
|
Open;
|
|
|
if FieldByName('ctn_id').AsInteger>0 then
|
|
|
b_ctncount:=True;
|
|
|
end;
|
|
|
|
|
|
if b_ctncount then
|
|
|
begin
|
|
|
with at_op_ctndetail do
|
|
|
begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('select ctn_id,sum(¼þÊý)¼þÊý,sum(ÖØÁ¿) ÖØÁ¿,sum(³ßÂë) ³ßÂë from t_op_ctn_detail');
|
|
|
SQL.Add('where ctn_id=:ctn_id');
|
|
|
SQL.Add('Group by ctn_id');
|
|
|
end;
|
|
|
|
|
|
with at_op_ctn do
|
|
|
begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('select ctn_id,¼þÊý,ÖØÁ¿,³ßÂë from t_op_ctn');
|
|
|
SQL.Add('where 񅧏=:bsno');
|
|
|
Parameters.ParamByName('bsno').Value:=bsno;
|
|
|
open;First;
|
|
|
while not eof do
|
|
|
begin
|
|
|
at_op_ctndetail.Close;
|
|
|
at_op_ctndetail.Parameters.ParamByName('ctn_id').Value:=FieldByName('ctn_id').AsInteger;
|
|
|
at_op_ctndetail.Open;
|
|
|
if at_op_ctndetail.FieldByName('¼þÊý').AsInteger<>FieldByName('¼þÊý').AsInteger then
|
|
|
begin
|
|
|
if Trim(result)='' then
|
|
|
result:='·ÖÏä¼þÊýºÏ¼Æ:'+at_op_ctndetail.FieldByName('¼þÊý').AsString+'²»µÈÓÚÏä×ܼþÊý:'+FieldByName('¼þÊý').AsString
|
|
|
else result:=result+#13#10+'·ÖÏä¼þÊýºÏ¼Æ:'+at_op_ctndetail.FieldByName('¼þÊý').AsString+'²»µÈÓÚÏä×ܼþÊý:'+FieldByName('¼þÊý').AsString;
|
|
|
end;
|
|
|
if at_op_ctndetail.FieldByName('ÖØÁ¿').AsFloat<>FieldByName('ÖØÁ¿').AsFloat then
|
|
|
begin
|
|
|
if Trim(result)='' then
|
|
|
result:='·ÖÏäÖØÁ¿ºÏ¼Æ:'+at_op_ctndetail.FieldByName('ÖØÁ¿').AsString+'²»µÈÓÚÏä×ÜÖØÁ¿:'+FieldByName('ÖØÁ¿').AsString
|
|
|
else result:=result+#13#10+'·ÖÏäÖØÁ¿ºÏ¼Æ:'+at_op_ctndetail.FieldByName('ÖØÁ¿').AsString+'²»µÈÓÚÏä×ÜÖØÁ¿:'+FieldByName('ÖØÁ¿').AsString;
|
|
|
end;
|
|
|
|
|
|
if at_op_ctndetail.FieldByName('³ßÂë').AsFloat<>FieldByName('³ßÂë').AsFloat then
|
|
|
begin
|
|
|
if Trim(result)='' then
|
|
|
result:='·ÖÏä³ßÂëºÏ¼Æ:'+at_op_ctndetail.FieldByName('³ßÂë').AsString+'²»µÈÓÚÏä×ܳßÂë:'+FieldByName('³ßÂë').AsString
|
|
|
else result:=result+#13#10+'·ÖÏä³ßÂëºÏ¼Æ:'+at_op_ctndetail.FieldByName('³ßÂë').AsString+'²»µÈÓÚÏä×ܳßÂë:'+FieldByName('³ßÂë').AsString;
|
|
|
end;
|
|
|
Next;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
try
|
|
|
finally
|
|
|
at_op_ctn.Free;
|
|
|
at_op_ctndetail.Free;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
function Tfrm_op_seae_edi_swi.isEditrue: boolean;
|
|
|
var
|
|
|
cntrs,s,Edis,cntrGoods,Goods,Lines:String;
|
|
|
sl:TStringList;
|
|
|
i:integer;
|
|
|
|
|
|
begin
|
|
|
result:=true;
|
|
|
SelectCarrier:=False;
|
|
|
sl:=TStringList.Create;
|
|
|
t_op_edi.Close;
|
|
|
t_op_edi.Parameters.ParamByName('񅧏').Value:=frm_op_seae.t_op_seae.fieldbyname('񅧏').asstring;
|
|
|
t_op_edi.Open;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if Edit1.Text='' then
|
|
|
begin
|
|
|
if trim(Edis)='' then
|
|
|
Edis:='·¢ËÍ·½´úÂë'
|
|
|
else Edis:=Edis+','+'·¢ËÍ·½´úÂë';
|
|
|
end;
|
|
|
|
|
|
if Edit2.Text='' then
|
|
|
begin
|
|
|
if trim(Edis)='' then
|
|
|
Edis:='·¢ËÍ·½Ãû³Æ'
|
|
|
else Edis:=Edis+','+'·¢ËÍ·½Ãû³Æ';
|
|
|
end;
|
|
|
|
|
|
if Edit3.Text='' then
|
|
|
begin
|
|
|
if trim(Edis)='' then
|
|
|
Edis:='½ÓÊÜ·½´úÂë'
|
|
|
else Edis:=Edis+','+'½ÓÊÜ·½´úÂë';
|
|
|
end;
|
|
|
|
|
|
if Edit4.Text='' then
|
|
|
begin
|
|
|
if trim(Edis)='' then
|
|
|
Edis:='½ÓÊÜ·½Ãû³Æ'
|
|
|
else Edis:=Edis+','+'½ÓÊÜ·½Ãû³Æ';
|
|
|
end;
|
|
|
|
|
|
if Edit5.Text='' then
|
|
|
begin
|
|
|
if trim(Edis)='' then
|
|
|
Edis:='¹Ì¶¨µç»°'
|
|
|
else Edis:=Edis+','+'¹Ì¶¨µç»°';
|
|
|
end;
|
|
|
|
|
|
|
|
|
if Edit7.Text='' then
|
|
|
begin
|
|
|
if trim(Edis)='' then
|
|
|
Edis:='ÁªÏµÈË'
|
|
|
else Edis:=Edis+','+'ÁªÏµÈË';
|
|
|
end;
|
|
|
|
|
|
if Edit6.Text='' then
|
|
|
begin
|
|
|
if trim(Edis)='' then
|
|
|
Edis:='ÓʼþµØÖ·'
|
|
|
else Edis:=Edis+','+'ÓʼþµØÖ·';
|
|
|
end;
|
|
|
|
|
|
|
|
|
if Edit12.Text='' then
|
|
|
begin
|
|
|
if trim(Edis)='' then
|
|
|
Edis:='ÓʼþµØÖ·'
|
|
|
else Edis:=Edis+','+'ÓʼþµØÖ·';
|
|
|
end;
|
|
|
|
|
|
if trim(Edis)<>'' then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg(trim(Edis)+'²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if not bsck.Checked then
|
|
|
begin
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('Ìáµ¥ºÅ²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('·Öµ¥Ìáµ¥ºÅ²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('¸¶·Ñ·½Ê½').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('¸¶·Ñ·½Ê½²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
if RadioGroup1.ItemIndex=1 then
|
|
|
begin
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('´¬Ãû').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('´¬Ãû²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('º½´Î').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('º½´Î²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('´¬¹«Ë¾').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('´¬¹«Ë¾²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if GetShipEdiNO(frm_op_seae.t_op_seae.fieldbyname('´¬¹«Ë¾').asstring)='' then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('´¬¹«Ë¾EDI´úÂë²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
aCarrier:=GetCarrier(0);
|
|
|
|
|
|
if aCarrier.EdiNo<>GetShipEdiNO(frm_op_seae.t_op_seae.fieldbyname('´¬¹«Ë¾').asstring) then
|
|
|
begin
|
|
|
if MessageDlg('Ñ¡ÔñµÄ´¬¹«Ë¾Îª:'+aCarrier.CarrierName+' ϵͳ¼ÈëµÄ´¬¹«Ë¾Îª:'+frm_op_seae.t_op_seae.fieldbyname('´¬¹«Ë¾').asstring+#13#10+',ÒªÒÔÑ¡ÔñµÄ´¬¹«Ë¾·¢ËÍÂð?',mtWarning,[mbyes,mbno],0)=mryes then
|
|
|
begin
|
|
|
SelectCarrier:=true;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if not bsck.Checked then
|
|
|
begin
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('EDI±¸×¢').asString)='' then begin
|
|
|
{
|
|
|
if MessageDlg('×¢ÒâEDI±¸×¢Îª¿Õ,¼ÌÐø·¢ËÍÂð?',mtWarning,[mbyes,mbno],0)=mrNO then
|
|
|
begin
|
|
|
result:=false;
|
|
|
end;
|
|
|
}
|
|
|
end;
|
|
|
if pos(':',frm_op_seae.t_op_seae.fieldbyname('EDI±¸×¢').asString)>0 then begin
|
|
|
// result:=false;
|
|
|
//MessageDlg('EDI±¸×¢Öв»ÄÜÓÐ : ×Ö·û',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('EDI±¸×¢').asString)='' then
|
|
|
begin
|
|
|
{
|
|
|
if MessageDlg('×¢ÒâEDI±¸×¢Îª¿Õ,¼ÌÐø·¢ËÍÂð?',mtWarning,[mbyes,mbno],0)=mrNO then
|
|
|
begin
|
|
|
result:=false;
|
|
|
end;
|
|
|
}
|
|
|
end;
|
|
|
|
|
|
if pos(':',frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('EDI±¸×¢').asString)>0 then begin
|
|
|
//result:=false;
|
|
|
//MessageDlg('EDI±¸×¢Öв»ÄÜÓÐ : ×Ö·û',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
if not bsck.Checked then
|
|
|
begin
|
|
|
if Length(trim(frm_op_seae.t_op_seae.fieldbyname('EDI±¸×¢').asString))>315 then begin
|
|
|
ShowMessage('EDI±¸×¢²»Äܳ¬¹ý314¸ö×Ö·û');
|
|
|
result:=false;
|
|
|
end;
|
|
|
|
|
|
if bsSkinCheckRadioBox1.Checked then
|
|
|
begin
|
|
|
if Pos('PLEASE BOOK OCEAN CARRIER',trim(frm_op_seae.t_op_seae.fieldbyname('EDI±¸×¢').asString))<=0 then
|
|
|
begin
|
|
|
ShowMessage('ÇëÔÚEDI±¸×¢ÖÐÊäÈë:PLEASE BOOK OCEAN CARRIER - ´¬¹«Ë¾Ãû³Æ');
|
|
|
begin
|
|
|
result:=false;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if Length(trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('EDI±¸×¢').asString))>315 then begin
|
|
|
ShowMessage('EDI±¸×¢²»Äܳ¬¹ý314¸ö×Ö·û');
|
|
|
result:=false;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if bsSkinCheckRadioBox1.Checked then
|
|
|
begin
|
|
|
if Pos('PLEASE BOOK OCEAN CARRIER',trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('EDI±¸×¢').asString))<=0 then
|
|
|
begin
|
|
|
ShowMessage('ÇëÔÚEDI±¸×¢ÖÐÊäÈë:PLEASE BOOK OCEAN CARRIER - ´¬¹«Ë¾Ãû³Æ');
|
|
|
begin
|
|
|
result:=false;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
{
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('×ܼÛ').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('µÚÒ»²ã°üװƤÖز»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sl.Clear;
|
|
|
if t_op_edi.fieldbyname('ËùÔÚ¹ú¼Ò').AsString<>'' then
|
|
|
begin
|
|
|
sl.Text:=Changestr(t_op_edi.fieldbyname('AMS·¢»õÈË').asstring);
|
|
|
if (sl.Count>5) then begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢Öз¢»õÈ˲»Äܳ¬¹ý5ÐÐ!',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
for i:=0 to sl.Count-1 do
|
|
|
begin
|
|
|
if IsZhongwen(sl[i]) then begin
|
|
|
MessageDlg('EDIÐÅÏ¢Öз¢»õÈËÖÐÓÐÖÐÎÄ×Ö·û»òTAB¼ü!',mtWarning,[mbOk],0);
|
|
|
result:=false;
|
|
|
// Exit;
|
|
|
end;
|
|
|
if Length(sl[i])>45 then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢Öз¢»õÈËÖÐÿÐÐ×Ö·û²»Äܳ¬¹ý45¸ö×Ö·û!',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
Lines:=ControlLines(sl.Count,0,0,'AMS·¢»õÈË'); //LinesCount,CorpTypeid,BsTypeid:Integer;SName:string
|
|
|
if Lines<>'' then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢ÖÐ'+Lines+'!',mtWarning,[mbOk],0);
|
|
|
// Exit;
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
sl.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('·¢»õÈË´úÂë').asstring);
|
|
|
if (sl.Count>5) then begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢Öз¢»õÈ˲»Äܳ¬¹ý5ÐÐ!',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
|
|
|
for i:=0 to sl.Count-1 do begin
|
|
|
if IsZhongwen(sl[i]) then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢Öз¢»õÈËÖÐÓÐÖÐÎÄ×Ö·û»òTAB¼ü!',mtWarning,[mbOk],0);
|
|
|
// Exit;
|
|
|
end;
|
|
|
|
|
|
if Length(sl[i])>45 then begin
|
|
|
result:=false;
|
|
|
MessageDlg('·¢»õÈËÖÐÿÐÐ×Ö·û²»Äܳ¬¹ý45¸ö×Ö·û!',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
Lines:=ControlLines(sl.Count,0,0,'·¢»õÈË'); //LinesCount,CorpTypeid,BsTypeid:Integer;SName:string
|
|
|
if Lines<>'' then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢ÖÐ'+Lines+'!',mtWarning,[mbOk],0);
|
|
|
// Exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if bsck.Checked then
|
|
|
begin
|
|
|
sl.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('·¢»õÈË´úÂë').asstring);
|
|
|
if (sl.Count>5) then begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢Öз¢»õÈ˲»Äܳ¬¹ý5ÐÐ!',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
for i:=0 to sl.Count-1 do begin
|
|
|
if IsZhongwen(sl[i]) then begin
|
|
|
result:=false;
|
|
|
MessageDlg('·Öµ¥EDIÐÅÏ¢Öз¢»õÈËÖÐÓÐÖÐÎÄ×Ö·û»òTAB¼ü!',mtWarning,[mbOk],0);
|
|
|
// Exit;
|
|
|
end;
|
|
|
|
|
|
if Length(sl[i])>45 then begin
|
|
|
result:=false;
|
|
|
MessageDlg('·Öµ¥·¢»õÈËÖÐÿÐÐ×Ö·û²»Äܳ¬¹ý45¸ö×Ö·û!',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
Lines:=ControlLines(sl.Count,0,1,'·¢»õÈË'); //LinesCount,CorpTypeid,BsTypeid:Integer;SName:string
|
|
|
if Lines<>'' then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('·Öµ¥EDIÐÅÏ¢ÖÐ'+Lines+'!',mtWarning,[mbOk],0);
|
|
|
// Exit;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
sl.Clear;
|
|
|
if t_op_edi.fieldbyname('ËùÔÚ¹ú¼Ò').AsString<>'' then begin
|
|
|
sl.Text:=Changestr(t_op_edi.fieldbyname('AMSÊÕ»õÈË').asstring);
|
|
|
for i:=0 to sl.Count-1 do begin
|
|
|
if IsZhongwen(sl[i]) then begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢ÖÐÊÕ»õÈËÖÐÓÐÖÐÎÄ×Ö·û»òTAB¼ü!',mtWarning,[mbOk],0);
|
|
|
// Exit;
|
|
|
end;
|
|
|
|
|
|
if Length(sl[i])>45 then begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢ÖÐÊÕ»õÈËÖÐÿÐÐ×Ö·û²»Äܳ¬¹ý45¸ö×Ö·û!',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
Lines:=ControlLines(sl.Count,1,0,'AMSÊÕ»õÈË'); //LinesCount,CorpTypeid,BsTypeid:Integer;SName:string
|
|
|
if Lines<>'' then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢ÖÐ'+Lines+'!',mtWarning,[mbOk],0);
|
|
|
// Exit;
|
|
|
end;
|
|
|
end else begin
|
|
|
sl.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('ÊÕ»õÈË´úÂë').asstring);
|
|
|
if (sl.Count>5) then begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢ÖÐÊÕ»õÈ˲»Äܳ¬¹ý5ÐÐ!',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
for i:=0 to sl.Count-1 do begin
|
|
|
if IsZhongwen(sl[i]) then begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢ÖÐÊÕ»õÈËÖÐÓÐÖÐÎÄ×Ö·û»òTAB¼ü!',mtWarning,[mbOk],0);
|
|
|
// Exit;
|
|
|
end;
|
|
|
|
|
|
if Length(sl[i])>45 then begin
|
|
|
result:=false;
|
|
|
MessageDlg('ÊÕ»õÈËÖÐÿÐÐ×Ö·û²»Äܳ¬¹ý45¸ö×Ö·û!',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
Lines:=ControlLines(sl.Count,1,0,'ÊÕ»õÈË'); //LinesCount,CorpTypeid,BsTypeid:Integer;SName:string
|
|
|
if Lines<>'' then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢ÖÐ'+Lines+'!',mtWarning,[mbOk],0);
|
|
|
// Exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='CY-DOOR' then
|
|
|
begin
|
|
|
IF frm_op_seae.t_op_seae.fieldbyname('DOORµØÖ·').asstring='' then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('ÔËÊäÌõ¿îΪ:CY-DOOR,SHIPPING TOµØÖ·²»ÄÜΪ¿Õ ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
sl.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('DOORµØÖ·').asstring);
|
|
|
for i:=0 to sl.Count-1 do begin
|
|
|
if IsZhongwen(sl[i]) then begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢ÖÐSHIPPING TOµØÖ·ÖÐÓÐÖÐÎÄ×Ö·û»òTAB¼ü!',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
if Length(sl[i])>35 then begin
|
|
|
result:=false;
|
|
|
MessageDlg('SHIPPING TOµØÖ·ÖÐÿÐÐ×Ö·û²»Äܳ¬¹ý35¸ö×Ö·û!',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if bsck.Checked then
|
|
|
begin
|
|
|
sl.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('ÊÕ»õÈË´úÂë').asstring);
|
|
|
if (sl.Count>5) then begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢ÖÐÊÕ»õÈ˲»Äܳ¬¹ý5ÐÐ!',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
for i:=0 to sl.Count-1 do
|
|
|
begin
|
|
|
if IsZhongwen(sl[i]) then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('·Öµ¥EDIÐÅÏ¢ÖÐÊÕ»õÈËÖÐÓÐÖÐÎÄ×Ö·û»òTAB¼ü!',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
|
|
|
if Length(sl[i])>35 then begin
|
|
|
result:=false;
|
|
|
MessageDlg('·Öµ¥ÊÕ»õÈËÖÐÿÐÐ×Ö·û²»Äܳ¬¹ý35¸ö×Ö·û!',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
Lines:=ControlLines(sl.Count,1,1,'ÊÕ»õÈË'); //LinesCount,CorpTypeid,BsTypeid:Integer;SName:string
|
|
|
if Lines<>'' then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('·Öµ¥EDIÐÅÏ¢ÖÐ'+Lines+'!',mtWarning,[mbOk],0);
|
|
|
// Exit;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
sl.Clear;
|
|
|
if t_op_edi.fieldbyname('ËùÔÚ¹ú¼Ò').AsString<>'' then
|
|
|
begin
|
|
|
sl.Text:=Changestr(t_op_edi.fieldbyname('AMS֪ͨÈË').asstring);
|
|
|
if (sl.Count>5) then begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢ÖÐ֪ͨÈ˲»Äܳ¬¹ý5ÐÐ!',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
for i:=0 to sl.Count-1 do
|
|
|
begin
|
|
|
if IsZhongwen(sl[i]) then
|
|
|
begin
|
|
|
MessageDlg('EDIÐÅÏ¢ÖÐ֪ͨÈËÖÐÓÐÖÐÎÄ×Ö·û»òTAB¼ü!',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
|
|
|
if Length(sl[i])>45 then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢ÖÐ֪ͨÈËÖÐÿÐÐ×Ö·û²»Äܳ¬¹ý45¸ö×Ö·û!',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
Lines:=ControlLines(sl.Count,2,0,'AMS֪ͨÈË'); //LinesCount,CorpTypeid,BsTypeid:Integer;SName:string
|
|
|
if Lines<>'' then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢ÖÐ'+Lines+'!',mtWarning,[mbOk],0);
|
|
|
// Exit;
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
sl.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('֪ͨÈË´úÂë').asstring);
|
|
|
if (sl.Count>5) then begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢ÖÐ֪ͨÈ˲»Äܳ¬¹ý5ÐÐ!',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
for i:=0 to sl.Count-1 do begin
|
|
|
if IsZhongwen(sl[i]) then begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢ÖÐ֪ͨÈËÖÐÓÐÖÐÎÄ×Ö·û»òTAB¼ü!',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
|
|
|
if Length(sl[i])>45 then begin
|
|
|
result:=false;
|
|
|
MessageDlg('֪ͨÈËÖÐÿÐÐ×Ö·û²»Äܳ¬¹ý45¸ö×Ö·û!',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
Lines:=ControlLines(sl.Count,2,0,'֪ͨÈË'); //LinesCount,CorpTypeid,BsTypeid:Integer;SName:string
|
|
|
if Lines<>'' then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢ÖÐ'+Lines+'!',mtWarning,[mbOk],0);
|
|
|
// Exit;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if bsck.Checked then
|
|
|
begin
|
|
|
sl.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('֪ͨÈË´úÂë').asstring);
|
|
|
if (sl.Count>5) then begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢ÖÐ֪ͨÈ˲»Äܳ¬¹ý5ÐÐ!',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
for i:=0 to sl.Count-1 do begin
|
|
|
if IsZhongwen(sl[i]) then begin
|
|
|
result:=false;
|
|
|
MessageDlg('·Öµ¥EDIÐÅÏ¢ÖÐ֪ͨÈËÖÐÓÐÖÐÎÄ×Ö·û»òTAB¼ü!',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
|
|
|
if Length(sl[i])>45 then begin
|
|
|
result:=false;
|
|
|
MessageDlg('·Öµ¥Í¨ÖªÈËÖÐÿÐÐ×Ö·û²»Äܳ¬¹ý45¸ö×Ö·û!',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
Lines:=ControlLines(sl.Count,2,1,'֪ͨÈË'); //LinesCount,CorpTypeid,BsTypeid:Integer;SName:string
|
|
|
if Lines<>'' then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('·Öµ¥EDIÐÅÏ¢ÖÐ'+Lines+'!',mtWarning,[mbOk],0);
|
|
|
// Exit;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
sl.Clear;
|
|
|
sl.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('ßéÍ·').asstring);
|
|
|
for i:=0 to sl.Count-1 do begin
|
|
|
if IsZhongwen(sl[i]) then begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢ÖÐßéÍ·ÓÐÖÐÎÄ×Ö·û»òTAB¼ü!',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
|
|
|
if Length(sl[i])>35 then begin
|
|
|
result:=false;
|
|
|
MessageDlg('ßéÍ·ÖÐÿÐÐ×Ö·û²»Äܳ¬¹ý35¸ö×Ö·û!',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
sl.Clear;
|
|
|
sl.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('»õÎïÃèÊö').asstring);
|
|
|
for i:=0 to sl.Count-1 do begin
|
|
|
if IsZhongwen(sl[i]) then begin
|
|
|
result:=false;
|
|
|
MessageDlg('EDIÐÅÏ¢ÖлõÎïÃèÊöÓÐÖÐÎÄ×Ö·û»òTAB¼ü!',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if bsck.Checked then
|
|
|
begin
|
|
|
sl.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('ßéÍ·').asstring);
|
|
|
for i:=0 to sl.Count-1 do begin
|
|
|
if IsZhongwen(sl[i]) then begin
|
|
|
result:=false;
|
|
|
MessageDlg('·Öµ¥EDIÐÅÏ¢ÖÐßéÍ·ÖÐÓÐÖÐÎÄ×Ö·û»òTAB¼ü!',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
|
|
|
if Length(sl[i])>35 then begin
|
|
|
result:=false;
|
|
|
MessageDlg('·Öµ¥ßéÍ·ÖÐÿÐÐ×Ö·û²»Äܳ¬¹ý35¸ö×Ö·û!',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if bsck.Checked then
|
|
|
begin
|
|
|
sl.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('»õÎïÃèÊö').asstring);
|
|
|
for i:=0 to sl.Count-1 do begin
|
|
|
if IsZhongwen(sl[i]) then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('·Öµ¥EDIÐÅÏ¢ÖлõÎïÃèÊöÖÐÓÐÖÐÎÄ×Ö·û»òTAB¼ü!',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
FreeAndNil(sl);
|
|
|
|
|
|
|
|
|
if trim(GetPortEdiIDBYEDICODE(frm_op_seae.t_op_seae.fieldbyname('×°¸Û´úÂë').asstring))='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('×°¸Û´úÂë²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
|
|
|
if Length(trim(GetPortEdiIDBYEDICODE(frm_op_seae.t_op_seae.fieldbyname('×°¸Û´úÂë').asstring)))<>5 then begin
|
|
|
result:=false;
|
|
|
MessageDlg('×°¸Û´úÂë±ØÐëΪ5¸ö×Ö·û',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
|
|
|
|
|
|
{
|
|
|
if trim(GetLoadPortEdiID(frm_op_seae.t_op_seae.fieldbyname('×°»õ¸Û').asstring))='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('×°¸Û´úÂë²»ÄÜΪ¿Õ,ÇëÔÚÆðÔËά»¤ EDI´úÂë',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
}
|
|
|
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('×°»õ¸Û').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('ÆôÔ˸۲»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('¿ª´¬ÈÕÆÚ').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('¿ª´¬ÈÕÆÚ²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('¿ª´¬ÈÕÆÚ').asDateTime<(now-120) then begin
|
|
|
result:=false;
|
|
|
MessageDlg('¿ª´¬ÈÕÆÚ±ØÐëÔÚ½ñÈÕµÄ120ÌìÄÚ!',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
|
|
|
if RadioGroup1.ItemIndex=1 then
|
|
|
begin
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('´¬Ãû').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('´¬Ãû²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('º½´Î').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('º½´Î²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
{
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('Ä¿µÄµØ´úÂë').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('Ä¿µÄµØ´úÂë²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
|
|
|
|
|
|
if Length(trim(frm_op_seae.t_op_seae.fieldbyname('Ä¿µÄµØ´úÂë').asstring))<>5 then begin
|
|
|
result:=false;
|
|
|
MessageDlg('Ä¿µÄµØ´úÂë±ØÐëΪ5¸ö×Ö·û',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('Ä¿µÄµØ').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('Ä¿µÄµØ²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
//xit;
|
|
|
end;
|
|
|
}
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('½»»õµØµã').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('½»»õµØµã²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
}
|
|
|
if trim(GetPortEdiIDBYEDICODE(frm_op_seae.t_op_seae.fieldbyname('ж»õ´úÂë').asstring))='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('ж»õ´úÂë²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
end;
|
|
|
|
|
|
if Length(trim(GetPortEdiIDBYEDICODE(frm_op_seae.t_op_seae.fieldbyname('ж»õ´úÂë').asstring)))<>5 then begin
|
|
|
result:=false;
|
|
|
MessageDlg('ж»õ´úÂë±ØÐëΪÎå¸ö×Ö·û',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
|
|
|
|
|
|
{
|
|
|
if trim(GetPortEdiID(frm_op_seae.t_op_seae.fieldbyname('ж»õ¸Û').asstring))='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('ж»õ´úÂë²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
}
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('ж»õ¸Û').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('ж»õ¸Û²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
|
|
|
if not bsck.Checked then
|
|
|
begin
|
|
|
if GetPkgCode(trim(frm_op_seae.t_op_seae.fieldbyname('°ü×°').asstring))='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('°ü×°´úÂë²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if GetPkgCode(trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('°ü×°').asstring))='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('°ü×°´úÂë²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if not bsck.Checked then
|
|
|
begin
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('»õÎïÃèÊö').asstring)='' then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('»õÎïÃèÊö²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('»õÎïÃèÊö').asstring)='' then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('»õÎïÃèÊö²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if not bsck.Checked then
|
|
|
begin
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('ßéÍ·').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('ßéÍ·²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('ßéÍ·').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('ßéÍ·²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
if not bsck.Checked then
|
|
|
begin
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('¼þÊý').asinteger=0 then begin
|
|
|
result:=false;
|
|
|
MessageDlg('¼þÊý²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('ÖØÁ¿').asfloat=0 then begin
|
|
|
result:=false;
|
|
|
MessageDlg('ÖØÁ¿²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('³ßÂë').asfloat=0 then begin
|
|
|
result:=false;
|
|
|
MessageDlg('³ßÂë²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('¼þÊý').asinteger=0 then begin
|
|
|
result:=false;
|
|
|
MessageDlg('¼þÊý²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
if frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('ÖØÁ¿').asfloat=0 then begin
|
|
|
result:=false;
|
|
|
MessageDlg('ÖØÁ¿²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
if frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('³ßÂë').asfloat=0 then begin
|
|
|
result:=false;
|
|
|
MessageDlg('³ßÂë²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if (trim(frm_op_seae.t_op_seae.FieldByName('»õÎï±êʶ').asstring)='D') or (trim(frm_op_seae.t_op_seae.FieldByName('»õÎï±êʶ').asstring)='T') then begin
|
|
|
if Trim(frm_op_seae.t_op_seae.fieldbyname('ΣÏÕÆ··ÖÀà').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('ΣÏÕÆ·µÈ¼¶²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
if Trim(frm_op_seae.t_op_seae.fieldbyname('ΣÏÕÆ·±àºÅ').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('ΣÏÕÆ·±àºÅ²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
if GetStrNum(Trim(frm_op_seae.t_op_seae.fieldbyname('ΣÏÕÆ·±àºÅ').asstring))<>4 then begin
|
|
|
result:=false;
|
|
|
MessageDlg('ΣÏÕÆ·±àºÅ±ØÐëÊÇ4λÊý×Ö',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if (trim(frm_op_seae.t_op_seae.FieldByName('»õÎï±êʶ').asstring)='R') OR (trim(frm_op_seae.t_op_seae.FieldByName('»õÎï±êʶ').asstring)='T') then begin
|
|
|
if Trim(frm_op_seae.t_op_seae.fieldbyname('ÉèÖÃζÈ').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('ÉèÖÃζȲ»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
if GetStrNum(trim(frm_op_seae.t_op_seae.fieldbyname('ÉèÖÃζÈ').asstring))<>3 then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('ÉèÖÃζȱØÐëÊÇ3λÊý×Ö',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if Pos('PREPAID',frm_op_seae.t_op_seae.fieldbyname('¸¶·Ñ·½Ê½').asstring)>0 then
|
|
|
if (trim(frm_op_seae.t_op_seae.fieldbyname('Ô¤¸¶µØµã').asstring)='')
|
|
|
or (GetPortEdiID(frm_op_seae.t_op_seae.fieldbyname('Ô¤¸¶µØµã').asstring)='') then
|
|
|
begin //¸¶¿îµØµã´úÂë
|
|
|
result:=false;
|
|
|
MessageDlg('Ô¤¸¶µØµã(»òedi´úÂë)²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if Pos('COLLECT',frm_op_seae.t_op_seae.fieldbyname('¸¶·Ñ·½Ê½').asstring)>0 then
|
|
|
if (trim(frm_op_seae.t_op_seae.fieldbyname('µ½¸¶µØµã').asstring)='')
|
|
|
or (frm_op_seae.t_op_seae.fieldbyname('µ½¸¶µØµã´úÂë').asstring='') then
|
|
|
begin //¸¶¿îµØµã´úÂë
|
|
|
result:=false;
|
|
|
MessageDlg('µ½¸¶µØµã(»òedi´úÂë)²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
|
|
|
if RadioGroup1.ItemIndex=1 then begin
|
|
|
if (trim(frm_op_seae.t_op_seae.fieldbyname('Ç©µ¥µØµã').asstring)='')
|
|
|
or (GetPortEdiID(frm_op_seae.t_op_seae.fieldbyname('Ç©µ¥µØµã').asstring)='')
|
|
|
then begin //Ç©µ¥µØµã´úÂë
|
|
|
result:=false;
|
|
|
MessageDlg('Ç©µ¥µØµã(»òedi´úÂë)²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('ÔËÊäÌõ¿î²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('ÔË·ÑÐÒéºÅ').asstring)='' then begin //ÔËÊäÐÒéºÅ
|
|
|
result:=false;
|
|
|
MessageDlg('ÔË·ÑÐÒéºÅ²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not bsck.Checked then
|
|
|
begin
|
|
|
t_op_ctn.Close;t_op_ctn.SQL.Clear;
|
|
|
t_op_ctn.SQL.Add('SELECT t_op_ctn.±àºÅ,t_op_ctn.ÊýÁ¿, t_code_ctn.EDI´úÂë,t_op_ctn.³ß´ç,t_op_ctn.°ü×°');
|
|
|
t_op_ctn.SQL.Add(',t_op_ctn.ÏäÐÍ,t_op_ctn.ÏäºÅ,t_op_ctn.ÖØÁ¿,t_op_ctn.·âºÅ,t_op_ctn.³ßÂë,t_op_ctn.¼þÊý,t_op_ctn.Æ·Ãû');
|
|
|
t_op_ctn.SQL.Add('FROM t_op_ctn INNER JOIN');
|
|
|
t_op_ctn.SQL.Add('t_code_ctn ON t_op_ctn.´úÂë = t_code_ctn.´úÂë');
|
|
|
t_op_ctn.SQL.Add('WHERE t_op_ctn.񅧏=:񅧏');
|
|
|
t_op_ctn.Parameters.ParamByName('񅧏').Value:=frm_op_seae.t_op_seae.fieldbyname('񅧏').asstring;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_op_ctn.Close;t_op_ctn.SQL.Clear;
|
|
|
t_op_ctn.SQL.Add('SELECT t_op_ctn_fendan.±àºÅ,t_op_ctn_fendan.ÊýÁ¿, t_code_ctn.EDI´úÂë,t_op_ctn_fendan.³ß´ç,t_op_ctn_fendan.°ü×°');
|
|
|
t_op_ctn.SQL.Add(',t_op_ctn_fendan.ÏäÐÍ,t_op_ctn_fendan.ÏäºÅ,t_op_ctn_fendan.ÖØÁ¿,t_op_ctn_fendan.·âºÅ,t_op_ctn_fendan.³ßÂë,t_op_ctn_fendan.¼þÊý,t_op_ctn_fendan.Æ·Ãû');
|
|
|
t_op_ctn.SQL.Add('FROM t_op_ctn_fendan INNER JOIN');
|
|
|
t_op_ctn.SQL.Add('t_code_ctn ON t_op_ctn_fendan.´úÂë = t_code_ctn.´úÂë');
|
|
|
t_op_ctn.SQL.Add('WHERE t_op_ctn_fendan.as_id=:as_id');
|
|
|
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('¼¯×°Ïä²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
t_op_ctn.first;
|
|
|
while not t_op_ctn.eof do
|
|
|
begin
|
|
|
cntrs:=GetCtnCode(t_op_ctn.fieldByName('ÏäÐÍ').asString,t_op_ctn.fieldByName('³ß´ç').asString);
|
|
|
if cntrs='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('¼¯×°ÏäÀàÐÍEDI´úÂë²»´æÔÚ!',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
|
|
|
if t_op_ctn.fieldByName('Æ·Ãû').asString='' then
|
|
|
begin
|
|
|
if Goods='' then
|
|
|
Goods:=t_op_ctn.fieldByName('ÏäÐÍ').asString+t_op_ctn.fieldByName('³ß´ç').asString
|
|
|
else Goods:=Goods+#13#10+t_op_ctn.fieldByName('ÏäÐÍ').asString+t_op_ctn.fieldByName('³ß´ç').asString;
|
|
|
end;
|
|
|
t_op_ctn.next;
|
|
|
end;
|
|
|
{
|
|
|
if trim(Goods)<>'' then
|
|
|
MessageDlg('×¢Òâ'+#13#10+Goods+#13#10+'¼¯×°Ïä»õÎïÃû³ÆΪ¿Õ!',mtWarning,[mbOk],0);
|
|
|
}
|
|
|
|
|
|
if RadioGroup1.ItemIndex=1 then
|
|
|
begin
|
|
|
if t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring='USA' then begin
|
|
|
if t_op_edi.FieldByName('²Õµ¥É걨Õß').asstring='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('²Õµ¥É걨Õß²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
if t_op_edi.FieldByName('²Õµ¥É걨Õß').asstring='×Ô¼º' then begin
|
|
|
if t_op_edi.FieldByName('SCAC񅧏').asstring='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('SCAC±àºÅ²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
if t_op_edi.FieldByName('ÊÕ»õÈËÓʱà').asstring='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('ÊÕ»õÈËÓʱ಻ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
if t_op_edi.FieldByName('֪ͨÈËÓʱà').asstring='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('֪ͨÈËÓʱ಻ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
|
|
|
if Trim(frm_op_seae.t_op_seae.fieldbyname('ÔËÊ䷽ʽ').asstring)='' then begin //ÉÌÆ·±àÂë
|
|
|
result:=false;
|
|
|
MessageDlg('ÉÌÆ·±àÂë²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring='CANADA' then begin
|
|
|
if t_op_edi.FieldByName('²Õµ¥É걨Õß').asstring='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('²Õµ¥É걨Õß²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
if t_op_edi.FieldByName('²Õµ¥É걨Õß').asstring='×Ô¼º' then begin
|
|
|
if t_op_edi.FieldByName('SCAC񅧏').asstring='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('SCAC±àºÅ²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
if t_op_edi.FieldByName('ÊÕ»õÈËÓʱà').asstring='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('ÊÕ»õÈËÓʱ಻ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring='BRAZIL' then begin
|
|
|
if t_op_edi.FieldByName('ÊÕ»õÈ˹ú¼Ò´úÂë').asstring='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('ÊÕ»õÈ˹ú¼Ò´úÂë²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
if t_op_edi.FieldByName('ÊÕ»õÈËË°ºÅ').asstring='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('ÊÕ»õÈËË°ºÅ²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
if t_op_edi.FieldByName('ÊÕ»õÈ˹ú¼Ò´úÂë').asstring<>'BR' then begin
|
|
|
if t_op_edi.FieldByName('֪ͨÈ˹ú¼Ò´úÂë').asstring='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('֪ͨÈ˹ú¼Ò´úÂë²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
if t_op_edi.FieldByName('֪ͨÈËË°ºÅ').asstring='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('֪ͨÈËË°ºÅ²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
if t_op_edi.FieldByName('»õÎïNCM±àºÅ').asstring='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('»õÎïNCM±àºÅ²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
cntrGoods:=GetCtnGoods(frm_op_seae.t_op_seae.fieldByName('񅧏').asString);
|
|
|
if trim(cntrGoods)<>'' then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg(cntrGoods,mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
|
|
|
if not bsck.Checked then
|
|
|
begin
|
|
|
t_op_ctn.Close;t_op_ctn.SQL.Clear;
|
|
|
t_op_ctn.SQL.Add('SELECT t_op_ctn.±àºÅ,t_op_ctn.ÊýÁ¿, t_code_ctn.EDI´úÂë,t_op_ctn.³ß´ç,t_op_ctn.°ü×°');
|
|
|
t_op_ctn.SQL.Add(',t_op_ctn.ÏäÐÍ,t_op_ctn.ÏäºÅ,t_op_ctn.ÖØÁ¿,t_op_ctn.·âºÅ,t_op_ctn.³ßÂë,t_op_ctn.¼þÊý');
|
|
|
t_op_ctn.SQL.Add('FROM t_op_ctn INNER JOIN');
|
|
|
t_op_ctn.SQL.Add('t_code_ctn ON t_op_ctn.´úÂë = t_code_ctn.´úÂë');
|
|
|
t_op_ctn.SQL.Add('WHERE t_op_ctn.񅧏=:񅧏');
|
|
|
t_op_ctn.Parameters.ParamByName('񅧏').Value:=frm_op_seae.t_op_seae.fieldbyname('񅧏').asstring;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_op_ctn.Close;t_op_ctn.SQL.Clear;
|
|
|
t_op_ctn.SQL.Add('SELECT t_op_ctn_fendan.±àºÅ,t_op_ctn_fendan.ÊýÁ¿, t_code_ctn.EDI´úÂë,t_op_ctn_fendan.³ß´ç,t_op_ctn_fendan.°ü×°');
|
|
|
t_op_ctn.SQL.Add(',t_op_ctn_fendan.ÏäÐÍ,t_op_ctn_fendan.ÏäºÅ,t_op_ctn_fendan.ÖØÁ¿,t_op_ctn_fendan.·âºÅ,t_op_ctn_fendan.³ßÂë,t_op_ctn_fendan.¼þÊý');
|
|
|
t_op_ctn.SQL.Add('FROM t_op_ctn_fendan INNER JOIN');
|
|
|
t_op_ctn.SQL.Add('t_code_ctn ON t_op_ctn_fendan.´úÂë = t_code_ctn.´úÂë');
|
|
|
t_op_ctn.SQL.Add('WHERE t_op_ctn_fendan.as_id=:as_id');
|
|
|
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('ÏäºÅ·âºÅ²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
t_op_ctn.first;
|
|
|
while not t_op_ctn.eof do
|
|
|
begin
|
|
|
cntrs:=t_op_ctn.fieldByName('ÏäºÅ').asString;
|
|
|
if GetCtnCode(t_op_ctn.fieldByName('ÏäÐÍ').asstring,t_op_ctn.fieldByName('³ß´ç').asstring)='' then begin
|
|
|
result:=false;
|
|
|
MessageDlg('¼¯×°ÏäÀàÐÍEDI´úÂë²»´æÔÚ!',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
|
|
|
if ((GetStrNum(cntrs))<>7) or ((GetcharNum(cntrs))<>4) then begin
|
|
|
result:=false;
|
|
|
MessageDlg('¼¯×°ÏäÏäºÅ²»ÕýÈ·!',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
|
|
|
t_op_ctn.next;
|
|
|
end;
|
|
|
if t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring='°ÍÎ÷' then
|
|
|
begin
|
|
|
if frm_op_seae.t_op_seae.fieldByName('×ܼÛ').asfloat=0 then
|
|
|
begin
|
|
|
result:=false;
|
|
|
MessageDlg('ÏäƤÖز»ÄÜΪ¿Õ!',mtWarning,[mbOk],0);
|
|
|
// exit;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_swi.get_goods(str:widestring):widestring;
|
|
|
var
|
|
|
str_all:Tstringlist;
|
|
|
r_str:widestring;
|
|
|
i:integer;
|
|
|
begin
|
|
|
str:=Changestr(trim(str));
|
|
|
str_all:=Tstringlist.Create;
|
|
|
str_all.Text:=str;
|
|
|
for i:=0 to str_all.Count-1 do
|
|
|
begin
|
|
|
r_str:=r_str+' '+str_all[i];
|
|
|
end;
|
|
|
result:=trim(r_str);
|
|
|
end;
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_swi.GetCtnCode(ctnkind,ctnsize:String): String;
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
ctnsize:=StringReplace(ctnsize,'''','''''',[rfReplaceAll]);
|
|
|
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('Select SWIEDI EDI´úÂë from t_code_ctn where ÏäÐÍ='''+ctnkind+''' and ³ß´ç='''+ctnsize+'''');
|
|
|
Open;
|
|
|
if not IsEmpty then
|
|
|
Result:=Trim(FieldByName('EDI´úÂë').asstring)
|
|
|
else
|
|
|
Result:='';
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
function Tfrm_op_seae_edi_swi.GetPkgCode(Pkg:String): String;
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('Select SWIEDI EDI´úÂë from t_code_package where ´úÂë='''+pkg+'''');
|
|
|
Open;
|
|
|
if not IsEmpty then
|
|
|
Result:=Trim(FieldByName('EDI´úÂë').asstring)
|
|
|
else
|
|
|
Result:='';
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
function Tfrm_op_seae_edi_swi.GetPort(PortID:String): String;
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('Select ¸Û¿ÚÃû³Æ Ó¢ÎÄÃû from t_code_edi_port where EDI´úÂë='''+PortID+'''');
|
|
|
Open;
|
|
|
if not IsEmpty then
|
|
|
Result:=Trim(FieldByName('Ó¢ÎÄÃû').asstring)
|
|
|
else
|
|
|
Result:='';
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
function Tfrm_op_seae_edi_swi.GetLoadPortEdiID(Port:String): String;
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('Select EDI´úÂë from t_code_loaport where Ó¢ÎÄÃû='''+Port+'''');
|
|
|
Open;
|
|
|
if not IsEmpty then
|
|
|
Result:=Trim(FieldByName('EDI´úÂë').asstring)
|
|
|
else
|
|
|
Result:='';
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_swi.GetPortEdiID(Port:String): String;
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('Select SWIEDI EDI´úÂë from t_code_disport where Ó¢ÎÄÃû='''+Port+'''');
|
|
|
Open;
|
|
|
if not IsEmpty then
|
|
|
Result:=Trim(FieldByName('EDI´úÂë').asstring)
|
|
|
else
|
|
|
Result:='';
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_swi.GetShipEdiNO(Ship:String): String;
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('Select ´úÂë,EDI´úÂë,¿Í»§¼ò³Æ,¿Í»§È«³Æ,À¿»õÈË,¼ÈëÈË,¼ÈëÈÕÆÚ from t_crm_client');
|
|
|
SQL.Add('where ¿Í»§ÐÔÖÊ<>''Ä¿±ê'' and ´¬¹«Ë¾=1 and ¿Í»§¼ò³Æ='''+Ship+'''');
|
|
|
SQL.Add('order by ´úÂë');
|
|
|
Open;
|
|
|
if not IsEmpty then
|
|
|
Result:=Trim(FieldByName('EDI´úÂë').asstring)
|
|
|
else
|
|
|
Result:='';
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_swi.Changestr(str:widestring):string;
|
|
|
var
|
|
|
i:integer;
|
|
|
strC:widestring;
|
|
|
begin
|
|
|
strC:='';
|
|
|
for i:=1 to length(str) do
|
|
|
begin
|
|
|
if ((str[i]=#39) or (str[i]=':') or (str[i]='''') or (str[i]='+') or (str[i]='?')) then
|
|
|
begin
|
|
|
strC:=strC+'?'+str[i];
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
strC:=strC+str[i];
|
|
|
end;
|
|
|
end;
|
|
|
result:=strC;
|
|
|
end;
|
|
|
|
|
|
function Tfrm_op_seae_edi_swi.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 (str[i]<>' ') and b then
|
|
|
s:=str[i]+s
|
|
|
else begin
|
|
|
b:=false;
|
|
|
result:=str[i]+Result;
|
|
|
end;
|
|
|
end;
|
|
|
s:=s+' ';
|
|
|
end;
|
|
|
end;
|
|
|
procedure Tfrm_op_seae_edi_swi.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_swi.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;
|
|
|
|
|
|
function Tfrm_op_seae_edi_swi.GetCharNum(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 ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'] then
|
|
|
result:=result+1;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
function Tfrm_op_seae_edi_swi.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)) or (Str[i]=Chr(9)) then begin
|
|
|
// if (Str[i]>Chr(127)) or (Str[i]=Chr(9)) or (Str[i]='<') or (Str[i]='>') then begin
|
|
|
Result:=True;
|
|
|
Exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_swi.get_txtBooking(str:Tstringlist):integer;
|
|
|
var
|
|
|
str_all,sl:Tstringlist;
|
|
|
j,Count,i,k:integer;
|
|
|
str_guodu,str_shr,str_con,str_not,freightpayer:widestring;
|
|
|
str_pay,Str_head:string;
|
|
|
function CutVoyNo(VoyNo:String):String;
|
|
|
begin
|
|
|
if length(VoyNO)<3 then exit;
|
|
|
if Pos('.',VoyNO)>0 then begin
|
|
|
Result:=Copy(VoyNO,3,length(VoyNO)-2);
|
|
|
end else
|
|
|
Result:=VoyNO;
|
|
|
end;
|
|
|
begin
|
|
|
str_all:=Tstringlist.Create;
|
|
|
count:=0;
|
|
|
str.Add('UNB+UNOC:2+'+Edit1.TEXT+':ZZZ+'+Edit3.TEXT
|
|
|
+':ZZZ+'+GetDatetime(datetimetostr(now),2)+'+'
|
|
|
+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
count:=count+1;
|
|
|
str.Add('UNH+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+'+IFTMBF:D:99B:UN'+#39);
|
|
|
count:=count+1;
|
|
|
str.Add('BGM+335+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+'SO+9'+#39); //9Ôʼ 5 ¸üÐÂ
|
|
|
|
|
|
count:=count+1;
|
|
|
str.Add('CTA+IC+:'+edit7.text+'''');
|
|
|
count:=count+1;
|
|
|
str.Add('COM+'+Edit5.text+':TE'+#39);
|
|
|
count:=count+1;
|
|
|
str.Add('COM+'+Edit6.text+':EM'+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('DTM+137:'+GetDatetime(datetimetostr(now),1)+':203'+#39);
|
|
|
count:=count+1;
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='' then
|
|
|
begin
|
|
|
showmessage('ÒµÎñ±àºÅΪ£º'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring
|
|
|
+'µÄÒµÎñÔËÊäÌõ¿îûÓÐÊäÈ룡£¡');
|
|
|
result:=-1;
|
|
|
exit;
|
|
|
end;
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='DOOR-DOOR' then
|
|
|
begin
|
|
|
str.Add('TSR+27+2'+#39);
|
|
|
end;
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='DOOR-CY' then
|
|
|
begin
|
|
|
str.Add('TSR+28+2'+#39);
|
|
|
end;
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='CY-DOOR' then
|
|
|
begin
|
|
|
str.Add('TSR+29+2'+#39);
|
|
|
end;
|
|
|
if (trim(frm_op_seae.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='CY-CY')
|
|
|
or (trim(frm_op_seae.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='CY-RAMP') then
|
|
|
begin
|
|
|
str.Add('TSR+30+2'+#39);
|
|
|
end;
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='OTHER' then
|
|
|
begin
|
|
|
str.Add('TSR+30+2'+#39);
|
|
|
end;
|
|
|
|
|
|
count:=count+1;
|
|
|
|
|
|
if Pos('PREPAID',frm_op_seae.t_op_seae.fieldbyname('¸¶·Ñ·½Ê½').asstring)>0 then
|
|
|
str_pay:=trim(frm_op_seae.t_op_seae.fieldbyname('Ô¤¸¶µØµã').asstring);
|
|
|
if Pos('COLLECT',frm_op_seae.t_op_seae.fieldbyname('¸¶·Ñ·½Ê½').asstring)>0 then
|
|
|
str_pay:=trim(frm_op_seae.t_op_seae.fieldbyname('µ½¸¶µØµã').asstring);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not bsck.Checked then
|
|
|
begin
|
|
|
str.Add('FTX+AAI+++'+frm_op_seae.t_op_seae.fieldbyname('¸¶·Ñ·½Ê½').asstring
|
|
|
+' Payable at '+str_pay+' '+
|
|
|
frm_op_seae.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring+
|
|
|
' '+frm_op_seae.t_op_seae.fieldbyname('¼þÊý').asstring+
|
|
|
trim(frm_op_seae.t_op_seae.fieldbyname('°ü×°').asstring)+' '+Changestr(frm_op_seae.t_op_seae.fieldbyname('EDI±¸×¢').asString)+#39);
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
str.Add('FTX+AAI+++'+frm_op_seae.t_op_seae.fieldbyname('¸¶·Ñ·½Ê½').asstring
|
|
|
+' Payable at '+str_pay+' '+
|
|
|
frm_op_seae.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring+
|
|
|
' '+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('¼þÊý').asstring+
|
|
|
trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('°ü×°').asstring)+' '+Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('EDI±¸×¢').asString)+#39);
|
|
|
|
|
|
end;
|
|
|
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('¸¶·Ñ·½Ê½').asstring='FREIGHT PREPAID' then
|
|
|
begin
|
|
|
str.Add('LOC+73+'+GetPortEdiID(trim(frm_op_seae.t_op_seae.fieldbyname('Ô¤¸¶µØµã').asstring))
|
|
|
+'::6:'+trim(frm_op_seae.t_op_seae.fieldbyname('Ô¤¸¶µØµã').asstring)+#39);
|
|
|
end
|
|
|
else
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('¸¶·Ñ·½Ê½').asstring='FREIGHT COLLECT' then begin
|
|
|
str.Add('LOC+73+'+trim(frm_op_seae.t_op_seae.fieldbyname('µ½¸¶µØµã´úÂë').asstring)
|
|
|
+'::6:'+trim(frm_op_seae.t_op_seae.fieldbyname('µ½¸¶µØµã').asstring)+#39);
|
|
|
end
|
|
|
else
|
|
|
str.Add('LOC+73+'+GetPortEdiID(trim(frm_op_seae.t_op_seae.fieldbyname('Ô¤¸¶µØµã').asstring))
|
|
|
+'::6:'+trim(frm_op_seae.t_op_seae.fieldbyname('Ô¤¸¶µØµã').asstring)+#39);
|
|
|
|
|
|
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('RFF+CT:'+Changestr(frm_op_seae.t_op_seae.fieldbyname('ÔË·ÑÐÒéºÅ').asstring)+#39); //
|
|
|
count:=count+1;
|
|
|
str.Add('RFF+SI:'+frm_op_seae.t_op_seae.FieldByName('ÒµÎñ±àºÅ').AsString+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if SelectCarrier then
|
|
|
begin
|
|
|
if Trim(frm_op_seae.t_op_seae.fieldbyname('ÄÚ²¿º½´ÎºÅ').asstring)<>'' then
|
|
|
begin
|
|
|
if bsSkinCheckRadioBox1.Checked then
|
|
|
str.Add('TDT+20+'+CutVoyNo(frm_op_seae.t_op_seae.fieldbyname('ÄÚ²¿º½´ÎºÅ').asstring)
|
|
|
+'+1++'+aCarrier.EdiNo+'+++:::'+frm_op_seae.t_op_seae.fieldbyname('´¬Ãû').asstring+#39)
|
|
|
else
|
|
|
str.Add('TDT+20+'+CutVoyNo(frm_op_seae.t_op_seae.fieldbyname('ÄÚ²¿º½´ÎºÅ').asstring)
|
|
|
+'+1+++++:::'+frm_op_seae.t_op_seae.fieldbyname('´¬Ãû').asstring+#39);
|
|
|
count:=count+1;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if bsSkinCheckRadioBox1.Checked then
|
|
|
str.Add('TDT+20+'+CutVoyNo(frm_op_seae.t_op_seae.fieldbyname('º½´Î').asstring)
|
|
|
+'+1++'+aCarrier.EdiNo+'+++:::'+frm_op_seae.t_op_seae.fieldbyname('´¬Ãû').asstring+#39)
|
|
|
else
|
|
|
str.Add('TDT+20+'+CutVoyNo(frm_op_seae.t_op_seae.fieldbyname('º½´Î').asstring)
|
|
|
+'+1+++++:::'+frm_op_seae.t_op_seae.fieldbyname('´¬Ãû').asstring+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if Trim(frm_op_seae.t_op_seae.fieldbyname('ÄÚ²¿º½´ÎºÅ').asstring)<>'' then
|
|
|
begin
|
|
|
if bsSkinCheckRadioBox1.Checked then
|
|
|
str.Add('TDT+20+'+CutVoyNo(frm_op_seae.t_op_seae.fieldbyname('ÄÚ²¿º½´ÎºÅ').asstring)
|
|
|
+'+1++'+GetShipEdiNO(frm_op_seae.t_op_seae.fieldbyname('´¬¹«Ë¾').asstring)+'+++:::'+frm_op_seae.t_op_seae.fieldbyname('´¬Ãû').asstring+#39)
|
|
|
else
|
|
|
str.Add('TDT+20+'+CutVoyNo(frm_op_seae.t_op_seae.fieldbyname('ÄÚ²¿º½´ÎºÅ').asstring)
|
|
|
+'+1+++++:::'+frm_op_seae.t_op_seae.fieldbyname('´¬Ãû').asstring+#39);
|
|
|
|
|
|
count:=count+1;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if bsSkinCheckRadioBox1.Checked then
|
|
|
str.Add('TDT+20+'+CutVoyNo(frm_op_seae.t_op_seae.fieldbyname('º½´Î').asstring)
|
|
|
+'+1++'+GetShipEdiNO(frm_op_seae.t_op_seae.fieldbyname('´¬¹«Ë¾').asstring)+'+++:::'+frm_op_seae.t_op_seae.fieldbyname('´¬Ãû').asstring+#39)
|
|
|
else
|
|
|
str.Add('TDT+20+'+CutVoyNo(frm_op_seae.t_op_seae.fieldbyname('º½´Î').asstring)
|
|
|
+'+1+++++:::'+frm_op_seae.t_op_seae.fieldbyname('´¬Ãû').asstring+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
str.Add('LOC+9+'+GetPortEdiIDBYEDICODE(frm_op_seae.t_op_seae.fieldbyname('×°¸Û´úÂë').asstring)
|
|
|
+':139:6:'+trim(frm_op_seae.t_op_seae.fieldbyname('×°»õ¸Û').asstring)+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('DTM+133:'+GetDatetime(datetimetostr(frm_op_seae.t_op_seae.fieldbyname('¿ª´¬ÈÕÆÚ').asDatetime),0)+':102'+#39);
|
|
|
count:=count+1;
|
|
|
if (t_op_edi.FieldByName('ÊÕ»õµØµã').asstring<>'') then begin
|
|
|
str.Add('LOC+88+'+GetPortEdiIDBYEDICODE(t_op_edi.FieldByName('ÊÕ»õ´úÂë').asstring)
|
|
|
+':139:6:'+trim(t_op_edi.FieldByName('ÊÕ»õµØµã').asstring)+#39);
|
|
|
count:=count+1;
|
|
|
end else begin
|
|
|
str.Add('LOC+88+'+GetPortEdiIDBYEDICODE(frm_op_seae.t_op_seae.fieldbyname('×°¸Û´úÂë').asstring)
|
|
|
+':139:6:'+trim(frm_op_seae.t_op_seae.fieldbyname('×°»õ¸Û').asstring)+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
end;
|
|
|
|
|
|
str.Add('LOC+11+'+GetPortEdiIDBYEDICODE(frm_op_seae.t_op_seae.fieldbyname('ж»õ´úÂë').asstring)
|
|
|
+':139:6:'+trim(frm_op_seae.t_op_seae.fieldbyname('ж»õ¸Û').asstring)+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('Ä¿µÄµØ').asstring)<>'' then
|
|
|
begin
|
|
|
str.Add('LOC+7+'+GetPortEdiIDBYEDICODE(frm_op_seae.t_op_seae.fieldbyname('Ä¿µÄµØ´úÂë').asstring) //?
|
|
|
+':139:6:'+trim(frm_op_seae.t_op_seae.fieldbyname('Ä¿µÄµØ').asstring)+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
|
|
|
str_all.Clear;
|
|
|
str_head:='';
|
|
|
|
|
|
if not bsck.Checked then
|
|
|
begin
|
|
|
if t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring<>'' then begin
|
|
|
str_all.Text:=Changestr(t_op_edi.fieldbyname('AMS·¢»õÈË').asstring);
|
|
|
end else begin
|
|
|
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('·¢»õÈË´úÂë').asstring);
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
str_all.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('·¢»õÈË´úÂë').asstring);
|
|
|
end;
|
|
|
GetLengthTString(str_all,45);
|
|
|
str_guodu:='NAD+CZ++'+str_all[0]+':';
|
|
|
if str_all.Count>=2 then
|
|
|
str_guodu:=str_guodu+str_all[1];
|
|
|
if (str_all.Count>=3) and (str_all.Count<=5) then
|
|
|
begin
|
|
|
for j:=2 to str_all.Count-1 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
end;
|
|
|
if str_all.Count>5 then
|
|
|
begin
|
|
|
for j:=2 to 3 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
|
|
|
str_guodu:=str_guodu+':'+Copy(str_all[4],1,34)+'*';
|
|
|
Str_shr:='*'+Copy(str_all[4],34,1);
|
|
|
for j:=5 to str_all.Count-1 do begin
|
|
|
Str_shr:=Str_shr+' '+str_all[j]
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
str_guodu:=str_guodu+#39;
|
|
|
str.Add(str_guodu);
|
|
|
count:=count+1;
|
|
|
|
|
|
str_head:='';
|
|
|
str_all.Clear;
|
|
|
|
|
|
if not bsck.Checked then
|
|
|
begin
|
|
|
if t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring<>'' then
|
|
|
begin
|
|
|
str_all.Text:=Changestr(t_op_edi.fieldbyname('AMSÊÕ»õÈË').asstring);
|
|
|
end else
|
|
|
begin
|
|
|
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('ÊÕ»õÈË´úÂë').asstring);
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
str_all.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('ÊÕ»õÈË´úÂë').asstring);
|
|
|
end;
|
|
|
GetLengthTString(str_all,45);
|
|
|
str_guodu:='NAD+CN++'+str_all[0]+':';
|
|
|
if str_all.Count>=2 then
|
|
|
str_guodu:=str_guodu+str_all[1];
|
|
|
if (str_all.Count>=3) and (str_all.Count<=5) then
|
|
|
begin
|
|
|
for j:=2 to str_all.Count-1 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if str_all.Count>5 then
|
|
|
begin
|
|
|
for j:=2 to 3 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
str_guodu:=str_guodu+':'+Copy(str_all[4],1,33)+'**';
|
|
|
Str_con:='**'+Copy(str_all[4],33,1);
|
|
|
for j:=5 to str_all.Count-1 do begin
|
|
|
Str_con:=Str_con+' '+str_all[j]
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
if (t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring='ÃÀ¹ú') then begin
|
|
|
str_guodu:=str_guodu+'+++'+t_op_edi.FieldByName('ÊÕ»õÈËÓʱà').asstring+#39;
|
|
|
str.Add(str_guodu);
|
|
|
end else if (t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring='¼ÓÄôó') then begin
|
|
|
str_guodu:=str_guodu+'+++'+t_op_edi.FieldByName('ÊÕ»õÈËÓʱà').asstring+'+CA'+#39;
|
|
|
str.Add(str_guodu);
|
|
|
end else if (t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring='°ÍÎ÷') then begin
|
|
|
str_guodu:=str_guodu+'++++'+t_op_edi.FieldByName('ÊÕ»õÈ˹ú¼Ò´úÂë').asstring+#39;
|
|
|
str.Add(str_guodu);
|
|
|
str.Add('RFF+GN:'+t_op_edi.FieldByName('ÊÕ»õÈËË°ºÅ').asstring+#39); //
|
|
|
count:=count+1;
|
|
|
end else begin
|
|
|
str_guodu:=str_guodu+#39;
|
|
|
str.Add(str_guodu);
|
|
|
end;
|
|
|
|
|
|
count:=count+1;
|
|
|
|
|
|
str_head:='';
|
|
|
str_all.Clear;
|
|
|
if not bsck.Checked then
|
|
|
begin
|
|
|
if t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring<>'' then begin
|
|
|
str_all.Text:=Changestr(t_op_edi.fieldbyname('AMS֪ͨÈË').asstring);
|
|
|
end else begin
|
|
|
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('֪ͨÈË´úÂë').asstring);
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
str_all.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('֪ͨÈË´úÂë').asstring);
|
|
|
end;
|
|
|
|
|
|
GetLengthTString(str_all,45);
|
|
|
str_guodu:='NAD+NI++'+str_all[0]+':';
|
|
|
if str_all.Count>=2 then
|
|
|
str_guodu:=str_guodu+str_all[1];
|
|
|
if (str_all.Count>=3) and (str_all.Count<=5) then
|
|
|
begin
|
|
|
for j:=2 to str_all.Count-1 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
end;
|
|
|
if str_all.Count>5 then
|
|
|
begin
|
|
|
for j:=2 to 3 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
str_guodu:=str_guodu+':'+Copy(str_all[4],1,32)+'***';
|
|
|
Str_not:='***'+Copy(str_all[4],32,1);
|
|
|
for j:=5 to str_all.Count-1 do begin
|
|
|
Str_not:=Str_not+' '+str_all[j]
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if (t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring='ÃÀ¹ú') then begin
|
|
|
str_guodu:=str_guodu+'+++'+t_op_edi.FieldByName('֪ͨÈËÓʱà').asstring+#39;
|
|
|
str.Add(str_guodu);
|
|
|
end else if (t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring='¼ÓÄôó') then begin
|
|
|
str_guodu:=str_guodu+#39;
|
|
|
str.Add(str_guodu);
|
|
|
end else if (t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring='°ÍÎ÷') then begin
|
|
|
if t_op_edi.FieldByName('֪ͨÈ˹ú¼Ò´úÂë').asstring<>'' then
|
|
|
str_guodu:=str_guodu+'++++'+t_op_edi.FieldByName('֪ͨÈ˹ú¼Ò´úÂë').asstring+#39
|
|
|
else
|
|
|
str_guodu:=str_guodu+#39;
|
|
|
str.Add(str_guodu);
|
|
|
if t_op_edi.FieldByName('֪ͨÈËË°ºÅ').asstring<>'' then begin
|
|
|
str.Add('RFF+GN:'+t_op_edi.FieldByName('֪ͨÈËË°ºÅ').asstring+#39); //
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
end else begin
|
|
|
str_guodu:=str_guodu+#39;
|
|
|
str.Add(str_guodu);
|
|
|
end;
|
|
|
|
|
|
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('NAD+CA+'+'SWI'+':160:86++'+'SWI'+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='DOOR-DOOR' then
|
|
|
begin
|
|
|
if not bsck.Checked then
|
|
|
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('·¢»õÈË´úÂë').asstring)
|
|
|
else str_all.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('·¢»õÈË´úÂë').asstring);
|
|
|
|
|
|
GetLengthTString(str_all,35);
|
|
|
|
|
|
str_guodu:='NAD+SF++'+str_all[0]+':';
|
|
|
if str_all.Count>=2 then
|
|
|
str_guodu:=str_guodu+str_all[1];
|
|
|
if (str_all.Count>=3) and (str_all.Count<=5) then
|
|
|
begin
|
|
|
for j:=2 to str_all.Count-1 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
end;
|
|
|
if str_all.Count>5 then
|
|
|
begin
|
|
|
for j:=2 to 4 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
str_guodu:=str_guodu+#39;
|
|
|
str.Add(str_guodu);
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('CTA+IC+:'+edit7.text+'''');
|
|
|
count:=count+1;
|
|
|
str.Add('COM+'+Edit5.text+':TE'+#39);
|
|
|
count:=count+1;
|
|
|
str.Add('COM+'+Edit6.text+':EM'+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
str_head:='';
|
|
|
str_all.Clear;
|
|
|
|
|
|
|
|
|
if not bsck.Checked then begin
|
|
|
if t_op_edi.fieldbyname('ËùÔÚ¹ú¼Ò').AsString<>'' then
|
|
|
begin
|
|
|
str_all.Text:=Changestr(t_op_edi.fieldbyname('AMSÊÕ»õÈË').asstring); //t_op_edi
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('ÊÕ»õÈË´úÂë').asstring);
|
|
|
end;
|
|
|
if (pos('TO ORDER',UpperCase(str_all.Text))>0) or (pos('SAME AS',UpperCase(str_all.Text))>0) then
|
|
|
if t_op_edi.fieldbyname('ËùÔÚ¹ú¼Ò').AsString<>'' then
|
|
|
begin
|
|
|
str_all.Text:=Changestr(t_op_edi.fieldbyname('֪ͨÈË´úÂë').asstring);
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('֪ͨÈË´úÂë').asstring);
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
str_all.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('ÊÕ»õÈË´úÂë').asstring);
|
|
|
end;
|
|
|
|
|
|
GetLengthTString(str_all,35);
|
|
|
str_guodu:='NAD+ST++'+str_all[0]+':';
|
|
|
if str_all.Count>=2 then
|
|
|
str_guodu:=str_guodu+str_all[1];
|
|
|
if (str_all.Count>=3) and (str_all.Count<=5) then
|
|
|
begin
|
|
|
for j:=2 to str_all.Count-1 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
end;
|
|
|
if str_all.Count>5 then
|
|
|
begin
|
|
|
for j:=2 to 4 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
end;
|
|
|
str_guodu:=str_guodu+#39;
|
|
|
str.Add(str_guodu);
|
|
|
count:=count+1;
|
|
|
str.Add('CTA+IC+:'+edit7.text+'''');
|
|
|
count:=count+1;
|
|
|
str.Add('COM+'+Edit5.text+':TE'+#39);
|
|
|
count:=count+1;
|
|
|
str.Add('COM+'+Edit6.text+':EM'+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='DOOR-CY' then
|
|
|
begin
|
|
|
|
|
|
str_all.Text:=Changestr(edit12.text);
|
|
|
GetLengthTString(str_all,35);
|
|
|
str_guodu:='NAD+SF++'+str_all[0]+'+';
|
|
|
if str_all.Count>=2 then
|
|
|
str_guodu:=str_guodu+str_all[1];
|
|
|
if (str_all.Count>=3) and (str_all.Count<=5) then
|
|
|
begin
|
|
|
for j:=2 to str_all.Count-1 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
end;
|
|
|
if str_all.Count>5 then
|
|
|
begin
|
|
|
for j:=2 to 4 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
end;
|
|
|
str_guodu:=str_guodu+#39;
|
|
|
str.Add(str_guodu);
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('CTA+IC+:'+edit7.text+'''');
|
|
|
count:=count+1;
|
|
|
str.Add('COM+'+Edit5.text+':TE'+#39);
|
|
|
count:=count+1;
|
|
|
str.Add('COM+'+Edit6.text+':EM'+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='CY-DOOR' then
|
|
|
begin
|
|
|
str_head:='';
|
|
|
str_all.Clear;
|
|
|
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('DOORµØÖ·').asstring);
|
|
|
|
|
|
GetLengthTString(str_all,35);
|
|
|
str_guodu:='NAD+ST++'+str_all[0]+'+';
|
|
|
if str_all.Count>=2 then
|
|
|
str_guodu:=str_guodu+str_all[1];
|
|
|
if (str_all.Count>=3) and (str_all.Count<=5) then
|
|
|
begin
|
|
|
for j:=2 to str_all.Count-1 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
end;
|
|
|
if str_all.Count>5 then
|
|
|
begin
|
|
|
for j:=2 to 4 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
end;
|
|
|
str_guodu:=str_guodu+#39;
|
|
|
str.Add(str_guodu);
|
|
|
count:=count+1;
|
|
|
str.Add('CTA+IC+:'+edit7.text+'''');
|
|
|
count:=count+1;
|
|
|
str.Add('COM+'+Edit5.text+':TE'+#39);
|
|
|
count:=count+1;
|
|
|
str.Add('COM+'+Edit6.text+':EM'+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
str.Add('NAD+BP+2021015294+Smart International Logistics'+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
if (frm_op_seae.t_op_seae.fieldbyname('ºÏͬºÅ').asstring<>'') then begin
|
|
|
str.Add('NAD+ZZZ++'+frm_op_seae.t_op_seae.fieldbyname('ºÏͬºÅ').asstring+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if Pos('PREPAID',frm_op_seae.t_op_seae.fieldbyname('¸¶·Ñ·½Ê½').asstring)>0 then
|
|
|
str.Add('CPI+4++P''')
|
|
|
else if Pos('COLLECT',frm_op_seae.t_op_seae.fieldbyname('¸¶·Ñ·½Ê½').asstring)>0 then
|
|
|
str.Add('CPI+4++C''')
|
|
|
else str.Add('CPI+4++B''');
|
|
|
count:=count+1;
|
|
|
|
|
|
if not bsck.Checked then
|
|
|
begin
|
|
|
str.Add('GID+1+'+frm_op_seae.t_op_seae.fieldbyname('¼þÊý').asstring+':'+
|
|
|
GetPkgCode(trim(frm_op_seae.t_op_seae.fieldbyname('°ü×°').asstring))+'::6:'+frm_op_seae.t_op_seae.fieldbyname('°ü×°').asstring+#39); //£¿
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
str.Add('GID+1+'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('¼þÊý').asstring+':'+
|
|
|
GetPkgCode(trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('°ü×°').asstring))+'::6:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('°ü×°').asstring+#39); //£¿
|
|
|
end;
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
|
|
|
sl:=TStringList.Create;
|
|
|
try
|
|
|
if not bsck.Checked then
|
|
|
begin
|
|
|
sl.text:=frm_op_seae.t_op_seae.fieldbyname('»õÎïÃèÊö').asstring;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
sl.text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('»õÎïÃèÊö').asstring;
|
|
|
end;
|
|
|
for i:=0 to sl.Count-1 do begin
|
|
|
str.Add('FTX+AAA+++'+Changestr(sl.Strings[i])+''+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(sl);
|
|
|
end;
|
|
|
|
|
|
if Trim(str_shr)<>'' then begin
|
|
|
str.Add('FTX+AAA+++'+
|
|
|
Str_shr+#39);
|
|
|
count:=count+2;
|
|
|
end;
|
|
|
if Trim(str_con)<>'' then begin
|
|
|
str.Add('FTX+AAA+++'+
|
|
|
Str_con+#39);
|
|
|
count:=count+2;
|
|
|
end;
|
|
|
if Trim(str_not)<>'' then begin
|
|
|
str.Add('FTX+AAA+++'+
|
|
|
Str_not+#39);
|
|
|
count:=count+2;
|
|
|
end;
|
|
|
|
|
|
if not bsck.Checked then
|
|
|
begin
|
|
|
str.Add('MEA+AAE+G+KGM:'+frm_op_seae.t_op_seae.fieldbyname('ÖØÁ¿').asstring+#39);
|
|
|
count:=count+1;
|
|
|
str.Add('MEA+AAE+AAW+MTQ:'+frm_op_seae.t_op_seae.fieldbyname('³ßÂë').asstring+#39);
|
|
|
count:=count+1;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
str.Add('MEA+AAE+G+KGM:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('ÖØÁ¿').asstring+#39);
|
|
|
count:=count+1;
|
|
|
str.Add('MEA+AAE+AAW+MTQ:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('³ßÂë').asstring+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if Trim(t_op_edi.fieldbyname('»õÎïNCM±àºÅ').asstring)<>'' then
|
|
|
begin
|
|
|
str.Add('RFF+ABT:'+t_op_edi.fieldbyname('»õÎïNCM±àºÅ').asstring+#39); //£¿
|
|
|
count:=count+1;
|
|
|
end else begin
|
|
|
|
|
|
end;
|
|
|
|
|
|
if (t_op_edi.fieldbyname('³¬ÏÞÏä±êÖ¾').asstring='Y') then begin
|
|
|
t_op_ctn.Close;t_op_ctn.SQL.Clear;
|
|
|
t_op_ctn.SQL.Add('SELECT * ');
|
|
|
t_op_ctn.SQL.Add('FROM t_op_ctn ');
|
|
|
t_op_ctn.SQL.Add('WHERE t_op_ctn.񅧏=:񅧏');
|
|
|
t_op_ctn.close;
|
|
|
t_op_ctn.Parameters.ParamByName('񅧏').Value:=frm_op_seae.t_op_seae.fieldbyname('񅧏').asstring;
|
|
|
t_op_ctn.Open;
|
|
|
if (not t_op_ctn.IsEmpty) then begin
|
|
|
str.Add('DIM+9+MTR:'+t_op_ctn.fieldbyname('³¤').AsString+':'+t_op_ctn.fieldbyname('¿í').AsString+':'+t_op_ctn.fieldbyname('¸ß').AsString+#39); //£¿
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
sl:=TStringList.Create;
|
|
|
try
|
|
|
if not bsck.Checked then
|
|
|
begin
|
|
|
sl.text:=frm_op_seae.t_op_seae.fieldbyname('ßéÍ·').asString;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
sl.text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('ßéÍ·').asString;
|
|
|
end;
|
|
|
GetLengthTString(sl,35);
|
|
|
for i:=0 to sl.Count-1 do begin
|
|
|
str.Add('PCI++'+Changestr(sl.Strings[i])+''+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(sl);
|
|
|
end;
|
|
|
|
|
|
if ((frm_op_seae.t_op_seae.FieldByName('»õÎï±êʶ').asstring='D') OR (trim(frm_op_seae.t_op_seae.FieldByName('»õÎï±êʶ').asstring)='T')) then
|
|
|
begin
|
|
|
str.Add('DGS+IMD+'+frm_op_seae.t_op_seae.fieldbyname('ΣÏÕÆ··ÖÀà').asstring
|
|
|
+'+'+frm_op_seae.t_op_seae.fieldbyname('ΣÏÕÆ·±àºÅ').asstring+#39);
|
|
|
count:=count+1;
|
|
|
str.Add('CTA+HG+:'+edit7.text+#39);
|
|
|
count:=count+1;
|
|
|
str.Add('COM+'+Edit5.text+':TE'+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if not bsck.Checked then
|
|
|
begin
|
|
|
t_op_ctn.Close;t_op_ctn.SQL.Clear;
|
|
|
t_op_ctn.SQL.Add('SELECT t_op_ctn.±àºÅ,t_op_ctn.ÊýÁ¿, t_code_ctn.EDI´úÂë,t_op_ctn.³ß´ç,t_op_ctn.°ü×°');
|
|
|
t_op_ctn.SQL.Add(',t_op_ctn.ÏäÐÍ,t_op_ctn.ÏäºÅ,t_op_ctn.ÖØÁ¿,t_op_ctn.·âºÅ,t_op_ctn.³ßÂë,t_op_ctn.¼þÊý');
|
|
|
t_op_ctn.SQL.Add('FROM t_op_ctn INNER JOIN');
|
|
|
t_op_ctn.SQL.Add('t_code_ctn ON t_op_ctn.´úÂë = t_code_ctn.´úÂë');
|
|
|
t_op_ctn.SQL.Add('WHERE t_op_ctn.񅧏=:񅧏');
|
|
|
t_op_ctn.close;
|
|
|
t_op_ctn.Parameters.ParamByName('񅧏').Value:=frm_op_seae.t_op_seae.fieldbyname('񅧏').asstring;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_op_ctn.Close;t_op_ctn.SQL.Clear;
|
|
|
t_op_ctn.SQL.Add('SELECT t_op_ctn_fendan.±àºÅ,t_op_ctn_fendan.ÊýÁ¿, t_code_ctn.EDI´úÂë,t_op_ctn_fendan.³ß´ç,t_op_ctn_fendan.°ü×°');
|
|
|
t_op_ctn.SQL.Add(',t_op_ctn_fendan.ÏäÐÍ,t_op_ctn_fendan.ÏäºÅ,t_op_ctn_fendan.ÖØÁ¿,t_op_ctn_fendan.·âºÅ,t_op_ctn_fendan.³ßÂë,t_op_ctn_fendan.¼þÊý');
|
|
|
t_op_ctn.SQL.Add('FROM t_op_ctn_fendan INNER JOIN');
|
|
|
t_op_ctn.SQL.Add('t_code_ctn ON t_op_ctn_fendan.´úÂë = t_code_ctn.´úÂë');
|
|
|
t_op_ctn.SQL.Add('WHERE t_op_ctn_fendan.as_id=:as_id');
|
|
|
t_op_ctn.close;
|
|
|
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;
|
|
|
t_op_ctn.first;
|
|
|
while not t_op_ctn.eof do
|
|
|
begin
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('ÊÇ·ñ×ÔÓÐÏä').asboolean then
|
|
|
str.Add('EQD+CN++'+GetCtnCode(t_op_ctn.fieldbyname('ÏäÐÍ').asstring,t_op_ctn.fieldbyname('³ß´ç').asstring)+'+1'+#39)
|
|
|
else
|
|
|
str.Add('EQD+CN++'+GetCtnCode(t_op_ctn.fieldbyname('ÏäÐÍ').asstring,t_op_ctn.fieldbyname('³ß´ç').asstring)+'+2'+#39); //ÏäÐÍ ¶àÏäÐÍ
|
|
|
count:=count+1;
|
|
|
str.Add('EQN+'+t_op_ctn.fieldbyname('ÊýÁ¿').asstring+#39); //ÊýÁ¿
|
|
|
count:=count+1;
|
|
|
str.Add('TMD+3++MM'+#39); //ÊýÁ¿
|
|
|
count:=count+1;
|
|
|
if (frm_op_seae.t_op_seae.FieldByName('»õÎï±êʶ').asstring='R') OR (trim(frm_op_seae.t_op_seae.FieldByName('»õÎï±êʶ').asstring)='T') then
|
|
|
begin
|
|
|
|
|
|
if Trim(frm_op_seae.t_op_seae.fieldbyname('Àä²Øͨ·çÁ¿').asstring)<>'' then
|
|
|
begin
|
|
|
str.Add('MEA+AAE+AAS+CBM:'+frm_op_seae.t_op_seae.fieldbyname('Àä²Øͨ·çÁ¿').asstring+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
|
|
|
if Trim(frm_op_seae.t_op_seae.fieldbyname('ʪ¶È').asstring)<>'' then
|
|
|
begin
|
|
|
str.Add('MEA+AAE+AAO+HMD:'+frm_op_seae.t_op_seae.fieldbyname('ʪ¶È').asstring+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if (frm_op_seae.t_op_seae.FieldByName('»õÎï±êʶ').asstring='R') OR (trim(frm_op_seae.t_op_seae.FieldByName('»õÎï±êʶ').asstring)='T') then
|
|
|
begin
|
|
|
str.Add('TMP+2+'+frm_op_seae.t_op_seae.fieldbyname('ÉèÖÃζÈ').asstring+':CEL'+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
t_op_ctn.next;
|
|
|
end;
|
|
|
|
|
|
count:=count+1;
|
|
|
|
|
|
result:=count;
|
|
|
end;
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_swi.get_txtSI(str: Tstringlist): integer; //ÌᵥȷÈÏ
|
|
|
var
|
|
|
str_all,sl:Tstringlist;
|
|
|
ctnlist:TStringList;
|
|
|
j,Count,i,k,Lineno:integer;
|
|
|
str_guodu,str_shr,str_con,str_not:widestring;
|
|
|
str_pay,Str_head,str1,str2,CopyBillCount:string;
|
|
|
aAdoQuery:TAdoQuery;
|
|
|
function CutVoyNo(VoyNo:String):String;
|
|
|
begin
|
|
|
if length(VoyNO)<3 then exit;
|
|
|
if Pos('.',VoyNO)>0 then begin
|
|
|
Result:=Copy(VoyNO,3,length(VoyNO)-2);
|
|
|
end else
|
|
|
Result:=VoyNO;
|
|
|
end;
|
|
|
begin
|
|
|
|
|
|
|
|
|
str_all:=Tstringlist.Create;
|
|
|
count:=0;
|
|
|
str.Add('UNB+UNOC:2+'+Edit1.TEXT+':ZZZ+'+Edit3.TEXT
|
|
|
+':ZZZ+'+GetDatetime(datetimetostr(now),2)+'+'
|
|
|
+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
count:=count+1;
|
|
|
str.Add('UNH+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+'+IFTMIN:D:99B:UN'+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
if not bsck.checked then
|
|
|
begin
|
|
|
if RadioGroup3.ItemIndex=0 then
|
|
|
str.Add('BGM+340+'+frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'+9'+#39)
|
|
|
else str.Add('BGM+340+'+frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'+5'+#39);
|
|
|
count:=count+1;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if RadioGroup3.ItemIndex=0 then
|
|
|
str.Add('BGM+340+'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'+9'+#39)
|
|
|
else str.Add('BGM+340+'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'+5'+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='' then
|
|
|
begin
|
|
|
showmessage('ÒµÎñ±àºÅΪ£º'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring
|
|
|
+'µÄÒµÎñÔËÊäÌõ¿îûÓÐÊäÈ룡£¡');
|
|
|
result:=-1;
|
|
|
exit;
|
|
|
end;
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='DOOR-DOOR' then
|
|
|
begin
|
|
|
str.Add('TSR+27+2'+#39);
|
|
|
end;
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='DOOR-CY' then
|
|
|
begin
|
|
|
str.Add('TSR+28+2'+#39);
|
|
|
end;
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='CY-DOOR' then
|
|
|
begin
|
|
|
str.Add('TSR+29+2'+#39);
|
|
|
end;
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='CY-CY' then
|
|
|
begin
|
|
|
str.Add('TSR+30+2'+#39);
|
|
|
end;
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='OTHER' then
|
|
|
begin
|
|
|
str.Add('TSR+30+2'+#39);
|
|
|
end;
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if Pos('PREPAID',frm_op_seae.t_op_seae.fieldbyname('¸¶·Ñ·½Ê½').asstring)>0 then
|
|
|
str_pay:=trim(frm_op_seae.t_op_seae.fieldbyname('Ô¤¸¶µØµã').asstring);
|
|
|
if Pos('COLLECT',frm_op_seae.t_op_seae.fieldbyname('¸¶·Ñ·½Ê½').asstring)>0 then
|
|
|
str_pay:=trim(frm_op_seae.t_op_seae.fieldbyname('µ½¸¶µØµã').asstring);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sl:=TStringList.Create;
|
|
|
try
|
|
|
if not bsck.checked then
|
|
|
sl.text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('EDI±¸×¢').asString)
|
|
|
else sl.text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('EDI±¸×¢').asString);
|
|
|
for i:=0 to sl.Count-1 do begin
|
|
|
str.Add('FTX+AAI+++'+sl.Strings[i]+''+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(sl);
|
|
|
end;
|
|
|
|
|
|
if (t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring='¼ÓÄôó') then begin
|
|
|
if (t_op_edi.FieldByName('SCAC񅧏').asstring<>'') then
|
|
|
str.Add('FTX+CCI++MFS+1:CA:'+t_op_edi.FieldByName('SCAC񅧏').asstring+#39)
|
|
|
else
|
|
|
str.Add('FTX+CCI++MFS+5:CA'+#39);
|
|
|
end;
|
|
|
if (t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring='ÃÀ¹ú') then begin
|
|
|
if (t_op_edi.FieldByName('SCAC񅧏').asstring<>'') then
|
|
|
str.Add('FTX+CCI++MFS+1:US:'+t_op_edi.FieldByName('SCAC񅧏').asstring+#39)
|
|
|
else
|
|
|
str.Add('FTX+CCI++MFS+5:US'+#39);
|
|
|
end;
|
|
|
|
|
|
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('¸¶·Ñ·½Ê½').asstring='FREIGHT PREPAID' then
|
|
|
begin
|
|
|
str.Add('LOC+57+'+GetPortEdiID(trim(frm_op_seae.t_op_seae.fieldbyname('Ô¤¸¶µØµã').asstring))
|
|
|
+'::6:'+trim(frm_op_seae.t_op_seae.fieldbyname('Ô¤¸¶µØµã').asstring)+#39);
|
|
|
end
|
|
|
else
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('¸¶·Ñ·½Ê½').asstring='FREIGHT COLLECT' then begin
|
|
|
str.Add('LOC+57+'+trim(frm_op_seae.t_op_seae.fieldbyname('µ½¸¶µØµã´úÂë').asstring)
|
|
|
+'::6:'+trim(frm_op_seae.t_op_seae.fieldbyname('µ½¸¶µØµã').asstring)+#39);
|
|
|
end
|
|
|
else
|
|
|
str.Add('LOC+57+'+GetPortEdiID(trim(frm_op_seae.t_op_seae.fieldbyname('Ô¤¸¶µØµã').asstring))
|
|
|
+'::6:'+trim(frm_op_seae.t_op_seae.fieldbyname('Ô¤¸¶µØµã').asstring)+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('LOC+73+'+GetPortEdiID(trim(frm_op_seae.t_op_seae.fieldbyname('Ç©µ¥µØµã').asstring))
|
|
|
+'::6:'+trim(frm_op_seae.t_op_seae.fieldbyname('Ç©µ¥µØµã').asstring)+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
if not bsck.checked then
|
|
|
begin
|
|
|
|
|
|
|
|
|
if t_op_edi.IsEmpty or (t_op_edi.FieldByName('¶¨²ÕºÅ').AsString='') then
|
|
|
str.Add('RFF+BN:'+frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+#39)
|
|
|
else
|
|
|
str.Add('RFF+BN:'+t_op_edi.FieldByName('¶¨²ÕºÅ').AsString+#39);
|
|
|
// end;
|
|
|
count:=count+1;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
|
|
|
|
|
|
str.Add('RFF+BN:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if not bsck.checked then
|
|
|
begin
|
|
|
str.Add('RFF+SI:'+frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+#39);
|
|
|
count:=count+1;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
str.Add('RFF+SI:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
str.Add('RFF+CT:'+Changestr(frm_op_seae.t_op_seae.fieldbyname('ÔË·ÑÐÒéºÅ').asstring)+#39); //
|
|
|
count:=count+1;
|
|
|
|
|
|
if (t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring='ÃÀ¹ú') then begin
|
|
|
str.Add('REF+TN:'+Changestr(t_op_edi.FieldByName('ITN񅧏').asstring)+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if Pos('PREPAID',frm_op_seae.t_op_seae.fieldbyname('¸¶·Ñ·½Ê½').asstring)>0 then
|
|
|
str.Add('CPI+4++P''')
|
|
|
else
|
|
|
str.Add('CPI+4++C''');
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
|
|
|
if SelectCarrier then
|
|
|
begin
|
|
|
if Trim(frm_op_seae.t_op_seae.fieldbyname('ÄÚ²¿º½´ÎºÅ').asstring)<>'' then
|
|
|
begin
|
|
|
if bsSkinCheckRadioBox1.Checked then
|
|
|
str.Add('TDT+20+'+CutVoyNo(frm_op_seae.t_op_seae.fieldbyname('ÄÚ²¿º½´ÎºÅ').asstring)
|
|
|
+'+1++'+aCarrier.EdiNo+'+++:::'+frm_op_seae.t_op_seae.fieldbyname('´¬Ãû').asstring+#39)
|
|
|
else
|
|
|
str.Add('TDT+20+'+CutVoyNo(frm_op_seae.t_op_seae.fieldbyname('ÄÚ²¿º½´ÎºÅ').asstring)
|
|
|
+'+1+++++:::'+frm_op_seae.t_op_seae.fieldbyname('´¬Ãû').asstring+#39);
|
|
|
count:=count+1;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if bsSkinCheckRadioBox1.Checked then
|
|
|
str.Add('TDT+20+'+CutVoyNo(frm_op_seae.t_op_seae.fieldbyname('º½´Î').asstring)
|
|
|
+'+1++'+aCarrier.EdiNo+'+++:::'+frm_op_seae.t_op_seae.fieldbyname('´¬Ãû').asstring+#39)
|
|
|
else
|
|
|
str.Add('TDT+20+'+CutVoyNo(frm_op_seae.t_op_seae.fieldbyname('º½´Î').asstring)
|
|
|
+'+1+++++:::'+frm_op_seae.t_op_seae.fieldbyname('´¬Ãû').asstring+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if Trim(frm_op_seae.t_op_seae.fieldbyname('ÄÚ²¿º½´ÎºÅ').asstring)<>'' then
|
|
|
begin
|
|
|
if bsSkinCheckRadioBox1.Checked then
|
|
|
str.Add('TDT+20+'+CutVoyNo(frm_op_seae.t_op_seae.fieldbyname('ÄÚ²¿º½´ÎºÅ').asstring)
|
|
|
+'+1++'+GetShipEdiNO(frm_op_seae.t_op_seae.fieldbyname('´¬¹«Ë¾').asstring)+'+++:::'+frm_op_seae.t_op_seae.fieldbyname('´¬Ãû').asstring+#39)
|
|
|
else
|
|
|
str.Add('TDT+20+'+CutVoyNo(frm_op_seae.t_op_seae.fieldbyname('ÄÚ²¿º½´ÎºÅ').asstring)
|
|
|
+'+1+++++:::'+frm_op_seae.t_op_seae.fieldbyname('´¬Ãû').asstring+#39);
|
|
|
|
|
|
count:=count+1;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if bsSkinCheckRadioBox1.Checked then
|
|
|
str.Add('TDT+20+'+CutVoyNo(frm_op_seae.t_op_seae.fieldbyname('º½´Î').asstring)
|
|
|
+'+1++'+GetShipEdiNO(frm_op_seae.t_op_seae.fieldbyname('´¬¹«Ë¾').asstring)+'+++:::'+frm_op_seae.t_op_seae.fieldbyname('´¬Ãû').asstring+#39)
|
|
|
else
|
|
|
str.Add('TDT+20+'+CutVoyNo(frm_op_seae.t_op_seae.fieldbyname('º½´Î').asstring)
|
|
|
+'+1+++++:::'+frm_op_seae.t_op_seae.fieldbyname('´¬Ãû').asstring+#39);
|
|
|
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
str.Add('LOC+9+'+GetPortEdiIDBYEDICODE(frm_op_seae.t_op_seae.fieldbyname('×°¸Û´úÂë').asstring)
|
|
|
+':139:6:'+trim(frm_op_seae.t_op_seae.fieldbyname('×°»õ¸Û').asstring)+#39);
|
|
|
count:=count+1;
|
|
|
if (t_op_edi.FieldByName('ÊÕ»õµØµã').asstring<>'') then begin
|
|
|
str.Add('LOC+88+'+GetPortEdiIDBYEDICODE(t_op_edi.FieldByName('ÊÕ»õ´úÂë').asstring)
|
|
|
+':139:6:'+trim(t_op_edi.FieldByName('ÊÕ»õµØµã').asstring)+#39);
|
|
|
count:=count+1;
|
|
|
end else begin
|
|
|
str.Add('LOC+88+'+GetPortEdiIDBYEDICODE(frm_op_seae.t_op_seae.fieldbyname('×°¸Û´úÂë').asstring)
|
|
|
+':139:6:'+trim(frm_op_seae.t_op_seae.fieldbyname('×°»õ¸Û').asstring)+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
end;
|
|
|
|
|
|
str.Add('LOC+11+'+GetPortEdiIDBYEDICODE(frm_op_seae.t_op_seae.fieldbyname('ж»õ´úÂë').asstring)
|
|
|
+':139:6:'+trim(frm_op_seae.t_op_seae.fieldbyname('ж»õ¸Û').asstring)+#39);
|
|
|
|
|
|
|
|
|
count:=count+1;
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('Ä¿µÄµØ').asstring)<>'' then
|
|
|
begin
|
|
|
str.Add('LOC+7+'+GetPortEdiIDBYEDICODE(frm_op_seae.t_op_seae.fieldbyname('Ä¿µÄµØ´úÂë').asstring) //?
|
|
|
+':139:6:'+trim(frm_op_seae.t_op_seae.fieldbyname('Ä¿µÄµØ').asstring)+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
|
|
|
str_all.Clear;
|
|
|
str_head:='';
|
|
|
if not bsck.checked then
|
|
|
begin
|
|
|
if t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring<>'' then
|
|
|
begin
|
|
|
str_all.Text:=Changestr(t_op_edi.fieldbyname('AMS·¢»õÈË').asstring);
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('·¢»õÈË´úÂë').asstring);
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
str_all.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('·¢»õÈË´úÂë').asstring);
|
|
|
end;
|
|
|
GetLengthTString(str_all,45);
|
|
|
str_guodu:='NAD+CZ+++'+str_all[0]+'+';
|
|
|
if str_all.Count>=2 then
|
|
|
str_guodu:=str_guodu+str_all[1];
|
|
|
if (str_all.Count>=3) and (str_all.Count<=5) then
|
|
|
begin
|
|
|
for j:=2 to str_all.Count-1 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
end;
|
|
|
if str_all.Count>5 then
|
|
|
begin
|
|
|
for j:=2 to 3 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
str_guodu:=str_guodu+':'+Copy(str_all[4],1,34)+'*';
|
|
|
Str_shr:='*'+Copy(str_all[4],34,1);
|
|
|
for j:=5 to str_all.Count-1 do begin
|
|
|
Str_shr:=Str_shr+' '+str_all[j]
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
str_guodu:=str_guodu+#39;
|
|
|
str.Add(str_guodu);
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
str_head:='';
|
|
|
str_all.Clear;
|
|
|
|
|
|
if not bsck.Checked then
|
|
|
begin
|
|
|
if t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring<>'' then
|
|
|
begin
|
|
|
str_all.Text:=Changestr(t_op_edi.fieldbyname('AMSÊÕ»õÈË').asstring);
|
|
|
end else
|
|
|
begin
|
|
|
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('ÊÕ»õÈË´úÂë').asstring);
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
str_all.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('ÊÕ»õÈË´úÂë').asstring);
|
|
|
end;
|
|
|
GetLengthTString(str_all,45);
|
|
|
str_guodu:='NAD+CN+++'+str_all[0]+'+';
|
|
|
if str_all.Count>=2 then
|
|
|
str_guodu:=str_guodu+str_all[1];
|
|
|
if (str_all.Count>=3) and (str_all.Count<=5) then
|
|
|
begin
|
|
|
for j:=2 to str_all.Count-1 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
end;
|
|
|
if str_all.Count>5 then
|
|
|
begin
|
|
|
for j:=2 to 3 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
str_guodu:=str_guodu+':'+Copy(str_all[4],1,33)+'**';
|
|
|
Str_con:='**'+Copy(str_all[4],33,1);
|
|
|
for j:=5 to str_all.Count-1 do begin
|
|
|
Str_con:=Str_con+' '+str_all[j]
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if (t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring='ÃÀ¹ú') then begin
|
|
|
str_guodu:=str_guodu+'+++'+t_op_edi.FieldByName('ÊÕ»õÈËÓʱà').asstring+#39;
|
|
|
str.Add(str_guodu);
|
|
|
end else if (t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring='¼ÓÄôó') then begin
|
|
|
str_guodu:=str_guodu+'+++'+t_op_edi.FieldByName('ÊÕ»õÈËÓʱà').asstring+'+CA'+#39;
|
|
|
str.Add(str_guodu);
|
|
|
end else if (t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring='°ÍÎ÷') then begin
|
|
|
str_guodu:=str_guodu+'++++'+t_op_edi.FieldByName('ÊÕ»õÈ˹ú¼Ò´úÂë').asstring+#39;
|
|
|
str.Add(str_guodu);
|
|
|
str.Add('RFF+GN:'+t_op_edi.FieldByName('ÊÕ»õÈËË°ºÅ').asstring+#39); //
|
|
|
count:=count+1;
|
|
|
end else begin
|
|
|
str_guodu:=str_guodu+#39;
|
|
|
str.Add(str_guodu);
|
|
|
end;
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
//´úÀí
|
|
|
|
|
|
str_head:='';
|
|
|
str_all.Clear;
|
|
|
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('´úÀíÄÚÈÝ').asstring);
|
|
|
IF str_all.Count>0 then
|
|
|
begin
|
|
|
GetLengthTString(str_all,35);
|
|
|
str_guodu:='NAD+FW+++'+str_all[0]+'+';
|
|
|
if str_all.Count>=2 then
|
|
|
str_guodu:=str_guodu+str_all[1];
|
|
|
if (str_all.Count>=3) and (str_all.Count<=5) then
|
|
|
begin
|
|
|
for j:=2 to str_all.Count-1 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
end;
|
|
|
str_guodu:=str_guodu+#39;
|
|
|
str.Add(str_guodu);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
str_head:='';
|
|
|
str_all.Clear;
|
|
|
if not bsck.checked then
|
|
|
begin
|
|
|
if t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring<>'' then
|
|
|
begin
|
|
|
str_all.Text:=Changestr(t_op_edi.fieldbyname('AMS֪ͨÈË').asstring);
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('֪ͨÈË´úÂë').asstring);
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
str_all.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('֪ͨÈË´úÂë').asstring);
|
|
|
end;
|
|
|
GetLengthTString(str_all,45);
|
|
|
str_guodu:='NAD+NI+++'+str_all[0]+'+';
|
|
|
if str_all.Count>=2 then
|
|
|
str_guodu:=str_guodu+str_all[1];
|
|
|
if (str_all.Count>=3) and (str_all.Count<=5) then
|
|
|
begin
|
|
|
for j:=2 to str_all.Count-1 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
end;
|
|
|
if str_all.Count>5 then
|
|
|
begin
|
|
|
for j:=2 to 3 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
str_guodu:=str_guodu+':'+Copy(str_all[4],1,32)+'***';
|
|
|
Str_not:='***'+Copy(str_all[4],32,1);
|
|
|
for j:=5 to str_all.Count-1 do begin
|
|
|
Str_not:=Str_not+' '+str_all[j]
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if (t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring='ÃÀ¹ú') then begin
|
|
|
str_guodu:=str_guodu+'+++'+t_op_edi.FieldByName('֪ͨÈËÓʱà').asstring+#39;
|
|
|
str.Add(str_guodu);
|
|
|
end else if (t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring='¼ÓÄôó') then begin
|
|
|
str_guodu:=str_guodu+#39;
|
|
|
str.Add(str_guodu);
|
|
|
end else if (t_op_edi.FieldByName('ËùÔÚ¹ú¼Ò').asstring='°ÍÎ÷') then begin
|
|
|
if t_op_edi.FieldByName('֪ͨÈ˹ú¼Ò´úÂë').asstring<>'' then
|
|
|
str_guodu:=str_guodu+'++++'+t_op_edi.FieldByName('֪ͨÈ˹ú¼Ò´úÂë').asstring+#39
|
|
|
else
|
|
|
str_guodu:=str_guodu+#39;
|
|
|
str.Add(str_guodu);
|
|
|
if t_op_edi.FieldByName('֪ͨÈËË°ºÅ').asstring<>'' then begin
|
|
|
str.Add('RFF+GN:'+t_op_edi.FieldByName('֪ͨÈËË°ºÅ').asstring+#39); //
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
end else begin
|
|
|
str_guodu:=str_guodu+#39;
|
|
|
str.Add(str_guodu);
|
|
|
end;
|
|
|
count:=count+1;
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('µÚ¶þ֪ͨÈË').asstring)<>'' then
|
|
|
begin
|
|
|
str_head:='';
|
|
|
str_all.Clear;
|
|
|
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('µÚ¶þ֪ͨÈË').asstring);
|
|
|
GetLengthTString(str_all,35);
|
|
|
str_guodu:='NAD+N1+++'+str_all[0]+'+';
|
|
|
if str_all.Count>=2 then
|
|
|
str_guodu:=str_guodu+str_all[1];
|
|
|
if (str_all.Count>=3) and (str_all.Count<=5) then
|
|
|
begin
|
|
|
for j:=2 to str_all.Count-1 do
|
|
|
begin
|
|
|
str_guodu:=str_guodu+':'+str_all[j]
|
|
|
end;
|
|
|
end;
|
|
|
str_guodu:=str_guodu+#39;
|
|
|
str.Add(str_guodu);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if SelectCarrier then
|
|
|
begin
|
|
|
str.Add('NAD+CA+'+'SWI'+':160:86++'+'SWI'+#39);
|
|
|
count:=count+1;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
str.Add('NAD+CA+'+'SWI'+':160:86++'+'SWI'+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('Ìáµ¥·ÝÊý').asstring='ONE' then
|
|
|
Str1:='1'
|
|
|
else if frm_op_seae.t_op_seae.fieldbyname('Ìáµ¥·ÝÊý').asstring='TWO' then
|
|
|
Str1:='2'
|
|
|
else if frm_op_seae.t_op_seae.fieldbyname('Ìáµ¥·ÝÊý').asstring='THREE' then
|
|
|
Str1:='3'
|
|
|
else if frm_op_seae.t_op_seae.fieldbyname('Ìáµ¥·ÝÊý').asstring='FOUR' then
|
|
|
Str1:='4'
|
|
|
else if frm_op_seae.t_op_seae.fieldbyname('Ìáµ¥·ÝÊý').asstring='FIVE' then
|
|
|
Str1:='5'
|
|
|
else if frm_op_seae.t_op_seae.fieldbyname('Ìáµ¥·ÝÊý').asstring='SIX' then
|
|
|
Str1:='6'
|
|
|
else if frm_op_seae.t_op_seae.fieldbyname('Ìáµ¥·ÝÊý').asstring='SERVEN' then
|
|
|
Str1:='7'
|
|
|
else if frm_op_seae.t_op_seae.fieldbyname('Ìáµ¥·ÝÊý').asstring='EIGHT' then
|
|
|
Str1:='8'
|
|
|
else if frm_op_seae.t_op_seae.fieldbyname('Ìáµ¥·ÝÊý').asstring='NIGHT' then
|
|
|
Str1:='9'
|
|
|
else if frm_op_seae.t_op_seae.fieldbyname('Ìáµ¥·ÝÊý').asstring='TEN' then
|
|
|
Str1:='10';
|
|
|
|
|
|
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('¸±±¾Ìáµ¥·ÝÊý').asstring='ONE' then
|
|
|
CopyBillCount:='1'
|
|
|
else if frm_op_seae.t_op_seae.fieldbyname('¸±±¾Ìáµ¥·ÝÊý').asstring='TWO' then
|
|
|
CopyBillCount:='2'
|
|
|
else if frm_op_seae.t_op_seae.fieldbyname('¸±±¾Ìáµ¥·ÝÊý').asstring='THREE' then
|
|
|
CopyBillCount:='3'
|
|
|
else if frm_op_seae.t_op_seae.fieldbyname('¸±±¾Ìáµ¥·ÝÊý').asstring='FOUR' then
|
|
|
CopyBillCount:='4'
|
|
|
else if frm_op_seae.t_op_seae.fieldbyname('¸±±¾Ìáµ¥·ÝÊý').asstring='FIVE' then
|
|
|
CopyBillCount:='5'
|
|
|
else if frm_op_seae.t_op_seae.fieldbyname('¸±±¾Ìáµ¥·ÝÊý').asstring='SIX' then
|
|
|
CopyBillCount:='6'
|
|
|
else if frm_op_seae.t_op_seae.fieldbyname('¸±±¾Ìáµ¥·ÝÊý').asstring='SERVEN' then
|
|
|
CopyBillCount:='7'
|
|
|
else if frm_op_seae.t_op_seae.fieldbyname('¸±±¾Ìáµ¥·ÝÊý').asstring='EIGHT' then
|
|
|
CopyBillCount:='8'
|
|
|
else if frm_op_seae.t_op_seae.fieldbyname('¸±±¾Ìáµ¥·ÝÊý').asstring='NIGHT' then
|
|
|
CopyBillCount:='9'
|
|
|
else if frm_op_seae.t_op_seae.fieldbyname('¸±±¾Ìáµ¥·ÝÊý').asstring='TEN' then
|
|
|
CopyBillCount:='10';
|
|
|
|
|
|
|
|
|
|
|
|
IF (trim(frm_op_seae.t_op_seae.fieldbyname('Ç©µ¥·½Ê½').asstring)='Õý±¾') or (trim(frm_op_seae.t_op_seae.fieldbyname('Ç©µ¥·½Ê½').asstring)='µç×ÓÌáµ¥') then begin //Ìáµ¥ÀàÐÍ
|
|
|
Str2:='706';
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('ÔË·Ñ').AsBoolean then
|
|
|
str.Add('DOC+'+Str2+'+:27++'+Str1+#39)
|
|
|
else str.Add('DOC+'+Str2+'+:26++'+Str1+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
if trim(CopyBillCount)<>'' then
|
|
|
begin
|
|
|
|
|
|
Str2:='707';
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('ÔË·Ñ').AsBoolean then
|
|
|
str.Add('DOC+'+Str2+'+:27++'+CopyBillCount+#39)
|
|
|
else str.Add('DOC+'+Str2+'+:26++'+CopyBillCount+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
|
|
|
end else if (trim(frm_op_seae.t_op_seae.fieldbyname('Ç©µ¥·½Ê½').asstring)='º£Ô˵¥')
|
|
|
or (trim(frm_op_seae.t_op_seae.fieldbyname('Ç©µ¥·½Ê½').asstring)='Seaway') then begin
|
|
|
Str2:='710';
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('ÔË·Ñ').AsBoolean then
|
|
|
str.Add('DOC+'+Str2+'+:27++'+Str1+#39)
|
|
|
else str.Add('DOC+'+Str2+'+:26++'+Str1+#39);
|
|
|
|
|
|
count:=count+1;
|
|
|
end else if (trim(frm_op_seae.t_op_seae.fieldbyname('Ç©µ¥·½Ê½').asstring)='BILL COPY') or
|
|
|
(trim(frm_op_seae.t_op_seae.fieldbyname('Ç©µ¥·½Ê½').asstring)='µç·Å')
|
|
|
then begin
|
|
|
|
|
|
Str2:='706';
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('ÔË·Ñ').AsBoolean then
|
|
|
str.Add('DOC+'+Str2+'+:27++'+Str1+#39)
|
|
|
else str.Add('DOC+'+Str2+'+:26++'+Str1+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
if Trim(CopyBillCount)<>'' then
|
|
|
begin
|
|
|
Str2:='707';
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('ÔË·Ñ').AsBoolean then
|
|
|
str.Add('DOC+'+Str2+'+:27++'+CopyBillCount+#39)
|
|
|
else str.Add('DOC+'+Str2+'+:26++'+CopyBillCount+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
end else if trim(frm_op_seae.t_op_seae.fieldbyname('Ç©µ¥·½Ê½').asstring)='HOUSE BILL' then begin
|
|
|
Str2:='714';
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('ÔË·Ñ').AsBoolean then
|
|
|
str.Add('DOC+'+Str2+'+:27++'+Str1+#39)
|
|
|
else str.Add('DOC+'+Str2+'+:26++'+Str1+#39);
|
|
|
|
|
|
count:=count+1;
|
|
|
end else if trim(frm_op_seae.t_op_seae.fieldbyname('Ç©µ¥·½Ê½').asstring)='Õý¸±±¾' then begin
|
|
|
Str2:='706';
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('ÔË·Ñ').AsBoolean then
|
|
|
str.Add('DOC+'+Str2+'+:27++'+Str1+#39)
|
|
|
else str.Add('DOC+'+Str2+'+:26++'+Str1+#39);
|
|
|
|
|
|
count:=count+1;
|
|
|
|
|
|
if Trim(CopyBillCount)<>'' then
|
|
|
begin
|
|
|
Str2:='707';
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('ÔË·Ñ').AsBoolean then
|
|
|
str.Add('DOC+'+Str2+'+:27++'+CopyBillCount+#39)
|
|
|
else str.Add('DOC+'+Str2+'+:26++'+CopyBillCount+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
Str2:='706';
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('ÔË·Ñ').AsBoolean then
|
|
|
str.Add('DOC+'+Str2+'+:27++'+Str1+#39)
|
|
|
else str.Add('DOC+'+Str2+'+:26++'+Str1+#39);
|
|
|
// str.Add('DOC+'+Str2+'+++'+Str1+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///
|
|
|
ctnlist:=TStringList.Create;
|
|
|
ctnlist.Clear;
|
|
|
with t_op_edictn do
|
|
|
begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('select ctn_id from t_op_ctn');
|
|
|
SQL.Add('where 񅧏=:bsno');
|
|
|
Parameters.ParamByName('bsno').Value:=frm_op_seae.t_op_seae.fieldbyname('񅧏').asstring;
|
|
|
open;First;
|
|
|
while not eof do
|
|
|
begin
|
|
|
ctnlist.Add(FieldByName('ctn_id').AsString);
|
|
|
Next;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
t_op_edictn.Close;t_op_edictn.SQL.Clear;
|
|
|
t_op_edictn.SQL.Add('select * from t_op_ctn_detail');
|
|
|
t_op_edictn.SQL.Add('where ctn_id in ('+ctnlist.CommaText+')');
|
|
|
t_op_edictn.Open;
|
|
|
if t_op_edictn.RecordCount<=0 then
|
|
|
begin
|
|
|
if not bsck.checked then
|
|
|
begin
|
|
|
str.Add('GID+1+'+frm_op_seae.t_op_seae.fieldbyname('¼þÊý').asstring+':'+
|
|
|
GetPkgCode(trim(frm_op_seae.t_op_seae.fieldbyname('°ü×°').asstring))+'::6:'+frm_op_seae.t_op_seae.fieldbyname('°ü×°').asstring+#39); //£¿
|
|
|
count:=count+1;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
str.Add('GID+1+'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('¼þÊý').asstring+':'+
|
|
|
GetPkgCode(trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('°ü×°').asstring))+'::6:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('°ü×°').asstring+#39); //£¿
|
|
|
count:=count+1;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if RadioGroup1.ItemIndex=0 then
|
|
|
begin
|
|
|
|
|
|
sl:=TStringList.Create;
|
|
|
try
|
|
|
if not bsck.checked then
|
|
|
sl.text:=frm_op_seae.t_op_seae.fieldbyname('»õÎïÃèÊö').asstring
|
|
|
else sl.text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('»õÎïÃèÊö').asstring;
|
|
|
for i:=0 to sl.Count-1 do begin
|
|
|
str.Add('FTX+AAA+++'+Changestr(sl.Strings[i])+''+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(sl);
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
sl:=TStringList.Create;
|
|
|
try
|
|
|
if not bsck.checked then
|
|
|
sl.text:=frm_op_seae.t_op_seae.fieldbyname('»õÎïÃèÊö').asstring
|
|
|
else sl.text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('»õÎïÃèÊö').asstring;
|
|
|
for i:=0 to sl.Count-1 do begin
|
|
|
str.Add('FTX+AAA+++'+Changestr(sl.Strings[i])+''+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(sl);
|
|
|
end;
|
|
|
|
|
|
if Trim(str_shr)<>'' then
|
|
|
begin
|
|
|
str.Add('FTX+AAA+++'+
|
|
|
Str_shr+#39);
|
|
|
count:=count+2;
|
|
|
end;
|
|
|
if Trim(str_con)<>'' then
|
|
|
begin
|
|
|
str.Add('FTX+AAA+++'+
|
|
|
Str_con+#39);
|
|
|
count:=count+2;
|
|
|
end;
|
|
|
if Trim(str_not)<>'' then
|
|
|
begin
|
|
|
str.Add('FTX+AAA+++'+
|
|
|
Str_not+#39);
|
|
|
count:=count+2;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if not bsck.checked then
|
|
|
begin
|
|
|
str.Add('MEA+AAE+WT+KGM:'+frm_op_seae.t_op_seae.fieldbyname('ÖØÁ¿').asstring+#39);
|
|
|
count:=count+1;
|
|
|
str.Add('MEA+AAE+AAW+MTQ:'+frm_op_seae.t_op_seae.fieldbyname('³ßÂë').asstring+#39);
|
|
|
count:=count+1;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
str.Add('MEA+AAE+WT+KGM:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('ÖØÁ¿').asstring+#39);
|
|
|
count:=count+1;
|
|
|
str.Add('MEA+AAE+AAW+MTQ:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('³ßÂë').asstring+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if (t_op_edi.fieldbyname('³¬ÏÞÏä±êÖ¾').asstring='Y') then begin
|
|
|
t_op_ctn.Close;t_op_ctn.SQL.Clear;
|
|
|
t_op_ctn.SQL.Add('SELECT * ');
|
|
|
t_op_ctn.SQL.Add('FROM t_op_ctn ');
|
|
|
t_op_ctn.SQL.Add('WHERE t_op_ctn.񅧏=:񅧏');
|
|
|
t_op_ctn.close;
|
|
|
t_op_ctn.Parameters.ParamByName('񅧏').Value:=frm_op_seae.t_op_seae.fieldbyname('񅧏').asstring;
|
|
|
t_op_ctn.Open;
|
|
|
if (not t_op_ctn.IsEmpty) then begin
|
|
|
str.Add('DIM+9+MTR:'+t_op_ctn.fieldbyname('³¤').AsString+':'+t_op_ctn.fieldbyname('¿í').AsString+':'+t_op_ctn.fieldbyname('¸ß').AsString+#39); //£¿
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
sl:=TStringList.Create;
|
|
|
try
|
|
|
if not bsck.checked then
|
|
|
sl.text:=frm_op_seae.t_op_seae.fieldbyname('ßéÍ·').asString
|
|
|
else sl.text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('ßéÍ·').asString;
|
|
|
GetLengthTString(sl,35);
|
|
|
for i:=0 to sl.Count-1 do begin
|
|
|
str.Add('PCI++'+Changestr(sl.Strings[i])+''+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(sl);
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if not bsck.Checked then
|
|
|
begin
|
|
|
t_op_ctn.Close;t_op_ctn.SQL.Clear;
|
|
|
t_op_ctn.SQL.Add('SELECT t_op_ctn.±àºÅ,t_op_ctn.ÊýÁ¿, t_code_ctn.EDI´úÂë,t_op_ctn.³ß´ç,t_op_ctn.°ü×°');
|
|
|
t_op_ctn.SQL.Add(',t_op_ctn.ÏäÐÍ,t_op_ctn.ÏäºÅ,t_op_ctn.ÖØÁ¿,t_op_ctn.·âºÅ,t_op_ctn.³ßÂë,t_op_ctn.¼þÊý');
|
|
|
t_op_ctn.SQL.Add('FROM t_op_ctn INNER JOIN');
|
|
|
t_op_ctn.SQL.Add('t_code_ctn ON t_op_ctn.´úÂë = t_code_ctn.´úÂë');
|
|
|
t_op_ctn.SQL.Add('WHERE t_op_ctn.񅧏=:񅧏');
|
|
|
t_op_ctn.close;
|
|
|
t_op_ctn.Parameters.ParamByName('񅧏').Value:=frm_op_seae.t_op_seae.fieldbyname('񅧏').asstring;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_op_ctn.Close;t_op_ctn.SQL.Clear;
|
|
|
t_op_ctn.SQL.Add('SELECT t_op_ctn_fendan.±àºÅ,t_op_ctn_fendan.ÊýÁ¿, t_code_ctn.EDI´úÂë,t_op_ctn_fendan.³ß´ç,t_op_ctn_fendan.°ü×°');
|
|
|
t_op_ctn.SQL.Add(',t_op_ctn_fendan.ÏäÐÍ,t_op_ctn_fendan.ÏäºÅ,t_op_ctn_fendan.ÖØÁ¿,t_op_ctn_fendan.·âºÅ,t_op_ctn_fendan.³ßÂë,t_op_ctn_fendan.¼þÊý');
|
|
|
t_op_ctn.SQL.Add('FROM t_op_ctn_fendan INNER JOIN');
|
|
|
t_op_ctn.SQL.Add('t_code_ctn ON t_op_ctn_fendan.´úÂë = t_code_ctn.´úÂë');
|
|
|
t_op_ctn.SQL.Add('WHERE t_op_ctn_fendan.as_id=:as_id');
|
|
|
t_op_ctn.close;
|
|
|
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;
|
|
|
t_op_ctn.first;
|
|
|
while not t_op_ctn.eof do
|
|
|
begin
|
|
|
str.Add('SGP+'+t_op_ctn.fieldbyname('ÏäºÅ').asstring+'+'+t_op_ctn.fieldbyname('¼þÊý').asstring+#39); //ÊýÁ¿
|
|
|
count:=count+1;
|
|
|
str.Add('MEA+AAE+WT+KGM:'+t_op_ctn.fieldbyname('ÖØÁ¿').asstring+#39);
|
|
|
count:=count+1;
|
|
|
str.Add('MEA+AAE+AAW+MTQ:'+t_op_ctn.fieldbyname('³ßÂë').asstring+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
t_op_ctn.next;
|
|
|
end;
|
|
|
end
|
|
|
else //·ÖÏäÃ÷ϸ
|
|
|
begin
|
|
|
t_op_edictn.Close;t_op_edictn.SQL.Clear;
|
|
|
t_op_edictn.SQL.Add('select hts,»õÎïÃèÊö,°ü×°,sum(¼þÊý)¼þÊý,sum(ÖØÁ¿) ÖØÁ¿,sum(³ßÂë) ³ßÂë');
|
|
|
t_op_edictn.SQL.Add('from t_op_ctn_detail');
|
|
|
t_op_edictn.SQL.Add('where ctn_id in ('+ctnlist.CommaText+')');
|
|
|
t_op_edictn.SQL.Add('Group by hts,»õÎïÃèÊö,°ü×°');
|
|
|
t_op_edictn.SQL.Add('Order by min(id)');
|
|
|
t_op_edictn.Open;
|
|
|
Lineno:=1;
|
|
|
while not t_op_edictn.eof do
|
|
|
begin
|
|
|
str.Add('GID+'+Inttostr(Lineno)+'+'+t_op_edictn.fieldbyname('¼þÊý').asstring+':'+
|
|
|
GetPkgCode(trim(t_op_edictn.fieldbyname('°ü×°').asstring))+'::6:'+t_op_edictn.fieldbyname('°ü×°').asstring+#39); //£¿
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('PIA+5+'+t_op_edictn.fieldbyname('hts').asstring+':HS'+#39); //£¿
|
|
|
count:=count+1;
|
|
|
|
|
|
sl:=TStringList.Create;
|
|
|
try
|
|
|
sl.text:=t_op_edictn.fieldbyname('»õÎïÃèÊö').asstring;
|
|
|
for i:=0 to sl.Count-1 do
|
|
|
begin
|
|
|
str.Add('FTX+AAA+++'+Changestr(sl.Strings[i])+''+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(sl);
|
|
|
end;
|
|
|
|
|
|
str.Add('MEA+AAE+WT+KGM:'+t_op_edictn.fieldbyname('ÖØÁ¿').asstring+#39);
|
|
|
count:=count+1;
|
|
|
str.Add('MEA+AAE+AAW+MTQ:'+t_op_edictn.fieldbyname('³ßÂë').asstring+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
if Trim(t_op_edi.fieldbyname('»õÎïNCM±àºÅ').asstring)<>'' then
|
|
|
begin
|
|
|
str.Add('RFF+ABT:'+t_op_edi.fieldbyname('»õÎïNCM±àºÅ').asstring+#39); //£¿
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if Lineno=1 then
|
|
|
begin
|
|
|
sl:=TStringList.Create;
|
|
|
try
|
|
|
if not bsck.Checked then
|
|
|
sl.text:=frm_op_seae.t_op_seae.fieldbyname('ßéÍ·').asString
|
|
|
else sl.text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('ßéÍ·').asString;
|
|
|
|
|
|
GetLengthTString(sl,35);
|
|
|
for i:=0 to sl.Count-1 do begin
|
|
|
str.Add('PCI++'+Changestr(sl.Strings[i])+''+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(sl);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
aAdoQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
aAdoQuery.Close;aAdoQuery.SQL.Clear;
|
|
|
aAdoQuery.SQL.Add('select t_op_ctn.ÏäºÅ,sum(t_op_ctn_detail.¼þÊý)¼þÊý,sum(t_op_ctn_detail.ÖØÁ¿) ÖØÁ¿,sum(t_op_ctn_detail.³ßÂë) ³ßÂë');
|
|
|
aAdoQuery.SQL.Add('from t_op_ctn_detail');
|
|
|
aAdoQuery.SQL.Add('left Join t_op_ctn on t_op_ctn.ctn_id=t_op_ctn_detail.ctn_id');
|
|
|
aAdoQuery.SQL.Add('where t_op_ctn.±àºÅ=:±àºÅ and t_op_ctn_detail.»õÎïÃèÊö=:goods and t_op_ctn_detail.°ü×°=:pkg and t_op_ctn_detail.hts=:hts');
|
|
|
aAdoQuery.SQL.Add('Group by t_op_ctn.ÏäºÅ');
|
|
|
aAdoQuery.Parameters.ParamByName('goods').Value:=t_op_edictn.fieldbyname('»õÎïÃèÊö').asstring;
|
|
|
aAdoQuery.Parameters.ParamByName('pkg').Value:=t_op_edictn.fieldbyname('°ü×°').asstring;
|
|
|
aAdoQuery.Parameters.ParamByName('hts').Value:=t_op_edictn.fieldbyname('hts').asstring;
|
|
|
aAdoQuery.Parameters.ParamByName('񅧏').Value:=frm_op_seae.t_op_seae.fieldbyname('񅧏').asstring;
|
|
|
aAdoQuery.Open;
|
|
|
while not aAdoQuery.eof do
|
|
|
begin
|
|
|
str.Add('SGP+'+aAdoQuery.fieldbyname('ÏäºÅ').asstring+'+'+aAdoQuery.fieldbyname('¼þÊý').asstring+#39); //ÊýÁ¿
|
|
|
count:=count+1;
|
|
|
str.Add('MEA+AAE+WT+KGM:'+aAdoQuery.fieldbyname('ÖØÁ¿').asstring+#39);
|
|
|
count:=count+1;
|
|
|
str.Add('MEA+AAE+AAW+MTQ:'+aAdoQuery.fieldbyname('³ßÂë').asstring+#39);
|
|
|
count:=count+1;
|
|
|
aAdoQuery.Next;
|
|
|
end;
|
|
|
finally
|
|
|
aAdoQuery.Free;
|
|
|
end;
|
|
|
Lineno:=Lineno+1;
|
|
|
t_op_edictn.Next;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
////
|
|
|
|
|
|
|
|
|
|
|
|
if ((frm_op_seae.t_op_seae.FieldByName('»õÎï±êʶ').asstring='D') OR (trim(frm_op_seae.t_op_seae.FieldByName('»õÎï±êʶ').asstring)='T') ) then
|
|
|
begin
|
|
|
str.Add('DGS+IMD+'+frm_op_seae.t_op_seae.fieldbyname('ΣÏÕÆ··ÖÀà').asstring
|
|
|
+'+'+frm_op_seae.t_op_seae.fieldbyname('ΣÏÕÆ·±àºÅ').asstring+#39);
|
|
|
|
|
|
count:=count+1;
|
|
|
str.Add('CTA+HG+:'+edit7.text+#39);
|
|
|
count:=count+1;
|
|
|
str.Add('COM+'+Edit5.text+':TE'+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
|
|
|
if not bsck.Checked then
|
|
|
begin
|
|
|
t_op_ctn.Close;t_op_ctn.SQL.Clear;
|
|
|
t_op_ctn.SQL.Add('SELECT t_op_ctn.±àºÅ,t_op_ctn.ÊýÁ¿, t_code_ctn.EDI´úÂë,t_op_ctn.³ß´ç,t_op_ctn.°ü×°');
|
|
|
t_op_ctn.SQL.Add(',t_op_ctn.ÏäÐÍ,t_op_ctn.ÏäºÅ,t_op_ctn.ÖØÁ¿,t_op_ctn.·âºÅ,t_op_ctn.³ßÂë,t_op_ctn.¼þÊý');
|
|
|
t_op_ctn.SQL.Add('FROM t_op_ctn INNER JOIN');
|
|
|
t_op_ctn.SQL.Add('t_code_ctn ON t_op_ctn.´úÂë = t_code_ctn.´úÂë');
|
|
|
t_op_ctn.SQL.Add('WHERE t_op_ctn.񅧏=:񅧏');
|
|
|
t_op_ctn.close;
|
|
|
t_op_ctn.Parameters.ParamByName('񅧏').Value:=frm_op_seae.t_op_seae.fieldbyname('񅧏').asstring;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_op_ctn.Close;t_op_ctn.SQL.Clear;
|
|
|
t_op_ctn.SQL.Add('SELECT t_op_ctn_fendan.±àºÅ,t_op_ctn_fendan.ÊýÁ¿, t_code_ctn.EDI´úÂë,t_op_ctn_fendan.³ß´ç,t_op_ctn_fendan.°ü×°');
|
|
|
t_op_ctn.SQL.Add(',t_op_ctn_fendan.ÏäÐÍ,t_op_ctn_fendan.ÏäºÅ,t_op_ctn_fendan.ÖØÁ¿,t_op_ctn_fendan.·âºÅ,t_op_ctn_fendan.³ßÂë,t_op_ctn_fendan.¼þÊý');
|
|
|
t_op_ctn.SQL.Add('FROM t_op_ctn_fendan INNER JOIN');
|
|
|
t_op_ctn.SQL.Add('t_code_ctn ON t_op_ctn_fendan.´úÂë = t_code_ctn.´úÂë');
|
|
|
t_op_ctn.SQL.Add('WHERE t_op_ctn_fendan.as_id=:as_id');
|
|
|
t_op_ctn.close;
|
|
|
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;
|
|
|
t_op_ctn.first;
|
|
|
while not t_op_ctn.eof do
|
|
|
begin
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('ÊÇ·ñ×ÔÓÐÏä').asboolean then
|
|
|
str.Add('EQD+CN+'+t_op_ctn.fieldbyname('ÏäºÅ').asstring+'+'+GetCtnCode(t_op_ctn.fieldbyname('ÏäÐÍ').asstring,t_op_ctn.fieldbyname('³ß´ç').asstring)+'+1'+#39) //ÊýÁ¿
|
|
|
else
|
|
|
str.Add('EQD+CN+'+t_op_ctn.fieldbyname('ÏäºÅ').asstring+'+'+GetCtnCode(t_op_ctn.fieldbyname('ÏäÐÍ').asstring,t_op_ctn.fieldbyname('³ß´ç').asstring)+'+2'+#39); //ÊýÁ¿
|
|
|
|
|
|
count:=count+1;
|
|
|
str.Add('MEA+AAE+WT+KGM:'+t_op_ctn.fieldbyname('ÖØÁ¿').asstring+#39);
|
|
|
count:=count+1;
|
|
|
str.Add('MEA+AAE+AAW+MTQ:'+t_op_ctn.fieldbyname('³ßÂë').asstring+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
if (frm_op_seae.t_op_seae.FieldByName('»õÎï±êʶ').asstring='R') OR (trim(frm_op_seae.t_op_seae.FieldByName('»õÎï±êʶ').asstring)='T') then
|
|
|
begin
|
|
|
if Trim(frm_op_seae.t_op_seae.fieldbyname('Àä²Øͨ·çÁ¿').asstring)<>'' then
|
|
|
begin
|
|
|
str.Add('MEA+AAE+AAS+CBM:'+frm_op_seae.t_op_seae.fieldbyname('Àä²Øͨ·çÁ¿').asstring+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
str.Add('SEL+'+t_op_ctn.fieldbyname('·âºÅ').asstring+'+SH'+#39);
|
|
|
count:=count+1;
|
|
|
if (frm_op_seae.t_op_seae.FieldByName('»õÎï±êʶ').asstring='R') OR (trim(frm_op_seae.t_op_seae.FieldByName('»õÎï±êʶ').asstring)='T') then
|
|
|
begin
|
|
|
str.Add('TMP+2+'+frm_op_seae.t_op_seae.fieldbyname('ÉèÖÃζÈ').asstring+':CEL'+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
|
|
|
t_op_ctn.next;
|
|
|
end;
|
|
|
|
|
|
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
result:=count;
|
|
|
|
|
|
end;
|
|
|
|
|
|
function Tfrm_op_seae_edi_swi.get_txtvgm_cma(str:Tstringlist):integer;
|
|
|
var
|
|
|
str_all,sl:Tstringlist;
|
|
|
i,count:integer;
|
|
|
SM,Carrer:string;
|
|
|
|
|
|
begin
|
|
|
i:=0;
|
|
|
Carrer:='SWI';
|
|
|
|
|
|
str_all:=Tstringlist.Create;
|
|
|
count:=0;
|
|
|
|
|
|
|
|
|
str.Add('UNB+UNOC:3+'+Edit1.TEXT+':ZZZ+'+Carrer
|
|
|
+':ZZZ+'+GetDatetime(datetimetostr(now),2)+'+'
|
|
|
+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
|
|
|
count:=count+1;
|
|
|
t_op_ctn.close;
|
|
|
t_op_ctn.Parameters.ParamByName('񅧏').Value:=frm_op_seae.t_op_seae.fieldbyname('񅧏').asstring;
|
|
|
t_op_ctn.open;
|
|
|
t_op_ctn.first;
|
|
|
while not t_op_ctn.eof do
|
|
|
begin
|
|
|
if (t_op_ctn.fieldbyname('³ÆÖØ·½Ê½').asstring<>'') or (t_op_ctn.fieldbyname('³ÆÖØ·½Ê½').asstring<>'ÎÞ') then
|
|
|
begin
|
|
|
i:=i+1;
|
|
|
str.Add('UNH+'+IntToStr(i)+'+VERMAS:D:16A:UN'+#39);
|
|
|
count:=count+1;
|
|
|
if RadioGroup3.ItemIndex=0 then
|
|
|
str.Add('BGM+XXX+'+frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'+9'+#39) //9Ôʼ 5 ¸üÐÂ
|
|
|
else str.Add('BGM+XXX+'+frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'+5'+#39); //9Ôʼ 5 ¸üÐÂ
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('DTM+137:'+GetDatetime(datetimetostr(now),1)+':203'+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('EQD+CN+'+t_op_ctn.fieldbyname('ÏäºÅ').asstring+'+'+GetCtnCode(t_op_ctn.fieldbyname('ÏäÐÍ').asstring,t_op_ctn.fieldbyname('³ß´ç').asstring)+'+2'+#39); //ÊýÁ¿
|
|
|
|
|
|
str.Add('RFF+BN:'+frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+#39);
|
|
|
|
|
|
str.Add('MEA+AAE+VGM+KGM:'+t_op_ctn.fieldbyname('³ÆÖØÖØÁ¿').asstring+#39); ////ÀÛ¼Ó ÎÞ
|
|
|
count:=count+1;
|
|
|
|
|
|
if Trim(t_op_ctn.fieldbyname('³ÆÖØ·½Ê½').asstring)='ÀÛ¼Ó' then
|
|
|
SM:='SM2'
|
|
|
else if Trim(t_op_ctn.fieldbyname('³ÆÖØ·½Ê½').asstring)='×ÜÖØ' then
|
|
|
SM:='SM1';
|
|
|
|
|
|
str.Add('DOC+'+SM+':VGM:306'+#39); ////ÀÛ¼Ó ÎÞ
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('NAD+SPC+++'+Changestr(Edit2.Text)+#39); ////ÀÛ¼Ó ÎÞ
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('UNT+9+'+IntToStr(i)+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
t_op_ctn.next;
|
|
|
end;
|
|
|
result:=i;
|
|
|
end;
|
|
|
procedure Tfrm_op_seae_edi_swi.bsSkinButton1Click(Sender: TObject);
|
|
|
var
|
|
|
str:Tstringlist;
|
|
|
i,Count,get_Count,bill_count:integer;
|
|
|
inifile1:Tinifile;
|
|
|
SIO,ORG,MBL,CARR,MBLNO,ETD,CORP,EMP,EMPDAE:string;
|
|
|
edi:WideString;
|
|
|
begin
|
|
|
if bsck.Checked then
|
|
|
begin
|
|
|
if frm_op_seae_assistant=nil then
|
|
|
begin
|
|
|
ShowMessage('ÇëÔÚ(ίÍкÍÌáµ¥)½çÃæÑ¡Ôñ·Öµ¥·¢ËÍ·Öµ¥Edi');
|
|
|
exit;
|
|
|
end
|
|
|
end;
|
|
|
|
|
|
str:=Tstringlist.Create;
|
|
|
str.Clear;
|
|
|
count:=0;
|
|
|
bill_count:=0;
|
|
|
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 then
|
|
|
exit;
|
|
|
if RadioGroup1.ItemIndex=1 then
|
|
|
get_Count:=frm_op_seae_edi_swi.get_txtSI(str)
|
|
|
else
|
|
|
get_Count:=frm_op_seae_edi_swi.get_txtBooking(str);
|
|
|
|
|
|
if get_Count=-1 then
|
|
|
exit
|
|
|
else
|
|
|
count:=count+get_Count;
|
|
|
bill_count:=bill_count+1;
|
|
|
|
|
|
end;
|
|
|
str.Add('UNT+'+INTTOSTR(str.count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
str.Add('UNZ+'+inttostr(bill_count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if not isEditrue then
|
|
|
exit;
|
|
|
if RadioGroup1.ItemIndex=1 then
|
|
|
get_Count:=frm_op_seae_edi_swi.get_txtSI(str)
|
|
|
else
|
|
|
get_Count:=frm_op_seae_edi_swi.get_txtBooking(str);
|
|
|
if get_Count=-1 then
|
|
|
exit
|
|
|
else
|
|
|
count:=count+get_Count;
|
|
|
|
|
|
str.Add('UNT+'+INTTOSTR(str.count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
str.Add('UNZ+1+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
end;
|
|
|
|
|
|
for i:=0 to Str.Count-1 do begin
|
|
|
if IsZhongwen(Str[i]) then
|
|
|
begin
|
|
|
MessageDlg('´ËƱҵÎñÓÐÖÐÎÄ×Ö·û»òTAB¼ü,²»ÄÜÉÏ´«£¡'+#13#10+Str[i],mtWarning,[mbYes],0);
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
SaveDialog1.FileName:=frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+GetDatetime(datetimetostr(now),1);
|
|
|
if SaveDialog1.Execute then
|
|
|
begin
|
|
|
str.SaveToFile(SaveDialog1.FileName+'.txt');
|
|
|
showmessage('ÎļþÉú³É³É¹¦£¡');
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
showmessage('ÎļþÉú³Éʧ°Ü£¡');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_swi.FormShow(Sender: TObject);
|
|
|
var
|
|
|
inifile1:Tinifile;
|
|
|
tmpstr:string;
|
|
|
begin
|
|
|
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
|
|
|
edit1.text:=inifile1.ReadString('EDI','SEND_CODE','');
|
|
|
edit2.text:=inifile1.ReadString('EDI','SEND_NAME','');
|
|
|
edit3.text:=inifile1.ReadString('EDI','RECEIVE_CODE','');
|
|
|
edit4.text:=inifile1.ReadString('EDI','RECEIVE_NAME','');
|
|
|
edit5.text:=inifile1.ReadString('EDI','SEND_TEL','');
|
|
|
edit6.text:=inifile1.ReadString('EDI','SEND_MAIL','');
|
|
|
edit7.text:=inifile1.ReadString('EDI','SEND_ATTN','');
|
|
|
edit8.text:=inifile1.ReadString('EDI','FTPADD','');
|
|
|
edit9.text:=inifile1.ReadString('EDI','FTPNAME','');
|
|
|
edit10.text:=inifile1.ReadString('EDI','FTPPASS','');
|
|
|
edit11.text:=inifile1.ReadString('EDI','FTPPATH','/');
|
|
|
edit12.text:=inifile1.ReadString('EDI','ADDR','');
|
|
|
|
|
|
edit15.text:=inifile1.ReadString('EDI','FTPADDCMA','');
|
|
|
edit16.text:=inifile1.ReadString('EDI','FTPNAMECMA','');
|
|
|
Edit17.text:=inifile1.ReadString('EDI','FTPPASSCMA','');
|
|
|
Edit18.text:=inifile1.ReadString('EDI','FTPPATHCMA','');
|
|
|
tmpstr:=inifile1.ReadString('EDI','SEND_FTPPASSIVE_CMA','1');
|
|
|
if (tmpstr='1') then CheckBox1.checked else CheckBox1.checked:=False;
|
|
|
tmpstr:=inifile1.ReadString('EDI','SEND_FTPSFTP_CMA','1');
|
|
|
if (tmpstr='1') then CheckBox2.checked:=true else CheckBox2.checked:=False;
|
|
|
|
|
|
RadioGroup1.ItemIndex:=inifile1.ReadInteger('EDI','CMASEND_TYPE',0);
|
|
|
|
|
|
// RadioGroup2.ItemIndex:=inifile1.ReadInteger('EDI','CMASEND_CA',0);
|
|
|
|
|
|
// IF RadioGroup2.ItemIndex=8 THEN
|
|
|
// bsSkinCheckRadioBox1.Checked:=True;
|
|
|
|
|
|
|
|
|
inifile1.free;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_swi.bsSkinButton3Click(Sender: TObject);
|
|
|
begin
|
|
|
if frm_op_seae_edi_swi.Width=650 then
|
|
|
frm_op_seae_edi_swi.Width:=305
|
|
|
else
|
|
|
frm_op_seae_edi_swi.Width:=650;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_swi.bsSkinButton4Click(Sender: TObject);
|
|
|
var
|
|
|
IdFTP1:TIdFTP;
|
|
|
str,dsstr:widestring;
|
|
|
str_file:widestring;
|
|
|
ftpar,ftpname,ftppass,ftppath,ScriptPath,strmsg:String;
|
|
|
StrL:Tstringlist;
|
|
|
i,Count,get_Count,bill_count,i_soi:integer;
|
|
|
|
|
|
SIO,ORG,MBL,CARR,MBLNO,ETD,CORP,EMP,EMPDAE:string;
|
|
|
edi,PostUrl:WideString;
|
|
|
|
|
|
IdHttp : TIdHTTP;
|
|
|
errmsg : string;//ÇëÇóµØÖ·
|
|
|
ResponseStream : TStringStream; //·µ»ØÐÅÏ¢
|
|
|
ResponseStr: string;
|
|
|
RequestStr : string; //ÇëÇóÐÅÏ¢
|
|
|
RequestStream : TStringStream;
|
|
|
jo: ISuperObject;
|
|
|
k:Integer;
|
|
|
sl:TStrings;
|
|
|
MultiPartFormDataStream :TIdMultiPartFormDataStream;
|
|
|
IdHTTP1:TIdHTTP;
|
|
|
begin
|
|
|
|
|
|
i_soi:=0;
|
|
|
if bsck.Checked then
|
|
|
begin
|
|
|
if frm_op_seae_assistant=nil then
|
|
|
begin
|
|
|
ShowMessage('ÇëÔÚ(ίÍкÍÌáµ¥)½çÃæ·¢ËÍ·Öµ¥Edi');
|
|
|
exit;
|
|
|
end
|
|
|
end;
|
|
|
|
|
|
ScriptPath:=ExtractFilePath(ParamStr(0))+'EDIFILE\';
|
|
|
if not DirectoryExists(ScriptPath) then
|
|
|
CreateDir(ScriptPath);
|
|
|
|
|
|
ftpar:=Trim(Edit8.Text);
|
|
|
if ftpar='' then begin
|
|
|
MessageDlg('ÇëÉèÖÃFTPµØÖ·£¡',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
ftpname:=Trim(Edit9.Text);;
|
|
|
if ftpar='' then begin
|
|
|
MessageDlg('ÇëÉèÖÃFTPÓû§Ãû£¡',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
ftppass:=Trim(Edit10.Text);;
|
|
|
if ftpar='' then begin
|
|
|
MessageDlg('ÇëÉèÖÃFTPÃÜÂ룡',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
ftppath:=Trim(Edit11.Text);;
|
|
|
|
|
|
str:=ScriptPath
|
|
|
+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring
|
|
|
+FormatDateTime('yyyy',now)
|
|
|
+FormatDateTime('mm',now)
|
|
|
+FormatDateTime('dd',now)
|
|
|
+FormatDateTime('hh',now)
|
|
|
+FormatDateTime('nn',now)+FormatDateTime('ss',now)+FormatDateTime('zzz',now)+'.txt';
|
|
|
|
|
|
str_file:=frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring
|
|
|
+FormatDateTime('yyyy',now)
|
|
|
+FormatDateTime('mm',now)
|
|
|
+FormatDateTime('dd',now)
|
|
|
+FormatDateTime('hh',now)
|
|
|
+FormatDateTime('nn',now)+FormatDateTime('ss',now)+FormatDateTime('zzz',now)+'.txt';
|
|
|
|
|
|
|
|
|
StrL:=Tstringlist.Create;
|
|
|
StrL.Clear;
|
|
|
count:=0;
|
|
|
bill_count:=0;
|
|
|
|
|
|
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 then
|
|
|
exit;
|
|
|
if RadioGroup1.ItemIndex=1 then
|
|
|
get_Count:=frm_op_seae_edi_swi.get_txtSI(StrL)
|
|
|
else
|
|
|
get_Count:=frm_op_seae_edi_swi.get_txtBooking(StrL);
|
|
|
|
|
|
if get_Count=-1 then
|
|
|
exit
|
|
|
else
|
|
|
count:=count+get_Count;
|
|
|
bill_count:=bill_count+1;
|
|
|
|
|
|
end;
|
|
|
StrL.Add('UNT+'+INTTOSTR(StrL.count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
StrL.Add('UNZ+'+inttostr(bill_count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if not isEditrue then
|
|
|
exit;
|
|
|
if RadioGroup1.ItemIndex=1 then
|
|
|
get_Count:=frm_op_seae_edi_swi.get_txtSI(StrL)
|
|
|
else
|
|
|
get_Count:=frm_op_seae_edi_swi.get_txtBooking(StrL);
|
|
|
if get_Count=-1 then
|
|
|
exit
|
|
|
else
|
|
|
count:=count+get_Count;
|
|
|
|
|
|
StrL.Add('UNT+'+INTTOSTR(StrL.count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
StrL.Add('UNZ+1+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
for i:=0 to StrL.Count-1 do begin
|
|
|
if IsZhongwen(StrL[i]) then begin
|
|
|
MessageDlg('´ËƱҵÎñÓÐÖÐÎÄ×Ö·û»òTAB¼ü»ò<>×Ö·û,²»ÄÜÉÏ´«£¡'+#13#10+Str[i],mtWarning,[mbYes],0);
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
StrL.SaveToFile(str);
|
|
|
edi:=StrL.Text;
|
|
|
|
|
|
IF (CheckBox2.Checked) THEN begin
|
|
|
ResponseStream := TStringStream.Create('');
|
|
|
MultiPartFormDataStream := TIdMultiPartFormDataStream.Create;
|
|
|
IdHTTP1:=TIdHTTP.Create(Application);
|
|
|
try
|
|
|
IdHttp1.Request.Accept := '*/*';
|
|
|
IdHttp1.Request.AcceptLanguage:='zh-CN';
|
|
|
IdHttp1.Request.ContentType := MultiPartFormDataStream.RequestContentType;
|
|
|
MultiPartFormDataStream.AddFile('filename',str,GetMIMETypeFromFile(str));
|
|
|
MultiPartFormDataStream.Position := 0;
|
|
|
|
|
|
try
|
|
|
if (RadioGroup1.ItemIndex=1) then
|
|
|
IdHTTP1.Post(StringReplace(get_parameters_value(2125,''),'SftpFilesJF','SftpSiFilesSWIJF',[rfReplaceAll]), MultiPartFormDataStream,ResponseStream)
|
|
|
else
|
|
|
IdHTTP1.Post(StringReplace(get_parameters_value(2125,''),'SftpFilesJF','SftpFilesSWIJF',[rfReplaceAll]), MultiPartFormDataStream,ResponseStream);
|
|
|
except
|
|
|
on e : Exception do
|
|
|
begin
|
|
|
end;
|
|
|
end;
|
|
|
ResponseStr := ResponseStream.DataString; //»ñÈ¡ÍøÒ³·µ»ØµÄÐÅÏ¢
|
|
|
ResponseStr := UTF8Decode(ResponseStr); //ÍøÒ³ÖеĴæÔÚÖÐÎÄʱ£¬ÐèÒª½øÐÐUTF8½âÂë
|
|
|
jo:=so(ResponseStr);
|
|
|
strmsg:=jo.O['Message'].AsString;
|
|
|
if (jo.O['Success'].AsString='true') then begin
|
|
|
Application.MessageBox(pchar('ÉÏ´«³É¹¦,'+strmsg),'Ìáʾ:',mrOk);
|
|
|
InsertSysLog('ÉÏ´«±¨Îijɹ¦',frm_op_seae.t_op_seae.FieldByName('ÒµÎñ±àºÅ').asstring+'---'+str);
|
|
|
if RadioGroup1.ItemIndex=0 then
|
|
|
SIO:='SO'
|
|
|
else SIO:='SI';
|
|
|
if RadioGroup3.ItemIndex=0 then
|
|
|
ORG:='ORG'
|
|
|
else ORG:='AMEND';
|
|
|
|
|
|
|
|
|
CARR:=frm_op_seae.t_op_seae.fieldbyname('´¬¹«Ë¾').asstring;
|
|
|
CORP:=frm_op_seae.t_op_seae.fieldbyname('ίÍе¥Î»').asstring;
|
|
|
EMP:=employee;
|
|
|
EMPDAE:=FormatDateTime('YYYY-MM-DD hh:mm:ss',now);
|
|
|
ETD:=FormatDateTime('YYYY-MM-DD',frm_op_seae.t_op_seae.fieldbyname('¿ª´¬ÈÕÆÚ').value);
|
|
|
Insertt_op_Edi_Log(SIO,ORG,MBL,CARR,MBLNO,ETD,CORP,EMP,EMPDAE,str,edi);
|
|
|
end else begin
|
|
|
deletefile(str);
|
|
|
InsertSysLog('ÉÏ´«±¨Îijö´í',frm_op_seae.t_op_seae.FieldByName('ÒµÎñ±àºÅ').asstring+'---'+str);
|
|
|
showmessage('ÎļþÉÏ´«³öÏÖ´íÎó£¡'+strmsg);
|
|
|
i_soi:=1;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
finally
|
|
|
MultiPartFormDataStream.Free;
|
|
|
FreeAndNil(IdHTTP1);
|
|
|
FreeAndNil(ResponseStream);
|
|
|
end;
|
|
|
|
|
|
end else begin
|
|
|
|
|
|
try
|
|
|
|
|
|
IdFTP1:=TIdFTP.Create(application);
|
|
|
with idftp1 do
|
|
|
begin
|
|
|
Username:=ftpname;
|
|
|
Password:=ftppass;
|
|
|
Host:=ftpar;
|
|
|
Passive:=CheckBox1.Checked;
|
|
|
Connect;
|
|
|
end;
|
|
|
idftp1.ChangeDir(ftppath);
|
|
|
idftp1.TransferType:=ftBinary;
|
|
|
idftp1.Put(str,str_file);
|
|
|
idftp1.Disconnect;
|
|
|
|
|
|
showmessage('ÎļþÉÏ´«³É¹¦£¡');
|
|
|
|
|
|
if RadioGroup1.ItemIndex=0 then
|
|
|
SIO:='SO'
|
|
|
else SIO:='SI';
|
|
|
if RadioGroup3.ItemIndex=0 then
|
|
|
ORG:='ORG'
|
|
|
else ORG:='AMEND';
|
|
|
|
|
|
IF bsck.Checked then
|
|
|
begin
|
|
|
MBL:='·Öµ¥';
|
|
|
MBLNO:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring;
|
|
|
if (MBLNO='') THEN MBLNO:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('ÒµÎñ±àºÅ').asstring;
|
|
|
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
MBL:='Ö÷µ¥';
|
|
|
MBLNO:=frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring;
|
|
|
if (MBLNO='') THEN MBLNO:=frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring;
|
|
|
end;
|
|
|
CARR:=frm_op_seae.t_op_seae.fieldbyname('´¬¹«Ë¾').asstring;
|
|
|
CORP:=frm_op_seae.t_op_seae.fieldbyname('ίÍе¥Î»').asstring;
|
|
|
EMP:=employee;
|
|
|
EMPDAE:=FormatDateTime('YYYY-MM-DD hh:mm:ss',now);
|
|
|
ETD:=FormatDateTime('YYYY-MM-DD',frm_op_seae.t_op_seae.fieldbyname('¿ª´¬ÈÕÆÚ').value);
|
|
|
Insertt_op_Edi_Log(SIO,ORG,MBL,CARR,MBLNO,ETD,CORP,EMP,EMPDAE,str,edi);
|
|
|
|
|
|
|
|
|
except
|
|
|
on e : exception do
|
|
|
begin
|
|
|
MessageDlg('ÎļþÉÏ´«´íÎó£¡'+e.message,mtError,[mbOk],0);
|
|
|
deletefile(str);
|
|
|
i_soi:=1;
|
|
|
// showmessage('ÎļþÉÏ´«´íÎó£¡');
|
|
|
end;
|
|
|
end;
|
|
|
idftp1.Free;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if i_soi=0 then UpdateSOIStatus(RadioGroup1.ItemIndex,frm_op_seae.t_op_seae.fieldbyname('񅧏').asstring);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_swi.FormClose(Sender: TObject;
|
|
|
var Action: TCloseAction);
|
|
|
VAR
|
|
|
inifile1:TIniFile;
|
|
|
begin
|
|
|
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
|
|
|
inifile1.WriteString('EDI','SEND_CODE',edit1.text);
|
|
|
inifile1.WriteString('EDI','SEND_NAME',edit2.text);
|
|
|
inifile1.WriteString('EDI','RECEIVE_CODE',edit3.text);
|
|
|
inifile1.WriteString('EDI','RECEIVE_NAME',edit4.text);
|
|
|
inifile1.WriteString('EDI','SEND_TEL',edit5.text);
|
|
|
inifile1.WriteString('EDI','SEND_MAIL',edit6.text);
|
|
|
inifile1.WriteString('EDI','SEND_ATTN',edit7.text);
|
|
|
|
|
|
inifile1.WriteString('EDI','FTPADD',edit8.text);
|
|
|
inifile1.WriteString('EDI','FTPNAME',edit9.text);
|
|
|
inifile1.WriteString('EDI','FTPPASS',Edit10.text);
|
|
|
inifile1.WriteString('EDI','FTPPATH',Edit11.text);
|
|
|
|
|
|
inifile1.WriteString('EDI','ADDR',edit12.text);
|
|
|
|
|
|
inifile1.WriteInteger('EDI','CMASEND_TYPE',RadioGroup1.ItemIndex);
|
|
|
|
|
|
|
|
|
inifile1.WriteString('EDI','FTPADDCMA',edit15.text);
|
|
|
inifile1.WriteString('EDI','FTPNAMECMA',edit16.text);
|
|
|
inifile1.WriteString('EDI','FTPPASSCMA',Edit17.text);
|
|
|
inifile1.WriteString('EDI','FTPPATHCMA',Edit18.text);
|
|
|
if CheckBox1.checked then
|
|
|
inifile1.WriteString('EDI','SEND_FTPPASSIVE_CMA','1');
|
|
|
if CheckBox2.checked then
|
|
|
inifile1.WriteString('EDI','SEND_FTPSFTP_CMA','1')
|
|
|
ELSE inifile1.WriteString('EDI','SEND_FTPSFTP_CMA','0');
|
|
|
inifile1.free;
|
|
|
action:=cafree;
|
|
|
frm_op_seae_edi_swi:=nil;
|
|
|
|
|
|
end;
|
|
|
|
|
|
function Tfrm_op_seae_edi_swi.get_txtvgm_cargo(str:Tstringlist):integer;
|
|
|
var
|
|
|
str_all,sl:Tstringlist;
|
|
|
i,count:integer;
|
|
|
SM,Carrer:string;
|
|
|
|
|
|
begin
|
|
|
i:=0;
|
|
|
Carrer:='SWI';
|
|
|
str_all:=Tstringlist.Create;
|
|
|
count:=0;
|
|
|
|
|
|
str.Add('UNB+UNOA:2+'+Edit1.TEXT+':ZZ+'+'CARGOSMART'
|
|
|
+':01+'+GetDatetime(datetimetostr(now),2)+'+'
|
|
|
+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
|
|
|
str.Add('UNH+'+frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'+VERMAS:D:16A:UN'+#39);
|
|
|
count:=count+1;
|
|
|
if RadioGroup3.ItemIndex=0 then
|
|
|
str.Add('BGM+XXX+'+frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'+9'+#39) //9Ôʼ 5 ¸üÐÂ
|
|
|
else str.Add('BGM+XXX+'+frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'+5'+#39); //9Ôʼ 5 ¸üÐÂ
|
|
|
count:=count+1;
|
|
|
|
|
|
count:=count+1;
|
|
|
t_op_ctn.close;
|
|
|
t_op_ctn.Parameters.ParamByName('񅧏').Value:=frm_op_seae.t_op_seae.fieldbyname('񅧏').asstring;
|
|
|
t_op_ctn.open;
|
|
|
t_op_ctn.first;
|
|
|
while not t_op_ctn.eof do
|
|
|
begin
|
|
|
if (t_op_ctn.fieldbyname('³ÆÖØ·½Ê½').asstring<>'') or (t_op_ctn.fieldbyname('³ÆÖØ·½Ê½').asstring<>'ÎÞ') then
|
|
|
begin
|
|
|
i:=i+1;
|
|
|
|
|
|
str.Add('DTM+137:'+GetDatetime(datetimetostr(now),1)+':203'+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('NAD+CA+'+GetShipEdiNO(frm_op_seae.t_op_seae.fieldbyname('´¬¹«Ë¾').asstring)+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('EQD+CN+'+t_op_ctn.fieldbyname('ÏäºÅ').asstring+#39); //ÊýÁ¿
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('RFF+BM:'+frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('RFF+BN:'+frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('MEA+AAE+VGM+KGM:'+t_op_ctn.fieldbyname('³ÆÖØÖØÁ¿').asstring+#39); ////ÀÛ¼Ó ÎÞ
|
|
|
count:=count+1;
|
|
|
|
|
|
if Trim(t_op_ctn.fieldbyname('³ÆÖØ·½Ê½').asstring)='ÀÛ¼Ó' then
|
|
|
SM:='SM2'
|
|
|
else if Trim(t_op_ctn.fieldbyname('³ÆÖØ·½Ê½').asstring)='×ÜÖØ' then
|
|
|
SM:='SM1';
|
|
|
|
|
|
str.Add('DOC+'+SM+':VGM:306'+#39); ////ÀÛ¼Ó ÎÞ
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('NAD+SPC+++'+Changestr(Edit2.Text)+#39); ////ÀÛ¼Ó ÎÞ
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('UNT+9+'+IntToStr(i)+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
t_op_ctn.next;
|
|
|
end;
|
|
|
result:=count;
|
|
|
end;
|
|
|
{
|
|
|
function Tfrm_op_seae_edi_cma.get_txtvgm_intrra(str:Tstringlist):integer;
|
|
|
var
|
|
|
str_all,sl:Tstringlist;
|
|
|
i,count:integer;
|
|
|
SM,Carrer:string;
|
|
|
begin
|
|
|
i:=0;
|
|
|
case RadioGroup2.ItemIndex of
|
|
|
0:Carrer:='MAEU';
|
|
|
1:Carrer:='SAFM';
|
|
|
2:Carrer:='MCPU';
|
|
|
end;
|
|
|
|
|
|
str_all:=Tstringlist.Create;
|
|
|
count:=0;
|
|
|
|
|
|
str.Add('UNB+UNOC:3+'+Edit1.TEXT+':ZZZ+'+'INTTRA'
|
|
|
+':ZZZ+'+GetDatetime(datetimetostr(now),2)+'+'
|
|
|
+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
|
|
|
str.Add('UNH+001+VERMAS:D:16A:UN:0.8'+#39);
|
|
|
count:=count+1;
|
|
|
if RadioGroup3.ItemIndex=0 then
|
|
|
str.Add('BGM+XXX+'+frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'+9'+#39) //9Ôʼ 5 ¸üÐÂ
|
|
|
else str.Add('BGM+XXX+'+frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'+5'+#39); //9Ôʼ 5 ¸üÐÂ
|
|
|
count:=count+1;
|
|
|
|
|
|
count:=count+1;
|
|
|
t_op_ctn.close;
|
|
|
t_op_ctn.Parameters.ParamByName('񅧏').Value:=frm_op_seae.t_op_seae.fieldbyname('񅧏').asstring;
|
|
|
t_op_ctn.open;
|
|
|
t_op_ctn.first;
|
|
|
while not t_op_ctn.eof do
|
|
|
begin
|
|
|
if (t_op_ctn.fieldbyname('³ÆÖØ·½Ê½').asstring<>'') or (t_op_ctn.fieldbyname('³ÆÖØ·½Ê½').asstring<>'ÎÞ') then
|
|
|
begin
|
|
|
i:=i+1;
|
|
|
|
|
|
str.Add('DTM+137:'+GetDatetime(datetimetostr(now),1)+':203'+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
str.Add('EQD+CN+'+t_op_ctn.fieldbyname('ÏäºÅ').asstring+':6346:5'+#39); //ÊýÁ¿
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('RFF+BN:'+frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('RFF+AOW:'+frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
str.Add('MEA+AAE+VGM+KGM:'+t_op_ctn.fieldbyname('³ÆÖØÖØÁ¿').asstring+#39); ////ÀÛ¼Ó ÎÞ
|
|
|
count:=count+1;
|
|
|
|
|
|
if Trim(t_op_ctn.fieldbyname('³ÆÖØ·½Ê½').asstring)='ÀÛ¼Ó' then
|
|
|
SM:='SM2'
|
|
|
else if Trim(t_op_ctn.fieldbyname('³ÆÖØ·½Ê½').asstring)='×ÜÖØ' then
|
|
|
SM:='SM1';
|
|
|
|
|
|
str.Add('DOC+'+SM+':VGM:306'+#39); ////ÀÛ¼Ó ÎÞ
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('NAD+SPC+++'+Changestr(Edit2.Text)+#39); ////ÀÛ¼Ó ÎÞ
|
|
|
count:=count+1;
|
|
|
|
|
|
str.Add('NAD+CA+'+GetShipEdiNO(frm_op_seae.t_op_seae.fieldbyname('´¬¹«Ë¾').asstring)+'::86++'+frm_op_seae.t_op_seae.fieldbyname('´¬¹«Ë¾').asstring+#39);
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
str.Add('UNT+9+'+IntToStr(i)+#39);
|
|
|
count:=count+1;
|
|
|
end;
|
|
|
t_op_ctn.next;
|
|
|
end;
|
|
|
result:=count;
|
|
|
end;
|
|
|
}
|
|
|
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_swi.bsSkinButton7Click(Sender: TObject);
|
|
|
var
|
|
|
str:Tstringlist;
|
|
|
i,Count,get_Count,bill_count:integer;
|
|
|
inifile1:Tinifile;
|
|
|
SIO,ORG,MBL,CARR,MBLNO,ETD,CORP,EMP,EMPDAE:string;
|
|
|
edi:WideString;
|
|
|
begin
|
|
|
|
|
|
str:=Tstringlist.Create;
|
|
|
str.Clear;
|
|
|
count:=0;
|
|
|
bill_count:=0;
|
|
|
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]));
|
|
|
get_Count:=frm_op_seae_edi_swi.get_txtvgm_cma(str);
|
|
|
|
|
|
if get_Count=-1 then
|
|
|
exit
|
|
|
else
|
|
|
count:=count+get_Count;
|
|
|
bill_count:=bill_count+1;
|
|
|
|
|
|
end;
|
|
|
str.Add('UNZ+'+inttostr(count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
get_Count:=frm_op_seae_edi_swi.get_txtvgm_cma(str);
|
|
|
if get_Count=-1 then
|
|
|
exit
|
|
|
else
|
|
|
count:=count+get_Count;
|
|
|
|
|
|
str.Add('UNZ+'+inttostr(count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
end;
|
|
|
|
|
|
for i:=0 to Str.Count-1 do begin
|
|
|
if IsZhongwen(Str[i]) then
|
|
|
begin
|
|
|
MessageDlg('´ËƱҵÎñÓÐÖÐÎÄ×Ö·û»òTAB¼ü,²»ÄÜÉÏ´«£¡'+#13#10+Str[i],mtWarning,[mbYes],0);
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
SaveDialog1.FileName:=frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+GetDatetime(datetimetostr(now),1);
|
|
|
if SaveDialog1.Execute then
|
|
|
begin
|
|
|
str.SaveToFile(SaveDialog1.FileName+'.txt');
|
|
|
showmessage('ÎļþÉú³É³É¹¦£¡');
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
showmessage('ÎļþÉú³Éʧ°Ü£¡');
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
{procedure Tfrm_op_seae_edi_cma.bsSkinButton7Click(Sender: TObject);
|
|
|
var
|
|
|
str:Tstringlist;
|
|
|
i,Count,get_Count,bill_count:integer;
|
|
|
inifile1:Tinifile;
|
|
|
SIO,ORG,MBL,CARR,MBLNO,ETD,CORP,EMP,EMPDAE:string;
|
|
|
edi:WideString;
|
|
|
begin
|
|
|
|
|
|
str:=Tstringlist.Create;
|
|
|
str.Clear;
|
|
|
count:=0;
|
|
|
bill_count:=0;
|
|
|
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]));
|
|
|
get_Count:=frm_op_seae_edi_cma.get_txtvgm_intrra(str);
|
|
|
|
|
|
if get_Count=-1 then
|
|
|
exit
|
|
|
else
|
|
|
count:=count+get_Count;
|
|
|
bill_count:=bill_count+1;
|
|
|
|
|
|
end;
|
|
|
str.Add('UNT+'+INTTOSTR(str.count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
str.Add('UNZ+'+inttostr(bill_count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
get_Count:=frm_op_seae_edi_cma.get_txtvgm_intrra(str);
|
|
|
if get_Count=-1 then
|
|
|
exit
|
|
|
else
|
|
|
count:=count+get_Count;
|
|
|
|
|
|
str.Add('UNT+'+INTTOSTR(str.count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
str.Add('UNZ+1+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
end;
|
|
|
|
|
|
for i:=0 to Str.Count-1 do begin
|
|
|
if IsZhongwen(Str[i]) then
|
|
|
begin
|
|
|
MessageDlg('´ËƱҵÎñÓÐÖÐÎÄ×Ö·û»òTAB¼ü,²»ÄÜÉÏ´«£¡'+#13#10+Str[i],mtWarning,[mbYes],0);
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
SaveDialog1.FileName:=frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+GetDatetime(datetimetostr(now),1);
|
|
|
if SaveDialog1.Execute then
|
|
|
begin
|
|
|
str.SaveToFile(SaveDialog1.FileName+'.txt');
|
|
|
showmessage('ÎļþÉú³É³É¹¦£¡');
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
showmessage('ÎļþÉú³Éʧ°Ü£¡');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
|
|
|
end;
|
|
|
}
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_swi.bsSkinButton5Click(Sender: TObject);
|
|
|
var
|
|
|
IdFTP1:TIdFTP;
|
|
|
str:widestring;
|
|
|
str_file:widestring;
|
|
|
ftpar,ftpname,ftppass,ftppath,ftppathSI,ScriptPath,strmsg:String;
|
|
|
StrL:Tstringlist;
|
|
|
i,Count,get_Count,bill_count,i_soi:integer;
|
|
|
|
|
|
SIO,ORG,MBL,CARR,MBLNO,ETD,CORP,EMP,EMPDAE:string;
|
|
|
edi:WideString;
|
|
|
IdHttp : TIdHTTP;
|
|
|
errmsg : string;//ÇëÇóµØÖ·
|
|
|
ResponseStream : TStringStream; //·µ»ØÐÅÏ¢
|
|
|
ResponseStr: string;
|
|
|
RequestStr : string; //ÇëÇóÐÅÏ¢
|
|
|
RequestStream : TStringStream;
|
|
|
jo: ISuperObject;
|
|
|
k:Integer;
|
|
|
sl:TStrings;
|
|
|
MultiPartFormDataStream :TIdMultiPartFormDataStream;
|
|
|
IdHTTP1:TIdHTTP;
|
|
|
|
|
|
begin
|
|
|
i_soi:=0;
|
|
|
if bsck.Checked then
|
|
|
begin
|
|
|
if frm_op_seae_assistant=nil then
|
|
|
begin
|
|
|
ShowMessage('ÇëÔÚ(ίÍкÍÌáµ¥)½çÃæ·¢ËÍ·Öµ¥Edi');
|
|
|
exit;
|
|
|
end
|
|
|
end;
|
|
|
|
|
|
ScriptPath:=ExtractFilePath(ParamStr(0))+'EDIFILE\';
|
|
|
if not DirectoryExists(ScriptPath) then
|
|
|
CreateDir(ScriptPath);
|
|
|
|
|
|
ftpar:=Trim(Edit15.Text);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
str:=ScriptPath
|
|
|
+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring
|
|
|
+FormatDateTime('yyyy',now)
|
|
|
+FormatDateTime('mm',now)
|
|
|
+FormatDateTime('dd',now)
|
|
|
+FormatDateTime('hh',now)
|
|
|
+FormatDateTime('nn',now)+'.txt';
|
|
|
|
|
|
str_file:=frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring
|
|
|
+FormatDateTime('yyyy',now)
|
|
|
+FormatDateTime('mm',now)
|
|
|
+FormatDateTime('dd',now)
|
|
|
+FormatDateTime('hh',now)
|
|
|
+FormatDateTime('nn',now)+'.txt';
|
|
|
|
|
|
|
|
|
StrL:=Tstringlist.Create;
|
|
|
StrL.Clear;
|
|
|
count:=0;
|
|
|
bill_count:=0;
|
|
|
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 RadioGroup1.ItemIndex=1 then
|
|
|
get_Count:=frm_op_seae_edi_swi.get_txtvgm_cma(StrL)
|
|
|
else
|
|
|
get_Count:=frm_op_seae_edi_swi.get_txtvgm_cma(StrL);
|
|
|
|
|
|
if get_Count=-1 then
|
|
|
exit
|
|
|
else
|
|
|
count:=count+get_Count;
|
|
|
bill_count:=bill_count+1;
|
|
|
|
|
|
end;
|
|
|
StrL.Add('UNZ+'+inttostr(count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if RadioGroup1.ItemIndex=1 then
|
|
|
get_Count:=frm_op_seae_edi_swi.get_txtvgm_cma(StrL)
|
|
|
else
|
|
|
get_Count:=frm_op_seae_edi_swi.get_txtvgm_cma(StrL);
|
|
|
if get_Count=-1 then
|
|
|
exit
|
|
|
else
|
|
|
count:=count+get_Count;
|
|
|
|
|
|
StrL.Add('UNZ+'+inttostr(count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
{
|
|
|
str.Add('UNT+'+INTTOSTR(count)+'+1'+#39);
|
|
|
str.Add('UNZ+1+100'+#39);
|
|
|
}
|
|
|
end;
|
|
|
|
|
|
for i:=0 to StrL.Count-1 do begin
|
|
|
if IsZhongwen(StrL[i]) then begin
|
|
|
MessageDlg('´ËƱҵÎñÓÐÖÐÎÄ×Ö·û»òTAB¼ü»ò<>×Ö·û,²»ÄÜÉÏ´«£¡'+#13#10+Str[i],mtWarning,[mbYes],0);
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
StrL.SaveToFile(str);
|
|
|
edi:=StrL.Text;
|
|
|
|
|
|
IF (CheckBox2.Checked) THEN begin
|
|
|
ResponseStream := TStringStream.Create('');
|
|
|
MultiPartFormDataStream := TIdMultiPartFormDataStream.Create;
|
|
|
IdHTTP1:=TIdHTTP.Create(Application);
|
|
|
try
|
|
|
IdHttp1.Request.Accept := '*/*';
|
|
|
IdHttp1.Request.AcceptLanguage:='zh-CN';
|
|
|
IdHttp1.Request.ContentType := MultiPartFormDataStream.RequestContentType;
|
|
|
MultiPartFormDataStream.AddFile('filename',str,GetMIMETypeFromFile(str));
|
|
|
MultiPartFormDataStream.Position := 0;
|
|
|
|
|
|
try
|
|
|
if (RadioGroup1.ItemIndex=1) then
|
|
|
IdHTTP1.Post(StringReplace(get_parameters_value(2125,''),'SftpFilesJF','SftpVgmFilesSWIJF',[rfReplaceAll]), MultiPartFormDataStream,ResponseStream)
|
|
|
else
|
|
|
IdHTTP1.Post(StringReplace(get_parameters_value(2125,''),'SftpFilesJF','SftpFilesSWIJF',[rfReplaceAll]), MultiPartFormDataStream,ResponseStream);
|
|
|
except
|
|
|
on e : Exception do
|
|
|
begin
|
|
|
end;
|
|
|
end;
|
|
|
ResponseStr := ResponseStream.DataString; //»ñÈ¡ÍøÒ³·µ»ØµÄÐÅÏ¢
|
|
|
ResponseStr := UTF8Decode(ResponseStr); //ÍøÒ³ÖеĴæÔÚÖÐÎÄʱ£¬ÐèÒª½øÐÐUTF8½âÂë
|
|
|
jo:=so(ResponseStr);
|
|
|
strmsg:=jo.O['Message'].AsString;
|
|
|
if (jo.O['Success'].AsString='true') then begin
|
|
|
Application.MessageBox(pchar('ÉÏ´«³É¹¦,'+strmsg),'Ìáʾ:',mrOk);
|
|
|
InsertSysLog('ÉÏ´«±¨Îijɹ¦',frm_op_seae.t_op_seae.FieldByName('ÒµÎñ±àºÅ').asstring+'---'+str);
|
|
|
|
|
|
SIO:='VGM'
|
|
|
|
|
|
|
|
|
{
|
|
|
CARR:=frm_op_seae.t_op_seae.fieldbyname('´¬¹«Ë¾').asstring;
|
|
|
CORP:=frm_op_seae.t_op_seae.fieldbyname('ίÍе¥Î»').asstring;
|
|
|
EMP:=employee;
|
|
|
EMPDAE:=FormatDateTime('YYYY-MM-DD hh:mm:ss',now);
|
|
|
ETD:=FormatDateTime('YYYY-MM-DD',frm_op_seae.t_op_seae.fieldbyname('¿ª´¬ÈÕÆÚ').value);
|
|
|
Insertt_op_Edi_Log(SIO,ORG,MBL,CARR,MBLNO,ETD,CORP,EMP,EMPDAE,str,edi);
|
|
|
}
|
|
|
|
|
|
end else begin
|
|
|
deletefile(str);
|
|
|
InsertSysLog('ÉÏ´«±¨Îijö´í',frm_op_seae.t_op_seae.FieldByName('ÒµÎñ±àºÅ').asstring+'---'+str);
|
|
|
showmessage('ÎļþÉÏ´«³öÏÖ´íÎó£¡'+strmsg);
|
|
|
i_soi:=1;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
finally
|
|
|
MultiPartFormDataStream.Free;
|
|
|
FreeAndNil(IdHTTP1);
|
|
|
FreeAndNil(ResponseStream);
|
|
|
end;
|
|
|
|
|
|
end else begin
|
|
|
|
|
|
|
|
|
edi:=StrL.Text;
|
|
|
|
|
|
try
|
|
|
IdFTP1:=TIdFTP.Create(application);
|
|
|
with idftp1 do
|
|
|
begin
|
|
|
Username:=ftpname;
|
|
|
Password:=ftppass;
|
|
|
Host:=ftpar;
|
|
|
Passive:=CheckBox1.Checked;
|
|
|
Connect;
|
|
|
end;
|
|
|
|
|
|
case RadioGroup1.ItemIndex of
|
|
|
0:begin
|
|
|
idftp1.ChangeDir(ftppath);
|
|
|
end;
|
|
|
1:begin
|
|
|
if (Trim(ftppathSI)<>'') then
|
|
|
idftp1.ChangeDir(ftppathSI)
|
|
|
else idftp1.ChangeDir(ftppath);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
// idftp1.ChangeDir(ftppath);
|
|
|
idftp1.TransferType:=ftBinary;
|
|
|
idftp1.Put(str,str_file);
|
|
|
idftp1.Disconnect;
|
|
|
showmessage('ÎļþÉÏ´«³É¹¦£¡');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
if RadioGroup1.ItemIndex=0 then
|
|
|
SIO:='SO'
|
|
|
else SIO:='SI';
|
|
|
}
|
|
|
SIO:='VGM';
|
|
|
|
|
|
if RadioGroup3.ItemIndex=0 then
|
|
|
ORG:='ORG'
|
|
|
else ORG:='AMEND';
|
|
|
|
|
|
IF bsck.Checked then
|
|
|
begin
|
|
|
MBL:='·Öµ¥';
|
|
|
MBLNO:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring;
|
|
|
if (MBLNO='') THEN MBLNO:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('ÒµÎñ±àºÅ').asstring;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
MBL:='Ö÷µ¥';
|
|
|
MBLNO:=frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring;
|
|
|
if (MBLNO='') THEN MBLNO:=frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring;
|
|
|
end;
|
|
|
CARR:=frm_op_seae.t_op_seae.fieldbyname('´¬¹«Ë¾').asstring;
|
|
|
CORP:=frm_op_seae.t_op_seae.fieldbyname('ίÍе¥Î»').asstring;
|
|
|
EMP:=employee;
|
|
|
EMPDAE:=FormatDateTime('YYYY-MM-DD hh:mm:ss',now);
|
|
|
ETD:=FormatDateTime('YYYY-MM-DD',frm_op_seae.t_op_seae.fieldbyname('¿ª´¬ÈÕÆÚ').value);
|
|
|
Insertt_op_Edi_Log(SIO,ORG,MBL,CARR,MBLNO,ETD,CORP,EMP,EMPDAE,str,edi);
|
|
|
|
|
|
|
|
|
except
|
|
|
on e : exception do
|
|
|
begin
|
|
|
MessageDlg('ÎļþÉÏ´«´íÎó£¡'+e.message,mtError,[mbOk],0);
|
|
|
deletefile(str);
|
|
|
i_soi:=1;
|
|
|
// showmessage('ÎļþÉÏ´«´íÎó£¡');
|
|
|
end;
|
|
|
end;
|
|
|
idftp1.Free;
|
|
|
END;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{procedure Tfrm_op_seae_edi_cma.bsSkinButton5Click(Sender: TObject);
|
|
|
var
|
|
|
IdFTP1:TIdFTP;
|
|
|
str:widestring;
|
|
|
str_file:widestring;
|
|
|
ftpar,ftpname,ftppass,ftppath,ScriptPath:String;
|
|
|
StrL:Tstringlist;
|
|
|
i,Count,get_Count,bill_count,i_soi:integer;
|
|
|
|
|
|
SIO,ORG,MBL,CARR,MBLNO,ETD,CORP,EMP,EMPDAE:string;
|
|
|
edi:WideString;
|
|
|
|
|
|
begin
|
|
|
i_soi:=0;
|
|
|
|
|
|
ScriptPath:=ExtractFilePath(ParamStr(0))+'EDIFILE\';
|
|
|
if not DirectoryExists(ScriptPath) then
|
|
|
CreateDir(ScriptPath);
|
|
|
|
|
|
ftpar:=Trim(Edit8.Text);
|
|
|
if ftpar='' then begin
|
|
|
MessageDlg('ÇëÉèÖÃFTPµØÖ·£¡',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
ftpname:=Trim(Edit9.Text);;
|
|
|
if ftpar='' then begin
|
|
|
MessageDlg('ÇëÉèÖÃFTPÓû§Ãû£¡',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
ftppass:=Trim(Edit10.Text);;
|
|
|
if ftpar='' then begin
|
|
|
MessageDlg('ÇëÉèÖÃFTPÃÜÂ룡',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
ftppath:=Trim(Edit11.Text);;
|
|
|
|
|
|
str:=ScriptPath
|
|
|
+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring
|
|
|
+FormatDateTime('yyyy',now)
|
|
|
+FormatDateTime('mm',now)
|
|
|
+FormatDateTime('dd',now)
|
|
|
+FormatDateTime('hh',now)
|
|
|
+FormatDateTime('nn',now)+'.txt';
|
|
|
|
|
|
str_file:=frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring
|
|
|
+FormatDateTime('yyyy',now)
|
|
|
+FormatDateTime('mm',now)
|
|
|
+FormatDateTime('dd',now)
|
|
|
+FormatDateTime('hh',now)
|
|
|
+FormatDateTime('nn',now)+'.txt';
|
|
|
|
|
|
|
|
|
StrL:=Tstringlist.Create;
|
|
|
StrL.Clear;
|
|
|
count:=0;
|
|
|
bill_count:=0;
|
|
|
if frm_op_seae.dxdbgrid1.SelectedCount>1 then
|
|
|
begin
|
|
|
for i:=0 to frm_op_seae.dxdbgrid1.SelectedCount-1 do
|
|
|
begin
|
|
|
get_Count:=frm_op_seae_edi_cma.get_txtvgm_intrra(StrL);
|
|
|
count:=count+get_Count;
|
|
|
bill_count:=bill_count+1;
|
|
|
end;
|
|
|
StrL.Add('UNT+'+INTTOSTR(StrL.count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
StrL.Add('UNZ+'+inttostr(bill_count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
get_Count:=frm_op_seae_edi_cma.get_txtvgm_intrra(StrL);
|
|
|
count:=count+get_Count;
|
|
|
|
|
|
StrL.Add('UNT+'+INTTOSTR(StrL.count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
StrL.Add('UNZ+1+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
StrL.SaveToFile(str);
|
|
|
edi:=StrL.Text;
|
|
|
|
|
|
try
|
|
|
IdFTP1:=TIdFTP.Create(application);
|
|
|
with idftp1 do
|
|
|
begin
|
|
|
Username:=ftpname;
|
|
|
Password:=ftppass;
|
|
|
Host:=ftpar;
|
|
|
Connect;
|
|
|
end;
|
|
|
idftp1.ChangeDir(ftppath);
|
|
|
idftp1.TransferType:=ftBinary;
|
|
|
idftp1.Put(str,str_file);
|
|
|
idftp1.Disconnect;
|
|
|
showmessage('ÎļþÉÏ´«³É¹¦£¡');
|
|
|
|
|
|
|
|
|
//
|
|
|
if RadioGroup1.ItemIndex=0 then
|
|
|
SIO:='SO'
|
|
|
else SIO:='SI';
|
|
|
if RadioGroup3.ItemIndex=0 then
|
|
|
ORG:='ORG'
|
|
|
else ORG:='AMEND';
|
|
|
|
|
|
IF bsck.Checked then
|
|
|
begin
|
|
|
MBL:='·Öµ¥';
|
|
|
MBLNO:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
MBL:='Ö÷µ¥';
|
|
|
MBLNO:=frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring;
|
|
|
end;
|
|
|
CARR:=frm_op_seae.t_op_seae.fieldbyname('´¬¹«Ë¾').asstring;
|
|
|
CORP:=frm_op_seae.t_op_seae.fieldbyname('ίÍе¥Î»').asstring;
|
|
|
EMP:=employee;
|
|
|
EMPDAE:=FormatDateTime('YYYY-MM-DD hh:mm:ss',now);
|
|
|
ETD:=FormatDateTime('YYYY-MM-DD',frm_op_seae.t_op_seae.fieldbyname('¿ª´¬ÈÕÆÚ').value);
|
|
|
Insertt_op_Edi_Log(SIO,ORG,MBL,CARR,MBLNO,ETD,CORP,EMP,EMPDAE,str,edi);
|
|
|
|
|
|
|
|
|
except
|
|
|
on e : exception do
|
|
|
begin
|
|
|
MessageDlg('ÎļþÉÏ´«´íÎó£¡'+e.message,mtError,[mbOk],0);
|
|
|
deletefile(str);
|
|
|
i_soi:=1;
|
|
|
// showmessage('ÎļþÉÏ´«´íÎó£¡');
|
|
|
end;
|
|
|
end;
|
|
|
idftp1.Free;
|
|
|
|
|
|
end;}
|
|
|
function Tfrm_op_seae_edi_swi.CreateSIEdiFile_MBL: string;
|
|
|
var
|
|
|
str,str2,codetype,codestr,strsql,typestr: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´úÂë from t_crm_client where ¿Í»§¼ò³Æ='''+cust+'''';
|
|
|
aQuery.Open;
|
|
|
if not aQuery.IsEmpty then
|
|
|
result:=aQuery.fieldbyname('EDI´úÂë').AsString;
|
|
|
if Result='' then result:=cust;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
end;
|
|
|
function getempemail(emp:string):string;
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
result:='';
|
|
|
try
|
|
|
aQuery.Close;
|
|
|
aQuery.SQL.Text:='select ÓÊÏä from t_sys_employee where ÐÕÃû='''+emp+'''';
|
|
|
aQuery.Open;
|
|
|
if not aQuery.IsEmpty then
|
|
|
result:=aQuery.fieldbyname('ÓÊÏä').AsString;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
end;
|
|
|
begin
|
|
|
str:=str+'{';
|
|
|
str:=str+'"COMPANY_NAME":"'+frm_data_share.t_sys_company.fieldbyname('È«³Æ').AsString+'"';
|
|
|
str:=str+',"BOOKINGS":[';
|
|
|
str:=str+'{';
|
|
|
|
|
|
aAdoQuery:=CreateAdoQuery;
|
|
|
TempStr:=TStringList.Create;
|
|
|
try
|
|
|
|
|
|
|
|
|
if not bsck.checked then
|
|
|
begin
|
|
|
str:=str+'"BSNO":"'+ frm_op_seae.t_op_seae.FieldByName('ÒµÎñ±àºÅ').asstring+'"';
|
|
|
str:=str+',"CUST_NO":"'+ frm_op_seae.t_op_seae.FieldByName('ÒµÎñ±àºÅ').asstring+'"';
|
|
|
str:=str+',"MBLNO":"'+ frm_op_seae.t_op_seae.FieldByName('Ö÷Ìáµ¥ºÅ').asstring+'"';
|
|
|
str:=str+',"HBLNO":"'+ frm_op_seae.t_op_seae.FieldByName('·ÖÌáµ¥ºÅ').asstring+'"';
|
|
|
str:=str+',"CONTRACTNO":"'+ frm_op_seae.t_op_seae.FieldByName('ÔË·ÑÐÒéºÅ').asstring+'"';
|
|
|
str:=str+',"SHIPPER":"'+ StringReplace(frm_op_seae.t_op_seae.FieldByName('·¢»õÈË´úÂë').asstring,'"','\"',[rfReplaceAll])+'"';
|
|
|
str:=str+',"CONSIGNEE":"'+ StringReplace(frm_op_seae.t_op_seae.FieldByName('ÊÕ»õÈË´úÂë').asstring,'"','\"',[rfReplaceAll])+'"';
|
|
|
str:=str+',"NOTIFYPARTY":"'+ StringReplace(frm_op_seae.t_op_seae.FieldByName('֪ͨÈË´úÂë').asstring,'"','\"',[rfReplaceAll])+'"';
|
|
|
str:=str+',"NOTIFYPARTY2":"'+ StringReplace(frm_op_seae.t_op_seae.FieldByName('µÚ¶þ֪ͨÈË').asstring,'"','\"',[rfReplaceAll])+'"';
|
|
|
str:=str+',"YARD":"'+getcustedi(frm_op_seae.t_op_seae.FieldByName('³¡Õ¾').asstring)+'"';
|
|
|
str:=str+',"VESSEL":"'+ frm_op_seae.t_op_seae.FieldByName('´¬Ãû').asstring+'"';
|
|
|
str:=str+',"VOYNO":"'+ frm_op_seae.t_op_seae.FieldByName('º½´Î').asstring+'"';
|
|
|
str:=str+',"VoynoInner":"'+ frm_op_seae.t_op_seae.FieldByName('ÄÚ²¿º½´ÎºÅ').asstring+'"';
|
|
|
str:=str+',"ETD":"'+ frm_op_seae.t_op_seae.FieldByName('¿ª´¬ÈÕÆÚ').asstring+'"';
|
|
|
str:=str+',"CLOSINGDATE":"'+ frm_op_seae.t_op_seae.FieldByName('½Ø¸ÛÈÕÆÚ').asstring+'"';
|
|
|
str:=str+',"CLOSEDOCDATE":"'+ frm_op_seae.t_op_seae.FieldByName('½Øµ¥ÈÕÆÚ').asstring+'"';
|
|
|
str:=str+',"ETA":"'+ frm_op_seae.t_op_seae.FieldByName('Ô¤µÖÈÕÆÚ').asstring+'"';
|
|
|
str:=str+',"PLACERECEIPTID":""';
|
|
|
str:=str+',"PLACERECEIPT":""';
|
|
|
str:=str+',"PORTLOADID":"CNTAO"';
|
|
|
str:=str+',"PORTLOAD":"QINGDAO,CHINA"';
|
|
|
str:=str+',"PORTDISCHARGEID":"'+ frm_op_seae.t_op_seae.FieldByName('ж»õ´úÂë').asstring+'"';
|
|
|
str:=str+',"PORTDISCHARGE":"'+ frm_op_seae.t_op_seae.FieldByName('ж»õ¸Û').asstring+'"';
|
|
|
str:=str+',"PLACEDELIVERYID":"'+ frm_op_seae.t_op_seae.FieldByName('½»»õ´úÂë').asstring+'"';
|
|
|
str:=str+',"PLACEDELIVERY":"'+ frm_op_seae.t_op_seae.FieldByName('½»»õµØµã').asstring+'"';
|
|
|
str:=str+',"DESTINATIONID":"'+ frm_op_seae.t_op_seae.FieldByName('Ä¿µÄµØ´úÂë').asstring+'"';
|
|
|
str:=str+',"DESTINATION":"'+ frm_op_seae.t_op_seae.FieldByName('Ä¿µÄµØ').asstring+'"';
|
|
|
str:=str+',"NOBILL":"'+ frm_op_seae.t_op_seae.FieldByName('Ìáµ¥·ÝÊý').asstring+'"';
|
|
|
str:=str+',"COPYNOBILLL":"'+ frm_op_seae.t_op_seae.FieldByName('¸±±¾Ìáµ¥·ÝÊý').asstring+'"';
|
|
|
str:=str+',"ISSUETYPE":"'+ frm_op_seae.t_op_seae.FieldByName('Ç©µ¥·½Ê½').asstring+'"';
|
|
|
str:=str+',"ISSUEDATE":"'+ frm_op_seae.t_op_seae.FieldByName('Ç©µ¥ÈÕÆÚ').asstring+'"';
|
|
|
str:=str+',"ISSUEPLACEID":"'+GetPortEdiID(trim(frm_op_seae.t_op_seae.fieldbyname('Ç©µ¥µØµã').asstring))+'"';
|
|
|
str:=str+',"ISSUEPLACE":"'+ frm_op_seae.t_op_seae.FieldByName('Ç©µ¥µØµã').asstring+'"';
|
|
|
str:=str+',"BLFRT":"'+ frm_op_seae.t_op_seae.FieldByName('¸¶·Ñ·½Ê½').asstring+'"';
|
|
|
str:=str+',"PREPARDAT":"'+ frm_op_seae.t_op_seae.FieldByName('Ô¤¸¶µØµã').asstring+'"';
|
|
|
str:=str+',"PAYABLEAT":"'+ frm_op_seae.t_op_seae.FieldByName('µ½¸¶µØµã').asstring+'"';
|
|
|
str:=str+',"SERVICE":"'+ frm_op_seae.t_op_seae.FieldByName('ÔËÊäÌõ¿î').asstring+'"';
|
|
|
str:=str+',"MARKS":"'+StringReplace(frm_op_seae.t_op_seae.FieldByName('ßéÍ·').asstring,'"','\"',[rfReplaceAll])+'"';
|
|
|
str:=str+',"HSCODE":"'+ frm_op_seae.t_op_seae.FieldByName('ÔËÊ䷽ʽ').asstring+'"';
|
|
|
str:=str+',"DESCRIPTION":"'+ StringReplace(frm_op_seae.t_op_seae.FieldByName('»õÎïÃèÊö').asstring,'"','\"',[rfReplaceAll])+'"';
|
|
|
str:=str+',"PKGS":'+ frm_op_seae.t_op_seae.FieldByName('¼þÊý').asstring;
|
|
|
str:=str+',"KINDPKGS":"'+ frm_op_seae.t_op_seae.FieldByName('°ü×°').asstring+'"';
|
|
|
str:=str+',"KGS":'+ frm_op_seae.t_op_seae.FieldByName('ÖØÁ¿').asstring;
|
|
|
str:=str+',"CBM":'+ frm_op_seae.t_op_seae.FieldByName('³ßÂë').asstring;
|
|
|
str:=str+',"CARRIER":"'+frm_op_seae.t_op_seae.FieldByName('´¬¹«Ë¾').asstring+'"';
|
|
|
str:=str+',"CARGOID":"'+ frm_op_seae.t_op_seae.FieldByName('»õÎï±êʶ').asstring+'"';
|
|
|
str:=str+',"DCLASS":"'+ frm_op_seae.t_op_seae.FieldByName('ΣÏÕÆ··ÖÀà').asstring+'"';
|
|
|
str:=str+',"DUNNO":"'+ frm_op_seae.t_op_seae.FieldByName('ΣÏÕÆ·±àºÅ').asstring+'"';
|
|
|
str:=str+',"DPAGE":""';
|
|
|
str:=str+',"DLABEL":""';
|
|
|
str:=str+',"LINKMAN":""';
|
|
|
if (frm_op_seae.t_op_seae.FieldByName('»õÎï±êʶ').asstring='R') then
|
|
|
str:=str+',"TEMPID":"C"'
|
|
|
else str:=str+',"TEMPID":""';
|
|
|
str:=str+',"TEMPSET":"'+ frm_op_seae.t_op_seae.FieldByName('ÉèÖÃζÈ').asstring+'"';
|
|
|
str:=str+',"REEFERF":"'+ frm_op_seae.t_op_seae.FieldByName('Àä²Øͨ·çÁ¿').asstring+'"';
|
|
|
str:=str+',"HUMIDITY":"'+ frm_op_seae.t_op_seae.FieldByName('ʪ¶È').asstring+'"';
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('ÊÇ·ñ×ÔÓÐÏä').asboolean then
|
|
|
str:=str+',"ISCONTAINERSOC":true'
|
|
|
else
|
|
|
str:=str+',"ISCONTAINERSOC":false';
|
|
|
strsql:='select * from t_op_ams where 񅧏='
|
|
|
+#39+frm_op_seae.t_op_seae.fieldbyname('񅧏').asstring+#39;
|
|
|
aAdoQuery.Close;
|
|
|
aAdoQuery.SQL.Text:=strsql;
|
|
|
aAdoQuery.Open;
|
|
|
|
|
|
str:=str+',"REMARK":"'+aAdoQuery.FieldByName('SI±¸×¢').asstring+'"';
|
|
|
str:=str+',"EDIREMARK":"'+ frm_op_seae.t_op_seae.FieldByName('EDI±¸×¢').asstring+'"';
|
|
|
str:=str+',"YardRemark":"'+ frm_op_seae.t_op_seae.FieldByName('±¸×¢').asstring+'"';
|
|
|
str:=str+',"PONO":"'+ frm_op_seae.t_op_seae.FieldByName('ίÍбàºÅ').asstring+'"';
|
|
|
str:=str+',"TOTALNO":"'+ frm_op_seae.t_op_seae.FieldByName('¼þÊý´óд').asstring+'"';
|
|
|
str:=str+',"TEMPMIN":"'+ frm_op_seae.t_op_seae.FieldByName('×îµÍζÈ').asstring+'"';
|
|
|
str:=str+',"TEMPMAX":"'+ frm_op_seae.t_op_seae.FieldByName('×î¸ßζÈ').asstring+'"';
|
|
|
str:=str+',"OP":"'+ frm_op_seae.t_op_seae.FieldByName('¿Í·þÔ±').asstring+'"';
|
|
|
str:=str+',"DOC":""';
|
|
|
str:=str+',"SALE":""';
|
|
|
str:=str+',"CUSTSERVICE":""';
|
|
|
str:=str+',"VGM_TIME":""';
|
|
|
str:=str+',"CUSTOMERNAME":"'+ frm_op_seae.t_op_seae.FieldByName('ίÍе¥Î»').asstring+'"';
|
|
|
str:=str+',"EMAIL":"'+getempemail(frm_op_seae.t_op_seae.FieldByName('²Ù×÷Ô±').asstring)+'"';
|
|
|
str:=str+',"FORWARDER":"'+ frm_op_seae.t_op_seae.FieldByName('»õ´ú¹«Ë¾').asstring+'"';
|
|
|
str:=str+',"SHIPAGENCY":""';
|
|
|
str:=str+',"CUSTOMSER":""';
|
|
|
str:=str+',"TRUCKER":""';
|
|
|
str:=str+',"AGENTID":""';
|
|
|
str:=str+',"CARRIERID":"'+ getcustedi(frm_op_seae.t_op_seae.FieldByName('´¬¹«Ë¾').asstring)+'"';
|
|
|
str:=str+',"YARDID":"'+ getcustedi(frm_op_seae.t_op_seae.FieldByName('³¡Õ¾').asstring)+'"';
|
|
|
str:=str+',"YardContract":"'+ frm_op_seae.t_op_seae.FieldByName('³¡Õ¾ÁªÏµÈË').asstring+'"';
|
|
|
str:=str+',"CUSTOMERID":""';
|
|
|
str:=str+',"FORWARDERID":""';
|
|
|
str:=str+',"SHIPAGENCYID":"'+frm_op_seae.t_op_seae.FieldByName('´¬´ú').asstring+'"';
|
|
|
str:=str+',"CUSTOMSERID":""';
|
|
|
str:=str+',"TRUCKERID":""';
|
|
|
str:=str+',"AGENTNAME":""';
|
|
|
str:=str+',"WEITUO":""';
|
|
|
str:=str+',"EDIATTN":""';
|
|
|
str:=str+',"EDIATTNTEL":""';
|
|
|
str:=str+',"EDIATTNEMAIL":""';
|
|
|
str:=str+',"CONSIGNEEDOORADDR":""';
|
|
|
str:=str+',"SHIPPERDOORADDR":""';
|
|
|
str:=str+',"SCACCODE":""';
|
|
|
str:=str+',"ITNCODE":""';
|
|
|
str:=str+',"PREPARDAT_ID":"'+GetPortEdiID(frm_op_seae.t_op_seae.fieldbyname('Ô¤¸¶µØµã').asstring)+'"';
|
|
|
str:=str+',"PAYABLEAT_ID":"'+trim(frm_op_seae.t_op_seae.fieldbyname('µ½¸¶µØµã´úÂë').asstring)+'"';
|
|
|
if (frm_op_seae.t_op_seae.FieldByName('³¡Õ¾').asstring='¸Û½Ý·á³¡Õ¾(FF)') or (frm_op_seae.t_op_seae.FieldByName('³¡Õ¾').asstring='½Ý·á³¡Õ¾') then begin
|
|
|
if (frm_op_seae.t_op_seae.FieldByName('·Àα').AsBoolean) then
|
|
|
str:=str+',"FEE_SELF":true'
|
|
|
else
|
|
|
str:=str+',"FEE_SELF":false';
|
|
|
end else begin
|
|
|
str:=str+',"FEE_SELF":true';
|
|
|
end;
|
|
|
strsql:='select * from t_op_ctn where 񅧏='
|
|
|
+#39+frm_op_seae.t_op_seae.fieldbyname('񅧏').asstring+#39;
|
|
|
aAdoQuery.Close;
|
|
|
aAdoQuery.SQL.Text:=strsql;
|
|
|
aAdoQuery.Open;
|
|
|
aAdoQuery.First;
|
|
|
str:=str+',"CtrnList":[';
|
|
|
isfirst:=true;
|
|
|
while not aAdoQuery.Eof do begin
|
|
|
if (isfirst) then str:=str+'{' else str:=str+',{';
|
|
|
str:=str+'"CTNALL":"'+StringReplace(aAdoQuery.FieldByName('±íÏÖÐÎʽ').asstring,'''','',[])+'"';
|
|
|
str:=str+',"CTNNUM":'+aAdoQuery.FieldByName('ÊýÁ¿').asstring;
|
|
|
str:=str+',"CNTRNO":"'+aAdoQuery.FieldByName('ÏäºÅ').asstring+'"';
|
|
|
str:=str+',"SEALNO":"'+aAdoQuery.FieldByName('·âºÅ').asstring+'"';
|
|
|
str:=str+',"PKGS":"'+aAdoQuery.FieldByName('¼þÊý').asstring+'"';
|
|
|
str:=str+',"KINDPKGS":"'+aAdoQuery.FieldByName('°ü×°').asstring+'"';
|
|
|
str:=str+',"KGS":"'+aAdoQuery.FieldByName('ÖØÁ¿').asstring+'"';
|
|
|
str:=str+',"CBM":"'+aAdoQuery.FieldByName('³ßÂë').asstring+'"';
|
|
|
str:=str+',"TAREWEIGHT":'+aAdoQuery.FieldByName('ÏäƤÖØ').asstring;
|
|
|
str:=str+',"WEIGHTYPE":"ÀÛ¼Ó"';
|
|
|
str:=str+',"WEIGHKGS":'+aAdoQuery.FieldByName('³ÆÖØÖØÁ¿').asstring;
|
|
|
str:=str+',"REMARK":""';
|
|
|
str:=str+'}';
|
|
|
isfirst:=false;
|
|
|
aAdoQuery.Next;
|
|
|
end;
|
|
|
str:=str+']';
|
|
|
end else begin
|
|
|
|
|
|
str:=str+'"BSNO":"'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'"';
|
|
|
str:=str+',"CUST_NO":"'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'"';
|
|
|
str:=str+',"MBLNO":"'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'"';
|
|
|
str:=str+',"HBLNO":"'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('·ÖÌáµ¥ºÅ').asstring+'"';
|
|
|
str:=str+',"CONTRACTNO":"'+ frm_op_seae.t_op_seae.FieldByName('ÔË·ÑÐÒéºÅ').asstring+'"';
|
|
|
str:=str+',"SHIPPER":"'+ StringReplace(frm_op_seae_assistant.t_op_seae_assistant.FieldByName('·¢»õÈË´úÂë').asstring,'"','\"',[rfReplaceAll])+'"';
|
|
|
str:=str+',"CONSIGNEE":"'+ StringReplace(frm_op_seae_assistant.t_op_seae_assistant.FieldByName('ÊÕ»õÈË´úÂë').asstring,'"','\"',[rfReplaceAll])+'"';
|
|
|
str:=str+',"NOTIFYPARTY":"'+ StringReplace(frm_op_seae_assistant.t_op_seae_assistant.FieldByName('֪ͨÈË´úÂë').asstring,'"','\"',[rfReplaceAll])+'"';
|
|
|
str:=str+',"NOTIFYPARTY2":"'+ StringReplace(frm_op_seae_assistant.t_op_seae_assistant.FieldByName('µÚ¶þ֪ͨÈË').asstring,'"','\"',[rfReplaceAll])+'"';
|
|
|
str:=str+',"YARD":"'+getcustedi(frm_op_seae.t_op_seae.FieldByName('³¡Õ¾').asstring)+'"';
|
|
|
str:=str+',"VESSEL":"'+ frm_op_seae.t_op_seae.FieldByName('´¬Ãû').asstring+'"';
|
|
|
str:=str+',"VOYNO":"'+ frm_op_seae.t_op_seae.FieldByName('º½´Î').asstring+'"';
|
|
|
str:=str+',"VoynoInner":"'+ frm_op_seae.t_op_seae.FieldByName('ÄÚ²¿º½´ÎºÅ').asstring+'"';
|
|
|
str:=str+',"ETD":"'+ frm_op_seae.t_op_seae.FieldByName('¿ª´¬ÈÕÆÚ').asstring+'"';
|
|
|
str:=str+',"CLOSINGDATE":"'+ frm_op_seae.t_op_seae.FieldByName('½Ø¸ÛÈÕÆÚ').asstring+'"';
|
|
|
str:=str+',"CLOSEDOCDATE":"'+ frm_op_seae.t_op_seae.FieldByName('½Øµ¥ÈÕÆÚ').asstring+'"';
|
|
|
str:=str+',"ETA":"'+ frm_op_seae.t_op_seae.FieldByName('Ô¤µÖÈÕÆÚ').asstring+'"';
|
|
|
str:=str+',"PLACERECEIPTID":""';
|
|
|
str:=str+',"PLACERECEIPT":""';
|
|
|
str:=str+',"PORTLOADID":"CNTAO"';
|
|
|
str:=str+',"PORTLOAD":"QINGDAO,CHINA"';
|
|
|
str:=str+',"PORTDISCHARGEID":"'+ frm_op_seae.t_op_seae.FieldByName('ж»õ´úÂë').asstring+'"';
|
|
|
str:=str+',"PORTDISCHARGE":"'+ frm_op_seae.t_op_seae.FieldByName('ж»õ¸Û').asstring+'"';
|
|
|
str:=str+',"PLACEDELIVERYID":"'+ frm_op_seae.t_op_seae.FieldByName('½»»õ´úÂë').asstring+'"';
|
|
|
str:=str+',"PLACEDELIVERY":"'+ frm_op_seae.t_op_seae.FieldByName('½»»õµØµã').asstring+'"';
|
|
|
str:=str+',"DESTINATIONID":"'+ frm_op_seae.t_op_seae.FieldByName('Ä¿µÄµØ´úÂë').asstring+'"';
|
|
|
str:=str+',"DESTINATION":"'+ frm_op_seae.t_op_seae.FieldByName('Ä¿µÄµØ').asstring+'"';
|
|
|
str:=str+',"NOBILL":"'+ frm_op_seae.t_op_seae.FieldByName('Ìáµ¥·ÝÊý').asstring+'"';
|
|
|
str:=str+',"COPYNOBILLL":"'+ frm_op_seae.t_op_seae.FieldByName('¸±±¾Ìáµ¥·ÝÊý').asstring+'"';
|
|
|
str:=str+',"ISSUETYPE":"'+ frm_op_seae.t_op_seae.FieldByName('Ç©µ¥·½Ê½').asstring+'"';
|
|
|
str:=str+',"ISSUEDATE":"'+ frm_op_seae.t_op_seae.FieldByName('Ç©µ¥ÈÕÆÚ').asstring+'"';
|
|
|
if (frm_op_seae.t_op_seae.fieldbyname('Ç©µ¥µØµã').asstring<>'') then begin
|
|
|
str:=str+',"ISSUEPLACEID":"'+GetPortEdiID(trim(frm_op_seae.t_op_seae.fieldbyname('Ç©µ¥µØµã').asstring))+'"';
|
|
|
str:=str+',"ISSUEPLACE":"'+ frm_op_seae.t_op_seae.FieldByName('Ç©µ¥µØµã').asstring+'"';
|
|
|
end else begin
|
|
|
str:=str+',"ISSUEPLACEID":"CNTAO"';
|
|
|
str:=str+',"ISSUEPLACE":"QINGDAO,CHINA"';
|
|
|
end;
|
|
|
str:=str+',"BLFRT":"'+ frm_op_seae.t_op_seae.FieldByName('¸¶·Ñ·½Ê½').asstring+'"';
|
|
|
str:=str+',"PREPARDAT":"'+ frm_op_seae.t_op_seae.FieldByName('Ô¤¸¶µØµã').asstring+'"';
|
|
|
str:=str+',"PAYABLEAT":"'+ frm_op_seae.t_op_seae.FieldByName('µ½¸¶µØµã').asstring+'"';
|
|
|
str:=str+',"SERVICE":"'+ frm_op_seae.t_op_seae.FieldByName('ÔËÊäÌõ¿î').asstring+'"';
|
|
|
str:=str+',"MARKS":"'+StringReplace(frm_op_seae_assistant.t_op_seae_assistant.FieldByName('ßéÍ·').asstring,'"','\"',[rfReplaceAll])+'"';
|
|
|
str:=str+',"HSCODE":"'+ frm_op_seae_assistant.t_op_seae_assistant.FieldByName('HS±àÂë').asstring+'"';
|
|
|
str:=str+',"DESCRIPTION":"'+ StringReplace(frm_op_seae_assistant.t_op_seae_assistant.FieldByName('»õÎïÃèÊö').asstring,'"','\"',[rfReplaceAll])+'"';
|
|
|
str:=str+',"PKGS":'+ frm_op_seae_assistant.t_op_seae_assistant.FieldByName('¼þÊý').asstring;
|
|
|
str:=str+',"KINDPKGS":"'+frm_op_seae_assistant.t_op_seae_assistant.FieldByName('°ü×°').asstring+'"';
|
|
|
str:=str+',"KGS":'+ frm_op_seae_assistant.t_op_seae_assistant.FieldByName('ÖØÁ¿').asstring;
|
|
|
str:=str+',"CBM":'+ frm_op_seae_assistant.t_op_seae_assistant.FieldByName('³ßÂë').asstring;
|
|
|
str:=str+',"CARRIER":"'+frm_op_seae.t_op_seae.FieldByName('´¬¹«Ë¾').asstring+'"';
|
|
|
str:=str+',"CARGOID":"'+ frm_op_seae.t_op_seae.FieldByName('»õÎï±êʶ').asstring+'"';
|
|
|
str:=str+',"DCLASS":"'+ frm_op_seae.t_op_seae.FieldByName('ΣÏÕÆ··ÖÀà').asstring+'"';
|
|
|
str:=str+',"DUNNO":"'+ frm_op_seae.t_op_seae.FieldByName('ΣÏÕÆ·±àºÅ').asstring+'"';
|
|
|
str:=str+',"DPAGE":""';
|
|
|
str:=str+',"DLABEL":""';
|
|
|
str:=str+',"LINKMAN":""';
|
|
|
if (frm_op_seae.t_op_seae.FieldByName('»õÎï±êʶ').asstring='R') then
|
|
|
str:=str+',"TEMPID":"C"'
|
|
|
else str:=str+',"TEMPID":""';
|
|
|
str:=str+',"TEMPSET":"'+ frm_op_seae.t_op_seae.FieldByName('ÉèÖÃζÈ').asstring+'"';
|
|
|
str:=str+',"REEFERF":"'+ frm_op_seae.t_op_seae.FieldByName('Àä²Øͨ·çÁ¿').asstring+'"';
|
|
|
str:=str+',"HUMIDITY":"'+ frm_op_seae.t_op_seae.FieldByName('ʪ¶È').asstring+'"';
|
|
|
if frm_op_seae.t_op_seae.fieldbyname('ÊÇ·ñ×ÔÓÐÏä').asboolean then
|
|
|
str:=str+',"ISCONTAINERSOC":true'
|
|
|
else
|
|
|
str:=str+',"ISCONTAINERSOC":false';
|
|
|
str:=str+',"REMARK":""';
|
|
|
str:=str+',"EDIREMARK":"'+frm_op_seae_assistant.t_op_seae_assistant.FieldByName('EDI±¸×¢').asstring+'"';
|
|
|
str:=str+',"PONO":"'+ frm_op_seae.t_op_seae.FieldByName('ίÍбàºÅ').asstring+'"';
|
|
|
str:=str+',"TOTALNO":"'+ frm_op_seae.t_op_seae.FieldByName('¼þÊý´óд').asstring+'"';
|
|
|
str:=str+',"TEMPMIN":"'+ frm_op_seae.t_op_seae.FieldByName('×îµÍζÈ').asstring+'"';
|
|
|
str:=str+',"TEMPMAX":"'+ frm_op_seae.t_op_seae.FieldByName('×î¸ßζÈ').asstring+'"';
|
|
|
str:=str+',"OP":"'+ frm_op_seae.t_op_seae.FieldByName('¿Í·þÔ±').asstring+'"';
|
|
|
str:=str+',"DOC":""';
|
|
|
str:=str+',"SALE":""';
|
|
|
str:=str+',"CUSTSERVICE":""';
|
|
|
str:=str+',"VGM_TIME":""';
|
|
|
str:=str+',"CUSTOMERNAME":"'+ frm_op_seae.t_op_seae.FieldByName('ίÍе¥Î»').asstring+'"';
|
|
|
str:=str+',"EMAIL":"'+getempemail(frm_op_seae.t_op_seae.FieldByName('²Ù×÷Ô±').asstring)+'"';
|
|
|
str:=str+',"FORWARDER":"'+ frm_op_seae.t_op_seae.FieldByName('»õ´ú¹«Ë¾').asstring+'"';
|
|
|
str:=str+',"SHIPAGENCY":""';
|
|
|
str:=str+',"CUSTOMSER":""';
|
|
|
str:=str+',"TRUCKER":""';
|
|
|
str:=str+',"AGENTID":""';
|
|
|
str:=str+',"CARRIERID":"'+ getcustedi(frm_op_seae.t_op_seae.FieldByName('´¬¹«Ë¾').asstring)+'"';
|
|
|
str:=str+',"YARDID":"'+ getcustedi(frm_op_seae.t_op_seae.FieldByName('³¡Õ¾').asstring)+'"';
|
|
|
str:=str+',"CUSTOMERID":""';
|
|
|
str:=str+',"FORWARDERID":""';
|
|
|
str:=str+',"SHIPAGENCYID":"'+frm_op_seae.t_op_seae.FieldByName('´¬´ú').asstring+'"';
|
|
|
str:=str+',"CUSTOMSERID":""';
|
|
|
str:=str+',"TRUCKERID":""';
|
|
|
str:=str+',"AGENTNAME":""';
|
|
|
str:=str+',"WEITUO":""';
|
|
|
str:=str+',"EDIATTN":""';
|
|
|
str:=str+',"EDIATTNTEL":""';
|
|
|
str:=str+',"EDIATTNEMAIL":""';
|
|
|
str:=str+',"CONSIGNEEDOORADDR":""';
|
|
|
str:=str+',"SHIPPERDOORADDR":""';
|
|
|
str:=str+',"SCACCODE":""';
|
|
|
str:=str+',"ITNCODE":""';
|
|
|
str:=str+',"PREPARDAT_ID":"'+GetPortEdiID(frm_op_seae.t_op_seae.fieldbyname('Ô¤¸¶µØµã').asstring)+'"';
|
|
|
str:=str+',"PAYABLEAT_ID":"'+trim(frm_op_seae.t_op_seae.fieldbyname('µ½¸¶µØµã´úÂë').asstring)+'"';
|
|
|
if (frm_op_seae.t_op_seae.FieldByName('³¡Õ¾').asstring='¸Û½Ý·á³¡Õ¾(FF)') or (frm_op_seae.t_op_seae.FieldByName('³¡Õ¾').asstring='½Ý·á³¡Õ¾') then begin
|
|
|
if (frm_op_seae.t_op_seae.FieldByName('·Àα').AsBoolean) then
|
|
|
str:=str+',"FEE_SELF":true'
|
|
|
else
|
|
|
str:=str+',"FEE_SELF":false';
|
|
|
end else begin
|
|
|
str:=str+',"FEE_SELF":true';
|
|
|
end;
|
|
|
strsql:='select * from t_op_ctn_fendan where 񅧏='
|
|
|
+#39+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('as_id').asstring+#39;
|
|
|
aAdoQuery.Close;
|
|
|
aAdoQuery.SQL.Text:=strsql;
|
|
|
aAdoQuery.Open;
|
|
|
aAdoQuery.First;
|
|
|
str:=str+',"CtrnList":[';
|
|
|
isfirst:=true;
|
|
|
while not aAdoQuery.Eof do begin
|
|
|
if (isfirst) then str:=str+'{' else str:=str+',{';
|
|
|
str:=str+'"CTNALL":"'+StringReplace(aAdoQuery.FieldByName('±íÏÖÐÎʽ').asstring,'''','',[])+'"';
|
|
|
str:=str+',"CTNNUM":'+aAdoQuery.FieldByName('ÊýÁ¿').asstring;
|
|
|
str:=str+',"CNTRNO":"'+aAdoQuery.FieldByName('ÏäºÅ').asstring+'"';
|
|
|
str:=str+',"SEALNO":"'+aAdoQuery.FieldByName('·âºÅ').asstring+'"';
|
|
|
str:=str+',"PKGS":"'+aAdoQuery.FieldByName('¼þÊý').asstring+'"';
|
|
|
str:=str+',"KINDPKGS":"'+aAdoQuery.FieldByName('°ü×°').asstring+'"';
|
|
|
str:=str+',"KGS":"'+aAdoQuery.FieldByName('ÖØÁ¿').asstring+'"';
|
|
|
str:=str+',"CBM":"'+aAdoQuery.FieldByName('³ßÂë').asstring+'"';
|
|
|
str:=str+',"TAREWEIGHT":0';
|
|
|
str:=str+',"WEIGHTYPE":"ÀÛ¼Ó"';
|
|
|
str:=str+',"WEIGHKGS":0';
|
|
|
str:=str+',"REMARK":""';
|
|
|
str:=str+'}';
|
|
|
isfirst:=false;
|
|
|
aAdoQuery.Next;
|
|
|
end;
|
|
|
str:=str+']';
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
if (frm_data_share.t_crm_client_all.Locate('¿Í»§¼ò³Æ',frm_op_seae.t_op_seae.FieldByName('ίÍе¥Î»').asstring,[])) then begin
|
|
|
str:=str+',"CUSTOMER_INFO":{';
|
|
|
str:=str+'"CODENAME":"'+frm_data_share.t_crm_client_all.fieldbyname('´úÂë').AsString+'"';
|
|
|
str:=str+',"SHORTNAME":"'+frm_data_share.t_crm_client_all.fieldbyname('¿Í»§¼ò³Æ').AsString+'"';
|
|
|
str:=str+',"DESCRIPTION":"'+frm_data_share.t_crm_client_all.fieldbyname('¿Í»§È«³Æ').AsString+'"';
|
|
|
str:=str+',"CONTRACT_LIST":[';
|
|
|
if (frm_op_seae.t_op_seae.FieldByName('¿Í»§Óʼþ·½°¸').AsString<>'') then begin
|
|
|
aAdoQuery.Close;
|
|
|
aAdoQuery.SQL.Clear;
|
|
|
aAdoQuery.SQL.Add('select * from t_code_cust_mailproject_detail where ·½°¸´úÂë='''+frm_op_seae.t_op_seae.FieldByName('¿Í»§Óʼþ·½°¸').AsString+''' and (µ¥¾ÝÀàÐÍ=''Èë»õ֪ͨ'' or µ¥¾ÝÀàÐÍ=''Ìáµ¥¼°Ï»õÖ½'' or µ¥¾ÝÀàÐÍ=''·ÑÓÃÈ·ÈÏ'' )');
|
|
|
aAdoQuery.Open;
|
|
|
aAdoQuery.First;
|
|
|
isfirst:=true;
|
|
|
typestr:='BC';
|
|
|
while not aAdoQuery.Eof do begin
|
|
|
if (isfirst) then str:=str+'{' else str:=str+',{';
|
|
|
str:=str+'"EMAIL":"'+aAdoQuery.FieldByName('ÊÕ¼þÈË').asstring+'"';
|
|
|
if (aAdoQuery.FieldByName('µ¥¾ÝÀàÐÍ').asstring='Èë»õ֪ͨ') then typestr:='BC';
|
|
|
if (aAdoQuery.FieldByName('µ¥¾ÝÀàÐÍ').asstring='Ìáµ¥¼°Ï»õÖ½') then typestr:='TD';
|
|
|
if (aAdoQuery.FieldByName('µ¥¾ÝÀàÐÍ').asstring='·ÑÓÃÈ·ÈÏ') then typestr:='ZD';
|
|
|
str:=str+',"TYPE":"'+typestr+'"';
|
|
|
str:=str+'}';
|
|
|
isfirst:=false;
|
|
|
aAdoQuery.Next;
|
|
|
end;
|
|
|
end;
|
|
|
str:=str+']';
|
|
|
str:=str+'}';
|
|
|
end;
|
|
|
|
|
|
str:=str+'}';
|
|
|
str:=str+']';
|
|
|
str:=str+'}';
|
|
|
finally
|
|
|
FreeAndNil(aAdoQuery);
|
|
|
FreeAndNil(TempStr);
|
|
|
end;
|
|
|
|
|
|
Result:=str;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_swi.bsSkinButton6Click(Sender: TObject);
|
|
|
var
|
|
|
IdFTP1:TIdFTP;
|
|
|
str,dsstr:widestring;
|
|
|
str_file:widestring;
|
|
|
ftpar,ftpname,ftppass,ftppath,ScriptPath:String;
|
|
|
StrL:Tstringlist;
|
|
|
i,Count,get_Count,bill_count,i_soi,z:integer;
|
|
|
|
|
|
SIO,ORG,MBL,CARR,MBLNO,ETD,CORP,EMP,EMPDAE,strmsg:string;
|
|
|
edi,PostUrl:WideString;
|
|
|
|
|
|
IdHttp : TIdHTTP;
|
|
|
errmsg : string;//ÇëÇóµØÖ·
|
|
|
ResponseStream : TStringStream; //·µ»ØÐÅÏ¢
|
|
|
ResponseStr: string;
|
|
|
RequestStr : string; //ÇëÇóÐÅÏ¢
|
|
|
RequestStream : TStringStream;
|
|
|
jo: ISuperObject;
|
|
|
k:Integer;
|
|
|
sl:TStrings;
|
|
|
MultiPartFormDataStream :TIdMultiPartFormDataStream;
|
|
|
IdHTTP1:TIdHTTP;
|
|
|
begin
|
|
|
|
|
|
i_soi:=0;
|
|
|
if bsck.Checked then
|
|
|
begin
|
|
|
if frm_op_seae_assistant=nil then
|
|
|
begin
|
|
|
ShowMessage('ÇëÔÚ(ίÍкÍÌáµ¥)½çÃæ·¢ËÍ·Öµ¥Edi');
|
|
|
exit;
|
|
|
end
|
|
|
end;
|
|
|
|
|
|
ScriptPath:=ExtractFilePath(ParamStr(0))+'EDIFILE\';
|
|
|
if not DirectoryExists(ScriptPath) then
|
|
|
CreateDir(ScriptPath);
|
|
|
|
|
|
ftpar:=Trim(Edit8.Text);
|
|
|
if ftpar='' then begin
|
|
|
MessageDlg('ÇëÉèÖÃFTPµØÖ·£¡',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
ftpname:=Trim(Edit9.Text);;
|
|
|
if ftpar='' then begin
|
|
|
MessageDlg('ÇëÉèÖÃFTPÓû§Ãû£¡',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
ftppass:=Trim(Edit10.Text);;
|
|
|
if ftpar='' then begin
|
|
|
MessageDlg('ÇëÉèÖÃFTPÃÜÂ룡',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
ftppath:=Trim(Edit11.Text);;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StrL:=Tstringlist.Create;
|
|
|
|
|
|
|
|
|
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]));
|
|
|
StrL.Clear;
|
|
|
count:=0;
|
|
|
bill_count:=0;
|
|
|
str:=ScriptPath
|
|
|
+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring
|
|
|
+FormatDateTime('yyyy',now)
|
|
|
+FormatDateTime('mm',now)
|
|
|
+FormatDateTime('dd',now)
|
|
|
+FormatDateTime('hh',now)
|
|
|
+FormatDateTime('nn',now)+FormatDateTime('ss',now)+FormatDateTime('zzz',now)+'.txt';
|
|
|
|
|
|
str_file:=frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring
|
|
|
+FormatDateTime('yyyy',now)
|
|
|
+FormatDateTime('mm',now)
|
|
|
+FormatDateTime('dd',now)
|
|
|
+FormatDateTime('hh',now)
|
|
|
+FormatDateTime('nn',now)+FormatDateTime('ss',now)+FormatDateTime('zzz',now)+'.txt';
|
|
|
|
|
|
|
|
|
if not isEditrue then
|
|
|
exit;
|
|
|
if RadioGroup1.ItemIndex=1 then
|
|
|
get_Count:=frm_op_seae_edi_swi.get_txtSI(StrL)
|
|
|
else
|
|
|
get_Count:=frm_op_seae_edi_swi.get_txtBooking(StrL);
|
|
|
if get_Count=-1 then
|
|
|
exit
|
|
|
else
|
|
|
count:=count+get_Count;
|
|
|
|
|
|
StrL.Add('UNT+'+INTTOSTR(StrL.count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
StrL.Add('UNZ+1+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
for z:=0 to StrL.Count-1 do begin
|
|
|
if IsZhongwen(StrL[z]) then begin
|
|
|
MessageDlg('´ËƱҵÎñÓÐÖÐÎÄ×Ö·û»òTAB¼ü»ò<>×Ö·û,²»ÄÜÉÏ´«£¡'+#13#10+Str[z],mtWarning,[mbYes],0);
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
StrL.SaveToFile(str);
|
|
|
edi:=StrL.Text;
|
|
|
|
|
|
IF (CheckBox2.Checked) THEN begin
|
|
|
ResponseStream := TStringStream.Create('');
|
|
|
MultiPartFormDataStream := TIdMultiPartFormDataStream.Create;
|
|
|
IdHTTP1:=TIdHTTP.Create(Application);
|
|
|
try
|
|
|
IdHttp1.Request.Accept := '*/*';
|
|
|
IdHttp1.Request.AcceptLanguage:='zh-CN';
|
|
|
IdHttp1.Request.ContentType := MultiPartFormDataStream.RequestContentType;
|
|
|
MultiPartFormDataStream.AddFile('filename',str,GetMIMETypeFromFile(str));
|
|
|
MultiPartFormDataStream.Position := 0;
|
|
|
|
|
|
try
|
|
|
|
|
|
IdHTTP1.Post(StringReplace(get_parameters_value(2125,''),'SftpFilesJF','SftpFilesSWIJF',[rfReplaceAll]), MultiPartFormDataStream,ResponseStream);
|
|
|
except
|
|
|
on e : Exception do
|
|
|
begin
|
|
|
end;
|
|
|
end;
|
|
|
ResponseStr := ResponseStream.DataString; //»ñÈ¡ÍøÒ³·µ»ØµÄÐÅÏ¢
|
|
|
ResponseStr := UTF8Decode(ResponseStr); //ÍøÒ³ÖеĴæÔÚÖÐÎÄʱ£¬ÐèÒª½øÐÐUTF8½âÂë
|
|
|
jo:=so(ResponseStr);
|
|
|
strmsg:=jo.O['Message'].AsString;
|
|
|
if (jo.O['Success'].AsString='true') then begin
|
|
|
// Application.MessageBox(pchar('ÉÏ´«³É¹¦,'+strmsg),'Ìáʾ:',mrOk);
|
|
|
InsertSysLog('ÉÏ´«±¨Îijɹ¦',frm_op_seae.t_op_seae.FieldByName('ÒµÎñ±àºÅ').asstring+'---'+str);
|
|
|
if RadioGroup1.ItemIndex=0 then
|
|
|
SIO:='SO'
|
|
|
else SIO:='SI';
|
|
|
if RadioGroup3.ItemIndex=0 then
|
|
|
ORG:='ORG'
|
|
|
else ORG:='AMEND';
|
|
|
|
|
|
|
|
|
CARR:=frm_op_seae.t_op_seae.fieldbyname('´¬¹«Ë¾').asstring;
|
|
|
CORP:=frm_op_seae.t_op_seae.fieldbyname('ίÍе¥Î»').asstring;
|
|
|
EMP:=employee;
|
|
|
EMPDAE:=FormatDateTime('YYYY-MM-DD hh:mm:ss',now);
|
|
|
ETD:=FormatDateTime('YYYY-MM-DD',frm_op_seae.t_op_seae.fieldbyname('¿ª´¬ÈÕÆÚ').value);
|
|
|
|
|
|
end else begin
|
|
|
deletefile(str);
|
|
|
InsertSysLog('ÉÏ´«±¨Îijö´í',frm_op_seae.t_op_seae.FieldByName('ÒµÎñ±àºÅ').asstring+'---'+str);
|
|
|
showmessage('ÎļþÉÏ´«³öÏÖ´íÎó£¡'+strmsg);
|
|
|
i_soi:=1;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
finally
|
|
|
MultiPartFormDataStream.Free;
|
|
|
FreeAndNil(IdHTTP1);
|
|
|
FreeAndNil(ResponseStream);
|
|
|
end;
|
|
|
|
|
|
end else begin
|
|
|
|
|
|
try
|
|
|
|
|
|
IdFTP1:=TIdFTP.Create(application);
|
|
|
with idftp1 do
|
|
|
begin
|
|
|
Username:=ftpname;
|
|
|
Password:=ftppass;
|
|
|
Host:=ftpar;
|
|
|
Connect;
|
|
|
end;
|
|
|
idftp1.ChangeDir(ftppath);
|
|
|
idftp1.TransferType:=ftBinary;
|
|
|
idftp1.Put(str,str_file);
|
|
|
idftp1.Disconnect;
|
|
|
idftp1.Free;
|
|
|
|
|
|
|
|
|
if RadioGroup1.ItemIndex=0 then
|
|
|
SIO:='SO'
|
|
|
else SIO:='SI';
|
|
|
if RadioGroup3.ItemIndex=0 then
|
|
|
ORG:='ORG'
|
|
|
else ORG:='AMEND';
|
|
|
|
|
|
IF bsck.Checked then
|
|
|
begin
|
|
|
MBL:='·Öµ¥';
|
|
|
MBLNO:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring;
|
|
|
if (MBLNO='') THEN MBLNO:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('ÒµÎñ±àºÅ').asstring;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
MBL:='Ö÷µ¥';
|
|
|
MBLNO:=frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring;
|
|
|
if (MBLNO='') THEN MBLNO:=frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring;
|
|
|
|
|
|
end;
|
|
|
CARR:=frm_op_seae.t_op_seae.fieldbyname('´¬¹«Ë¾').asstring;
|
|
|
CORP:=frm_op_seae.t_op_seae.fieldbyname('ίÍе¥Î»').asstring;
|
|
|
EMP:=employee;
|
|
|
EMPDAE:=FormatDateTime('YYYY-MM-DD hh:mm:ss',now);
|
|
|
ETD:=FormatDateTime('YYYY-MM-DD',frm_op_seae.t_op_seae.fieldbyname('¿ª´¬ÈÕÆÚ').value);
|
|
|
Insertt_op_Edi_Log(SIO,ORG,MBL,CARR,MBLNO,ETD,CORP,EMP,EMPDAE,str,edi);
|
|
|
|
|
|
|
|
|
except
|
|
|
on e : exception do
|
|
|
begin
|
|
|
MessageDlg('ÎļþÉÏ´«´íÎó£¡'+e.message,mtError,[mbOk],0);
|
|
|
deletefile(str);
|
|
|
i_soi:=1;
|
|
|
// showmessage('ÎļþÉÏ´«´íÎó£¡');
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if i_soi=0 then UpdateSOIStatus(RadioGroup1.ItemIndex,frm_op_seae.t_op_seae.fieldbyname('񅧏').asstring);
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
|
|
|
StrL.Clear;
|
|
|
count:=0;
|
|
|
bill_count:=0;
|
|
|
str:=ScriptPath
|
|
|
+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring
|
|
|
+FormatDateTime('yyyy',now)
|
|
|
+FormatDateTime('mm',now)
|
|
|
+FormatDateTime('dd',now)
|
|
|
+FormatDateTime('hh',now)
|
|
|
+FormatDateTime('nn',now)+FormatDateTime('ss',now)+FormatDateTime('zzz',now)+'.txt';
|
|
|
|
|
|
str_file:=frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring
|
|
|
+FormatDateTime('yyyy',now)
|
|
|
+FormatDateTime('mm',now)
|
|
|
+FormatDateTime('dd',now)
|
|
|
+FormatDateTime('hh',now)
|
|
|
+FormatDateTime('nn',now)+FormatDateTime('ss',now)+FormatDateTime('zzz',now)+'.txt';
|
|
|
|
|
|
|
|
|
if not isEditrue then
|
|
|
exit;
|
|
|
if RadioGroup1.ItemIndex=1 then
|
|
|
get_Count:=frm_op_seae_edi_swi.get_txtSI(StrL)
|
|
|
else
|
|
|
get_Count:=frm_op_seae_edi_swi.get_txtBooking(StrL);
|
|
|
if get_Count=-1 then
|
|
|
exit
|
|
|
else
|
|
|
count:=count+get_Count;
|
|
|
|
|
|
StrL.Add('UNT+'+INTTOSTR(StrL.count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
StrL.Add('UNZ+1+'+frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring+#39);
|
|
|
for i:=0 to StrL.Count-1 do begin
|
|
|
if IsZhongwen(StrL[i]) then begin
|
|
|
MessageDlg('´ËƱҵÎñÓÐÖÐÎÄ×Ö·û»òTAB¼ü»ò<>×Ö·û,²»ÄÜÉÏ´«£¡'+#13#10+Str[i],mtWarning,[mbYes],0);
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
StrL.SaveToFile(str);
|
|
|
edi:=StrL.Text;
|
|
|
|
|
|
IF (CheckBox2.Checked) THEN begin
|
|
|
ResponseStream := TStringStream.Create('');
|
|
|
MultiPartFormDataStream := TIdMultiPartFormDataStream.Create;
|
|
|
IdHTTP1:=TIdHTTP.Create(Application);
|
|
|
try
|
|
|
IdHttp1.Request.Accept := '*/*';
|
|
|
IdHttp1.Request.AcceptLanguage:='zh-CN';
|
|
|
IdHttp1.Request.ContentType := MultiPartFormDataStream.RequestContentType;
|
|
|
MultiPartFormDataStream.AddFile('filename',str,GetMIMETypeFromFile(str));
|
|
|
MultiPartFormDataStream.Position := 0;
|
|
|
|
|
|
try
|
|
|
|
|
|
if (RadioGroup1.ItemIndex=1) then
|
|
|
IdHTTP1.Post(StringReplace(get_parameters_value(2125,''),'SftpFilesJF','SftpSiFilesSWIJF',[rfReplaceAll]), MultiPartFormDataStream,ResponseStream)
|
|
|
else
|
|
|
IdHTTP1.Post(StringReplace(get_parameters_value(2125,''),'SftpFilesJF','SftpFilesSWIJF',[rfReplaceAll]), MultiPartFormDataStream,ResponseStream);
|
|
|
|
|
|
except
|
|
|
on e : Exception do
|
|
|
begin
|
|
|
end;
|
|
|
end;
|
|
|
ResponseStr := ResponseStream.DataString; //»ñÈ¡ÍøÒ³·µ»ØµÄÐÅÏ¢
|
|
|
ResponseStr := UTF8Decode(ResponseStr); //ÍøÒ³ÖеĴæÔÚÖÐÎÄʱ£¬ÐèÒª½øÐÐUTF8½âÂë
|
|
|
jo:=so(ResponseStr);
|
|
|
strmsg:=jo.O['Message'].AsString;
|
|
|
if (jo.O['Success'].AsString='true') then begin
|
|
|
// Application.MessageBox(pchar('ÉÏ´«³É¹¦,'+strmsg),'Ìáʾ:',mrOk);
|
|
|
InsertSysLog('ÉÏ´«±¨Îijɹ¦',frm_op_seae.t_op_seae.FieldByName('ÒµÎñ±àºÅ').asstring+'---'+str);
|
|
|
if RadioGroup1.ItemIndex=0 then
|
|
|
SIO:='SO'
|
|
|
else SIO:='SI';
|
|
|
if RadioGroup3.ItemIndex=0 then
|
|
|
ORG:='ORG'
|
|
|
else ORG:='AMEND';
|
|
|
|
|
|
|
|
|
CARR:=frm_op_seae.t_op_seae.fieldbyname('´¬¹«Ë¾').asstring;
|
|
|
CORP:=frm_op_seae.t_op_seae.fieldbyname('ίÍе¥Î»').asstring;
|
|
|
EMP:=employee;
|
|
|
EMPDAE:=FormatDateTime('YYYY-MM-DD hh:mm:ss',now);
|
|
|
ETD:=FormatDateTime('YYYY-MM-DD',frm_op_seae.t_op_seae.fieldbyname('¿ª´¬ÈÕÆÚ').value);
|
|
|
|
|
|
end else begin
|
|
|
deletefile(str);
|
|
|
InsertSysLog('ÉÏ´«±¨Îijö´í',frm_op_seae.t_op_seae.FieldByName('ÒµÎñ±àºÅ').asstring+'---'+str);
|
|
|
showmessage('ÎļþÉÏ´«³öÏÖ´íÎó£¡'+strmsg);
|
|
|
i_soi:=1;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
finally
|
|
|
MultiPartFormDataStream.Free;
|
|
|
FreeAndNil(IdHTTP1);
|
|
|
FreeAndNil(ResponseStream);
|
|
|
end;
|
|
|
|
|
|
end else begin
|
|
|
|
|
|
try
|
|
|
|
|
|
IdFTP1:=TIdFTP.Create(application);
|
|
|
with idftp1 do
|
|
|
begin
|
|
|
Username:=ftpname;
|
|
|
Password:=ftppass;
|
|
|
Host:=ftpar;
|
|
|
Passive:=CheckBox1.Checked;
|
|
|
Connect;
|
|
|
end;
|
|
|
idftp1.ChangeDir(ftppath);
|
|
|
idftp1.TransferType:=ftBinary;
|
|
|
idftp1.Put(str,str_file);
|
|
|
idftp1.Disconnect;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if RadioGroup1.ItemIndex=0 then
|
|
|
SIO:='SO'
|
|
|
else SIO:='SI';
|
|
|
if RadioGroup3.ItemIndex=0 then
|
|
|
ORG:='ORG'
|
|
|
else ORG:='AMEND';
|
|
|
|
|
|
IF bsck.Checked then
|
|
|
begin
|
|
|
MBL:='·Öµ¥';
|
|
|
MBLNO:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring;
|
|
|
if (MBLNO='') THEN MBLNO:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('ÒµÎñ±àºÅ').asstring;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
MBL:='Ö÷µ¥';
|
|
|
MBLNO:=frm_op_seae.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring;
|
|
|
if (MBLNO='') THEN MBLNO:=frm_op_seae.t_op_seae.fieldbyname('ÒµÎñ±àºÅ').asstring;
|
|
|
|
|
|
end;
|
|
|
CARR:=frm_op_seae.t_op_seae.fieldbyname('´¬¹«Ë¾').asstring;
|
|
|
CORP:=frm_op_seae.t_op_seae.fieldbyname('ίÍе¥Î»').asstring;
|
|
|
EMP:=employee;
|
|
|
EMPDAE:=FormatDateTime('YYYY-MM-DD hh:mm:ss',now);
|
|
|
ETD:=FormatDateTime('YYYY-MM-DD',frm_op_seae.t_op_seae.fieldbyname('¿ª´¬ÈÕÆÚ').value);
|
|
|
Insertt_op_Edi_Log(SIO,ORG,MBL,CARR,MBLNO,ETD,CORP,EMP,EMPDAE,str,edi);
|
|
|
|
|
|
|
|
|
except
|
|
|
on e : exception do
|
|
|
begin
|
|
|
MessageDlg('ÎļþÉÏ´«´íÎó£¡'+e.message,mtError,[mbOk],0);
|
|
|
deletefile(str);
|
|
|
i_soi:=1;
|
|
|
// showmessage('ÎļþÉÏ´«´íÎó£¡');
|
|
|
end;
|
|
|
end;
|
|
|
idftp1.Free;
|
|
|
end;
|
|
|
|
|
|
if i_soi=0 then UpdateSOIStatus(RadioGroup1.ItemIndex,frm_op_seae.t_op_seae.fieldbyname('񅧏').asstring);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
showmessage('ÎļþÉÏ´«³É¹¦£¡');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
function Tfrm_op_seae_edi_swi.GetPortEdiIDBYEDICODE(Port: String): String;
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('Select SWIEDI EDI´úÂë from t_code_disport where EDI´úÂë='''+Port+'''');
|
|
|
Open;
|
|
|
if not IsEmpty then
|
|
|
Result:=Trim(FieldByName('EDI´úÂë').asstring)
|
|
|
else
|
|
|
Result:=Port;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
end.
|