unit u_op_seae_oder_add; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, BusinessSkinForm, bsSkinCtrls, StdCtrls, wwdbdatetimepicker, DB, RxLookup,adodb, Mask, DBCtrlsEh,inifiles, DBCtrls; type Tfrm_op_seae_order_add = class(TForm) bsBusinessSkinForm1: TbsBusinessSkinForm; bsSkinGroupBox1: TbsSkinGroupBox; Label1: TLabel; wwDBDateTimePicker1: TwwDBDateTimePicker; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; data1: TDataSource; Label16: TLabel; Label42: TLabel; RxDBLookupCombo30: TRxDBLookupCombo; Label17: TLabel; data2: TDataSource; data3: TDataSource; data4: TDataSource; data5: TDataSource; RxDBLookupCombo1: TRxDBLookupCombo; Label2: TLabel; bsSkinCheckRadioBox1: TbsSkinCheckRadioBox; ADOQuery1: TADOQuery; data7: TDataSource; Data8: TDataSource; t_sys_employee: TADOQuery; t_sys_employee1: TDataSource; t_sys_employee2: TADOQuery; t_sys_employee21: TDataSource; RxDBLookupCombo12: TRxDBLookupCombo; RxDBLookupCombo2: TRxDBLookupCombo; t_sys_department: TADOQuery; t_sys_department1: TDataSource; procedure FormShow(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure RxDBLookupCombo14Change(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure DBComboBoxEh1DropDown(Sender: TObject); procedure DBComboBoxEh2DropDown(Sender: TObject); procedure DBComboBoxEh1Change(Sender: TObject); procedure DBComboBoxEh2Change(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure RxDBLookupCombo30Change(Sender: TObject); procedure RxDBLookupCombo12Enter(Sender: TObject); procedure RxDBLookupCombo12Exit(Sender: TObject); procedure RxDBLookupCombo1Change(Sender: TObject); procedure RxDBLookupCombo12Change(Sender: TObject); procedure RxDBLookupCombo2Change(Sender: TObject); private { Private declarations } public { Public declarations } function GetLoadPortEdiID(Port:String): String; function GetPortEdiID(Port:String): String; function checkctn(aOR_ID:integer):Boolean; end; var frm_op_seae_order_add: Tfrm_op_seae_order_add; frm_op_seae_add_num:integer; implementation uses u_main, my_sys_function, u_data_share; {$R *.dfm} function Tfrm_op_seae_order_add.GetLoadPortEdiID(Port:String): String; var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('Select EDI代码 from t_code_loaport where 英文名='''+Port+''''); Open; if not IsEmpty then Result:=Trim(FieldByName('EDI代码').asstring) else Result:=''; end; finally FreeAndNil(aQuery); end; end; function Tfrm_op_seae_order_add.GetPortEdiID(Port:String): String; var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('Select EDI代码 from t_code_disport where 英文名='''+Port+''''); Open; if not IsEmpty then Result:=Trim(FieldByName('EDI代码').asstring) else Result:=''; end; finally FreeAndNil(aQuery); end; end; procedure Tfrm_op_seae_order_add.bsSkinButton2Click(Sender: TObject); begin close; end; procedure Tfrm_op_seae_order_add.FormShow(Sender: TObject); var inifile1:Tinifile; begin t_sys_department.Open; t_sys_employee.Open; t_sys_employee2.Open; inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini'); RxDBLookupCombo12.Value:=inifile1.ReadString('seaeorder','op',''); RxDBLookupCombo30.DisplayValue:=inifile1.ReadString('seaeorder','opdept',''); RxDBLookupCombo2.Value:=inifile1.ReadString('seaeorder','kf',''); RxDBLookupCombo1.DisplayValue:=inifile1.ReadString('seaeorder','kfdept',''); bsSkinCheckRadioBox1.Checked:=inifile1.Readbool('seaeorder','savecheck',true); inifile1.free; wwDBDateTimePicker1.Date:=date; end; function Tfrm_op_seae_order_add.checkctn(aOR_ID:integer):Boolean; var aQuery:TAdoQuery; begin Result:=True; aQuery:=CreateAdoQuery; with aQuery do begin close;sql.clear; sql.Add('select a.表现形式 as opor表现 ,b.表现形式 from t_opor_ctn a inner join t_code_ctn b on a.代码=b.代码 where a.OR_ID='+inttostr(aOR_ID)); open; end; aQuery.First; while not aQuery.Eof do begin if aQuery.FieldByName('opor表现').AsString<> aQuery.FieldByName('表现形式').AsString then begin Result:=False; Break; end; aQuery.Next; end; end; procedure Tfrm_op_seae_order_add.bsSkinButton3Click(Sender: TObject); var i: Integer; bsno,ywno:String; aQuery:TAdoQuery; begin if IsSeaeOrder(Data2.DataSet.fieldbyname('编号').AsString) then begin MessageDlg('已经生成委托,请刷新!', mtConfirmation, [mbYes],0); exit; end; if (RxDBLookupCombo12.DisplayValue='') or (wwDBDateTimePicker1.text='') then begin MessageDlg('操作员和会计期间不能为空!', mtConfirmation, [mbYes],0); exit; end; if not checkctn(Data2.DataSet.fieldbyname('OR_ID').AsInteger) then begin ShowMessage('集装箱信息不正确!不能继续!'); Exit; end; frm_main.db.BeginTrans; try if not data1.DataSet.Active then data1.DataSet.Open; //主表 if not data3.DataSet.Active then data3.DataSet.Open; // if not data4.DataSet.Active then data4.DataSet.Open; data1.DataSet.Insert; bsno:=get_id; data1.DataSet.FieldByName('编号').AsString:=bsno; if Data2.DataSet.FieldByName('装运方式').AsString<>'' then data1.DataSet.FieldByName('装运方式').AsString:=data2.DataSet.FieldByName('装运方式').AsString else data1.DataSet.FieldByName('装运方式').AsString:='整箱'; data1.DataSet.FieldByName('会计期间').Value:=wwDBDateTimePicker1.date; data1.DataSet.FieldByName('周次').AsInteger:=WeekofYear(wwDBDateTimePicker1.date); data1.DataSet.FieldByName('录入人').AsString:=employee; data1.DataSet.FieldByName('录入日期').Value:=date; data1.DataSet.FieldByName('操作员').AsString:=RxDBLookupCombo12.Value; // data1.DataSet['报关操作']:=employee; data1.DataSet.FieldByName('揽货人').AsString:=data2.DataSet.FieldByName('揽货人').AsString; data1.DataSet.FieldByName('客服员').AsString:=RxDBLookupCombo2.Value; data1.DataSet.FieldByName('销售部门').AsString:=data2.DataSet.FieldByName('销售部门').AsString; data1.DataSet.FieldByName('操作部门').AsString:=RxDBLookupCombo30.DisplayValue; data1.DataSet.FieldByName('委托单位').AsString:=data2.DataSet.FieldByName('委托单位').AsString; if frm_data_share.t_crm_client_weituo.Locate('客户简称',data2.DataSet.FieldByName('委托单位').AsString,[]) then begin data1.DataSet.FieldByName('辅助字段一').AsString:=frm_data_share.t_crm_client_weituo.fieldbyname('备注').asstring; end; data1.DataSet.FieldByName('货代公司').AsString:=data2.DataSet.FieldByName('货代公司').AsString; data1.DataSet.FieldByName('船公司').AsString:=data2.DataSet.FieldByName('船公司').AsString; ywno:=get_no(wwDBDateTimePicker1.date,getbsno(Logininfo.SeaExpBsNo,'SE')); data1.DataSet.FieldByName('业务编号').AsString:=ywno; data1.DataSet.FieldByName('主编号').AsString:=bsno; data1.DataSet.FieldByName('委托编号').AsString:=Data2.DataSet.FieldByName('订舱编号').AsString; data1.DataSet.FieldByName('主提单标准').AsString:=bsno; data1.DataSet.FieldByName('分提单标准').AsString:=bsno; data1.DataSet.FieldByName('委托标准').AsString:=bsno; data1.DataSet.FieldByName('报关标准').AsString:=bsno; data1.DataSet.FieldByName('报检标准').AsString:=bsno; data1.DataSet.FieldByName('核销标准').AsString:=bsno; data1.DataSet.FieldByName('计费标准').AsString:=''; data1.DataSet.FieldByName('业务状态').AsString:='接受委托'; data1.DataSet.FieldByName('封帐前状态').AsString:='接受委托'; data1.DataSet.FieldByName('费用状态').AsString:='录入状态'; data1.DataSet.FieldByName('业务类型').AsString:='普通货'; data1.DataSet.FieldByName('业务来源').AsString:=data2.DataSet.FieldByName('业务来源').AsString; data1.DataSet.FieldByName('来源明细').AsString:=data2.DataSet.FieldByName('来源明细').AsString; data1.DataSet.FieldByName('起运港').AsString:=data2.DataSet.FieldByName('装货港').AsString; data1.DataSet.FieldByName('装货港').AsString:=data2.DataSet.FieldByName('装货港').AsString; data1.DataSet.FieldByName('航线').AsString:=data2.DataSet.FieldByName('航线').AsString; data1.DataSet.FieldByName('装港代码').AsString:=GetLoadPortEdiID(trim(data2.DataSet.FieldByName('装货港').AsString)); //////?????? data1.DataSet.FieldByName('提单份数').AsString:=get_parameters_value(20,'THREE'); data1.DataSet.FieldByName('运输条款').AsString:=data2.DataSet.FieldByName('运输条款').AsString; data1.DataSet.FieldByName('唛头').AsString:=data2.DataSet.FieldByName('唛头').AsString; data1.DataSet.FieldByName('货物描述').AsString:=data2.DataSet.FieldByName('货物描述').AsString; data1.DataSet.FieldByName('发货人').AsString:=data2.DataSet.FieldByName('发货人').AsString; data1.DataSet.FieldByName('收货人').AsString:=data2.DataSet.FieldByName('收货人').AsString; data1.DataSet.FieldByName('通知人').AsString:=data2.DataSet.FieldByName('通知人').AsString; data1.DataSet.FieldByName('代理').AsString:=data2.DataSet.FieldByName('境外代理').AsString; data1.DataSet.FieldByName('发货人代码').AsString:=data2.DataSet.FieldByName('发货人代码').AsString; data1.DataSet.FieldByName('收货人代码').AsString:=data2.DataSet.FieldByName('收货人代码').AsString; data1.DataSet.FieldByName('通知人代码').AsString:=data2.DataSet.FieldByName('通知人代码').AsString; data1.DataSet.FieldByName('代理内容').AsString:=data2.DataSet.FieldByName('代理内容').AsString; data1.DataSet.FieldByName('付费方式').AsString:=data2.DataSet.FieldByName('付费方式').AsString; data1.DataSet.FieldByName('签单地点').AsString:=data2.DataSet.FieldByName('签单地点').AsString; data1.DataSet.FieldByName('件数包装').AsString:=data2.DataSet.FieldByName('件数包装').AsString; data1.DataSet.FieldByName('货物重量').AsString:=data2.DataSet.FieldByName('货物重量').AsString; data1.DataSet.FieldByName('货物尺码').AsString:=data2.DataSet.FieldByName('货物尺码').AsString; data1.DataSet.FieldByName('件数').AsInteger:=data2.DataSet.FieldByName('件数').AsInteger; data1.DataSet.FieldByName('包装').AsString:=data2.DataSet.FieldByName('包装').AsString; data1.DataSet.FieldByName('重量').AsFloat:=data2.DataSet.FieldByName('重量').AsFloat; data1.DataSet.FieldByName('尺码').AsFloat:=data2.DataSet.FieldByName('尺码').AsFloat; data1.DataSet.FieldByName('件数大写').AsString:=data2.DataSet.FieldByName('件数大写').AsString; data1.DataSet.FieldByName('危险品分类').AsString:=data2.DataSet.FieldByName('危险品分类').AsString; data1.DataSet.FieldByName('危险品编号').AsString:=data2.DataSet.FieldByName('危险品编号').AsString; data1.DataSet.FieldByName('运费协议号').AsString:=data2.DataSet.FieldByName('运费协议号').AsString; data1.DataSet.FieldByName('船名').AsString:=data2.DataSet.FieldByName('船名').AsString; data1.DataSet.FieldByName('航次').AsString:=data2.DataSet.FieldByName('航次').AsString; data1.DataSet.FieldByName('开船日期').Value:=data2.DataSet.FieldByName('开船日期').Value; data1.DataSet.FieldByName('卸货港').AsString:=data2.DataSet.FieldByName('卸货港').AsString; data1.DataSet.FieldByName('卸货代码').AsString:=GetPortEdiID(trim(data2.DataSet.FieldByName('卸货港').AsString)); data1.DataSet.FieldByName('目的地').AsString:=data2.DataSet.FieldByName('目的地').AsString; data1.DataSet.FieldByName('目的地代码').AsString:=GetPortEdiID(trim(data2.DataSet.FieldByName('目的地').AsString)); data1.DataSet.FieldByName('集装箱').AsString:=data2.DataSet.FieldByName('集装箱').AsString; data1.DataSet.FieldByName('备注').AsString:=data2.DataSet.FieldByName('备注').AsString; data1.DataSet.FieldByName('销售订舱说明').AsString:=data2.DataSet.FieldByName('订舱说明').AsString; data1.DataSet.FieldByName('预付地点').AsString:=get_parameters_value(50,'QINGDAO,CHINA'); data1.DataSet.FieldByName('退税日期').Value:=null; data1.DataSet.FieldByName('签单日期').Value:=null; data1.DataSet.FieldByName('派车日期').Value:=null; data1.DataSet.FieldByName('寄单日期').Value:=null; data1.DataSet.FieldByName('是否寄单').Value:=0; data1.DataSet.FieldByName('是否退税').Value:=0; data1.DataSet.FieldByName('是否通关').Value:=0; data1.DataSet.FieldByName('是否签单').Value:=0; data1.DataSet.FieldByName('请求派车').Value:=0; data1.DataSet.FieldByName('是否派车').Value:=0; data1.DataSet.FieldByName('是否解锁').Value:=0; data1.DataSet.FieldByName('解锁日期').Value:=null; data1.DataSet.FieldByName('解锁人').Value:=''; data1.DataSet.FieldByName('应收陆运').Value:=0; data1.DataSet.FieldByName('应付陆运').Value:=0; data1.DataSet.FieldByName('陆运利润').Value:=0; data1.DataSet.FieldByName('财务').Value:=0; data1.DataSet.FieldByName('财务凭证').Value:=''; data1.DataSet.FieldByName('是否打印').Value:=0; data1.DataSet.FieldByName('销售订舱').Value:=1; data1.DataSet.FieldByName('是否退舱').Value:=0; data1.DataSet['VGM']:=1; data1.DataSet.FieldByName('报关服务').Value:=data2.DataSet.FieldByName('报关服务').Value; data1.DataSet.FieldByName('报验服务').Value:=data2.DataSet.FieldByName('报验服务').Value; data1.DataSet.FieldByName('拖车服务').Value:=data2.DataSet.FieldByName('拖车服务').Value; data1.DataSet.FieldByName('签单方式').AsString:=data2.DataSet.FieldByName('签单方式').AsString; data1.DataSet.FieldByName('付费方式').AsString:=data2.DataSet.FieldByName('付费方式').AsString; data1.DataSet.FieldByName('货代公司联系人').AsString:=data2.DataSet.FieldByName('货代公司联系人').AsString; data1.DataSet.FieldByName('应收海运费').AsFloat:=data2.DataSet.FieldByName('应收海运费').AsFloat; data1.DataSet.FieldByName('应付海运费').AsFloat:=data2.DataSet.FieldByName('应付海运费').AsFloat; data1.DataSet.FieldByName('船公司代理费').AsFloat:=data2.DataSet.FieldByName('船公司代理费').AsFloat; data1.DataSet.FieldByName('捷丰代理费').AsFloat:=data2.DataSet.FieldByName('捷丰代理费').AsFloat; data1.DataSet.FieldByName('香港付费').Value:=data2.DataSet.FieldByName('香港付费').Value; data1.DataSet.FieldByName('香港付费对象').Value:=data2.DataSet.FieldByName('香港付费对象').Value; data1.DataSet.FieldByName('二程开船日期').Value:=data2.DataSet.FieldByName('录入日期').Value; data1.DataSet.FieldByName('三程开船日期').Value:=now; data1.DataSet.FieldByName('货物标识').Value:=data2.DataSet.FieldByName('货物标识').Value; data1.DataSet.Post; if not data5.DataSet.IsEmpty then begin data5.dataset.First; while not data5.DataSet.Eof do begin if (Data5.DataSet['应收金额']<>0) then begin Data4.DataSet.Insert; Data4.DataSet['客户名称']:=Data5.DataSet['应收客户']; Data4.DataSet['类型']:='收'; Data4.DataSet['费用状态']:='审核通过'; Data4.DataSet['费用名称']:=Data5.DataSet['费用名称']; Data4.DataSet['标准']:=Data5.DataSet['应收标准']; Data4.DataSet['单价']:=Data5.DataSet['应收单价']; Data4.DataSet['数量']:=Data5.DataSet['应收数量']; Data4.DataSet['金额']:=Data5.DataSet['应收金额']; Data4.DataSet['币别']:=Data5.DataSet['应收币别']; Data4.DataSet['汇率']:=Data5.DataSet['应收汇率']; Data4.DataSet['录入人']:=Data2.DataSet['揽货人']; Data4.DataSet['结算金额']:=0; Data4.DataSet['开票金额']:=0; Data4.DataSet['申请开票']:=0; Data4.DataSet['冲抵金额']:=0; Data4.DataSet['申请金额']:=0; Data4.DataSet['录入日期']:=now; Data4.DataSet['是否对帐']:=0; Data4.DataSet['是否垫付']:=0; Data4.DataSet['不开发票']:=0; Data4.DataSet['结算单位']:='委托单位'; Data4.DataSet['顺序']:=0; Data4.DataSet['机密']:=0; Data4.DataSet['编号']:=bsno; Data4.DataSet.post; end; if (Data5.DataSet['应付金额']<>0) then begin Data4.DataSet.Insert; Data4.DataSet['客户名称']:=Data5.DataSet['应付客户']; Data4.DataSet['类型']:='付'; Data4.DataSet['费用状态']:='审核通过'; Data4.DataSet['费用名称']:=Data5.DataSet['费用名称']; Data4.DataSet['标准']:=Data5.DataSet['应付标准']; Data4.DataSet['单价']:=Data5.DataSet['应付单价']; Data4.DataSet['数量']:=Data5.DataSet['应付数量']; Data4.DataSet['金额']:=Data5.DataSet['应付金额']; Data4.DataSet['币别']:=Data5.DataSet['应付币别']; Data4.DataSet['汇率']:=Data5.DataSet['应付汇率']; Data4.DataSet['录入人']:=Data2.DataSet['揽货人']; Data4.DataSet['结算金额']:=0; Data4.DataSet['申请开票']:=0; Data4.DataSet['开票金额']:=0; Data4.DataSet['冲抵金额']:=0; Data4.DataSet['申请金额']:=0; Data4.DataSet['录入日期']:=now; Data4.DataSet['是否对帐']:=0; Data4.DataSet['是否垫付']:=0; Data4.DataSet['不开发票']:=0; Data4.DataSet['结算单位']:='货代公司'; Data4.DataSet['顺序']:=0; Data4.DataSet['机密']:=0; Data4.DataSet['编号']:=bsno; Data4.DataSet.post; end; data5.DataSet.Next; end; end; if (Data2.DataSet.FieldByName('集装箱').AsString<>'') then begin aQuery:=CreateAdoQuery; try Data3.DataSet.Close; Data3.DataSet.Open; with aQuery do begin sql.Add('select * from t_opor_ctn where OR_ID='+Data2.DataSet.fieldbyname('OR_ID').AsString); Open;First; while not Eof do begin Data3.DataSet.Insert; Data3.DataSet['代码']:=aQuery['代码']; Data3.DataSet['尺寸']:=aQuery['尺寸']; Data3.DataSet['箱型']:=aQuery['箱型']; Data3.DataSet['数量']:=aQuery['数量']; Data3.DataSet['TEU']:=aQuery['TEU']; Data3.DataSet['表现形式']:=aQuery['表现形式']; Data3.DataSet['箱号']:=aQuery['箱号']; Data3.DataSet['箱型']:=aQuery['箱型']; Data3.DataSet['封号']:=aQuery['封号']; Data3.DataSet['件数']:=aQuery['件数']; Data3.DataSet['包装']:=aQuery['包装']; Data3.DataSet['重量']:=aQuery['重量']; Data3.DataSet['尺码']:=aQuery['尺码']; Data3.DataSet['品名']:=aQuery['品名']; Data3.DataSet['唛头']:=aQuery['唛头']; Data3.DataSet['备注']:=aQuery['备注']; Data3.DataSet['编号']:=bsno; Data3.DataSet.post; Next; end; end; finally freeAndNil(aQuery); end; end; update_ctn(TAdoQuery(Data3.DataSet)); // update_ctn(TAdoQuery(Data3.DataSet)); if (Data2.DataSet.fieldbyname('状态').AsString='新建订舱') or (Data2.DataSet.fieldbyname('状态').AsString='提交审核') or (Data2.DataSet.fieldbyname('状态').AsString='驳回提交') then begin Data2.DataSet.Edit; Data2.DataSet.fieldbyname('状态').AsString:='接受订舱'; Data2.DataSet.fieldbyname('编号').AsString:=bsno; Data2.DataSet.fieldbyname('业务编号').AsString:=ywno; Data2.DataSet.fieldbyname('审核人').AsString:=employee; Data2.DataSet.fieldbyname('审核时间').Value:=date; Data2.DataSet.fieldbyname('提交人').AsString:=employee; Data2.DataSet.fieldbyname('提交时间').Value:=date; Data2.DataSet.fieldbyname('操作员').AsString:=RxDBLookupCombo12.Value; Data2.DataSet.fieldbyname('客服员').AsString:=RxDBLookupCombo2.Value; Data2.DataSet.Post; end else if Data2.DataSet.fieldbyname('状态').AsString='审核通过' then begin Data2.DataSet.Edit; Data2.DataSet.fieldbyname('状态').AsString:='接受订舱'; Data2.DataSet.fieldbyname('编号').AsString:=bsno; Data2.DataSet.fieldbyname('业务编号').AsString:=ywno; Data2.DataSet.fieldbyname('提交人').AsString:=employee; Data2.DataSet.fieldbyname('提交时间').Value:=date; Data2.DataSet.fieldbyname('操作员').AsString:=RxDBLookupCombo12.Value; Data2.DataSet.fieldbyname('客服员').AsString:=RxDBLookupCombo2.Value; Data2.DataSet.Post; end; { Send_op_do('销售订舱确认,业务编号:'+ywno +',委托编号:'+Data2.DataSet.fieldbyname('订舱编号').AsString,'72', trim(DBComboBoxEh1.text), trim(DBComboBoxEh2.text), data2.DataSet.fieldbyname('揽货人').AsString); } frm_main.db.CommitTrans; finally if frm_main.db.InTransaction then begin frm_main.db.RollbackTrans; end; { if strtobool(get_parameters_value(161,'false')) then update_ctn(TAdoQuery(Data3.DataSet)) else update_ctn_sql(TAdoQuery(Data3.DataSet),bsno); } close; end; end; procedure Tfrm_op_seae_order_add.RxDBLookupCombo14Change(Sender: TObject); begin { if RxDBLookupCombo14.DisplayValue='' then exit; if frm_data_share.t_sys_employee.locate('姓名',RxDBLookupCombo14.DisplayValue,[]) then RxDBLookupCombo30.DisplayValue:=frm_data_share.t_sys_employee['部门名称']; } end; procedure Tfrm_op_seae_order_add.DBComboBoxEh1DropDown(Sender: TObject); begin { DBComboBoxEh1.items.clear; if RxDBLookupCombo30.DisplayValue<>'' then begin AdoQuery1.Close; AdoQuery1.sql.Clear; AdoQuery1.SQL.Add('select * from t_sys_employee where 部门名称='''+RxDBLookupCombo30.DisplayValue+''''); AdoQuery1.Open; AdoQuery1.first; while not AdoQuery1.Eof do begin DBComboBoxEh1.Items.Add(AdoQuery1.fieldbyname('姓名').AsString); ADOQuery1.Next; end; end else begin AdoQuery1.Close; AdoQuery1.sql.Clear; AdoQuery1.SQL.Add('select * from t_sys_employee '); AdoQuery1.Open; AdoQuery1.first; while not AdoQuery1.Eof do begin DBComboBoxEh1.Items.Add(AdoQuery1.fieldbyname('姓名').AsString); ADOQuery1.Next; end; end; } end; procedure Tfrm_op_seae_order_add.DBComboBoxEh2DropDown(Sender: TObject); begin { DBComboBoxEh2.items.clear; if RxDBLookupCombo1.DisplayValue<>'' then begin AdoQuery1.Close; AdoQuery1.sql.Clear; AdoQuery1.SQL.Add('select * from t_sys_employee where 部门名称='''+RxDBLookupCombo1.DisplayValue+''''); AdoQuery1.Open; AdoQuery1.first; while not AdoQuery1.Eof do begin DBComboBoxEh2.Items.Add(AdoQuery1.fieldbyname('姓名').AsString); ADOQuery1.Next; end; end else begin AdoQuery1.Close; AdoQuery1.sql.Clear; AdoQuery1.SQL.Add('select * from t_sys_employee '); AdoQuery1.Open; AdoQuery1.first; while not AdoQuery1.Eof do begin DBComboBoxEh2.Items.Add(AdoQuery1.fieldbyname('姓名').AsString); ADOQuery1.Next; end; end; } end; procedure Tfrm_op_seae_order_add.DBComboBoxEh1Change(Sender: TObject); begin // if frm_data_share.t_sys_employee.Locate('姓名',DBComboBoxEh1.Text,[]) then // RxDBLookupCombo30.DisplayValue:=frm_data_share.t_sys_employee['部门名称']; end; procedure Tfrm_op_seae_order_add.DBComboBoxEh2Change(Sender: TObject); begin // if frm_data_share.t_sys_employee.Locate('姓名',DBComboBoxEh2.Text,[]) then // RxDBLookupCombo1.DisplayValue:=frm_data_share.t_sys_employee['部门名称']; end; procedure Tfrm_op_seae_order_add.FormClose(Sender: TObject; var Action: TCloseAction); var inifile1:Tinifile; begin if bsSkinCheckRadioBox1.Checked then begin inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini'); inifile1.WriteString('seaeorder','op',RxDBLookupCombo12.DisplayValue); inifile1.WriteString('seaeorder','opdept',RxDBLookupCombo30.DisplayValue); inifile1.WriteString('seaeorder','kf',RxDBLookupCombo2.DisplayValue); inifile1.WriteString('seaeorder','kfdept',RxDBLookupCombo1.DisplayValue); inifile1.Writebool('seaeorder','savecheck',bsSkinCheckRadioBox1.Checked); inifile1.free; end; end; procedure Tfrm_op_seae_order_add.RxDBLookupCombo30Change(Sender: TObject); begin if (RxDBLookupCombo30.DisplayValue<>'') then begin t_sys_employee.Close; t_sys_employee.sql.Clear; t_sys_employee.SQL.Add('select * from t_sys_employee where 部门名称='''+RxDBLookupCombo30.DisplayValue+''''); t_sys_employee.Open; end; end; procedure Tfrm_op_seae_order_add.RxDBLookupCombo12Enter(Sender: TObject); begin TRxDBLookupCombo(Sender).LookupDisplay:='代码;姓名' end; procedure Tfrm_op_seae_order_add.RxDBLookupCombo12Exit(Sender: TObject); begin // TRxDBLookupCombo(Sender).LookupDisplay:='姓名' end; procedure Tfrm_op_seae_order_add.RxDBLookupCombo1Change(Sender: TObject); begin if (RxDBLookupCombo1.DisplayValue<>'') then begin t_sys_employee2.Close; t_sys_employee2.sql.Clear; t_sys_employee2.SQL.Add('select * from t_sys_employee where 部门名称='''+RxDBLookupCombo1.DisplayValue+''''); t_sys_employee2.Open; end; end; procedure Tfrm_op_seae_order_add.RxDBLookupCombo12Change(Sender: TObject); begin RxDBLookupCombo30.DisplayValue:=t_sys_employee['部门名称']; end; procedure Tfrm_op_seae_order_add.RxDBLookupCombo2Change(Sender: TObject); begin RxDBLookupCombo1.DisplayValue:=t_sys_employee2['部门名称']; end; end.