unit u_op_seae_order_edit; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, bsSkinCtrls, ExtCtrls, DB, ADODB, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, ComCtrls, bsSkinTabs, RxLookup, StdCtrls, Mask, DBCtrls, wwdbdatetimepicker, wwdblook, u_op_sate, u_fee, u_op_card, Menus, dxDBTLCl, dxGrClms, bsdbctrls, XPMenu, wwdbedit, Wwdotdot, Wwdbcomb, Grids, Wwdbigrd, Wwdbgrid, DBGrids; type Tfrm_op_seae_order_edit = class(TForm) Panel2: TPanel; bsSkinButton5: TbsSkinButton; bsSkinButton38: TbsSkinButton; t_op_seae: TADOQuery; t_op_seae1: TDataSource; XPMenu1: TXPMenu; PopupMenu2: TPopupMenu; N10: TMenuItem; N11: TMenuItem; N14: TMenuItem; N13: TMenuItem; N12: TMenuItem; N15: TMenuItem; N16: TMenuItem; bsSkinButton2: TbsSkinButton; t_op_ctn1: TDataSource; t_op_ctn: TADOQuery; t_op_seae_insert: TADOQuery; t_op_seae_insert1: TDataSource; t_op_ctn_insert: TADOQuery; Notebook1: TNotebook; bsSkinPanel1: TbsSkinPanel; Label10: TLabel; bsSkinPanel3: TbsSkinPanel; Label1: TLabel; Label6: TLabel; Label7: TLabel; Label8: TLabel; Label9: TLabel; Label22: TLabel; Label23: TLabel; DBEdit1: TDBEdit; DBEdit6: TDBEdit; DBEdit7: TDBEdit; DBEdit8: TDBEdit; DBMemo3: TDBMemo; DBEdit15: TDBEdit; wwDBComboBox15: TwwDBComboBox; bsSkinPanel4: TbsSkinPanel; Label11: TLabel; Label12: TLabel; Label13: TLabel; Label14: TLabel; Label15: TLabel; Label16: TLabel; Label17: TLabel; Label18: TLabel; Label19: TLabel; Label20: TLabel; Label25: TLabel; Label26: TLabel; Label27: TLabel; Label28: TLabel; Label29: TLabel; Label30: TLabel; Label31: TLabel; Label32: TLabel; Label33: TLabel; Label34: TLabel; Label35: TLabel; Label36: TLabel; Label38: TLabel; Label39: TLabel; Label40: TLabel; Label44: TLabel; DBMemo1: TDBMemo; DBMemo4: TDBMemo; DBMemo5: TDBMemo; DBMemo38: TDBMemo; DBMemo2: TDBMemo; DBEdit9: TDBEdit; DBEdit10: TDBEdit; DBEdit11: TDBEdit; DBEdit12: TDBEdit; DBEdit13: TDBEdit; DBEdit16: TDBEdit; DBEdit18: TDBEdit; DBEdit19: TDBEdit; DBEdit20: TDBEdit; DBEdit21: TDBEdit; DBEdit22: TDBEdit; DBEdit23: TDBEdit; DBEdit24: TDBEdit; DBEdit25: TDBEdit; DBEdit26: TDBEdit; DBEdit27: TDBEdit; DBEdit28: TDBEdit; DBEdit30: TDBEdit; DBEdit31: TDBEdit; DBEdit32: TDBEdit; DBEdit36: TDBEdit; DBGrid1: TDBGrid; Label2: TLabel; DBEdit2: TDBEdit; Label3: TLabel; DBEdit3: TDBEdit; Label4: TLabel; DBEdit4: TDBEdit; Label5: TLabel; DBEdit5: TDBEdit; bsSkinButton8: TbsSkinButton; procedure bsSkinButton5Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure Panel2Resize(Sender: TObject); procedure bsSkinButton7Click(Sender: TObject); procedure bsSkinButton6Click(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure bsSkinButton38Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure Notebook1PageChanged(Sender: TObject); procedure RxDBLookupCombo5Enter(Sender: TObject); procedure RxDBLookupCombo5Exit(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton8Click(Sender: TObject); private { Private declarations } m_bsno:string; procedure setconcolor; //设置控件的颜色 function getkingpkgs(kindpkgscode:string):string; function GetDeptname(Port:String): String; public m_qryTask:TADOQuery; { Public declarations } public procedure InitialData( qryTask:TADOQuery; bsno1:string); end; var frm_op_seae_order_edit: Tfrm_op_seae_order_edit; implementation uses u_main,u_data_share, my_sys_function, u_sys_progress, u_op_seae_apply_add, u_op_add_code, u_op_date_change, u_op_ctn, u_op_seae_web_add, u_op_seae_selectbsno; {$R *.dfm} procedure Tfrm_op_seae_order_edit.setconcolor; begin end; procedure Tfrm_op_seae_order_edit.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_seae_order_edit.FormClose(Sender: TObject; var Action: TCloseAction); begin { frm_op_seae_web_order.Hide; frm_op_seae_web_order.ManualFloat(frm_op_seae_web_order.BoundsRect ); frm_main.freeTabs('frm_op_seae_web_order'); action:=cafree; frm_op_seae_web_order:=nil; } end; procedure Tfrm_op_seae_order_edit.Panel2Resize(Sender: TObject); var i:integer; begin i:=round(Panel2.Width/12); bsSkinButton8.Width:=i; bsSkinButton2.Width:=i; bsSkinButton38.Width:=i; end; procedure Tfrm_op_seae_order_edit.bsSkinButton7Click(Sender: TObject); begin table_Prior(t_op_seae); end; procedure Tfrm_op_seae_order_edit.bsSkinButton6Click(Sender: TObject); begin table_next(t_op_seae); end; procedure Tfrm_op_seae_order_edit.bsSkinButton9Click(Sender: TObject); begin sys_print('海运出口报关报检',2,t_op_seae1,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil); end; procedure Tfrm_op_seae_order_edit.bsSkinButton38Click(Sender: TObject); var book1:Tbookmark; begin book1:=t_op_seae.GetBookmark; t_op_seae.Refresh; t_op_seae.GotoBookmark(book1); end; procedure Tfrm_op_seae_order_edit.FormShow(Sender: TObject); begin t_op_seae.Close; t_op_seae.SQL.clear; t_op_seae.SQL.Add('select * from op_seaeorder where BSNO='''+ m_bsno + ''''); t_op_seae.open; t_op_ctn.OPEN; end; procedure Tfrm_op_seae_order_edit.Notebook1PageChanged(Sender: TObject); begin setconcolor; end; procedure Tfrm_op_seae_order_edit.RxDBLookupCombo5Enter(Sender: TObject); begin TRxDBLookupCombo(Sender).LookupDisplay:='代码;姓名' ; end; procedure Tfrm_op_seae_order_edit.RxDBLookupCombo5Exit(Sender: TObject); begin TRxDBLookupCombo(Sender).LookupDisplay:='姓名'; end; procedure Tfrm_op_seae_order_edit.bsSkinButton2Click(Sender: TObject); var i: Integer; bsno,ywno,sql:String; aQuery:TAdoQuery; begin frm_main.db.BeginTrans; try if not t_op_seae_insert.Active then t_op_seae_insert.Open; //主表 if not t_op_ctn_insert.Active then t_op_ctn_insert.Open; // t_op_seae_insert.Insert; bsno:=get_id; t_op_seae_insert.FieldByName('编号').AsString:=bsno; t_op_seae_insert.FieldByName('装运方式').AsString:='整箱'; t_op_seae_insert.FieldByName('会计期间').Value:=Date; t_op_seae_insert.FieldByName('周次').AsInteger:=WeekofYear(Date); t_op_seae_insert.FieldByName('录入人').AsString:=employee; t_op_seae_insert.FieldByName('录入日期').Value:=date; t_op_seae_insert.FieldByName('操作员').AsString:=employee; t_op_seae_insert.FieldByName('委托单位').AsString:=t_op_seae.FieldByName('CUSTOMERNAME').AsString; if frm_data_share.t_crm_client.Locate('客户简称',t_op_seae.FieldByName('CUSTOMERNAME').AsString,[]) then begin t_op_seae_insert.FieldByName('揽货人').AsString:=frm_data_share.t_crm_client.FieldByName('揽货人').AsString; t_op_seae_insert.FieldByName('销售部门').AsString:=GetDeptname(t_op_seae_insert.FieldByName('揽货人').AsString); t_op_seae_insert.FieldByName('业务来源').AsString:=frm_data_share.t_crm_client.FieldByName('其他要求').AsString; t_op_seae_insert.FieldByName('结费类型').AsString:=getzqlx(t_op_seae.FieldByName('CUSTOMERNAME').AsString); t_op_seae_insert.FieldByName('辅助字段一').AsString:=frm_data_share.t_crm_client.FieldByName('备注').AsString; end; t_op_seae_insert.FieldByName('客服员').AsString:=employee; t_op_seae_insert.FieldByName('操作部门').AsString:=department; t_op_seae_insert.FieldByName('货物标识').AsString:=t_op_seae.FieldByName('CARGOID').AsString; t_op_seae_insert.FieldByName('船公司').AsString:=t_op_seae.FieldByName('CARRIER').AsString; aQuery:=CreateAdoQuery; try With aQuery do begin close;sql.Clear; sql.Add('select 默认场站,默认场站联系人 from t_crm_client where 客户简称='''+t_op_seae.FieldByName('CARRIER').AsString+''''); Open; if not IsEmpty then begin t_op_seae_insert.FieldByName('场站').AsString:=aQuery.fieldbyname('默认场站').AsString; t_op_seae_insert.FieldByName('场站联系人').AsString:=aQuery.fieldbyname('默认场站联系人').AsString; end; end; finally FreeAndNil(aQuery); end; ywno:=get_no(Date,getbsno(Logininfo.SeaExpBsNo,'SE')); if (t_op_seae.FieldByName('CUSTOMERNAME').AsString='海尔') then t_op_seae_insert.FieldByName('签单编号').AsInteger:=10; t_op_seae_insert.FieldByName('业务编号').AsString:=ywno; t_op_seae_insert.FieldByName('主编号').AsString:=bsno; t_op_seae_insert.FieldByName('委托编号').AsString:=t_op_seae.FieldByName('CUSTNO').AsString; t_op_seae_insert.FieldByName('主提单标准').AsString:=bsno; t_op_seae_insert.FieldByName('分提单标准').AsString:=bsno; t_op_seae_insert.FieldByName('委托标准').AsString:=bsno; t_op_seae_insert.FieldByName('报关标准').AsString:=bsno; t_op_seae_insert.FieldByName('报检标准').AsString:=bsno; t_op_seae_insert.FieldByName('核销标准').AsString:=bsno; t_op_seae_insert.FieldByName('计费标准').AsString:=''; t_op_seae_insert.FieldByName('业务状态').AsString:='接受委托'; t_op_seae_insert.FieldByName('封帐前状态').AsString:='接受委托'; t_op_seae_insert.FieldByName('费用状态').AsString:='录入状态'; t_op_seae_insert.FieldByName('业务类型').AsString:='普通货'; t_op_seae_insert.FieldByName('装货港').AsString:=t_op_seae.FieldByName('PORTLOAD').AsString; t_op_seae_insert.FieldByName('装港代码').AsString:=t_op_seae.FieldByName('PORTLOADID').AsString; //////?????? t_op_seae_insert.FieldByName('提单份数').AsString:=t_op_seae.FieldByName('NOBILL').AsString; t_op_seae_insert.FieldByName('运输条款').AsString:=t_op_seae.FieldByName('SERVICE').AsString; t_op_seae_insert.FieldByName('唛头').AsString:=t_op_seae.FieldByName('MARKS').AsString; t_op_seae_insert.FieldByName('货物描述').AsString:=t_op_seae.FieldByName('DESCRIPTION').AsString; t_op_seae_insert.FieldByName('发货人代码').AsString:=t_op_seae.FieldByName('SHIPPER').AsString; t_op_seae_insert.FieldByName('收货人代码').AsString:=t_op_seae.FieldByName('CONSIGNEE').AsString; t_op_seae_insert.FieldByName('通知人代码').AsString:=t_op_seae.FieldByName('NOTIFYPARTY').AsString; t_op_seae_insert.FieldByName('付费方式').AsString:=t_op_seae.FieldByName('BLFRT').AsString; t_op_seae_insert.FieldByName('签单地点').AsString:='QINGDAO,CHINA'; t_op_seae_insert.FieldByName('货物重量').AsString:=t_op_seae.FieldByName('KGS').AsString+'KGS'; t_op_seae_insert.FieldByName('货物尺码').AsString:=t_op_seae.FieldByName('CBM').AsString+'CBM'; t_op_seae_insert.FieldByName('件数').AsInteger:=t_op_seae.FieldByName('PKGS').AsInteger; // t_op_seae_insert.FieldByName('包装').AsString:=getkingpkgs(t_op_seae.FieldByName('KINDPKGS').AsString); t_op_seae_insert.FieldByName('包装').AsString:=t_op_seae.FieldByName('KINDPKGS').AsString; if (t_op_seae_insert.FieldByName('件数').AsInteger>1) then t_op_seae_insert.FieldByName('包装').AsString:=t_op_seae_insert.FieldByName('包装').AsString+'S'; t_op_seae_insert.FieldByName('件数包装').AsString:=t_op_seae.FieldByName('PKGS').AsString+t_op_seae_insert.FieldByName('包装').AsString; t_op_seae_insert.FieldByName('重量').AsFloat:=t_op_seae.FieldByName('KGS').AsFloat; t_op_seae_insert.FieldByName('尺码').AsFloat:=t_op_seae.FieldByName('CBM').AsFloat; t_op_seae_insert.FieldByName('件数大写').AsString:='SAY:'+ntoc(t_op_seae.FieldByName('PKGS').asfloat,true) +t_op_seae.FieldByName('KINDPKGS').asstring+' ONLY.'; t_op_seae_insert.FieldByName('危险品分类').AsString:=t_op_seae.FieldByName('DCLASS').AsString; t_op_seae_insert.FieldByName('危险品编号').AsString:=t_op_seae.FieldByName('DUNNO').AsString; t_op_seae_insert.FieldByName('设置温度').AsString:=t_op_seae.FieldByName('TEMPSET').AsString; t_op_seae_insert.FieldByName('冷藏通风量').AsString:=t_op_seae.FieldByName('REEFERF').AsString; t_op_seae_insert.FieldByName('运费协议号').AsString:=t_op_seae.FieldByName('SERVICECONTRACTNO').AsString; t_op_seae_insert.FieldByName('船名').AsString:=t_op_seae.FieldByName('VESSEL').AsString; t_op_seae_insert.FieldByName('航次').AsString:=t_op_seae.FieldByName('VOYNO').AsString; t_op_seae_insert.FieldByName('开船日期').Value:=t_op_seae.FieldByName('ETD').Value; t_op_seae_insert.FieldByName('卸货代码').AsString:=t_op_seae.FieldByName('PORTDISCHARGEID').AsString; if (frm_data_share.t_code_disport.Locate('EDI代码',t_op_seae.FieldByName('PORTDISCHARGEID').AsString,[])) then t_op_seae_insert.FieldByName('卸货港').AsString:=frm_data_share.t_code_disport.fieldbyname('英文名').AsString else t_op_seae_insert.FieldByName('卸货港').AsString:=t_op_seae.FieldByName('PORTDISCHARGE').AsString; t_op_seae_insert.FieldByName('目的地代码').AsString:=t_op_seae.FieldByName('DESTINATIONID').AsString; if (frm_data_share.t_code_disport.Locate('EDI代码',t_op_seae.FieldByName('DESTINATIONID').AsString,[])) then t_op_seae_insert.FieldByName('目的地').AsString:=frm_data_share.t_code_disport.fieldbyname('英文名').AsString else t_op_seae_insert.FieldByName('目的地').AsString:=t_op_seae.FieldByName('DESTINATION').AsString; t_op_seae_insert.FieldByName('集装箱').AsString:=t_op_seae.FieldByName('CNTRTOTAL').AsString; t_op_seae_insert.FieldByName('销售订舱说明').AsString:=t_op_seae.FieldByName('REMARK').AsString; t_op_seae_insert.FieldByName('备注').AsString:='客户联系人:'+t_op_seae.FieldByName('CUSTATTN').AsString+' '+t_op_seae.FieldByName('CUSTTEL').AsString; t_op_seae_insert.FieldByName('退税日期').Value:=null; t_op_seae_insert.FieldByName('签单日期').Value:=null; t_op_seae_insert.FieldByName('派车日期').Value:=null; t_op_seae_insert.FieldByName('寄单日期').Value:=null; t_op_seae_insert.FieldByName('是否寄单').Value:=0; t_op_seae_insert.FieldByName('是否退税').Value:=0; t_op_seae_insert.FieldByName('是否通关').Value:=0; t_op_seae_insert.FieldByName('是否签单').Value:=0; t_op_seae_insert.FieldByName('请求派车').Value:=0; t_op_seae_insert.FieldByName('是否派车').Value:=0; t_op_seae_insert.FieldByName('是否解锁').Value:=0; t_op_seae_insert.FieldByName('解锁日期').Value:=null; t_op_seae_insert.FieldByName('解锁人').Value:=''; t_op_seae_insert.FieldByName('应收陆运').Value:=0; t_op_seae_insert.FieldByName('应付陆运').Value:=0; t_op_seae_insert.FieldByName('陆运利润').Value:=0; t_op_seae_insert.FieldByName('财务').Value:=0; t_op_seae_insert.FieldByName('财务凭证').Value:=''; t_op_seae_insert.FieldByName('是否打印').Value:=0; t_op_seae_insert.FieldByName('销售订舱').Value:=0; t_op_seae_insert.FieldByName('是否退舱').Value:=0; t_op_seae_insert['VGM']:=1; t_op_seae_insert.FieldByName('报关服务').Value:=0; t_op_seae_insert.FieldByName('报验服务').Value:=0; t_op_seae_insert.FieldByName('拖车服务').Value:=0; t_op_seae_insert.FieldByName('BC状态').Value:='N'; t_op_seae_insert.FieldByName('财务凭证').Value:=''; t_op_seae_insert.FieldByName('签单方式').AsString:=t_op_seae.FieldByName('ISSUETYPE').AsString; t_op_seae_insert.FieldByName('付费方式').AsString:=t_op_seae.FieldByName('BLFRT').AsString; t_op_seae_insert.FieldByName('预付地点').AsString:=t_op_seae.FieldByName('PREPARDAT').AsString; t_op_seae_insert.FieldByName('到付地点').AsString:=t_op_seae.FieldByName('PAYABLEAT').AsString; // t_op_seae_insert.FieldByName('货代公司联系人').AsString:=t_op_seae.FieldByName('CUSTATTN').AsString; t_op_seae_insert.FieldByName('应收海运费').AsFloat:=0; t_op_seae_insert.FieldByName('应付海运费').AsFloat:=0; t_op_seae_insert.FieldByName('船公司代理费').AsFloat:=0; t_op_seae_insert.FieldByName('捷丰代理费').AsFloat:=0; t_op_seae_insert.Post; if (not t_op_ctn.IsEmpty) then begin try t_op_ctn_insert.Close; t_op_ctn_insert.Open; with t_op_ctn do begin First; while not Eof do begin t_op_ctn_insert.Insert; t_op_ctn_insert['数量']:=t_op_ctn['CTNNUM']; if frm_data_share.t_code_ctn.Locate('表现形式',t_op_ctn['CTNALL'],[]) then begin t_op_ctn_insert['表现形式']:=t_op_ctn['CTNALL']; t_op_ctn_insert['代码']:=frm_data_share.t_code_ctn['代码']; t_op_ctn_insert['箱型']:=frm_data_share.t_code_ctn['箱型']; t_op_ctn_insert['尺寸']:=frm_data_share.t_code_ctn['尺寸']; if frm_data_share.t_code_ctn.FieldByName('尺寸').asstring='20'then t_op_ctn_insert['TEU']:=1*t_op_ctn_insert.FieldByName('数量').asinteger; if (frm_data_share.t_code_ctn.FieldByName('尺寸').asstring='40')OR (frm_data_share.t_code_ctn.FieldByName('尺寸').asstring='45')then t_op_ctn_insert['TEU']:=2*t_op_ctn_insert.FieldByName('数量').asinteger; end else begin t_op_ctn_insert['代码']:=''; t_op_ctn_insert['表现形式']:=''; t_op_ctn_insert['箱型']:=''; t_op_ctn_insert['尺寸']:=''; t_op_ctn_insert['TEU']:=0; end; t_op_ctn_insert['件数']:=t_op_ctn['PKGS']; t_op_ctn_insert['包装']:=t_op_ctn['KINDPKGS']; t_op_ctn_insert['重量']:=t_op_ctn['KGS']; t_op_ctn_insert['尺码']:=t_op_ctn['CBM']; // t_op_ctn_insert['品名']:=t_op_ctn['GOODSNAME']; t_op_ctn_insert['编号']:=bsno; t_op_ctn_insert.post; Next; end; end; finally end; end; update_ctn(t_op_ctn_insert); t_op_seae.Edit; t_op_seae.fieldbyname('ORSTATUS').AsString:='0'; t_op_seae.fieldbyname('BSCUSTNO').AsString:=bsno; t_op_seae.Post; m_qryTask.Edit; m_qryTask.FieldByName('完成时间').AsDateTime:=Now; m_qryTask.FieldByName('是否完成').AsInteger:=1; m_qryTask.FieldByName('任务状态').AsString:='已接收'; m_qryTask.FieldByName('操作人').AsString:=employee; m_qryTask.FieldByName('任务相关人员').AsString:=employee; m_qryTask.Post; sql:='INSERT INTO t_op_task_state ( [任务编号],[任务状态],[操作人])VALUES (''%s'' ,''%s'' ,''%s'')'; sql:=Format(sql,[m_qryTask.fieldbyname('任务编号').asstring,'已接收',employee] ); m_qryTask.Connection.Execute(sql); m_qryTask.Requery(); frm_main.db.CommitTrans; finally if frm_main.db.InTransaction then begin frm_main.db.RollbackTrans; end; Application.MessageBox(PChar('操作完成'),'信息提示'); close; end; end; procedure Tfrm_op_seae_order_edit.bsSkinButton1Click(Sender: TObject); var sql:string; begin if( Application.MessageBox(PChar('您确实要直接结束该任务吗?'+#13#10+'结束任务将直接关闭任务!,是否结束任务?'),'信息提示',MB_YESNO+ MB_ICONQUESTION)<>IDYES) then Exit; try //** m_qryTask.Connection.BeginTrans; m_qryTask.Edit; m_qryTask.FieldByName('完成时间').AsDateTime:=Now; m_qryTask.FieldByName('是否完成').AsInteger:=1; m_qryTask.FieldByName('任务状态').AsString:='结束'; m_qryTask.FieldByName('操作人').AsString:=employee; m_qryTask.FieldByName('任务相关人员').AsString:=employee; m_qryTask.Post; // sql:='INSERT INTO t_op_task_state ( [任务编号],[任务状态],[操作人])VALUES (''%s'' ,''%s'' ,''%s'')'; sql:=Format(sql,[m_qryTask.fieldbyname('任务编号').asstring,'结束',employee] ); m_qryTask.Connection.Execute(sql); //** m_qryTask.Connection.CommitTrans; m_qryTask.Requery(); Application.MessageBox(PChar('操作完成'),'信息提示'); close(); except on e:Exception do begin // on except //* m_qryTask.Connection.RollbackTrans; m_qryTask.Cancel(); Application.MessageBox(PChar('处理发生错误: '+E.Message),'信息提示'); end; end; end; procedure Tfrm_op_seae_order_edit.InitialData(qryTask: TADOQuery; bsno1: string); begin m_qryTask:=qryTask; m_bsno:=bsno1; end; function Tfrm_op_seae_order_edit.getkingpkgs(kindpkgscode: string): string; var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('Select 包装名称 from t_code_package where EDI代码='''+kindpkgscode+''''); Open; if IsEmpty then Result:='a' else Result:=FieldByName('包装名称').AsString; end; finally FreeAndNil(aQuery); end; end; function Tfrm_op_seae_order_edit.GetDeptname(Port: String): String; var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('Select 部门名称 from t_sys_employee where 姓名='''+Port+''''); Open; if not IsEmpty then Result:=Trim(FieldByName('部门名称').asstring) else Result:=''; end; finally FreeAndNil(aQuery); end; end; procedure Tfrm_op_seae_order_edit.bsSkinButton8Click(Sender: TObject); begin try frm_op_seae_selectbsno:=tfrm_op_seae_selectbsno.Create (self); frm_op_seae_selectbsno.ShowModal; finally frm_op_seae_selectbsno.Free; frm_op_seae_selectbsno:=nil; end; end; end.