|
|
|
|
unit u_op_seae_edi_at;
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,IdFTP,IdFTPCommon,
|
|
|
|
|
Dialogs, BusinessSkinForm, StdCtrls, bsSkinCtrls,inifiles, DB, ADODB;
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
Tfrm_op_seae_edi_at = 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;
|
|
|
|
|
t_op_seae_assistant: 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 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 GetCtnCode(ctnkind,ctnsize:String): String;
|
|
|
|
|
|
|
|
|
|
function Zeros(len:integer):String;
|
|
|
|
|
function EditFieldVlaueZeros(FieldVlaue:string;len:integer):String;
|
|
|
|
|
|
|
|
|
|
function GetCorpsString(recordno,fldName:string;aDataset:TDataset):String;
|
|
|
|
|
function Record00(strType,SenderCode,ReciverCode:string):String;
|
|
|
|
|
function Record10(aDataset:TDataset):String;
|
|
|
|
|
function Record11(aDataset:TDataset;SHIPPINGLINECODE:string):String;
|
|
|
|
|
function Record12(aDataset:TDataset):String;
|
|
|
|
|
function Record13(aDataset:TDataset):String;
|
|
|
|
|
function Record16_17_18(recordno,fldName:string;aDataset:TDataset):String;
|
|
|
|
|
function Record41(aDataset:TDataset):String;
|
|
|
|
|
function Record43(aDataset:TDataset):String;
|
|
|
|
|
function Record44_47(strLen,LoopCount:integer;RecordNo,FldName:string;aDataset:TDataset):TStringlist;
|
|
|
|
|
function Record51(aDataset:TDataset):TStringlist;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
frm_op_seae_edi_at: Tfrm_op_seae_edi_at;
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
uses u_op_seae, u_main, my_sys_function, u_data_share;
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_at.GetCtnCode(ctnkind,ctnsize:String): String;
|
|
|
|
|
var
|
|
|
|
|
aQuery:TADOQuery;
|
|
|
|
|
begin
|
|
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
|
|
ctnsize:=StringReplace(ctnsize,'''','''''',[rfReplaceAll]);
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
with aQuery do begin
|
|
|
|
|
Close;SQL.Clear;
|
|
|
|
|
SQL.Add('Select EDI<44><49><EFBFBD><EFBFBD> from t_code_ctn where <20><><EFBFBD><EFBFBD>='''+ctnkind+''' and <20>ߴ<EFBFBD>='''+ctnsize+'''');
|
|
|
|
|
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_at.Zeros(len:integer):String;
|
|
|
|
|
var i : integer;
|
|
|
|
|
begin
|
|
|
|
|
result:='';
|
|
|
|
|
for i :=0 to len-1 do
|
|
|
|
|
begin
|
|
|
|
|
if result='' then result:='0' else result:='0'+result;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
function Tfrm_op_seae_edi_at.EditFieldVlaueZeros(FieldVlaue:string;len:integer):String;
|
|
|
|
|
begin
|
|
|
|
|
Result:='';
|
|
|
|
|
if Length(FieldVlaue)>=Len then Result:=Copy(FieldVlaue,1,Len) else Result:=Zeros(len-Length(FieldVlaue))+FieldVlaue;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_at.GetCorpsString(recordno,fldName:string;aDataset:TDataset):String;
|
|
|
|
|
var
|
|
|
|
|
TempStr:TStringList;
|
|
|
|
|
begin
|
|
|
|
|
TempStr:=TStringList.Create;
|
|
|
|
|
try
|
|
|
|
|
TempStr.Text:=FormatEdiString(aDataset.fieldbyname(fldName).AsString);
|
|
|
|
|
GetLengthTString(TempStr,35);
|
|
|
|
|
Result:=recordno+':';
|
|
|
|
|
Result:=Result+':';
|
|
|
|
|
Result:=Result+FormatListString(TempStr,6,35)+'''';
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(TempStr);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_at.Record00(strType,SenderCode,ReciverCode:string):String;
|
|
|
|
|
begin
|
|
|
|
|
result:='00:IFCSUM:MANIFEST'+':'+trim(strType)+':'+ SenderCode+':'+ReciverCode+':'+GetDatetime(datetimetostr(now),1)+#39;
|
|
|
|
|
end;
|
|
|
|
|
function Tfrm_op_seae_edi_at.Record10(aDataset:TDataset):String;
|
|
|
|
|
begin
|
|
|
|
|
result:='10:'+':'+trim(aDataset.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) //
|
|
|
|
|
+':'
|
|
|
|
|
+':'+ trim(aDataset.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+':::'
|
|
|
|
|
+':'+ formatdatetime('YYYYMMDD',aDataset.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value)
|
|
|
|
|
+':'
|
|
|
|
|
+':'+ trim(aDataset.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+'::'
|
|
|
|
|
+#39;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_at.Record11(aDataset:TDataset;SHIPPINGLINECODE:string):String;
|
|
|
|
|
begin
|
|
|
|
|
result:='11:' //
|
|
|
|
|
+':'+trim(aDataset.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring)
|
|
|
|
|
+#39;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
function Tfrm_op_seae_edi_at.Record12(aDataset:TDataset):String;
|
|
|
|
|
var strPAY:string;
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
if frm_data_share.t_code_free.locate('<27><><EFBFBD>ѷ<EFBFBD>ʽ',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring,[]) then
|
|
|
|
|
begin
|
|
|
|
|
strPAY:=frm_data_share.t_code_free.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
result:='12'+':'+trim(aDataset.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring) //
|
|
|
|
|
+':::'
|
|
|
|
|
+':'+trim(aDataset.fieldbyname('Ŀ<>ĵش<C4B5><D8B4><EFBFBD>').asstring)
|
|
|
|
|
+':'+trim(aDataset.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring)
|
|
|
|
|
+':'+ trim(aDataset.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring)
|
|
|
|
|
+':'+ trim(aDataset.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+':'+ trim(aDataset.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+':'+ strPAY
|
|
|
|
|
+':'+ formatdatetime('YYYYMMDD',aDataset.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value)
|
|
|
|
|
+'::::'
|
|
|
|
|
+#39;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_at.Record13(aDataset:TDataset):String;
|
|
|
|
|
begin
|
|
|
|
|
result:='13'+':'+trim(aDataset.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+':'+ trim(aDataset.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+':'+trim(aDataset.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+':'+ trim(aDataset.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>').asstring)
|
|
|
|
|
+'::::'
|
|
|
|
|
+#39;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
function Tfrm_op_seae_edi_at.Record16_17_18(recordno,fldName:string;aDataset:TDataset):String;
|
|
|
|
|
begin
|
|
|
|
|
result:=GetCorpsString(recordno,fldName,aDataset);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_at.Record41(aDataset:TDataset):String;
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
case bsSkinRadioGroup2.ItemIndex of
|
|
|
|
|
0:begin
|
|
|
|
|
result:='41:001:'
|
|
|
|
|
+':'
|
|
|
|
|
+':'+ trim(aDataset.fieldbyname('<27><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+':'+ trim(aDataset.fieldbyname('<27><>װ').asstring)
|
|
|
|
|
+':'
|
|
|
|
|
+':'
|
|
|
|
|
+':'
|
|
|
|
|
+#39;
|
|
|
|
|
end;
|
|
|
|
|
1:begin
|
|
|
|
|
result:='41:001:'
|
|
|
|
|
+':'+ trim(aDataset.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+':'
|
|
|
|
|
+':'+ trim(aDataset.fieldbyname('<27><>װ').asstring)
|
|
|
|
|
+':'+ trim(aDataset.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+':'
|
|
|
|
|
+':'+ trim(aDataset.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+#39;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_at.Record43(aDataset:TDataset):String;
|
|
|
|
|
begin
|
|
|
|
|
result:='43:';
|
|
|
|
|
if trim(aDataset.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='D' THEN
|
|
|
|
|
begin
|
|
|
|
|
result:=result
|
|
|
|
|
+':'+trim(aDataset.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+':'
|
|
|
|
|
+':'+trim(aDataset.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+':::'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
result:=result+':::::::'
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if trim(aDataset.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='R' then
|
|
|
|
|
begin
|
|
|
|
|
result:=result+':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
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
result:=result+'::::'+#39;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
function Tfrm_op_seae_edi_at.Record44_47(strLen,LoopCount:integer;RecordNo,FldName:string;aDataset:TDataset):TStringlist;
|
|
|
|
|
var sl,sl1:Tstringlist;
|
|
|
|
|
m,l:integer;
|
|
|
|
|
s:string;
|
|
|
|
|
begin
|
|
|
|
|
result:=Tstringlist.Create;
|
|
|
|
|
sl:=Tstringlist.Create;
|
|
|
|
|
sl1:=Tstringlist.Create;
|
|
|
|
|
try
|
|
|
|
|
sl1.Text:=FormatEdiString(aDataset.fieldbyname(FldName).AsString);
|
|
|
|
|
GetLengthTString(sl1,strLen);
|
|
|
|
|
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<=LoopCount then begin
|
|
|
|
|
if M=1 then begin
|
|
|
|
|
s:=RecordNo+':'+sl.Strings[L]+':';
|
|
|
|
|
end else begin
|
|
|
|
|
if M=LoopCount then
|
|
|
|
|
s:=s+sl.Strings[L]
|
|
|
|
|
else
|
|
|
|
|
s:=s+sl.Strings[L]+':';
|
|
|
|
|
end;
|
|
|
|
|
end else begin
|
|
|
|
|
S:=S+'''';
|
|
|
|
|
result.Add(S);
|
|
|
|
|
M:=1;
|
|
|
|
|
s:=RecordNo+':'+sl.Strings[L]+':';
|
|
|
|
|
end;
|
|
|
|
|
M:=M+1;
|
|
|
|
|
end;
|
|
|
|
|
S:=S+'''';
|
|
|
|
|
result.Add(S);
|
|
|
|
|
finally
|
|
|
|
|
sl.Free;
|
|
|
|
|
sl1.Free;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_at.Record51(aDataset:TDataset):TStringlist;
|
|
|
|
|
var strsql:string;
|
|
|
|
|
rs:TADOQuery;
|
|
|
|
|
LineNo:integer;
|
|
|
|
|
begin
|
|
|
|
|
result:=TStringlist.Create;
|
|
|
|
|
strsql:='select * from t_op_ctn where <20><><EFBFBD><EFBFBD>='
|
|
|
|
|
+#39+aDataset.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;
|
|
|
|
|
LineNo:=1;
|
|
|
|
|
while not rs.Eof do
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
//+EditFieldVlaueZeros(intTostr(LineNo),3)
|
|
|
|
|
|
|
|
|
|
case bsSkinRadioGroup2.ItemIndex of
|
|
|
|
|
0:begin
|
|
|
|
|
result.Add ('51:'
|
|
|
|
|
+':'
|
|
|
|
|
+':'
|
|
|
|
|
+':'+GetCtnCode(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,rs.fieldbyname('<27>ߴ<EFBFBD>').asstring)
|
|
|
|
|
+':'
|
|
|
|
|
+':'
|
|
|
|
|
+':'
|
|
|
|
|
+':'
|
|
|
|
|
+':'
|
|
|
|
|
+#39);
|
|
|
|
|
end;
|
|
|
|
|
1:begin
|
|
|
|
|
result.Add ('51:'
|
|
|
|
|
+':'+Trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+':'+Trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+':'+GetCtnCode(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,rs.fieldbyname('<27>ߴ<EFBFBD>').asstring)
|
|
|
|
|
+':F'
|
|
|
|
|
+':'+trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+':'+Trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+':'
|
|
|
|
|
+':'+Trim(rs.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+#39);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
LineNo:=LineNo+1;
|
|
|
|
|
rs.Next;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
rs.Close;
|
|
|
|
|
rs.Destroy;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_at.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_at.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_at.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_at.FormatEdiString(str:String;Strlength:integer=0):String;
|
|
|
|
|
var
|
|
|
|
|
i:integer;
|
|
|
|
|
strC:widestring;
|
|
|
|
|
begin
|
|
|
|
|
strC:='';
|
|
|
|
|
for i:=1 to length(str) do
|
|
|
|
|
begin
|
|
|
|
|
if ((str[i]=#39) or (str[i]=':') or (str[i]='+') or (str[i]='?') or (str[i]=';')) then
|
|
|
|
|
begin
|
|
|
|
|
strC:=strC+'?'+str[i];
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
strC:=strC+str[i];
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
result:=strC;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_at.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_at.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_at.bsSkinButton2Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
close;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_at.FormShow(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
inifile1:Tinifile;
|
|
|
|
|
begin
|
|
|
|
|
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
|
|
|
|
|
edit1.text:=inifile1.ReadString('EDI','ATSEND','');
|
|
|
|
|
edit2.text:=inifile1.ReadString('EDI','ATRECIEVE','123456');
|
|
|
|
|
edit3.text:=inifile1.ReadString('EDI','ATSENDNAME','');
|
|
|
|
|
edit4.text:=inifile1.ReadString('EDI','ATFTPSERVER',get_parameters_value(77,''));
|
|
|
|
|
edit5.text:=inifile1.ReadString('EDI','ATFTPPATH',get_parameters_value(78,'/'));
|
|
|
|
|
edit6.text:=inifile1.ReadString('EDI','ATFTPNAME',get_parameters_value(79,''));
|
|
|
|
|
edit7.text:=inifile1.ReadString('EDI','ATFTPPASS',get_parameters_value(80,''));
|
|
|
|
|
inifile1.free;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_at.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:=CreateEdiFile
|
|
|
|
|
else
|
|
|
|
|
Str:=CreateEdiFile
|
|
|
|
|
else if Pos('<27><>Ʊ',(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring))>0 then
|
|
|
|
|
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:=Trim(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','ATSEND',edit1.text);
|
|
|
|
|
inifile1.WriteString('EDI','ATRECIEVE',edit2.text);
|
|
|
|
|
inifile1.WriteString('EDI','ATSENDNAME',edit3.text);
|
|
|
|
|
inifile1.WriteString('EDI','ATFTPSERVER',edit4.text);
|
|
|
|
|
inifile1.WriteString('EDI','ATFTPPATH',edit5.text);
|
|
|
|
|
inifile1.WriteString('EDI','ATFTPNAME',edit6.text);
|
|
|
|
|
inifile1.WriteString('EDI','ATFTPPASS',edit7.text);
|
|
|
|
|
inifile1.free;
|
|
|
|
|
|
|
|
|
|
close;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_at.isEditrue(DataSet:TDataSet): boolean;
|
|
|
|
|
var
|
|
|
|
|
cntrs:String;
|
|
|
|
|
begin
|
|
|
|
|
result:=true;
|
|
|
|
|
|
|
|
|
|
if trim(DataSet.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27>ᵥ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if trim(DataSet.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><><EFBFBD>ѷ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><><EFBFBD>β<EFBFBD><CEB2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if trim(DataSet.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('װ<>۴<EFBFBD><DBB4>벻<EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if trim(DataSet.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('װ<><D7B0><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if trim(DataSet.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if trim(DataSet.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('ж<><D0B6><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD>ص㲻<D8B5><E3B2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if trim(DataSet.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('Ŀ<>ĵز<C4B5><D8B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if trim(DataSet.fieldbyname('Ŀ<>ĵش<C4B5><D8B4><EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('Ŀ<>ĵش<C4B5><D8B4>벻<EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if trim(DataSet.fieldbyname('ǩ<><C7A9><EFBFBD>ص<EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('ǩ<><C7A9><EFBFBD>ص㲻<D8B5><E3B2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if trim(DataSet.fieldbyname('<27><>ͷ').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asinteger=0 then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asFloat=0 then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asFloat=0 then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27>ܳ<EFBFBD><DCB3>벻<EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='D' then begin
|
|
|
|
|
if Trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('Σ<><CEA3>Ʒ<EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if Trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if GetStrNum(Trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring))<>4 then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD>ű<EFBFBD><C5B1><EFBFBD><EFBFBD><EFBFBD>4λ<34><CEBB><EFBFBD><EFBFBD>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='R' then begin
|
|
|
|
|
|
|
|
|
|
if Trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD>¶Ȳ<C2B6><C8B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if Trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if Trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD>¶Ȳ<C2B6><C8B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if Trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD>¶Ȳ<C2B6><C8B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
if 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;
|
|
|
|
|
MessageDlg('<27><>װ<EFBFBD>䲻<EFBFBD><E4B2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
t_op_ctn.First;
|
|
|
|
|
while not t_op_ctn.Eof do begin
|
|
|
|
|
if Trim(t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if Trim(t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
t_op_ctn.Next;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_at.CreateEdiFile:TStrings;
|
|
|
|
|
var str,aTempList:TStringlist;
|
|
|
|
|
strType,SenderCode,ReciverCode:string;
|
|
|
|
|
i,k,LineNo:integer;
|
|
|
|
|
begin
|
|
|
|
|
try
|
|
|
|
|
aTempList:=TStringlist.create;
|
|
|
|
|
str:=TStringlist.create;
|
|
|
|
|
|
|
|
|
|
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';
|
|
|
|
|
I:=0;
|
|
|
|
|
if frm_op_seae.dxdbgrid1.SelectedCount<=1 then
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
if not isEditrue(frm_op_seae.t_op_seae) then abort;
|
|
|
|
|
I:=0;
|
|
|
|
|
str.add(Record00(strType,SenderCode,ReciverCode));
|
|
|
|
|
str.add(Record10(frm_op_seae.t_op_seae));
|
|
|
|
|
str.add(Record11(frm_op_seae.t_op_seae,'SJJ'));
|
|
|
|
|
str.add(Record12(frm_op_seae.t_op_seae));
|
|
|
|
|
str.add(Record13(frm_op_seae.t_op_seae));
|
|
|
|
|
str.add(Record16_17_18('16','<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>',frm_op_seae.t_op_seae));
|
|
|
|
|
str.add(Record16_17_18('17','<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>',frm_op_seae.t_op_seae));
|
|
|
|
|
str.add(Record16_17_18('18','֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>',frm_op_seae.t_op_seae));
|
|
|
|
|
str.add(Record41(frm_op_seae.t_op_seae));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
str.add(Record43(frm_op_seae.t_op_seae));
|
|
|
|
|
|
|
|
|
|
aTempList:=Record44_47(35,10,'44','<27><>ͷ',frm_op_seae.t_op_seae);
|
|
|
|
|
str.addstrings(aTempList);
|
|
|
|
|
|
|
|
|
|
aTempList:=Record44_47(70,5,'47','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',frm_op_seae.t_op_seae);
|
|
|
|
|
str.addstrings(aTempList);
|
|
|
|
|
|
|
|
|
|
{ aTempList:=Record51(frm_op_seae.t_op_seae);
|
|
|
|
|
str.addstrings(aTempList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
I:=str.Count;
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
I:=0;
|
|
|
|
|
str.add(Record00(strType,SenderCode,ReciverCode));
|
|
|
|
|
str.add(Record10(frm_op_seae.t_op_seae));
|
|
|
|
|
str.add(Record11(frm_op_seae.t_op_seae,'SJJ'));
|
|
|
|
|
for k:=0 to frm_op_seae.dxdbgrid1.SelectedCount-1 do
|
|
|
|
|
begin
|
|
|
|
|
lineno:=0;
|
|
|
|
|
frm_op_seae.t_op_seae.GotoBookmark(pointer(frm_op_seae.dxdbgrid1.selectedrows[k]));
|
|
|
|
|
if not isEditrue(frm_op_seae.t_op_seae) then abort;
|
|
|
|
|
str.add(Record12(frm_op_seae.t_op_seae));
|
|
|
|
|
str.add(Record13(frm_op_seae.t_op_seae));
|
|
|
|
|
str.add(Record16_17_18('16','<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>',frm_op_seae.t_op_seae));
|
|
|
|
|
str.add(Record16_17_18('17','<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>',frm_op_seae.t_op_seae));
|
|
|
|
|
str.add(Record16_17_18('18','֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>',frm_op_seae.t_op_seae));
|
|
|
|
|
|
|
|
|
|
str.add(Record41(frm_op_seae.t_op_seae));
|
|
|
|
|
|
|
|
|
|
str.add(Record43(frm_op_seae.t_op_seae));
|
|
|
|
|
lineno:=7;
|
|
|
|
|
|
|
|
|
|
aTempList:=Record44_47(35,10,'44','<27><>ͷ',frm_op_seae.t_op_seae);
|
|
|
|
|
str.addstrings(aTempList);
|
|
|
|
|
lineno:=lineno+aTempList.count;
|
|
|
|
|
|
|
|
|
|
aTempList:=Record44_47(70,5,'47','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',frm_op_seae.t_op_seae);
|
|
|
|
|
str.addstrings(aTempList);
|
|
|
|
|
lineno:=lineno+aTempList.count;
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
aTempList:=Record51(frm_op_seae.t_op_seae);
|
|
|
|
|
str.addstrings(aTempList);
|
|
|
|
|
lineno:=lineno+aTempList.count;
|
|
|
|
|
}
|
|
|
|
|
I:=I+lineno;
|
|
|
|
|
end;
|
|
|
|
|
I:=I+3;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
str.Add('99:'+intToStr(i+1)+'''');
|
|
|
|
|
Result:=str;
|
|
|
|
|
freeandnil(aTempList);
|
|
|
|
|
//freeandnil(str);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_at.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:=CreateEdiFile
|
|
|
|
|
else
|
|
|
|
|
StrL:=CreateEdiFile
|
|
|
|
|
else if Pos('<27><>Ʊ',(frm_op_seae.t_op_seae.fieldbyname('װ<>˷<EFBFBD>ʽ').asstring))>0 then
|
|
|
|
|
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','ATSEND',edit1.text);
|
|
|
|
|
inifile1.WriteString('EDI','ATRECIEVE',edit2.text);
|
|
|
|
|
inifile1.WriteString('EDI','ATSENDNAME',edit3.text);
|
|
|
|
|
inifile1.WriteString('EDI','ATFTPSERVER',edit4.text);
|
|
|
|
|
inifile1.WriteString('EDI','ATFTPPATH',edit5.text);
|
|
|
|
|
inifile1.WriteString('EDI','ATFTPNAME',edit6.text);
|
|
|
|
|
inifile1.WriteString('EDI','ATFTPPASS',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_at.bsSkinButton4Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
if frm_op_seae_edi_AT.Height=349 then
|
|
|
|
|
frm_op_seae_edi_AT.Height:=200
|
|
|
|
|
else
|
|
|
|
|
frm_op_seae_edi_AT.Height:=349;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end.
|