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.

2335 lines
68 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,
IdComponent, IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase,
IdMessageClient, IdSMTPBase, IdSMTP, IdBaseComponent, IdMessage,IdAttachmentFile,
bsSkinBoxCtrls;
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;
edt1: 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;
Label6: TLabel;
Edit6: TEdit;
IdMsg: TIdMessage;
SMTP1: TIdSMTP;
Label7: TLabel;
Edit7: TEdit;
bsSkinComboBox1: TbsSkinComboBox;
bsSkinLabel1: TbsSkinLabel;
Label8: TLabel;
Edit8: 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 Record41_DETAILS_SI(DataSet:TDataSet;LineNo:string):String;
function Record44_MARKS(DataSet:TDataSet;LineNo:string):Tstringlist;
function Record44_MARKS_SI(DataSet:TDataSet;LineNo:string):Tstringlist;
function Record47_DESCRIPTION(DataSet:TDataSet;LineNo:string):Tstringlist;
function Record47_DESCRIPTION_SI(DataSet:TDataSet;LineNo:string):Tstringlist;
function Record47_DESCRIPTION_Line(DataSet:TDataSet;LineNo:string):Tstringlist;
function Record47_QTY(BsNo:string):String;
function Record47_QTY_SI(lINENO:Integer;DataSet:TDataSet):String;
function Record54_SPECIAL(DataSet:TDataSet;LineNo,Qty:string):String;
function Record51_SI(TTLLineno,Lineno:Integer;DataSet:TDataSet):string;
function Record44_47(LineNo:string):Tstringlist;
function Record73(DataSet:TDataSet):String;
function Record99(LineNo:string):String;
function CreateSIEdiFile:TStrings;
function SCNVaild(cust: String): boolean;
function GetCorpEdiNO(CorpSName:String): String;
function GetCtnCode(ctnkind,ctnsize:String):String;
function GetPkgCode(Pkg:String):String;
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.GetPkgCode(Pkg:String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select PIL<49><4C><EFBFBD><EFBFBD> EDI<44><49><EFBFBD><EFBFBD> from t_code_package where <20><><EFBFBD><EFBFBD>='''+pkg+'''');
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_PIL.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 PIL<49><4C><EFBFBD><EFBFBD> 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_PIL.GetCorpEdiNO(CorpSName: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><>''Ŀ<><C4BF>'' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+CorpSName+'''');
SQL.Add('order by <20><><EFBFBD><EFBFBD>');
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_PIL.SCNVaild(cust: String): boolean;
var i :integer;
ls:TStringList;
begin
result:=false;
try
ls:=TStringList.Create;
ls.Clear;
ls.Text:=frm_op_seae.t_op_seae.fieldbyname(cust).asstring;
for i:=0 to ls.Count-1 do
begin
{
if IsZhongwen(ls[i]) then
begin
MessageDlg('EDI<44><49>Ϣ<EFBFBD><CFA2>'+cust+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42>!',mtWarning,[mbOk],0);
end;
}
if Length(ls[i])>35 then
begin
result:=true;
MessageDlg('EDI<44><49>Ϣ<EFBFBD><CFA2>'+cust+'<27><>ÿ<EFBFBD><C3BF><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>35<33><35><EFBFBD>ַ<EFBFBD>!',mtWarning,[mbOk],0);
end;
end;
if ls.Count>6 then
begin
result:=true;
MessageDlg('EDI<44><49>Ϣ<EFBFBD><CFA2>'+cust+'<27><><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>6<EFBFBD><36>,<2C><><EFBFBD><EFBFBD>ϵPIL ,<2C><><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbOk],0);
end;
finally
ls.Free;
end;
end;
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 PIL<49><4C><EFBFBD><EFBFBD> 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 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(EDIT8.TEXT)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD>ͷ<EFBFBD>ESI<53><49><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 SCNVaild('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>') then
begin
result:=false;
exit;
end;
if SCNVaild('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>') then
begin
result:=false;
exit;
end;
if SCNVaild('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>') then
begin
result:=false;
exit;
end;
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;
case bsSkinComboBox1.ItemIndex of
0:
begin
if GetCorpEdiNO(frm_op_seae.t_op_seae.fieldbyname('<27><>վ').asstring)='' then
begin
result:=false;
MessageDlg('<27><>վEDI<44><49><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>,<2C><><EFBFBD>ڿͻ<DABF><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>ÿͻ<C3BF><CDBB><EFBFBD>EDI<44><49><EFBFBD><EFBFBD>',mtWarning,[mbOk],0);
exit;
end;
end;
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;
if Trim(GetPkgCode(t_op_ctn.fieldbyname('<27><>װ').asstring))='' then
begin
result:=false;
MessageDlg('<27><>װ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
case bsknrdgrp1.ItemIndex of
0: SendCode:=EditFieldVlaue(Edit1.Text,8); //4
1: SendCode:=EditFieldVlaue(Edit8.Text,8); //4
end;
Result:=Result+SendCode; //5
Result:=Result+SPACES(6); //6
Result:=Result+GetDatetime(datetimetostr(now),1);//7
Result:=Result+SPACES(1); //8
case bsSkinComboBox1.ItemIndex of
0:begin
Result:=Result+'CNTAO'; //9
Result:=Result+'CNTAO'; //10
end;
1:begin
Result:=Result+'CNSHA'; //9
Result:=Result+'CNSHA'; //10
end;
end;
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 //<2F><><EFBFBD>ǵĴ<C7B5><C4B4>ڱ<EFBFBD><DAB1>и<EFBFBD><D0B8><EFBFBD><EFBFBD>κţ<CEBA>QC90020W<30><57>һ<EFBFBD><D2BB>ǰ<EFBFBD><C7B0>λ<EFBFBD>Ǵ<EFBFBD><C7B4><EFBFBD><EFBFBD><EFBFBD>
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring),20); //4
Result:=Result+EditFieldVlaue(Copy(trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring),4,8),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 <20>Ϻ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><E1B5A5>.
end;
if (bsSkinComboBox1.ItemIndex=1) then //<2F>Ϻ<EFBFBD>4<EFBFBD>ֶβ<D6B6><CEB2><EFBFBD>Ҫ <20><EFBFBD><E0B5BA>Ҫ
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('<27><><EFBFBD>յ<EFBFBD><D5B5><EFBFBD>').asstring),20) //3
else
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring),20); //3
{
if (bsSkinComboBox1.ItemIndex=1) then //<2F>Ϻ<EFBFBD>4<EFBFBD>ֶβ<D6B6><CEB2><EFBFBD>Ҫ <20><EFBFBD><E0B5BA>Ҫ
Result:=Result+SPACES(20) //4
else
}
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
if (bsSkinComboBox1.ItemIndex=1) and (bsknrdgrp1.ItemIndex=0) then
Result:=Result+SPACES(20) //4
else
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('<27><><EFBFBD><EFBFBD><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<=6 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'; //1
Result:=Result+SPACES(3);//2
if DataSet.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring='FREIGHT PREPAID' then
Result:=Result+EditFieldVlaue(Edit3.Text,10) //3
else Result:=Result+EditFieldVlaue(Edit4.Text,10);
case bsSkinComboBox1.ItemIndex of
0:begin
case bsknrdgrp1.ItemIndex of
0:Result:=Result+SPACES(3); //4
else Result:=Result+'001';
end;
end;
1:begin
case bsknrdgrp1.ItemIndex of
0:Result:=Result+'001'; //4
else Result:=Result+'001';
end;
end;
end;
Result:=Result+SPACES(4); //5
Result:=Result+EditFieldVlaue(Edit5.Text,35);
{
case bsknrdgrp1.ItemIndex of
0:Result:=Result+SPACES(35); //6
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'; // 1
Result:=Result+SPACES(3); // 2
if trim(Edit7.Text)='' then
begin
if DataSet.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring='FREIGHT PREPAID' then
Result:=Result+EditFieldVlaue(Edit3.Text,10) //3
else Result:=Result+EditFieldVlaue(Edit4.Text,10);
end
else
begin
Result:=Result+EditFieldVlaue(Edit7.Text,10) //3
end;
case bsSkinComboBox1.ItemIndex of
0:begin
case bsknrdgrp1.ItemIndex of
0:Result:=Result+SPACES(3); //4
else Result:=Result+'001';
end;
end;
1:begin
case bsknrdgrp1.ItemIndex of
0:Result:=Result+'001'; //4
else Result:=Result+'001';
end;
end;
end;
Result:=Result+SPACES(1);
if DataSet.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring='FREIGHT PREPAID' then
sl1.Text:=DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').AsString
else 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<=6 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<=6 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<=6 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,ContainerSOC:string;
aAdoQuery:TAdoQuery;
begin
ContainerSOC:='Y';
if (frm_op_seae.t_op_seae.fieldbyname('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean)
then
ContainerSOC:='S';
//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('0.000',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('0.000',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';
Result:=Result+ContainerSOC;
Result:=EditFieldVlaue(Result,250);
end;
function Tfrm_op_seae_edi_PIL.Record41_DETAILS_SI(DataSet:TDataSet;LineNo:string):String;
var l,m:integer;
GoodsNo,ContainerSOC: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;
ContainerSOC:='Y';
if (frm_op_seae.t_op_seae.fieldbyname('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean)
then
ContainerSOC:='S';
Result:='41'; //1
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('0.000',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('0.000',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';
Result:=Result+ContainerSOC;
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.Record44_MARKS_SI(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_SI(lINENO:Integer;DataSet:TDataSet):String;
begin
Result:=DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+DataSet.fieldbyname('<27><>װ').asstring;
Result:='47'+SPACES(3)+EditFieldVlaueZeros(IntToStr(lINENO),3)+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_SI(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.Record51_SI(TTLLineno,Lineno:Integer;DataSet:TDataSet):string;
var
s,LineHeads:string;
ContainerSOC:string;
i:Integer;
begin
Result:='';
ContainerSOC:='Y';
if (frm_op_seae.t_op_seae.fieldbyname('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean)
then
ContainerSOC:='S';
s:='';
i:=1;
if trim(DataSet.FieldByName('<27><><EFBFBD><EFBFBD>').AsString)<>'' then
begin
LineHeads:='51'; //1
LineHeads:=LineHeads+SPACES(3); //2
LineHeads:=LineHeads+EditFieldVlaueZeros(IntToStr(TTLLineno),3); //3
LineHeads:=LineHeads+EditFieldVlaueZeros(IntToStr(Lineno),3); //4
s:=EditFieldVlaue(DataSet.FieldByName('<27><><EFBFBD><EFBFBD>').AsString,11); //5
s:=s+ContainerSOC; //6
s:=s+GetCtnCode(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,DataSet.fieldbyname('<27>ߴ<EFBFBD>').asstring); //7
s:=s+'F'; //8
s:=s+SPACES(3); //9
s:=s+SPACES(3); //10
s:=s+SPACES(3); //11
s:=s+SPACES(9); //12
s:=s+EditFieldVlaueZeros(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,6); //13
s:=s+EditFieldVlaue(DataSet.fieldbyname('<27><>װ').asstring,8); //14
s:=s+FormatFloatPIL(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,6,3); //15
s:=s+FormatFloatPIL('0',6,3); //16
s:=s+FormatFloatPIL(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,6,3); //17
s:=s+FormatFloatPIL('000',6,3); //18
s:=s+EditFieldVlaue(GetPkgCode(DataSet.fieldbyname('<27><>װ').asstring),5); //19
s:=s+SPACES(20); //20
s:=s+EditFieldVlaue(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,20); //21
s:=s+SPACES(20); //22
s:=s+SPACES(20); //23
s:=s+SPACES(1); //24
Result:=EditFieldVlaue(LineHeads+S,250);
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.Record73(DataSet:TDataSet):String;
begin
Result:='73';
Result:=Result+'B';
result:=result+GetCorpEdiNO(DataSet.fieldbyname('<27><>վ').AsString);
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','');
Edit6.text:=inifile1.ReadString('PILEDI','FTPSERVER2','');
bsSkinComboBox1.ItemIndex:=inifile1.ReadInteger('PILEDI','area',0);
Edit7.text:=inifile1.ReadString('PILEDI','pilpo','');
Edit8.text:=inifile1.ReadString('PILEDI','SENDESICODE','');
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,TTLLineNo,LineNo,qty,i:integer;
str:Tstringlist;
inifile1:Tinifile;
aAdoQueryCtnKind,aAdoQuery,aAdoQueryItems: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));
case bsknrdgrp1.ItemIndex of
0:
begin
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;
1:
begin
TTLLineNo:=1;
LineNo:=1;
aAdoQuery:=CreateAdoQuery;
aAdoQueryItems:=CreateAdoQuery;
aAdoQueryCtnKind:=CreateAdoQuery;
try
aAdoQueryCtnKind.Close;
aAdoQueryCtnKind.Sql.Clear;
aAdoQueryCtnKind.Sql.Add('select distinct <20><><EFBFBD><EFBFBD> from t_op_ctn where <20><><EFBFBD><EFBFBD>=:BsNo');
aAdoQueryCtnKind.Parameters.ParamByName('BSNO').Value:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
aAdoQueryCtnKind.Open;aAdoQueryCtnKind.First;
while not aAdoQueryCtnKind.Eof do
begin
aAdoQuery.Close;aAdoQuery.Sql.Clear;
aAdoQuery.Sql.Add('select <20><><EFBFBD><EFBFBD>,<2C>ߴ<EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C><>װ,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 and <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
aAdoQuery.Sql.Add('Group by <20><><EFBFBD><EFBFBD>,<2C>ߴ<EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C><>װ');
aAdoQuery.Parameters.ParamByName('BSNO').Value:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
aAdoQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=aAdoQueryCtnKind.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
aAdoQuery.Open;aAdoQuery.First;
str.Add(Record41_DETAILS_SI(TDataSet(aAdoQuery),IntToStr(TTLLineNo)));
str.AddStrings(Record44_MARKS_SI(frm_op_seae.t_op_seae,IntToStr(TTLLineNo)));
//str.Add(Record47_QTY_SI(TTLLineNo,TDataSet(aAdoQuery)));
str.AddStrings(Record47_DESCRIPTION_SI(frm_op_seae.t_op_seae,IntToStr(TTLLineNo)));
LineNo:=1;
while not aAdoQuery.Eof do
begin
aAdoQueryItems.Close;aAdoQueryItems.Sql.Clear;
aAdoQueryItems.Sql.Add('select * from t_op_ctn where <20><><EFBFBD><EFBFBD>=:BsNo and <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
aAdoQueryItems.Parameters.ParamByName('BSNO').Value:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
aAdoQueryItems.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=aAdoQueryCtnKind.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
aAdoQueryItems.Open;aAdoQuery.First;
while not aAdoQueryItems.Eof do
begin
if trim(aAdoQueryItems.FieldByName('<27><><EFBFBD><EFBFBD>').AsString)<>'' then
str.Add(Record51_SI(TTLLineNo,LineNo,TDataSet(aAdoQueryItems)));
LineNo:=LineNo+1;
aAdoQueryItems.Next;
end;
aAdoQuery.Next;
end;
TTLLineNo:=TTLLineNo+1;
aAdoQueryCtnKind.Next;
end;
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,IntToStr(1),IntToStr(i)));
str.Add(Record73(frm_op_seae.t_op_seae));
finally
aAdoQuery.Free;
aAdoQueryItems.Free;
aAdoQueryCtnKind.Free;
end;
end;
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'));
// str.AddStrings(Record51(frm_op_seae.t_op_seae));
str.Add(Record73(frm_op_seae.t_op_seae));
end;
end;
str.Add(Record99(IntToStr(frm_op_seae.dxdbgrid1.SelectedCount)));
result:=str;
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));
case bsknrdgrp1.ItemIndex of
0:
begin
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;
1:
begin
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)));
Next;
LineNo:=LineNo+1;
end;
Close;Sql.Clear;
Sql.Add('select count(*) c from t_op_ctn where <20><><EFBFBD><EFBFBD>=:BsNo and <20><><EFBFBD><EFBFBD>=''''');
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;
if fieldbyname('c').AsInteger<=0 then
str.AddStrings(Record51(frm_op_seae.t_op_seae));
finally
free;
end;
end;
end;
str.Add(Record73(frm_op_seae.t_op_seae));
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'));
str.AddStrings(Record51(frm_op_seae.t_op_seae));
str.Add(Record73(frm_op_seae.t_op_seae));
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;
ftpar,ftpar2,ScriptPath,Host,username,userpassword: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','FTPSERVER2',Edit6.text);
inifile1.WriteInteger('PILEDI','area',bsSkinComboBox1.ItemIndex);
inifile1.WriteString('PILEDI','pilpo',Edit7.text);
inifile1.WriteString('PILEDI','SENDESICODE',edit8.text);
inifile1.free;
Host:=get_parameters_value(181,'');
if frm_data_share.t_sys_employee.locate('<27><><EFBFBD><EFBFBD>',employee,[]) then
begin
username:=frm_data_share.t_sys_employee.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
userpassword:=frm_data_share.t_sys_employee.FieldByName('MSN<53>ʺ<EFBFBD>').AsString;
end;
ScriptPath:=ExtractFilePath(ParamStr(0))+'EDIFILE\';
if not DirectoryExists(ScriptPath) then
CreateDir(ScriptPath);
ftpar:=Trim(edt1.Text);
ftpar2:=Trim(Edit6.Text);
if not isEditrue(frm_op_seae.t_op_seae) then exit;
if ftpar='' then
begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>䣡',mtWarning,[mbOk],0);
exit;
end;
if ftpar2='' then
begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><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;
case bsknrdgrp1.ItemIndex of
0:begin
str:=ScriptPath
+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring
+'EDI'+'.pms';
end;
1:begin
str:=ScriptPath
+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring
+'ESI'+'.pms';
end;
end;
{ 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)+'.pms';
}
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>'+StrL[i],mtWarning,[mbYes,mbNo],0)=mrNo then
exit;
end;
end;
strL.SaveToFile(str);
finally
FreeAndNil(StrL)
end;
try
if Trim(userpassword)<>'' then
begin
SMTP1.AuthType := satDefault; //(satNone, satDefault, satSASL);
SMTP1.username:=username;
SMTP1.Password :=userpassword;
SMTP1.Host :=Host;
SMTP1.Port :=25;
try
SMTP1.Connect;
except
on e : Exception do
begin
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+E.Message);
end;
end;
if not SMTP1.Connected then
begin
Sleep(1000);
SMTP1.Connect;
end;
try
with IdMsg do
begin
body.Clear;
case bsknrdgrp1.ItemIndex of
0:Body.Text :=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+' EDI';
1:Body.Text :=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+' ESI';
end;
From.address :=username;
case bsknrdgrp1.ItemIndex of
0:begin
Recipients.EMailAddresses :=edt1.text;
Subject:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+' EDI';
end;
1:begin
Recipients.EMailAddresses :=Edit6.text;
Subject:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+' ESI';
end;
end;
TIdAttachmentFile.Create(MessageParts,Str);
end;
if not SMTP1.Connected then
begin
SMTP1.Connect;
end;
SMTP1.Send(IdMsg);
ShowMessage('<27><><EFBFBD>ͳɹ<CDB3>');
finally
SMTP1.Disconnect;
end;
end;
except
ShowMessage('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>');
end;
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:=170
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','BOOKAGENTNAME',edit5.text);
inifile1.WriteString('PILEDI','FTPSERVER',edt1.text);
inifile1.WriteString('PILEDI','FTPSERVER2',Edit6.text);
inifile1.WriteInteger('PILEDI','area',bsSkinComboBox1.ItemIndex);
inifile1.WriteString('PILEDI','pilpo',Edit7.text);
inifile1.WriteString('PILEDI','SENDESICODE',edit8.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>'+#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.