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.

3637 lines
115 KiB
Plaintext

11 months ago
unit u_op_seae_edi_NEWPIL;
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, RxLookup, wwdblook;
type
Tfrm_op_seae_edi_NEWPIL = 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;
bsSkinComboBox1: TbsSkinComboBox;
bsSkinLabel1: TbsSkinLabel;
Label8: TLabel;
Edit8: TEdit;
t_op_edi: TADOQuery;
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
Label9: TLabel;
Edit9: TEdit;
Label10: TLabel;
Edit10: TEdit;
t_code_pilcode1: TDataSource;
t_code_pilcode: TADOQuery;
wwDBLookupCombo52: TwwDBLookupCombo;
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 GetPortEdiID(Port: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 Record15_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 Record55_DG(DataSet:TDataSet;LineNo,Qty:string):String;
function Record56_DG(DataSet:TDataSet;LineNo,Qty:string;CtnDataSet:TDataSet):String;
function Record51_SI(TTLLineno,Lineno:Integer;DataSet:TDataSet):string;
function Record53_SPECIAL(TTLLineno,Lineno:Integer):string;
function Record44_47(LineNo:string):Tstringlist;
function Record73(DataSet:TDataSet):Tstringlist;
function Record73CANADA(DataSet:TDataSet):Tstringlist;
function Record73HZ(DataSet:TDataSet):Tstringlist;
function Record74USA(DataSet:TDataSet):String;
function Record99(LineNo:string):String;
function CreateSIEdiFile:Tstringlist;
function SCNVaild(cust: String;aLength:Integer;count:Integer): boolean;
function GetCorpEdiNO(CorpSName:String): String;
function GetCtnCode(ctnkind,ctnsize:String):String;
function GetPILMELLCtnCode(ctnkind,ctnsize:String):String;
function GetPkgCode(Pkg:String):String;
function GetSgCode(Pkg:String):String;
function IsZhongwen(Str: String): string;
function Isnum(Str: String): Boolean;
function get_txtBooking(str:Tstringlist):integer;
end;
var
frm_op_seae_edi_NEWPIL: Tfrm_op_seae_edi_NEWPIL;
implementation
uses u_op_seae, u_main, my_sys_function, u_data_share, u_op_seae_assistant;
{$R *.dfm}
function Tfrm_op_seae_edi_NEWPIL.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_NEWPIL.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_NEWPIL.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_NEWPIL.SCNVaild(cust: String;aLength:Integer;count:Integer): 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])>alength then
begin
result:=true;
MessageDlg('EDI<44><49>Ϣ<EFBFBD><CFA2>'+cust+'<27><>ÿ<EFBFBD><C3BF><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>'+inttostr(aLength)+'<27><><EFBFBD>ַ<EFBFBD>!',mtWarning,[mbOk],0);
end;
end;
if ls.Count>count then
begin
result:=true;
MessageDlg('EDI<44><49>Ϣ<EFBFBD><CFA2>'+cust+'<27><><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>'+inttostr(count)+'<27><>,<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_NEWPIL.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_NEWPIL.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_NEWPIL.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_NEWPIL.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_NEWPIL.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_NEWPIL.isEditrue(DataSet:TDataSet): boolean;
var
cntrs:String;
begin
result:=true;
if frm_op_seae.t_op_ams.State in [dsedit,dsinsert] then frm_op_seae.t_op_ams.Post;
t_op_edi.Close;
t_op_edi.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
t_op_edi.Open;
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 bsknrdgrp1.ItemIndex=1 then
begin
if SCNVaild('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>',35,5) then
begin
result:=false;
exit;
end;
if SCNVaild('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>',35,5) then
begin
result:=false;
exit;
end;
if SCNVaild('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>',35,5) then
begin
result:=false;
exit;
end;
end else begin
if SCNVaild('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>',30,5) then
begin
result:=false;
exit;
end;
if SCNVaild('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>',35,5) then
begin
result:=false;
exit;
end;
if SCNVaild('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>',35,5) then
begin
result:=false;
exit;
end;
end;
if bsknrdgrp1.ItemIndex=1 then
begin
{
if DataSet.FindField('<27><><EFBFBD>յ<EFBFBD><D5B5><EFBFBD>')<>nil 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;
end else begin
if trim(DataSet.fieldbyname('<27>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>').asstring)='' then
begin
result:=false;
MessageDlg('PIL<49><4C><EFBFBD>յ<EFBFBD><D5B5><EFBFBD>(<28>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>)<29><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
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 t_op_edi.FieldByName('<27><><EFBFBD>۴<EFBFBD><DBB4><EFBFBD>').asstring='' then begin
result:=false;
MessageDlg('̫ƽ<CCAB><C6BD><EFBFBD>۴<EFBFBD><DBB4><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
if t_op_edi.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring='Y' then begin
if t_op_edi.FieldByName('<27>߳<EFBFBD><DFB3><EFBFBD>').asstring='Y' then begin
if t_op_edi.FieldByName('<27>߶ȵ<DFB6>λ').asstring='' then begin
result:=false;
MessageDlg('<27><><EFBFBD>޸߶ȵ<DFB6>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end else if Length(trim(t_op_edi.fieldbyname('<27>߶ȵ<DFB6>λ').asstring))>3 then begin
result:=false;
MessageDlg('<27><><EFBFBD>޸߶ȵ<DFB6>λ<EFBFBD><CEBB><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>3λ',mtWarning,[mbOk],0);
exit;
end;
if t_op_edi.FieldByName('<27><><EFBFBD>޸߶<DEB8>').AsFloat=0 then begin
result:=false;
MessageDlg('<27><><EFBFBD>޸߶Ȳ<DFB6><C8B2><EFBFBD>Ϊ0',mtWarning,[mbOk],0);
exit;
end
end;
if t_op_edi.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring='Y' then begin
if t_op_edi.FieldByName('<27><><EFBFBD>ȵ<EFBFBD>λ').asstring='' then begin
result:=false;
MessageDlg('<27><><EFBFBD>޳<EFBFBD><DEB3>ȵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end else if Length(trim(t_op_edi.fieldbyname('<27><><EFBFBD>ȵ<EFBFBD>λ').asstring))>3 then begin
result:=false;
MessageDlg('<27><><EFBFBD>޳<EFBFBD><DEB3>ȵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>3λ',mtWarning,[mbOk],0);
exit;
end;
if (t_op_edi.FieldByName('<27><><EFBFBD>޳<EFBFBD><DEB3><EFBFBD>ǰ').AsFloat=0) and (t_op_edi.FieldByName('<27><><EFBFBD>޳<EFBFBD><DEB3>Ⱥ<EFBFBD>').AsFloat=0) then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>޳<EFBFBD><DEB3>Ⱥͺ<C8BA><CDBA><EFBFBD><EFBFBD>޳<EFBFBD><DEB3>Ȳ<EFBFBD><C8B2>ܶ<EFBFBD>Ϊ0',mtWarning,[mbOk],0);
exit;
end
end;
if t_op_edi.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring='Y' then begin
if t_op_edi.FieldByName('<27><><EFBFBD>ȵ<EFBFBD>λ').asstring='' then begin
result:=false;
MessageDlg('<27><><EFBFBD>޿<EFBFBD><DEBF>ȵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end else if Length(trim(t_op_edi.fieldbyname('<27><><EFBFBD>ȵ<EFBFBD>λ').asstring))>3 then begin
result:=false;
MessageDlg('<27><><EFBFBD>޿<EFBFBD><DEBF>ȵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>3λ',mtWarning,[mbOk],0);
exit;
end;
if (t_op_edi.FieldByName('<27><><EFBFBD>޿<EFBFBD><DEBF><EFBFBD><EFBFBD><EFBFBD>').AsFloat=0) and (t_op_edi.FieldByName('<27><><EFBFBD>޿<EFBFBD><DEBF><EFBFBD><EFBFBD><EFBFBD>').AsFloat=0) then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޿<EFBFBD><DEBF>Ⱥ<EFBFBD><C8BA>ҳ<EFBFBD><D2B3>޿<EFBFBD><DEBF>Ȳ<EFBFBD><C8B2>ܶ<EFBFBD>Ϊ0',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 DataSet.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring='FREIGHT PREPAID' then begin
if t_op_edi.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring='' then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
end else begin
if t_op_edi.FieldByName('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').asstring='' then begin
result:=false;
MessageDlg('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
end;
if t_op_edi.FieldByName('HBL<42><4C><EFBFBD>ͷ<EFBFBD>ʽ').asstring='' then begin
result:=false;
MessageDlg('HBL<42><4C><EFBFBD>ͷ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
{
if t_op_edi.FieldByName('<27><><EFBFBD><EFBFBD>AMS<4D><53>־').asstring='Y' then begin
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 Isnum(DataSet.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring) then begin
result:=false;
MessageDlg('װ<>۴<EFBFBD><DBB4><EFBFBD><EBB2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!',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 Isnum(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!',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 Isnum(DataSet.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring) then begin
result:=false;
MessageDlg('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!',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 (bsknrdgrp1.ItemIndex=1) then begin
if trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
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 frm_op_seae.t_op_seae.FindField('HS<48><53><EFBFBD><EFBFBD>')<>nil then begin
if trim(frm_op_seae.t_op_seae.fieldbyname('HS<48><53><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('HS<48><53><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end else begin
if Length(trim(frm_op_seae.t_op_seae.fieldbyname('HS<48><53><EFBFBD><EFBFBD>').asstring))<>6 then begin
result:=false;
MessageDlg('HS<48><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ6λ<36><CEBB><EFBFBD><EFBFBD>',mtWarning,[mbOk],0);
exit;
end
end;
end else begin
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ʽ').asstring)='' then begin
result:=false;
MessageDlg('HS<48><53><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end else begin
if Length(trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ʽ').asstring))<>6 then begin
result:=false;
MessageDlg('HS<48><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ6λ<36><CEBB><EFBFBD><EFBFBD>',mtWarning,[mbOk],0);
exit;
end
end;
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><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>װEDI<44><49><EFBFBD><EFBFBD><EBB2BB><EFBFBD>ڣ<EFBFBD>',mtWarning,[mbOk],0);
exit;
end;
t_op_ctn.Next;
end;
end;
function Tfrm_op_seae_edi_NEWPIL.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_NEWPIL.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_NEWPIL.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_NEWPIL.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_NEWPIL.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_NEWPIL.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_NEWPIL._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_NEWPIL.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_NEWPIL.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_NEWPIL.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_NEWPIL.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_NEWPIL.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_NEWPIL.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_NEWPIL.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:=Zeros(d);
end;
result:=s1+s2;
end;
function Tfrm_op_seae_edi_NEWPIL.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.02';
end;
Result:=Result+'';
Result:=EditFieldVlaue(Result,250);
end;
function Tfrm_op_seae_edi_NEWPIL.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,4),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
Result:=Result+SPACES(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); //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
Result:=Result+SPACES(12);
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:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring),12);
Result:=Result+EditFieldVlaue(Copy(trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring),5,Length(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)-4),8); //5
Result:=EditFieldVlaue(Result,250);
end;
function Tfrm_op_seae_edi_NEWPIL.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';
{
if DataSet.FindField('<27><><EFBFBD>յ<EFBFBD><D5B5><EFBFBD>')<>nil then begin
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;
end else begin
case bsknrdgrp1.ItemIndex of
0:Result:=Result+EditFieldVlaue('+',20); //2
1:Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('<27>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>').asstring),20); //2 <20>Ϻ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><E1B5A5>.
end;
end;
}
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring),20); //3
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
if bsSkinCheckRadioBox1.Checked then begin
Result:=Result+EditFieldVlaue('PIL',3); //23
Result:=Result+EditFieldVlaue('PIL',3); //24
end else begin
Result:=Result+EditFieldVlaue('PM',3); //23
Result:=Result+EditFieldVlaue('PM',3); //24
end;
Result:=EditFieldVlaue(Result,250);
end;
function Tfrm_op_seae_edi_NEWPIL.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);
Result:=Result+EditFieldVlaue(trim(t_op_edi.fieldbyname('HBL<42><4C><EFBFBD>ͷ<EFBFBD>ʽ').asstring),1);
{
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_NEWPIL.Record15_BL(DataSet:TDataSet):String;
var s:string;
begin
Result:='15';
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring),50);
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring),50);
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring),50);
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>').asstring),50);
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring),30);
Result:=EditFieldVlaue(Result,250);
end;
function Tfrm_op_seae_edi_NEWPIL.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+EditFieldVlaue(trim(t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring),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
sl.Add(EditFieldVlaue(sl1.Strings[L],35));
{
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_NEWPIL.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,236);
if DataSet.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring='FREIGHT PREPAID' then
Result:=Result+EditFieldVlaue(Edit3.Text,10) //3
else Result:=Result+EditFieldVlaue(Edit4.Text,10);
Result:=EditFieldVlaue(Result,250);
sl.Free;
sl1.Free;
end;
function Tfrm_op_seae_edi_NEWPIL.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(wwDBLookupCombo52.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);
}
if t_op_edi.FieldByName('<27><><EFBFBD><EFBFBD>AMS<4D><53>־').asstring='Y' then begin
Result:=Result+EditFieldVlaue('',11) //3
end else begin
Result:=Result+EditFieldVlaue('',11) //3
end;
end
else
begin
Result:=Result+EditFieldVlaue(wwDBLookupCombo52.Text,11) //3
end;
case bsSkinComboBox1.ItemIndex of
0:begin
case bsknrdgrp1.ItemIndex of
0:Result:=Result+SPACES(2); //4
else Result:=Result+'01';
end;
end;
1:begin
case bsknrdgrp1.ItemIndex of
0:Result:=Result+'01'; //4
else Result:=Result+'01';
end;
end;
end;
Result:=Result+SPACES(1);
Result:=Result+SPACES(3); // 2
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,236);
result:=result+Trim(t_op_edi.fieldbyname('<27><><EFBFBD>۴<EFBFBD><DBB4><EFBFBD>').AsString);
Result:=EditFieldVlaue(Result,250);
sl.Free;
sl1.Free;
end;
function Tfrm_op_seae_edi_NEWPIL.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+EditFieldVlaue(trim(t_op_edi.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').asstring),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
sl.Add(EditFieldVlaue(sl1.Strings[L],35));
{
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_NEWPIL.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
sl.Add(EditFieldVlaue(sl1.Strings[L],35));
{
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_NEWPIL.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_NEWPIL.Record41_DETAILS(DataSet:TDataSet;LineNo:string):String;
var l,m:integer;
GoodsNo,ContainerSOC:string;
aAdoQuery:TAdoQuery;
begin
ContainerSOC:=' ';
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);
if frm_op_seae.t_op_seae.FindField('HS<48><53><EFBFBD><EFBFBD>')<>nil then
Result:=Result+EditFieldVlaue(frm_op_seae.t_op_seae.fieldbyname('HS<48><53><EFBFBD><EFBFBD>').AsString,9)
else
Result:=Result+EditFieldVlaue(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ʽ').AsString,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_NEWPIL.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:=' ';
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);
if frm_op_seae.t_op_seae.FindField('HS<48><53><EFBFBD><EFBFBD>')<>nil then
Result:=Result+EditFieldVlaue(frm_op_seae.t_op_seae.fieldbyname('HS<48><53><EFBFBD><EFBFBD>').AsString,9)
else
Result:=Result+EditFieldVlaue(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ʽ').AsString,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,7,3);
Result:=Result+FormatFloatPIL('0.000',7,3);
// Result:=Result+SPACES(48);
Result:=Result+EditFieldVlaue(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString,48);
// Result:=Result+EditFieldVlaue(GoodsNo,4);
Result:=Result+SPACES(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_NEWPIL.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_NEWPIL.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_NEWPIL.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_NEWPIL.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_NEWPIL.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_NEWPIL.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_NEWPIL.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_NEWPIL.Record51_SI(TTLLineno,Lineno:Integer;DataSet:TDataSet):string;
var
s,LineHeads:string;
ContainerSOC:string;
i:Integer;
begin
Result:='';
ContainerSOC:='N';
if (frm_op_seae.t_op_seae.fieldbyname('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean)
then
ContainerSOC:='Y';
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_NEWPIL.Record53_SPECIAL(TTLLineno,Lineno:Integer):string;
var
s,LineHeads:string;
ContainerSOC:string;
i:Integer;
begin
Result:='';
s:='';
i:=1;
if trim(t_op_edi.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString)='Y' then
begin
LineHeads:='53'; //1
LineHeads:=LineHeads+SPACES(3); //2
LineHeads:=LineHeads+EditFieldVlaueZeros(IntToStr(TTLLineno),3); //3
LineHeads:=LineHeads+EditFieldVlaueZeros(IntToStr(Lineno),3);
if trim(t_op_edi.FieldByName('<27>߳<EFBFBD><DFB3><EFBFBD>').AsString)='Y' then begin
s:=s+'Y';
s:=s+EditFieldVlaue(t_op_edi.FieldByName('<27>߶ȵ<DFB6>λ').AsString,3);
s:=s+FormatFloatPIL(t_op_edi.fieldbyname('<27><><EFBFBD>޸߶<DEB8>').AsString,5,2); //15
end else begin
s:=s+'N';
s:=s+SPACES(3); //9
s:=s+SPACES(7); //9
end;
if trim(t_op_edi.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString)='Y' then begin
s:=s+'Y';
s:=s+EditFieldVlaue(t_op_edi.FieldByName('<27><><EFBFBD>ȵ<EFBFBD>λ').AsString,3);
s:=s+FormatFloatPIL(t_op_edi.fieldbyname('<27><><EFBFBD>޳<EFBFBD><DEB3>Ⱥ<EFBFBD>').AsString,5,2); //15
s:=s+FormatFloatPIL(t_op_edi.fieldbyname('<27><><EFBFBD>޳<EFBFBD><DEB3><EFBFBD>ǰ').AsString,5,2); //15
end else begin
s:=s+'N';
s:=s+SPACES(3); //9
s:=s+SPACES(7); //9
s:=s+SPACES(7); //9
end;
if trim(t_op_edi.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString)='Y' then begin
s:=s+'Y';
s:=s+EditFieldVlaue(t_op_edi.FieldByName('<27><><EFBFBD>ȵ<EFBFBD>λ').AsString,3);
s:=s+FormatFloatPIL(t_op_edi.fieldbyname('<27><><EFBFBD>޿<EFBFBD><DEBF><EFBFBD><EFBFBD><EFBFBD>').AsString,5,2); //15
s:=s+FormatFloatPIL(t_op_edi.fieldbyname('<27><><EFBFBD>޿<EFBFBD><DEBF><EFBFBD><EFBFBD><EFBFBD>').AsString,5,2); //15
end else begin
s:=s+'N';
s:=s+SPACES(3); //9
s:=s+SPACES(7); //9
s:=s+SPACES(7); //9
end;
Result:=EditFieldVlaue(LineHeads+S,250);
end;
end;
function Tfrm_op_seae_edi_NEWPIL.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_NEWPIL.Record55_DG(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:='55'; //12
result:=result+SPACES(1); //345
result:=result+'01'; //12
result:=result+EditFieldVlaueZeros(LineNo,3); //678
result:=result+EditFieldVlaueZeros(Qty,3); //9 10 11 //12
result:=result+EditFieldVlaue(t_op_edi.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD><CFB5>').AsString,35);
result:=result+EditFieldVlaue(t_op_edi.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD><CFB5>ʽ').AsString,35);
//40
Result:=EditFieldVlaue(Result,250);
end;
function Tfrm_op_seae_edi_NEWPIL.Record56_DG(DataSet:TDataSet;LineNo,Qty:string;CtnDataSet:TDataSet):String;
begin
result:='56'; //12
result:=result+SPACES(1); //345
result:=result+'01'; //12
result:=result+EditFieldVlaueZeros(LineNo,3); //678
result:=result+EditFieldVlaueZeros(Qty,3); //9 10 11
result:=result+EditFieldVlaue(DataSet.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').AsString,4);
result:=result+EditFieldVlaue(t_op_edi.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD>ȼ<EFBFBD>').AsString,1);
result:=result+EditFieldVlaue(DataSet.fieldbyname('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').AsString,4);
result:=result+SPACES(3); //345
result:=result+'KGM'; //345
result:=result+FormatFloatPIL('000',6,3); //18
result:=result+FormatFloatPIL(CtnDataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,6,3); //15
result:=result+EditFieldVlaue(t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱦ<EFBFBD><C8BE>').AsString,1); //40
result:=result+SPACES(52); //345
result:=result+EditFieldVlaue(GetPkgCode(CtnDataSet.fieldbyname('<27><>װ').asstring),5); //19
result:=result+EditFieldVlaue(CtnDataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,9); //19
Result:=EditFieldVlaue(Result,250);
end;
function Tfrm_op_seae_edi_NEWPIL.Record73(DataSet:TDataSet):Tstringlist;
var
str:Tstringlist;
sl:Tstringlist;
sl1:Tstringlist;
L:integer;
begin
if result=nil then result:=Tstringlist.Create
else result.Clear;
str:=Tstringlist.Create;
sl:=Tstringlist.Create;
sl1:=Tstringlist.Create;
try
if trim(t_op_edi.fieldbyname('ŷ<><C5B7>HSCODE').AsString)<>'' then begin
sl1.Text:=t_op_edi.fieldbyname('ŷ<><C5B7>HSCODE').AsString;
GetLengthTString(sl1,120);
sl.text:='';
for L:=0 to sl1.Count-1 do
begin
if Trim(sl1.Strings[L])<>'' then
sl.Add(EditFieldVlaue('73C'+EditFieldVlaue(sl1.Strings[L],120),250));
end;
result.AddStrings(sl);
end;
if trim(t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>NCM').AsString)<>'' then begin
sl1.Text:=t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>NCM').AsString;
GetLengthTString(sl1,120);
sl.text:='';
for L:=0 to sl1.Count-1 do
begin
if Trim(sl1.Strings[L])<>'' then
sl.Add(EditFieldVlaue('73C'+EditFieldVlaue(sl1.Strings[L],120),250));
end;
result.AddStrings(sl);
end;
if trim(t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD>ľ<EFBFBD>ʰ<EFBFBD>װ˵<D7B0><CBB5>').AsString)<>'' then begin
sl1.Text:=t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD>ľ<EFBFBD>ʰ<EFBFBD>װ˵<D7B0><CBB5>').AsString;
GetLengthTString(sl1,120);
sl.text:='';
for L:=0 to sl1.Count-1 do
begin
if Trim(sl1.Strings[L])<>'' then
sl.Add(EditFieldVlaue('73W'+EditFieldVlaue(sl1.Strings[L],120),250));
end;
result.AddStrings(sl);
end;
finally
str.Free;
sl.Free;
sl1.Free;
end;
{
Result:='73';
Result:=Result+'B';
result:=result+Trim(t_op_edi.fieldbyname('<27><><EFBFBD>۴<EFBFBD><DBB4><EFBFBD>').AsString);
Result:=EditFieldVlaue(Result,250);
}
end;
function Tfrm_op_seae_edi_NEWPIL.Record73CANADA(DataSet:TDataSet):Tstringlist;
var
str:Tstringlist;
sl:Tstringlist;
sl1:Tstringlist;
L:integer;
begin
if result=nil then result:=Tstringlist.Create
else result.Clear;
str:=Tstringlist.Create;
sl:=Tstringlist.Create;
sl1:=Tstringlist.Create;
try
if trim(t_op_edi.fieldbyname('<27><><EFBFBD>ô<EFBFBD>HBL').AsString)<>'' then begin
sl1.Text:=t_op_edi.fieldbyname('<27><><EFBFBD>ô<EFBFBD>HBL').AsString;
GetLengthTString(sl1,120);
sl.text:='';
for L:=0 to sl1.Count-1 do
begin
if Trim(sl1.Strings[L])<>'' then
sl.Add(EditFieldVlaue('73B'+EditFieldVlaue(sl1.Strings[L],120),250));
end;
result.AddStrings(sl);
end;
finally
str.Free;
sl.Free;
sl1.Free;
end;
end;
function Tfrm_op_seae_edi_NEWPIL.Record73HZ(DataSet:TDataSet):Tstringlist;
var
str:Tstringlist;
sl:Tstringlist;
sl1:Tstringlist;
L:integer;
begin
if result=nil then result:=Tstringlist.Create
else result.Clear;
str:=Tstringlist.Create;
sl:=Tstringlist.Create;
sl1:=Tstringlist.Create;
try
if trim(t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>').AsString)<>'' then begin
sl1.Text:=t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>').AsString;
GetLengthTString(sl1,120);
sl.text:='';
for L:=0 to sl1.Count-1 do
begin
if Trim(sl1.Strings[L])<>'' then
sl.Add(EditFieldVlaue('73B'+EditFieldVlaue(sl1.Strings[L],120),250));
end;
result.AddStrings(sl);
end;
finally
str.Free;
sl.Free;
sl1.Free;
end;
end;
function Tfrm_op_seae_edi_NEWPIL.Record74USA(DataSet:TDataSet):String;
VAR
Str1,CopyBillCount:string;
begin
if DataSet.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='ONE' then
Str1:='1'
else if DataSet.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='TWO' then
Str1:='2'
else if DataSet.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='THREE' then
Str1:='3'
else if DataSet.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='FOUR' then
Str1:='4'
else if DataSet.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='FIVE' then
Str1:='5'
else if DataSet.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='SIX' then
Str1:='6'
else if DataSet.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='SERVEN' then
Str1:='7'
else if DataSet.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='EIGHT' then
Str1:='8'
else if DataSet.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='NIGHT' then
Str1:='9'
else if DataSet.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='TEN' then
Str1:='10';
if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='ONE' then
CopyBillCount:='1'
else if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='TWO' then
CopyBillCount:='2'
else if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='THREE' then
CopyBillCount:='3'
else if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='FOUR' then
CopyBillCount:='4'
else if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='FIVE' then
CopyBillCount:='5'
else if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='SIX' then
CopyBillCount:='6'
else if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='SERVEN' then
CopyBillCount:='7'
else if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='EIGHT' then
CopyBillCount:='8'
else if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='NIGHT' then
CopyBillCount:='9'
else if DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='TEN' then
CopyBillCount:='10';
Result:='74';
result:=result+SPACES(3);
result:=result+EditFieldVlaue(Trim(GetPortEdiID(trim(DataSet.fieldbyname('ǩ<><C7A9><EFBFBD>ص<EFBFBD>').asstring))),5);
if (DataSet.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString<>'') then
result:=result+FormatDateTime('YYYYMMDD',DataSet.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime)
else
result:=result+SPACES(8);
result:=result+SPACES(7);
if UpperCase(DataSet.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='WAYBILL' then
result:=result+'W'
else result:=result+'N';
Result:=Result+EditFieldVlaue(trim(Str1),2);
Result:=Result+EditFieldVlaue(trim(CopyBillCount),2);
if trim(t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD>AMS<4D><53>־').asstring)='Y' then
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('<27>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>').asstring),10)
else
result:=result+SPACES(10);
result:=result+SPACES(10);
Result:=Result+EditFieldVlaueZeros(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,8);
// Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring),8);
Result:=Result+EditFieldVlaue(trim(DataSet.fieldbyname('<27><>װ').asstring),8);
Result:=EditFieldVlaue(Result,250);
end;
function Tfrm_op_seae_edi_NEWPIL.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_NEWPIL.FormShow(Sender: TObject);
var
inifile1:Tinifile;
begin
t_code_pilcode.open;
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
edit1.text:=inifile1.ReadString('PILNEWEDI','SENDCODE','');
edit9.text:=inifile1.ReadString('PILNEWEDI','MELLSENDCODE','');
edit2.text:=inifile1.ReadString('PILNEWEDI','RECIEVECODE','');
edit3.text:=inifile1.ReadString('PILNEWEDI','BOOKAGENT','');
edit4.text:=inifile1.ReadString('PILNEWEDI','BOOKAGENTCC','');
edit5.text:=inifile1.ReadString('PILNEWEDI','BOOKAGENTNAME','');
edt1.text:=inifile1.ReadString('PILNEWEDI','FTPSERVER','');
Edit6.text:=inifile1.ReadString('PILNEWEDI','FTPSERVER2','');
bsSkinComboBox1.ItemIndex:=inifile1.ReadInteger('PILNEWEDI','area',0);
wwDBLookupCombo52.Text:=inifile1.ReadString('PILNEWEDI','pilpo','');
edit10.text:=inifile1.ReadString('PILNEWEDI','MELLBPCODE','');
Edit8.text:=inifile1.ReadString('PILNEWEDI','SENDESICODE','');
inifile1.free;
end;
procedure Tfrm_op_seae_edi_NEWPIL.bsSkinButton2Click(Sender: TObject);
begin
close;
end;
function Tfrm_op_seae_edi_NEWPIL.CreateSIEdiFile:Tstringlist;
var
k,TTLLineNo,LineNo,qty,i,j: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));
if bsknrdgrp1.ItemIndex=1 then
str.Add(Record15_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>,<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');
Sql.Add('Group by <20><><EFBFBD><EFBFBD>,<2C>ߴ<EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C><>װ');
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)));
if frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring='D' then begin
aAdoQueryItems:=CreateAdoQuery;
try
aAdoQueryItems.Close;aAdoQueryItems.Sql.Clear;
aAdoQueryItems.Sql.Add('select * from t_op_ctn where <20><><EFBFBD><EFBFBD>=:BsNo and <20>ߴ<EFBFBD>=:<3A>ߴ<EFBFBD> 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>').Value:=aAdoQuery.fieldbyname('<27>ߴ<EFBFBD>').asstring;
aAdoQueryItems.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=aAdoQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
aAdoQueryItems.Open;aAdoQueryItems.First;
j:=1;
while not aAdoQueryItems.Eof do
begin
if trim(aAdoQueryItems.FieldByName('<27><><EFBFBD><EFBFBD>').AsString)<>'' then
str.Add(Record51_SI(TTLLineNo,LineNo,TDataSet(aAdoQueryItems)));
if trim(t_op_edi.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString)='Y' then
str.Add(Record53_SPECIAL(TTLLineNo,LineNo));
if frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring='D' then begin
str.Add(Record55_DG(frm_op_seae.t_op_seae,IntToStr(LineNo),IntToStr(j)));
str.Add(Record56_DG(frm_op_seae.t_op_seae,IntToStr(LineNo),IntToStr(j),TDataSet(aAdoQueryItems)));
end;
j:=j+1;
aAdoQueryItems.Next;
end;
finally
FreeAndNil(aAdoQueryItems);
end;
end;
Next;
LineNo:=LineNo+1;
end;
finally
free;
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)));
{
if (trim(t_op_edi.fieldbyname('ŷ<><C5B7>HSCODE').asstring)<>'') OR (trim(t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>NCM').asstring)<>'') OR (trim(t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD>ľ<EFBFBD>ʰ<EFBFBD>װ˵<D7B0><CBB5>').asstring)<>'') then
str.AddStrings(Record73(frm_op_seae.t_op_seae));
}
// str.Add(Record73(frm_op_seae.t_op_seae));
if trim(t_op_edi.fieldbyname('<27><><EFBFBD>ô<EFBFBD>HBL').asstring)<>'' then
str.AddStrings(Record73CANADA(frm_op_seae.t_op_seae));
if trim(t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>').asstring)<>'' then
str.AddStrings(Record73HZ(frm_op_seae.t_op_seae));
str.Add(Record74USA(frm_op_seae.t_op_seae));
{
if trim(t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD>AMS<4D><53>־').asstring)='Y' then
str.Add(Record74USA(frm_op_seae.t_op_seae));
}
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)));
if (TTLLineNo=1) then begin
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)));
end;
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;aAdoQueryItems.First;
while not aAdoQueryItems.Eof do
begin
if trim(aAdoQueryItems.FieldByName('<27><><EFBFBD><EFBFBD>').AsString)<>'' then
str.Add(Record51_SI(TTLLineNo,LineNo,TDataSet(aAdoQueryItems)));
if trim(t_op_edi.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString)='Y' then
str.Add(Record53_SPECIAL(TTLLineNo,LineNo));
if frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring='D' then begin
str.Add(Record55_DG(frm_op_seae.t_op_seae,IntToStr(TTLLineNo),IntToStr(LineNo)));
str.Add(Record56_DG(frm_op_seae.t_op_seae,IntToStr(TTLLineNo),IntToStr(LineNo),TDataSet(aAdoQueryItems)));
end;
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)));
if (trim(t_op_edi.fieldbyname('ŷ<><C5B7>HSCODE').asstring)<>'') OR (trim(t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>NCM').asstring)<>'') OR (trim(t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD>ľ<EFBFBD>ʰ<EFBFBD>װ˵<D7B0><CBB5>').asstring)<>'') then
str.AddStrings(Record73(frm_op_seae.t_op_seae));
// str.Add(Record73(frm_op_seae.t_op_seae));
if trim(t_op_edi.fieldbyname('<27><><EFBFBD>ô<EFBFBD>HBL').asstring)<>'' then
str.AddStrings(Record73CANADA(frm_op_seae.t_op_seae));
if trim(t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>').asstring)<>'' then
str.AddStrings(Record73HZ(frm_op_seae.t_op_seae));
// if trim(t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD>AMS<4D><53>־').asstring)='Y' then
str.Add(Record74USA(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));
if bsknrdgrp1.ItemIndex=1 then
str.Add(Record15_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>,<2C><>װ,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>,<2C><>װ');
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)));
if frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring='D' then begin
aAdoQueryItems:=CreateAdoQuery;
try
aAdoQueryItems.Close;aAdoQueryItems.Sql.Clear;
aAdoQueryItems.Sql.Add('select * from t_op_ctn where <20><><EFBFBD><EFBFBD>=:BsNo and <20>ߴ<EFBFBD>=:<3A>ߴ<EFBFBD> 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>').Value:=aAdoQuery.fieldbyname('<27>ߴ<EFBFBD>').asstring;
aAdoQueryItems.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=aAdoQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
aAdoQueryItems.Open;aAdoQueryItems.First;
j:=1;
while not aAdoQueryItems.Eof do
begin
if trim(aAdoQueryItems.FieldByName('<27><><EFBFBD><EFBFBD>').AsString)<>'' then
str.Add(Record51_SI(TTLLineNo,LineNo,TDataSet(aAdoQueryItems)));
if trim(t_op_edi.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString)='Y' then
str.Add(Record53_SPECIAL(TTLLineNo,LineNo));
if frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring='D' then begin
str.Add(Record55_DG(frm_op_seae.t_op_seae,IntToStr(LineNo),IntToStr(j)));
str.Add(Record56_DG(frm_op_seae.t_op_seae,IntToStr(LineNo),IntToStr(j),TDataSet(aAdoQueryItems)));
end;
j:=j+1;
aAdoQueryItems.Next;
end;
finally
FreeAndNil(aAdoQueryItems);
end;
end;
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'));
if (trim(t_op_edi.fieldbyname('ŷ<><C5B7>HSCODE').asstring)<>'') OR (trim(t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>NCM').asstring)<>'') OR (trim(t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD>ľ<EFBFBD>ʰ<EFBFBD>װ˵<D7B0><CBB5>').asstring)<>'') then
str.AddStrings(Record73(frm_op_seae.t_op_seae));
if trim(t_op_edi.fieldbyname('<27><><EFBFBD>ô<EFBFBD>HBL').asstring)<>'' then
str.AddStrings(Record73CANADA(frm_op_seae.t_op_seae));
if trim(t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>').asstring)<>'' then
str.AddStrings(Record73HZ(frm_op_seae.t_op_seae));
// if trim(t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD>AMS<4D><53>־').asstring)='Y' then
str.Add(Record74USA(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_NEWPIL.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('PILNEWEDI','SENDCODE',edit1.text);
inifile1.WriteString('PILNEWEDI','RECIEVECODE',edit2.text);
inifile1.WriteString('PILNEWEDI','BOOKAGENT',edit3.text);
inifile1.WriteString('PILNEWEDI','BOOKAGENTCC',edit4.text);
inifile1.WriteString('PILNEWEDI','BOOKAGENTNAME',edit5.text);
inifile1.WriteString('PILNEWEDI','FTPSERVER',edt1.text);
inifile1.WriteString('PILNEWEDI','FTPSERVER2',Edit6.text);
inifile1.WriteInteger('PILNEWEDI','area',bsSkinComboBox1.ItemIndex);
inifile1.WriteString('PILNEWEDI','pilpo',wwDBLookupCombo52.Text);
inifile1.WriteString('PILNEWEDI','MELLSENDCODE',edit9.text);
inifile1.WriteString('PILNEWEDI','MELLBPCODE',edit10.text);
inifile1.WriteString('PILNEWEDI','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_NEWPIL.btn2Click(Sender: TObject);
begin
if frm_op_seae_edi_NEWPIL.Height=312 then
frm_op_seae_edi_NEWPIL.Height:=230
else
frm_op_seae_edi_NEWPIL.Height:=312;
end;
function Tfrm_op_seae_edi_NEWPIL.IsZhongwen(Str: String): string;
var
i:Integer;
begin
Result:='';
if Str='' then Exit;
if Str='''' then Exit;
for i:=1 to Length(Str) do begin
if (Str[i]>Chr(127)) or (Str[i]=Chr(9)) then begin
Result:=Str[i];
Exit;
end;
end;
end;
procedure Tfrm_op_seae_edi_NEWPIL.bsSkinButton1Click(Sender: TObject);
var
Str:Tstringlist;
inifile1:Tinifile;
i,strcount:integer;
begin
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
inifile1.WriteString('PILNEWEDI','SENDCODE',edit1.text);
inifile1.WriteString('PILNEWEDI','RECIEVECODE',edit2.text);
inifile1.WriteString('PILNEWEDI','BOOKAGENT',edit3.text);
inifile1.WriteString('PILNEWEDI','BOOKAGENTCC',edit4.text);
inifile1.WriteString('PILNEWEDI','BOOKAGENTNAME',edit5.text);
inifile1.WriteString('PILNEWEDI','FTPSERVER',edt1.text);
inifile1.WriteString('PILNEWEDI','FTPSERVER2',Edit6.text);
inifile1.WriteInteger('PILNEWEDI','area',bsSkinComboBox1.ItemIndex);
inifile1.WriteString('PILNEWEDI','pilpo',wwDBLookupCombo52.Text);
inifile1.WriteString('PILNEWEDI','MELLSENDCODE',edit9.text);
inifile1.WriteString('PILNEWEDI','MELLBPCODE',edit10.text);
inifile1.WriteString('PILNEWEDI','SENDESICODE',edit8.text);
inifile1.free;
if (not isEditrue(frm_op_seae.t_op_seae)) then exit;
str:=Tstringlist.Create;
{
if (bsSkinCheckRadioBox1.Checked) then begin
t_op_ctn.close;
t_op_ctn.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
t_op_ctn.open;
if t_op_ctn.IsEmpty then
begin
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(GetPILMELLCtnCode(t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,t_op_ctn.fieldbyname('<27>ߴ<EFBFBD>').asstring))='' then
begin
MessageDlg('<27><>װ<EFBFBD><D7B0>EDI<44><49><EFBFBD><EFBFBD><EBB2BB><EFBFBD>ڣ<EFBFBD>',mtWarning,[mbOk],0);
exit;
end;
t_op_ctn.Next;
end;
get_txtBooking(str);
str.Add('UNT+'+INTTOSTR(str.count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+#39);
str.Add('UNZ+1+'+frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+#39);
end else
}
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
{
if (bsSkinCheckRadioBox1.Checked) then
str.SaveToFile(SaveDialog1.FileName+'.txt')
else
}
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;
function Tfrm_op_seae_edi_NEWPIL.GetPortEdiID(Port: String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select EDI<44><49><EFBFBD><EFBFBD> from t_code_disport where Ӣ<><D3A2><EFBFBD><EFBFBD>='''+Port+'''');
Open;
if not IsEmpty then
Result:=Trim(FieldByName('EDI<44><49><EFBFBD><EFBFBD>').asstring)
else
Result:='';
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_edi_NEWPIL.Isnum(Str: String): Boolean;
var
k:char;
find:boolean;
begin
find:=false;
for k:='0' to '9' do
if pos(k,Str)>0 then find:=true;
result:=find;
end;
function Tfrm_op_seae_edi_NEWPIL.get_txtBooking(str: Tstringlist): integer;
var
str_all,sl:Tstringlist;
j,Count,i,k:integer;
str_guodu,str_shr,str_con,str_not:widestring;
str_pay,Str_head:string;
function CutVoyNo(VoyNo:String):String;
begin
if length(VoyNO)<3 then exit;
if Pos('.',VoyNO)>0 then begin
Result:=Copy(VoyNO,3,length(VoyNO)-2);
end else
Result:=VoyNO;
end;
begin
str_all:=Tstringlist.Create;
count:=0;
str.Add('UNB+UNOC:2+'+Changestr(Edit9.TEXT)+'SO'+':ZZZ+'+Edit3.TEXT
+':ZZZ+'+GetDatetime(datetimetostr(now),2)+'+'
+frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
str.Add('UNH+'+frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+'+IFTMBF:D:99B:UN'+#39);
count:=count+1;
if not bsSkinCheckRadioBox2.Checked then
begin
// if RadioGroup3.ItemIndex=0 then
str.Add('BGM+335+'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+'SO+9'+#39) //9ԭʼ 5 <20><><EFBFBD><EFBFBD>
// else str.Add('BGM+335+'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+'SO+5'+#39); //9ԭʼ 5 <20><><EFBFBD><EFBFBD>
end
else
begin
// if RadioGroup3.ItemIndex=0 then
str.Add('BGM+335+'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+'SO+9'+#39) //9ԭʼ 5 <20><><EFBFBD><EFBFBD>
// else str.Add('BGM+335+'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+'SO+5'+#39); //9ԭʼ 5 <20><><EFBFBD><EFBFBD>
end;
count:=count+1;
str.Add('DTM+137:'+GetDatetime(datetimetostr(now),1)+':203'+#39);
count:=count+1;
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then
begin
showmessage('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>'+frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
+'<27><>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA3A1>');
result:=-1;
exit;
end;
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='DOOR-DOOR' then
begin
str.Add('TSR+16+2'+#39);
end;
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='DOOR-CY' then
begin
str.Add('TSR+15+2'+#39);
end;
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='CY-DOOR' then
begin
str.Add('TSR+17+2'+#39);
end;
if (trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='CY-CY')
or (trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='CY-RAMP') then
begin
str.Add('TSR+11+2'+#39);
end;
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='OTHER' then
begin
str.Add('TSR+30+2'+#39);
end;
count:=count+1;
if Pos('PREPAID',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)>0 then
str_pay:=trim(frm_op_seae.t_op_seae.fieldbyname('Ԥ<><D4A4><EFBFBD>ص<EFBFBD>').asstring);
if Pos('COLLECT',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)>0 then
str_pay:=trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>').asstring);
{
if frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring='FREIGHT PREPAID' then
begin
str.Add('LOC+57+'+GetPortEdiID(trim(frm_op_seae.t_op_seae.fieldbyname('Ԥ<><D4A4><EFBFBD>ص<EFBFBD>').asstring))
+'::6:'+trim(frm_op_seae.t_op_seae.fieldbyname('Ԥ<><D4A4><EFBFBD>ص<EFBFBD>').asstring)+#39);
end
else
if frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring='FREIGHT COLLECT' then begin
str.Add('LOC+57+'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>').asstring)
+'::6:'+trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>').asstring)+#39);
end
else
str.Add('LOC+57+'+GetPortEdiID(trim(frm_op_seae.t_op_seae.fieldbyname('Ԥ<><D4A4><EFBFBD>ص<EFBFBD>').asstring))
+'::6:'+trim(frm_op_seae.t_op_seae.fieldbyname('Ԥ<><D4A4><EFBFBD>ص<EFBFBD>').asstring)+#39);
}
count:=count+1;
// if (CheckBox1.Checked) then begin
// str.Add('RFF+FF:'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>յ<EFBFBD><D5B5><EFBFBD>').asstring+#39);
// count:=count+1;
str.Add('LOC+88+'+frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring
+':139:6:'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring)+#39);
count:=count+1;
if trim(frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring)<>'' then
begin
str.Add('LOC+7+'+frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵش<C4B5><D8B4><EFBFBD>').asstring //?
+':139:6:'+trim(frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring)+#39);
count:=count+1;
end;
if not bsSkinCheckRadioBox2.Checked then
str.Add('RFF+BN:'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+#39)
else str.Add('RFF+BN:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+#39);
count:=count+1;
if not bsSkinCheckRadioBox2.Checked then
str.Add('RFF+BM:'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+#39)
else str.Add('RFF+BM:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+#39);
count:=count+1;
str.Add('TDT+20+'+CutVoyNo(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)
+'+1+++++:::'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
str.Add('LOC+9+'+frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring
+':139:6:'+trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring)+#39);
count:=count+1;
str.Add('LOC+11+'+frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
+':139:6:'+trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring)+#39);
count:=count+1;
{
str.Add('RFF+CT:'+frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>').asstring+#39); //
count:=count+1;
}
{
if RadioGroup2.ItemIndex=10 then
begin
str.Add('RFF+SI:'+frm_op_seae.t_op_seae.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asstring+#39); //
count:=count+1;
end;
}
{
str.Add('DTM+133:'+GetDatetime(datetimetostr(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asDatetime),0)+':102'+#39);
count:=count+1;
}
str_all.Clear;
str_head:='';
if not bsSkinCheckRadioBox2.Checked then
begin
{
if t_op_edi.FieldByName('<27><><EFBFBD>ڹ<EFBFBD><DAB9><EFBFBD>').asstring<>'' then begin
str_all.Text:=Changestr(t_op_edi.fieldbyname('AMS<4D><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring);
end else begin
}
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring);
// end;
end
else
begin
str_all.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring);
end;
GetLengthTString(str_all,35);
str_guodu:='NAD+CZ+'+Changestr(Edit10.Text)+'+'+str_all[0]+':';
if str_all.Count>=2 then
str_guodu:=str_guodu+str_all[1];
if (str_all.Count>=3) and (str_all.Count<=5) then
begin
for j:=2 to str_all.Count-1 do
begin
str_guodu:=str_guodu+':'+str_all[j]
end;
end;
if str_all.Count>5 then
begin
for j:=2 to 3 do
begin
str_guodu:=str_guodu+':'+str_all[j]
end;
str_guodu:=str_guodu+':'+Copy(str_all[4],1,34)+'*';
Str_shr:='*'+Copy(str_all[4],34,1);
for j:=5 to str_all.Count-1 do begin
Str_shr:=Str_shr+' '+str_all[j]
end;
end;
str_guodu:=str_guodu+#39;
str.Add(str_guodu);
count:=count+1;
str_head:='';
str_all.Clear;
if not bsSkinCheckRadioBox2.Checked then
begin
{
if t_op_edi.FieldByName('<27><><EFBFBD>ڹ<EFBFBD><DAB9><EFBFBD>').asstring<>'' then
begin
str_all.Text:=Changestr(t_op_edi.fieldbyname('AMS<4D>ջ<EFBFBD><D5BB><EFBFBD>').asstring);
end else
begin
}
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').asstring);
// end;
end
else
begin
str_all.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').asstring);
end;
GetLengthTString(str_all,35);
str_guodu:='NAD+CN+'+Changestr(Edit10.Text)+'+'+str_all[0]+':';
if str_all.Count>=2 then
str_guodu:=str_guodu+str_all[1];
if (str_all.Count>=3) and (str_all.Count<=5) then
begin
for j:=2 to str_all.Count-1 do
begin
str_guodu:=str_guodu+':'+str_all[j]
end;
end;
if str_all.Count>5 then
begin
for j:=2 to 3 do
begin
str_guodu:=str_guodu+':'+str_all[j]
end;
str_guodu:=str_guodu+':'+Copy(str_all[4],1,33)+'**';
Str_con:='**'+Copy(str_all[4],33,1);
for j:=5 to str_all.Count-1 do begin
Str_con:=Str_con+' '+str_all[j]
end;
end;
{
if (t_op_edi.FieldByName('<27><><EFBFBD>ڹ<EFBFBD><DAB9><EFBFBD>').asstring='<27><><EFBFBD><EFBFBD>') then begin
str_guodu:=str_guodu+'+++'+t_op_edi.FieldByName('<27>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD>ʱ<EFBFBD>').asstring+#39;
str.Add(str_guodu);
end else if (t_op_edi.FieldByName('<27><><EFBFBD>ڹ<EFBFBD><DAB9><EFBFBD>').asstring='<27><><EFBFBD>ô<EFBFBD>') then begin
str_guodu:=str_guodu+'+++'+t_op_edi.FieldByName('<27>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD>ʱ<EFBFBD>').asstring+'+CA'+#39;
str.Add(str_guodu);
end else if (t_op_edi.FieldByName('<27><><EFBFBD>ڹ<EFBFBD><DAB9><EFBFBD>').asstring='<27><><EFBFBD><EFBFBD>') then begin
str_guodu:=str_guodu+'++++'+t_op_edi.FieldByName('<27>ջ<EFBFBD><D5BB>˹<EFBFBD><CBB9>Ҵ<EFBFBD><D2B4><EFBFBD>').asstring+#39;
str.Add(str_guodu);
str.Add('RFF+GN:'+t_op_edi.FieldByName('<27>ջ<EFBFBD><D5BB><EFBFBD>˰<EFBFBD><CBB0>').asstring+#39); //
count:=count+1;
end else begin
}
str_guodu:=str_guodu+#39;
str.Add(str_guodu);
// end;
count:=count+1;
str_head:='';
str_all.Clear;
if not bsSkinCheckRadioBox2.Checked then
begin
{
if t_op_edi.FieldByName('<27><><EFBFBD>ڹ<EFBFBD><DAB9><EFBFBD>').asstring<>'' then begin
str_all.Text:=Changestr(t_op_edi.fieldbyname('AMS֪ͨ<CDA8><D6AA>').asstring);
end else begin
}
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').asstring);
// end;
end
else
begin
str_all.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').asstring);
end;
GetLengthTString(str_all,35);
str_guodu:='NAD+NI+'+Changestr(Edit10.Text)+'+'+str_all[0]+':';
if str_all.Count>=2 then
str_guodu:=str_guodu+str_all[1];
if (str_all.Count>=3) and (str_all.Count<=5) then
begin
for j:=2 to str_all.Count-1 do
begin
str_guodu:=str_guodu+':'+str_all[j]
end;
end;
if str_all.Count>5 then
begin
for j:=2 to 3 do
begin
str_guodu:=str_guodu+':'+str_all[j]
end;
str_guodu:=str_guodu+':'+Copy(str_all[4],1,32)+'***';
Str_not:='***'+Copy(str_all[4],32,1);
for j:=5 to str_all.Count-1 do begin
Str_not:=Str_not+' '+str_all[j]
end;
end;
{
if (t_op_edi.FieldByName('<27><><EFBFBD>ڹ<EFBFBD><DAB9><EFBFBD>').asstring='<27><><EFBFBD><EFBFBD>') then begin
str_guodu:=str_guodu+'+++'+t_op_edi.FieldByName('֪ͨ<CDA8><D6AA><EFBFBD>ʱ<EFBFBD>').asstring+#39;
str.Add(str_guodu);
end else if (t_op_edi.FieldByName('<27><><EFBFBD>ڹ<EFBFBD><DAB9><EFBFBD>').asstring='<27><><EFBFBD>ô<EFBFBD>') then begin
str_guodu:=str_guodu+#39;
str.Add(str_guodu);
end else if (t_op_edi.FieldByName('<27><><EFBFBD>ڹ<EFBFBD><DAB9><EFBFBD>').asstring='<27><><EFBFBD><EFBFBD>') then begin
if t_op_edi.FieldByName('֪ͨ<CDA8>˹<EFBFBD><CBB9>Ҵ<EFBFBD><D2B4><EFBFBD>').asstring<>'' then
str_guodu:=str_guodu+'++++'+t_op_edi.FieldByName('֪ͨ<CDA8>˹<EFBFBD><CBB9>Ҵ<EFBFBD><D2B4><EFBFBD>').asstring+#39
else
str_guodu:=str_guodu+#39;
str.Add(str_guodu);
if t_op_edi.FieldByName('֪ͨ<CDA8><D6AA>˰<EFBFBD><CBB0>').asstring<>'' then begin
str.Add('RFF+GN:'+t_op_edi.FieldByName('֪ͨ<CDA8><D6AA>˰<EFBFBD><CBB0>').asstring+#39); //
count:=count+1;
end;
end else begin
}
str_guodu:=str_guodu+#39;
str.Add(str_guodu);
// end;
count:=count+1;
str.Add('NAD+BP+'+Changestr(Edit10.Text)+'+'+Changestr(Edit9.TEXT)+':160:86+'+#39);
count:=count+1;
str.Add('NAD+AP+'+Changestr(Edit10.Text)+'+'+Changestr(Edit9.TEXT)+':160:86+'+#39);
count:=count+1;
if Pos('PREPAID',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)>0 then
str.Add('CPI+4++P''')
else if Pos('COLLECT',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)>0 then
str.Add('CPI+4++C''')
else str.Add('CPI+4++B''');
count:=count+1;
if not bsSkinCheckRadioBox2.Checked then
begin
str.Add('GID+1+'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+':'+
GetPkgCode(trim(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring))+'::6:'+frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring+#39); //<2F><>
end
else
begin
str.Add('GID+1+'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+':'+
GetPkgCode(trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><>װ').asstring))+'::6:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><>װ').asstring+#39); //<2F><>
end;
count:=count+1;
if Trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ʽ').asstring)<>'' then
begin
str.Add('PIA+5+'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ʽ').asstring+':HS'+#39); //<2F><>
count:=count+1;
end;
sl:=TStringList.Create;
try
if not bsSkinCheckRadioBox2.Checked then
begin
sl.text:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
end
else
begin
sl.text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
end;
for i:=0 to sl.Count-1 do begin
if (i<=1) then begin
str.Add('FTX+AAA+++'+Changestr(sl.Strings[i])+''+#39);
count:=count+1;
end;
end;
finally
FreeAndNil(sl);
end;
{
if Trim(str_shr)<>'' then begin
str.Add('FTX+AAA+++'+
Str_shr+#39);
count:=count+2;
end;
if Trim(str_con)<>'' then begin
str.Add('FTX+AAA+++'+
Str_con+#39);
count:=count+2;
end;
if Trim(str_not)<>'' then begin
str.Add('FTX+AAA+++'+
Str_not+#39);
count:=count+2;
end;
}
if not bsSkinCheckRadioBox2.Checked then
begin
str.Add('MEA+AAE+G+KGM:'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
str.Add('MEA+AAE+AAW+MTQ:'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
end
else
begin
str.Add('MEA+AAE+G+KGM:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
str.Add('MEA+AAE+AAW+MTQ:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
end;
{
sl:=TStringList.Create;
try
if not bsSkinCheckRadioBox2.Checked then
begin
sl.text:=frm_op_seae.t_op_seae.fieldbyname('<27><>ͷ').asString;
end
else
begin
sl.text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><>ͷ').asString;
end;
GetLengthTString(sl,35);
for i:=0 to sl.Count-1 do begin
str.Add('PCI++'+Changestr(sl.Strings[i])+''+#39);
count:=count+1;
end;
finally
FreeAndNil(sl);
end;
}
if frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring='D' then
begin
str.Add('DGS+IMD+'+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;
str.Add('CTA+HG+:'+wwDBLookupCombo52.text+#39);
count:=count+1;
str.Add('COM+'+Edit5.text+':TE'+#39);
count:=count+1;
end;
if not bsSkinCheckRadioBox2.Checked then
begin
t_op_ctn.Close;t_op_ctn.SQL.Clear;
t_op_ctn.SQL.Add('SELECT t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD>, t_code_ctn.EDI<44><49><EFBFBD><EFBFBD>,t_op_ctn.<2E>ߴ<EFBFBD>,t_op_ctn.<2E><>װ');
t_op_ctn.SQL.Add(',t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD>');
t_op_ctn.SQL.Add('FROM t_op_ctn INNER JOIN');
t_op_ctn.SQL.Add('t_code_ctn ON t_op_ctn.<2E><><EFBFBD><EFBFBD> = t_code_ctn.<2E><><EFBFBD><EFBFBD>');
t_op_ctn.SQL.Add('WHERE t_op_ctn.<2E><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
t_op_ctn.close;
t_op_ctn.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
end
else
begin
t_op_ctn.Close;t_op_ctn.SQL.Clear;
t_op_ctn.SQL.Add('SELECT t_op_ctn_fendan.<2E><><EFBFBD><EFBFBD>,t_op_ctn_fendan.<2E><><EFBFBD><EFBFBD>, t_code_ctn.EDI<44><49><EFBFBD><EFBFBD>,t_op_ctn_fendan.<2E>ߴ<EFBFBD>,t_op_ctn_fendan.<2E><>װ');
t_op_ctn.SQL.Add(',t_op_ctn_fendan.<2E><><EFBFBD><EFBFBD>,t_op_ctn_fendan.<2E><><EFBFBD><EFBFBD>,t_op_ctn_fendan.<2E><><EFBFBD><EFBFBD>,t_op_ctn_fendan.<2E><><EFBFBD><EFBFBD>,t_op_ctn_fendan.<2E><><EFBFBD><EFBFBD>,t_op_ctn_fendan.<2E><><EFBFBD><EFBFBD>');
t_op_ctn.SQL.Add('FROM t_op_ctn_fendan INNER JOIN');
t_op_ctn.SQL.Add('t_code_ctn ON t_op_ctn_fendan.<2E><><EFBFBD><EFBFBD> = t_code_ctn.<2E><><EFBFBD><EFBFBD>');
t_op_ctn.SQL.Add('WHERE t_op_ctn_fendan.as_id=:as_id');
t_op_ctn.close;
t_op_ctn.Parameters.ParamByName('as_id').Value:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('as_id').asinteger;
end;
t_op_ctn.open;
t_op_ctn.first;
while not t_op_ctn.eof do
begin
if frm_op_seae.t_op_seae.fieldbyname('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
str.Add('EQD+CN++'+GetPILMELLCtnCode(t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,t_op_ctn.fieldbyname('<27>ߴ<EFBFBD>').asstring)+'+1'+#39)
else
str.Add('EQD+CN++'+GetPILMELLCtnCode(t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,t_op_ctn.fieldbyname('<27>ߴ<EFBFBD>').asstring)+'+2'+#39); //<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
count:=count+1;
str.Add('EQN+'+t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39); //<2F><><EFBFBD><EFBFBD>
count:=count+1;
if 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><CDA8><EFBFBD><EFBFBD>').asstring)<>'' then
begin
str.Add('MEA+AAE+AAS+CBM:'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
end;
if Trim(frm_op_seae.t_op_seae.fieldbyname('ʪ<><CAAA>').asstring)<>'' then
begin
str.Add('MEA+AAE+AAO+HMD:'+frm_op_seae.t_op_seae.fieldbyname('ʪ<><CAAA>').asstring+#39);
count:=count+1;
end;
end;
if frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring='R' then
begin
str.Add('TMP+2+'+StringReplace(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,'+','',[])+':CEL'+#39);
count:=count+1;
end;
t_op_ctn.next;
end;
count:=count+1;
result:=count;
end;
function Tfrm_op_seae_edi_NEWPIL.GetPILMELLCtnCode(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 PILMELL<4C><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_NEWPIL.GetSgCode(Pkg: String): String;
begin
end;
end.