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.

1636 lines
46 KiB
Plaintext

11 months ago
unit u_op_seae_edi_PIL;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, BusinessSkinForm, StdCtrls, bsSkinCtrls,inifiles, DB, ADODB,IdFTP,IdFTPCommon;
type
Tfrm_op_seae_edi_PIL = class(TForm)
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
SaveDialog1: TSaveDialog;
Label1: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Label2: TLabel;
bsBusinessSkinForm1: TbsBusinessSkinForm;
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
bskngrpbx1: TbsSkinGroupBox;
lbl1: TLabel;
lbl2: TLabel;
lbl3: TLabel;
lbl4: TLabel;
lbl5: TLabel;
lbl6: TLabel;
edt1: TEdit;
edt2: TEdit;
edt3: TEdit;
edt4: TEdit;
edt5: TEdit;
edt6: TEdit;
bsknrdgrp1: TbsSkinRadioGroup;
btn1: TbsSkinButton;
btn2: TbsSkinButton;
Label3: TLabel;
Edit3: TEdit;
t_op_ctn: TADOQuery;
t_op_ctn1: TDataSource;
Edit4: TEdit;
Label4: TLabel;
Label5: TLabel;
Edit5: TEdit;
procedure FormShow(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure btn1Click(Sender: TObject);
procedure btn2Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function GetStrNum(str:String):integer;
function GetCntrEdi(cntrsize:String):String;
function GetpkgsEdi(pkgs:String):String;
function GetcustEdi(cust:String):String;
function GetlineEdi(aline:String):String;
function isEditrue(DataSet:TDataSet): boolean;
function SPACES(len:integer):String;
function Zeros(len:integer):String;
function EditFieldVlaue(FieldVlaue:string;len:integer):String;
function EditFieldVlaueZeros(FieldVlaue:string;len:integer):String;
function _EditFieldVlaueZeros(FieldVlaue:string;len:integer):String;
function GetvesselEdi(avessel:String):String;
function GetLengthword(var s: String; l: Integer;str:String): String;
procedure GetLengthTString(var sl: TStringList; l: integer);
function GetBookDetail(CorpSName:string):string;
function GetCntSum(BsNo:string):String;
function FreightTerms(FT:string):String;
function FormatFloatPIL(FT:string;i,d:integer):String;
function TemperatureFormat(T:string):String;
function FreferFormat(T:string):String;
function Record00_HEADER:String;
function Record11_VESSELVOYAGE(DataSet:TDataSet):String;
function Record12_BL(DataSet:TDataSet):String;
function Record13_BL(DataSet:TDataSet):String;
function Record16_SHIPPER(DataSet:TDataSet):String;
function Record17_BOOKINGPARTY(DataSet:TDataSet):String;
function Record18_DECIDING(DataSet:TDataSet):String;
function Record21_CONSIGNEE(DataSet:TDataSet):String;
function Record26_Notify(DataSet:TDataSet):String;
function Record41_DETAILS(DataSet:TDataSet;LineNo:string):String;
function Record44_MARKS(DataSet:TDataSet;LineNo:string):Tstringlist;
function Record47_DESCRIPTION(DataSet:TDataSet;LineNo:string):Tstringlist;
function Record47_DESCRIPTION_Line(DataSet:TDataSet;LineNo:string):Tstringlist;
function Record47_QTY(BsNo:string):String;
function Record54_SPECIAL(DataSet:TDataSet;LineNo,Qty:string):String;
function Record99(LineNo:string):String;
function Record44_47(LineNo:string):Tstringlist;
function CreateSIEdiFile:TStrings;
end;
var
frm_op_seae_edi_PIL: Tfrm_op_seae_edi_PIL;
implementation
uses u_op_seae, u_main, my_sys_function, u_data_share;
{$R *.dfm}
function Tfrm_op_seae_edi_PIL.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_PIL.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_PIL.GetlineEdi(aline: String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select Edi<64><69><EFBFBD><EFBFBD> from t_code_trade where <20><><EFBFBD><EFBFBD>='''+aline+'''');
Open;
if IsEmpty then
Result:=''
else
Result:=FieldByName('Edi<64><69><EFBFBD><EFBFBD>').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_edi_PIL.GetStrNum(str:String):integer;
var
i:integer;
begin
result:=0;
if str='' then exit;
for i:=1 to length(Str) do begin
if str[i] in ['0','1','2','3','4','5','6','7','8','9'] then
result:=result+1;
end;
end;
function Tfrm_op_seae_edi_PIL.GetcustEdi(cust: 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_crm_client where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+Cust+'''');
Open;
if not IsEmpty then
result:=fieldbyname('EDI<44><49><EFBFBD><EFBFBD>').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_edi_PIL.isEditrue(DataSet:TDataSet): boolean;
var
cntrs:String;
begin
result:=true;
if bsknrdgrp1.ItemIndex=1 then
begin
if trim(DataSet.fieldbyname('<27><><EFBFBD>յ<EFBFBD><D5B5><EFBFBD>').asstring)='' then
begin
result:=false;
MessageDlg('PIL<49><4C><EFBFBD>յ<EFBFBD><D5B5>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(Edit5.text)='' then
begin
result:=false;
MessageDlg('<27><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if Length(Edit5.text)>35 then
begin
result:=false;
MessageDlg('<27><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2>ܳ<EFBFBD><DCB3><EFBFBD>35<33>ַ<EFBFBD>',mtWarning,[mbOk],0);
exit;
end;
end;
if trim(EDIT1.TEXT)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(EDIT2.TEXT)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD>շ<EFBFBD><D5B7><EFBFBD><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(EDIT3.TEXT)='' then begin
result:=false;
MessageDlg('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD>մ<EFBFBD><D5B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(EDIT4.TEXT)='' 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><><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('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('װ<>۴<EFBFBD><DBB4><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('װ<><D7B0><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD>ص㲻<D8B5><E3B2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('Ŀ<>ĵز<C4B5><D8B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if trim(DataSet.fieldbyname('ǩ<><C7A9><EFBFBD>ص<EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('ǩ<><C7A9><EFBFBD>ص㲻<D8B5><E3B2BB>Ϊ<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><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><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;
if (Pos('.' ,frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)<=0)
or (Pos('.' ,frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)<=0)
or (Pos('.' ,frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)<=0) then
begin
result:=false;
MessageDlg('<27>¶ȸ<C2B6>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EBB2BB>ȷ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˸<EFBFBD>ʽ: -0.10 <20><> +0.10',mtWarning,[mbOk],0);
exit;
end;
if (Pos('+' ,frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)<=0)
and (Pos('-' ,frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)<=0) then
begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD>¶ȸ<C2B6>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EBB2BB>ȷ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˸<EFBFBD>ʽ: -0.10 <20><> +0.10',mtWarning,[mbOk],0);
exit;
end;
if (Pos('+' ,frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)<=0)
and (Pos('-' ,frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)<=0) then
begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD>¶ȸ<C2B6>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EBB2BB>ȷ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˸<EFBFBD>ʽ: -0.10 <20><> +0.10',mtWarning,[mbOk],0);
exit;
end;
if (Pos('+' ,frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)<=0)
and (Pos('-' ,frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)<=0) then
begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD>¶ȸ<C2B6>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EBB2BB>ȷ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˸<EFBFBD>ʽ: -0.10 <20><> +0.10',mtWarning,[mbOk],0);
exit;
end;
end;
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(GetCntrEdi(t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring))='' then begin
result:=false;
MessageDlg('<27><>װ<EFBFBD><D7B0>EDI<44><49><EFBFBD><EFBFBD><EBB2BB><EFBFBD>ڣ<EFBFBD>',mtWarning,[mbOk],0);
exit;
end;
t_op_ctn.Next;
end;
end;
function Tfrm_op_seae_edi_PIL.GetBookDetail(CorpSName:string):string;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
with aQuery do
try
Close;SQL.Clear;
SQL.Add('Select <20><><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD> from t_crm_client where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+CorpSName+'''');
Open;
if IsEmpty then
Result:=''
else
Result:=FieldByName('<27><><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD>').AsString;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_edi_PIL.GetvesselEdi(avessel: String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_code_vessel where Ӣ<>Ĵ<EFBFBD><C4B4><EFBFBD>='''+avessel+'''');
Open;
if IsEmpty then
Result:=''
else
Result:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_edi_PIL.SPACES(len:integer):String;
var i : integer;
begin
result:='';
for i :=0 to len-1 do
begin
if result='' then result:=' ' else result:=result+' ';
end;
end;
function Tfrm_op_seae_edi_PIL.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_PIL.EditFieldVlaue(FieldVlaue:string;len:integer):String;
begin
Result:='';
if Length(FieldVlaue)>=Len then Result:=Copy(FieldVlaue,1,Len) else Result:=FieldVlaue+SPACES(len-Length(FieldVlaue));
end;
function Tfrm_op_seae_edi_PIL.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_PIL._EditFieldVlaueZeros(FieldVlaue:string;len:integer):String;
begin
Result:='';
if Length(FieldVlaue)>=Len then Result:=Copy(FieldVlaue,1,Len) else Result:=FieldVlaue+Zeros(len-Length(FieldVlaue));
end;
function Tfrm_op_seae_edi_PIL.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_PIL.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_PIL.GetCntSum(BsNo:string):String;
var aAdoQuery:TAdoQuery;
begin
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;Sql.Clear;
Sql.Add('select sum(<28><><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD> from t_op_ctn where <20><><EFBFBD><EFBFBD>=:BsNo');
Parameters.ParamByName('BSNO').Value:=BSNO;
Open;First;
if not IsEmpty then result:=fieldbyname('<27><><EFBFBD><EFBFBD>').asstring
else result:='0';
finally
free;
end;
end;
function Tfrm_op_seae_edi_PIL.FreightTerms(FT:string):String;
var s,split :string;
begin
//Y:CY, F:CFS, I:FI, O:FO, D:Door, K:Hook, L:Tackle eg. YY=CY/CY
Result:='YY';
if pos('-',FT)>0 then split:='-' else split:='/';
s:=Copy(FT,1,Pos(split,FT)-1);
if s='CY' then Result:='Y'
else if UpperCase(s)='CFS' then Result:='F'
else if UpperCase(s)='FO' then Result:='O'
else if UpperCase(s)='DOOR' then Result:='D'
else if UpperCase(s)='HOOK' then Result:='K'
else if UpperCase(s)='TACKLE' then Result:='L'
else Result:='Y';
s:=Copy(FT,Pos(split,FT)+1,Length(ft));
if s='CY' then Result:=Result+'Y'
else if UpperCase(s)='CFS' then Result:=Result+'F'
else if UpperCase(s)='FO' then Result:=Result+'O'
else if UpperCase(s)='DOOR' then Result:=Result+'D'
else if UpperCase(s)='HOOK' then Result:=Result+'K'
else if UpperCase(s)='TACKLE' then Result:=Result+'L'
else Result:=Result+'Y';
end;
function Tfrm_op_seae_edi_PIL.FreferFormat(T:string):String;
var s1,s2 : string;
begin
result:='';
if pos('.',T)>0 then
begin
s1:=Copy(T,1,pos('.',T)-1);
while Length(s1)<3 do s1:='0'+s1;
s2:=Copy(T,pos('.',T)+1,Length(T));
while Length(s2)<2 do s2:=s2+'0';
end
else
begin
s1:=T;
while Length(s1)<3 do s1:='0'+s1;
s2:='00';
end;
result:=s1+s2;
end;
function Tfrm_op_seae_edi_PIL.TemperatureFormat(T:string):String;
var s1,s2 : string;
begin
T:=StringReplace(T,'+','0',[rfReplaceAll]);
result:='';
if pos('.',T)>0 then
begin
s1:=Copy(T,2,pos('.',T)-2);
while Length(s1)<2 do s1:='0'+s1;
s2:=Copy(T,pos('.',T)+1,Length(T));
while Length(s2)<2 do s2:=s2+'0';
end
else
begin
s1:=Copy(T,2,Length(T)-1);
while Length(s1)<2 do s1:='0'+s1;
s2:='00';
end;
result:=Copy(T,1,1)+s1+s2;
end;
function Tfrm_op_seae_edi_PIL.FormatFloatPIL(FT:string;i,d:integer):String;
var s1,s2 : string;
begin
result:='';
if pos('.',FT)>0 then
begin
s1:=Copy(FT,1,pos('.',FT)-1);
s1:=EditFieldVlaueZeros(s1,i);
s2:=Copy(FT,pos('.',FT)+1,Length(FT));
s2:=_EditFieldVlaueZeros(s2,d);
end
else
begin
s1:=EditFieldVlaueZeros(FT,i);
s2:='000';
end;
result:=s1+s2;
end;
function Tfrm_op_seae_edi_PIL.Record00_HEADER:String;
var SendCode,ReceiverCode :string;
begin
//9(2)X(3)X(20)X(2)X(8)X(6)9(12)X(1)X(5)X(5)X(4)X(15)X(167)
Result:='00';
Result:=Result+'DOC';
{ case bsknrdgrp1.ItemIndex of
0:Result:=Result+'DOC';
1:Result:=Result+'BKG';
end;
}
Result:=Result+SPACES(20)+SPACES(2); // 123 4
SendCode:=EditFieldVlaue(Edit1.Text,8); //4
Result:=Result+SendCode; //5
Result:=Result+SPACES(6); //6
Result:=Result+GetDatetime(datetimetostr(now),1);//7
Result:=Result+SPACES(1); //8
Result:=Result+'CNTAO'; //9
Result:=Result+'CNTAO'; //10
case bsknrdgrp1.ItemIndex of
0:Result:=Result+'PBK';
1:Result:=Result+'4.01';
end;
Result:=EditFieldVlaue(Result,250);
end;
function Tfrm_op_seae_edi_PIL.Record11_VESSELVOYAGE(DataSet:TDataSet):String;
begin
// 9(2)X(1)X(10)X(20)X(8)9(8)9(8)X(12)9(8)
Result:='11'; //1
Result:=Result+SPACES(1); //2
// Result:=Result+EditFieldVlaue(GetvesselEdi(trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)),10);
Result:=Result+EditFieldVlaue(Copy(trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring),1,3),10); //3
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring),20); //4
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring),8); //5
if DataSet.fieldbyname('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull then
Result:=Result+FormatDateTime('YYYYMMDD',Now)
else Result:=Result+FormatDateTime('YYYYMMDD',DataSet.fieldbyname('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime); //6
if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull then
Result:=Result+SPACES(8)
else Result:=Result+FormatDateTime('YYYYMMDD',DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime); //7
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring),12); //8
if DataSet.fieldbyname('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull then
Result:=Result+FormatDateTime('YYYYMMDD',Now)
else Result:=Result+FormatDateTime('YYYYMMDD',DataSet.fieldbyname('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime); //9
Result:=EditFieldVlaue(Result,250);
end;
function Tfrm_op_seae_edi_PIL.Record12_BL(DataSet:TDataSet):String;
var pc:string;
begin
// 9(2)X(20)X(20)X(20)X(5)X(5)X(5)X(2)X(2)X(2)X(3)
// X(1)X(1)X(1)X(8)X(20)X(20)X(1)X(20)X(20)X(12)X(8)X(3)X(3)X(46)
Result:='12';
case bsknrdgrp1.ItemIndex of
0:Result:=Result+EditFieldVlaue('+',20); //2
1:Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('<27><><EFBFBD>յ<EFBFBD><D5B5><EFBFBD>').asstring),20); //2
end;
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring),20); //3
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring),20); //4
Result:=Result+SPACES(5); //5
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring),5); //6
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring),5); //7
Result:=Result+'FF'; //8
Result:=Result+'PP'; //9
Result:=Result+EditFieldVlaue(FreightTerms(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring),2); //10
Result:=Result+SPACES(3); //11
if DataSet.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring='FREIGHT PREPAID' then
PC:='P'
else PC:='C';
Result:=Result+PC; //12
Result:=Result+'N'; //13
Result:=Result+'N'; //14
if DataSet.fieldbyname('<27>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>').IsNull then
Result:=Result+SPACES(8)
else Result:=Result+FormatDateTime('YYYYMMDD',DataSet.fieldbyname('<27>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>').AsDateTime); //15
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring),20); //16
Result:=Result+SPACES(20); //17
Result:=Result+'F'; //18
Result:=Result+SPACES(20); //19
Result:=Result+SPACES(20); //20
Result:=Result+SPACES(12); //21
if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull then
Result:=Result+SPACES(8) //19
else Result:=Result+FormatDateTime('YYYYMMDD',DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime); //22
Result:=Result+EditFieldVlaue('PI',3); //23
Result:=Result+EditFieldVlaue('PI',3); //24
Result:=EditFieldVlaue(Result,250);
end;
function Tfrm_op_seae_edi_PIL.Record13_BL(DataSet:TDataSet):String;
var s:string;
begin
Result:='13';
Result:=Result+SPACES(3);
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring),5);
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring),5);
Result:=Result+SPACES(5);
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring),5);
Result:=Result+SPACES(20);
Result:=Result+SPACES(10);
Result:=Result+SPACES(45);
Result:=Result+SPACES(5);
Result:=Result+SPACES(5);
Result:=Result+SPACES(5);
s:=Copy(DataSet.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,3,3);
if (s='SSZ')
or (s='BUE')
or (s='MVD')
or (s='PNG')
or (s='NVT')
or (s='RIO') then
Result:=Result+'U'
else Result:=Result+'N';
Result:=EditFieldVlaue(Result,250);
end;
function Tfrm_op_seae_edi_PIL.Record16_SHIPPER(DataSet:TDataSet):String;
var
l,m:integer;
s:string;
sl:Tstringlist;
sl1:Tstringlist;
begin
//9(2)X(3)X(10)X(3)X(4)X(35)X(35)X(35)X(35)X(35)X(17)X(18)X(4)X(5)X(9)
s:='';
sl:=Tstringlist.Create;
sl1:=Tstringlist.Create;
Result:='16';
Result:=Result+SPACES(3);
Result:=Result+SPACES(10);
Result:=Result+SPACES(3);
Result:=Result+SPACES(4);
sl1.Text:=DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').AsString;
GetLengthTString(sl1,35);
sl.text:='';
for L:=0 to sl1.Count-1 do
begin
if Trim(sl1.Strings[L])<>'' then
begin
sl.Add(EditFieldVlaue(sl1.Strings[L],35));
end;
end;
for L:=0 to sl.Count-1 do
begin
if L<=5 then
begin
s:=s+sl.Strings[L];
end
end;
Result:=Result+s;
Result:=EditFieldVlaue(Result,250);
sl.Free;
sl1.Free;
end;
function Tfrm_op_seae_edi_PIL.Record17_BOOKINGPARTY(DataSet:TDataSet):String;
var
l,m:integer;
s:string;
sl:Tstringlist;
sl1:Tstringlist;
begin
//9(2)X(3)X(10)X(3)X(4)X(35)X(35)X(35)X(35)X(35)X(17)X(18)X(4)X(5)X(9)
s:='';
sl:=Tstringlist.Create;
sl1:=Tstringlist.Create;
Result:='17';
Result:=Result+SPACES(3);
if DataSet.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring='FREIGHT PREPAID' then
Result:=Result+EditFieldVlaue(Edit3.Text,10)
else Result:=Result+EditFieldVlaue(Edit4.Text,10);
case bsknrdgrp1.ItemIndex of
0:Result:=Result+SPACES(3);
else Result:=Result+'001';
end;
Result:=Result+SPACES(4);
case bsknrdgrp1.ItemIndex of
0:Result:=Result+SPACES(35);
else Result:=Result+EditFieldVlaue(Edit5.Text,35);
end;
{
sl1.Text:=Edit3.Text;
// GetBookDetail(DataSet.fieldbyname('<27><><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
begin
sl.Add(EditFieldVlaue(sl1.Strings[L],35));
end;
end;
for L:=0 to sl.Count-1 do
begin
if L<=5 then
begin
s:=s+sl.Strings[L];
end
end;
Result:=Result+s;
}
Result:=EditFieldVlaue(Result,250);
sl.Free;
sl1.Free;
end;
function Tfrm_op_seae_edi_PIL.Record18_DECIDING(DataSet:TDataSet):String;
var
l,m:integer;
s:string;
sl:Tstringlist;
sl1:Tstringlist;
begin
//9(2)X(3)X(10)X(3)X(4)X(35)X(35)X(35)X(35)X(35)X(17)X(18)X(4)X(5)X(9)
s:='';
sl:=Tstringlist.Create;
sl1:=Tstringlist.Create;
Result:='18';
Result:=Result+SPACES(3);
if DataSet.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring='FREIGHT PREPAID' then
Result:=Result+EditFieldVlaue(Edit3.Text,10)
else Result:=Result+EditFieldVlaue(Edit4.Text,10);
case bsknrdgrp1.ItemIndex of
0:Result:=Result+SPACES(3);
else Result:=Result+'001';
end;
Result:=Result+SPACES(1);
sl1.Text:=DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').AsString;
GetLengthTString(sl1,35);
sl.text:='';
for L:=0 to sl1.Count-1 do
begin
if Trim(sl1.Strings[L])<>'' then
begin
sl.Add(EditFieldVlaue(sl1.Strings[L],35));
end;
end;
for L:=0 to sl.Count-1 do
begin
if L<=5 then
begin
s:=s+sl.Strings[L];
end
end;
Result:=Result+s;
Result:=EditFieldVlaue(Result,250);
sl.Free;
sl1.Free;
end;
function Tfrm_op_seae_edi_PIL.Record21_CONSIGNEE(DataSet:TDataSet):String;
var
l,m:integer;
s:string;
sl:Tstringlist;
sl1:Tstringlist;
begin
//9(2)X(3)X(10)X(3)X(4)X(35)X(35)X(35)X(35)X(35)X(17)X(18)X(4)X(5)X(9)
s:='';
sl:=Tstringlist.Create;
sl1:=Tstringlist.Create;
Result:='21';
Result:=Result+SPACES(3);
Result:=Result+SPACES(10);
Result:=Result+SPACES(3);
Result:=Result+SPACES(4);
sl1.Text:=DataSet.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').AsString;
GetLengthTString(sl1,35);
sl.text:='';
for L:=0 to sl1.Count-1 do
begin
if Trim(sl1.Strings[L])<>'' then
begin
sl.Add(EditFieldVlaue(sl1.Strings[L],35));
end;
end;
for L:=0 to sl.Count-1 do
begin
if L<=5 then
begin
s:=s+sl.Strings[L];
end
end;
Result:=Result+s;
Result:=EditFieldVlaue(Result,250);
sl.Free;
sl1.Free;
end;
function Tfrm_op_seae_edi_PIL.Record26_Notify(DataSet:TDataSet):String;
var
l,m:integer;
s:string;
sl:Tstringlist;
sl1:Tstringlist;
begin
//9(2)X(2)9(1)X(10)X(3)X(4)X(35)X(35)X(35)X(35)X(35)X(17)X(18)X(4)X(5)X(9)
s:='';
sl:=Tstringlist.Create;
sl1:=Tstringlist.Create;
Result:='26';
Result:=Result+SPACES(2);
Result:=Result+'1';
Result:=Result+SPACES(10);
Result:=Result+SPACES(3);
Result:=Result+SPACES(4);
sl1.Text:=DataSet.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').AsString;
GetLengthTString(sl1,35);
sl.text:='';
for L:=0 to sl1.Count-1 do
begin
if Trim(sl1.Strings[L])<>'' then
begin
sl.Add(EditFieldVlaue(sl1.Strings[L],35));
end;
end;
for L:=0 to sl.Count-1 do
begin
if L<=5 then
begin
s:=s+sl.Strings[L];
end
end;
Result:=Result+s;
Result:=EditFieldVlaue(Result,250);
sl.Free;
sl1.Free;
end;
function Tfrm_op_seae_edi_PIL.Record44_47(Lineno:string):Tstringlist;
var LineHeads:string;
begin
if result=nil then result:=Tstringlist.Create
else result.Clear;
try
LineHeads:='44';
LineHeads:=LineHeads+SPACES(3);
LineHeads:=LineHeads+EditFieldVlaueZeros(LineNo,3);
result.Add(EditFieldVlaue(LineHeads,250));
LineHeads:='47';
LineHeads:=LineHeads+SPACES(3);
LineHeads:=LineHeads+EditFieldVlaueZeros(LineNo,3);
result.Add(EditFieldVlaue(LineHeads,250));
finally
end;
end;
function Tfrm_op_seae_edi_PIL.Record41_DETAILS(DataSet:TDataSet;LineNo:string):String;
var l,m:integer;
GoodsNo:string;
aAdoQuery:TAdoQuery;
begin
//9(2)X(3)9(3)X(9)X(1)9(6)9(4)9(8)v9999(8)v9999(7)v9999(7)v999X(48)X(4)X(4)X(3)X(3)X(1)X(117)
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;Sql.Clear;
Sql.Add('select <20><><EFBFBD><EFBFBD> from t_Code_Goods where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
Open;
if not IsEmpty then GoodsNo:=Fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
finally
free;
end;
Result:='41';
Result:=Result+SPACES(3);
Result:=Result+EditFieldVlaueZeros(LineNo,3);
Result:=Result+EditFieldVlaue(GoodsNo,9);
Result:=Result+'Y';
Result:=Result+EditFieldVlaueZeros(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,6);
Result:=Result+EditFieldVlaueZeros(DataSet.fieldbyname('TEU').AsString,4);
Result:=Result+FormatFloatPIL(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,8,3);
Result:=Result+FormatFloatPIL(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,8,3);
Result:=Result+FormatFloatPIL(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,7,3);
Result:=Result+FormatFloatPIL(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,7,3);
Result:=Result+SPACES(48);
Result:=Result+EditFieldVlaue(GoodsNo,4);
Result:=Result+EditFieldVlaue(DataSet.fieldbyname('<27>ߴ<EFBFBD>').AsString+DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,4); //<2F><><EFBFBD><EFBFBD>
Result:=Result+'KGM';
Result:=Result+'MTQ';
if frm_op_seae.t_op_seae.fieldbyname('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull
then Result:=Result+'N'
else
if strtobool(frm_op_seae.t_op_seae.fieldbyname('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value)
then Result:=Result+'Y'
else Result:=Result+'N';
Result:=EditFieldVlaue(Result,250);
end;
function Tfrm_op_seae_edi_PIL.Record44_MARKS(DataSet:TDataSet;LineNo:string):Tstringlist;
var
l,m:integer;
s,LineHeads:string;
str:Tstringlist;
sl:Tstringlist;
sl1:Tstringlist;
begin
//9(2)X(3)X(10)X(3)X(4)X(35)X(35)X(35)X(35)X(35)X(17)X(18)X(4)X(5)X(9)
s:='';
if result=nil then result:=Tstringlist.Create
else result.Clear;
str:=Tstringlist.Create;
sl:=Tstringlist.Create;
sl1:=Tstringlist.Create;
try
LineHeads:='44';
LineHeads:=LineHeads+SPACES(3);
LineHeads:=LineHeads+EditFieldVlaueZeros(LineNo,3);
sl1.Text:=DataSet.fieldbyname('<27><>ͷ').AsString;
GetLengthTString(sl1,20);
sl.text:='';
for L:=0 to sl1.Count-1 do
begin
if Trim(sl1.Strings[L])<>'' then
sl.Add(EditFieldVlaue(sl1.Strings[L],20));
end;
M:=1;
for L:=0 to sl.Count-1 do
begin
if M<=12 then
begin
if M=1 then
begin
s:=sl.Strings[L];
end
else
begin
if M=12 then
begin
s:=s+sl.Strings[L];
end
else s:=s+sl.Strings[L];
end;
end
else
begin
// Str.Add(LineHeads+S);
Str.Add(EditFieldVlaue(LineHeads+S,250));
M:=1;
s:=sl.Strings[L];
end;
M:=M+1;
end;
// Str.Add(LineHeads+S);
Str.Add(EditFieldVlaue(LineHeads+S,250));
result.AddStrings(str);
finally
str.Free;
sl.Free;
sl1.Free;
end;
end;
function Tfrm_op_seae_edi_PIL.Record47_QTY(BSNO:string):String;
begin
Result:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring;
Result:='47'+SPACES(3)+'001'+Result;
Result:=EditFieldVlaue(Result,250);
end;
{
function Tfrm_op_seae_edi_PIL.Record47_QTY(BSNO:string):String;
var aAdoQuery:TAdoQuery;
begin
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;Sql.Clear;
Sql.Add('select <20><>װ,sum(<28><><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD> from t_op_ctn where <20><><EFBFBD><EFBFBD>=:BsNo');
Sql.Add('Group by <20><>װ');
Parameters.ParamByName('BSNO').Value:=BSNO;
Open;First;
while not Eof do
begin
if Result='' then
Result:=fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+fieldbyname('<27><>װ').asstring
else Result:=Result+fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+fieldbyname('<27><>װ').asstring;
Next;
end;
finally
free;
end;
Result:='47'+SPACES(3)+'001'+Result;
Result:=EditFieldVlaue(Result,250);
end;
}
function Tfrm_op_seae_edi_PIL.Record47_DESCRIPTION(DataSet:TDataSet;LineNo:string):Tstringlist;
var
i,j,l,m,c:integer;
s,LineHeads:string;
str:Tstringlist;
sl:Tstringlist;
begin
//9(2)X(3)X(10)X(3)X(4)X(35)X(35)X(35)X(35)X(35)X(17)X(18)X(4)X(5)X(9)
s:='';
if result=nil then result:=Tstringlist.Create
else result.Clear;
str:=Tstringlist.Create;
sl:=Tstringlist.Create;
sl.Text:=DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
GetLengthTString(sl,30);
c:=Trunc(sl.Count/8)+1;
try
for i:=1 to c do
begin
s:='';
LineHeads:='47';
LineHeads:=LineHeads+SPACES(3);
LineHeads:=LineHeads+EditFieldVlaueZeros(LineNo,3);
for j:=1 to 8 do
begin
if (i-1)*8+j<=sl.Count then
s:=s+EditFieldVlaue(sl.Strings[(i-1)*8+j-1],30);
end;
if Trim(s)<>'' then
result.Add(EditFieldVlaue(LineHeads+s,250));
end;
finally
str.Free;
sl.Free;
end;
end;
function Tfrm_op_seae_edi_PIL.Record47_DESCRIPTION_Line(DataSet:TDataSet;LineNo:string):Tstringlist;
var
l,m:integer;
s,LineHeads:string;
str:Tstringlist;
sl:Tstringlist;
sl1:Tstringlist;
begin
//9(2)X(3)X(10)X(3)X(4)X(35)X(35)X(35)X(35)X(35)X(17)X(18)X(4)X(5)X(9)
s:='';
if result=nil then result:=Tstringlist.Create
else result.Clear;
str:=Tstringlist.Create;
sl:=Tstringlist.Create;
sl1:=Tstringlist.Create;
try
LineHeads:='47';
LineHeads:=LineHeads+SPACES(3);
LineHeads:=LineHeads+EditFieldVlaueZeros(LineNo,3);
sl1.Text:=DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
GetLengthTString(sl1,30);
sl.text:='';
for L:=0 to sl1.Count-1 do
begin
if Trim(sl1.Strings[L])<>'' then
sl.Add(EditFieldVlaue(sl1.Strings[L],30));
end;
M:=1;
for L:=0 to sl.Count-1 do
begin
if M<=12 then
begin
if M=1 then
begin
s:=sl.Strings[L];
end
else
begin
if M=12 then
begin
s:=s+sl.Strings[L];
end else s:=s+sl.Strings[L];
end;
end
else
begin
M:=1;
Str.Add(EditFieldVlaue(LineHeads+S,250));
s:=sl.Strings[L];
end;
M:=M+1;
end;
// Str.Add(LineHeads+S);
Str.Add(EditFieldVlaue(LineHeads+S,250));
result.AddStrings(str);
finally
str.Free;
sl.Free;
sl1.Free;
end;
end;
function Tfrm_op_seae_edi_PIL.Record54_SPECIAL(DataSet:TDataSet;LineNo,Qty:string):String;
begin
//9(2) X(3) 9(3) 9(3) X(1) 9(3) v999(3) v999(3) v99X(1)9(3)v99X(1)9(3)v99X(1)X(210)
result:='54'; //12
result:=result+SPACES(3); //345
result:=result+EditFieldVlaueZeros(LineNo,3); //678
result:=result+EditFieldVlaueZeros(Qty,3); //9 10 11
result:=result+'C'; //12
result:=result+SPACES(5); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //13 14 15 16 1 7
result:=result+SPACES(5); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // 18 19 20 21 22
{
result:=result+TemperatureFormat(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
result:=result+TemperatureFormat(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
}
result:=result+TemperatureFormat(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString); // 23 24 25 26 27
result:=result+'N'; //28
if Trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>').AsString)<>'' then
result:=result+FreferFormat(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>').AsString)
else result:=result+EditFieldVlaue(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>').AsString,5); //29 30 31 32 33
result:=result+'Y'; //34
result:=result+TemperatureFormat(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString); // 35 36 37 38 39
If Trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>').AsString)<>'' then
result:=result+'H'
else result:=result+'C'; //40
Result:=EditFieldVlaue(Result,250);
end;
function Tfrm_op_seae_edi_PIL.Record99(LineNo:string):String;
begin
//9(2)X(3)9(6)X(239)
result:='99';
result:=result+SPACES(3);
result:=result+EditFieldVlaueZeros(LineNo,6);
Result:=EditFieldVlaue(Result,250);
end;
procedure Tfrm_op_seae_edi_PIL.FormShow(Sender: TObject);
var
inifile1:Tinifile;
begin
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
edit1.text:=inifile1.ReadString('PILEDI','SENDCODE','');
edit2.text:=inifile1.ReadString('PILEDI','RECIEVECODE','');
edit3.text:=inifile1.ReadString('PILEDI','BOOKAGENT','');
edit4.text:=inifile1.ReadString('PILEDI','BOOKAGENTCC','');
edit5.text:=inifile1.ReadString('PILEDI','BOOKAGENTNAME','');
edt1.text:=inifile1.ReadString('PILEDI','FTPSERVER','');
edt2.text:=inifile1.ReadString('PILEDI','FTPPATH','/');
edt3.text:=inifile1.ReadString('PILEDI','FTPNAME','');
edt4.text:=inifile1.ReadString('PILEDI','FTPPASS','');
edt5.text:=inifile1.ReadString('PILEDI','ESINAME','');
edt6.text:=inifile1.ReadString('PILEDI','ESIPASS','');
inifile1.free;
end;
procedure Tfrm_op_seae_edi_PIL.bsSkinButton2Click(Sender: TObject);
begin
close;
end;
function Tfrm_op_seae_edi_PIL.CreateSIEdiFile:TStrings;
var
k,LineNo,qty,i:integer;
str:Tstringlist;
inifile1:Tinifile;
aAdoQuery:TAdoQuery;
begin
str:=Tstringlist.Create;
if frm_op_seae.dxdbgrid1.SelectedCount<=1 then
begin
str.Add(Record00_HEADER);
str.Add(Record11_VESSELVOYAGE(frm_op_seae.t_op_seae));
str.Add(Record12_BL(frm_op_seae.t_op_seae));
str.Add(Record13_BL(frm_op_seae.t_op_seae));
str.Add(Record16_SHIPPER(frm_op_seae.t_op_seae));
str.Add(Record17_BOOKINGPARTY(frm_op_seae.t_op_seae));
str.Add(Record18_DECIDING(frm_op_seae.t_op_seae));
str.Add(Record21_CONSIGNEE(frm_op_seae.t_op_seae));
str.Add(Record26_Notify(frm_op_seae.t_op_seae));
LineNo:=1;
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;Sql.Clear;
Sql.Add('select <20><><EFBFBD><EFBFBD>,<2C>ߴ<EFBFBD>,<2C><><EFBFBD><EFBFBD>,Sum(<28><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,Sum(<28><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,Sum(<28><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,Sum(TEU) TEU from t_op_ctn where <20><><EFBFBD><EFBFBD>=:BsNo');
Sql.Add('Group by <20><><EFBFBD><EFBFBD>,<2C>ߴ<EFBFBD>,<2C><><EFBFBD><EFBFBD>');
Parameters.ParamByName('BSNO').Value:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
Open;First;
while not Eof do
begin
qty:=fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger;
str.Add(Record41_DETAILS(TDataSet(aAdoQuery),IntToStr(LineNo)));
str.AddStrings(Record44_MARKS(frm_op_seae.t_op_seae,IntToStr(LineNo)));
if LineNo =1 then
str.Add(Record47_QTY(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring));
str.AddStrings(Record47_DESCRIPTION(frm_op_seae.t_op_seae,IntToStr(LineNo)));
if frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring='R' then
for i:=1 to qty do
str.Add(Record54_SPECIAL(frm_op_seae.t_op_seae,IntToStr(LineNo),IntToStr(i)));
Next;
LineNo:=LineNo+1;
end;
finally
free;
end;
end
else
begin
str.Add(Record00_HEADER);
str.Add(Record11_VESSELVOYAGE(frm_op_seae.t_op_seae));
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(Record12_BL(frm_op_seae.t_op_seae));
str.Add(Record13_BL(frm_op_seae.t_op_seae));
str.Add(Record16_SHIPPER(frm_op_seae.t_op_seae));
str.Add(Record17_BOOKINGPARTY(frm_op_seae.t_op_seae));
str.Add(Record18_DECIDING(frm_op_seae.t_op_seae));
str.Add(Record21_CONSIGNEE(frm_op_seae.t_op_seae));
str.Add(Record26_Notify(frm_op_seae.t_op_seae));
LineNo:=1;
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;Sql.Clear;
Sql.Add('select <20><><EFBFBD><EFBFBD>,<2C>ߴ<EFBFBD>,<2C><><EFBFBD><EFBFBD>,Sum(<28><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,Sum(<28><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,Sum(TEU) TEU from t_op_ctn where <20><><EFBFBD><EFBFBD>=:BsNo');
Sql.Add('Group by <20><><EFBFBD><EFBFBD>,<2C>ߴ<EFBFBD>,<2C><><EFBFBD><EFBFBD>');
Parameters.ParamByName('BSNO').Value:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
Open;First;
while not Eof do
begin
qty:=fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger;
if LineNo =1 then
str.Add(Record47_QTY(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring));
str.AddStrings(Record47_DESCRIPTION(frm_op_seae.t_op_seae,IntToStr(LineNo)));
if frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring='R' then
for i:=1 to qty do
str.Add(Record54_SPECIAL(frm_op_seae.t_op_seae,IntToStr(LineNo),IntToStr(i)));
Next;
LineNo:=LineNo+1;
end;
finally
free;
end;
str.AddStrings(Record44_MARKS(frm_op_seae.t_op_seae,'1'));
str.Add(Record47_QTY(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring));
str.AddStrings(Record47_DESCRIPTION(frm_op_seae.t_op_seae,'1'));
if frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring='R' then
// str.Add(Record54_SPECIAL(frm_op_seae.t_op_seae,'001'));
end;
end;
str.Add(Record99(IntToStr(frm_op_seae.dxdbgrid1.SelectedCount)));
result:=str;
end;
procedure Tfrm_op_seae_edi_PIL.btn1Click(Sender: TObject);
var
IdFTP1:TIdFTP;
str:widestring;
str_file:widestring;
ftpar,ftpname,ftppass,ftppath,ScriptPath:String;
StrL:TStrings;
inifile1:Tinifile;
i:integer;
begin
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
inifile1.WriteString('PILEDI','SENDCODE',edit1.text);
inifile1.WriteString('PILEDI','RECIEVECODE',edit2.text);
inifile1.WriteString('PILEDI','BOOKAGENT',edit3.text);
inifile1.WriteString('PILEDI','BOOKAGENTCC',edit4.text);
inifile1.WriteString('PILEDI','BOOKAGENTNAME',edit5.text);
inifile1.WriteString('PILEDI','FTPSERVER',edt1.text);
inifile1.WriteString('PILEDI','FTPPATH',edt2.text);
inifile1.WriteString('PILEDI','FTPNAME',edt3.text);
inifile1.WriteString('PILEDI','FTPPASS',edt4.text);
inifile1.WriteString('PILEDI','ESINAME',edt5.text);
inifile1.WriteString('PILEDI','ESIPASS',edt6.text);
inifile1.free;
ScriptPath:=ExtractFilePath(ParamStr(0))+'EDIFILE\';
if not DirectoryExists(ScriptPath) then
CreateDir(ScriptPath);
ftpar:=Trim(edt1.Text);
if ftpar='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FTP<54><50>ַ<EFBFBD><D6B7>',mtWarning,[mbOk],0);
exit;
end;
if bsknrdgrp1.ItemIndex=1 then begin
ftpname:=Trim(edt3.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(edt4.Text);
if ftpar='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FTP<54><50><EFBFBD>룡',mtWarning,[mbOk],0);
exit;
end;
end else begin
ftpname:=Trim(edt5.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(edt6.Text);
if ftpar='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FTP<54><50><EFBFBD>룡',mtWarning,[mbOk],0);
exit;
end;
if Trim(edit3.text)='' then begin
MessageDlg('<27><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if Trim(edit4.text)='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>մ<EFBFBD><D5B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
end;
ftppath:=Trim(edt2.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
StrL:=CreateSIEdiFile;
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;
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_PIL.btn2Click(Sender: TObject);
begin
if frm_op_seae_edi_PIL.Height=293 then
frm_op_seae_edi_PIL.Height:=158
else
frm_op_seae_edi_PIL.Height:=293;
end;
procedure Tfrm_op_seae_edi_PIL.bsSkinButton1Click(Sender: TObject);
var
Str:TStrings;
inifile1:Tinifile;
i:integer;
begin
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
inifile1.WriteString('PILEDI','SENDCODE',edit1.text);
inifile1.WriteString('PILEDI','RECIEVECODE',edit2.text);
inifile1.WriteString('PILEDI','BOOKAGENT',edit3.text);
inifile1.WriteString('PILEDI','BOOKAGENTCC',edit4.text);
inifile1.WriteString('PILEDI','FTPSERVER',edt1.text);
inifile1.WriteString('PILEDI','FTPPATH',edt2.text);
inifile1.WriteString('PILEDI','FTPNAME',edt3.text);
inifile1.WriteString('PILEDI','FTPPASS',edt4.text);
inifile1.WriteString('PILEDI','ESINAME',edt5.text);
inifile1.WriteString('PILEDI','ESIPASS',edt6.text);
inifile1.free;
if not isEditrue(frm_op_seae.t_op_seae) then exit;
str:=Tstringlist.Create;
Str:=CreateSIEdiFile;
try
for i:=0 to Str.Count-1 do
begin
if IsZhongwen(Str[i])<>'' then
begin
ShowMessage('<27><>Ʊҵ<C6B1><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>,<2C><><EFBFBD>ܼ<EFBFBD><DCBC><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD>'+#13#10+Str[i]);
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+'.pms');
showmessage('<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ɳɹ<C9B3><C9B9><EFBFBD>');
end
else
begin
showmessage('<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
exit;
end;
finally
FreeAndNil(Str);
end;
close;
end;
end.