|
|
|
|
unit u_op_seae_edi_zxd;
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
Dialogs, BusinessSkinForm, bsSkinCtrls, StdCtrls,inifiles, DB, ADODB,IdFTP,IdFTPCommon,
|
|
|
|
|
ExtCtrls, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, dxDBTLCl,
|
|
|
|
|
dxGrClms;
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
|
|
|
|
TCarrier = Record //<2F><>Ϣ<EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ṹ
|
|
|
|
|
EdiNo :String;
|
|
|
|
|
CarrierName :String;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
Tfrm_op_seae_edi_zxd = class(TForm)
|
|
|
|
|
bsBusinessSkinForm1: TbsBusinessSkinForm;
|
|
|
|
|
SaveDialog1: TSaveDialog;
|
|
|
|
|
t_op_ctn: TADOQuery;
|
|
|
|
|
Label5: TLabel;
|
|
|
|
|
Label6: TLabel;
|
|
|
|
|
Label7: TLabel;
|
|
|
|
|
Edit5: TEdit;
|
|
|
|
|
Edit6: TEdit;
|
|
|
|
|
Edit7: TEdit;
|
|
|
|
|
bsSkinButton3: TbsSkinButton;
|
|
|
|
|
bsSkinButton4: TbsSkinButton;
|
|
|
|
|
GroupBox1: TGroupBox;
|
|
|
|
|
Label8: TLabel;
|
|
|
|
|
Edit8: TEdit;
|
|
|
|
|
Edit9: TEdit;
|
|
|
|
|
Edit10: TEdit;
|
|
|
|
|
Label9: TLabel;
|
|
|
|
|
Label10: TLabel;
|
|
|
|
|
Edit11: TEdit;
|
|
|
|
|
Label11: TLabel;
|
|
|
|
|
t_op_edi: TADOQuery;
|
|
|
|
|
Label12: TLabel;
|
|
|
|
|
Edit12: TEdit;
|
|
|
|
|
bsck: TbsSkinCheckRadioBox;
|
|
|
|
|
t_op_edictn: TADOQuery;
|
|
|
|
|
Panel1: TPanel;
|
|
|
|
|
Label2: TLabel;
|
|
|
|
|
Label1: TLabel;
|
|
|
|
|
Label3: TLabel;
|
|
|
|
|
Label4: TLabel;
|
|
|
|
|
Edit2: TEdit;
|
|
|
|
|
Edit1: TEdit;
|
|
|
|
|
bsSkinButton1: TbsSkinButton;
|
|
|
|
|
bsSkinButton2: TbsSkinButton;
|
|
|
|
|
Edit3: TEdit;
|
|
|
|
|
Edit4: TEdit;
|
|
|
|
|
RadioGroup1: TRadioGroup;
|
|
|
|
|
RadioGroup3: TRadioGroup;
|
|
|
|
|
dxDBGrid1: TdxDBGrid;
|
|
|
|
|
t_op_ctn1: TDataSource;
|
|
|
|
|
dxDBGrid1Column2: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1Column3: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1Column4: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1Column5: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1Column6: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1Column7: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1Column8: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1Column1: TdxDBGridCheckColumn;
|
|
|
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
|
|
|
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function get_txtBooking(str:Tstringlist):integer;
|
|
|
|
|
function get_goods(str:widestring):widestring;
|
|
|
|
|
procedure bsSkinButton3Click(Sender: TObject);
|
|
|
|
|
|
|
|
|
|
function isEditrue(DataSet:TDataSet):boolean;
|
|
|
|
|
|
|
|
|
|
function Changestr(str:widestring):string;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function GetLengthword(var s: String; l: Integer;str:String): String;
|
|
|
|
|
procedure GetLengthTString(var sl:TStringList;l:integer);
|
|
|
|
|
function GetStrNum(str:String):integer;
|
|
|
|
|
function GetCharNum(str:String):integer;
|
|
|
|
|
procedure bsSkinButton4Click(Sender: TObject);
|
|
|
|
|
|
|
|
|
|
function GetvesselEdi(avessel: String): String;
|
|
|
|
|
|
|
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
|
|
procedure FormCreate(Sender: TObject);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
{ Private declarations }
|
|
|
|
|
public
|
|
|
|
|
{ Public declarations }
|
|
|
|
|
aCarrier:TCarrier;
|
|
|
|
|
SelectCarrier:Boolean;
|
|
|
|
|
function FormatEdiString(old:String;Strlength:integer):String;
|
|
|
|
|
function GetpkgsEdi(pkgs:String):String;
|
|
|
|
|
function GetShipEdiNO(Ship:String): String;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
frm_op_seae_edi_zxd: Tfrm_op_seae_edi_zxd;
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
uses u_op_seae, my_sys_function, u_main, u_data_share, u_op_seae_assistant;
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_zxd.GetShipEdiNO(Ship:String): String;
|
|
|
|
|
var
|
|
|
|
|
aQuery:TADOQuery;
|
|
|
|
|
begin
|
|
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
|
|
try
|
|
|
|
|
with aQuery do begin
|
|
|
|
|
Close;SQL.Clear;
|
|
|
|
|
SQL.Add('Select <20><><EFBFBD><EFBFBD>,EDI<44><49><EFBFBD><EFBFBD>,<2C>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,<2C>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,¼<><C2BC><EFBFBD><EFBFBD>,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_crm_client');
|
|
|
|
|
SQL.Add('where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+Ship+'''');
|
|
|
|
|
SQL.Add('order by <20><><EFBFBD><EFBFBD>');
|
|
|
|
|
Open;
|
|
|
|
|
if not IsEmpty then
|
|
|
|
|
Result:=Trim(FieldByName('<27><><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
else
|
|
|
|
|
Result:='';
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(aQuery);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_zxd.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_zxd.FormatEdiString(old:String;Strlength:integer):String;
|
|
|
|
|
var
|
|
|
|
|
i:integer;
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
Result:=Trim(Old);
|
|
|
|
|
Result:=StringReplace(Result,'?','??',[rfReplaceAll]);
|
|
|
|
|
Result:=StringReplace(Result,':','?:',[rfReplaceAll]);
|
|
|
|
|
Result:=StringReplace(Result,'''','?''',[rfReplaceAll]);
|
|
|
|
|
Result:=StringReplace(Result,'+','?+',[rfReplaceAll]);
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_zxd.GetvesselEdi(avessel: String): String;
|
|
|
|
|
var
|
|
|
|
|
aQuery:TADOQuery;
|
|
|
|
|
begin
|
|
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
|
|
try
|
|
|
|
|
with aQuery do begin
|
|
|
|
|
Close;SQL.Clear;
|
|
|
|
|
SQL.Add('Select <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_zxd.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><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>').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><>վ').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><>վ<EFBFBD><D5BE><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if trim(DataSet.fieldbyname('<27><>װ').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if trim(DataSet.fieldbyname('<27><>ͷ').asstring)='' then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asinteger=0 then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asFloat=0 then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asFloat=0 then begin
|
|
|
|
|
result:=false;
|
|
|
|
|
MessageDlg('<27>ܳ<EFBFBD><DCB3>벻<EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_zxd.get_goods(str:widestring):widestring;
|
|
|
|
|
var
|
|
|
|
|
str_all:Tstringlist;
|
|
|
|
|
r_str:widestring;
|
|
|
|
|
i:integer;
|
|
|
|
|
begin
|
|
|
|
|
str:=Changestr(trim(str));
|
|
|
|
|
str_all:=Tstringlist.Create;
|
|
|
|
|
str_all.Text:=str;
|
|
|
|
|
for i:=0 to str_all.Count-1 do
|
|
|
|
|
begin
|
|
|
|
|
r_str:=r_str+' '+str_all[i];
|
|
|
|
|
end;
|
|
|
|
|
result:=trim(r_str);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_zxd.Changestr(str:widestring):string;
|
|
|
|
|
var
|
|
|
|
|
i:integer;
|
|
|
|
|
strC:widestring;
|
|
|
|
|
begin
|
|
|
|
|
strC:='';
|
|
|
|
|
for i:=1 to length(str) do
|
|
|
|
|
begin
|
|
|
|
|
if ((str[i]=#39) or (str[i]=':') or (str[i]='''') or (str[i]='+') or (str[i]='?')) then
|
|
|
|
|
begin
|
|
|
|
|
strC:=strC+'?'+str[i];
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
strC:=strC+str[i];
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
result:=strC;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_zxd.GetLengthword(var s: String; l: Integer;str:String): String;
|
|
|
|
|
var
|
|
|
|
|
i:Integer;
|
|
|
|
|
b:Boolean;
|
|
|
|
|
begin
|
|
|
|
|
s:='';
|
|
|
|
|
if Length(str)<=l then begin
|
|
|
|
|
result:=str;
|
|
|
|
|
end else begin
|
|
|
|
|
b:=true;
|
|
|
|
|
s:=Copy(str,l+1,Length(str)-l);
|
|
|
|
|
str:=Copy(str,1,l);
|
|
|
|
|
result:='';
|
|
|
|
|
for i:=Length(str) downto 1 do begin
|
|
|
|
|
if (str[i]<>' ') and b then
|
|
|
|
|
s:=str[i]+s
|
|
|
|
|
else begin
|
|
|
|
|
b:=false;
|
|
|
|
|
result:=str[i]+Result;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
s:=s+' ';
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
procedure Tfrm_op_seae_edi_zxd.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_zxd.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_zxd.GetCharNum(str:String):integer;
|
|
|
|
|
var
|
|
|
|
|
i:integer;
|
|
|
|
|
begin
|
|
|
|
|
result:=0;
|
|
|
|
|
if str='' then exit;
|
|
|
|
|
for i:=1 to length(Str) do begin
|
|
|
|
|
if str[i] in ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'] then
|
|
|
|
|
result:=result+1;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Tfrm_op_seae_edi_zxd.get_txtBooking(str:Tstringlist):integer;
|
|
|
|
|
var
|
|
|
|
|
str_all,sl,sl1:Tstringlist;
|
|
|
|
|
l,count,m:integer;
|
|
|
|
|
FILEFUNCTION,s:string;
|
|
|
|
|
Qty:integer;
|
|
|
|
|
pkg,cmb:double;
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if RadioGroup3.ItemIndex=0 then
|
|
|
|
|
FILEFUNCTION:='9' //9ԭʼ 5 <20><><EFBFBD><EFBFBD>
|
|
|
|
|
else FILEFUNCTION:='4;';
|
|
|
|
|
|
|
|
|
|
Qty:=0;
|
|
|
|
|
pkg:=0;
|
|
|
|
|
cmb:=0;
|
|
|
|
|
|
|
|
|
|
count:=0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
str.Add ('00:'+'COSTCO'
|
|
|
|
|
+':'+'CONTAINER LOAD PLAN'
|
|
|
|
|
+':'+FILEFUNCTION
|
|
|
|
|
+':'+trim(Edit1.Text)
|
|
|
|
|
+':'+trim(Edit3.Text)
|
|
|
|
|
+':'+FormatDateTime('YYYYMMDDhhmm',Now)
|
|
|
|
|
+':'+frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring
|
|
|
|
|
+':'+frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring+#39);
|
|
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
|
str.Add ('10:'+trim(GetvesselEdi(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><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)
|
|
|
|
|
+':'
|
|
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring)+#39);
|
|
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
|
with t_op_ctn do
|
|
|
|
|
begin
|
|
|
|
|
First;
|
|
|
|
|
while not eof do
|
|
|
|
|
begin
|
|
|
|
|
if t_op_ctn.FieldByName('A').AsBoolean then
|
|
|
|
|
begin
|
|
|
|
|
str.Add ('50:'+trim(fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+':'+trim(fieldbyname('<27>ߴ<EFBFBD>').asstring)+trim(fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+':'+'F'
|
|
|
|
|
+':'+'O'
|
|
|
|
|
+':'+GetShipEdiNO(trim(frm_op_seae.t_op_seae.fieldbyname('<27><>վ').asstring)) //װ<><D7B0><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><>վ').asstring) //װ<><D7B0><EFBFBD>ص<EFBFBD>
|
|
|
|
|
+':'+FormatDateTime('YYYYMMDDhhmm',Now)
|
|
|
|
|
+':'+trim(fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+':' // <20>侭Ӫ<E4BEAD>˴<EFBFBD><CBB4><EFBFBD>
|
|
|
|
|
+':' //<2F>侭Ӫ<E4BEAD><D3AA>
|
|
|
|
|
+#39);
|
|
|
|
|
count:=count+1;
|
|
|
|
|
Qty:=Qty+fieldbyname('<27><><EFBFBD><EFBFBD>').asInteger;
|
|
|
|
|
pkg:=pkg+fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat;
|
|
|
|
|
cmb:=cmb+fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat;
|
|
|
|
|
end;
|
|
|
|
|
next;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
str.Add ('51:'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring)
|
|
|
|
|
+':'+frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
|
|
|
|
|
+':'+frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring
|
|
|
|
|
+':'+frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring
|
|
|
|
|
+':'+frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring
|
|
|
|
|
+':'
|
|
|
|
|
+':'
|
|
|
|
|
+':'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
|
|
|
|
|
+':'+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);
|
|
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='R' then
|
|
|
|
|
begin
|
|
|
|
|
str.Add ('52:'+'1'
|
|
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>䷽ʽ').asstring) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
+':'
|
|
|
|
|
+':'+IntToStr(Qty)
|
|
|
|
|
+':'+GetpkgsEdi(trim(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring))
|
|
|
|
|
+':'+frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring
|
|
|
|
|
+':'+FormatFloat(';;',pkg)
|
|
|
|
|
+':'+FormatFloat(';;',cmb)
|
|
|
|
|
+':'+'C'
|
|
|
|
|
+':'+frm_op_seae.t_op_seae.fieldbyname('<27>¶<EFBFBD>').asstring
|
|
|
|
|
+':'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>').asstring
|
|
|
|
|
+':'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>').asstring+#39);
|
|
|
|
|
count:=count+1;
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='D' then
|
|
|
|
|
begin
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
str.Add ('52:'+'1'
|
|
|
|
|
+':'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>䷽ʽ').asstring) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
+':'
|
|
|
|
|
+':'+IntToStr(Qty)
|
|
|
|
|
+':'+GetpkgsEdi(trim(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring))
|
|
|
|
|
+':'+frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring
|
|
|
|
|
+':'+FormatFloat(';;',pkg)
|
|
|
|
|
+':'+FormatFloat(';;',cmb)+#39);
|
|
|
|
|
count:=count+1;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sl:=Tstringlist.Create;
|
|
|
|
|
sl1:=Tstringlist.Create;
|
|
|
|
|
sl1.Text:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
GetLengthTString(sl1,70);
|
|
|
|
|
sl.text:='';
|
|
|
|
|
for L:=0 to sl1.Count-1 do begin
|
|
|
|
|
if Trim(sl1.Strings[L])<>'' then
|
|
|
|
|
sl.Add(sl1.Strings[L]);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
M:=1;
|
|
|
|
|
for L:=0 to sl.Count-1 do begin
|
|
|
|
|
if M<=5 then
|
|
|
|
|
begin
|
|
|
|
|
if M=1 then
|
|
|
|
|
begin
|
|
|
|
|
s:='53:'+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:='53:'+FormatEdiString(sl.Strings[L],0)+':';
|
|
|
|
|
end;
|
|
|
|
|
M:=M+1;
|
|
|
|
|
end;
|
|
|
|
|
S:=S+'''';
|
|
|
|
|
Str.Add(S);
|
|
|
|
|
|
|
|
|
|
Count:=Count+M+1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sl1.Text:=frm_op_seae.t_op_seae.fieldbyname('<27><>ͷ').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:='54:'+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:='54:'+FormatEdiString(sl.Strings[L],0)+':';
|
|
|
|
|
end;
|
|
|
|
|
M:=M+1;
|
|
|
|
|
end;
|
|
|
|
|
S:=S+'''';
|
|
|
|
|
Str.Add(S);
|
|
|
|
|
|
|
|
|
|
Count:=Count+M+1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if trim(frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring)='D' then
|
|
|
|
|
begin
|
|
|
|
|
str.Add ('55:'+trim(frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+':'+frm_op_seae.t_op_seae.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring
|
|
|
|
|
+':'
|
|
|
|
|
+':'
|
|
|
|
|
+':'
|
|
|
|
|
+':'
|
|
|
|
|
+':'+#39);
|
|
|
|
|
count:=count+1;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with t_op_ctn do
|
|
|
|
|
begin
|
|
|
|
|
First;
|
|
|
|
|
while not eof do
|
|
|
|
|
begin
|
|
|
|
|
if t_op_ctn.FieldByName('A').AsBoolean then
|
|
|
|
|
begin
|
|
|
|
|
str.Add ('56:'+trim(fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)
|
|
|
|
|
+':'+fieldbyname('<27><><EFBFBD><EFBFBD>').asString
|
|
|
|
|
+':'+fieldbyname('<27><><EFBFBD><EFBFBD>').asString
|
|
|
|
|
+':'+fieldbyname('<27><><EFBFBD><EFBFBD>').asString
|
|
|
|
|
+':'+fieldbyname('<27><><EFBFBD><EFBFBD>').asString
|
|
|
|
|
+#39);
|
|
|
|
|
count:=count+1;
|
|
|
|
|
end;
|
|
|
|
|
next;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
result:=count;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_zxd.bsSkinButton1Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
str:Tstringlist;
|
|
|
|
|
i,Count,get_Count,bill_count:integer;
|
|
|
|
|
inifile1:Tinifile;
|
|
|
|
|
begin
|
|
|
|
|
try
|
|
|
|
|
str:=Tstringlist.Create;
|
|
|
|
|
str.Clear;
|
|
|
|
|
count:=0;
|
|
|
|
|
bill_count:=0;
|
|
|
|
|
if frm_op_seae.dxdbgrid1.SelectedCount>1 then
|
|
|
|
|
begin
|
|
|
|
|
for i:=0 to frm_op_seae.dxdbgrid1.SelectedCount-1 do
|
|
|
|
|
begin
|
|
|
|
|
frm_op_seae.t_op_seae.GotoBookmark(pointer(frm_op_seae.dxdbgrid1.selectedrows[i]));
|
|
|
|
|
if not isEditrue(frm_op_seae.t_op_seae) then
|
|
|
|
|
exit;
|
|
|
|
|
|
|
|
|
|
if RadioGroup1.ItemIndex=1 then
|
|
|
|
|
// get_Count:=frm_op_seae_edi_zxd.get_txtSI(str)
|
|
|
|
|
else
|
|
|
|
|
get_Count:=frm_op_seae_edi_zxd.get_txtBooking(str);
|
|
|
|
|
|
|
|
|
|
if get_Count=-1 then
|
|
|
|
|
exit
|
|
|
|
|
else
|
|
|
|
|
count:=count+get_Count;
|
|
|
|
|
bill_count:=bill_count+1;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
str.Add('99:'+intToStr(count+1)+'''');
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
if not isEditrue(frm_op_seae.t_op_seae) then
|
|
|
|
|
exit;
|
|
|
|
|
if RadioGroup1.ItemIndex=1 then
|
|
|
|
|
// get_Count:=frm_op_seae_edi_zxd.get_txtSI(str)
|
|
|
|
|
else
|
|
|
|
|
get_Count:=frm_op_seae_edi_zxd.get_txtBooking(str);
|
|
|
|
|
|
|
|
|
|
if get_Count=-1 then
|
|
|
|
|
exit
|
|
|
|
|
else
|
|
|
|
|
count:=count+get_Count;
|
|
|
|
|
|
|
|
|
|
str.Add('99:'+intToStr(count+1)+'''');
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SaveDialog1.FileName:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring+GetDatetime(datetimetostr(now),1);
|
|
|
|
|
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;
|
|
|
|
|
except
|
|
|
|
|
on e:exception do
|
|
|
|
|
begin
|
|
|
|
|
ShowMessage(e.Message);
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{procedure Tfrm_op_seae_edi_zxd.bsSkinButton1Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
str:Tstringlist;
|
|
|
|
|
i,Count,get_Count,bill_count:integer;
|
|
|
|
|
inifile1:Tinifile;
|
|
|
|
|
begin
|
|
|
|
|
str:=Tstringlist.Create;
|
|
|
|
|
str.Clear;
|
|
|
|
|
count:=0;
|
|
|
|
|
bill_count:=0;
|
|
|
|
|
if frm_op_seae.dxdbgrid1.SelectedCount>1 then
|
|
|
|
|
begin
|
|
|
|
|
for i:=0 to frm_op_seae.dxdbgrid1.SelectedCount-1 do
|
|
|
|
|
begin
|
|
|
|
|
frm_op_seae.t_op_seae.GotoBookmark(pointer(frm_op_seae.dxdbgrid1.selectedrows[i]));
|
|
|
|
|
get_Count:=frm_op_seae_edi_zxd.get_txt(str);
|
|
|
|
|
if get_Count=-1 then
|
|
|
|
|
exit
|
|
|
|
|
else
|
|
|
|
|
count:=count+get_Count;
|
|
|
|
|
bill_count:=bill_count+1;
|
|
|
|
|
end;
|
|
|
|
|
str.Add('UNT+'+INTTOSTR(count)+'+1'+#39);
|
|
|
|
|
str.Add('UNZ+'+inttostr(bill_count)+'+100'+#39);
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
get_Count:=frm_op_seae_edi_zxd.get_txt(str);
|
|
|
|
|
if get_Count=-1 then
|
|
|
|
|
exit
|
|
|
|
|
else
|
|
|
|
|
count:=count+get_Count;
|
|
|
|
|
|
|
|
|
|
str.Add('UNT+'+INTTOSTR(count)+'+1'+#39);
|
|
|
|
|
str.Add('UNZ+1+100'+#39);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
SaveDialog1.FileName:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><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;
|
|
|
|
|
|
|
|
|
|
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
|
|
|
|
|
inifile1.WriteString('INTRA','SEND_CODE',edit1.text);
|
|
|
|
|
inifile1.WriteString('INTRA','SEND_NAME',edit2.text);
|
|
|
|
|
inifile1.WriteString('INTRA','RECEIVE_CODE',edit3.text);
|
|
|
|
|
inifile1.WriteString('INTRA','RECEIVE_NAME',edit4.text);
|
|
|
|
|
inifile1.free;
|
|
|
|
|
close;
|
|
|
|
|
end;}
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_zxd.FormShow(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
inifile1:Tinifile;
|
|
|
|
|
begin
|
|
|
|
|
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
|
|
|
|
|
edit1.text:=inifile1.ReadString('EDI','SEND_CODE_ZXD','');
|
|
|
|
|
edit2.text:=inifile1.ReadString('EDI','SEND_NAME_ZXD','');
|
|
|
|
|
edit3.text:=inifile1.ReadString('EDI','RECEIVE_CODE_ZXD','');
|
|
|
|
|
edit4.text:=inifile1.ReadString('EDI','RECEIVE_NAME_ZXD','');
|
|
|
|
|
edit5.text:=inifile1.ReadString('EDI','SEND_TEL_ZXD','');
|
|
|
|
|
edit6.text:=inifile1.ReadString('EDI','SEND_MAIL_ZXD','');
|
|
|
|
|
edit7.text:=inifile1.ReadString('EDI','SEND_ATTN_ZXD','');
|
|
|
|
|
edit8.text:=inifile1.ReadString('EDI','FTPADD_ZXD','');
|
|
|
|
|
edit9.text:=inifile1.ReadString('EDI','FTPNAME_ZXD','');
|
|
|
|
|
edit10.text:=inifile1.ReadString('EDI','FTPPASS_ZXD','');
|
|
|
|
|
edit11.text:=inifile1.ReadString('EDI','FTPPATH_ZXD','/');
|
|
|
|
|
edit12.text:=inifile1.ReadString('EDI','ADDR_ZXD','');
|
|
|
|
|
inifile1.free;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_zxd.bsSkinButton3Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
if frm_op_seae_edi_zxd.Width=650 then
|
|
|
|
|
frm_op_seae_edi_zxd.Width:=305
|
|
|
|
|
else
|
|
|
|
|
frm_op_seae_edi_zxd.Width:=650;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_zxd.bsSkinButton4Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
IdFTP1:TIdFTP;
|
|
|
|
|
str:widestring;
|
|
|
|
|
str_file:widestring;
|
|
|
|
|
ftpar,ftpname,ftppass,ftppath,ScriptPath:String;
|
|
|
|
|
StrL:Tstringlist;
|
|
|
|
|
i,Count,get_Count,bill_count,i_soi:integer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
i_soi:=0;
|
|
|
|
|
if bsck.Checked then
|
|
|
|
|
begin
|
|
|
|
|
if frm_op_seae_assistant=nil then
|
|
|
|
|
begin
|
|
|
|
|
ShowMessage('<27><><EFBFBD><EFBFBD>(ί<>к<EFBFBD><D0BA>ᵥ)<29><><EFBFBD>淢<EFBFBD>ͷֵ<CDB7>Edi');
|
|
|
|
|
exit;
|
|
|
|
|
end
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
ScriptPath:=ExtractFilePath(ParamStr(0))+'EDIFILE\';
|
|
|
|
|
if not DirectoryExists(ScriptPath) then
|
|
|
|
|
CreateDir(ScriptPath);
|
|
|
|
|
|
|
|
|
|
ftpar:=Trim(Edit8.Text);
|
|
|
|
|
if ftpar='' then begin
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FTP<54><50>ַ<EFBFBD><D6B7>',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
ftpname:=Trim(Edit9.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(Edit10.Text);;
|
|
|
|
|
if ftpar='' then begin
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FTP<54><50><EFBFBD>룡',mtWarning,[mbOk],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
ftppath:=Trim(Edit11.Text);;
|
|
|
|
|
|
|
|
|
|
str:=ScriptPath
|
|
|
|
|
+frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').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('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
|
|
|
|
|
+FormatDateTime('yyyy',now)
|
|
|
|
|
+FormatDateTime('mm',now)
|
|
|
|
|
+FormatDateTime('dd',now)
|
|
|
|
|
+FormatDateTime('hh',now)
|
|
|
|
|
+FormatDateTime('nn',now)+'.txt';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StrL:=Tstringlist.Create;
|
|
|
|
|
StrL.Clear;
|
|
|
|
|
count:=0;
|
|
|
|
|
bill_count:=0;
|
|
|
|
|
if frm_op_seae.dxdbgrid1.SelectedCount>1 then
|
|
|
|
|
begin
|
|
|
|
|
for i:=0 to frm_op_seae.dxdbgrid1.SelectedCount-1 do
|
|
|
|
|
begin
|
|
|
|
|
frm_op_seae.t_op_seae.GotoBookmark(pointer(frm_op_seae.dxdbgrid1.selectedrows[i]));
|
|
|
|
|
if not isEditrue(frm_op_seae.t_op_seae) then
|
|
|
|
|
exit;
|
|
|
|
|
if RadioGroup1.ItemIndex=1 then
|
|
|
|
|
// get_Count:=frm_op_seae_edi_zxd.get_txtSI(StrL)
|
|
|
|
|
else
|
|
|
|
|
get_Count:=frm_op_seae_edi_zxd.get_txtBooking(StrL);
|
|
|
|
|
|
|
|
|
|
if get_Count=-1 then
|
|
|
|
|
exit
|
|
|
|
|
else
|
|
|
|
|
count:=count+get_Count;
|
|
|
|
|
bill_count:=bill_count+1;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
StrL.Add('99:'+intToStr(count+1)+'''');
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
if not isEditrue(frm_op_seae.t_op_seae) then
|
|
|
|
|
exit;
|
|
|
|
|
if RadioGroup1.ItemIndex=1 then
|
|
|
|
|
// get_Count:=frm_op_seae_edi_zxd.get_txtSI(StrL)
|
|
|
|
|
else
|
|
|
|
|
get_Count:=frm_op_seae_edi_zxd.get_txtBooking(StrL);
|
|
|
|
|
if get_Count=-1 then
|
|
|
|
|
exit
|
|
|
|
|
else
|
|
|
|
|
count:=count+get_Count;
|
|
|
|
|
|
|
|
|
|
StrL.Add('99:'+intToStr(count+1)+'''');
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StrL.SaveToFile(str);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
i_soi:=1;
|
|
|
|
|
showmessage('<27>ļ<EFBFBD><C4BC>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
end;
|
|
|
|
|
idftp1.Free;
|
|
|
|
|
|
|
|
|
|
if i_soi=0 then UpdateSOIStatus(RadioGroup1.ItemIndex,frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_zxd.FormClose(Sender: TObject;
|
|
|
|
|
var Action: TCloseAction);
|
|
|
|
|
VAR
|
|
|
|
|
inifile1:TIniFile;
|
|
|
|
|
begin
|
|
|
|
|
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
|
|
|
|
|
inifile1.WriteString('EDI','SEND_CODE_ZXD',edit1.text);
|
|
|
|
|
inifile1.WriteString('EDI','ZXDSEND_NAME_ZXD',edit2.text);
|
|
|
|
|
inifile1.WriteString('EDI','RECEIVE_CODE_ZXD',edit3.text);
|
|
|
|
|
inifile1.WriteString('EDI','RECEIVE_NAME_ZXD',edit4.text);
|
|
|
|
|
inifile1.WriteString('EDI','SEND_TEL_ZXD',edit5.text);
|
|
|
|
|
inifile1.WriteString('EDI','SEND_MAIL_ZXD',edit6.text);
|
|
|
|
|
inifile1.WriteString('EDI','SEND_ATTN_ZXD',edit7.text);
|
|
|
|
|
|
|
|
|
|
inifile1.WriteString('EDI','FTPADD_ZXD',edit8.text);
|
|
|
|
|
inifile1.WriteString('EDI','FTPNAME_ZXD',edit9.text);
|
|
|
|
|
inifile1.WriteString('EDI','FTPPASS_ZXD',Edit10.text);
|
|
|
|
|
inifile1.WriteString('EDI','FTPPATH_ZXD',Edit11.text);
|
|
|
|
|
|
|
|
|
|
inifile1.WriteString('EDI','ADDR_ZXD',edit12.text);
|
|
|
|
|
|
|
|
|
|
inifile1.WriteInteger('EDI','CMASEND_TYPE_ZXD',RadioGroup1.ItemIndex);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inifile1.free;
|
|
|
|
|
action:=cafree;
|
|
|
|
|
frm_op_seae_edi_zxd:=nil;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_op_seae_edi_zxd.FormCreate(Sender: TObject);
|
|
|
|
|
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;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end.
|