unit u_op_seae_oder_wf_add; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, BusinessSkinForm, bsSkinCtrls, StdCtrls, wwdbdatetimepicker, DB, RxLookup,adodb,my_sys_chat, Mask, DBCtrlsEh,inifiles; type Tfrm_op_seae_order_wf_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; DBComboBoxEh1: TDBComboBoxEh; DBComboBoxEh2: TDBComboBoxEh; ADOQuery1: TADOQuery; data7: TDataSource; Data8: TDataSource; p_op_gain: TADOStoredProc; data6: 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); private { Private declarations } public { Public declarations } function GetLoadPortEdiID(Port:String): String; function GetPortEdiID(Port:String): String; end; var frm_op_seae_order_wf_add: Tfrm_op_seae_order_wf_add; frm_op_seae_add_num:integer; implementation uses u_main, my_sys_function, u_data_share; {$R *.dfm} function Tfrm_op_seae_order_wf_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_wf_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_wf_add.bsSkinButton2Click(Sender: TObject); begin close; end; procedure Tfrm_op_seae_order_wf_add.FormShow(Sender: TObject); var inifile1:Tinifile; begin inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini'); DBComboBoxEh1.Text:=inifile1.ReadString('seaeorder','op',''); RxDBLookupCombo30.DisplayValue:=inifile1.ReadString('seaeorder','opdept',''); DBComboBoxEh2.Text:=inifile1.ReadString('seaeorder','kf',''); RxDBLookupCombo1.DisplayValue:=inifile1.ReadString('seaeorder','kfdept',''); bsSkinCheckRadioBox1.Checked:=inifile1.Readbool('seaeorder','savecheck',true); inifile1.free; wwDBDateTimePicker1.Date:=date; end; procedure Tfrm_op_seae_order_wf_add.bsSkinButton3Click(Sender: TObject); var i: Integer; bsno,ywno:String; aQuery:TAdoQuery; begin 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='普通') or (Data2.DataSet.fieldbyname('业务方式').AsString='代派') then begin data1.DataSet.FieldByName('原始编号').AsString:=bsno; end else begin data1.DataSet.FieldByName('原始编号').AsString:=data2.DataSet.FieldByName('原始编号').AsString; end; 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:=data2.DataSet.FieldByName('录入人').AsString; data1.DataSet.FieldByName('运费确认人').AsString:=data2.DataSet.FieldByName('运费确认人').AsString; data1.DataSet.FieldByName('报检操作').AsString:=data2.DataSet.FieldByName('审核人').AsString; data1.DataSet.FieldByName('录入日期').Value:=date; data1.DataSet.FieldByName('操作员').AsString:=DBComboBoxEh1.text; // data1.DataSet['报关操作']:=employee; data1.DataSet.FieldByName('揽货人').AsString:=data2.DataSet.FieldByName('揽货人').AsString; data1.DataSet.FieldByName('客服员').AsString:=DBComboBoxEh2.text; data1.DataSet.FieldByName('销售部门').AsString:=data2.DataSet.FieldByName('销售部门').AsString; data1.DataSet.FieldByName('操作部门').AsString:=RxDBLookupCombo30.DisplayValue; 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; 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:=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:=getzqlx(data2.Dataset.fieldbyname('委托单位').asstring,'',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:=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.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('航线').AsString:=data2.DataSet.FieldByName('航线').AsString; data1.DataSet.FieldByName('场站').AsString:=data2.DataSet.FieldByName('场站').AsString; if not data2.DataSet.FieldByName('报关服务').AsBoolean then begin data1.DataSet.FieldByName('报关行').AsString:='自理报关'; end else begin InsertSeaeStatus(bsno,'报关服务',employee,FormatDateTime('YYYY-MM-DD',Now)); data1.DataSet.FieldByName('报关行').AsString:=data2.DataSet.FieldByName('报关行').AsString; end; if not data2.DataSet.FieldByName('拖车服务').AsBoolean then begin data1.DataSet.FieldByName('承运车队').AsString:='自行派车'; end else begin InsertSeaeStatus(bsno,'拖车服务',employee,FormatDateTime('YYYY-MM-DD',Now)); data1.DataSet.FieldByName('承运车队').AsString:=data2.DataSet.FieldByName('承运车队').AsString; end; data1.DataSet.FieldByName('报关行').AsString:=data2.DataSet.FieldByName('报关行').AsString; data1.DataSet.FieldByName('承运车队').AsString:=data2.DataSet.FieldByName('承运车队').AsString; data1.DataSet.Post; if not data5.DataSet.IsEmpty then begin data5.dataset.First; while not data5.DataSet.Eof do 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['财务税额']:=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['录入人']:=Data5.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; data5.DataSet.Next; end; end; // if not data6.DataSet.IsEmpty then begin data6.dataset.First; while not data6.DataSet.Eof do begin Data4.DataSet.Insert; Data4.DataSet['客户名称']:=Data6.DataSet['客户名称']; Data4.DataSet['类型']:='付'; Data4.DataSet['费用状态']:='审核通过'; Data4.DataSet['费用名称']:=Data6.DataSet['费用名称']; Data4.DataSet['标准']:=Data6.DataSet['标准']; Data4.DataSet['不含税价']:=Data6.DataSet['不含税价']; Data4.DataSet['税率']:=Data6.DataSet['税率']; Data4.DataSet['税额']:=Data6.DataSet['税额']; Data4.DataSet['不含税金额']:=Data6.DataSet['不含税金额']; Data4.DataSet['财务税率']:=Data6.DataSet['财务税率']; Data4.DataSet['财务税额']:=Data6.DataSet['财务税额']; Data4.DataSet['财务不含税价']:=Data6.DataSet['财务不含税价']; Data4.DataSet['单价']:=Data6.DataSet['单价']; Data4.DataSet['数量']:=Data6.DataSet['数量']; Data4.DataSet['金额']:=Data6.DataSet['金额']; Data4.DataSet['币别']:=Data6.DataSet['币别']; Data4.DataSet['汇率']:=Data6.DataSet['汇率']; Data4.DataSet['录入人']:=Data6.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; data6.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; // ShowMessage(IntToStr(Data3.DataSet.RecordCount)); update_ctn(TAdoQuery(Data3.DataSet)); aQuery:=CreateAdoQuery; with aQuery do try if (Data2.DataSet.fieldbyname('业务方式').AsString='普通') or (Data2.DataSet.fieldbyname('业务方式').AsString='代派') then begin Close;SQL.Clear; SQL.Add('Update t_op_seae_order set 状态=''接受订舱'' , 编号=:编号,业务编号=:业务编号'); SQL.Add(',审核人=:审核人,审核时间=:审核时间,提交人=:提交人,提交时间=:提交时间,原始编号=:原始编号'); SQL.Add('where OR_ID=:OR_ID'); Parameters.ParamByName('or_id').Value:=Data2.DataSet.fieldbyname('OR_ID').AsString; Parameters.ParamByName('原始编号').Value:=bsno; Parameters.ParamByName('编号').Value:=bsno; Parameters.ParamByName('业务编号').Value:=bsno; Parameters.ParamByName('审核人').Value:=employee; Parameters.ParamByName('审核时间').Value:=now; Parameters.ParamByName('提交人').Value:=employee; Parameters.ParamByName('提交时间').Value:=now; ExecSQL; end else begin Close;SQL.Clear; SQL.Add('Update t_op_seae_order set 状态=''接受订舱'' , 编号=:编号,业务编号=:业务编号'); SQL.Add(',审核人=:审核人,审核时间=:审核时间,提交人=:提交人,提交时间=:提交时间'); SQL.Add('where OR_ID=:OR_ID'); Parameters.ParamByName('or_id').Value:=Data2.DataSet.fieldbyname('OR_ID').AsString; Parameters.ParamByName('编号').Value:=bsno; Parameters.ParamByName('业务编号').Value:=bsno; Parameters.ParamByName('审核人').Value:=employee; Parameters.ParamByName('审核时间').Value:=now; Parameters.ParamByName('提交人').Value:=employee; Parameters.ParamByName('提交时间').Value:=now; ExecSQL; end; Close;sql.Clear; sql.Add('Update t_workflow_do set 当前状态=''审核通过'',审核日期=:审核日期'); sql.Add('where or_id=:or_id and W_ID=:W_ID and WI_ID=:WI_ID and 顺序=:顺序'); Parameters.ParamByName('or_id').Value:=Data2.DataSet.fieldbyname('or_id').value; Parameters.ParamByName('W_ID').Value:=Data2.DataSet.fieldbyname('W_ID').value; Parameters.ParamByName('WI_ID').Value:=Data2.DataSet.fieldbyname('WI_ID').value; Parameters.ParamByName('顺序').Value:=Data2.DataSet.fieldbyname('顺序').value; Parameters.ParamByName('审核日期').Value:=now; ExecSQL; finally freeAndNil(aQuery); end; Send_op_do('销售订舱确认,业务编号:'+ywno +',委托编号:'+Data2.DataSet.fieldbyname('订舱编号').AsString,'72', trim(DBComboBoxEh1.text), trim(DBComboBoxEh2.text), data2.DataSet.fieldbyname('揽货人').AsString); p_op_gain.Parameters.ParamByName('@con_no').value:=bsno; p_op_gain.ExecProc; close; end; procedure Tfrm_op_seae_order_wf_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_wf_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_wf_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_wf_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_wf_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_wf_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',DBComboBoxEh1.Text); inifile1.WriteString('seaeorder','opdept',RxDBLookupCombo30.DisplayValue); inifile1.WriteString('seaeorder','kf',DBComboBoxEh2.Text); inifile1.WriteString('seaeorder','kfdept',RxDBLookupCombo1.DisplayValue); inifile1.Writebool('seaeorder','savecheck',bsSkinCheckRadioBox1.Checked); inifile1.free; end; end; end.