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.
DONGSHENG6/海运业务/u_op_seae_edi_cargosmart.~pas

4966 lines
159 KiB
Plaintext

11 months ago
unit u_op_seae_edi_cargosmart;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, BusinessSkinForm, bsSkinCtrls, StdCtrls,inifiles, DB, ADODB,IdFTP,IdFTPCommon,
ExtCtrls, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
IdExplicitTLSClientServerBase, Menus;
type
TCarrier = Record //<2F><>Ϣ<EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>
EdiNo :String;
CarrierName :String;
end;
Tfrm_op_seae_edi_cargosmart = class(TForm)
Label2: TLabel;
Label1: TLabel;
Edit2: TEdit;
Edit1: TEdit;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsBusinessSkinForm1: TbsBusinessSkinForm;
SaveDialog1: TSaveDialog;
Label3: TLabel;
Label4: TLabel;
Edit3: TEdit;
Edit4: TEdit;
t_op_ctn: TADOQuery;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
RadioGroup1: TRadioGroup;
bsSkinButton3: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
GroupBox1: TGroupBox;
Label8: TLabel;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
Label9: TLabel;
Label10: TLabel;
Edit11: TEdit;
Label11: TLabel;
RadioGroup2: TRadioGroup;
t_op_edi: TADOQuery;
RadioGroup3: TRadioGroup;
bsck: TbsSkinCheckRadioBox;
t_op_edictn: TADOQuery;
Label13: TLabel;
Edit13: TEdit;
IdFTP1: TIdFTP;
bsSkinButton7: TbsSkinButton;
PopupMenu3: TPopupMenu;
N17: TMenuItem;
N18: TMenuItem;
N34: TMenuItem;
N1: TMenuItem;
CMA1: TMenuItem;
INTTRA1: TMenuItem;
N2: TMenuItem;
CARGO1: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
CMA2: TMenuItem;
Label14: TLabel;
Edit14: TEdit;
GroupBox2: TGroupBox;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Edit15: TEdit;
Edit16: TEdit;
Edit17: TEdit;
Edit18: TEdit;
Edit12: TEdit;
Label12: TLabel;
Edit19: TEdit;
Label19: TLabel;
CheckIFT: TbsSkinCheckRadioBox;
Label20: TLabel;
Edit20: TEdit;
bsSkinButton5: TbsSkinButton;
procedure bsSkinButton1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
function get_txtBooking(strL:Tstringlist;afilename:String):integer;
function get_txtSI(strL:Tstringlist;afilename:String):integer;
function get_goods(str:widestring):widestring;
procedure bsSkinButton3Click(Sender: TObject);
function isEditrue:boolean;
function GetCtnCode(ctnkind,ctnsize:String):String;
function GetPkgCode(Pkg:String):String;
function GetPort(PortID:String): String;
function GetLoadPortEdiID(Port:String): String;
function GetPortEdiID(Port:String): String;
function GetShipEdiNO(Ship:String): String;
function Changestr(str:widestring):string;
function GetCtnGoods(bsno:String):String;
function GetLengthword(var s: String; l: Integer;str:String): String;
procedure GetLengthTString(var sl:TStringList;l:integer);
function GetStrNum(str:String):integer;
function GetCharNum(str:String):integer;
function IsZhongwen(Str:String):Boolean;
procedure bsSkinButton4Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bsSkinButton7Click(Sender: TObject);
function get_txtBooking_txt(str:Tstringlist):integer;
function get_txtSI_txt(str:Tstringlist):integer;
procedure bsSkinButton5Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
aCarrier:TCarrier;
SelectCarrier:Boolean;
function ControlLines(LinesCount,CorpTypeid,BsTypeid:Integer;SName:string):String;
function GetCarrier(i:integer):TCarrier;
function GetcntCount:string;
end;
var
frm_op_seae_edi_cargosmart: Tfrm_op_seae_edi_cargosmart;
implementation
uses u_op_seae, my_sys_function, u_main, u_data_share, u_op_seae_assistant;
{$R *.dfm}
function Tfrm_op_seae_edi_cargosmart.GetcntCount:string;
var aAdoQuery:TAdoQuery;
begin
result:='0';
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
if not bsck.Checked then
begin
Close;t_op_ctn.SQL.Clear;
SQL.Add('SELECT sum(t_op_ctn.<2E><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>');
SQL.Add('FROM t_op_ctn');
SQL.Add('WHERE t_op_ctn.<2E><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
end
else
begin
Close;SQL.Clear;
SQL.Add('SELECT sum(t_op_ctn_fendan.<2E><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>');
SQL.Add('FROM t_op_ctn_fendan');
SQL.Add('WHERE t_op_ctn_fendan.as_id=:as_id');
Parameters.ParamByName('as_id').Value:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('as_id').asinteger;
end;
Open;
if IsEmpty then
result:='0'
else result:=fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
finally
Free;
end;
end;
function Tfrm_op_seae_edi_cargosmart.GetCarrier(i:integer):TCarrier;
begin
case RadioGroup2.ItemIndex of
0:begin // COSU
Result.EdiNo:='COSU';
Result.CarrierName:='COSCO';
end;
1:begin // COSU
Result.EdiNo:='OOLU';
Result.CarrierName:='OOCL';
end;
2:begin // COSU
Result.EdiNo:='HLCU';
Result.CarrierName:='HLCU';
end;
end;
end;
function Tfrm_op_seae_edi_cargosmart.ControlLines(LinesCount,CorpTypeid,BsTypeid:Integer;SName:string):String;
begin
Result:='';
if LinesCount>5 then
begin
if RadioGroup2.ItemIndex=5 then
begin
case CorpTypeid of
0:begin
case BsTypeid of
0: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>5<EFBFBD><35>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ʽΪ:-<2D>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
1: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>5<EFBFBD><35>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ʽΪ:-<2D>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end;
end;
1:begin
case BsTypeid of
0: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>5<EFBFBD><35>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ʽΪ:--<2D>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
1: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>5<EFBFBD><35>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ʽΪ:--<2D>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end;
end;
2:begin
case BsTypeid of
0: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>5<EFBFBD><35>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ʽΪ:---<2D>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
1: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>5<EFBFBD><35>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ʽΪ:---<2D>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end;
end;
3:begin
case BsTypeid of
0: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>5<EFBFBD><35>';
1: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>5<EFBFBD><35>';
end;
end;
end;
end
else
begin
case CorpTypeid of
0:begin
case BsTypeid of
0: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>5<EFBFBD><35>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ʽΪ:*<2A>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
1: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>5<EFBFBD><35>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ʽΪ:*<2A>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end;
end;
1:begin
case BsTypeid of
0: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>5<EFBFBD><35>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ʽΪ:**<2A>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
1: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>5<EFBFBD><35>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ʽΪ:**<2A>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end;
end;
2:begin
case BsTypeid of
0: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>5<EFBFBD><35>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ʽΪ:***<2A>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
1: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>5<EFBFBD><35>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ʽΪ:***<2A>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end;
end;
3:begin
case BsTypeid of
0: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>5<EFBFBD><35>';
1: Result:=SName+'<27><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>5<EFBFBD><35>';
end;
end;
end;
end;
end;
end;
function Tfrm_op_seae_edi_cargosmart.GetCtnGoods(bsno:String):String;
var at_op_ctn,at_op_ctndetail :TADOQuery;
ctnlist:TStringList;
b_ctncount:Boolean;
begin
result:='';
at_op_ctn:=CreateAdoQuery;
at_op_ctndetail:=CreateAdoQuery;
ctnlist:=TStringList.Create;
ctnlist.Clear;
with at_op_ctn do
begin
Close;SQL.Clear;
SQL.Add('select ctn_id from t_op_ctn');
SQL.Add('where <20><><EFBFBD><EFBFBD>=:bsno');
Parameters.ParamByName('bsno').Value:=bsno;
open;First;
while not eof do
begin
ctnlist.Add(FieldByName('ctn_id').AsString);
Next;
end;
end;
if Trim(ctnlist.CommaText)<>'' then
with at_op_ctndetail do
begin
Close;SQL.Clear;
SQL.Add('select count(ctn_id) ctn_id from t_op_ctn_detail');
SQL.Add('where ctn_id in ('+ctnlist.CommaText+')');
Open;
if FieldByName('ctn_id').AsInteger>0 then
b_ctncount:=True;
end;
if b_ctncount then
begin
with at_op_ctndetail do
begin
Close;SQL.Clear;
SQL.Add('select ctn_id,sum(<28><><EFBFBD><EFBFBD>)<29><><EFBFBD><EFBFBD>,sum(<28><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,sum(<28><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD> from t_op_ctn_detail');
SQL.Add('where ctn_id=:ctn_id');
SQL.Add('Group by ctn_id');
end;
with at_op_ctn do
begin
Close;SQL.Clear;
SQL.Add('select ctn_id,<2C><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD> from t_op_ctn');
SQL.Add('where <20><><EFBFBD><EFBFBD>=:bsno');
Parameters.ParamByName('bsno').Value:=bsno;
open;First;
while not eof do
begin
at_op_ctndetail.Close;
at_op_ctndetail.Parameters.ParamByName('ctn_id').Value:=FieldByName('ctn_id').AsInteger;
at_op_ctndetail.Open;
if at_op_ctndetail.FieldByName('<27><><EFBFBD><EFBFBD>').AsInteger<>FieldByName('<27><><EFBFBD><EFBFBD>').AsInteger then
begin
if Trim(result)='' then
result:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>:'+at_op_ctndetail.FieldByName('<27><><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܼ<EFBFBD><DCBC><EFBFBD>:'+FieldByName('<27><><EFBFBD><EFBFBD>').AsString
else result:=result+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>:'+at_op_ctndetail.FieldByName('<27><><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܼ<EFBFBD><DCBC><EFBFBD>:'+FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
end;
if at_op_ctndetail.FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat<>FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat then
begin
if Trim(result)='' then
result:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>:'+at_op_ctndetail.FieldByName('<27><><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+FieldByName('<27><><EFBFBD><EFBFBD>').AsString
else result:=result+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>:'+at_op_ctndetail.FieldByName('<27><><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
end;
if at_op_ctndetail.FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat<>FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat then
begin
if Trim(result)='' then
result:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>:'+at_op_ctndetail.FieldByName('<27><><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>:'+FieldByName('<27><><EFBFBD><EFBFBD>').AsString
else result:=result+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>:'+at_op_ctndetail.FieldByName('<27><><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>:'+FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
end;
Next;
end;
end;
end;
try
finally
at_op_ctn.Free;
at_op_ctndetail.Free;
end;
end;
function Tfrm_op_seae_edi_cargosmart.isEditrue: boolean;
var
cntrs,s,Edis,cntrGoods,Goods,Lines:String;
sl:TStringList;
i:integer;
begin
result:=true;
SelectCarrier:=False;
sl:=TStringList.Create;
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 Edit1.Text='' then
begin
if trim(Edis)='' then
Edis:='<27><><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD>'
else Edis:=Edis+','+'<27><><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD>';
end;
if Edit2.Text='' then
begin
if trim(Edis)='' then
Edis:='<27><><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD>'
else Edis:=Edis+','+'<27><><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD>';
end;
if Edit3.Text='' then
begin
if trim(Edis)='' then
Edis:='<27><><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD><EFBFBD><EFBFBD>'
else Edis:=Edis+','+'<27><><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD><EFBFBD><EFBFBD>';
end;
if Edit4.Text='' then
begin
if trim(Edis)='' then
Edis:='<27><><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD><EFBFBD><EFBFBD>'
else Edis:=Edis+','+'<27><><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD><EFBFBD><EFBFBD>';
end;
if Edit5.Text='' then
begin
if trim(Edis)='' then
Edis:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>绰'
else Edis:=Edis+','+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>绰';
end;
if Edit7.Text='' then
begin
if trim(Edis)='' then
Edis:='<27><><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD>'
else Edis:=Edis+','+'<27><><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD>';
end;
if Edit6.Text='' then
begin
if trim(Edis)='' then
Edis:='<27>ʼ<EFBFBD><CABC><EFBFBD>ַ'
else Edis:=Edis+','+'<27>ʼ<EFBFBD><CABC><EFBFBD>ַ';
end;
if Edit12.Text='' then
begin
if trim(Edis)='' then
Edis:='<27><>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>'
else Edis:=Edis+','+'<27><>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>';
end;
if Edit19.Text='' then
begin
if trim(Edis)='' then
Edis:='<27><><EFBFBD><EFBFBD>(Ӣ)'
else Edis:=Edis+','+'<27><><EFBFBD><EFBFBD>(Ӣ)';
end;
if trim(Edis)<>'' then
begin
result:=false;
MessageDlg(trim(Edis)+'<27><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
if RadioGroup1.ItemIndex=1 then
begin
if trim(frm_op_seae.t_op_seae.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(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring)='' then begin
result:=false;
MessageDlg('<27><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
end;
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>յ<EFBFBD><D5B5><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD>յ<EFBFBD><D5B5>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
{
if RadioGroup2.ItemIndex=5 then
begin
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ʽ').asstring)='' then
begin
result:=false;
MessageDlg('HL <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
end;
end
else
begin
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ʽ').asstring)='' then
begin
MessageDlg('ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
end;
end;
}
if RadioGroup1.ItemIndex=1 then
begin
if not bsck.Checked then
begin
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring)='' then begin
result:=false;
MessageDlg('<27><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
end
else
begin
if trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring)='' then begin
result:=false;
MessageDlg('<27>ֵ<EFBFBD><D6B5><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
end;
end;
if RadioGroup1.ItemIndex=1 then
begin
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD>β<EFBFBD><CEB2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
end;
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end
else
begin
if GetShipEdiNO(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring)='' then
begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD>˾EDI<44><49><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
end;
aCarrier:=GetCarrier(RadioGroup2.ItemIndex);
if aCarrier.EdiNo<>GetShipEdiNO(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring) then
begin
if MessageDlg('ѡ<><D1A1><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>˾Ϊ:'+aCarrier.CarrierName+' ϵͳ¼<CDB3><C2BC><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>˾Ϊ:'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring+#13#10+',Ҫ<><D2AA>ѡ<EFBFBD><D1A1><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?',mtWarning,[mbyes,mbno],0)=mryes then
begin
SelectCarrier:=true;
end;
end;
{
if not bsck.Checked then
begin
if trim(frm_op_seae.t_op_seae.fieldbyname('EDI<44><49>ע').asString)='' then begin
result:=false;
MessageDlg('EDI<44><49>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
end;
end
else
begin
if trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('EDI<44><49>ע').asString)='' then
begin
result:=false;
MessageDlg('EDI<44><49>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
end;
end;
}
sl.Clear;
sl.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('<27>ڶ<EFBFBD>֪ͨ<CDA8><D6AA>').asstring);
for i:=0 to sl.Count-1 do
begin
if IsZhongwen(sl[i]) then
begin
result:=false;
MessageDlg('EDI<44><49>Ϣ<EFBFBD>еڶ<D0B5>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42>!',mtWarning,[mbOk],0);
end;
if Length(sl[i])>35 then begin
result:=false;
MessageDlg('<27>ڶ<EFBFBD>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>35<33><35><EFBFBD>ַ<EFBFBD>!',mtWarning,[mbOk],0);
end;
end;
if sl.Count>5 then
begin
result:=false;
MessageDlg('<27>ڶ<EFBFBD>֪ͨ<CDA8>˲<EFBFBD><CBB2>ܴ<EFBFBD><DCB4><EFBFBD>5<EFBFBD><35>!',mtWarning,[mbOk],0);
end;
sl.Clear;
sl.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring);
for i:=0 to sl.Count-1 do begin
if IsZhongwen(sl[i]) then
begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42>!',mtWarning,[mbOk],0);
// Exit;
end;
if Length(sl[i])>35 then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>35<33><35><EFBFBD>ַ<EFBFBD>!',mtWarning,[mbOk],0);
// exit;
end;
{
if (Pos('TEL',sl[i])>0) or (Pos('TEL',sl[i])>0) then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4>ڵ绰<DAB5>ʹ<EFBFBD><CDB4><EFBFBD>!',mtWarning,[mbOk],0);
end;
}
end;
Lines:=ControlLines(sl.Count,0,0,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'); //LinesCount,CorpTypeid,BsTypeid:Integer;SName:string
if Lines<>'' then
begin
result:=false;
MessageDlg(Lines+'!',mtWarning,[mbOk],0);
// Exit;
end;
if bsck.Checked then
begin
sl.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring);
for i:=0 to sl.Count-1 do begin
if IsZhongwen(sl[i]) then begin
result:=false;
MessageDlg('<27>ֵ<EFBFBD>EDI<44><49>Ϣ<EFBFBD>з<EFBFBD><D0B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42>!',mtWarning,[mbOk],0);
// Exit;
end;
if Length(sl[i])>35 then begin
result:=false;
MessageDlg('<27>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>35<33><35><EFBFBD>ַ<EFBFBD>!',mtWarning,[mbOk],0);
// exit;
end;
{
if (Pos('TEL',sl[i])>0) or (Pos('TEL',sl[i])>0) then begin
result:=false;
MessageDlg('<27>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4>ڵ绰<DAB5>ʹ<EFBFBD><CDB4><EFBFBD>!',mtWarning,[mbOk],0);
end;
}
end;
Lines:=ControlLines(sl.Count,0,1,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'); //LinesCount,CorpTypeid,BsTypeid:Integer;SName:string
if Lines<>'' then
begin
result:=false;
MessageDlg('<27>ֵ<EFBFBD>EDI<44><49>Ϣ<EFBFBD><CFA2>'+Lines+'!',mtWarning,[mbOk],0);
// Exit;
end;
end;
sl.Clear;
sl.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').asstring);
for i:=0 to sl.Count-1 do begin
if IsZhongwen(sl[i]) then begin
result:=false;
MessageDlg('EDI<44><49>Ϣ<EFBFBD><CFA2><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42>!',mtWarning,[mbOk],0);
// Exit;
end;
if Length(sl[i])>35 then begin
result:=false;
MessageDlg('<27>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>35<33><35><EFBFBD>ַ<EFBFBD>!',mtWarning,[mbOk],0);
// exit;
end;
{
if (Pos('TEL',sl[i])>0) or (Pos('TEL',sl[i])>0) then begin
result:=false;
MessageDlg('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4>ڵ绰<DAB5>ʹ<EFBFBD><CDB4><EFBFBD>!',mtWarning,[mbOk],0);
end;
}
end;
Lines:=ControlLines(sl.Count,1,0,'<27>ջ<EFBFBD><D5BB><EFBFBD>'); //LinesCount,CorpTypeid,BsTypeid:Integer;SName:string
if Lines<>'' then
begin
result:=false;
MessageDlg('EDI<44><49>Ϣ<EFBFBD><CFA2>'+Lines+'!',mtWarning,[mbOk],0);
// Exit;
end;
if bsck.Checked then
begin
sl.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').asstring);
for i:=0 to sl.Count-1 do
begin
if IsZhongwen(sl[i]) then
begin
result:=false;
MessageDlg('<27>ֵ<EFBFBD>EDI<44><49>Ϣ<EFBFBD><CFA2><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42>!',mtWarning,[mbOk],0);
// exit;
end;
if Length(sl[i])>35 then begin
result:=false;
MessageDlg('<27>ֵ<EFBFBD><D6B5>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>35<33><35><EFBFBD>ַ<EFBFBD>!',mtWarning,[mbOk],0);
// exit;
end;
{
if (Pos('TEL',sl[i])>0) or (Pos('TEL',sl[i])>0) then begin
result:=false;
MessageDlg('<27><>Ʊ<EFBFBD>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4>ڵ绰<DAB5>ʹ<EFBFBD><CDB4><EFBFBD>!',mtWarning,[mbOk],0);
end;
}
end;
Lines:=ControlLines(sl.Count,1,1,'<27>ջ<EFBFBD><D5BB><EFBFBD>'); //LinesCount,CorpTypeid,BsTypeid:Integer;SName:string
if Lines<>'' then
begin
result:=false;
MessageDlg('<27>ֵ<EFBFBD>EDI<44><49>Ϣ<EFBFBD><CFA2>'+Lines+'!',mtWarning,[mbOk],0);
// Exit;
end;
end;
sl.Clear;
sl.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').asstring);
for i:=0 to sl.Count-1 do begin
if IsZhongwen(sl[i]) then begin
result:=false;
MessageDlg('EDI<44><49>Ϣ<EFBFBD><CFA2>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42>!',mtWarning,[mbOk],0);
end;
if Length(sl[i])>35 then begin
result:=false;
MessageDlg('֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>35<33><35><EFBFBD>ַ<EFBFBD>!',mtWarning,[mbOk],0);
// exit;
end;
{
if (Pos('TEL',sl[i])>0) or (Pos('TEL',sl[i])>0) then begin
result:=false;
MessageDlg('֪ͨ<CDA8>˴<EFBFBD><CBB4>ڵ绰<DAB5>ʹ<EFBFBD><CDB4><EFBFBD>!',mtWarning,[mbOk],0);
end;
}
end;
Lines:=ControlLines(sl.Count,2,0,'֪ͨ<CDA8><D6AA>'); //LinesCount,CorpTypeid,BsTypeid:Integer;SName:string
if Lines<>'' then
begin
result:=false;
MessageDlg('EDI<44><49>Ϣ<EFBFBD><CFA2>'+Lines+'!',mtWarning,[mbOk],0);
// Exit;
end;
if bsck.Checked then
begin
sl.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').asstring);
for i:=0 to sl.Count-1 do begin
if IsZhongwen(sl[i]) then begin
result:=false;
MessageDlg('<27>ֵ<EFBFBD>EDI<44><49>Ϣ<EFBFBD><CFA2>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42>!',mtWarning,[mbOk],0);
end;
if Length(sl[i])>35 then begin
result:=false;
MessageDlg('<27>ֵ<EFBFBD>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>35<33><35><EFBFBD>ַ<EFBFBD>!',mtWarning,[mbOk],0);
// exit;
end;
{
if (Pos('TEL',sl[i])>0) or (Pos('TEL',sl[i])>0) then begin
result:=false;
MessageDlg('<27>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4>ڵ绰<DAB5>ʹ<EFBFBD><CDB4><EFBFBD>!',mtWarning,[mbOk],0);
end;
}
end;
Lines:=ControlLines(sl.Count,2,1,'֪ͨ<CDA8><D6AA>'); //LinesCount,CorpTypeid,BsTypeid:Integer;SName:string
if Lines<>'' then
begin
result:=false;
MessageDlg('<27>ֵ<EFBFBD>EDI<44><49>Ϣ<EFBFBD><CFA2>'+Lines+'!',mtWarning,[mbOk],0);
// Exit;
end;
end;
sl.Clear;
sl.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('<27><>ͷ').asstring);
for i:=0 to sl.Count-1 do begin
if IsZhongwen(sl[i]) then begin
result:=false;
MessageDlg('EDI<44><49>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42>!',mtWarning,[mbOk],0);
end;
if Length(sl[i])>35 then begin
result:=false;
MessageDlg('<27><>ͷ<EFBFBD><CDB7>ÿ<EFBFBD><C3BF><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>35<33><35><EFBFBD>ַ<EFBFBD>!',mtWarning,[mbOk],0);
// exit;
end;
end;
sl.Clear;
sl.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring);
for i:=0 to sl.Count-1 do begin
if IsZhongwen(sl[i]) then begin
result:=false;
MessageDlg('EDI<44><49>Ϣ<EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42>!',mtWarning,[mbOk],0);
end;
end;
if bsck.Checked then
begin
sl.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><>ͷ').asstring);
for i:=0 to sl.Count-1 do begin
if IsZhongwen(sl[i]) then begin
result:=false;
MessageDlg('<27>ֵ<EFBFBD>EDI<44><49>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42>!',mtWarning,[mbOk],0);
end;
if Length(sl[i])>35 then begin
result:=false;
MessageDlg('<27>ֵ<EFBFBD><D6B5><EFBFBD>ͷ<EFBFBD><CDB7>ÿ<EFBFBD><C3BF><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>35<33><35><EFBFBD>ַ<EFBFBD>!',mtWarning,[mbOk],0);
// exit;
end;
end;
end;
if bsck.Checked then
begin
sl.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring);
for i:=0 to sl.Count-1 do begin
if IsZhongwen(sl[i]) then
begin
result:=false;
MessageDlg('<27>ֵ<EFBFBD>EDI<44><49>Ϣ<EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42>!',mtWarning,[mbOk],0);
end;
end;
end;
FreeAndNil(sl);
if trim(frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('װ<>۴<EFBFBD><DBB4><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
end;
if Length(trim(frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring))<>5 then begin
result:=false;
MessageDlg('װ<>۴<EFBFBD><DBB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ5<CEAA><35><EFBFBD>ַ<EFBFBD>',mtWarning,[mbOk],0);
end;
{
if trim(GetLoadPortEdiID(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring))='' then begin
result:=false;
MessageDlg('װ<>۴<EFBFBD><DBB4><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ά<EFBFBD><CEAC> EDI<44><49><EFBFBD><EFBFBD>',mtWarning,[mbOk],0);
exit;
end;
}
if trim(frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD>˸۲<CBB8><DBB2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
if trim(frm_op_seae.t_op_seae.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 frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asDateTime<(now-120) then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD><EFBFBD>ڽ<EFBFBD><DABD>յ<EFBFBD>120<32><30><EFBFBD><EFBFBD>!',mtWarning,[mbOk],0);
// exit;
end;
if RadioGroup1.ItemIndex=1 then
begin
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD>β<EFBFBD><CEB2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
end;
if trim(frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵش<C4B5><D8B4><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('Ŀ<>ĵش<C4B5><D8B4><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
end;
if Length(trim(frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵش<C4B5><D8B4><EFBFBD>').asstring))<>5 then begin
result:=false;
MessageDlg('Ŀ<>ĵش<C4B5><D8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ5<CEAA><35><EFBFBD>ַ<EFBFBD>',mtWarning,[mbOk],0);
end;
if trim(frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('Ŀ<>ĵز<C4B5><D8B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
//xit;
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>ص㲻<D8B5><E3B2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
}
if trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
end;
if Length(trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring))<>5 then begin
result:=false;
MessageDlg('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>',mtWarning,[mbOk],0);
// exit;
end;
{
if trim(GetPortEdiID(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring))='' then begin
result:=false;
MessageDlg('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
exit;
end;
}
if trim(frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('ж<><D0B6><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
if not bsck.Checked then
begin
if GetPkgCode(trim(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring))='' then begin
result:=false;
MessageDlg('<27><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
end
else
begin
if GetPkgCode(trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><>װ').asstring))='' then begin
result:=false;
MessageDlg('<27><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
end;
if not bsck.Checked then
begin
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then
begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
end
else
begin
if trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then
begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
end;
if not bsck.Checked then
begin
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><>ͷ').asstring)='' then begin
result:=false;
MessageDlg('<27><>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
end
else
begin
if trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><>ͷ').asstring)='' then begin
result:=false;
MessageDlg('<27><>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
end;
if not bsck.Checked then
begin
if frm_op_seae.t_op_seae.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 frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat=0 then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
if frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat=0 then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
end
else
begin
if frm_op_seae_assistant.t_op_seae_assistant.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 frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat=0 then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
if frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat=0 then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
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 GetStrNum(trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring))<>3 then
begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD>¶ȱ<C2B6><C8B1><EFBFBD><EFBFBD><EFBFBD><33><CEBB><EFBFBD><EFBFBD>',mtWarning,[mbOk],0);
// exit;
end;
end;
if RadioGroup1.ItemIndex=1 then begin
if (trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD>ص<EFBFBD>').asstring)='')
or (GetPortEdiID(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD>ص<EFBFBD>').asstring)='')
then begin //ǩ<><C7A9><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
result:=false;
MessageDlg('ǩ<><C7A9><EFBFBD>ص<EFBFBD>(<28><>edi<64><69><EFBFBD><EFBFBD>)<29><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
end;
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='' then begin
result:=false;
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB2BB>Ϊ<EFBFBD><CEAA>',mtWarning,[mbOk],0);
// exit;
end;
if not bsck.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.Ʒ<><C6B7>');
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.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_fendan.Ʒ<><C6B7>');
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.Parameters.ParamByName('as_id').Value:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('as_id').asinteger;
end;
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
cntrs:=GetCtnCode(t_op_ctn.fieldByName('<27><><EFBFBD><EFBFBD>').asString,t_op_ctn.fieldByName('<27>ߴ<EFBFBD>').asString);
if cntrs='' then begin
result:=false;
MessageDlg('<27><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>EDI<44><49><EFBFBD><EFBFBD><EBB2BB><EFBFBD><EFBFBD>!',mtWarning,[mbOk],0);
// exit;
end;
if t_op_ctn.fieldByName('Ʒ<><C6B7>').asString='' then
begin
if Goods='' then
Goods:=t_op_ctn.fieldByName('<27><><EFBFBD><EFBFBD>').asString+t_op_ctn.fieldByName('<27>ߴ<EFBFBD>').asString
else Goods:=Goods+#13#10+t_op_ctn.fieldByName('<27><><EFBFBD><EFBFBD>').asString+t_op_ctn.fieldByName('<27>ߴ<EFBFBD>').asString;
end;
t_op_ctn.next;
end;
{
if trim(Goods)<>'' then
MessageDlg('ע<><D7A2>'+#13#10+Goods+#13#10+'<27><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!',mtWarning,[mbOk],0);
}
end;
function Tfrm_op_seae_edi_cargosmart.get_goods(str:widestring):widestring;
var
str_all:Tstringlist;
r_str:widestring;
i:integer;
begin
str:=Changestr(trim(str));
str_all:=Tstringlist.Create;
str_all.Text:=str;
for i:=0 to str_all.Count-1 do
begin
r_str:=r_str+' '+str_all[i];
end;
result:=trim(r_str);
end;
function Tfrm_op_seae_edi_cargosmart.GetCtnCode(ctnkind,ctnsize:String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
ctnsize:=StringReplace(ctnsize,'''','''''',[rfReplaceAll]);
try
with aQuery do
begin
Close;SQL.Clear;
SQL.Add('Select EDI<44><49><EFBFBD><EFBFBD> from t_code_ctn where <20><><EFBFBD><EFBFBD>='''+ctnkind+''' and <20>ߴ<EFBFBD>='''+ctnsize+'''');
Open;
if not IsEmpty then
Result:=Trim(FieldByName('EDI<44><49><EFBFBD><EFBFBD>').asstring)
else
Result:='';
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_edi_cargosmart.GetPkgCode(Pkg: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_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_cargosmart.GetPort(PortID:String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select <20>ۿ<EFBFBD><DBBF><EFBFBD><EFBFBD><EFBFBD> Ӣ<><D3A2><EFBFBD><EFBFBD> from t_code_edi_port where EDI<44><49><EFBFBD><EFBFBD>='''+PortID+'''');
Open;
if not IsEmpty then
Result:=Trim(FieldByName('Ӣ<><D3A2><EFBFBD><EFBFBD>').asstring)
else
Result:='';
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_edi_cargosmart.GetLoadPortEdiID(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_loaport 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_cargosmart.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_cargosmart.GetShipEdiNO(Ship:String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select <20><><EFBFBD><EFBFBD>,EDI<44><49><EFBFBD><EFBFBD>,<2C>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,<2C>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><C2BC><EFBFBD><EFBFBD><><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_crm_client');
SQL.Add('where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''Ŀ<><C4BF>'' and <20><><EFBFBD><EFBFBD>˾=1 and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+Ship+'''');
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_cargosmart.Changestr(str:widestring):string;
var
i:integer;
strC:widestring;
begin
strC:=str;
strC:=StringReplace(strC,'''''','&quot;',[rfReplaceAll]);
strC:=StringReplace(strC,'''','&apos;',[rfReplaceAll]);
strC:=StringReplace(strC,'&','&amp;',[rfReplaceAll]);
strC:=StringReplace(strC,'>','&gt;',[rfReplaceAll]);
strC:=StringReplace(strC,'<','&lt;',[rfReplaceAll]);
result:=strC;
end;
function Tfrm_op_seae_edi_cargosmart.GetLengthword(var s: String; l: Integer;str:String): String;
var
i:Integer;
b:Boolean;
begin
s:='';
if Length(str)<=l then begin
result:=str;
end else begin
b:=true;
s:=Copy(str,l+1,Length(str)-l);
str:=Copy(str,1,l);
result:='';
for i:=Length(str) downto 1 do begin
if (str[i]<>' ') and b then
s:=str[i]+s
else begin
b:=false;
result:=str[i]+Result;
end;
end;
s:=s+' ';
end;
end;
procedure Tfrm_op_seae_edi_cargosmart.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_cargosmart.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_cargosmart.GetCharNum(str:String):integer;
var
i:integer;
begin
result:=0;
if str='' then exit;
for i:=1 to length(Str) do begin
if str[i] in ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'] then
result:=result+1;
end;
end;
function Tfrm_op_seae_edi_cargosmart.IsZhongwen(Str: String): Boolean;
var
i:Integer;
begin
Result:=false;
if Str='' then Exit;
for i:=1 to Length(Str) do begin
if (Str[i]>Chr(127)) or (Str[i]=Chr(9)) then begin
// if (Str[i]>Chr(127)) or (Str[i]=Chr(9)) or (Str[i]='<') or (Str[i]='>') then begin
Result:=True;
Exit;
end;
end;
end;
function Tfrm_op_seae_edi_cargosmart.get_txtBooking(strL:Tstringlist;afilename:String):integer;
var
str_all,sl:Tstringlist;
j,Count,i,k:integer;
str_guodu,str_shr,str_con,str_not:widestring;
str_pay,Str_head,sControlNumber: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;
sControlNumber:=frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
sControlNumber:=Copy(sControlNumber,Length(sControlNumber)-6,7);
StrL.Add('<InterchangeControlHeader>');
StrL.Add('<ControlNumber>EDI' + sControlNumber + '</ControlNumber>');
StrL.Add('<SenderId>' + Trim(Edit1.text) + '</SenderId>');
StrL.Add('<ReceiverId>' + Trim(Edit3.text) + '</ReceiverId>');
StrL.Add('<DateTime>' +formatdatetime('yyyymmddhhnnss',now)+ '</DateTime>');
StrL.Add('<ControlVersion>5.9</ControlVersion>');
StrL.Add('<UsageIndicator>T</UsageIndicator>');
sControlNumber:=frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
sControlNumber:=Copy(sControlNumber,Length(sControlNumber)-5,6);
StrL.Add('<MessageSessionId>' +sControlNumber+ '</MessageSessionId>');
StrL.Add('</InterchangeControlHeader>');
StrL.Add('<Request>');
StrL.Add('<GeneralInfo>');
StrL.Add('<TransactionInfo>');
sControlNumber:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>յ<EFBFBD><D5B5><EFBFBD>').asstring;
StrL.Add('<BatchNumber>' +sControlNumber+ '</BatchNumber>');
StrL.Add('<MessageSender>' + Trim(Edit1.text) + '</MessageSender>');
StrL.Add('<MessageRecipient>' + Trim(Edit3.text) + '</MessageRecipient>');
StrL.Add('<MessageID>BRXML</MessageID>');
StrL.Add('<DateCreated TimeZone="HKT">' +formatdatetime('yyyymmddhhnnss',now)+ '</DateCreated>');
StrL.Add('<FileName>' +afilename+ '</FileName>');
StrL.Add('<Version>1.0</Version>');
StrL.Add('</TransactionInfo>');
if RadioGroup3.ItemIndex=1 then
StrL.Add('<ActionType>UPD</ActionType>')
else
StrL.Add('<ActionType>NEW</ActionType>');
StrL.Add('<SCAC>' +aCarrier.EdiNo+ '</SCAC>');
StrL.Add('<Offices>');
StrL.Add('<BookingOffice></BookingOffice>');
StrL.Add('<BookingOfficeName></BookingOfficeName>');
StrL.Add('<BLIssuingOffice></BLIssuingOffice>');
StrL.Add('<CargoOrigin></CargoOrigin>');
StrL.Add('</Offices>');
StrL.Add('<Requested>');
StrL.Add('<By>' +aCarrier.EdiNo+ '</By>');
StrL.Add('<Date TimeZone="HKT">' +formatdatetime('yyyymmddhhnnss',now)+ '</Date>');
StrL.Add('</Requested>');
StrL.Add('</GeneralInfo>');
StrL.Add('<ShipmentDetails>');
StrL.Add('<UserReferences>');
StrL.Add('<References>');
StrL.Add('<ReferenceType>CR</ReferenceType>');
StrL.Add('<ReferenceNumber>' +frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>յ<EFBFBD><D5B5><EFBFBD>').asstring+ '</ReferenceNumber>');
StrL.Add('</References>');
if trim(frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>').asstring)<>'' then begin //<2F><><EFBFBD><EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>
StrL.Add('<References>');
StrL.Add('<ReferenceType>CT</ReferenceType>');
StrL.Add('<ReferenceNumber>' +frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>').asstring+ '</ReferenceNumber>');
StrL.Add('</References>');
end;
StrL.Add('</UserReferences>');
StrL.Add('<LegalParties>');
StrL.Add('<Party>');
StrL.Add('<PartyType>SH</PartyType>');
if not bsck.checked then
begin
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring);
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;
StrL.Add('<PartyName>' +str_all[0]+ '</PartyName>');
StrL.Add('<PartyLocation>');
if (str_all.Count>1) then begin
StrL.Add('<Address>');
for j:=1 to str_all.Count-1 do
begin
StrL.Add('<AddressLines>'+str_all[j]+'</AddressLines>');
end;
StrL.Add('</Address>');
end;
StrL.Add('<City>' +Edit19.text+ '</City>');
StrL.Add('</PartyLocation>');
StrL.Add('</Party>');
StrL.Add('<Party>');
StrL.Add('<PartyType>CN</PartyType>');
if not bsck.checked then
begin
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').asstring);
end
else
begin
str_all.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').asstring);
end;
StrL.Add('<PartyName>' +str_all[0]+ '</PartyName>');
StrL.Add('<PartyLocation>');
if (str_all.Count>1) then begin
StrL.Add('<Address>');
for j:=1 to str_all.Count-1 do
begin
StrL.Add('<AddressLines>'+str_all[j]+'</AddressLines>');
end;
StrL.Add('</Address>');
end;
StrL.Add('<City>' +frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring+ '</City>');
StrL.Add('</PartyLocation>');
StrL.Add('</Party>');
StrL.Add('<Party>');
StrL.Add('<PartyType>NP</PartyType>');
if not bsck.checked then
begin
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').asstring);
end
else
begin
str_all.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').asstring);
end;
StrL.Add('<PartyName>' +str_all[0]+ '</PartyName>');
StrL.Add('<PartyLocation>');
if (str_all.Count>1) then begin
StrL.Add('<Address>');
for j:=1 to str_all.Count-1 do
begin
StrL.Add('<AddressLines>'+str_all[j]+'</AddressLines>');
end;
StrL.Add('</Address>');
end;
StrL.Add('<City>' +frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring+ '</City>');
StrL.Add('</PartyLocation>');
StrL.Add('</Party>');
StrL.Add('<Party>');
StrL.Add('<PartyType>BP</PartyType>');
StrL.Add('<PartyName>' +edit2.text+ '</PartyName>');
StrL.Add('<CarrierCustomerCode>' +edit12.text+ '</CarrierCustomerCode>');
StrL.Add('<PartyLocation>');
{
StrL.Add('<Address>');
StrL.Add('<AddressLines></AddressLines>');
StrL.Add('</Address>');
}
StrL.Add('<City>' +Edit19.text+ '</City>');
StrL.Add('</PartyLocation>');
StrL.Add('<ContactPerson>');
StrL.Add('<FirstName>' +Edit7.text+ '</FirstName>');
StrL.Add('<Email>' +Edit6.text+ '</Email>');
StrL.Add('</ContactPerson>');
StrL.Add('</Party>');
StrL.Add('</LegalParties>');
StrL.Add('<RouteInformation>');
StrL.Add('<IntendedDates>');
StrL.Add('<From TimeZone="LOCAL">' +formatdatetime('yyyymmddhhnnss',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asdatetime)+ '</From>');
if (frm_op_seae.t_op_seae.fieldbyname('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring<>'') then
StrL.Add('<To TimeZone="LOCAL">' +formatdatetime('yyyymmddhhnnss',frm_op_seae.t_op_seae.fieldbyname('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asdatetime)+ '</To>');
StrL.Add('<Range>S</Range>');
StrL.Add('</IntendedDates>');
StrL.Add('<Location>');
StrL.Add('<FunctionCode>POR</FunctionCode>');
StrL.Add('<LocationName>' +frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring+ '</LocationName>');
StrL.Add('<LocationDetails>');
StrL.Add('<City>' +frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring+ '</City>');
StrL.Add('<LocationCode>');
StrL.Add('<UNLocationCode>' +frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring+ '</UNLocationCode>');
StrL.Add('</LocationCode>');
StrL.Add('</LocationDetails>');
StrL.Add('</Location>');
StrL.Add('<Location>');
StrL.Add('<FunctionCode>FND</FunctionCode>');
StrL.Add('<LocationName>' +frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring+ '</LocationName>');
StrL.Add('<LocationDetails>');
StrL.Add('<City>' +frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring+ '</City>');
StrL.Add('<LocationCode>');
StrL.Add('<UNLocationCode>' +frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+ '</UNLocationCode>');
StrL.Add('</LocationCode>');
StrL.Add('</LocationDetails>');
StrL.Add('</Location>');
StrL.Add('<Intermodal>');
StrL.Add('<VesselVoyageInformation>');
StrL.Add('<ServiceName Code=""/>');
StrL.Add('<VoyageNumberDirection>' +frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+ '</VoyageNumberDirection>');
StrL.Add('<VesselInformation>');
StrL.Add('<VesselName>' +frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+ '</VesselName>');
StrL.Add('</VesselInformation>');
StrL.Add('<External>');
StrL.Add('<VesselCode Type="Z"/>');
StrL.Add('</External>');
StrL.Add('</VesselVoyageInformation>');
StrL.Add('<Location>');
StrL.Add('<FunctionCode>POL</FunctionCode>');
StrL.Add('<LocationName>' +frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring+ '</LocationName>');
StrL.Add('<LocationDetails>');
StrL.Add('<City>' +frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring+ '</City>');
StrL.Add('<LocationCode>');
StrL.Add('<UNLocationCode>' +frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring+ '</UNLocationCode>');
StrL.Add('</LocationCode>');
StrL.Add('</LocationDetails>');
StrL.Add('</Location>');
StrL.Add('<Location>');
StrL.Add('<FunctionCode>POD</FunctionCode>');
StrL.Add('<LocationName>' +frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring+ '</LocationName>');
StrL.Add('<LocationDetails>');
StrL.Add('<City>' +frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring+ '</City>');
StrL.Add('<LocationCode>');
StrL.Add('<UNLocationCode>' +frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+ '</UNLocationCode>');
StrL.Add('</LocationCode>');
StrL.Add('</LocationDetails>');
StrL.Add('</Location>');
StrL.Add('</Intermodal>');
StrL.Add('</RouteInformation>');
StrL.Add('<EquipmentInformation>');
if not bsck.Checked then
begin
t_op_ctn.Close;t_op_ctn.SQL.Clear;
t_op_ctn.SQL.Add('SELECT t_op_ctn.<2E><><EFBFBD><EFBFBD>,SUM(t_op_ctn.<2E><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>, t_code_ctn.EDI<44><49><EFBFBD><EFBFBD>,t_op_ctn.<2E>ߴ<EFBFBD>');
t_op_ctn.SQL.Add(',t_op_ctn.<2E><><EFBFBD><EFBFBD>,sum(t_op_ctn.<2E><><EFBFBD><EFBFBD>) KGS,sum(t_op_ctn.<2E><><EFBFBD><EFBFBD>) CBM,sum(t_op_ctn.<2E><><EFBFBD><EFBFBD>) PKGS');
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.SQL.Add('group by t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_code_ctn.EDI<44><49><EFBFBD><EFBFBD>,t_op_ctn.<2E>ߴ<EFBFBD>,t_op_ctn.<2E><><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>,SUM(t_op_ctn_fendan.<2E><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>, t_code_ctn.EDI<44><49><EFBFBD><EFBFBD>,t_op_ctn_fendan.<2E>ߴ<EFBFBD>');
t_op_ctn.SQL.Add(',t_op_ctn_fendan.<2E><><EFBFBD><EFBFBD>,sum(t_op_ctn_fendan.<2E><><EFBFBD><EFBFBD>) KGS,SUM(t_op_ctn_fendan.<2E><><EFBFBD><EFBFBD>) CBM,sum(t_op_ctn_fendan.<2E><><EFBFBD><EFBFBD>) pkgs');
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.SQL.Add('group by 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><><EFBFBD><EFBFBD>');
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
StrL.Add('<Containers>');
StrL.Add('<ContainerType>' +GetCtnCode(t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,t_op_ctn.fieldbyname('<27>ߴ<EFBFBD>').asstring)+ '</ContainerType>');
StrL.Add('<Quantity>' +t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+ '</Quantity>');
{
StrL.Add('<Package Type="'+GetPkgCode(trim(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring))+'">' +t_op_ctn.fieldbyname('PKGS').asstring+ '</Package>');
StrL.Add('<Weight Units="KGS" Qualifier="GROSS">' +t_op_ctn.fieldbyname('KGS').asstring+ '</Weight>');
StrL.Add('<Volume Type="CBM">' +t_op_ctn.fieldbyname('CBM').asstring+ '</Volume>');
}
StrL.Add('<OutBound>');
StrL.Add('<isMerchantHaulage>1</isMerchantHaulage>');
StrL.Add('</OutBound>');
StrL.Add('<InBound>');
StrL.Add('<isMerchantHaulage>1</isMerchantHaulage>');
StrL.Add('</InBound>');
StrL.Add('</Containers>');
t_op_ctn.Next;
end;
StrL.Add('</EquipmentInformation>');
StrL.Add('<CargoInformation>');
StrL.Add('<CargoDetails>');
if frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring='R' then
StrL.Add('<CargoNature>RF</CargoNature>')
else if frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring='D' then
StrL.Add('<CargoNature>DG</CargoNature>')
else
StrL.Add('<CargoNature>GC</CargoNature>');
sl:=TStringList.Create;
try
if not bsck.Checked then
begin
str_guodu:=Changestr(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring);
end
else
begin
str_guodu:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring);
end;
str_guodu:=StringReplace(str_guodu,#13#10,' ',[rfReplaceAll]);
if (Length(sl.Text)<=60) then
StrL.Add('<CargoDescription>'+str_guodu+'</CargoDescription>')
else
StrL.Add('<CargoDescription>'+copy(str_guodu,1,60)+'</CargoDescription>');
finally
FreeAndNil(sl);
end;
StrL.Add('<Packaging>');
StrL.Add('<PackageType>'+GetPkgCode(trim(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring))+'</PackageType>');
StrL.Add('<Quantity>'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'</Quantity>');
StrL.Add('</Packaging>');
StrL.Add('<Weight Units="KGS" Qualifier="GROSS">'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'</Weight>');
StrL.Add('<Volume Units="CBM">' +frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+ '</Volume>');
StrL.Add('<TrafficMode>');
if frm_op_seae.t_op_seae.FieldByName('װ<>˷<EFBFBD>ʽ').asstring='<27><><EFBFBD><EFBFBD>' then
StrL.Add('<OutBound>FCL</OutBound>')
else StrL.Add('<OutBound>LCL</OutBound>');
StrL.Add('</TrafficMode>');
if frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring='R' then begin
StrL.Add('<ReeferSettings>');
StrL.Add('<Temperature Units="C">'+frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+'</Temperature>');
StrL.Add('<Ventilation>'+frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>').asstring+'</Ventilation>');
if (frm_op_seae.t_op_seae.FieldByName('ʪ<><CAAA>').asstring<>'') then
StrL.Add('<DehumidityPercentage>'+frm_op_seae.t_op_seae.FieldByName('ʪ<><CAAA>').asstring+'</DehumidityPercentage>');
StrL.Add('<EmergencyContact>');
StrL.Add('<FirstName>'+t_op_edi.FieldByName('Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD><CFB5>').asstring+'</FirstName>');
StrL.Add('<LastName></LastName>');
StrL.Add('<Phone>');
StrL.Add('<Number>'+t_op_edi.FieldByName('Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD><CFB5>ʽ').asstring+'</Number>');
StrL.Add('</Phone>');
StrL.Add('<Type>OutBound</Type>');
StrL.Add('</EmergencyContact>');
StrL.Add('</ReeferSettings>');
end else if frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring='D' then begin
StrL.Add('<DangerousCargo>');
StrL.Add('<DangerousCargoInfo>');
StrL.Add('<HazardousMaterial>');
StrL.Add('<IMCOClass>'+frm_op_seae.t_op_seae.FieldByName('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring+'</IMCOClass>');
// StrL.Add('<IMCOPage>'+t_op_edi.FieldByName('Σ<><CEA3>Ʒ<EFBFBD>ȼ<EFBFBD>').asstring+'</IMCOPage>');
StrL.Add('<UNNumber>'+frm_op_seae.t_op_seae.FieldByName('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring+'</UNNumber>');
StrL.Add('</HazardousMaterial>');
StrL.Add('<EmergencyContact>');
StrL.Add('<FirstName>'+t_op_edi.FieldByName('Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD><CFB5>').asstring+'</FirstName>');
StrL.Add('<LastName></LastName>');
StrL.Add('<Phone>');
StrL.Add('<Number>'+t_op_edi.FieldByName('Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD><CFB5>ʽ').asstring+'</Number>');
StrL.Add('</Phone>');
StrL.Add('<Type>OutBound</Type>');
StrL.Add('</EmergencyContact>');
StrL.Add('</DangerousCargoInfo>');
StrL.Add('</DangerousCargo>');
end;
StrL.Add('</CargoDetails>');
StrL.Add('</CargoInformation>');
StrL.Add('</ShipmentDetails>');
StrL.Add('<SummaryDetails>');
StrL.Add('<Remarks>');
StrL.Add('<Type>01</Type>');
StrL.Add('<Content>');
sl:=TStringList.Create;
try
if not bsck.checked then
sl.text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('EDI<44><49>ע').asString)
else sl.text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('EDI<44><49>ע').asString);
for i:=0 to sl.Count-1 do begin
StrL.Add('<RemarksLines>'+sl.Strings[i]+'</RemarksLines>');
count:=count+1;
end;
finally
FreeAndNil(sl);
end;
StrL.Add('</Content>');
StrL.Add('</Remarks>');
StrL.Add('</SummaryDetails>');
StrL.Add('</Request>');
end;
function Tfrm_op_seae_edi_cargosmart.get_txtSI(StrL: Tstringlist;afilename:String): integer; //<2F>ᵥȷ<E1B5A5><C8B7>
var
str_all,sl:Tstringlist;
j,Count,i,k:integer;
str_guodu,str_shr,str_con,str_not:widestring;
str_pay,Str_head,sControlNumber,issuetypecode,afrt,bfrt,blcount: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;
sControlNumber:=frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
sControlNumber:=Copy(sControlNumber,Length(sControlNumber)-6,7);
StrL.Add('<InterchangeControlHeader>');
StrL.Add('<ControlNumber>ESI' + sControlNumber + '</ControlNumber>');
StrL.Add('<SenderId>' + Trim(Edit1.text) + '</SenderId>');
StrL.Add('<ReceiverId>' + Trim(Edit3.text) + '</ReceiverId>');
StrL.Add('<DateTime>' +formatdatetime('yyyymmddhhnnss',now)+ '</DateTime>');
StrL.Add('<ControlVersion>401</ControlVersion>');
StrL.Add('<UsageIndicator>T</UsageIndicator>');
sControlNumber:=frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
sControlNumber:=Copy(sControlNumber,Length(sControlNumber)-5,6);
StrL.Add('<MessageSessionId>' +sControlNumber+ '</MessageSessionId>');
StrL.Add('</InterchangeControlHeader>');
StrL.Add('<SIBillOfLading>');
StrL.Add('<GeneralInfo>');
StrL.Add('<TransactionInfo>');
sControlNumber:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>յ<EFBFBD><D5B5><EFBFBD>').asstring;
StrL.Add('<BatchNumber>' +sControlNumber+ '</BatchNumber>');
StrL.Add('<MessageSender>' + Trim(Edit1.text) + '</MessageSender>');
StrL.Add('<MessageRecipient>' + Trim(Edit3.text) + '</MessageRecipient>');
StrL.Add('<MessageID>SIXML</MessageID>');
StrL.Add('<DateCreated TimeZone=\"HKT\">' +formatdatetime('yyyymmddhhnnss',now)+ '</DateCreated>');
StrL.Add('<FileName/>');
StrL.Add('<DataSource>EDI</DataSource>');
StrL.Add('<Version>12</Version>');
StrL.Add('</TransactionInfo>');
if RadioGroup3.ItemIndex=1 then
StrL.Add('<ActionType>UPD</ActionType>')
else
StrL.Add('<ActionType>NEW</ActionType>');
StrL.Add('<BLNumber>' +frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+ '</BLNumber>');
StrL.Add('<SIReferenceNumber>' +frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+ '</SIReferenceNumber>');
StrL.Add('<SCAC>' +aCarrier.EdiNo+ '</SCAC>');
StrL.Add('<OwnedBy">' +aCarrier.EdiNo+ '</OwnedBy>');
StrL.Add('<SIVersionNumber>12</SIVersionNumber>');
StrL.Add('</GeneralInfo>');
StrL.Add('<BLDetails>');
StrL.Add('<BookingInfo>');
StrL.Add('<BookingNumber>' +frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+ '</BookingNumber>');
StrL.Add('</BookingInfo>');
StrL.Add('<UserReferences>');
StrL.Add('<References>');
StrL.Add('<ReferenceNumber>' +frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+ '</ReferenceNumber>');
StrL.Add('<ReferenceType>FI</ReferenceType>');
StrL.Add('</References>');
StrL.Add('<References>');
StrL.Add('<ReferenceNumber>' +frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+ '</ReferenceNumber>');
StrL.Add('<ReferenceType>BM</ReferenceType>');
StrL.Add('</References>');
StrL.Add('</UserReferences>');
StrL.Add('<LegalParties>');
StrL.Add('<Party>');
StrL.Add('<PartyType>FW</PartyType>');
StrL.Add('<PartyName>' +edit2.text+ '</PartyName>');
StrL.Add('<CarrierCustomerCode>' +edit12.text+ '</CarrierCustomerCode>');
StrL.Add('<PartyLocation>');
{
StrL.Add('<Address>');
StrL.Add('<AddressLines></AddressLines>');
StrL.Add('</Address>');
}
StrL.Add('<City>' +Edit19.text+ '</City>');
StrL.Add('</PartyLocation>');
StrL.Add('<ContactPerson>');
StrL.Add('<FirstName>' +Edit7.text+ '</FirstName>');
StrL.Add('<Email>' +Edit6.text+ '</Email>');
StrL.Add('</ContactPerson>');
StrL.Add('</Party>');
StrL.Add('<Party>');
StrL.Add('<PartyType>BP</PartyType>');
StrL.Add('<PartyName>' +edit2.text+ '</PartyName>');
StrL.Add('<CarrierCustomerCode>' +edit12.text+ '</CarrierCustomerCode>');
StrL.Add('<PartyLocation>');
{
StrL.Add('<Address>');
StrL.Add('<AddressLines></AddressLines>');
StrL.Add('</Address>');
}
StrL.Add('<City>' +Edit19.text+ '</City>');
StrL.Add('</PartyLocation>');
StrL.Add('<ContactPerson>');
StrL.Add('<FirstName>' +Edit7.text+ '</FirstName>');
StrL.Add('<Email>' +Edit6.text+ '</Email>');
StrL.Add('</ContactPerson>');
StrL.Add('</Party>');
StrL.Add('<Party>');
StrL.Add('<PartyType>SH</PartyType>');
if not bsck.checked then
begin
str_all.Text:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring;
str_shr:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring;
end
else
begin
str_all.Text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring;
str_shr:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring;
end;
if length(str_shr)>425 then str_shr:=Copy(str_shr,1,425);
StrL.Add('<PartyName>' +str_all[0]+ '</PartyName>');
StrL.Add('<PartyLocation>');
StrL.Add('<Address>');
for j:=1 to str_all.Count-1 do
begin
StrL.Add('<AddressLines>'+str_all[j]+'</AddressLines>');
end;
StrL.Add('</Address>');
StrL.Add('<City>' +Edit19.text+ '</City>');
StrL.Add('</PartyLocation>');
StrL.Add('<PartyText>'+str_shr+'</PartyText>');
StrL.Add('</Party>');
StrL.Add('<Party>');
StrL.Add('<PartyType>CN</PartyType>');
if not bsck.checked then
begin
str_all.Text:=frm_op_seae.t_op_seae.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').asstring;
str_shr:=frm_op_seae.t_op_seae.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').asstring;
end
else
begin
str_all.Text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').asstring;
str_shr:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').asstring;
end;
if length(str_shr)>425 then str_shr:=Copy(str_shr,1,425);
StrL.Add('<PartyName>' +str_all[0]+ '</PartyName>');
StrL.Add('<PartyLocation>');
StrL.Add('<Address>');
for j:=1 to str_all.Count-1 do
begin
StrL.Add('<AddressLines>'+str_all[j]+'</AddressLines>');
end;
StrL.Add('</Address>');
StrL.Add('<City>' +frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring+ '</City>');
StrL.Add('</PartyLocation>');
StrL.Add('<PartyText>'+str_shr+'</PartyText>');
StrL.Add('</Party>');
StrL.Add('<Party>');
StrL.Add('<PartyType>NP</PartyType>');
if not bsck.checked then
begin
str_all.Text:=frm_op_seae.t_op_seae.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').asstring;
str_shr:=frm_op_seae.t_op_seae.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').asstring;
end
else
begin
str_all.Text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').asstring;
str_shr:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').asstring;
end;
if length(str_shr)>425 then str_shr:=Copy(str_shr,1,425);
StrL.Add('<PartyName>' +str_all[0]+ '</PartyName>');
StrL.Add('<PartyLocation>');
StrL.Add('<Address>');
for j:=1 to str_all.Count-1 do
begin
StrL.Add('<AddressLines>'+str_all[j]+'</AddressLines>');
end;
StrL.Add('</Address>');
StrL.Add('<City>' +frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring+ '</City>');
StrL.Add('</PartyLocation>');
StrL.Add('<PartyText>'+str_shr+'</PartyText>');
StrL.Add('</Party>');
StrL.Add('</LegalParties>');
StrL.Add('<RouteInformation>');
StrL.Add('<VesselVoyageInformation>');
StrL.Add('<ServiceName Code=\"\"/>');
StrL.Add('<VoyageNumberDirection>' +frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+ '</VoyageNumberDirection>');
StrL.Add('<VesselInformation>');
StrL.Add('<VesselName>' +frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+ '</VesselName>');
StrL.Add('</VesselInformation>');
StrL.Add('<External>');
StrL.Add('<VoyageNumber>' +frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+ '</VoyageNumber>');
StrL.Add('</External>');
StrL.Add('<VesselVoyageText>' +frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+ '</VesselVoyageText>');
StrL.Add('<TrafficMode>');
if frm_op_seae.t_op_seae.FieldByName('װ<>˷<EFBFBD>ʽ').asstring='<27><><EFBFBD><EFBFBD>' then
StrL.Add('<OutBound>FCL</OutBound>')
else StrL.Add('<OutBound>LCL</OutBound>');
StrL.Add('</TrafficMode>');
StrL.Add('<Haulage>' +frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+ '</Haulage>');
StrL.Add('</VesselVoyageInformation>');
StrL.Add('<Location>');
StrL.Add('<FunctionCode>POR</FunctionCode>');
StrL.Add('<LocationName>' +frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring+ '</LocationName>');
StrL.Add('<LocationDetails>');
StrL.Add('<City>' +frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring+ '</City>');
StrL.Add('<LocationCode>');
StrL.Add('<UNLocationCode>' +frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring+ '</UNLocationCode>');
StrL.Add('</LocationCode>');
StrL.Add('</LocationDetails>');
StrL.Add('</Location>');
StrL.Add('<Location>');
StrL.Add('<FunctionCode>POL</FunctionCode>');
StrL.Add('<LocationName>' +frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring+ '</LocationName>');
StrL.Add('<LocationDetails>');
StrL.Add('<City>' +frm_op_seae.t_op_seae.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring+ '</City>');
StrL.Add('<LocationCode>');
StrL.Add('<UNLocationCode>' +frm_op_seae.t_op_seae.fieldbyname('װ<>۴<EFBFBD><DBB4><EFBFBD>').asstring+ '</UNLocationCode>');
StrL.Add('</LocationCode>');
StrL.Add('</LocationDetails>');
StrL.Add('</Location>');
StrL.Add('<Location>');
StrL.Add('<FunctionCode>POD</FunctionCode>');
StrL.Add('<LocationName>' +frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring+ '</LocationName>');
StrL.Add('<LocationDetails>');
StrL.Add('<City>' +frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring+ '</City>');
StrL.Add('<LocationCode>');
StrL.Add('<UNLocationCode>' +frm_op_seae.t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+ '</UNLocationCode>');
StrL.Add('</LocationCode>');
StrL.Add('</LocationDetails>');
StrL.Add('</Location>');
StrL.Add('<Location>');
StrL.Add('<FunctionCode>FND</FunctionCode>');
StrL.Add('<LocationName>' +frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring+ '</LocationName>');
StrL.Add('<LocationDetails>');
StrL.Add('<City>' +frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵ<EFBFBD>').asstring+ '</City>');
StrL.Add('<LocationCode>');
StrL.Add('<UNLocationCode>' +frm_op_seae.t_op_seae.fieldbyname('Ŀ<>ĵش<C4B5><D8B4><EFBFBD>').asstring+ '</UNLocationCode>');
StrL.Add('</LocationCode>');
StrL.Add('</LocationDetails>');
StrL.Add('</Location>');
StrL.Add('</RouteInformation>');
StrL.Add('<EquipmentInformation>');
if not bsck.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.SQL.Add(',t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn.<2E><><EFBFBD><EFBFBD> KGS,t_op_ctn.<2E><><EFBFBD><EFBFBD> CBM,t_op_ctn.<2E><><EFBFBD><EFBFBD> PKGS,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.SQL.Add(',t_op_ctn_fendan.<2E><><EFBFBD><EFBFBD>,t_op_ctn_fendan.<2E><><EFBFBD><EFBFBD> KGS,t_op_ctn_fendan.<2E><><EFBFBD><EFBFBD> CBM,t_op_ctn_fendan.<2E><><EFBFBD><EFBFBD> pkgs,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
StrL.Add('<Containers>');
StrL.Add('<AssociatedBookingNumber>' +frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+ '</AssociatedBookingNumber>');
StrL.Add('<ContainerType>' +GetCtnCode(t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,t_op_ctn.fieldbyname('<27>ߴ<EFBFBD>').asstring)+ '</ContainerType>');
StrL.Add('<ContainerNumber CheckDigit=\"'+t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'\">' +t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+ '</ContainerNumber>');
StrL.Add('<SealNumber Type=\"HS\">' +frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ʽ').asstring+ '</SealNumber>');
StrL.Add('<Package Type="'+GetPkgCode(trim(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring))+'">'+t_op_ctn.fieldbyname('PKGS').asstring+ '</Package>');
StrL.Add('<Weight Units=\"KGS\" Qualifier=\"GROSS\">' +t_op_ctn.fieldbyname('KGS').asstring+ '</Weight>');
StrL.Add('<Volume Units=\"CBM\">' +t_op_ctn.fieldbyname('CBM').asstring+ '</Volume>');
StrL.Add('<TrafficMode>');
if frm_op_seae.t_op_seae.FieldByName('װ<>˷<EFBFBD>ʽ').asstring='<27><><EFBFBD><EFBFBD>' then
StrL.Add('<OutBound>FCL</OutBound>')
else StrL.Add('<OutBound>LCL</OutBound>');
StrL.Add('</TrafficMode>');
if frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring='R' then begin
StrL.Add('<ReeferSettings>');
StrL.Add('<Temperature Units=\"C\">'+frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+'</Temperature>');
StrL.Add('<Ventilation>'+frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>').asstring+'</Ventilation>');
if (frm_op_seae.t_op_seae.FieldByName('ʪ<><CAAA>').asstring<>'') then
StrL.Add('<DehumidityPercentage>'+frm_op_seae.t_op_seae.FieldByName('ʪ<><CAAA>').asstring+'</DehumidityPercentage>');
StrL.Add('<EmergencyContact>');
StrL.Add('<FirstName>'+t_op_edi.FieldByName('Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD><CFB5>').asstring+'</FirstName>');
StrL.Add('<LastName></LastName>');
StrL.Add('<Phone>');
StrL.Add('<Number>'+t_op_edi.FieldByName('Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD><CFB5>ʽ').asstring+'</Number>');
StrL.Add('</Phone>');
StrL.Add('<Type>OutBound</Type>');
StrL.Add('</EmergencyContact>');
StrL.Add('</ReeferSettings>');
end;
StrL.Add('</Containers>');
t_op_ctn.Next;
end;
StrL.Add('</EquipmentInformation>');
StrL.Add('<CargoInformation>');
StrL.Add('<CargoItems>');
if frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring='R' then
StrL.Add('<CargoNature>RF</CargoNature>')
else if frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring='D' then
StrL.Add('<CargoNature>DG</CargoNature>')
else
StrL.Add('<CargoNature>GC</CargoNature>');
StrL.Add('<Package Type=\"'+GetPkgCode(trim(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring))+'">'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'</Package>');
StrL.Add('<Weight Units=\"KGS\" Qualifier=\"GROSS\">'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'</Weight>');
StrL.Add('<Volume Units=\"CBM\">'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'</Volume>');
StrL.Add('<CargoDescription>');
sl:=TStringList.Create;
try
if not bsck.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
StrL.Add('<DescriptionLine>'+sl.Strings[i]+'</DescriptionLine>');
end;
finally
FreeAndNil(sl);
end;
StrL.Add('</CargoDescription>');
StrL.Add('<MarksAndNumbers>');
sl:=TStringList.Create;
try
if not bsck.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;
for i:=0 to sl.Count-1 do begin
StrL.Add('<MarksAndNumbersLine>'+sl.Strings[i]+'</MarksAndNumbersLine>');
end;
finally
FreeAndNil(sl);
end;
StrL.Add('</MarksAndNumbers>');
StrL.Add('<HarmonizedTariffSchedule></HarmonizedTariffSchedule>');
if frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring='D' then begin
StrL.Add('<DangerousCargo>');
StrL.Add('<DangerousCargoInfo>');
StrL.Add('<HazardousMaterial>');
StrL.Add('<IMCOClass>'+t_op_edi.FieldByName('Σ<><CEA3>Ʒ<EFBFBD>ȼ<EFBFBD>').asstring+'</IMCOClass>');
// StrL.Add('<IMCOPage>'+t_op_edi.FieldByName('Σ<><CEA3>Ʒ<EFBFBD>ȼ<EFBFBD>').asstring+'</IMCOPage>');
StrL.Add('<UNNumber>'+frm_op_seae.t_op_seae.FieldByName('Σ<><CEA3>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>').asstring+'</UNNumber>');
StrL.Add('</HazardousMaterial>');
StrL.Add('<EmergencyContact>');
StrL.Add('<FirstName>'+t_op_edi.FieldByName('Σ<><CEA3>Ʒ<EFBFBD><C6B7>ϵ<EFBFBD><CFB5>').asstring+'</FirstName>');
StrL.Add('<LastName></LastName>');
StrL.Add('</EmergencyContact>');
StrL.Add('</DangerousCargoInfo>');
StrL.Add('</DangerousCargo>');
end;
t_op_ctn.first;
while not t_op_ctn.eof do
begin
StrL.Add('<CargoDetails>');
StrL.Add('<AssociatedBookingNumber>' +frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+ '</AssociatedBookingNumber>');
StrL.Add('<ContainerNumber CheckDigit=\"'+t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'\">' +t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+ '</ContainerNumber>');
StrL.Add('<Package Type=\"IA\>'+t_op_ctn.fieldbyname('PKGS').asstring+ '</Package>');
StrL.Add('<Weight Units=\"KGS\" Qualifier=\"GROSS\">' +t_op_ctn.fieldbyname('KGS').asstring+ '</Weight>');
StrL.Add('<Volume Units=\"CBM\">' +t_op_ctn.fieldbyname('CBM').asstring+ '</Volume>');
StrL.Add('</CargoDetails>');
t_op_ctn.Next;
end;
StrL.Add('</CargoItems>');
StrL.Add('</CargoInformation>');
StrL.Add('</BLDetails>');
StrL.Add('<SummaryDetails>');
blcount:='3';
if frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='ONE' then
blcount:='1'
else if frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='TWO' then
blcount:='2'
else if frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='THREE' then
blcount:='3'
else if frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='FOUR' then
blcount:='4'
else if frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='FIVE' then
blcount:='5'
else if frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='SIX' then
blcount:='6'
else if frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='SERVEN' then
blcount:='7'
else if frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='EIGHT' then
blcount:='8'
else if frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='NIGHT' then
blcount:='9'
else if frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='TEN' then
blcount:='10'
else if frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='ZERO' then
blcount:='0';
IF trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then begin //<2F><EFBFBD><E1B5A5><EFBFBD><EFBFBD>
issuetypecode:='OBL';
end else if (trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='<27><><EFBFBD>˵<EFBFBD>')
or (trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='SEAWAY')
or (trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='SWB<57><42><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')
or (trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='WAYBILL')
or (trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='SWB<57><42><EFBFBD><EFBFBD>')
then begin
issuetypecode:='SWB';
end else if trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
issuetypecode:='BC';
end ELSE issuetypecode:='ZZ';
if Pos('PREPAID',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)>0 then begin
afrt:='FreightedPrepaid';
bfrt:='PREPAID';
end else if Pos('COLLECT',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)>0 then begin
afrt:='FreightedCollect';
bfrt:='COLLECT';
end;
StrL.Add('<BLInformation BLType=\"'+issuetypecode+'\" FreightType=\"'+afrt+'\">');
StrL.Add('<BLNumber>' +frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+ '</BLNumber>');
StrL.Add('<OnBoardBLDate Type=\"OnBoardVessel\"></OnBoardBLDate>');
StrL.Add('<OriginalBL>');
StrL.Add('<ModeOfTransmission>EDI</ModeOfTransmission>');
StrL.Add('</OriginalBL>');
StrL.Add('<PaymentStatus>'+bfrt+'</PaymentStatus>');
StrL.Add('<Remarks>');
try
if not bsck.checked then
sl.text:=frm_op_seae.t_op_seae.fieldbyname('EDI<44><49>ע').asString
else sl.text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('EDI<44><49>ע').asString;
for i:=0 to sl.Count-1 do begin
StrL.Add('<RemarksLines>'+sl.Strings[i]+'</RemarksLines>');
count:=count+1;
end;
finally
FreeAndNil(sl);
end;
StrL.Add('</Remarks>');
StrL.Add('<SIDistribution>');
StrL.Add('<SIBillOfLadingDistribution BLType=\"'+issuetypecode+'\" FreightType=\"'+afrt+'\">');
if (bfrt='PREPAID') then
StrL.Add('<PartyRole>SH</PartyRole>')
else if (bfrt='COLLECT') then StrL.Add('<PartyRole>CN</PartyRole>');
StrL.Add('<NumberOfCopies>'+blcount+'</NumberOfCopies>');
StrL.Add('</SIBillOfLadingDistribution>');
StrL.Add('</SIDistribution>');
StrL.Add('</BLInformation>');
StrL.Add('</SummaryDetails>');
StrL.Add('</SIBillOfLading>');
end;
procedure Tfrm_op_seae_edi_cargosmart.bsSkinButton1Click(Sender: TObject);
var
str:Tstringlist;
i,Count,get_Count,bill_count:integer;
inifile1:Tinifile;
SIO,ORG,MBL,CARR,MBLNO,ETD,CORP,EMP,EMPDAE,afilename:string;
edi:WideString;
begin
if bsck.Checked then
begin
if frm_op_seae_assistant=nil then
begin
ShowMessage('<27><><EFBFBD><EFBFBD><>к<EFBFBD><D0BA>ᵥ)<29><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>ͷֵ<CDB7>Edi');
exit;
end
end;
afilename:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+GetDatetime(datetimetostr(now),1);
str:=Tstringlist.Create;
str.Clear;
count:=0;
bill_count:=0;
if (CheckIFT.Checked) then begin
count:=0;
bill_count:=0;
if frm_op_seae.dxdbgrid1.SelectedCount>1 then
begin
for i:=0 to frm_op_seae.dxdbgrid1.SelectedCount-1 do
begin
frm_op_seae.t_op_seae.GotoBookmark(pointer(frm_op_seae.dxdbgrid1.selectedrows[i]));
if not isEditrue then
exit;
if RadioGroup1.ItemIndex=1 then
get_Count:=frm_op_seae_edi_cargosmart.get_txtSI_txt(str)
else
get_Count:=frm_op_seae_edi_cargosmart.get_txtBooking_txt(str);
if get_Count=-1 then
exit
else
count:=count+get_Count;
bill_count:=bill_count+1;
end;
str.Add('UNT+'+INTTOSTR(str.count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+#39);
str.Add('UNZ+'+inttostr(bill_count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+#39);
end
else
begin
if not isEditrue then
exit;
if RadioGroup1.ItemIndex=1 then
get_Count:=frm_op_seae_edi_cargosmart.get_txtSI_txt(str)
else
get_Count:=frm_op_seae_edi_cargosmart.get_txtBooking_txt(str);
if get_Count=-1 then
exit
else
count:=count+get_Count;
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;
end else begin
str.Add('<?xml version="1.0" encoding="utf-8"?>');
if RadioGroup1.ItemIndex=1 then
str.Add('<ShippingInstructions>')
else
str.Add('<Booking xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="br.xsd">');
if frm_op_seae.dxdbgrid1.SelectedCount>1 then
begin
for i:=0 to frm_op_seae.dxdbgrid1.SelectedCount-1 do
begin
frm_op_seae.t_op_seae.GotoBookmark(pointer(frm_op_seae.dxdbgrid1.selectedrows[i]));
if not isEditrue then
exit;
if RadioGroup1.ItemIndex=1 then begin
get_Count:=frm_op_seae_edi_cargosmart.get_txtSI(str,afilename)
end else begin
get_Count:=frm_op_seae_edi_cargosmart.get_txtBooking(str,afilename);
end;
if get_Count=-1 then
exit
else
count:=count+get_Count;
bill_count:=bill_count+1;
end;
if RadioGroup1.ItemIndex=1 then
str.Add('</ShippingInstructions>')
else
Str.Add('</Booking>');
end
else
begin
if not isEditrue then
exit;
if RadioGroup1.ItemIndex=1 then begin
get_Count:=frm_op_seae_edi_cargosmart.get_txtSI(str,afilename)
end else begin
get_Count:=frm_op_seae_edi_cargosmart.get_txtBooking(str,afilename);
end;
if get_Count=-1 then
exit
else
count:=count+get_Count;
if RadioGroup1.ItemIndex=1 then
str.Add('</ShippingInstructions>')
else
Str.Add('</Booking>');
end;
end;
for i:=0 to Str.Count-1 do begin
if IsZhongwen(Str[i]) then
begin
MessageDlg('<27><>Ʊҵ<C6B1><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42>,<2C><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD>'+#13#10+Str[i],mtWarning,[mbYes],0);
exit;
end;
end;
SaveDialog1.FileName:=afilename;
if SaveDialog1.Execute then
begin
if (CheckIFT.Checked) then
str.SaveToFile(SaveDialog1.FileName+'.edi')
else str.SaveToFile(SaveDialog1.FileName+'.XML');
showmessage('<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ɳɹ<C9B3><C9B9><EFBFBD>');
end
else
begin
showmessage('<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
exit;
end;
end;
{procedure Tfrm_op_seae_edi_cma.bsSkinButton1Click(Sender: TObject);
var
str:Tstringlist;
i,Count,get_Count,bill_count:integer;
inifile1:Tinifile;
begin
str:=Tstringlist.Create;
str.Clear;
count:=0;
bill_count:=0;
if frm_op_seae.dxdbgrid1.SelectedCount>1 then
begin
for i:=0 to frm_op_seae.dxdbgrid1.SelectedCount-1 do
begin
frm_op_seae.t_op_seae.GotoBookmark(pointer(frm_op_seae.dxdbgrid1.selectedrows[i]));
get_Count:=frm_op_seae_edi_cma.get_txt(str);
if get_Count=-1 then
exit
else
count:=count+get_Count;
bill_count:=bill_count+1;
end;
str.Add('UNT+'+INTTOSTR(count)+'+1'+#39);
str.Add('UNZ+'+inttostr(bill_count)+'+100'+#39);
end
else
begin
get_Count:=frm_op_seae_edi_cma.get_txt(str);
if get_Count=-1 then
exit
else
count:=count+get_Count;
str.Add('UNT+'+INTTOSTR(count)+'+1'+#39);
str.Add('UNZ+1+100'+#39);
end;
SaveDialog1.FileName:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5>').asstring;
if SaveDialog1.Execute then
begin
str.SaveToFile(SaveDialog1.FileName+'.txt');
showmessage('<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ɳɹ<C9B3><C9B9><EFBFBD>');
end
else
begin
showmessage('<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
exit;
end;
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
inifile1.WriteString('INTRA','SEND_CODE',edit1.text);
inifile1.WriteString('INTRA','SEND_NAME',edit2.text);
inifile1.WriteString('INTRA','RECEIVE_CODE',edit3.text);
inifile1.WriteString('INTRA','RECEIVE_NAME',edit4.text);
inifile1.free;
close;
end;}
procedure Tfrm_op_seae_edi_cargosmart.FormShow(Sender: TObject);
var
inifile1:Tinifile;
begin
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
edit1.text:=inifile1.ReadString('EDI','SEND_CODE','');
edit2.text:=inifile1.ReadString('EDI','SEND_NAME','');
edit3.text:=inifile1.ReadString('EDI','RECEIVE_CODE','');
edit4.text:=inifile1.ReadString('EDI','RECEIVE_NAME','');
edit5.text:=inifile1.ReadString('EDI','SEND_TEL','');
edit6.text:=inifile1.ReadString('EDI','SEND_MAIL','');
edit7.text:=inifile1.ReadString('EDI','SEND_ATTN','');
edit8.text:=inifile1.ReadString('EDI','FTPADD','');
edit9.text:=inifile1.ReadString('EDI','FTPNAME','');
edit10.text:=inifile1.ReadString('EDI','FTPPASS','');
edit11.text:=inifile1.ReadString('EDI','FTPPATH','/');
edit13.text:=inifile1.ReadString('EDI','FTPPATHSI','');
edit12.text:=inifile1.ReadString('EDI','COMPANYCODE','');
edit19.text:=inifile1.ReadString('EDI','CITY','');
edit20.text:=inifile1.ReadString('EDI','CARGOSMARTSALEID','');
edit14.text:=inifile1.ReadString('EDI','FTPSIGN','');
RadioGroup1.ItemIndex:=inifile1.ReadInteger('EDI','CMASEND_TYPE',0);
RadioGroup2.ItemIndex:=inifile1.ReadInteger('EDI','CMASEND_CA',0);
edit15.text:=inifile1.ReadString('EDI','FTPADDCMA','');
edit16.text:=inifile1.ReadString('EDI','FTPNAMECMA','');
Edit17.text:=inifile1.ReadString('EDI','FTPPASSCMA','');
Edit18.text:=inifile1.ReadString('EDI','FTPPATHCMA','');
CheckIFT.Checked:=inifile1.ReadBool('EDI','CARGOSMARTISIFT',false);
inifile1.free;
end;
procedure Tfrm_op_seae_edi_cargosmart.bsSkinButton3Click(Sender: TObject);
begin
if frm_op_seae_edi_cargosmart.Width=650 then
frm_op_seae_edi_cargosmart.Width:=305
else
frm_op_seae_edi_cargosmart.Width:=650;
end;
procedure Tfrm_op_seae_edi_cargosmart.bsSkinButton4Click(Sender: TObject);
var
IdFTP1:TIdFTP;
str:widestring;
str_file:widestring;
ftpar,ftpname,ftppass,ftppath,ftppathSI,ScriptPath:String;
StrL:Tstringlist;
i,Count,get_Count,bill_count,i_soi:integer;
SIO,ORG,MBL,CARR,MBLNO,ETD,CORP,EMP,EMPDAE:string;
edi:WideString;
begin
i_soi:=0;
if bsck.Checked then
begin
if frm_op_seae_assistant=nil then
begin
ShowMessage('<27><><EFBFBD><EFBFBD><>к<EFBFBD><D0BA>ᵥ)<29><><EFBFBD><EFBFBD>ͷֵ<CDB7>Edi');
exit;
end
end;
ScriptPath:=ExtractFilePath(ParamStr(0))+'EDIFILE\';
if not DirectoryExists(ScriptPath) then
CreateDir(ScriptPath);
ftpar:=Trim(Edit8.Text);
if ftpar='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FTP<54><50>ַ<EFBFBD><D6B7>',mtWarning,[mbOk],0);
exit;
end;
ftpname:=Trim(Edit9.Text);;
if ftpar='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FTP<54>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbOk],0);
exit;
end;
ftppass:=Trim(Edit10.Text);;
if ftpar='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FTP<54><50><EFBFBD>룡',mtWarning,[mbOk],0);
exit;
end;
ftppath:=Trim(Edit11.Text);
ftppathSI:=Trim(Edit13.Text);
StrL:=Tstringlist.Create;
StrL.Clear;
count:=0;
if (CheckIFT.Checked) then begin
str:=ScriptPath
+frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
+FormatDateTime('yyyy',now)
+FormatDateTime('mm',now)
+FormatDateTime('dd',now)
+FormatDateTime('hh',now)
+FormatDateTime('nn',now)+'.edi';
str_file:=frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
+FormatDateTime('yyyy',now)
+FormatDateTime('mm',now)
+FormatDateTime('dd',now)
+FormatDateTime('hh',now)
+FormatDateTime('nn',now)+'.edi';
count:=0;
bill_count:=0;
if frm_op_seae.dxdbgrid1.SelectedCount>1 then
begin
for i:=0 to frm_op_seae.dxdbgrid1.SelectedCount-1 do
begin
frm_op_seae.t_op_seae.GotoBookmark(pointer(frm_op_seae.dxdbgrid1.selectedrows[i]));
if not isEditrue then
exit;
if RadioGroup1.ItemIndex=1 then
get_Count:=frm_op_seae_edi_cargosmart.get_txtSI_txt(StrL)
else
get_Count:=frm_op_seae_edi_cargosmart.get_txtBooking_txt(StrL);
if get_Count=-1 then
exit
else
count:=count+get_Count;
bill_count:=bill_count+1;
end;
StrL.Add('UNT+'+INTTOSTR(StrL.count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+#39);
StrL.Add('UNZ+'+inttostr(bill_count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+#39);
end
else
begin
if not isEditrue then
exit;
if RadioGroup1.ItemIndex=1 then
get_Count:=frm_op_seae_edi_cargosmart.get_txtSI_txt(StrL)
else
get_Count:=frm_op_seae_edi_cargosmart.get_txtBooking_txt(StrL);
if get_Count=-1 then
exit
else
count:=count+get_Count;
StrL.Add('UNT+'+INTTOSTR(StrL.count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+#39);
StrL.Add('UNZ+1+'+frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+#39);
{
str.Add('UNT+'+INTTOSTR(count)+'+1'+#39);
str.Add('UNZ+1+100'+#39);
}
end;
for i:=0 to StrL.Count-1 do begin
if IsZhongwen(StrL[i]) then begin
MessageDlg('<27><>Ʊҵ<C6B1><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42><EFBFBD><EFBFBD><><3E>ַ<EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD>'+#13#10+Str[i],mtWarning,[mbYes],0);
exit;
end;
end;
end else begin
str:=ScriptPath
+frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
+FormatDateTime('yyyy',now)
+FormatDateTime('mm',now)
+FormatDateTime('dd',now)
+FormatDateTime('hh',now)
+FormatDateTime('nn',now)+'.XML';
str_file:=frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
+FormatDateTime('yyyy',now)
+FormatDateTime('mm',now)
+FormatDateTime('dd',now)
+FormatDateTime('hh',now)
+FormatDateTime('nn',now)+'.XML';
StrL.Add('<?xml version="1.0" encoding="utf-8"?>');
StrL.Add('<Booking xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="br.xsd">');
bill_count:=0;
if frm_op_seae.dxdbgrid1.SelectedCount>1 then
begin
for i:=0 to frm_op_seae.dxdbgrid1.SelectedCount-1 do
begin
frm_op_seae.t_op_seae.GotoBookmark(pointer(frm_op_seae.dxdbgrid1.selectedrows[i]));
if not isEditrue then
exit;
if RadioGroup1.ItemIndex=1 then
get_Count:=frm_op_seae_edi_cargosmart.get_txtSI(StrL,str_file)
else
get_Count:=frm_op_seae_edi_cargosmart.get_txtBooking(StrL,str_file);
if get_Count=-1 then
exit
else
count:=count+get_Count;
bill_count:=bill_count+1;
end;
StrL.Add('</Booking>');
end
else
begin
if not isEditrue then
exit;
if RadioGroup1.ItemIndex=1 then
get_Count:=frm_op_seae_edi_cargosmart.get_txtSI(StrL,str_file)
else
get_Count:=frm_op_seae_edi_cargosmart.get_txtBooking(StrL,str_file);
if get_Count=-1 then
exit
else
count:=count+get_Count;
StrL.Add('</Booking>');
{
str.Add('UNT+'+INTTOSTR(count)+'+1'+#39);
str.Add('UNZ+1+100'+#39);
}
end;
for i:=0 to StrL.Count-1 do begin
if IsZhongwen(StrL[i]) then begin
MessageDlg('<27><>Ʊҵ<C6B1><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42><EFBFBD><EFBFBD><><3E>ַ<EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD>'+#13#10+Str[i],mtWarning,[mbYes],0);
exit;
end;
end;
end;
StrL.SaveToFile(str);
edi:=StrL.Text;
try
IdFTP1:=TIdFTP.Create(application);
with idftp1 do
begin
Username:=ftpname;
Password:=ftppass;
Host:=ftpar;
Connect;
end;
case RadioGroup1.ItemIndex of
0:begin
idftp1.ChangeDir(ftppath);
end;
1:begin
if (Trim(ftppathSI)<>'') then
idftp1.ChangeDir(ftppathSI)
else idftp1.ChangeDir(ftppath);
end;
end;
// idftp1.ChangeDir(ftppath);
idftp1.TransferType:=ftBinary;
idftp1.Put(str,str_file);
idftp1.Disconnect;
showmessage('<27>ļ<EFBFBD><C4BC>ϴ<EFBFBD><CFB4>ɹ<EFBFBD><C9B9><EFBFBD>');
//
if RadioGroup1.ItemIndex=0 then
SIO:='SO'
else SIO:='SI';
if RadioGroup3.ItemIndex=0 then
ORG:='ORG'
else ORG:='AMEND';
IF bsck.Checked then
begin
MBL:='<27>ֵ<EFBFBD>';
MBLNO:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring;
end
else
begin
MBL:='<27><><EFBFBD><EFBFBD>';
MBLNO:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring;
end;
CARR:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring;
CORP:=frm_op_seae.t_op_seae.fieldbyname('ί<>е<EFBFBD>λ').asstring;
EMP:=employee;
EMPDAE:=FormatDateTime('YYYY-MM-DD hh:mm:ss',now);
ETD:=FormatDateTime('YYYY-MM-DD',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value);
Insertt_op_Edi_Log(SIO,ORG,MBL,CARR,MBLNO,ETD,CORP,EMP,EMPDAE,str,edi);
except
on e : exception do
begin
MessageDlg('<27>ļ<EFBFBD><C4BC>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+e.message,mtError,[mbOk],0);
deletefile(str);
i_soi:=1;
// showmessage('<27>ļ<EFBFBD><C4BC>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
end;
idftp1.Free;
if i_soi=0 then UpdateSOIStatus(RadioGroup1.ItemIndex,frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring);
end;
procedure Tfrm_op_seae_edi_cargosmart.FormClose(Sender: TObject;
var Action: TCloseAction);
VAR
inifile1:TIniFile;
begin
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
inifile1.WriteString('EDI','SEND_CODE',edit1.text);
inifile1.WriteString('EDI','SEND_NAME',edit2.text);
inifile1.WriteString('EDI','RECEIVE_CODE',edit3.text);
inifile1.WriteString('EDI','RECEIVE_NAME',edit4.text);
inifile1.WriteString('EDI','SEND_TEL',edit5.text);
inifile1.WriteString('EDI','SEND_MAIL',edit6.text);
inifile1.WriteString('EDI','SEND_ATTN',edit7.text);
inifile1.WriteString('EDI','FTPADD',edit8.text);
inifile1.WriteString('EDI','FTPNAME',edit9.text);
inifile1.WriteString('EDI','FTPPASS',Edit10.text);
inifile1.WriteString('EDI','FTPPATH',Edit11.text);
inifile1.WriteString('EDI','FTPADDCMA',edit15.text);
inifile1.WriteString('EDI','FTPNAMECMA',edit16.text);
inifile1.WriteString('EDI','FTPPASSCMA',Edit17.text);
inifile1.WriteString('EDI','FTPPATHCMA',Edit18.text);
inifile1.WriteString('EDI','COMPANYCODE',Edit12.text);
inifile1.WriteString('EDI','CITY',Edit19.text);
inifile1.WriteString('EDI','CARGOSMARTSALEID',Edit20.text);
inifile1.WriteString('EDI','FTPPATHSI',Edit13.text);
inifile1.WriteString('EDI','FTPSIGN',Edit14.text);
inifile1.WriteInteger('EDI','CMASEND_TYPE',RadioGroup1.ItemIndex);
inifile1.WriteInteger('EDI','CMASEND_CA',RadioGroup2.ItemIndex);
inifile1.WriteBool('EDI','CARGOSMARTISIFT',CheckIFT.Checked);
inifile1.free;
action:=cafree;
frm_op_seae_edi_cargosmart:=nil;
end;
procedure Tfrm_op_seae_edi_cargosmart.bsSkinButton7Click(Sender: TObject);
var
Pnt:Tpoint;
begin
Pnt:=bsSkinButton7.ClientToScreen(Point(0,bsSkinButton7.Height));
PopupMenu3.Popup(Pnt.x,Pnt.y);
end;
function Tfrm_op_seae_edi_cargosmart.get_txtBooking_txt(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+'+Edit1.TEXT+':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 bsck.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 if RadioGroup3.ItemIndex=2 then
str.Add('BGM+335+'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+'SO::000002+1'+#39)
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 if RadioGroup3.ItemIndex=2 then
str.Add('BGM+335+'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+'SO::000002+1'+#39)
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+318:'+GetDatetime(datetimetostr(now),3)+':204'+#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+27+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+28+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+29+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+30+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 not bsck.Checked then
begin
if (Trim(Changestr(frm_op_seae.t_op_seae.fieldbyname('EDI<44><49>ע').asString))<>'') then begin
str.Add('FTX+AAA+++'+Changestr(frm_op_seae.t_op_seae.fieldbyname('EDI<44><49>ע').asString)+#39);
count:=count+1;
end;
end
else
begin
if (Trim(Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('EDI<44><49>ע').asString))<>'') then begin
str.Add('FTX+AAA+++'+Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('EDI<44><49>ע').asString)+#39);
count:=count+1;
end;
end;
str.Add('RFF+SI:'+frm_op_seae.t_op_seae.fieldbyname('ί<>б<EFBFBD><D0B1><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 Trim(frm_op_seae.t_op_seae.fieldbyname('<27>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD>κ<EFBFBD>').asstring)<>'' then
begin
str.Add('TDT+20+'+CutVoyNo(frm_op_seae.t_op_seae.fieldbyname('<27>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD>κ<EFBFBD>').asstring)
+'+1+++++:::'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
end
else
begin
str.Add('TDT+20+'+CutVoyNo(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring)
+'+1++'+GetShipEdiNO(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring)+'+++:::'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
end;
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;
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('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.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;
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;
str.Add('NAD+CA+'+GetShipEdiNO(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring)+':160:86++'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring+#39);
count:=count+1;
str_all.Clear;
str_head:='';
if not bsck.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+++'+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;
if RadioGroup2.ItemIndex=5 then
begin
str_guodu:=str_guodu+':'+Copy(str_all[4],1,34)+'-';
Str_shr:='-'+Copy(str_all[4],34,1);
end
else
begin
str_guodu:=str_guodu+':'+Copy(str_all[4],1,34)+'*';
Str_shr:='*'+Copy(str_all[4],34,1);
end;
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;
if Length(Edit2.text)<=35 then
str.Add('NAD+BK+'+Edit1.TEXT+':160:86++'+Edit2.text+#39)
else str.Add('NAD+BK+'+Edit1.TEXT+':160:86++'+Copy(Edit2.text,1,35)+'+'+Copy(Edit2.text,35,35)+#39);
count:=count+1;
str.Add('CTA+IC+:'+edit7.text+'''');
count:=count+1;
str.Add('COM+'+Edit5.text+':TE'+#39);
count:=count+1;
str.Add('COM+'+Edit6.text+':EM'+#39);
count:=count+1;
if Trim(Edit20.text)<>'' then begin
str.Add('NAD+CP+'+Edit20.TEXT+#39)
end;
{
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;
}
str_head:='';
str_all.Clear;
if not bsck.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+++'+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;
if RadioGroup2.ItemIndex=5 then
begin
str_guodu:=str_guodu+':'+Copy(str_all[4],1,33)+'--';
Str_con:='--'+Copy(str_all[4],33,1);
end
else
begin
str_guodu:=str_guodu+':'+Copy(str_all[4],1,33)+'**';
Str_con:='**'+Copy(str_all[4],33,1);
end;
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;
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='DOOR-DOOR' then
begin
if not bsck.Checked then
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring)
else str_all.Text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>').asstring);
GetLengthTString(str_all,35);
str_guodu:='NAD+SF+++'+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 4 do
begin
str_guodu:=str_guodu+':'+str_all[j]
end;
end;
str_guodu:=str_guodu+#39;
str.Add(str_guodu);
count:=count+1;
str.Add('CTA+IC+:'+edit7.text+'''');
count:=count+1;
str.Add('COM+'+Edit5.text+':TE'+#39);
count:=count+1;
str.Add('COM+'+Edit6.text+':EM'+#39);
count:=count+1;
str_head:='';
str_all.Clear;
if not bsck.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); //t_op_edi
end
else
begin
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').asstring);
end;
if (pos('TO ORDER',UpperCase(str_all.Text))>0) or (pos('SAME AS',UpperCase(str_all.Text))>0) then
if t_op_edi.fieldbyname('<27><><EFBFBD>ڹ<EFBFBD><DAB9><EFBFBD>').AsString<>'' then
begin
str_all.Text:=Changestr(t_op_edi.fieldbyname('֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>').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('<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>').asstring);
end;
GetLengthTString(str_all,35);
str_guodu:='NAD+ST+++'+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 4 do
begin
str_guodu:=str_guodu+':'+str_all[j]
end;
end;
str_guodu:=str_guodu+#39;
str.Add(str_guodu);
count:=count+1;
str.Add('CTA+IC+:'+edit7.text+'''');
count:=count+1;
str.Add('COM+'+Edit5.text+':TE'+#39);
count:=count+1;
str.Add('COM+'+Edit6.text+':EM'+#39);
count:=count+1;
end;
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='DOOR-CY' then
begin
{
str.Add('NAD+SF+++SEAWORTHYQD+.'+#39);
count:=count+1;
}
str_all.Text:=Changestr(edit12.text);
GetLengthTString(str_all,35);
str_guodu:='NAD+SF+++'+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 4 do
begin
str_guodu:=str_guodu+':'+str_all[j]
end;
end;
str_guodu:=str_guodu+#39;
str.Add(str_guodu);
count:=count+1;
str.Add('CTA+IC+:'+edit7.text+'''');
count:=count+1;
str.Add('COM+'+Edit5.text+':TE'+#39);
count:=count+1;
str.Add('COM+'+Edit6.text+':EM'+#39);
count:=count+1;
end;
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='CY-DOOR' then
begin
str_head:='';
str_all.Clear;
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('DOOR<4F><52>ַ').asstring);
GetLengthTString(str_all,35);
str_guodu:='NAD+ST+++'+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 4 do
begin
str_guodu:=str_guodu+':'+str_all[j]
end;
end;
str_guodu:=str_guodu+#39;
str.Add(str_guodu);
count:=count+1;
str.Add('CTA+IC+:'+edit7.text+'''');
count:=count+1;
str.Add('COM+'+Edit5.text+':TE'+#39);
count:=count+1;
str.Add('COM+'+Edit6.text+':EM'+#39);
count:=count+1;
end;
if Length(Edit2.text)<=35 then
str.Add('NAD+FW+'+Edit1.TEXT+':160:86++'+Edit2.text+#39)
else str.Add('NAD+FW+'+Edit1.TEXT+':160:86++'+Copy(Edit2.text,1,35)+'+'+Copy(Edit2.text,35,35)+#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
str.Add('CPI+4++C''');
count:=count+1;
if not bsck.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 bsck.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
str.Add('FTX+AAA+++'+Changestr(sl.Strings[i])+''+#39);
count:=count+1;
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 bsck.Checked then
begin
str.Add('MEA+WT+G+KGM:'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
str.Add('MEA+VOL+AAW+CBM:'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
end
else
begin
str.Add('MEA+WT+G+KGM:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
str.Add('MEA+VOL+AAW+CBM:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
end;
sl:=TStringList.Create;
try
if not bsck.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+:'+edit7.text+#39);
count:=count+1;
str.Add('COM+'+Edit5.text+':TE'+#39);
count:=count+1;
end;
if not bsck.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++'+GetCtnCode(t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,t_op_ctn.fieldbyname('<27>ߴ<EFBFBD>').asstring)+'+1'+#39)
else
str.Add('EQD+CN++'+GetCtnCode(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+PER:'+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+'+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_cargosmart.get_txtSI_txt(str: Tstringlist): integer; //<2F>ᵥȷ<E1B5A5><C8B7>
var
str_all,sl:Tstringlist;
ctnlist:TStringList;
j,Count,i,k,Lineno:integer;
str_guodu,str_shr,str_con,str_not:widestring;
str_pay,Str_head,str1,str2,CopyBillCount:string;
aAdoQuery:TAdoQuery;
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+'+Edit1.TEXT+':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+'+IFTMIN:D:99B:UN'+#39);
count:=count+1;
if not bsck.checked then
begin
if RadioGroup3.ItemIndex=0 then
str.Add('BGM+340+'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+'+9'+#39)
else str.Add('BGM+340+'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+'+5'+#39);
count:=count+1;
end
else
begin
if RadioGroup3.ItemIndex=0 then
str.Add('BGM+340+'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+'+9'+#39)
else str.Add('BGM+340+'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+'+5'+#39);
count:=count+1;
end;
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+27+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+28+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+29+2'+#39);
end;
if trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='CY-CY' then
begin
str.Add('TSR+30+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 not bsck.checked then
begin
str.Add('FTX+AAS+++'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring
+' Payable at '+str_pay+' '+
frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+
' '+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+
trim(frm_op_seae.t_op_seae.fieldbyname('<27><>װ').asstring)+#39);
count:=count+1;
end
else
begin
str.Add('FTX+AAS+++'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring
+' Payable at '+str_pay+' '+
frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+
' '+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+
trim(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><>װ').asstring)+#39);
count:=count+1;
end;
sl:=TStringList.Create;
try
if not bsck.checked then
sl.text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('EDI<44><49>ע').asString)
else sl.text:=Changestr(frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('EDI<44><49>ע').asString);
for i:=0 to sl.Count-1 do begin
str.Add('FTX+AAS+++'+sl.Strings[i]+''+#39);
count:=count+1;
end;
finally
FreeAndNil(sl);
end;
if not bsck.checked then
begin
str.Add('CNT+7:'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+':KGM''');
count:=count+1;
str.Add('CNT+11:'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'''');
count:=count+1;
str.Add('CNT+15:'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+':CBM''');
count:=count+1;
end
else
begin
str.Add('CNT+7:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+':KGM''');
count:=count+1;
str.Add('CNT+11:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'''');
count:=count+1;
str.Add('CNT+15:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+':CBM''');
count:=count+1;
end;
str.Add('CNT+16:'+GetcntCount+#39); //
count:=count+1;
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;
str.Add('LOC+73+'+GetPortEdiID(trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD>ص<EFBFBD>').asstring))
+'::6:'+trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD>ص<EFBFBD>').asstring)+#39);
count:=count+1;
if not (frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asDatetime<(now-120)) then begin
str.Add('DTM+95:'+GetDatetime(datetimetostr(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asDatetime),0)+':102'+#39);
count:=count+1;
end;
if not bsck.checked then
begin
if t_op_edi.IsEmpty or (t_op_edi.FieldByName('<27><><EFBFBD>պ<EFBFBD>').AsString='') then
str.Add('RFF+BN:'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+#39)
else
str.Add('RFF+BN:'+t_op_edi.FieldByName('<27><><EFBFBD>պ<EFBFBD>').AsString+#39);
count:=count+1;
end
else
begin
str.Add('RFF+BN:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+#39);
count:=count+1;
end;
if not bsck.checked then
begin
str.Add('RFF+BM:'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+#39);
count:=count+1;
end
else
begin
str.Add('RFF+BM:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring+#39);
count:=count+1;
end;
{
str.Add('RFF+ON:###NAD-CZ-ZZZ-['+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>˱<EFBFBD><CBB1><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;
str.Add('RFF+SI:'+frm_op_seae.t_op_seae.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asstring+#39); //
count:=count+1;
if (t_op_edi.FieldByName('<27><><EFBFBD>ڹ<EFBFBD><DAB9><EFBFBD>').asstring='<27><><EFBFBD><EFBFBD>') then begin
str.Add('REF+TN:'+t_op_edi.FieldByName('ITN<54><4E><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
end;
if Pos('PREPAID',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ѷ<EFBFBD>ʽ').asstring)>0 then
str.Add('CPI+4++P''')
else
str.Add('CPI+4++C''');
count:=count+1;
if SelectCarrier then
begin
if Trim(frm_op_seae.t_op_seae.fieldbyname('<27>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD>κ<EFBFBD>').asstring)<>'' then
begin
str.Add('TDT+20+'+CutVoyNo(frm_op_seae.t_op_seae.fieldbyname('<27>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD>κ<EFBFBD>').asstring)
+'+1+++++:::'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
end
else
begin
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;
end;
end
else
begin
if Trim(frm_op_seae.t_op_seae.fieldbyname('<27>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD>κ<EFBFBD>').asstring)<>'' then
begin
str.Add('TDT+20+'+CutVoyNo(frm_op_seae.t_op_seae.fieldbyname('<27>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD>κ<EFBFBD>').asstring)
+'+1+++++:::'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
end
else
begin
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;
end;
end;
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+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;
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;
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;
str.Add('NAD+CA+'+GetShipEdiNO(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring)+':160:86++'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring+#39);
count:=count+1;
str_all.Clear;
str_head:='';
if not bsck.checked then
begin
if (t_op_edi.FieldByName('<27><><EFBFBD>ڹ<EFBFBD><DAB9><EFBFBD>').asstring<>'') and (aCarrier.CarrierName<>'OOCL') 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+SH+++'+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;
if RadioGroup2.ItemIndex=5 then
begin
str_guodu:=str_guodu+':'+Copy(str_all[4],1,34)+'-';
Str_shr:='-'+Copy(str_all[4],34,1);
end
else
begin
str_guodu:=str_guodu+':'+Copy(str_all[4],1,34)+'*';
Str_shr:='*'+Copy(str_all[4],34,1);
end;
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 bsck.Checked then
begin
if (t_op_edi.FieldByName('<27><><EFBFBD>ڹ<EFBFBD><DAB9><EFBFBD>').asstring<>'') and (aCarrier.CarrierName<>'OOCL') 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+++'+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;
if RadioGroup2.ItemIndex=5 then
begin
str_guodu:=str_guodu+':'+Copy(str_all[4],1,33)+'--';
Str_con:='--'+Copy(str_all[4],33,1);
end
else
begin
str_guodu:=str_guodu+':'+Copy(str_all[4],1,33)+'**';
Str_con:='**'+Copy(str_all[4],33,1);
end;
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;
//<2F><><EFBFBD><EFBFBD>
str_head:='';
str_all.Clear;
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring);
IF str_all.Count>0 then
begin
GetLengthTString(str_all,35);
str_guodu:='NAD+FW+++'+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;
str_guodu:=str_guodu+#39;
str.Add(str_guodu);
count:=count+1;
end;
str_head:='';
str_all.Clear;
if not bsck.checked then
begin
if (t_op_edi.FieldByName('<27><><EFBFBD>ڹ<EFBFBD><DAB9><EFBFBD>').asstring<>'') and (aCarrier.CarrierName<>'OOCL') 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+N1+++'+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;
if RadioGroup2.ItemIndex=5 then
begin
str_guodu:=str_guodu+':'+Copy(str_all[4],1,32)+'---';
Str_not:='---'+Copy(str_all[4],32,1);
end
else
begin
str_guodu:=str_guodu+':'+Copy(str_all[4],1,32)+'***';
Str_not:='***'+Copy(str_all[4],32,1);
end;
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;
if trim(frm_op_seae.t_op_seae.fieldbyname('<27>ڶ<EFBFBD>֪ͨ<CDA8><D6AA>').asstring)<>'' then
begin
str_head:='';
str_all.Clear;
str_all.Text:=Changestr(frm_op_seae.t_op_seae.fieldbyname('<27>ڶ<EFBFBD>֪ͨ<CDA8><D6AA>').asstring);
GetLengthTString(str_all,35);
str_guodu:='NAD+N2+++'+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;
str_guodu:=str_guodu+#39;
str.Add(str_guodu);
count:=count+1;
end;
{ if RadioGroup2.ItemIndex=0 then
str.Add('NAD+CA+MAEU:160:86++MAERSK'+#39)
else if RadioGroup2.ItemIndex=1 then
str.Add('NAD+CA+MCCQ:160:86++MCC TRANSPORT'+#39)
else if RadioGroup2.ItemIndex=2 then
str.Add('NAD+CA+ANNU:160:86++ANL CONTAINER LINE'+#39);
}
{
if SelectCarrier then
begin
str.Add('NAD+CA+'+aCarrier.EdiNo+':160:86++'+aCarrier.CarrierName+#39);
count:=count+1;
end
else
begin
str.Add('NAD+CA+'+GetShipEdiNO(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring)+':160:86++'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring+#39);
count:=count+1;
end;
}
// str.Add('NAD+CA+'+GetShipEdiNO(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring)+':160:86++'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring+#39);
// count:=count+1;
if Length(Edit2.text)<=35 then
str.Add('NAD+SI+'+Edit1.TEXT+':160:86++'+Edit2.text+#39)
else str.Add('NAD+SI+'+Edit1.TEXT+':160:86++'+Copy(Edit2.text,1,35)+'+'+Copy(Edit2.text,35,35)+#39);
count:=count+1;
str.Add('CTA+IC+:'+edit7.text+'''');
count:=count+1;
str.Add('COM+'+Edit5.text+':TE'+#39);
count:=count+1;
str.Add('COM+'+Edit6.text+':EM'+#39);
count:=count+1;
if frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='ONE' then
Str1:='1'
else if frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='TWO' then
Str1:='2'
else if frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='THREE' then
Str1:='3'
else if frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='FOUR' then
Str1:='4'
else if frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='FIVE' then
Str1:='5'
else if frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='SIX' then
Str1:='6'
else if frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='SERVEN' then
Str1:='7'
else if frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='EIGHT' then
Str1:='8'
else if frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='NIGHT' then
Str1:='9'
else if frm_op_seae.t_op_seae.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='TEN' then
Str1:='10';
if frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='ONE' then
CopyBillCount:='1'
else if frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='TWO' then
CopyBillCount:='2'
else if frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='THREE' then
CopyBillCount:='3'
else if frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='FOUR' then
CopyBillCount:='4'
else if frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='FIVE' then
CopyBillCount:='5'
else if frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='SIX' then
CopyBillCount:='6'
else if frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='SERVEN' then
CopyBillCount:='7'
else if frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='EIGHT' then
CopyBillCount:='8'
else if frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='NIGHT' then
CopyBillCount:='9'
else if frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asstring='TEN' then
CopyBillCount:='10';
IF trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>' then begin //<2F><EFBFBD><E1B5A5><EFBFBD><EFBFBD>
if aCarrier.CarrierName='OOCL' then
Str2:='705'
else
Str2:='706';
if frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>').AsBoolean then
str.Add('DOC+'+Str2+'+:27++'+Str1+#39)
else str.Add('DOC+'+Str2+'+++'+Str1+#39);
count:=count+1;
if trim(CopyBillCount)<>'' then
begin
Str2:='707';
if frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>').AsBoolean then
str.Add('DOC+'+Str2+'+:27++'+CopyBillCount+#39)
else str.Add('DOC+'+Str2+'+++'+CopyBillCount+#39);
count:=count+1;
end;
end else if (trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='<27><><EFBFBD>˵<EFBFBD>')
or (trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='Seaway')
or (trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='SWB<57><42><EFBFBD><EFBFBD>')
or (trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='SWB<57><42><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') then begin //SWB<57><42><EFBFBD><EFBFBD> //SWB<57><42><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Str2:='710';
if frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>').AsBoolean then
str.Add('DOC+'+Str2+'+:27++'+Str1+#39)
else str.Add('DOC+'+Str2+'+++'+Str1+#39);
count:=count+1;
end else if (trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='BILL COPY') or
(trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD>')
then begin
if aCarrier.CarrierName='OOCL' then
Str2:='705'
else Str2:='706';
if frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>').AsBoolean then
str.Add('DOC+'+Str2+'+:27++'+Str1+#39)
else str.Add('DOC+'+Str2+'+++'+Str1+#39);
count:=count+1;
if Trim(CopyBillCount)<>'' then
begin
Str2:='707';
if frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>').AsBoolean then
str.Add('DOC+'+Str2+'+:27++'+CopyBillCount+#39)
else str.Add('DOC+'+Str2+'+++'+CopyBillCount+#39);
count:=count+1;
end;
end else if trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='HOUSE BILL' then begin
Str2:='714';
if frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>').AsBoolean then
str.Add('DOC+'+Str2+'+:27++'+Str1+#39)
else str.Add('DOC+'+Str2+'+++'+Str1+#39);
count:=count+1;
end else if trim(frm_op_seae.t_op_seae.fieldbyname('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').asstring)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
if aCarrier.CarrierName='OOCL' then
Str2:='705'
else Str2:='706';
if frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>').AsBoolean then
str.Add('DOC+'+Str2+'+:27++'+Str1+#39)
else str.Add('DOC+'+Str2+'+++'+Str1+#39);
count:=count+1;
if Trim(CopyBillCount)<>'' then
begin
Str2:='707';
if frm_op_seae.t_op_seae.fieldbyname('<27>˷<EFBFBD>').AsBoolean then
str.Add('DOC+'+Str2+'+:27++'+CopyBillCount+#39)
else str.Add('DOC+'+Str2+'+++'+CopyBillCount+#39);
count:=count+1;
end;
end;
///
ctnlist:=TStringList.Create;
ctnlist.Clear;
with t_op_edictn do
begin
Close;SQL.Clear;
SQL.Add('select ctn_id from t_op_ctn');
SQL.Add('where <20><><EFBFBD><EFBFBD>=:bsno');
Parameters.ParamByName('bsno').Value:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
open;First;
while not eof do
begin
ctnlist.Add(FieldByName('ctn_id').AsString);
Next;
end;
end;
t_op_edictn.Close;t_op_edictn.SQL.Clear;
t_op_edictn.SQL.Add('select * from t_op_ctn_detail');
t_op_edictn.SQL.Add('where ctn_id in ('+ctnlist.CommaText+')');
t_op_edictn.Open;
if t_op_edictn.RecordCount<=0 then
begin
if not bsck.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><>
count:=count+1;
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><>
count:=count+1;
end;
if Trim(frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ʽ').asstring)<>'' then begin // <20><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
str.Add('PIA+5+'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD>ʽ').asstring+':HS'+#39); //<2F><>
count:=count+1;
end;
if RadioGroup1.ItemIndex=0 then
begin
sl:=TStringList.Create;
try
if not bsck.checked then
sl.text:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
else sl.text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
for i:=0 to sl.Count-1 do begin
str.Add('FTX+AAA+++'+Changestr(sl.Strings[i])+''+#39);
count:=count+1;
end;
finally
FreeAndNil(sl);
end;
end
else
begin
sl:=TStringList.Create;
try
if not bsck.checked then
sl.text:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
else sl.text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
for i:=0 to sl.Count-1 do begin
str.Add('FTX+AAA+++'+Changestr(sl.Strings[i])+''+#39);
count:=count+1;
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;
end;
if not bsck.checked then
begin
str.Add('MEA+WT+G+KGM:'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
str.Add('MEA+VOL+AAW+CBM:'+frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
end
else
begin
str.Add('MEA+WT+G+KGM:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
str.Add('MEA+VOL+AAW+CBM:'+frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
end;
if Trim(t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD>NCM<43><4D><EFBFBD><EFBFBD>').asstring)<>'' then
begin
str.Add('RFF+ABT:'+t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD>NCM<43><4D><EFBFBD><EFBFBD>').asstring+#39); //<2F><>
count:=count+1;
end;
sl:=TStringList.Create;
try
if not bsck.checked then
sl.text:=frm_op_seae.t_op_seae.fieldbyname('<27><>ͷ').asString
else sl.text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><>ͷ').asString;
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 not bsck.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
str.Add('SGP+'+t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'+'+t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39); //<2F><><EFBFBD><EFBFBD>
count:=count+1;
str.Add('MEA+WT+G+KGM:'+t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
str.Add('MEA+VOL+AAW+CBM:'+t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
t_op_ctn.next;
end;
end
else //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ
begin
t_op_edictn.Close;t_op_edictn.SQL.Clear;
t_op_edictn.SQL.Add('select hts,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>װ,sum(<28><><EFBFBD><EFBFBD>)<29><><EFBFBD><EFBFBD>,sum(<28><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,sum(<28><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>');
t_op_edictn.SQL.Add('from t_op_ctn_detail');
t_op_edictn.SQL.Add('where ctn_id in ('+ctnlist.CommaText+')');
t_op_edictn.SQL.Add('Group by hts,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>װ');
t_op_edictn.SQL.Add('Order by min(id)');
t_op_edictn.Open;
Lineno:=1;
while not t_op_edictn.eof do
begin
str.Add('GID+'+Inttostr(Lineno)+'+'+t_op_edictn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+':'+
GetPkgCode(trim(t_op_edictn.fieldbyname('<27><>װ').asstring))+'::6:'+t_op_edictn.fieldbyname('<27><>װ').asstring+#39); //<2F><>
count:=count+1;
str.Add('PIA+5+'+t_op_edictn.fieldbyname('hts').asstring+':HS'+#39); //<2F><>
count:=count+1;
sl:=TStringList.Create;
try
sl.text:=t_op_edictn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
for i:=0 to sl.Count-1 do
begin
str.Add('FTX+AAA+++'+Changestr(sl.Strings[i])+''+#39);
count:=count+1;
end;
finally
FreeAndNil(sl);
end;
str.Add('MEA+WT+G+KGM:'+t_op_edictn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
str.Add('MEA+VOL+AAW+CBM:'+t_op_edictn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
if Trim(t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD>NCM<43><4D><EFBFBD><EFBFBD>').asstring)<>'' then
begin
str.Add('RFF+ABT:'+t_op_edi.fieldbyname('<27><><EFBFBD><EFBFBD>NCM<43><4D><EFBFBD><EFBFBD>').asstring+#39); //<2F><>
count:=count+1;
end;
if Lineno=1 then
begin
sl:=TStringList.Create;
try
if not bsck.Checked then
sl.text:=frm_op_seae.t_op_seae.fieldbyname('<27><>ͷ').asString
else sl.text:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><>ͷ').asString;
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;
end;
if (aCarrier.CarrierName='OOCL') THEN begin
aAdoQuery:=CreateAdoQuery;
try
aAdoQuery.Close;aAdoQuery.SQL.Clear;
aAdoQuery.SQL.Add('select t_op_ctn.<2E><><EFBFBD><EFBFBD>,t_op_ctn_detail.<2E><><EFBFBD><EFBFBD>,t_op_ctn_detail.<2E><><EFBFBD><EFBFBD>,t_op_ctn_detail.<2E><><EFBFBD><EFBFBD>');
aAdoQuery.SQL.Add('from t_op_ctn_detail');
aAdoQuery.SQL.Add('left Join t_op_ctn on t_op_ctn.ctn_id=t_op_ctn_detail.ctn_id');
aAdoQuery.SQL.Add('where t_op_ctn.<2E><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD> and t_op_ctn_detail.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:goods and t_op_ctn_detail.<2E><>װ=:pkg and t_op_ctn_detail.hts=:hts');
aAdoQuery.Parameters.ParamByName('goods').Value:=t_op_edictn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
aAdoQuery.Parameters.ParamByName('pkg').Value:=t_op_edictn.fieldbyname('<27><>װ').asstring;
aAdoQuery.Parameters.ParamByName('hts').Value:=t_op_edictn.fieldbyname('hts').asstring;
aAdoQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
aAdoQuery.Open;
while not aAdoQuery.eof do
begin
str.Add('SGP+'+aAdoQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'+'+aAdoQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39); //<2F><><EFBFBD><EFBFBD>
count:=count+1;
str.Add('MEA+WT+G+KGM:'+aAdoQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
str.Add('MEA+VOL+AAW+CBM:'+aAdoQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
aAdoQuery.Next;
end;
finally
aAdoQuery.Free;
end;
end else begin
aAdoQuery:=CreateAdoQuery;
try
aAdoQuery.Close;aAdoQuery.SQL.Clear;
aAdoQuery.SQL.Add('select t_op_ctn.<2E><><EFBFBD><EFBFBD>,sum(t_op_ctn_detail.<2E><><EFBFBD><EFBFBD>)<29><><EFBFBD><EFBFBD>,sum(t_op_ctn_detail.<2E><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,sum(t_op_ctn_detail.<2E><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>');
aAdoQuery.SQL.Add('from t_op_ctn_detail');
aAdoQuery.SQL.Add('left Join t_op_ctn on t_op_ctn.ctn_id=t_op_ctn_detail.ctn_id');
aAdoQuery.SQL.Add('where t_op_ctn.<2E><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD> and t_op_ctn_detail.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:goods and t_op_ctn_detail.<2E><>װ=:pkg and t_op_ctn_detail.hts=:hts');
aAdoQuery.SQL.Add('Group by t_op_ctn.<2E><><EFBFBD><EFBFBD>');
aAdoQuery.Parameters.ParamByName('goods').Value:=t_op_edictn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
aAdoQuery.Parameters.ParamByName('pkg').Value:=t_op_edictn.fieldbyname('<27><>װ').asstring;
aAdoQuery.Parameters.ParamByName('hts').Value:=t_op_edictn.fieldbyname('hts').asstring;
aAdoQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
aAdoQuery.Open;
while not aAdoQuery.eof do
begin
str.Add('SGP+'+aAdoQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'+'+aAdoQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39); //<2F><><EFBFBD><EFBFBD>
count:=count+1;
str.Add('MEA+WT+G+KGM:'+aAdoQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
str.Add('MEA+VOL+AAW+CBM:'+aAdoQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
aAdoQuery.Next;
end;
finally
aAdoQuery.Free;
end;
end;
Lineno:=Lineno+1;
t_op_edictn.Next;
end;
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+:'+edit7.text+#39);
count:=count+1;
str.Add('COM+'+Edit5.text+':TE'+#39);
count:=count+1;
end;
if not bsck.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+'+t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'+'+GetCtnCode(t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,t_op_ctn.fieldbyname('<27>ߴ<EFBFBD>').asstring)+'+1'+#39) //<2F><><EFBFBD><EFBFBD>
else
str.Add('EQD+CN+'+t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'+'+GetCtnCode(t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,t_op_ctn.fieldbyname('<27>ߴ<EFBFBD>').asstring)+'+2'+#39); //<2F><><EFBFBD><EFBFBD>
count:=count+1;
str.Add('MEA+WT+G+KGM:'+t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
count:=count+1;
str.Add('MEA+VOL+AAW+CBM:'+t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+#39);
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;
end;
{
if frm_op_seae.t_op_seae.fieldbyname('<27>ܼ<EFBFBD>').asfloat<>0 then begin
str.Add('MEA+AAE+T+KGM:'+frm_op_seae.t_op_seae.fieldbyname('<27>ܼ<EFBFBD>').asstring+#39);
count:=count+1;
end;
}
str.Add('SEL+'+t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'+CA'+#39);
count:=count+1;
if frm_op_seae.t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ').asstring='R' then
begin
str.Add('TMP+2+'+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;
procedure Tfrm_op_seae_edi_cargosmart.bsSkinButton5Click(Sender: TObject);
var
IdFTP1:TIdFTP;
str:widestring;
str_file:widestring;
ftpar,ftpname,ftppass,ftppath,ftppathSI,ScriptPath:String;
StrL:Tstringlist;
i,Count,get_Count,bill_count,i_soi,z:integer;
SIO,ORG,MBL,CARR,MBLNO,ETD,CORP,EMP,EMPDAE:string;
edi:WideString;
begin
i_soi:=0;
if bsck.Checked then
begin
if frm_op_seae_assistant=nil then
begin
ShowMessage('<27><><EFBFBD><EFBFBD><>к<EFBFBD><D0BA>ᵥ)<29><><EFBFBD><EFBFBD>ͷֵ<CDB7>Edi');
exit;
end
end;
ScriptPath:=ExtractFilePath(ParamStr(0))+'EDIFILE\';
if not DirectoryExists(ScriptPath) then
CreateDir(ScriptPath);
ftpar:=Trim(Edit8.Text);
if ftpar='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FTP<54><50>ַ<EFBFBD><D6B7>',mtWarning,[mbOk],0);
exit;
end;
ftpname:=Trim(Edit9.Text);;
if ftpar='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FTP<54>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbOk],0);
exit;
end;
ftppass:=Trim(Edit10.Text);;
if ftpar='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FTP<54><50><EFBFBD>룡',mtWarning,[mbOk],0);
exit;
end;
ftppath:=Trim(Edit11.Text);
ftppathSI:=Trim(Edit13.Text);
StrL:=Tstringlist.Create;
StrL.Clear;
count:=0;
if (CheckIFT.Checked) then begin
if frm_op_seae.dxdbgrid1.SelectedCount>1 then
begin
for i:=0 to frm_op_seae.dxdbgrid1.SelectedCount-1 do
begin
frm_op_seae.t_op_seae.GotoBookmark(pointer(frm_op_seae.dxdbgrid1.selectedrows[i]));
str:=ScriptPath
+frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
+FormatDateTime('yyyy',now)
+FormatDateTime('mm',now)
+FormatDateTime('dd',now)
+FormatDateTime('hh',now)
+FormatDateTime('nn',now)+'.edi';
str_file:=frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
+FormatDateTime('yyyy',now)
+FormatDateTime('mm',now)
+FormatDateTime('dd',now)
+FormatDateTime('hh',now)
+FormatDateTime('nn',now)+'.edi';
count:=0;
bill_count:=0;
if not isEditrue then
exit;
if RadioGroup1.ItemIndex=1 then
get_Count:=frm_op_seae_edi_cargosmart.get_txtSI_txt(StrL)
else
get_Count:=frm_op_seae_edi_cargosmart.get_txtBooking_txt(StrL);
if get_Count=-1 then
exit
else
count:=count+get_Count;
StrL.Add('UNT+'+INTTOSTR(StrL.count)+'+'+frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+#39);
StrL.Add('UNZ+1+'+frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+#39);
for z:=0 to StrL.Count-1 do begin
if IsZhongwen(StrL[z]) then begin
MessageDlg('<27><>Ʊҵ<C6B1><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42><EFBFBD><EFBFBD><><3E>ַ<EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD>'+#13#10+Str[z],mtWarning,[mbYes],0);
exit;
end;
end;
StrL.SaveToFile(str);
edi:=StrL.Text;
try
IdFTP1:=TIdFTP.Create(application);
with idftp1 do
begin
Username:=ftpname;
Password:=ftppass;
Host:=ftpar;
Connect;
end;
case RadioGroup1.ItemIndex of
0:begin
idftp1.ChangeDir(ftppath);
end;
1:begin
if (Trim(ftppathSI)<>'') then
idftp1.ChangeDir(ftppathSI)
else idftp1.ChangeDir(ftppath);
end;
end;
idftp1.TransferType:=ftBinary;
idftp1.Put(str,str_file);
idftp1.Disconnect;
// showmessage('<27>ļ<EFBFBD><C4BC>ϴ<EFBFBD><CFB4>ɹ<EFBFBD><C9B9><EFBFBD>');
if RadioGroup1.ItemIndex=0 then
SIO:='SO'
else SIO:='SI';
if RadioGroup3.ItemIndex=0 then
ORG:='ORG'
else ORG:='AMEND';
IF bsck.Checked then
begin
MBL:='<27>ֵ<EFBFBD>';
MBLNO:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring;
end
else
begin
MBL:='<27><><EFBFBD><EFBFBD>';
MBLNO:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring;
end;
CARR:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring;
CORP:=frm_op_seae.t_op_seae.fieldbyname('ί<>е<EFBFBD>λ').asstring;
EMP:=employee;
EMPDAE:=FormatDateTime('YYYY-MM-DD hh:mm:ss',now);
ETD:=FormatDateTime('YYYY-MM-DD',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value);
Insertt_op_Edi_Log(SIO,ORG,MBL,CARR,MBLNO,ETD,CORP,EMP,EMPDAE,str,edi);
except
on e : exception do
begin
MessageDlg('<27>ļ<EFBFBD><C4BC>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+e.message,mtError,[mbOk],0);
deletefile(str);
i_soi:=1;
end;
end;
idftp1.Free;
if i_soi=0 then UpdateSOIStatus(RadioGroup1.ItemIndex,frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring);
end;
end else begin
for i:=0 to frm_op_seae.dxdbgrid1.SelectedCount-1 do
begin
frm_op_seae.t_op_seae.GotoBookmark(pointer(frm_op_seae.dxdbgrid1.selectedrows[i]));
str:=ScriptPath
+frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
+FormatDateTime('yyyy',now)
+FormatDateTime('mm',now)
+FormatDateTime('dd',now)
+FormatDateTime('hh',now)
+FormatDateTime('nn',now)+'.XML';
str_file:=frm_op_seae.t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
+FormatDateTime('yyyy',now)
+FormatDateTime('mm',now)
+FormatDateTime('dd',now)
+FormatDateTime('hh',now)
+FormatDateTime('nn',now)+'.XML';
StrL.Add('<?xml version="1.0" encoding="utf-8"?>');
StrL.Add('<Booking xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="br.xsd">');
bill_count:=0;
if not isEditrue then
exit;
if RadioGroup1.ItemIndex=1 then
get_Count:=frm_op_seae_edi_cargosmart.get_txtSI(StrL,str_file)
else
get_Count:=frm_op_seae_edi_cargosmart.get_txtBooking(StrL,str_file);
if get_Count=-1 then
exit
else
count:=count+get_Count;
StrL.Add('</Booking>');
for z:=0 to StrL.Count-1 do begin
if IsZhongwen(StrL[z]) then begin
MessageDlg('<27><>Ʊҵ<C6B1><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>TAB<41><42><EFBFBD><EFBFBD><><3E>ַ<EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD>'+#13#10+Str[z],mtWarning,[mbYes],0);
exit;
end;
end;
StrL.SaveToFile(str);
edi:=StrL.Text;
try
IdFTP1:=TIdFTP.Create(application);
with idftp1 do
begin
Username:=ftpname;
Password:=ftppass;
Host:=ftpar;
Connect;
end;
case RadioGroup1.ItemIndex of
0:begin
idftp1.ChangeDir(ftppath);
end;
1:begin
if (Trim(ftppathSI)<>'') then
idftp1.ChangeDir(ftppathSI)
else idftp1.ChangeDir(ftppath);
end;
end;
idftp1.TransferType:=ftBinary;
idftp1.Put(str,str_file);
idftp1.Disconnect;
if RadioGroup1.ItemIndex=0 then
SIO:='SO'
else SIO:='SI';
if RadioGroup3.ItemIndex=0 then
ORG:='ORG'
else ORG:='AMEND';
IF bsck.Checked then
begin
MBL:='<27>ֵ<EFBFBD>';
MBLNO:=frm_op_seae_assistant.t_op_seae_assistant.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring;
end
else
begin
MBL:='<27><><EFBFBD><EFBFBD>';
MBLNO:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring;
end;
CARR:=frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asstring;
CORP:=frm_op_seae.t_op_seae.fieldbyname('ί<>е<EFBFBD>λ').asstring;
EMP:=employee;
EMPDAE:=FormatDateTime('YYYY-MM-DD hh:mm:ss',now);
ETD:=FormatDateTime('YYYY-MM-DD',frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value);
Insertt_op_Edi_Log(SIO,ORG,MBL,CARR,MBLNO,ETD,CORP,EMP,EMPDAE,str,edi);
except
on e : exception do
begin
MessageDlg('<27>ļ<EFBFBD><C4BC>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+e.message,mtError,[mbOk],0);
deletefile(str);
i_soi:=1;
end;
end;
idftp1.Free;
if i_soi=0 then UpdateSOIStatus(RadioGroup1.ItemIndex,frm_op_seae.t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring);
end;
end;
showmessage('<27>ļ<EFBFBD><C4BC>ϴ<EFBFBD><CFB4>ɹ<EFBFBD><C9B9><EFBFBD>');
end;
end.