You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3003 lines
102 KiB
Plaintext

11 months ago
unit u_op_seae_edi_nor;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,IdFTP,IdFTPCommon,
Dialogs, BusinessSkinForm, StdCtrls, bsSkinCtrls,inifiles, DB, ADODB;
type
Tfrm_op_seae_edi_nor = class(TForm)
bsBusinessSkinForm1: TbsBusinessSkinForm;
Label2: TLabel;
Edit2: TEdit;
Edit1: TEdit;
Label1: TLabel;
SaveDialog1: TSaveDialog;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
t_op_ctn: TADOQuery;
t_op_ctn1: TDataSource;
bsSkinRadioGroup1: TbsSkinRadioGroup;
Label3: TLabel;
Edit3: TEdit;
bsSkinRadioGroup2: TbsSkinRadioGroup;
bsSkinButton4: TbsSkinButton;
bsSkinGroupBox1: TbsSkinGroupBox;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
t_op_ams: TADOQuery;
t_op_ams1: TDataSource;
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
t_op_seae_assistant: TADOQuery;
bsSkinRadioGroup3: TbsSkinRadioGroup;
t_op_edictn: TADOQuery;
procedure bsSkinButton2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
private
function isEditrue(DataSet:TDataSet): boolean; //<2F>жϱ<D0B6><CFB1><EFBFBD><EFBFBD><EFBFBD>
function GetStrNum(str:String):integer;//<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
function FormatListString(Old:TStrings;mCount,Strlength:integer):String;//<2F><><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
function FormatEdiString(str:String;Strlength:integer=0):String;//<2F><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD> :
function CreateEdiFile:TStrings;//<2F><><EFBFBD>ձ<EFBFBD><D5B1><EFBFBD>
function CreateZHUEdiFile:TStrings;//<2F><>Ʊ<EFBFBD><C6B1><EFBFBD>ձ<EFBFBD><D5B1><EFBFBD>
function CreateSIEdiFile:TStrings; //SI<53><49><EFBFBD><EFBFBD>
function GetCntrEdi(cntrsize: String):String; //<2F><><EFBFBD><EFBFBD>EDI<44><49><EFBFBD><EFBFBD>
function GetpkgsEdi(pkgs:String):String;//<2F><>װEDI<44><49><EFBFBD><EFBFBD>
function GetlineEdi(aline:String):String;//<2F><><EFBFBD><EFBFBD>EDI<44><49><EFBFBD><EFBFBD>
function GetLengthword(var s: String; l: Integer;str:String): String;//<2F><><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>ȡ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
procedure GetLengthTString(var sl:TStringList;l:integer);//<2F><><EFBFBD>ݳ<EFBFBD><DDB3>ȸ<EFBFBD>ʽ<EFBFBD><CABD> tstringlist
function IsZhongwen(Str:String):Boolean;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD>˫<EFBFBD>ֽ<EFBFBD><D6BD>ַ<EFBFBD>
{ Private declarations }
public
{ Public declarations }
function ControlLines(LinesCount,CorpTypeid,BsTypeid:Integer;SName:string):String;
function GetPortEdiID(Port:String): String;
end;
var
frm_op_seae_edi_nor: Tfrm_op_seae_edi_nor;
implementation
uses u_op_seae, u_main, my_sys_function, u_data_share;
{$R *.dfm}
function Tfrm_op_seae_edi_nor.GetPortEdiID(Port:String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select EDI<44><49><EFBFBD><EFBFBD> from t_code_disport where Ӣ<><D3A2><EFBFBD><EFBFBD>='''+Port+'''');
Open;
if not IsEmpty then
Result:=Trim(FieldByName('EDI<44><49><EFBFBD><EFBFBD>').asstring)
else
Result:='';
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_edi_nor.ControlLines(LinesCount,CorpTypeid,BsTypeid:Integer;SName:string):String;
begin
Result:='';
if LinesCount>6 then
begin
case CorpTypeid of
0:begin
case BsTypeid of
0: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>6<EFBFBD><36>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ʽΪ:*<2A>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
1: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>6<EFBFBD><36>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ʽΪ:*<2A>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end;
end;
1:begin
case BsTypeid of
0: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>6<EFBFBD><36>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ʽΪ:**<2A>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
1: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>6<EFBFBD><36>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ʽΪ:**<2A>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end;
end;
2:begin
case BsTypeid of
0: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>6<EFBFBD><36>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ʽΪ:***<2A>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
1: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>6<EFBFBD><36>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ʽΪ:***<2A>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end;
end;
end;
end;
end;
function Tfrm_op_seae_edi_nor.IsZhongwen(Str: String): Boolean;
var
i:Integer;
begin
Result:=false;
if Str='' then Exit;
for i:=1 to Length(Str) do begin
if Str[i]>Chr(127) then begin
Result:=True;
Exit;
end;
end;
end;
function Tfrm_op_seae_edi_nor.GetLengthword(var s: String; l: Integer;str:String): String;
var
i:Integer;
b:Boolean;
begin
s:='';
if Length(str)<=l then begin
result:=str;
end else begin
b:=true;
s:=Copy(str,l+1,Length(str)-l);
str:=Copy(str,1,l);
result:='';
for i:=Length(str) downto 1 do begin
if ( not (str[i] in [' ',';',',','.',':','/','(',')','+','-'])) and b then //,'?'
s:=str[i]+s
else begin
b:=false;
result:=str[i]+Result;
end;
end;
s:=s+' ';
end;
end;
procedure Tfrm_op_seae_edi_nor.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_nor.FormatEdiString(str:String;Strlength:integer=0):String;
var
i:integer;
strC:widestring;
begin
strC:='';
for i:=1 to length(str) do
begin
if ((str[i]=#39) or (str[i]=':') or (str[i]='+') or (str[i]='?')) then//or (str[i]=';')
begin
strC:=strC+'?'+str[i];
end
else
begin
strC:=strC+str[i];
end;
end;
result:=strC;
end;
function Tfrm_op_seae_edi_nor.FormatListString(Old:TStrings;mCount,Strlength:integer):String;
var
i:integer;
NewStrs:TStrings;
mStr:String;
begin
Result:='';
NewStrs:=TStringList.Create;
for i:=0 to old.Count-1 do begin
if Length(old.Strings[i])<=Strlength then begin
NewStrs.Add(old.Strings[i]);
end else begin
mStr:=old.Strings[i];
while length(mStr)>Strlength do begin
newStrs.Add(copy(mStr,1,Strlength));
system.Delete(mStr,1,Strlength);
end;
newStrs.Add(mStr);
end;
end;
try
for i:=0 to mCount-1 do begin
if i<NewStrs.Count then begin
Result:=Result+NewStrs.Strings[i];
end;
if i<mCount-1 then
Result:=Result+':';
end;
finally
FreeAndNil(NewStrs);
end;
end;
function Tfrm_op_seae_edi_nor.GetStrNum(str:String):integer;
var
i:integer;
begin
result:=0;
if str='' then exit;
for i:=1 to length(Str) do begin
if str[i] in ['0','1','2','3','4','5','6','7','8','9'] then
result:=result+1;
end;
end;
procedure Tfrm_op_seae_edi_nor.bsSkinButton2Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_op_seae_edi_nor.FormShow(Sender: TObject);
var
inifile1:Tinifile;
begin
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
edit1.text:=inifile1.ReadString('EDI','CSAVSEND','');
edit2.text:=inifile1.ReadString('EDI','CSAVRECIEVE','71093609X');
edit3.text:=inifile1.ReadString('EDI','CSAVSENDNAME','');
edit4.text:=inifile1.ReadString('EDI','CSAVFTPSERVER',get_parameters_value(77,''));
edit5.text:=inifile1.ReadString('EDI','CSAVFTPPATH',get_parameters_value(78,'/'));
edit6.text:=inifile1.ReadString('EDI','CSAVFTPNAME',get_parameters_value(79,''));
edit7.text:=inifile1.ReadString('EDI','CSAVFTPPASS',get_parameters_value(80,''));
//????
inifile1.free;
t_op_ams.close;
t_op_ams.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
t_op_ams.open;
end;
procedure Tfrm_op_seae_edi_nor.bsSkinButton1Click(Sender: TObject);
var
Str:TStrings;
inifile1:Tinifile;
i:integer;
begin
str:=Tstringlist.Create;
try
if Trim(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
if bsSkinRadioGroup2.ItemIndex=1 then
Str:=CreateSIEdiFile
else
Str:=CreateEdiFile
else
if Pos('<27><>Ʊ',(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring))>0 then
{
if bsSkinRadioGroup2.ItemIndex=1 then
Str:=CreateSIZHUEdiFile
else
Str:=CreateZHUEdiFile
}
else begin
Exit;
end;
for i:=0 to Str.Count-1 do begin
if IsZhongwen(Str[i]) then begin
if MessageDlg('<27><>Ʊҵ<C6B1><D2B5><EFBFBD><EFBFBD><EFBFBD>ܺ<EFBFBD><DCBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>,ȷʵҪ<CAB5><D2AA><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbYes,mbNo],0)=mrNo then
exit;
end;
end;
SaveDialog1.FileName:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring;
if SaveDialog1.Execute then
begin
str.SaveToFile(SaveDialog1.FileName+'.txt');
showmessage('<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ɳɹ<C9B3><C9B9><EFBFBD>');
end
else
begin
showmessage('<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
exit;
end;
finally
FreeAndNil(Str)
end;
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
inifile1.WriteString('EDI','CSAVSEND',edit1.text);
inifile1.WriteString('EDI','CSAVRECIEVE',edit2.text);
inifile1.WriteString('EDI','CSAVSENDNAME',edit3.text);
inifile1.WriteString('EDI','CSAVFTPSERVER',edit4.text);
inifile1.WriteString('EDI','CSAVFTPPATH',edit5.text);
inifile1.WriteString('EDI','CSAVFTPNAME',edit6.text);
inifile1.WriteString('EDI','CSAVFTPPASS',edit7.text);
inifile1.free;
close;
end;
function Tfrm_op_seae_edi_nor.isEditrue(DataSet:TDataSet): boolean;
var
cntrs,Lines,s_error:String;
sl:TStringList;
i:integer;
begin
result:=true;
sl:=TStringList.Create;
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring)='' then begin
result:=false;
if s_error='' then s_error:='<27><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'<27><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
if trim(DataSet.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)='' then begin
result:=false;
if s_error='' then s_error:='<27><><EFBFBD>ѷ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'<27><><EFBFBD>ѷ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
{
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD>β<EFBFBD><CEB2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
}
if trim(DataSet.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring)='' then
begin
result:=false;
if s_error='' then s_error:='װ<>۴<EFBFBD><DBB4><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'װ<>۴<EFBFBD><DBB4><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>';
end;
if trim(DataSet.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
if s_error='' then s_error:='װ<><D7B0><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'װ<><D7B0><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
if trim(DataSet.fieldbyname('<27>ܼ<EFBFBD>').asstring)='' then begin
result:=false;
if s_error='' then s_error:='<27><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װƤ<D7B0>ز<EFBFBD><D8B2><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'<27><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װƤ<D7B0>ز<EFBFBD><D8B2><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
if s_error='' then s_error:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
if s_error='' then s_error:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>';
end;
if trim(DataSet.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
if s_error='' then s_error:='ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>';
end;
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>').asstring)='' then begin
result:=false;
if s_error='' then s_error:='<27><><EFBFBD><EFBFBD><EFBFBD>ص㲻<D8B5><E3B2BB>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD>ص㲻<D8B5><E3B2BB>Ϊ<EFBFBD><CEAA>';
end;
if trim(DataSet.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring)='' then begin
result:=false;
if s_error='' then s_error:='Ŀ<>ĵز<C4B5><D8B2><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'Ŀ<>ĵز<C4B5><D8B2><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
if trim(frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
if s_error='' then s_error:='<27>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'<27>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
{
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˱<EFBFBD><CBB1><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
}
if bsSkinRadioGroup2.ItemIndex=1 then
begin
if trim(t_op_ams.fieldbyname('SI<53><49>ע').asstring)='' then begin
result:=false;
if s_error='' then s_error:='SI<53><49>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'SI<53><49>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
end else begin
if trim(frm_op_seae.t_op_seae.fieldbyname('EDI<44><49>ע').asstring)='' then begin
result:=false;
if s_error='' then s_error:='EDI<44><49>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'EDI<44><49>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
end;
if trim(DataSet.fieldbyname('ǩ<><C7A9><EFBFBD>ص<EFBFBD>').asstring)='' then
begin
result:=false;
if s_error='' then s_error:='ǩ<><C7A9><EFBFBD>ص㲻<D8B5><E3B2BB>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'ǩ<><C7A9><EFBFBD>ص㲻<D8B5><E3B2BB>Ϊ<EFBFBD><CEAA>';
end;
if trim(GetpkgsEdi(DataSet.fieldbyname('<27><>װ').asstring))='' then
begin
result:=false;
if s_error='' then s_error:='<27><>װEDI<44><49><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'<27><>װEDI<44><49><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>';
end;
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then
begin
result:=false;
if s_error='' then s_error:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
if trim(DataSet.fieldbyname('<27><>ͷ').asstring)='' then
begin
result:=false;
if s_error='' then s_error:='<27><>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'<27><>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asinteger=0 then
begin
result:=false;
if s_error='' then s_error:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asFloat=0 then
begin
result:=false;
if s_error='' then s_error:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asFloat=0 then
begin
result:=false;
if s_error='' then s_error:='<27>ܳ<EFBFBD><DCB3><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'<27>ܳ<EFBFBD><DCB3><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>';
end;
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='' then
begin
result:=false;
if s_error='' then s_error:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
if trim(frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='D' then
begin
if Trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
if s_error='' then s_error:='Σ<><CEA3>Ʒ<EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'Σ<><CEA3>Ʒ<EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
if Trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
if s_error='' then s_error:='Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
{
if GetStrNum(Trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring))<>4 then begin
result:=false;
if s_error='' then s_error:='Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>';
MessageDlg('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>ű<EFBFBD><C5B1><EFBFBD><EFBFBD><EFBFBD><34><CEBB><EFBFBD><EFBFBD>',mtWarning,[mbOk],0);
exit;
end;
}
end;
if trim(frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='R' then
begin
if Trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
if s_error='' then s_error:='<27><><EFBFBD><EFBFBD><EFBFBD>¶Ȳ<C2B6><C8B2><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD>¶Ȳ<C2B6><C8B2><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
if Trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>').asstring)='' then
begin
result:=false;
if s_error='' then s_error:='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>';
end
else
begin
{
if bsSkinRadioGroup3.ItemIndex=1 then
begin
if GetStrNum(Trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>').asstring))<>3 then
begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>Ϊ<EFBFBD><CEAA><EFBFBD>ֶ<EFBFBD><D6B6>Ҳ<EFBFBD><D2B2>ܳ<EFBFBD><DCB3><EFBFBD>3λ',mtWarning,[mbOk],0);
exit;
end;
end;
}
end;
if Trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
if s_error='' then s_error:='<27><><EFBFBD><EFBFBD><EFBFBD>¶Ȳ<C2B6><C8B2><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD>¶Ȳ<C2B6><C8B2><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
if Trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
if s_error='' then s_error:='<27><><EFBFBD><EFBFBD><EFBFBD>¶Ȳ<C2B6><C8B2><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD>¶Ȳ<C2B6><C8B2><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
end;
if bsSkinRadioGroup3.ItemIndex=1 then
begin
sl.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring);
for i:=0 to sl.Count-1 do
begin
if IsZhongwen(sl[i]) then begin
result:=false;
if s_error='' then s_error:='EDI<44><49>Ϣ<EFBFBD>з<EFBFBD><D0B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42>!'
else s_error:=s_error+#13#10+'EDI<44><49>Ϣ<EFBFBD>з<EFBFBD><D0B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42>!';
end;
if Length(sl[i])>34 then begin
result:=false;
if s_error='' then s_error:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>34<33><34><EFBFBD>ַ<EFBFBD>!'
else s_error:=s_error+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>34<33><34><EFBFBD>ַ<EFBFBD>!';
end;
Lines:=ControlLines(sl.Count,1,0,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'); //LinesCount,CorpTypeid,BsTypeid:Integer;SName:string
if Lines<>'' then
begin
result:=false;
if s_error='' then s_error:='EDI<44><49>Ϣ<EFBFBD><CFA2>'+Lines+'!'
else s_error:=s_error+#13#10+'EDI<44><49>Ϣ<EFBFBD><CFA2>'+Lines+'!';
end;
end;
sl.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').asstring);
for i:=0 to sl.Count-1 do
begin
if IsZhongwen(sl[i]) then begin
result:=false;
if s_error='' then s_error:='EDI<44><49>Ϣ<EFBFBD><CFA2><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42>!'
else s_error:=s_error+#13#10+'EDI<44><49>Ϣ<EFBFBD><CFA2><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42>!';
end;
if Length(sl[i])>34 then begin
result:=false;
if s_error='' then s_error:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>34<33><34><EFBFBD>ַ<EFBFBD>!'
else s_error:=s_error+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>34<33><34><EFBFBD>ַ<EFBFBD>!';
end;
Lines:=ControlLines(sl.Count,1,0,'<27>ջ<EFBFBD><D5BB><EFBFBD>'); //LinesCount,CorpTypeid,BsTypeid:Integer;SName:string
if Lines<>'' then
begin
result:=false;
if s_error='' then s_error:='EDI<44><49>Ϣ<EFBFBD><CFA2>'+Lines+'!'
else s_error:=s_error+#13#10+'EDI<44><49>Ϣ<EFBFBD><CFA2>'+Lines+'!';
end;
end;
sl.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').asstring);
for i:=0 to sl.Count-1 do
begin
if IsZhongwen(sl[i]) then begin
result:=false;
if s_error='' then s_error:='EDI<44><49>Ϣ<EFBFBD><CFA2>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42>!'
else s_error:=s_error+#13#10+'EDI<44><49>Ϣ<EFBFBD><CFA2>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42>!';
end;
if Length(sl[i])>34 then begin
result:=false;
if s_error='' then s_error:='֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>34<33><34><EFBFBD>ַ<EFBFBD>!'
else s_error:=s_error+#13#10+'֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>34<33><34><EFBFBD>ַ<EFBFBD>!';
end;
Lines:=ControlLines(sl.Count,1,0,'֪ͨ<CDA8><D6AA>'); //LinesCount,CorpTypeid,BsTypeid:Integer;SName:string
if Lines<>'' then
begin
result:=false;
if s_error='' then s_error:='EDI<44><49>Ϣ<EFBFBD><CFA2>'+Lines+'!'
else s_error:=s_error+#13#10+'EDI<44><49>Ϣ<EFBFBD><CFA2>'+Lines+'!';
end;
end;
end;
if bsSkinRadioGroup2.ItemIndex=1 then begin
t_op_ctn.close;
t_op_ctn.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
t_op_ctn.open;
if t_op_ctn.IsEmpty then begin
result:=false;
if s_error='' then s_error:='<27><>װ<EFBFBD><EFBFBD><E4B2BB>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'<27><>װ<EFBFBD><EFBFBD><E4B2BB>Ϊ<EFBFBD><CEAA>';
end;
t_op_ctn.First;
while not t_op_ctn.Eof do begin
if Trim(t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
if s_error='' then s_error:='<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
if Trim(t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
if s_error='' then s_error:='<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>'
else s_error:=s_error+#13#10+'<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
t_op_ctn.Next;
end;
end;
if not result then
begin
MessageDlg(s_error,mtWarning,[mbOk],0);
end;
end;
function Tfrm_op_seae_edi_nor.CreateEdiFile:TStrings;
var
str,sl,sl1:Tstringlist;
i,j,Count,l,M:integer;
strsql,strRmain,strtemp,S,SOC:string;
rs:Tadoquery;
wide_str:widestring;
k:integer;
strType:string;
strDatetime:string;
SenderCode,ReciverCode:string;
function GetRemarksString:String;
var
TempStr:TStringList;
begin
TempStr:=TStringList.Create;
try
TempStr.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('EDI<44><49>ע').AsString);
GetLengthTString(TempStr,35);
Result:='17:';
Result:=Result+FormatListString(TempStr,5,35)+'''';
finally
FreeAndNil(TempStr);
end;
end;
function GetShipperString:String;
var
TempStr:TStringList;
begin
TempStr:=TStringList.Create;
try
TempStr.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').AsString);
GetLengthTString(TempStr,35);
Result:='20:';
Result:=Result+':';
Result:=Result+FormatListString(TempStr,6,35)+'''';
finally
FreeAndNil(TempStr);
end;
end;
function GetConsigneString:String;
var
TempStr:TStringList;
begin
TempStr:=TStringList.Create;
try
TempStr.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').AsString);
GetLengthTString(TempStr,35);
Result:='21:';
Result:=Result+':';
Result:=Result+FormatListString(TempStr,6,35)+'''';
finally
FreeAndNil(TempStr);
end;
end;
function GetNOTIFYString:String;
var
TempStr:TStringList;
begin
TempStr:=TStringList.Create;
try
TempStr.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').AsString);
GetLengthTString(TempStr,35);
Result:='22:';
Result:=Result+':';
Result:=Result+FormatListString(TempStr,6,35)+'''';
finally
FreeAndNil(TempStr);
end;
end;
function GetAMSSHIPPERString:String;
var
TempStr:TStringList;
begin
TempStr:=TStringList.Create;
try
TempStr.Text:=FormatEdiString(t_op_ams.fieldbyname('AMS<4D><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
GetLengthTString(TempStr,35);
Result:='23:';
Result:=Result+Trim(t_op_ams.fieldbyname('<27><>ʵǩԼ<C7A9>˴<EFBFBD><CBB4><EFBFBD>').AsString)+':';
Result:=Result+FormatListString(TempStr,6,35)+'''';
finally
FreeAndNil(TempStr);
end;
end;
function GetMARKSString:String;
var
TempStr:TStringList;
begin
TempStr:=TStringList.Create;
try
TempStr.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('<27><>ͷ').AsString);
GetLengthTString(TempStr,35);
Result:='44:';
Result:=Result+FormatListString(TempStr,10,35)+'''';
finally
FreeAndNil(TempStr);
end;
end;
{
function GetCARGODESCRIPTIONString:String;
var
TempStr:TStrings;
i:integer;
begin
TempStr:=TStringList.Create;
try
TempStr.Text:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
for i:=0 to TempStr.Count-1 do begin
if i=0 then
Result:='47:'+FormatEdiString(TempStr.Strings[i],70)
else
Result:=Result+':'+FormatEdiString(TempStr.Strings[i],70);
end;
Result:=Result+'''';
finally
FreeAndNil(TempStr);
end;
end;
}
begin
if not isEditrue(frm_op_seae.t_op_seae) then exit;
SOC:='N';
SenderCode:=trim(edit1.Text) ;
if bsSkinRadioGroup3.ItemIndex=0 then
ReciverCode:='71093609X'
else
ReciverCode:='HLC';
// ReciverCode:=trim(edit2.Text) ;
if bsSkinRadioGroup1.ItemIndex=0 then
strType:='9'
else if bsSkinRadioGroup1.ItemIndex=1 then
strType:='2'
else if bsSkinRadioGroup1.ItemIndex=2 then
strType:='3'
else if bsSkinRadioGroup1.ItemIndex=3 then
strType:='4'
else strType:='9';
if frm_op_seae.dxdbgrid1.SelectedCount<=1 then
begin
str:=Tstringlist.Create;
sl:=Tstringlist.Create;
sl1:=Tstringlist.Create;
str.Clear;
if bsSkinRadioGroup2.ItemIndex=1 then
str.Add('00:IFTMIN:BOOKING:'+trim(strType)+':'+ SenderCode+':'+ReciverCode+':'+GetDatetime(datetimetostr(now),1)+#39)
else
str.Add('00:IFTMBF:BOOKING:'+trim(strType)+':'+ SenderCode+':'+ReciverCode+':'+GetDatetime(datetimetostr(now),1)+#39);
Count:=0;
str.Add ('02:'+ trim(frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)+GetDatetime(datetimetostr(now),1)
+':'+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring)
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)
+':'+trim(t_op_ams.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>').asstring)
+':'+ReciverCode
+ ':::::::::'
+ ':'+ trim(frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>').asstring)
+':'
+':'+ #39);
if trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
strtemp:='ORI'
else
strtemp:='EXP';
str.add('03:'+strtemp+':'
+':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD>ص<EFBFBD>').asstring) +':'
+ GetDatetime(trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring),0)+':'
+ get_fenshu(trim(frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring))+':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('Ԥ<><D4A4><EFBFBD>ص<EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('Ԥ<><D4A4><EFBFBD>ص<EFBFBD>').asstring) +#39);
str.Add('11:'+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˱<EFBFBD><CBB1><EFBFBD>').asstring) //2
+':'+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //3
+':'+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //4
+':' //5
+':' //6
+':'+ ReciverCode //7
+':' //8
+ ':'+GetDatetime(trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring),0) //9
+ ':::::' +#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
str.Add ('12:'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring) //2
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring) //3
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring) //4
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring) //5
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) //6
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring) //7
+':'+GetPortEdiID(trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD≯ۿ<CCB8>').asstring)) //<2F><><EFBFBD≯ۿ<CCB8> <20><><EFBFBD><EFBFBD> //8
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD≯ۿ<CCB8>').asstring) //9
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) //10
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>').asstring) //11
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵش<C4B5><D8B4><EFBFBD>').asstring) //12
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring) +#39); //13
if frm_data_share.t_code_free.locate('<27><><EFBFBD>ѷ<EFBFBD>ʽ',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring,[]) then
begin
str.Add ('14:'+frm_data_share.t_code_free.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)+#39);
str.Add('15:'
+'::'
+trim(frm_data_share.t_code_free.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'
+'::'
+ '::::' +#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
end
else
begin
str.Add ('14:'+'P'+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)+#39);
str.Add('15:'
+'::'
+'P:'
+'::'
+ '::::' +#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
end;
Str.Add(GetRemarksString);
Str.Add(GetShipperString);
Str.Add(GetConsigneString);
Str.Add(GetNOTIFYString);
if (t_op_ams.fieldbyname('<27><>ʵǩԼ<C7A9>˴<EFBFBD><CBB4><EFBFBD>').AsString<>'') or (t_op_ams.fieldbyname('AMS<4D><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString<>'') then
Str.Add(GetAMSSHIPPERString);
{
str.Add ('20:'+':'
+Changestr(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring) +#39);
str.Add ('21:'+':'
+Changestr(frm_op_seae.t_op_seae.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').asstring) +#39);
str.Add ('22:'+':'
+Changestr(frm_op_seae.t_op_seae.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').asstring) +#39);
}
str.Add ('41:1' //2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ʽ').asstring) //3 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring) // 4<><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ S/R/D/O
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //5 <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>
+':'+trim(GetpkgsEdi(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring))//6 <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring) //7<><37>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ˵<D7B0><CBB5>
+':' +trim(frm_op_seae.t_op_seae.fieldbyname('<27>ܼ<EFBFBD>').asstring) //8 <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װƤ<D7B0><C6A4>
+':' +trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //9 <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>
+':' //10 <20>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>
+':' //11
+':' //12
+':' //13
+':' //14
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //15
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //16
+':'
+':'
+#39);
IF trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='R' THEN
BEGIN
str.Add ('43:' // Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>
+':'
+':'
+':'
+':'
+':'
+':'
+':'
+'::'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>').asstring) +':'
+'C:'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+'::::'
+#39);
END;
IF trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='D'THEN
BEGIN
str.Add ('43:' // Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>
+trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) +':'
+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) +':'
+':'
+':'
+':'
+':'
+'::'
+':'
+':'
+':'
+':'
+':::::'
+#39);
END;
Str.Add(GetMARKSString);
sl1.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
GetLengthTString(sl1,35);
sl.text:='';
for L:=0 to sl1.Count-1 do
begin
if Trim(sl1.Strings[L])<>'' then
sl.Add(sl1.Strings[L]);
end;
M:=1;
for L:=0 to sl.Count-1 do begin
if M<=5 then begin
if M=1 then begin
s:='47:'+sl.Strings[L]+':';
end else begin
if M=5 then
s:=s+sl.Strings[L]
else
s:=s+sl.Strings[L]+':';
end;
end else begin
S:=S+'''';
Str.Add(S);
M:=1;
s:='47:'+sl.Strings[L]+':';
end;
M:=M+1;
end;
S:=S+'''';
Str.Add(S);
// Str.Add(GetCARGODESCRIPTIONString);
Count:=Count+11;
strRmain:='';
if trim(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
begin
if frm_op_seae.t_op_seae.fieldbyname('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
SOC:='Y';
if frm_data_share.t_crm_client_changzhan.locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',frm_op_seae.t_op_seae.fieldbyname('<27><>վ').asstring,[])then
begin
strRmain:=strRmain+'F:'+':'+':'+frm_data_share.t_crm_client_changzhan.fieldbyname('EDI<44><49><EFBFBD><EFBFBD>').asstring+':'+':'+SOC+#39;
end
else
begin
strRmain:=strRmain+'F:'+':'+':'+':'+':'+SOC+#39;
end;
strsql:='select <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,sum(<28><><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD> from t_op_ctn group by <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD> having <20><><EFBFBD><EFBFBD>='
+#39+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39;
try
rs:=Tadoquery.Create(application);
rs.Connection := frm_main.db;
rs.sql.clear;
rs.sql.add(strsql);
rs.Open;
rs.First;
while not rs.Eof do
begin
str.Add ('48:'+Trim(GetCntrEdi(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring))+':'+
trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+
strRmain);
Count:=Count+1;
rs.Next;
end;
{
strsql:='select * from t_op_ctn where <20><><EFBFBD><EFBFBD>='
+#39+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39;
rs.Close;
rs.sql.clear;
rs.sql.add(strsql);
rs.Open;
if not rs.IsEmpty then begin
if rs.FieldByName('<27><><EFBFBD><EFBFBD>').AsInteger>0 then begin
rs.First;
while not rs.Eof do begin
str.Add ('51:'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+Trim(GetCntrEdi(rs.fieldbyname('<27>ߴ<EFBFBD>').asstring,rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring))+':'+
trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+trim(IntToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger))+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat))+':'+''''
);
rs.Next;
end;
end;
end;
}
rs.Close;
rs.Destroy;
except
on e:exception do
begin
rs.Close;
rs.Destroy;
exit;
end;
end;
end
else
begin
if frm_data_share.t_crm_client_changzhan.locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',frm_op_seae.t_op_seae.fieldbyname('<27><>վ').asstring,[])then
begin
strRmain:=strRmain+'L:'+':'+':'+frm_data_share.t_crm_client_changzhan.fieldbyname('EDI<44><49><EFBFBD><EFBFBD>').asstring+':'+':'+'N'+#39;
end
else
begin
strRmain:=strRmain+'L:'+':'+':'+':'+':'+'N'+#39;
end;
str.Add('48:'+':'+':'+strRmain);
Count:=Count+1;
end;
I:=str.Count;
str.Add('99:'+intToStr(i+1)+'''');
end
else
begin
str:=Tstringlist.Create;
str.Clear;
sl:=Tstringlist.Create;
sl1:=Tstringlist.Create;
str.Add('00:IFTMBF:BOOKING:'+trim(strType)+':'+ SenderCode+':'+ReciverCode+':'+GetDatetime(datetimetostr(now),1)+#39);
Count:=0;
for k:=0 to frm_op_seae.dxdbgrid1.SelectedCount-1 do
begin
frm_op_seae.t_op_seae.GotoBookmark(pointer(frm_op_seae.dxdbgrid1.selectedrows[k]));
str.Add ('02:'+ trim(frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)+GetDatetime(datetimetostr(now),1)+':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+ trim(t_op_ams.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>').asstring) +':'
+ 'CSAV:'
+ ':::::::'
+ '::'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>').asstring)+':'
+':'+ #39);
if trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
strtemp:='ORI'
else
strtemp:='EXP';
str.add('03:'+strtemp+':'
+':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD>ص<EFBFBD>').asstring) +':'
+ GetDatetime(trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring),0)+':'
+ get_fenshu(trim(frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring))+':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('Ԥ<><D4A4><EFBFBD>ص<EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('Ԥ<><D4A4><EFBFBD>ص<EFBFBD>').asstring) +#39);
str.Add('11:'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˱<EFBFBD><CBB1><EFBFBD>').asstring)+':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'
+'::'
+ ReciverCode +':'
+ '::::::' +#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
str.Add ('12:'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring) //2
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring) //3
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring) //4
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring) //5
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) //6
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring) //7
+':'+GetPortEdiID(trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD≯ۿ<CCB8>').asstring)) //<2F><><EFBFBD≯ۿ<CCB8> <20><><EFBFBD><EFBFBD> //8
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD≯ۿ<CCB8>').asstring) //9
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) //10
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>').asstring) //11
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵش<C4B5><D8B4><EFBFBD>').asstring) //12
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring) +#39); //13
if frm_data_share.t_code_free.locate('<27><><EFBFBD>ѷ<EFBFBD>ʽ',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring,[]) then
begin
str.Add ('14:'+frm_data_share.t_code_free.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)+#39);
str.Add('15:'
+'::'
+trim(frm_data_share.t_code_free.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'
+'::'
+ '::::' +#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
end
else
begin
str.Add ('14:'+'P'+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)+#39);
str.Add('15:'
+'::'
+'P:'
+'::'
+ '::::' +#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
end;
Str.Add(GetRemarksString);
Str.Add(GetShipperString);
Str.Add(GetConsigneString);
Str.Add(GetNOTIFYString);
if (t_op_ams.fieldbyname('<27><>ʵǩԼ<C7A9>˴<EFBFBD><CBB4><EFBFBD>').AsString<>'') or (t_op_ams.fieldbyname('AMS<4D><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString<>'') then
Str.Add(GetAMSSHIPPERString);
str.Add ('41:1' //2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ʽ').asstring) //3 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring) // 4<><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ S/R/D/O
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //5 <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>
+':'+trim(GetpkgsEdi(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring))//6 <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring) //7<><37>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ˵<D7B0><CBB5>
+':' +trim(frm_op_seae.t_op_seae.fieldbyname('<27>ܼ<EFBFBD>').asstring) //8 <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װƤ<D7B0><C6A4>
+':' +trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //9 <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>
+':' //10 <20>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>
+':' //11
+':' //12
+':' //13
+':' //14
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //15
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //16
+':'
+':'
+#39);
{
str.Add ('41:1::'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)+':' // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ S/R/D/O
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(GetpkgsEdi(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring))+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring) +':' //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ˵<D7B0><CBB5>
+trim(frm_op_seae.t_op_seae.fieldbyname('<27>ܼ<EFBFBD>').asstring) +':' //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ˵<D7B0><CBB5>
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +'::::::' // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װƤ<D7B0><C6A4>
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':::' // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>
+#39);
}
IF trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='R' THEN
BEGIN
str.Add ('43:' // Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>
+':'
+':'
+':'
+':'
+':'
+':'
+':'
+'::'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>').asstring) +':'
+'C:'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+'::::'
+#39);
END;
IF trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='D'THEN
BEGIN
str.Add ('43:' // Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>
+trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) +':'
+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) +':'
+':'
+':'
+':'
+':'
+'::'
+':'
+':'
+':'
+':'
+':::::'
+#39);
END;
Str.Add(GetMARKSString);
sl1.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
GetLengthTString(sl1,35);
sl.text:='';
for L:=0 to sl1.Count-1 do
begin
if Trim(sl1.Strings[L])<>'' then
sl.Add(sl1.Strings[L]);
end;
M:=1;
for L:=0 to sl.Count-1 do begin
if M<=5 then begin
if M=1 then begin
s:='47:'+sl.Strings[L]+':';
end else begin
if M=5 then
s:=s+sl.Strings[L]
else
s:=s+sl.Strings[L]+':';
end;
end else begin
S:=S+'''';
Str.Add(S);
M:=1;
s:='47:'+sl.Strings[L]+':';
end;
M:=M+1;
end;
S:=S+'''';
Str.Add(S);
Count:=Count+11;
strRmain:='';
if trim(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
begin
if frm_op_seae.t_op_seae.fieldbyname('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
SOC:='Y';
if frm_data_share.t_crm_client_changzhan.locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',frm_op_seae.t_op_seae.fieldbyname('<27><>վ').asstring,[])then
begin
strRmain:=strRmain+'F:'+':'+':'+frm_data_share.t_crm_client_changzhan.fieldbyname('EDI<44><49><EFBFBD><EFBFBD>').asstring+':'+':'+SOC+#39;
end
else
begin
strRmain:=strRmain+'F:'+':'+':'+':'+':'+SOC+#39;
end;
strsql:='select <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,sum(<28><><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD> from t_op_ctn group by <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD> having <20><><EFBFBD><EFBFBD>='
+#39+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39;
try
rs:=Tadoquery.Create(application);
rs.Connection := frm_main.db;
rs.sql.clear;
rs.sql.add(strsql);
rs.Open;
rs.First;
while not rs.Eof do
begin
str.Add ('48:'+Trim(GetCntrEdi(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring))+':'+
trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+
strRmain);
Count:=Count+1;
rs.Next;
end;
rs.Close;
rs.Destroy;
except
on e:exception do
begin
rs.Close;
rs.Destroy;
exit;
end;
end;
end
else
begin
if frm_data_share.t_crm_client_changzhan.locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',frm_op_seae.t_op_seae.fieldbyname('<27><>վ').asstring,[])then
begin
strRmain:=strRmain+'L:'+':'+':'+frm_data_share.t_crm_client_changzhan.fieldbyname('EDI<44><49><EFBFBD><EFBFBD>').asstring+':'+':'+'N'+#39;
end
else
begin
strRmain:=strRmain+'L:'+':'+':'+':'+':'+'N'+#39;
end;
str.Add('48:'+':'+':'+strRmain);
Count:=Count+1;
end;
I:=str.Count;
end;
str.Add('99:'+intToStr(i+1)+'''');
end;
Result:=str;
end;
function Tfrm_op_seae_edi_nor.CreateZHUEdiFile:TStrings;
var
str,sl,sl1:Tstringlist;
i,j,Count,l,M:integer;
first:Boolean;
strsql,strRmain,strtemp,strhead:string;
rs,aQuery:Tadoquery;
wide_str:widestring;
k:integer;
strType,s:string;
strDatetime:string;
SenderCode,ReciverCode:string;
function GetRemarksString:String;
var
TempStr:TStringList;
begin
TempStr:=TStringList.Create;
try
TempStr.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('EDI<44><49>ע').AsString);
GetLengthTString(TempStr,70);
Result:='17:';
Result:=Result+FormatListString(TempStr,5,70)+'''';
finally
FreeAndNil(TempStr);
end;
end;
function GetShipperString:String;
var
TempStr:TStringList;
begin
TempStr:=TStringList.Create;
try
TempStr.Text:=FormatEdiString(aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').AsString);
GetLengthTString(TempStr,35);
Result:='20:';
Result:=Result+':';
Result:=Result+FormatListString(TempStr,6,35)+'''';
finally
FreeAndNil(TempStr);
end;
end;
function GetConsigneString:String;
var
TempStr:TStringList;
begin
TempStr:=TStringList.Create;
try
TempStr.Text:=FormatEdiString(aQuery.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').AsString);
GetLengthTString(TempStr,35);
Result:='21:';
Result:=Result+':';
Result:=Result+FormatListString(TempStr,6,35)+'''';
finally
FreeAndNil(TempStr);
end;
end;
function GetNOTIFYString:String;
var
TempStr:TStringList;
begin
TempStr:=TStringList.Create;
try
TempStr.Text:=FormatEdiString(aQuery.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').AsString);
GetLengthTString(TempStr,35);
Result:='22:';
Result:=Result+':';
Result:=Result+FormatListString(TempStr,6,35)+'''';
finally
FreeAndNil(TempStr);
end;
end;
function GetMARKSString:String;
var
TempStr:TStringList;
begin
TempStr:=TStringList.Create;
try
TempStr.Text:=FormatEdiString(aQuery.fieldbyname('<27><>ͷ').AsString);
GetLengthTString(TempStr,35);
Result:='44:';
Result:=Result+FormatListString(TempStr,10,35)+'''';
finally
FreeAndNil(TempStr);
end;
end;
begin
SenderCode:=trim(edit1.Text) ;
ReciverCode:=trim(edit2.Text) ;
if bsSkinRadioGroup1.ItemIndex=0 then
strType:='9'
else if bsSkinRadioGroup1.ItemIndex=1 then
strType:='2'
else if bsSkinRadioGroup1.ItemIndex=2 then
strType:='3'
else if bsSkinRadioGroup1.ItemIndex=3 then
strType:='4'
else strType:='9';
str:=Tstringlist.Create;
sl:=Tstringlist.Create;
sl1:=Tstringlist.Create;
str.Clear;
str.Add('00:IFTMBF:BOOKING:'+trim(strType)+':'+ SenderCode+':'+ReciverCode+':'+GetDatetime(datetimetostr(now),1)+#39);
Count:=0;
aQuery:=CreateAdoQuery;
try
aQuery.Close;aQuery.sql.Clear;
aQuery.SQL.Add('select * from t_op_seae where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD> and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><3E><><EFBFBD><EFBFBD>');
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
aQuery.Open;
if not aQuery.IsEmpty then begin
if not isEditrue(aQuery) then exit;
aQuery.first;
first:=true;
while not aQuery.eof do begin
if first then begin
str.Add ('02:'+ trim(frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)+':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring) +':'
+ trim(aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +'::'
+ 'CSAV:'
+ ':::::::'
+ '::'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>').asstring)+':'
+':'+ #39);
end else begin
str.Add ('02:'+ trim(aQuery.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)+':'
+ trim(aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring) +':'
+ trim(aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+ trim(t_op_ams.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>').asstring) +':'
+ 'CSAV:'
+ ':::::::'
+ '::'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>').asstring)+':'
+':'+ #39);
{
str.Add ('02:'+ trim(aQuery.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)+':'
+ trim(aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring) +':'
+ trim(aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +'::'
+ ReciverCode +':'
+ ':::::::'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>').asstring)+':'
+':::'+ #39);
}
end;
if trim(aQuery.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
strtemp:='ORI'
else
strtemp:='EXP';
str.add('03:'+strtemp+':'
+':'
+ trim(aQuery.fieldbyname('ǩ<><C7A9><EFBFBD>ص<EFBFBD>').asstring) +':'
+ GetDatetime(trim(aQuery.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring),0)+':'
+ get_fenshu(trim(aQuery.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring))+':'
+ trim(aQuery.fieldbyname('Ԥ<><D4A4><EFBFBD>ص<EFBFBD>').asstring) +':'
+ trim(aQuery.fieldbyname('Ԥ<><D4A4><EFBFBD>ص<EFBFBD>').asstring) +#39);
str.Add('11:'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˱<EFBFBD><CBB1><EFBFBD>').asstring)+':'
+ trim(aQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+ trim(aQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'
+'::'
+ ReciverCode +':'
+ '::::::' +#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
str.Add ('12:'+trim(aQuery.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring)+':'
+trim(aQuery.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring)+':'
+trim(aQuery.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring)+':'
+trim(aQuery.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring)+':'
+trim(aQuery.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+trim(aQuery.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring)+':'
+':'
+':'
+trim(aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+trim(aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>').asstring) +':'
+trim(aQuery.fieldbyname('Ŀ<>ĵش<C4B5><D8B4><EFBFBD>').asstring) +':'
+trim(aQuery.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring) +#39);
if frm_data_share.t_code_free.locate('<27><><EFBFBD>ѷ<EFBFBD>ʽ',aQuery.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring,[]) then
begin
str.Add ('14:'+frm_data_share.t_code_free.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+':'
+trim(aQuery.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)+#39);
str.Add('15:'
+'::'
+trim(frm_data_share.t_code_free.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'
+'::'
+ '::::' +#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
end
else
begin
str.Add ('14:'+'P'+':'
+trim(aQuery.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)+#39);
str.Add('15:'
+'::'
+'P:'
+'::'
+ '::::' +#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
end;
Str.Add(GetRemarksString);
Str.Add(GetShipperString);
Str.Add(GetConsigneString);
Str.Add(GetNOTIFYString);
str.Add ('41:1::'+trim(aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)+':' // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ S/R/D/O
+trim(aQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(GetpkgsEdi(aQuery.fieldbyname('<27><>װ').asstring))+':'
+trim(aQuery.fieldbyname('<27><>װ').asstring) +':' //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ˵<D7B0><CBB5>
+trim(aQuery.fieldbyname('<27>ܼ<EFBFBD>').asstring) +':' //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ˵<D7B0><CBB5>
+trim(aQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +'::::::' // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װƤ<D7B0><C6A4>
+trim(aQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':::' // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>
+#39);
IF trim(aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='R'THEN
BEGIN
str.Add ('43:' // Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>
+':'
+':'
+':'
+':'
+':'
+':'
+':'
+'::'
+trim(aQuery.fieldbyname('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>').asstring) +':'
+'C:'
+trim(aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+trim(aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+trim(aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+'::::'
+#39);
END;
IF trim(aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='D'THEN
BEGIN
str.Add ('43:' // Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>
+trim(aQuery.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) +':'
+':'
+trim(aQuery.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) +':'
+':'
+':'
+':'
+':'
+'::'
+':'
+':'
+':'
+':'
+':::::'
+#39);
END;
Str.Add(GetMARKSString);
// Str.Add(GetCARGODESCRIPTIONString);
sl1.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
GetLengthTString(sl1,70);
sl.text:='';
for L:=0 to sl1.Count-1 do begin
if Trim(sl1.Strings[L])<>'' then
sl.Add(sl1.Strings[L]);
end;
M:=1;
for L:=0 to sl.Count-1 do begin
if M<=5 then begin
if M=1 then begin
s:='47:'+FormatEdiString(sl.Strings[L],0)+':';
end else begin
if M=5 then
s:=s+FormatEdiString(sl.Strings[L],0)
else
s:=s+FormatEdiString(sl.Strings[L],0)+':';
end;
end else begin
S:=S+'''';
Str.Add(S);
M:=1;
s:='47:'+FormatEdiString(sl.Strings[L],0)+':';
end;
M:=M+1;
end;
S:=S+'''';
Str.Add(S);
Count:=Count+11;
strRmain:='';
if first then
strRmain:=strRmain+'L:'+':'+':'+':'+':'+'N'+#39
else
strRmain:=strRmain+'L:'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring)+':'+':'+':'+':'+'N'+#39;
strsql:='select <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,sum(<28><><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD> from t_op_ctn group by <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD> having <20><><EFBFBD><EFBFBD>='
+#39+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39;
try
rs:=Tadoquery.Create(application);
rs.Connection := frm_main.db;
rs.sql.clear;
rs.sql.add(strsql);
rs.Open;
rs.First;
while not rs.Eof do
begin
str.Add ('48:'+Trim(GetCntrEdi(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring))+':'+
trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+
strRmain);
Count:=Count+1;
rs.Next;
end;
{
strsql:='select * from t_op_ctn where <20><><EFBFBD><EFBFBD>='
+#39+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39;
rs.Close;
rs.sql.clear;
rs.sql.add(strsql);
rs.Open;
if not rs.IsEmpty then begin
if rs.FieldByName('<27><><EFBFBD><EFBFBD>').AsInteger>0 then begin
rs.First;
while not rs.Eof do begin
str.Add ('51:'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+Trim(GetCntrEdi(rs.fieldbyname('<27>ߴ<EFBFBD>').asstring,rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring))+':'+
trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+trim(IntToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger))+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat))+':'+''''
);
rs.Next;
end;
end;
end;
}
rs.Close;
rs.Destroy;
except
on e:exception do
begin
rs.Close;
rs.Destroy;
exit;
end;
end;
aQuery.Next;
first:=False;
end;
end;
finally
FreeAndNil(aQuery);
end;
I:=str.Count;
str.Add('99:'+intToStr(i+1)+'''');
Result:=str;
end;
function Tfrm_op_seae_edi_nor.CreateSIEdiFile:TStrings;
var
str,sl,sl1:Tstringlist;
i,j,Count,l,M:integer;
strsql,strRmain,strtemp,S,fenshu:string;
rs:Tadoquery;
wide_str,str_shr,str_con,str_not:widestring;
k:integer;
strType:string;
strDatetime:string;
SenderCode,ReciverCode,SOC:string;
firstcon:boolean;
function GetRemarksString:String;
var
TempStr:TStringlist;
begin
TempStr:=TStringList.Create;
try
TempStr.Text:=FormatEdiString(t_op_ams.fieldbyname('SI<53><49>ע').AsString);
GetLengthTString(TempStr,70);
Result:='17:';
Result:=Result+FormatListString(TempStr,5,70)+'''';
finally
FreeAndNil(TempStr);
end;
end;
function GetAMSSHIPPERString:String;
var
TempStr:TStringList;
begin
TempStr:=TStringList.Create;
try
TempStr.Text:=FormatEdiString(t_op_ams.fieldbyname('AMS<4D><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
GetLengthTString(TempStr,35);
Result:='23:';
Result:=Result+trim(t_op_ams.fieldbyname('<27><>ʵǩԼ<C7A9>˴<EFBFBD><CBB4><EFBFBD>').AsString)+':';
Result:=Result+FormatListString(TempStr,6,35)+'''';
finally
FreeAndNil(TempStr);
end;
end;
begin
if not isEditrue(frm_op_seae.t_op_seae) then exit;
SOC:='N';
SenderCode:=trim(edit1.Text) ;
if bsSkinRadioGroup3.ItemIndex=0 then
ReciverCode:='71093609X'
else
ReciverCode:='HLC';
if bsSkinRadioGroup1.ItemIndex=0 then
strType:='9'
else if bsSkinRadioGroup1.ItemIndex=1 then
strType:='2'
else if bsSkinRadioGroup1.ItemIndex=2 then
strType:='3'
else if bsSkinRadioGroup1.ItemIndex=3 then
strType:='4'
else strType:='9';
if frm_op_seae.dxdbgrid1.SelectedCount<=1 then
begin
str:=Tstringlist.Create;
sl:=Tstringlist.Create;
sl1:=Tstringlist.Create;
if bsSkinCheckRadioBox2.Checked then
with t_op_seae_assistant do begin
Close;
SQL.Clear;
SQL.Add('select * from t_op_seae_assistant where <20><><EFBFBD><EFBFBD>='''+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''');
open;
end;
str.Clear;
str.Add('00:IFTMIN:BOOKING:'+trim(strType)+':'+ SenderCode+':'+ReciverCode+':'+GetDatetime(datetimetostr(now),1)+#39);
Count:=0;
str.Add ('02:'+ trim(frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)+GetDatetime(datetimetostr(now),1) //2 3
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring) //3
+':'+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) //4
+':'+ trim(t_op_ams.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>').asstring) //5
+':'+ ReciverCode //6
+ ':' //7
+ ':' //8
+ ':' //9
+ ':' //10
+ ':' //11
+ ':' //12
+ ':' //13
+ ':' //14
+ ':' //15
+ ':'+ trim(frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>').asstring)// 16
+':' //17
+':'+ #39);
if trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then begin
strtemp:='ORI';
fenshu:=get_fenshu(trim(frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring));
end else begin
strtemp:='EXP';
fenshu:='0';
end;
str.add('03:'+strtemp+':'
+':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD>ص<EFBFBD>').asstring) +':'
+ GetDatetime(trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring),0)+':'
+ fenshu+':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('Ԥ<><D4A4><EFBFBD>ص<EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('Ԥ<><D4A4><EFBFBD>ص<EFBFBD>').asstring) +#39);
str.Add('11:'+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˱<EFBFBD><CBB1><EFBFBD>').asstring) //2
+':'+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //3
+':'+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //4
+':' //5
+':' //6
+':'+ ReciverCode //7
+':' //8
+ ':'+GetDatetime(trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring),0) //9
+ ':::::' +#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
str.Add ('12:'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring) //2
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring) //3
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring) //4
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring) //5
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) //6
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring) //7
+':'+GetPortEdiID(trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD≯ۿ<CCB8>').asstring)) //<2F><><EFBFBD≯ۿ<CCB8> <20><><EFBFBD><EFBFBD> //8
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD≯ۿ<CCB8>').asstring) //9
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) //10
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>').asstring) //11
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵش<C4B5><D8B4><EFBFBD>').asstring) //12
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring) +#39); //13
if frm_data_share.t_code_free.locate('<27><><EFBFBD>ѷ<EFBFBD>ʽ',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring,[]) then
begin
str.Add ('14:'+frm_data_share.t_code_free.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)+#39);
str.Add('15:'
+'::'
+trim(frm_data_share.t_code_free.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'
+'::'
+ '::::' +#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
end
else
begin
str.Add ('14:'+'P'+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)+#39);
str.Add('15:'
+'::'
+'P:'
+'::'
+ '::::' +#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
end;
Str.Add(GetRemarksString);
if (bsSkinCheckRadioBox2.Checked) and (not t_op_seae_assistant.IsEmpty) then
sl1.Text:=FormatEdiString(t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring)
else
sl1.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring);
GetLengthTString(sl1,35);
strtemp:='20::'+sl1[0]+':';
if sl1.Count>=2 then
strtemp:=strtemp+sl1[1];
if (sl1.Count>=3) and (sl1.Count<=6) then
begin
for j:=2 to sl1.Count-1 do
begin
strtemp:=strtemp+':'+sl1[j]
end;
end;
if sl1.Count>6 then
begin
for j:=2 to 3 do
begin
strtemp:=strtemp+':'+sl1[j]
end;
s:='';
strtemp:=strtemp+':'+GetLengthword(s,34,sl1[5])+'*';
Str_shr:='*'+S;
for j:=6 to sl1.Count-1 do
begin
Str_shr:=Str_shr+' '+sl1[j];
end;
{
strtemp:=strtemp+':'+Copy(sl1[4],1,34)+'*';
Str_shr:='*'+Copy(sl1[4],34,1);
for j:=5 to sl1.Count-1 do begin
Str_shr:=Str_shr+' '+sl1[j]
end;
}
end;
strtemp:=strtemp+#39;
str.Add(strtemp);
count:=count+1;
if (bsSkinCheckRadioBox2.Checked) and (not t_op_seae_assistant.IsEmpty) then
sl1.Text:=FormatEdiString(t_op_seae_assistant.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').asstring)
else
sl1.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').asstring);
GetLengthTString(sl1,35);
strtemp:='21::'+sl1[0]+':';
if sl1.Count>=2 then
strtemp:=strtemp+sl1[1];
if (sl1.Count>=3) and (sl1.Count<=6) then
begin
for j:=2 to sl1.Count-1 do
begin
strtemp:=strtemp+':'+sl1[j]
end;
end;
if sl1.Count>6 then
begin
for j:=2 to 3 do
begin
strtemp:=strtemp+':'+sl1[j]
end;
s:='';
strtemp:=strtemp+':'+GetLengthword(s,33,sl1[5])+'**';
Str_con:='**'+S;
for j:=6 to sl1.Count-1 do begin
Str_con:=Str_con+' '+sl1[j]
end;
{
strtemp:=strtemp+':'+Copy(sl1[4],1,33)+'**';
Str_con:='**'+Copy(sl1[4],33,2);
for j:=5 to sl1.Count-1 do begin
Str_con:=Str_con+' '+sl1[j]
end;
}
end;
strtemp:=strtemp+#39;
str.Add(strtemp);
count:=count+1;
if (bsSkinCheckRadioBox2.Checked) and (not t_op_seae_assistant.IsEmpty) then
sl1.Text:=FormatEdiString(t_op_seae_assistant.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').asstring)
else
sl1.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').asstring);
GetLengthTString(sl1,35);
strtemp:='22::'+sl1[0]+':';
if sl1.Count>=2 then
strtemp:=strtemp+sl1[1];
if (sl1.Count>=3) and (sl1.Count<=6) then
begin
for j:=2 to sl1.Count-1 do
begin
strtemp:=strtemp+':'+sl1[j]
end;
end;
if sl1.Count>6 then
begin
for j:=2 to 3 do
begin
strtemp:=strtemp+':'+sl1[j]
end;
s:='';
strtemp:=strtemp+':'+GetLengthword(s,32,sl1[5])+'***';
Str_not:='***'+S;
for j:=6 to sl1.Count-1 do begin
Str_not:=Str_not+' '+sl1[j]
end;
{
strtemp:=strtemp+':'+Copy(sl1[4],1,32)+'***';
Str_not:='***'+Copy(sl1[4],32,3);
for j:=5 to sl1.Count-1 do begin
Str_not:=Str_not+' '+sl1[j]
end;
}
end;
strtemp:=strtemp+#39;
str.Add(strtemp);
count:=count+1;
if (t_op_ams.fieldbyname('<27><>ʵǩԼ<C7A9>˴<EFBFBD><CBB4><EFBFBD>').AsString<>'') or (t_op_ams.fieldbyname('AMS<4D><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString<>'') then
Str.Add(GetAMSSHIPPERString);
str.Add ('41:1' //2
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ʽ').asstring) //3
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring) // 4<><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ S/R/D/O
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //5
+':'+trim(GetpkgsEdi(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring))//6
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring) //7<><37>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ˵<D7B0><CBB5>
+':' +trim(frm_op_seae.t_op_seae.fieldbyname('<27>ܼ<EFBFBD>').asstring) //8
+':' +trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //9
+':' //10
+':' //11
+':' //12
+':' //13
+':' //14
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //15
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //16
+':'
+':'
+#39);
IF trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='R' THEN
BEGIN
str.Add ('43:' // Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>
+':'
+':'
+':'
+':'
+':'
+':'
+':'
+'::'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>').asstring) +':'
+'C:'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+'::::'
+#39);
END;
IF trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='D'THEN
BEGIN
str.Add ('43:' // Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>
+trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) +':'
+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) +':'
+':'
+':'
+':'
+':'
+'::'
+':'
+':'
+':'
+':'
+':::::'
+#39);
END;
if (bsSkinCheckRadioBox2.Checked) and (not t_op_seae_assistant.IsEmpty) then
sl.Text:=FormatEdiString(t_op_seae_assistant.fieldbyname('<27><>ͷ').asstring)
else
sl.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('<27><>ͷ').AsString);
GetLengthTString(sl,20);
M:=1;
for L:=0 to sl.Count-1 do begin
if M<=10 then begin
if M=1 then begin
s:='44:'+sl.Strings[L]+':';
end else begin
if M=10 then
s:=s+sl.Strings[L]
else
s:=s+sl.Strings[L]+':';
end;
end else begin
S:=S+'''';
Str.Add(S);
M:=1;
s:='44:'+sl.Strings[L]+':';
end;
M:=M+1;
end;
S:=S+'''';
Str.Add(S);
if (bsSkinCheckRadioBox2.Checked) and (not t_op_seae_assistant.IsEmpty) then
sl1.Text:=FormatEdiString(t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)
else
sl1.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
if str_shr<>'' then begin
sl1.Add(str_shr)
end;
if str_con<>'' then begin
sl1.Add(str_con)
end;
if str_not<>'' then begin
sl1.Add(str_not)
end;
GetLengthTString(sl1,35);
sl.text:='';
for L:=0 to sl1.Count-1 do begin
sl.Add(sl1.Strings[L]);
end;
M:=1;
for L:=0 to sl.Count-1 do begin
if M<=5 then begin
if M=1 then begin
s:='47:'+sl.Strings[L]+':';
end else begin
if M=5 then
s:=s+sl.Strings[L]
else
s:=s+sl.Strings[L]+':';
end;
end else begin
S:=S+'''';
Str.Add(S);
M:=1;
s:='47:'+sl.Strings[L]+':';
end;
M:=M+1;
end;
S:=S+'''';
Str.Add(S);
// Str.Add(GetCARGODESCRIPTIONString);
Count:=Count+11;
strRmain:='';
if trim(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
begin
if frm_op_seae.t_op_seae.fieldbyname('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
SOC:='Y';
if frm_data_share.t_crm_client_changzhan.locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',frm_op_seae.t_op_seae.fieldbyname('<27><>վ').asstring,[])then
begin
strRmain:=strRmain+'F:'+':'+':'+frm_data_share.t_crm_client_changzhan.fieldbyname('EDI<44><49><EFBFBD><EFBFBD>').asstring+':'+':'+SOC+#39;
end
else
begin
strRmain:=strRmain+'F:'+':'+':'+':'+':'+SOC+#39;
end;
strsql:='select <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,sum(<28><><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD> from t_op_ctn group by <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD> having <20><><EFBFBD><EFBFBD>='
+#39+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39;
try
rs:=Tadoquery.Create(application);
rs.Connection := frm_main.db;
rs.sql.clear;
rs.sql.add(strsql);
rs.Open;
rs.First;
while not rs.Eof do
begin
str.Add ('48:'+Trim(GetCntrEdi(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring))+':'+
trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+
strRmain);
Count:=Count+1;
rs.Next;
end;
strsql:='select * from t_op_ctn where <20><><EFBFBD><EFBFBD>='
+#39+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39;
rs.Close;
rs.sql.clear;
rs.sql.add(strsql);
rs.Open;
firstcon:=true;
if not rs.IsEmpty then begin
if rs.FieldByName('<27><><EFBFBD><EFBFBD>').AsInteger>0 then
begin
rs.First;
while not rs.Eof do begin
if pos('FR',rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)>0 then
begin
if firstcon then
str.Add ('51:'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+Trim(GetCntrEdi(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring))
+':NIL'+':'+trim(IntToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger))+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat))+'::'
+trim(floatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').Asfloat))+':'+edit3.Text+'''')
else
str.Add ('51:'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+Trim(GetCntrEdi(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring))
+':NIL'+':'+trim(IntToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger))+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat))+'::'
+trim(floatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').Asfloat))+':'+'''');
end
else
begin
if firstcon then
str.Add ('51:'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+Trim(GetCntrEdi(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring))+':'+
trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+trim(IntToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger))+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat))+'::'
+trim(floatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').Asfloat))+':'+edit3.Text+'''')
else
str.Add ('51:'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+Trim(GetCntrEdi(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring))+':'+
trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+trim(IntToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger))+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat))+'::'
+trim(floatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').Asfloat))+':'+'''');
end;
firstcon:=false;
rs.Next;
end;
end;
end;
with t_op_edictn do
begin
Close;
SQL.Clear;
SQL.Add('select * from t_op_edictn where <20><><EFBFBD><EFBFBD>='''+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''');
open;
if not IsEmpty then begin
first;
while not eof do begin
str.Add ('53:'+trim(fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+trim(fieldbyname('HTS').asstring)+':'+trim(fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)
+':'+trim(GetpkgsEdi(fieldbyname('<27><>װ').asstring))+':'+trim(IntToStr(fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger))+':'
+trim(FloatToStr(fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat))+':'+trim(fieldbyname('<27><>ֵ').asstring)+':'+trim(fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CDB4><EFBFBD>').Asstring)+'''');
next;
end;
end
else
begin
{
rs.First;
while not rs.Eof do begin
str.Add ('53:'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ʽ').asstring)
+':'+trim(rs.fieldbyname('Ʒ<><C6B7>').asstring)+':'+trim(GetpkgsEdi(rs.fieldbyname('<27><>װ').asstring))+':'
+trim(IntToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger))+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat))+'''');
rs.Next;
end;
}
end;
end;
rs.Close;
rs.Destroy;
except
on e:exception do
begin
rs.Close;
rs.Destroy;
exit;
end;
end;
end
else
begin
if frm_data_share.t_crm_client_changzhan.locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',frm_op_seae.t_op_seae.fieldbyname('<27><>վ').asstring,[])then
begin
strRmain:=strRmain+'L:'+':'+':'+frm_data_share.t_crm_client_changzhan.fieldbyname('EDI<44><49><EFBFBD><EFBFBD>').asstring+':'+':'+'N'+#39;
end
else
begin
strRmain:=strRmain+'L:'+':'+':'+':'+':'+'N'+#39;
end;
str.Add('48:'+':'+':'+strRmain);
Count:=Count+1;
end;
I:=str.Count;
str.Add('99:'+intToStr(i+1)+'''');
end
else
begin
str.Clear;
str.Add('00:IFTMIN:BOOKING:'+trim(strType)+':'+ SenderCode+':'+ReciverCode+':'+GetDatetime(datetimetostr(now),1)+#39);
Count:=0;
for k:=0 to frm_op_seae.dxdbgrid1.SelectedCount-1 do
begin
frm_op_seae.t_op_seae.GotoBookmark(pointer(frm_op_seae.dxdbgrid1.selectedrows[k]));
str:=Tstringlist.Create;
sl:=Tstringlist.Create;
sl1:=Tstringlist.Create;
if bsSkinCheckRadioBox2.Checked then
with t_op_seae_assistant do
begin
Close;
SQL.Clear;
SQL.Add('select * from t_op_seae_assistant where <20><><EFBFBD><EFBFBD>='''+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''');
open;
end;
str.Add ('02:'+ trim(frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)+GetDatetime(datetimetostr(now),1)+':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+ trim(t_op_ams.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>').asstring) +':'
+ 'CSAV:'
+ ':::::::'
+ '::'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>').asstring)+':'
+':'+ #39);
if trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then begin
strtemp:='ORI';
fenshu:=get_fenshu(trim(frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring));
end else begin
strtemp:='EXP';
fenshu:='0';
end;
str.add('03:'+strtemp+':'
+':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD>ص<EFBFBD>').asstring) +':'
+ GetDatetime(trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring),0)+':'
+ fenshu+':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('Ԥ<><D4A4><EFBFBD>ص<EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('Ԥ<><D4A4><EFBFBD>ص<EFBFBD>').asstring) +#39);
str.Add('11:'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˱<EFBFBD><CBB1><EFBFBD>').asstring)+':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+ trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'
+'::'
+ ReciverCode +':'
+ '::::::' +#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
str.Add ('12:'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring) //2
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring) //3
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring) //4
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring) //5
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) //6
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring) //7
+':'+GetPortEdiID(trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD≯ۿ<CCB8>').asstring)) //<2F><><EFBFBD≯ۿ<CCB8> <20><><EFBFBD><EFBFBD> //8
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD≯ۿ<CCB8>').asstring) //9
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) //10
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>').asstring) //11
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵش<C4B5><D8B4><EFBFBD>').asstring) //12
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring) +#39); //13
{
str.Add ('12:'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring) //2
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring) //3
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring) //4
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring) //5
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) //6
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring) //7
+':'
+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵش<C4B5><D8B4><EFBFBD>').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring) +#39);
}
if frm_data_share.t_code_free.locate('<27><><EFBFBD>ѷ<EFBFBD>ʽ',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring,[]) then
begin
str.Add ('14:'+frm_data_share.t_code_free.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)+#39);
str.Add('15:'
+'::'
+trim(frm_data_share.t_code_free.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'
+'::'
+ '::::' +#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
end
else
begin
str.Add ('14:'+'P'+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)+#39);
str.Add('15:'
+'::'
+'P:'
+'::'
+ '::::' +#39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA>
end;
Str.Add(GetRemarksString);
if (bsSkinCheckRadioBox2.Checked) and (not t_op_seae_assistant.IsEmpty) then
sl1.Text:=FormatEdiString(t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring)
else
sl1.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring);
GetLengthTString(sl1,35);
strtemp:='20::'+sl1[0]+':';
if sl1.Count>=2 then
strtemp:=strtemp+sl1[1];
if (sl1.Count>=3) and (sl1.Count<=5) then
begin
for j:=2 to sl1.Count-1 do
begin
strtemp:=strtemp+':'+sl1[j]
end;
end;
if sl1.Count>5 then
begin
for j:=2 to 3 do
begin
strtemp:=strtemp+':'+sl1[j]
end;
s:='';
strtemp:=strtemp+':'+GetLengthword(s,34,sl1[4])+'*';
Str_shr:='*'+S;
for j:=5 to sl1.Count-1 do
begin
Str_shr:=Str_shr+' '+sl1[j]
end;
{
strtemp:=strtemp+':'+Copy(sl1[4],1,34)+'*';
Str_shr:='*'+Copy(sl1[4],34,1);
for j:=5 to sl1.Count-1 do begin
Str_shr:=Str_shr+' '+sl1[j]
end;
}
end;
strtemp:=strtemp+#39;
str.Add(strtemp);
count:=count+1;
if (bsSkinCheckRadioBox2.Checked) and (not t_op_seae_assistant.IsEmpty) then
sl1.Text:=FormatEdiString(t_op_seae_assistant.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').asstring)
else
sl1.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').asstring);
GetLengthTString(sl1,35);
strtemp:='21::'+sl1[0]+':';
if sl1.Count>=2 then
strtemp:=strtemp+sl1[1];
if (sl1.Count>=3) and (sl1.Count<=5) then
begin
for j:=2 to sl1.Count-1 do
begin
strtemp:=strtemp+':'+sl1[j]
end;
end;
if sl1.Count>5 then
begin
for j:=2 to 3 do
begin
strtemp:=strtemp+':'+sl1[j]
end;
s:='';
strtemp:=strtemp+':'+GetLengthword(s,33,sl1[4])+'**';
Str_con:='**'+S;
for j:=5 to sl1.Count-1 do begin
Str_con:=Str_con+' '+sl1[j]
end;
{
strtemp:=strtemp+':'+Copy(sl1[4],1,33)+'**';
Str_con:='**'+Copy(sl1[4],33,2);
for j:=5 to sl1.Count-1 do begin
Str_con:=Str_con+' '+sl1[j]
end;
}
end;
strtemp:=strtemp+#39;
str.Add(strtemp);
count:=count+1;
if (bsSkinCheckRadioBox2.Checked) and (not t_op_seae_assistant.IsEmpty) then
sl1.Text:=FormatEdiString(t_op_seae_assistant.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').asstring)
else
sl1.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').asstring);
GetLengthTString(sl1,35);
strtemp:='22::'+sl1[0]+':';
if sl1.Count>=2 then
strtemp:=strtemp+sl1[1];
if (sl1.Count>=3) and (sl1.Count<=5) then
begin
for j:=2 to sl1.Count-1 do
begin
strtemp:=strtemp+':'+sl1[j]
end;
end;
if sl1.Count>5 then
begin
for j:=2 to 3 do
begin
strtemp:=strtemp+':'+sl1[j]
end;
s:='';
strtemp:=strtemp+':'+GetLengthword(s,32,sl1[4])+'***';
Str_not:='***'+S;
for j:=5 to sl1.Count-1 do begin
Str_not:=Str_not+' '+sl1[j]
end;
{
strtemp:=strtemp+':'+Copy(sl1[4],1,32)+'***';
Str_not:='***'+Copy(sl1[4],32,3);
for j:=5 to sl1.Count-1 do begin
Str_not:=Str_not+' '+sl1[j]
end;
}
end;
strtemp:=strtemp+#39;
str.Add(strtemp);
count:=count+1;
if (t_op_ams.fieldbyname('<27><>ʵǩԼ<C7A9>˴<EFBFBD><CBB4><EFBFBD>').AsString<>'') or (t_op_ams.fieldbyname('AMS<4D><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString<>'') then
Str.Add(GetAMSSHIPPERString);
str.Add ('41:1' //2
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ʽ').asstring) //3
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring) // 4<><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ S/R/D/O
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //5
+':'+trim(GetpkgsEdi(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring))//6
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring) //7<><37>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ˵<D7B0><CBB5>
+':' +trim(frm_op_seae.t_op_seae.fieldbyname('<27>ܼ<EFBFBD>').asstring) //8
+':' +trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //9
+':' //10
+':' //11
+':' //12
+':' //13
+':' //14
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //15
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //16
+':'
+':'
+#39);
{
str.Add ('41:1::'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)+':' // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ S/R/D/O
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':'
+trim(GetpkgsEdi(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring))+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring) +':' //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ˵<D7B0><CBB5>
+trim(frm_op_seae.t_op_seae.fieldbyname('<27>ܼ<EFBFBD>').asstring) +':' //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ˵<D7B0><CBB5>
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +'::::::' // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װƤ<D7B0><C6A4>
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) +':::' // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>
+#39);
}
IF trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='R' THEN
BEGIN
str.Add ('43:' // Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>
+':'
+':'
+':'
+':'
+':'
+':'
+':'
+'::'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>').asstring) +':'
+'C:'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) +':'
+'::::'
+#39);
END;
IF trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='D'THEN
BEGIN
str.Add ('43:' // Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>
+trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) +':'
+':'
+trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring) +':'
+':'
+':'
+':'
+':'
+'::'
+':'
+':'
+':'
+':'
+':::::'
+#39);
END;
if (bsSkinCheckRadioBox2.Checked) and (not t_op_seae_assistant.IsEmpty) then
sl.Text:=FormatEdiString(t_op_seae_assistant.fieldbyname('<27><>ͷ').asstring)
else
sl.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('<27><>ͷ').AsString);
GetLengthTString(sl,20);
M:=1;
for L:=0 to sl.Count-1 do begin
if M<=10 then begin
if M=1 then begin
s:='44:'+sl.Strings[L]+':';
end else begin
if M=10 then
s:=s+sl.Strings[L]
else
s:=s+sl.Strings[L]+':';
end;
end else begin
S:=S+'''';
Str.Add(S);
M:=1;
s:='44:'+sl.Strings[L]+':';
end;
M:=M+1;
end;
S:=S+'''';
Str.Add(S);
if (bsSkinCheckRadioBox2.Checked) and (not t_op_seae_assistant.IsEmpty) then
sl1.Text:=FormatEdiString(t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)
else
sl1.Text:=FormatEdiString(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
if str_shr<>'' then begin
sl1.Add(str_shr)
end;
if str_con<>'' then begin
sl1.Add(str_con)
end;
if str_not<>'' then begin
sl1.Add(str_not)
end;
GetLengthTString(sl1,35);
sl.text:='';
for L:=0 to sl1.Count-1 do begin
sl.Add(sl1.Strings[L]);
end;
M:=1;
for L:=0 to sl.Count-1 do begin
if M<=5 then begin
if M=1 then begin
s:='47:'+sl.Strings[L]+':';
end else begin
if M=5 then
s:=s+sl.Strings[L]
else
s:=s+sl.Strings[L]+':';
end;
end
else
begin
S:=S+'''';
Str.Add(S);
M:=1;
s:='47:'+sl.Strings[L]+':';
end;
M:=M+1;
end;
S:=S+'''';
Str.Add(S);
// Str.Add(GetCARGODESCRIPTIONString);
Count:=Count+11;
strRmain:='';
if trim(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
begin
if frm_op_seae.t_op_seae.fieldbyname('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
SOC:='Y';
if frm_data_share.t_crm_client_changzhan.locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',frm_op_seae.t_op_seae.fieldbyname('<27><>վ').asstring,[])then
begin
strRmain:=strRmain+'F:'+':'+':'+frm_data_share.t_crm_client_changzhan.fieldbyname('EDI<44><49><EFBFBD><EFBFBD>').asstring+':'+':'+SOC+#39;
end
else
begin
strRmain:=strRmain+'F:'+':'+':'+':'+':'+SOC+#39;
end;
strsql:='select <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,sum(<28><><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD> from t_op_ctn group by <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD> having <20><><EFBFBD><EFBFBD>='
+#39+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39;
try
rs:=Tadoquery.Create(application);
rs.Connection := frm_main.db;
rs.sql.clear;
rs.sql.add(strsql);
rs.Open;
rs.First;
while not rs.Eof do
begin
str.Add ('48:'+Trim(GetCntrEdi(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring))+':'+
trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+
strRmain);
Count:=Count+1;
rs.Next;
end;
strsql:='select * from t_op_ctn where <20><><EFBFBD><EFBFBD>='
+#39+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39;
rs.Close;
rs.sql.clear;
rs.sql.add(strsql);
rs.Open;
firstcon:=true;
if not rs.IsEmpty then begin
if rs.FieldByName('<27><><EFBFBD><EFBFBD>').AsInteger>0 then
begin
rs.First;
while not rs.Eof do begin
if pos('FR',rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)>0 then
begin
if firstcon then
str.Add ('51:'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+Trim(GetCntrEdi(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring))
+':NIL'+':'+trim(IntToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger))+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat))+'::'
+trim(floatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').Asfloat))+':'+edit3.Text+'''')
else
str.Add ('51:'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+Trim(GetCntrEdi(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring))
+':NIL'+':'+trim(IntToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger))+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat))+'::'
+trim(floatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').Asfloat))+':'+'''');
end
else
begin
if firstcon then
str.Add ('51:'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+Trim(GetCntrEdi(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring))+':'+
trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+trim(IntToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger))+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat))+'::'
+trim(floatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').Asfloat))+':'+edit3.Text+'''')
else
str.Add ('51:'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+Trim(GetCntrEdi(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring))+':'+
trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+trim(IntToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger))+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat))+'::'
+trim(floatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').Asfloat))+':'+'''');
end;
firstcon:=false;
rs.Next;
end;
end;
end;
with t_op_edictn do
begin
Close;
SQL.Clear;
SQL.Add('select * from t_op_edictn where <20><><EFBFBD><EFBFBD>='''+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''');
open;
if not IsEmpty then begin
first;
while not eof do begin
str.Add ('53:'+trim(fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+trim(fieldbyname('HTS').asstring)+':'+trim(fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)
+':'+trim(GetpkgsEdi(fieldbyname('<27><>װ').asstring))+':'+trim(IntToStr(fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger))+':'
+trim(FloatToStr(fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat))+':'+trim(fieldbyname('<27><>ֵ').asstring)+':'+trim(fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CDB4><EFBFBD>').Asstring)+'''');
next;
end;
end else begin
rs.First;
while not rs.Eof do begin
str.Add ('53:'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ʽ').asstring)
+':'+trim(rs.fieldbyname('Ʒ<><C6B7>').asstring)+':'+trim(GetpkgsEdi(rs.fieldbyname('<27><>װ').asstring))+':'
+trim(IntToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger))+':'+trim(FloatToStr(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat))+'''');
rs.Next;
end;
end;
end;
rs.Close;
rs.Destroy;
except
on e:exception do
begin
rs.Close;
rs.Destroy;
exit;
end;
end;
end
else
begin
if frm_data_share.t_crm_client_changzhan.locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',frm_op_seae.t_op_seae.fieldbyname('<27><>վ').asstring,[])then
begin
strRmain:=strRmain+'L:'+':'+':'+frm_data_share.t_crm_client_changzhan.fieldbyname('EDI<44><49><EFBFBD><EFBFBD>').asstring+':'+':'+'N'+#39;
end
else
begin
strRmain:=strRmain+'L:'+':'+':'+':'+':'+'N'+#39;
end;
str.Add('48:'+':'+':'+strRmain);
Count:=Count+1;
end;
I:=str.Count;
end;
str.Add('99:'+intToStr(i+1)+'''');
end;
Result:=str;
end;
function Tfrm_op_seae_edi_nor.GetCntrEdi(cntrsize: String):String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select Edi<64><69><EFBFBD><EFBFBD> from t_code_ctn where <20><><EFBFBD><EFBFBD>='''+cntrsize+'''');
Open;
if IsEmpty then
Result:=''
else
Result:=FieldByName('Edi<64><69><EFBFBD><EFBFBD>').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_edi_nor.GetpkgsEdi(pkgs: String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select Edi<64><69><EFBFBD><EFBFBD> from t_code_package where <20><><EFBFBD><EFBFBD>='''+pkgs+'''');
Open;
if IsEmpty then
Result:=''
else
Result:=FieldByName('Edi<64><69><EFBFBD><EFBFBD>').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_edi_nor.GetlineEdi(aline: String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select Edi<64><69><EFBFBD><EFBFBD> from t_code_trade where <20><><EFBFBD><EFBFBD>='''+aline+'''');
Open;
if IsEmpty then
Result:=''
else
Result:=FieldByName('Edi<64><69><EFBFBD><EFBFBD>').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
procedure Tfrm_op_seae_edi_nor.bsSkinButton3Click(Sender: TObject);
var
IdFTP1:TIdFTP;
str:widestring;
str_file:widestring;
ftpar,ftpname,ftppass,ftppath,ScriptPath:String;
StrL:TStrings;
inifile1:Tinifile;
i:integer;
begin
ScriptPath:=ExtractFilePath(ParamStr(0))+'EDIFILE\';
if not DirectoryExists(ScriptPath) then
CreateDir(ScriptPath);
ftpar:=Trim(edit4.Text);
if ftpar='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FTP<54><50>ַ<EFBFBD><D6B7>',mtWarning,[mbOk],0);
exit;
end;
ftpname:=Trim(edit6.Text);
if ftpar='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FTP<54>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbOk],0);
exit;
end;
ftppass:=Trim(edit7.Text);
if ftpar='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FTP<54><50><EFBFBD>룡',mtWarning,[mbOk],0);
exit;
end;
ftppath:=Trim(edit5.Text);
str:=ScriptPath
+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring
+FormatDateTime('yyyy',now)
+FormatDateTime('mm',now)
+FormatDateTime('dd',now)
+FormatDateTime('hh',now)
+FormatDateTime('nn',now)+'.txt';
str_file:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring
+FormatDateTime('yyyy',now)
+FormatDateTime('mm',now)
+FormatDateTime('dd',now)
+FormatDateTime('hh',now)
+FormatDateTime('nn',now)+'.txt';
strL:=Tstringlist.Create;
try
if Trim(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then
if bsSkinRadioGroup2.ItemIndex=1 then
StrL:=CreateSIEdiFile
else
StrL:=CreateEdiFile
else if Pos('<27><>Ʊ',(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring))>0 then
{
if bsSkinRadioGroup2.ItemIndex=1 then
StrL:=CreateSIZHUEdiFile
else
StrL:=CreateZHUEdiFile
}
else begin
Exit;
end;
for i:=0 to StrL.Count-1 do begin
if IsZhongwen(StrL[i]) then begin
if MessageDlg('<27><>Ʊҵ<C6B1><D2B5><EFBFBD><EFBFBD><EFBFBD>ܺ<EFBFBD><DCBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>,ȷʵҪ<CAB5><D2AA><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbYes,mbNo],0)=mrNo then
exit;
end;
end;
strL.SaveToFile(str);
finally
FreeAndNil(StrL)
end;
try
IdFTP1:=TIdFTP.Create(application);
with idftp1 do
begin
Username:=ftpname;
Password:=ftppass;
Host:=ftpar;
Connect;
end;
idftp1.ChangeDir(ftppath);
idftp1.TransferType:=ftBinary;
idftp1.Put(str,str_file);
idftp1.Disconnect;
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
inifile1.WriteString('EDI','CSAVSEND',edit1.text);
inifile1.WriteString('EDI','CSAVRECIEVE',edit2.text);
inifile1.WriteString('EDI','CSAVSENDNAME',edit3.text);
inifile1.WriteString('EDI','CSAVFTPSERVER',edit4.text);
inifile1.WriteString('EDI','CSAVFTPPATH',edit5.text);
inifile1.WriteString('EDI','CSAVFTPNAME',edit6.text);
inifile1.WriteString('EDI','CSAVFTPPASS',edit7.text);
inifile1.free;
showmessage('<27>ļ<EFBFBD><C4BC>ϴ<EFBFBD><CFB4>ɹ<EFBFBD><C9B9><EFBFBD>');
except
deletefile(str);
showmessage('<27>ļ<EFBFBD><C4BC>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
idftp1.Free;
end;
procedure Tfrm_op_seae_edi_nor.bsSkinButton4Click(Sender: TObject);
begin
if frm_op_seae_edi_nor.Height=349 then
frm_op_seae_edi_nor.Height:=200
else
frm_op_seae_edi_nor.Height:=349;
end;
end.