unit u_op_seae_edi_custom_wy; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,IdFTP,IdFTPCommon, Dialogs, BusinessSkinForm, StdCtrls, bsSkinCtrls,inifiles, DB, ADODB, IdComponent, IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase, IdMessageClient, IdSMTPBase, IdSMTP, IdBaseComponent, IdMessage,IdAttachmentFile; type Tfrm_op_seae_edi_custom_wy = class(TForm) bsBusinessSkinForm1: TbsBusinessSkinForm; Label2: TLabel; Edit2: TEdit; Edit1: TEdit; Label1: TLabel; SaveDialog1: TSaveDialog; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton3: TbsSkinButton; t_op_ctn: TADOQuery; t_op_ctn1: TDataSource; bsSkinRadioGroup1: TbsSkinRadioGroup; Label3: TLabel; Edit3: TEdit; bsSkinRadioGroup2: TbsSkinRadioGroup; bsSkinButton4: TbsSkinButton; bsSkinGroupBox1: TbsSkinGroupBox; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; Edit4: TEdit; Edit5: TEdit; Edit6: TEdit; Edit7: TEdit; t_op_ams: TADOQuery; bsSkinCheckRadioBox2: TbsSkinCheckRadioBox; Label8: TLabel; Edit8: TEdit; Label9: TLabel; Edit9: TEdit; Label10: TLabel; Edit10: TEdit; Label11: TLabel; Edit11: TEdit; Label12: TLabel; Edit12: TEdit; Label13: TLabel; Label14: TLabel; Edit13: TEdit; Edit14: TEdit; Label15: TLabel; Edit15: TEdit; IdMsg: TIdMessage; SMTP1: TIdSMTP; procedure bsSkinButton2Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); private function isEditrue(DataSet:TDataSet): boolean; function GetStrNum(str:String):integer; function FormatListString(Old:TStrings;mCount,Strlength:integer):String; function FormatEdiString(str:String;Strlength:integer=0):String; function CreateSIEdiFile_MBL:TStrings; function GetCntrEdi(cntrsize: String):String; function GetpkgsEdi(pkgs:String):String; function GetlineEdi(aline:String):String; function GetvesselEdi(avessel:String):String; function GetLengthword(var s: String; l: Integer;str:String): String; procedure GetLengthTString(var sl:TStringList;l:integer); function IsZhongwen(Str:String):Boolean; function Changestr(str:widestring):string; { Private declarations } public { Public declarations } function GetPortStr(Port:String):String; function GetPPCC(aFree:String):string; function GetCntrSize(code,Cntr:String):string; function Getport(code,port:String):string; function GetCarrCustomNO(sanme:String):string; end; var frm_op_seae_edi_custom_wy: Tfrm_op_seae_edi_custom_wy; implementation uses u_op_seae_edi_data, u_main, my_sys_function, u_data_share, u_op_seae_edi_custom_WaiDai; {$R *.dfm} function Tfrm_op_seae_edi_custom_wy.Changestr(str:widestring):string; var i:integer; strC:widestring; begin strC:=''; for i:=1 to length(str) do begin if ((str[i]=#39) or (str[i]=':') or (str[i]='''') or (str[i]='+') or (str[i]='?')) then begin strC:=strC+'?'+str[i]; end else begin strC:=strC+str[i]; end; end; result:=strC; end; function Tfrm_op_seae_edi_custom_wy.GetCarrCustomNO(sanme:String):string; var aQuery:TADOQuery; begin result:=''; aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('Select 客户简称,海关编码 from t_crm_client where 客户简称=:客户简称'); Parameters.ParamByName('客户简称').Value:=sanme; Open; if (not IsEmpty) and (FieldByName('海关编码').AsString<>'') then begin Result:=FieldByName('海关编码').AsString; end; end; finally FreeAndNil(aQuery); end; end; function Tfrm_op_seae_edi_custom_wy.GetPPCC(aFree:String):string; var aQuery:TADOQuery; begin result:=''; aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('Select 代码 from t_code_FREE where 付费方式=:FREE'); Parameters.ParamByName('FREE').Value:=aFree; Open; if (not IsEmpty) and (FieldByName('代码').AsString<>'') then begin Result:=FieldByName('代码').AsString; end; end; finally FreeAndNil(aQuery); end; end; function Tfrm_op_seae_edi_custom_wy.GetCntrSize(code,Cntr:String):string; var aQuery:TADOQuery; begin result:=Cntr; aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('Select 外运EDI代码 EDI代码 from t_code_ctn where 代码='''+Code+''''); Open; if (not IsEmpty) and (FieldByName('EDI代码').AsString<>'') then begin Result:=FieldByName('EDI代码').AsString; end; end; finally FreeAndNil(aQuery); end; end; function Tfrm_op_seae_edi_custom_wy.Getport(code,port:String):string; var aQuery:TADOQuery; begin result:=port; aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('Select 港口名称 from t_code_edi_port where EDI代码='''+Code+''''); Open; if (not IsEmpty) and (FieldByName('港口名称').AsString<>'') then begin Result:=FieldByName('港口名称').AsString; end; end; if Pos(',',Result)>0 then Result:=Copy(Result,1,Pos(',',Result)-1); finally FreeAndNil(aQuery); end; end; function Tfrm_op_seae_edi_custom_wy.GetPortStr(Port:String):String; begin if Pos(',',Port)>0 then Result:=Copy(Port,1,Pos(',',Port)-1) else Result:=Port; end; function Tfrm_op_seae_edi_custom_wy.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) then begin if bytetype(Str[i],1)<>mbsinglebyte then begin Result:=True; Exit; end; end; end; function Tfrm_op_seae_edi_custom_wy.GetLengthword(var s: String; l: Integer;str:String): String; var i:Integer; b:Boolean; begin s:=''; if Length(str)<=l then begin result:=str; end else begin b:=true; s:=Copy(str,l+1,Length(str)-l); str:=Copy(str,1,l); result:=''; for i:=Length(str) downto 1 do begin if ( not (str[i] in [' ',';',',','.',':','/','(',')','?','+','-'])) and b then s:=str[i]+s else begin b:=false; result:=str[i]+Result; end; end; s:=s+' '; end; end; procedure Tfrm_op_seae_edi_custom_wy.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_custom_wy.FormatEdiString(str:String;Strlength:integer=0):String; var i:integer; strC:widestring; begin strC:=''; for i:=1 to length(str) do begin if ((str[i]=#39) or (str[i]=':') or (str[i]='+') or (str[i]='?') or (str[i]=';')) then begin strC:=strC+'?'+str[i]; end else begin strC:=strC+str[i]; end; end; result:=strC; end; function Tfrm_op_seae_edi_custom_wy.FormatListString(Old:TStrings;mCount,Strlength:integer):String; var i:integer; NewStrs:TStrings; mStr:String; begin Result:=''; NewStrs:=TStringList.Create; for i:=0 to old.Count-1 do begin if Length(old.Strings[i])<=Strlength then begin NewStrs.Add(old.Strings[i]); end else begin mStr:=old.Strings[i]; while length(mStr)>Strlength do begin newStrs.Add(copy(mStr,1,Strlength)); system.Delete(mStr,1,Strlength); end; newStrs.Add(mStr); end; end; try for i:=0 to mCount-1 do begin if i=7) and (Copy(substr,1,7)='TOORDER')) OR ((Length(substr)>=10) and (Copy(substr,1,10)='TOTHEORDER')) then begin { if trim(DataSet.fieldbyname('通知人企业代码').asstring)='' then begin result:=false; MessageDlg('通知人企业代码不能为空',mtWarning,[mbOk],0); exit; end; } if trim(DataSet.fieldbyname('通知人国家代码').asstring)='' then begin result:=false; MessageDlg('通知人国家代码不能为空',mtWarning,[mbOk],0); exit; end; end else begin { if trim(DataSet.fieldbyname('收货人企业代码').asstring)='' then begin result:=false; MessageDlg('收货人企业代码不能为空',mtWarning,[mbOk],0); exit; end; if (trim(DataSet.fieldbyname('收货人电话').asstring)='') and (trim(DataSet.fieldbyname('收货人邮箱').asstring)='') then begin result:=false; MessageDlg('收货人电话邮箱不能为空',mtWarning,[mbOk],0); exit; end; if trim(DataSet.fieldbyname('收货人国家代码').asstring)='' then begin result:=false; MessageDlg('收货人国家代码不能为空',mtWarning,[mbOk],0); exit; end; } end; if trim(GetpkgsEdi(DataSet.fieldbyname('包装').asstring))='' then begin result:=false; MessageDlg('包装EDI代码不存在!',mtWarning,[mbOk],0); exit; end; if trim(DataSet.fieldbyname('货物描述').asstring)='' then begin result:=false; MessageDlg('货物描述不能为空',mtWarning,[mbOk],0); exit; end; if trim(DataSet.fieldbyname('唛头').asstring)='' then begin result:=false; MessageDlg('唛头不能为空',mtWarning,[mbOk],0); exit; end; if DataSet.fieldbyname('件数').asinteger=0 then begin result:=false; MessageDlg('件数不能为空',mtWarning,[mbOk],0); exit; end; if DataSet.fieldbyname('重量').asFloat=0 then begin result:=false; MessageDlg('总重量不能为空',mtWarning,[mbOk],0); exit; end; { if DataSet.fieldbyname('尺码').asFloat=0 then begin result:=false; MessageDlg('总尺码不能为空',mtWarning,[mbOk],0); exit; end; } if trim(DataSet.fieldbyname('货物标识').asstring)='' then begin result:=false; MessageDlg('货物标识不能为空',mtWarning,[mbOk],0); exit; end; if trim(DataSet.fieldbyname('货物标识').asstring)='' then begin result:=false; MessageDlg('货物标识不能为空',mtWarning,[mbOk],0); exit; end; if trim(DataSet.FieldByName('货物标识').asstring)='D' then begin if Trim(DataSet.fieldbyname('危险品分类').asstring)='' then begin result:=false; MessageDlg('危险品等级不能为空',mtWarning,[mbOk],0); exit; end; if Trim(DataSet.fieldbyname('危险品编号').asstring)='' then begin result:=false; MessageDlg('危险品编号不能为空',mtWarning,[mbOk],0); exit; end; if GetStrNum(Trim(DataSet.fieldbyname('危险品编号').asstring))<>4 then begin result:=false; MessageDlg('危险品编号必须是4位数字',mtWarning,[mbOk],0); exit; end; end; if trim(DataSet.FieldByName('货物标识').asstring)='R' then begin if Trim(DataSet.fieldbyname('设置温度').asstring)='' then begin result:=false; MessageDlg('设置温度不能为空',mtWarning,[mbOk],0); exit; end; if Trim(DataSet.fieldbyname('冷藏通风量').asstring)='' then begin result:=false; MessageDlg('冷藏通风量不能为空',mtWarning,[mbOk],0); exit; end; end; t_op_ctn.close; t_op_ctn.Parameters.ParamByName('编号').Value:=DataSet.fieldbyname('编号').asstring; t_op_ctn.open; if t_op_ctn.IsEmpty then begin result:=false; MessageDlg('集装箱不能为空',mtWarning,[mbOk],0); exit; end; t_op_ctn.First; while not t_op_ctn.Eof do begin if Trim(t_op_ctn.fieldbyname('箱号').asstring)='' then begin result:=false; MessageDlg('箱号不能为空!',mtWarning,[mbOk],0); exit; end; if Trim(t_op_ctn.fieldbyname('封号').asstring)='' then begin result:=false; MessageDlg('封号不能为空!',mtWarning,[mbOk],0); exit; end; t_op_ctn.Next; end; if iszhongwen(dataset.fieldbyname('发货人代码').AsString) then begin result:=false; MessageDlg('发货人不能有中文字符!',mtWarning,[mbOk],0); exit; end; if iszhongwen(dataset.fieldbyname('收货人代码').AsString) then begin result:=false; MessageDlg('收货人不能有中文字符!',mtWarning,[mbOk],0); exit; end; if iszhongwen(dataset.fieldbyname('通知人代码').AsString) then begin result:=false; MessageDlg('通知人不能有中文字符!',mtWarning,[mbOk],0); exit; end; if iszhongwen(dataset.fieldbyname('唛头').AsString) then begin result:=false; MessageDlg('唛头不能有中文字符!',mtWarning,[mbOk],0); exit; end; if iszhongwen(dataset.fieldbyname('货物描述').AsString) then begin result:=false; MessageDlg('货物描述不能有中文字符!',mtWarning,[mbOk],0); exit; end; end; function Tfrm_op_seae_edi_custom_wy.CreateSIEdiFile_MBL:TStrings; var str:Tstringlist; Tempstr : TStrings; Temprslt : string; i,j,Count,ctncount:integer; strsql,strRmain:string; rs,aQuery2:Tadoquery; wide_str:widestring; k:integer; inifile1:Tinifile; strType,XType:string; strDatetime:string; SenderCode,ReciverCode:string; aAdoQuery:TAdoQuery; begin if not isEditrue(frm_op_seae_edi_data.t_op_seae) then begin Exit; end; aAdoQuery:=CreateAdoQuery; SenderCode:=trim(edit1.Text) ; ReciverCode:=trim(edit2.Text) ; if bsSkinRadioGroup1.ItemIndex=0 then strType:='9' else if bsSkinRadioGroup1.ItemIndex=1 then strType:='2' else if bsSkinRadioGroup1.ItemIndex=2 then strType:='3' else if bsSkinRadioGroup1.ItemIndex=3 then strType:='4' else strType:='9'; // ShowMessage(IntToStr(frm_op_seae_edi.dxdbgrid1.SelectedCount)); if frm_op_seae_edi_data.dxdbgrid1.SelectedCount<=1 then begin str:=Tstringlist.Create; str.Clear; str.Add('00:IFCSUM:MANIFEST:'+trim(strType)+':'+ SenderCode+':'+ReciverCode+':'+GetDatetime(datetimetostr(now),4)+':::2.0'+#39); // Count:=0; str.Add ('10' +':'+frm_op_seae_edi_data.t_op_seae.fieldbyname('船舶IMO').asstring // 2 船舶IMO编号 +':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('船名').AsString) //3船名 +':' //4舶国籍代码 +':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('航次').asstring) //5航次 +':' //6 航线代码 +':' //7 航线 +':' //8预计到达日期 +':'+ GetDatetime(frm_op_seae_edi_data.t_op_seae.fieldbyname('开船日期').asstring,3) //9 离港日期(船舶启运日期和时间) +':'+frm_op_seae_edi_data.t_op_seae.fieldbyname('装港代码').asstring // 10离港地点代码(船舶离境地海关代码) +':'+frm_op_seae_edi_data.t_op_seae.fieldbyname('装货港').asstring // 11 离港地点 +':' //12 下一挂港代码 +':' //13 下一挂港 +':1' //14运输方式代码 +#39); str.Add('11' +':'+frm_op_seae_edi_data.t_op_seae.fieldbyname('船公司代码').AsString //2 船公司(承运人)代码 +':' //3 船公司(承运人) +':'+SenderCode //4舱单传输人名称 ??? +':' //5船舶代理企业代码 +':'+ GetDatetime(frm_op_seae_edi_data.t_op_seae.fieldbyname('开船日期').asstring,3) //6 货物装载运输工具时间 +':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('卸货代码').asstring) //7船舶抵达关境内第一个目的港代码 +':'+ GetDatetime(frm_op_seae_edi_data.t_op_seae.fieldbyname('预抵日期').asstring,3)//8船舶抵达关境内第一个目的港的日期和时间 + #39); if pos('FREIGHT PREPAID',trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('付费方式').asstring)) >0 then xtype := 'PP' else if pos('FREIGHT COLLECT',trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('付费方式').asstring)) >0 then xtype := 'CC' else xtype := 'PP'; str.add('12:' + trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('主提单号').asstring) //2总提运单号 +':' //3 前程运输船名代码 +':' //4 前程运输船名 +':' //5 前程运输航次 +':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('交货代码').asstring) //6 收货地代码 +':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('交货地点').asstring) //7收货地名称 +':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('装港代码').asstring) //8装货港代码 +':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('装货港').asstring) //9装货港 +':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('运输条款').asstring) //10运输条款 +':'+ XType //11付款方式(运费支付方法代码) +':'+ GetDatetime(frm_op_seae_edi_data.t_op_seae.fieldbyname('开船日期').asstring,3) //12 离港日期(船舶启运日期和时间) +':' //13检疫代码 +':' //14签发日期 +':' //15币种(金额类型代码) +':' //16 汇率 +':' //17 托运货物价值 +':' //18 总提运单号 +':' //19 码头作业指令代码 +':' //20 拼箱人代码/拆箱人代码 +':' //21 前一海关单证号 +':' //22 前一海关单证类型代码 +#39); str.add('13:' + trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('卸货代码').asstring) //2卸货地代码 ??? +':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('卸货港').asstring) //3卸货港 +':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('目的代码').asstring) //4交货地代码 +':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('目的地').asstring) //5交货地 + ':' // 6 中转港代码 + ':' // 7 中转港 + ':CN' // 8 提单签发地代码(货物托运地或者国家代码) +':' // 9 +':' // 10 +':' +GetDatetime(frm_op_seae_edi_data.t_op_seae.fieldbyname('预抵日期').asstring,0) // 11 +':' // 12 +':' // 13 +#39); str.add('16' +':' //2 发货人代码 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('发货人名称').AsString) //3发货人名称 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('发货人地址1').AsString) //4发货人地址(街道,邮箱) +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('发货人电话').AsString) //10 发货人电话 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('发货人邮箱').AsString) //6 省份代码 +':' //7 省份名称 +':' //7 省份名称 +':' //8 邮政编码 +':' //8 邮政编码 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('发货人邮编').AsString) //8 邮政编码 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('发货人国家代码').AsString) //9 国家代码 +#39); str.add('17' +':' //2 收货人代码 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('收货人名称').AsString) //3收货人名称 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('收货人地址1').AsString) //4收货人地址(街道,邮箱) +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('收货人电话').AsString) //10 收货人电话 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('收货人邮箱').AsString) //11 收货人EMAIL +':' //7 省份名称 +':' //7 省份名称 +':' //7 省份名称 +':' //7 省份名称 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('收货人邮编').AsString) //8 邮政编码 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('收货人国家代码').AsString) //9 国家代码 +':' ///12 收货人传真 +':' ///13 收货人具体联系人名称 +':' ///14 收货人具体联系人电话 +':' ///15 收货人具体联系人EMAIL +#39); str.add('18' +':' //2 通知人代码 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('通知人名称').AsString) //3通知人名称 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('通知人地址1').AsString) //4通知人地址(街道,邮箱) +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('通知人电话').AsString) //10 通知人电话 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('通知人邮箱').AsString) //11 通知人EMAIL +':' //7 省份名称 +':' //7 省份名称 +':' //7 省份名称 +':' //7 省份名称 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('通知人邮编').AsString) //8 邮政编码 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('通知人国家代码').AsString) //9 国家代码 +#39); { with aAdoQuery do begin Close;sql.Clear; sql.Add('select 代码,sum(数量) as 数量'); sql.Add('from t_op_ctn_edi'); sql.Add('where 编号=:编号'); sql.Add('Group by '); Parameters.ParamByName('编号').Value:=frm_op_seae_edi_data.t_op_seae.fieldbyname('编号').asstring; Open;First; while not Eof do begin str.Add ('42' +':'+trim(fieldbyname('箱号').asstring) //2 箱号 +#39); Count:=Count+1; Next; end; end; } ctncount:=1; with aAdoQuery do begin Close;sql.Clear; sql.Add('select * '); sql.Add('from t_op_ctn_edi'); sql.Add('where 编号=:编号'); Parameters.ParamByName('编号').Value:=frm_op_seae_edi_data.t_op_seae.fieldbyname('编号').asstring; Open;First; while not Eof do begin if trim(aAdoQuery.fieldbyname('箱子所有者').asstring)='Shipper' then tmpstr:='Y' else tmpstr:='N'; if Trim(aAdoQuery.fieldbyname('尺寸').asstring+aAdoQuery.fieldbyname('箱型').asstring)='40HQ' then ctntype:='40HC' else ctntype:= Trim(aAdoQuery.fieldbyname('尺寸').asstring+aAdoQuery.fieldbyname('箱型').asstring); str.Add ('40' //记录类型标识 +':'+ctntype //集装箱尺寸类型 +':'+trim(aAdoQuery.fieldbyname('数量').asstring) //集装箱箱数 +':F' //集装箱状态 +':' //主拼号 +':' //装箱方式 +':' //装箱地点代码 +':' //装箱地点说明 +':'+tmpstr //货主箱标志 +':' //集装箱来源代码 +':' // 拼箱人代码 +#39); Count:=Count+1; ctncount:=ctncount+1; Next; end; end; str.Add ('41:1' //2货物序号 +':' //3货类代码 +':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('件数').asstring) //4 货物件数 +':'+trim(GetpkgsEdi(frm_op_seae_edi_data.t_op_seae.fieldbyname('包装').asstring)) //5 包装种类代码 +':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('包装').asstring) // 6 包装类型 +':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('重量').asstring) // 7货毛重 +':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('重量').asstring) // 8货净重 +':' // 9货尺码 +':' // 10海关税则编号 +':' // 11海关手续代码 +':' // 12原产地代码 +':' // 13唯一托运编号 +#39); if trim(frm_op_seae_edi_data.t_op_seae.FieldByName('货物标识').asstring)='D' then begin str.Add ('43:'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('危险品分类').asstring) //2危险品分类 +':none' //3危险品页号 +':' +trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('危险品编号').asstring) //4联合国危险品编号 +':none' //5危险品标签 +':' //6 危险货物闪点 +':' //7 船运危险品应急措施号 +':' //8 医疗急救指南号 +':' //9 应急联系 +':' //10 温度计量单位 +':' //11 设置温度 +':' //12 冷藏最低温度 +':' //13 冷藏最高温度 +':' //14 危险品联系人姓名 +':' //15 危险品联系人电话 +':' //16 危险品联系人EMAIL +':' //17 危险品联系人传真 +#39); end else if trim(frm_op_seae_edi_data.t_op_seae.FieldByName('货物标识').asstring)='R' then begin str.Add ('43:' //2危险品分类 +':' //3危险品页号 +':' //4联合国危险品编号 +':' //5危险品标签 +':' //6 危险货物闪点 +':' //7 船运危险品应急措施号 +':' //8 医疗急救指南号 +':' //9 应急联系 +':C' //10 温度计量单位 +':'+frm_op_seae_edi_data.t_op_seae.fieldbyname('设置温度').asstring //11 设置温度 +':' //12 冷藏最低温度 +':' //13 冷藏最高温度 +':' //14 危险品联系人姓名 +':' //15 危险品联系人电话 +':' //16 危险品联系人EMAIL +#39); end; Temprslt:=Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('唛头').asstring); Temprslt:=StringReplace(Temprslt,#13#10,' ',[rfReplaceAll]); str.Add ('44:' +Temprslt + #39); Temprslt:=Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('货物描述').asstring); Temprslt:=StringReplace(Temprslt,#13#10,' ',[rfReplaceAll]); str.Add ('47:' + Temprslt+ ':' + #39); Count:=Count+10; strsql:='select * from t_op_ctn_edi ' +'WHERE 编号=' +#39+frm_op_seae_edi_data.t_op_seae.fieldbyname('编号').asstring+#39; try rs:=Tadoquery.Create(application); rs.Connection := frm_main.db; rs.sql.clear; rs.sql.add(strsql); rs.Open; rs.First; if not rs.IsEmpty then begin rs.First; while not rs.Eof do begin str.Add ('51:001' //2货物序号 +':'+trim(rs.fieldbyname('箱号').asstring) //3箱号 +':'+trim(rs.fieldbyname('封号').asstring) //4主铅封号 +':'+Trim(rs.fieldbyname('尺寸').asstring+rs.fieldbyname('箱型').asstring) //5集装箱尺寸类型 +':F' //6箱状态(重箱或者空箱标识代码) +':' +trim(IntToStr(rs.fieldbyname('件数').AsInteger)) //7箱内货物件数 +':'+trim(FloatToStr(rs.fieldbyname('重量').AsFloat)) //8箱内货重 +':0' //9箱皮重 +':' //10箱内货物尺码 +':' //11 +':' //12 +':' //13 +':' // 14 +':' // 15 +':' // 16 +':2' // 17 +#39); str.Add ('52' +':M' //3 封志类型 +':CA' //4 施加封志人 +':'+trim(rs.fieldbyname('封号').asstring) //2 封志号 +#39); Count:=Count+1; rs.Next; end; end; rs.Close; rs.Destroy; except on e:exception do begin rs.Close; rs.Destroy; exit; end; end; frm_op_seae_edi_data.t_op_seae.Edit; frm_op_seae_edi_data.t_op_seae.FieldByName('EDI状态').AsString:='已发送'; frm_op_seae_edi_data.t_op_seae.Post; str.Add ('99:'+ inttostr(Count+2)+#39); end else begin str:=Tstringlist.Create; str.Clear; str.Add('00:IFCSUM:MANIFEST:'+trim(strType)+':'+ SenderCode+':'+ReciverCode+':'+GetDatetime(datetimetostr(now),3)+':::2.0'+#39); Count:=0; for k:=0 to frm_op_seae_edi_data.dxdbgrid1.SelectedCount-1 do begin frm_op_seae_edi_data.t_op_seae.GotoBookmark(pointer(frm_op_seae_edi_data.dxdbgrid1.selectedrows[k])); str.Add ('10' +':'+frm_op_seae_edi_data.t_op_seae.fieldbyname('船舶IMO').asstring // 2 船舶IMO编号 +':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('船名').AsString) //3船名 +':' //4舶国籍代码 +':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('航次').asstring) //5航次 +':' //6 航线代码 +':' //7 航线 +':' //8预计到达日期 +':'+ GetDatetime(frm_op_seae_edi_data.t_op_seae.fieldbyname('开船日期').asstring,3) //9 离港日期(船舶启运日期和时间) +':'+frm_op_seae_edi_data.t_op_seae.fieldbyname('装港代码').asstring // 10离港地点代码(船舶离境地海关代码) +':'+frm_op_seae_edi_data.t_op_seae.fieldbyname('装货港').asstring // 11 离港地点 +':' //12 下一挂港代码 +':' //13 下一挂港 +':1' //14运输方式代码 +#39); str.Add('11' +':'+frm_op_seae_edi_data.t_op_seae.fieldbyname('船公司代码').AsString //2 船公司(承运人)代码 +':' //3 船公司(承运人) +':'+SenderCode //4舱单传输人名称 ??? +':' //5船舶代理企业代码 +':'+ GetDatetime(frm_op_seae_edi_data.t_op_seae.fieldbyname('开船日期').asstring,3) //6 货物装载运输工具时间 +':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('卸货代码').asstring) //7船舶抵达关境内第一个目的港代码 +':'+ GetDatetime(frm_op_seae_edi_data.t_op_seae.fieldbyname('预抵日期').asstring,3)//8船舶抵达关境内第一个目的港的日期和时间 + #39); if pos('FREIGHT PREPAID',trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('付费方式').asstring)) >0 then xtype := 'PP' else if pos('FREIGHT COLLECT',trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('付费方式').asstring)) >0 then xtype := 'CC' else xtype := 'PP'; str.add('12:' + trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('主提单号').asstring) //2总提运单号 +':' //3 前程运输船名代码 +':' //4 前程运输船名 +':' //5 前程运输航次 +':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('交货代码').asstring) //6 收货地代码 +':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('交货地点').asstring) //7收货地名称 +':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('装港代码').asstring) //8装货港代码 +':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('装货港').asstring) //9装货港 +':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('运输条款').asstring) //10运输条款 +':'+ XType //11付款方式(运费支付方法代码) +':'+ GetDatetime(frm_op_seae_edi_data.t_op_seae.fieldbyname('开船日期').asstring,3)//12 离港日期(船舶启运日期和时间) +':' //13检疫代码 +':' //14签发日期 +':' //15币种(金额类型代码) +':' //16 汇率 +':' //17 托运货物价值 +':' //18 总提运单号 +':' //19 码头作业指令代码 +':' //20 拼箱人代码/拆箱人代码 +':' //21 前一海关单证号 +':' //22 前一海关单证类型代码 +#39); str.add('13:' + trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('卸货代码').asstring) //2卸货地代码 ??? +':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('卸货港').asstring) //3卸货港 +':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('目的代码').asstring) //4交货地代码 +':'+ trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('目的地').asstring) //5交货地 + ':' // 6 中转港代码 + ':' // 7 中转港 + ':CN' // 8 提单签发地代码(货物托运地或者国家代码) +':' // 9 +':' // 10 +':' +GetDatetime(frm_op_seae_edi_data.t_op_seae.fieldbyname('预抵日期').asstring,0) // 11 +':' // 12 +':' // 13 +#39); str.add('16' +':' //2 发货人代码 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('发货人名称').AsString) //3发货人名称 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('发货人地址1').AsString) //4发货人地址(街道,邮箱) +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('发货人城市').AsString) //5 城市名称 +':' //6 省份代码 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('发货人州').AsString) //7 省份名称 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('发货人邮编').AsString) //8 邮政编码 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('发货人国家代码').AsString) //9 国家代码 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('发货人电话').AsString) //10 发货人电话 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('发货人联系人').AsString) //11 发货人EMAIL +':' ///12 发货人传真 +#39); str.add('17' +':' //2 发货人代码 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('收货人名称').AsString) //3收货人名称 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('收货人地址1').AsString) //4收货人地址(街道,邮箱) +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('收货人城市').AsString) //5 城市名称 +':' //6 省份代码 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('收货人州').AsString) //7 省份名称 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('收货人邮编').AsString) //8 邮政编码 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('收货人国家代码').AsString) //9 国家代码 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('收货人电话').AsString) //10 收货人电话 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('收货人联系人').AsString) //11 收货人EMAIL +':' ///12 收货人传真 +':' ///13 收货人具体联系人名称 +':' ///14 收货人具体联系人电话 +':' ///15 收货人具体联系人EMAIL +':' ///16 收货人具体联系人传真 +#39); str.add('18' +':' //2 发货人代码 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('通知人名称').AsString) //3通知人名称 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('通知人地址1').AsString) //4通知人地址(街道,邮箱) +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('通知人城市').AsString) //5 城市名称 +':' //6 省份代码 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('通知人州').AsString) //7 省份名称 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('通知人邮编').AsString) //8 邮政编码 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('发货人国家代码').AsString) //9 国家代码 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('通知人电话').AsString) //10 通知人电话 +':'+ Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('通知人联系人').AsString) //11 通知人EMAIL +':' ///12 通知人传真 +#39); ctncount:=1; with aAdoQuery do begin Close;sql.Clear; sql.Add('select * '); sql.Add('from t_op_ctn_edi'); sql.Add('where 编号=:编号'); Parameters.ParamByName('编号').Value:=frm_op_seae_edi_data.t_op_seae.fieldbyname('编号').asstring; Open;First; while not Eof do begin if trim(aAdoQuery.fieldbyname('箱子所有者').asstring)='Shipper' then tmpstr:='Y' else tmpstr:='N'; if Trim(aAdoQuery.fieldbyname('尺寸').asstring+aAdoQuery.fieldbyname('箱型').asstring)='40HQ' then ctntype:='40HC' else ctntype:= Trim(aAdoQuery.fieldbyname('尺寸').asstring+aAdoQuery.fieldbyname('箱型').asstring); str.Add ('40' //记录类型标识 +':'+ctntype //集装箱尺寸类型 +':'+trim(aAdoQuery.fieldbyname('数量').asstring) //集装箱箱数 +':F' //集装箱状态 +':' //主拼号 +':' //装箱方式 +':' //装箱地点代码 +':' //装箱地点说明 +':'+tmpstr //货主箱标志 +':' //集装箱来源代码 +':' // 拼箱人代码 +#39); Count:=Count+1; ctncount:=ctncount+1; Next; end; end; str.Add ('41:1' //2货物序号 +':' //3货类代码 +':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('件数').asstring) //4 货物件数 +':'+trim(GetpkgsEdi(frm_op_seae_edi_data.t_op_seae.fieldbyname('包装').asstring)) //5 包装种类代码 +':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('包装').asstring) // 6 包装类型 +':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('重量').asstring) // 7货毛重 +':'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('重量').asstring) // 8货净重 +':' // 9货尺码 +':' // 10海关税则编号 +':' // 11海关手续代码 +':' // 12原产地代码 +':' // 13唯一托运编号 +#39); if trim(frm_op_seae_edi_data.t_op_seae.FieldByName('货物标识').asstring)='D' then begin str.Add ('43:'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('危险品分类').asstring) //2危险品分类 +':none' //3危险品页号 +':' +trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('危险品编号').asstring) //4联合国危险品编号 +':none' //5危险品标签 +':' //6 危险货物闪点 +':' //7 船运危险品应急措施号 +':' //8 医疗急救指南号 +':' //9 应急联系 +':' //10 温度计量单位 +':' //11 设置温度 +':' //12 冷藏最低温度 +':' //13 冷藏最高温度 +':' //14 危险品联系人姓名 +':' //15 危险品联系人电话 +':' //16 危险品联系人EMAIL +':' //17 危险品联系人传真 +#39); end else if trim(frm_op_seae_edi_data.t_op_seae.FieldByName('货物标识').asstring)='R' then begin str.Add ('43:' //2危险品分类 +':' //3危险品页号 +':' //4联合国危险品编号 +':' //5危险品标签 +':' //6 危险货物闪点 +':' //7 船运危险品应急措施号 +':' //8 医疗急救指南号 +':' //9 应急联系 +':C' //10 温度计量单位 +':'+frm_op_seae_edi_data.t_op_seae.fieldbyname('设置温度').asstring //11 设置温度 +':' //12 冷藏最低温度 +':' //13 冷藏最高温度 +':' //14 危险品联系人姓名 +':' //15 危险品联系人电话 +':' //16 危险品联系人EMAIL +#39); end; Temprslt:=Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('唛头').asstring); Temprslt:=StringReplace(Temprslt,#13#10,' ',[rfReplaceAll]); str.Add ('44:' +Temprslt + #39); Temprslt:=Changestr(frm_op_seae_edi_data.t_op_seae.fieldbyname('货物描述').asstring); Temprslt:=StringReplace(Temprslt,#13#10,' ',[rfReplaceAll]); str.Add ('47:' + Temprslt+ ':' + #39); Count:=Count+10; strsql:='select * from t_op_ctn_edi ' +'WHERE 编号=' +#39+frm_op_seae_edi_data.t_op_seae.fieldbyname('编号').asstring+#39; try rs:=Tadoquery.Create(application); rs.Connection := frm_main.db; rs.sql.clear; rs.sql.add(strsql); rs.Open; rs.First; if not rs.IsEmpty then begin rs.First; while not rs.Eof do begin str.Add ('51:001' //2货物序号 +':'+trim(rs.fieldbyname('箱号').asstring) //3箱号 +':'+trim(rs.fieldbyname('封号').asstring) //4主铅封号 +':'+Trim(rs.fieldbyname('尺寸').asstring+rs.fieldbyname('箱型').asstring) //5集装箱尺寸类型 +':F' //6箱状态(重箱或者空箱标识代码) +':' +trim(IntToStr(rs.fieldbyname('件数').AsInteger)) //7箱内货物件数 +':'+trim(FloatToStr(rs.fieldbyname('重量').AsFloat)) //8箱内货重 +':0' //9箱皮重 +':' //10箱内货物尺码 +':' //11 +':' //12 +':' //13 +':' // 14 +':' // 15 +':' // 16 +':2' // 17 +#39); str.Add ('52' +':M' //3 封志类型 +':CA' //4 施加封志人 +':'+trim(rs.fieldbyname('封号').asstring) //2 封志号 +#39); Count:=Count+1; rs.Next; end; end; rs.Close; rs.Destroy; except on e:exception do begin rs.Close; rs.Destroy; exit; end; end; frm_op_seae_edi_data.t_op_seae.Edit; frm_op_seae_edi_data.t_op_seae.FieldByName('EDI状态').AsString:='已发送'; frm_op_seae_edi_data.t_op_seae.Post; end; str.Add ('99:'+ inttostr(Count+2)+#39); end; Result:=str; close; end; //// function Tfrm_op_seae_edi_custom_wy.GetCntrEdi(cntrsize: String):String; var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('Select Edi代码 from t_code_ctn where 代码='''+cntrsize+''''); Open; if IsEmpty then Result:='' else Result:=FieldByName('Edi代码').AsString; end; finally FreeAndNil(aQuery); end; end; function Tfrm_op_seae_edi_custom_wy.GetpkgsEdi(pkgs: String): String; var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('Select Edi代码 from t_code_package where 代码='''+pkgs+''''); Open; if IsEmpty then Result:='' else Result:=FieldByName('Edi代码').AsString; end; finally FreeAndNil(aQuery); end; end; function Tfrm_op_seae_edi_custom_wy.GetlineEdi(aline: String): String; var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('Select Edi代码 from t_code_trade where 航线='''+aline+''''); Open; if IsEmpty then Result:='' else Result:=FieldByName('Edi代码').AsString; end; finally FreeAndNil(aQuery); end; end; function Tfrm_op_seae_edi_custom_wy.GetvesselEdi(avessel: String): String; var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('Select 船舶呼号 from t_code_vessel where 英文船名='''+avessel+''''); Open; if IsEmpty then Result:='' else Result:=FieldByName('船舶呼号').AsString; end; finally FreeAndNil(aQuery); end; end; procedure Tfrm_op_seae_edi_custom_wy.bsSkinButton3Click(Sender: TObject); var str:widestring; StrL:TStrings; i:integer; str_memo:Tmemo; ScriptPath:string; begin ScriptPath:=ExtractFilePath(ParamStr(0))+'CUSTOMFILE\'; if not DirectoryExists(ScriptPath) then CreateDir(ScriptPath); if Trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('分提单号').asstring)<>'' then begin str:=ScriptPath +frm_op_seae_edi_data.t_op_seae.fieldbyname('分提单号').asstring +FormatDateTime('yyyy',now) +FormatDateTime('mm',now) +FormatDateTime('dd',now) +FormatDateTime('hh',now) +FormatDateTime('nn',now)+'.txt'; end else begin str:=ScriptPath +frm_op_seae_edi_data.t_op_seae.fieldbyname('主提单号').asstring +FormatDateTime('yyyy',now) +FormatDateTime('mm',now) +FormatDateTime('dd',now) +FormatDateTime('hh',now) +FormatDateTime('nn',now)+'.txt'; end; strL:=Tstringlist.Create; try StrL:=CreateSIEdiFile_MBL; for i:=0 to StrL.Count-1 do begin if IsZhongwen(StrL[i]) then begin if MessageDlg('此票业务可能含有中文字符或其他不规范字符,确实要继续上传吗!',mtWarning,[mbYes,mbNo],0)=mrNo then exit; end; end; strL.SaveToFile(str); str_memo:=Tmemo.create(application); str_memo.visible:=false; str_memo.Parent:=frm_op_seae_edi_custom_wy; str_memo.Lines.Add('公司名称:海尔舱单-外运'); str_memo.Lines.Add('发送人:'+Employee); try if Trim(str_memo.lines.Text)<>'' then begin SMTP1.AuthType := satDefault; //(satNone, satDefault, satSASL); SMTP1.username:=MailAddress; SMTP1.Password :=MailPw; SMTP1.Host:='mail.sdsmartlogistics.com'; SMTP1.Port:=25; try SMTP1.Connect; except on e : Exception do begin ShowMessage('连接邮箱出错:'+E.Message); end; end; if not SMTP1.Connected then begin Sleep(1000); SMTP1.Connect; end; try with IdMsg do begin body.Clear; Body.Text :=str_memo.lines.Text; From.address :=MailAddress; Recipients.EMailAddresses :=MailAddress; if Trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('分提单号').asstring)<>'' then Subject:='海尔舱单 主提单号:'+frm_op_seae_edi_data.t_op_seae.fieldbyname('主提单号').asstring+' 分提单号:'+frm_op_seae_edi_data.t_op_seae.fieldbyname('分提单号').asstring else Subject:='海尔舱单 主提单号:'+frm_op_seae_edi_data.t_op_seae.fieldbyname('主提单号').asstring; TIdAttachmentFile.Create(MessageParts,str); end; if not SMTP1.Connected then begin Sleep(1000); SMTP1.Connect; end; SMTP1.Send(IdMsg); MessageDlg('发送成功!',mtConfirmation,[mbOK],0) finally SMTP1.Disconnect; end; end; except MessageDlg('发送失败!',mtError,[mbOK],0); end; str_memo.free; finally FreeAndNil(StrL) end; end; procedure Tfrm_op_seae_edi_custom_wy.bsSkinButton4Click(Sender: TObject); begin if frm_op_seae_edi_custom_Waidai.Height=349 then frm_op_seae_edi_custom_Waidai.Height:=200 else frm_op_seae_edi_custom_Waidai.Height:=349; end; end.