{$INCLUDE t_main.inc} unit u_main; //主窗体 interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ImgList, bsSkinData, BusinessSkinForm, DB, ADODB, bsSkinCtrls, ComCtrls, bsSkinTabs, ExtCtrls, StdCtrls, Menus, AppEvnts,inifiles, jpeg, Mask, DBCtrls, NMUDP,ShellApi,Registry, RxCombos, bsSkinBoxCtrls, RxMemDS,Winsock, wwdbedit, Wwdotdot, Wwdbcomb, RxLookup, ActnList, Grids, Buttons, ToolWin, DBActns,Regware2, IdComponent, IdTCPConnection, IdTCPClient, IdMessageClient, IdSMTP, IdBaseComponent, IdMessage,Client_TLB, IdExplicitTLSClientServerBase, IdSMTPBase; type //tloaddll=procedure(username:pchar); stdcall; // tsendmsg=procedure(cmd,msgtitle,msg,revname:pchar); stdcall; Tfrm_main = class(TForm) db: TADOConnection; bsBusinessSkinForm1: TbsBusinessSkinForm; bsStoredSkin1: TbsStoredSkin; ApplicationEvents1: TApplicationEvents; imglMain: TImageList; t_info_bulletin: TADOQuery; t_info_bulletin1: TDataSource; t_info_plan: TADOQuery; t_info_plan1: TDataSource; t_info_tell: TADOQuery; t_info_tell1: TDataSource; Timer1: TTimer; t_chat_man: TRxMemoryData; t_chat_man1: TDataSource; t_info_leaveword: TADOQuery; t_info_leaveword1: TDataSource; t_sum_ctn: TRxMemoryData; t_sys_message_no: TADOQuery; t_sys_message_yes: TADOQuery; t_sys_message_yes1: TDataSource; t_do_shenhe_fee: TADOQuery; t_do_shenhe_other: TADOQuery; qryTmp: TADOQuery; ActionList1: TActionList; p_kaoqin: TADOStoredProc; bsSkinData1: TbsSkinData; qrytmp2: TADOQuery; bsStoredSkin2: TbsStoredSkin; bsStoredSkin3: TbsStoredSkin; bsStoredSkin4: TbsStoredSkin; Panel1: TPanel; IdMsg: TIdMessage; SMTP1: TIdSMTP; RegwareII1: TRegwareII; t_sys_soft_rg: TADOQuery; Timer2: TTimer; qrytmp3: TADOQuery; webdb: TADOConnection; qryweb: TADOQuery; qryweb2: TADOQuery; NMUDP: TNMUDP; function SearchTabs(formName:string;formcaption:string;tabname:string=''):TtabSheet;//创建TAB页 procedure freeTabs(formName:string);//根据窗体名称释放TAB页 procedure view_momo(DataSource1:TDataSource;fi:string;b_ReadOnly:Boolean = false); //编辑字段内容 公用大数据弹出窗体 procedure Timer1Timer(Sender: TObject);//定时检索计时提醒信息 procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure NMUDPDataReceived(Sender: TComponent; NumberBytes: Integer; FromIP: String; Port: Integer);//接收消息提醒 procedure dxDBGrid4Click(Sender: TObject); procedure ApplicationEvents1Exception(Sender: TObject; E: Exception); //错误事件处理 procedure FormShow(Sender: TObject); procedure dbBeforeConnect(Sender: TObject); procedure ApplicationEvents1ShortCut(var Msg: TWMKey; var Handled: Boolean);//程序快捷键 procedure Timer2Timer(Sender: TObject);//作用定时检索数据库防止断线 procedure webdbBeforeConnect(Sender: TObject);//网页独立数据库的数据库连接设置 private { Private declarations } procedure getview(t_project:boolean); //true新false旧界面 procedure LoadView; //程序皮肤切换 // procedure loaddsdll ; // procedure Mymessage(var t:TWmCopyData);message WM_COPYDATA; public { Public declarations } end; var frm_main: Tfrm_main; employee,department,subComp,emppassword,emailAddr,emptel,empmobil,employeecode:string;//人员、部门、分公司、密码 // sl_histroy:tstringlist; EmpDr,EmpCr,EmpProfit,modify_all:boolean; //允许修改标记 if_ch_delete_do:boolean; //判断是否取消添加费用 delete_do_type_num:integer; //取消费用添加业务类型 if_log:boolean; //是否已登录 LocalIP: String; //本机IP地址 BroadCastIP: String; //广播消息地址段 G_ZWCHK : String; //税务稽查 109:TRUE 隐藏帐务 FALSE 显示帐务 G_Arrivdate : String; //审核检查 110:true 检查审核时到达日期不为空 false 到达日期可以为空 backstate,orderState:string ; //订舱 退舱 业务状态 showprice:booLean ; //客户信誉返回特加 t_project:boolean ; //界面切换 True: tree , False:老界面 msgclient:Iimclient; //即时消息客户端COM接口 isclosewoke,isopenwoke:string;//是否随程序关闭提醒客户端 yctx:string ; //启用 不启用消息客户端 procedure getmsg(msg:widestring); //接收即时消息客户端消息 implementation uses u_sys_about, my_sys_function,u_data_share, u_op_memo, u_sys_close,u_sys_progress, my_sys_chat, u_sys_message_pri, u_info_tell, u_sys_login, u_sys_module, u_tree_main, u_dxbar_main, u_chrat_message, U_op_fee_view, u_ch_fee_check_seae, u_ch_fee_check_seai, u_ch_fee_check_aire, u_ch_fee_check_airi, u_ch_fee_check_airtruck, u_ch_invoice_check, u_ch_invoice, u_ch_check_check, U_op_state_view, u_op_seae_edi_cma, U_op_fee_view_all, u_rp_op_ttl, U_SHIPINGBOX_SI; {$R *.DFM} procedure Tfrm_main.view_momo(DataSource1:TDataSource;fi:string;b_ReadOnly:Boolean=false); //编辑字段内容 begin if DataSource1.DataSet.IsEmpty then exit; try frm_op_memo:=Tfrm_op_memo.Create(self); frm_op_memo.DBMemo1.DataSource:=DataSource1; frm_op_memo.DBMemo1.DataField:=fi; frm_op_memo.DBMemo1.ReadOnly:=b_ReadOnly; frm_op_memo.caption:=fi; frm_op_memo.ShowModal; finally frm_op_memo.free; end; end; function Tfrm_main.SearchTabs(formName:string;formcaption:string;tabname:string=''):TtabSheet; //查找 相应tab var i:integer; TabSheet: TbsSkinTabSheet; curpagectl:TbsSkinPageControl; begin if t_project then curpagectl:=frm_tree_main.bsSkinPageControl1 else curpagectl:=frm_dxbar_main.bsSkinPageControl1 ; for i:=0 to curpagectl.PageCount -1 do begin if curpagectl.Pages[i].TabVisible then begin if curpagectl.Pages[i].Hint=formName then begin curpagectl.ActivePageIndex :=i; result:=curpagectl.Pages[curpagectl.ActivePageIndex] ; exit; end; end ; end; TabSheet:=TbsSkinTabSheet.create(self); TabSheet.PageControl:=curpagectl ; curpagectl.ActivePageIndex :=curpagectl.PageCount-1; curpagectl.Pages[curpagectl.ActivePageIndex].Hint:=formName; if tabname<>'' then curpagectl.Pages[curpagectl.ActivePageIndex].Name:='tab'+tabname; curpagectl.Pages[curpagectl.ActivePageIndex].caption:=formcaption; result:=curpagectl.Pages[curpagectl.ActivePageIndex] ; end; procedure Tfrm_main.freeTabs(formName:string); var i:integer; curpagectl:TbsSkinPageControl; begin if t_project then curpagectl:=frm_tree_main.bsSkinPageControl1 else curpagectl:=frm_dxbar_main.bsSkinPageControl1 ; for i:=0 to curpagectl.PageCount -1 do begin if curpagectl.Pages[i].TabVisible then begin if curpagectl.Pages[i].Hint=formName then begin curpagectl.Pages[i].free ; break; end; end ; end; end; procedure Tfrm_main.Timer1Timer(Sender: TObject); var now_str,tel_str:string; get_str,do_str:integer; begin //计时提醒内容 if t_info_tell.IsEmpty then begin Timer1.enabled:=false; exit; end; do_str:=86400; t_info_tell.first; now_str:=FormatDateTime('yyyy',now) +FormatDateTime('mm',now) +FormatDateTime('dd',now) +FormatDateTime('hh',now) +FormatDateTime('nn',now); while not t_info_tell.eof do begin tel_str:=FormatDateTime('yyyy',t_info_tell.fieldbyname('提醒时间').asdatetime) +FormatDateTime('mm',t_info_tell.fieldbyname('提醒时间').asdatetime) +FormatDateTime('dd',t_info_tell.fieldbyname('提醒时间').asdatetime) +FormatDateTime('hh',t_info_tell.fieldbyname('提醒时间').asdatetime) +FormatDateTime('nn',t_info_tell.fieldbyname('提醒时间').asdatetime); if tel_str=now_str then begin try Timer1.enabled:=false; frm_info_tell:=tfrm_info_tell.Create (self); frm_info_tell.ShowModal; finally frm_info_tell.Free; frm_info_tell:= nil; Timer1.Interval:=10000; Timer1.enabled:=true; end; end else begin if (FormatDateTime('yyyy',t_info_tell.fieldbyname('提醒时间').asdatetime)=FormatDateTime('yyyy',now)) and(FormatDateTime('mm',t_info_tell.fieldbyname('提醒时间').asdatetime)=FormatDateTime('mm',now)) and(FormatDateTime('dd',t_info_tell.fieldbyname('提醒时间').asdatetime)=FormatDateTime('dd',now)) then begin get_str:=(strtoint(FormatDateTime('hh',t_info_tell.fieldbyname('提醒时间').asdatetime))- strtoint(FormatDateTime('hh',now)))*60*60+ (strtoint(FormatDateTime('nn',t_info_tell.fieldbyname('提醒时间').asdatetime))- strtoint(FormatDateTime('nn',now)))*60; if (get_str0) then do_str:=get_str; end; end; t_info_tell.next; end; if do_str=86400 then begin Timer1.enabled:=false; end else if do_str<>0 then begin Timer1.enabled:=false; Timer1.Interval:=1000*(do_str-1); Timer1.enabled:=true; end else begin Timer1.enabled:=false; end; end; procedure Tfrm_main.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin try frm_sys_close:=Tfrm_sys_close.Create(self); frm_sys_close.ShowModal; if frm_sys_close.ModalResult = mrOk then CanClose:=True else CanClose:=False; finally frm_sys_close.Free; end; end; procedure Tfrm_main.NMUDPDataReceived(Sender: TComponent; NumberBytes: Integer; FromIP: String; Port: Integer); var msg:array[1..255] of Char; from_ip,from_type,from_emp:wideString; i:integer; tell_str:string; begin if not strtobool(get_parameters_value(192,'false')) then Exit; //旧消息处理 if not if_log then exit; if employee='' then exit; NMUDP.ReadBuffer(msg,i); from_ip:=Trim(Copy(Msg,1,16)); from_type:=Trim(Copy(Msg,17,2)); from_emp:=Trim(Copy(Msg,19,10)); tell_str:=Copy(Msg,29,i-28); try strtoint(from_type); except exit; end; case strtoint(from_type) of 1: begin if (from_ip<>LocalIP) and (from_emp=employee)then begin // showmessage('对不起,你的帐号在别的电脑上登陆,你将被逐出系统!!'); // application.Terminate; // exit; end; if (from_ip<>LocalIP) and (from_emp<>employee)then begin if t_chat_man.locate('在线职员',from_emp,[]) then begin t_chat_man.edit; t_chat_man['所在电脑']:=from_ip; t_chat_man.post; end else begin t_chat_man.insert; t_chat_man['在线职员']:=from_emp; t_chat_man['所在电脑']:=from_ip; t_chat_man['发布']:=false; if frm_data_share.t_sys_employee.locate('姓名',from_emp,[]) then begin t_chat_man['所属部门']:=frm_data_share.t_sys_employee.fieldbyname('部门名称').asstring; end; t_chat_man.post; end; Sendlogtell(from_ip); exit; end; if (from_ip=LocalIP) and (from_emp=employee)then begin Sendlogtell(from_ip); exit; end; end; 2: begin if t_chat_man.locate('在线职员',from_emp,[]) then begin t_chat_man.edit; t_chat_man['所在电脑']:=from_ip; t_chat_man.post; end else begin t_chat_man.insert; t_chat_man['在线职员']:=from_emp; if frm_data_share.t_sys_employee.locate('姓名',from_emp,[]) then begin t_chat_man['所属部门']:=frm_data_share.t_sys_employee.fieldbyname('部门名称').asstring; end; t_chat_man['所在电脑']:=from_ip; t_chat_man.post; end; end; 3: begin if t_chat_man.locate('在线职员',from_emp,[]) then begin t_chat_man.delete; end; end; 4,5: begin if from_emp<>employee then begin frm_chart_message.ChatMsgRichEdit.lines.add(from_emp+'对您说:('+datetimetostr(now)+')'+tell_str); //??? if frm_dxbar_main.bsSkinPageControl1.ActivePage.Hint='消 息 室' then //.bsSkinTabSheet2.Showing then begin t_sys_message_no.insert; t_sys_message_no['类型']:='聊天信息'; t_sys_message_no['发送方']:=from_emp; t_sys_message_no['发送地址']:=from_ip; t_sys_message_no['接收方']:=employee; t_sys_message_no['事件描述']:=tell_str; t_sys_message_no['是否知道']:=1; t_sys_message_no['时间']:=now; t_sys_message_no.post; end else begin t_sys_message_yes.insert; t_sys_message_yes['类型']:='聊天信息'; t_sys_message_yes['发送方']:=from_emp; t_sys_message_yes['发送地址']:=from_ip; t_sys_message_yes['接收方']:=employee; t_sys_message_yes['事件描述']:=tell_str; t_sys_message_yes['是否知道']:=0; t_sys_message_yes['时间']:=now; t_sys_message_yes.post; tell_message(from_emp+'对您说:'+tell_str); end; end; end; 6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 21,22,23,24,25,26,27,28,29,30,31,32,33,34, 35,36,37,38,39,40,41,42,43,44,45,46,47,50,61,62,72: begin t_sys_message_yes.insert; case strtoint(from_type)of 6: begin t_sys_message_yes['类型']:='费用提交审核'; end; 7: begin t_sys_message_yes['类型']:='费用申请修改'; end; 8: begin t_sys_message_yes['类型']:='费用申请删除'; end; 9: begin t_sys_message_yes['类型']:='费用审核通过'; end; 10: begin t_sys_message_yes['类型']:='费用驳回提交'; end; 11: begin t_sys_message_yes['类型']:='费用批准修改'; end; 12: begin t_sys_message_yes['类型']:='费用禁止修改'; end; 13: begin t_sys_message_yes['类型']:='费用批准删除'; end; 14: begin t_sys_message_yes['类型']:='费用禁止删除'; end; 15: begin t_sys_message_yes['类型']:='申请业务发票'; end; 16: begin t_sys_message_yes['类型']:='申请修改发票'; end; 17: begin t_sys_message_yes['类型']:='申请支付费用'; end; 18: begin t_sys_message_yes['类型']:='申请修改支付'; end; 19: begin t_sys_message_yes['类型']:='批准开出发票'; end; 20: begin t_sys_message_yes['类型']:='批准支付费用'; end; 21: begin t_sys_message_yes['类型']:='批准开出发票'; end; 22: begin t_sys_message_yes['类型']:='驳回申请发票'; end; 23: begin t_sys_message_yes['类型']:='批准修改发票'; end; 24: begin t_sys_message_yes['类型']:='禁止修改发票'; end; 25: begin t_sys_message_yes['类型']:='申请发票开出'; end; 26: begin t_sys_message_yes['类型']:='批准支付费用'; end; 27: begin t_sys_message_yes['类型']:='驳回申请支付'; end; 28: begin t_sys_message_yes['类型']:='批准修改支付'; end; 29: begin t_sys_message_yes['类型']:='禁止修改支付'; end; 30: begin t_sys_message_yes['类型']:='收费核销通知'; end; 31: begin t_sys_message_yes['类型']:='收费核销完毕'; end; 32: begin t_sys_message_yes['类型']:='收费核销完毕'; end; 33: begin t_sys_message_yes['类型']:='收费核销审核'; end; 34: begin t_sys_message_yes['类型']:='申请发送快递'; end; 35: begin t_sys_message_yes['类型']:='快递确认发出'; end; 36: begin t_sys_message_yes['类型']:='驳回快递申请'; end; 37: begin t_sys_message_yes['类型']:='申请调度派车'; end; 38: begin t_sys_message_yes['类型']:='调度确认派车'; end; 39: begin t_sys_message_yes['类型']:='海运退税确认'; end; 40: begin t_sys_message_yes['类型']:='海运签单确认'; end; 41: begin t_sys_message_yes['类型']:='业务信息封帐'; end; 42: begin t_sys_message_yes['类型']:='费用信息封帐'; end; 43: begin t_sys_message_yes['类型']:='业务信息解封'; end; 44: begin t_sys_message_yes['类型']:='费用信息解封'; end; 45: begin t_sys_message_yes['类型']:='客户申请转正'; end; 46: begin t_sys_message_yes['类型']:='客户转正通过'; end; 47: begin t_sys_message_yes['类型']:='驳回客户转正'; end; 50: begin t_sys_message_yes['类型']:='海运费用解锁'; end; 61: begin t_sys_message_yes['类型']:='费用超期提醒'; end ; 62: begin t_sys_message_yes['类型']:='销售订舱提醒'; end ; 72: begin t_sys_message_yes['类型']:='销售订舱提醒'; end ; end; t_sys_message_yes['发送方']:=from_emp; t_sys_message_yes['发送地址']:=from_ip; t_sys_message_yes['接收方']:=employee; t_sys_message_yes['事件描述']:=tell_str; t_sys_message_yes['是否知道']:=0; t_sys_message_yes['时间']:=now; t_sys_message_yes.post; tell_message(from_emp+'对您说:'+tell_str); end; 48: begin tell_message(from_emp+'发布公告:'+tell_str); t_info_bulletin.Requery(); end; 49: begin tell_message(from_emp+'给你留言:'+tell_str); t_info_leaveword.Requery(); end; 51: begin if not strtobool(get_parameters_value(4,'false')) then tell_message(from_emp+'更改客户:'+tell_str); with frm_data_share do begin t_crm_client.Requery(); t_crm_client_all.Requery(); t_crm_client_ship.Requery(); t_crm_client_changzhan.Requery(); t_crm_client_truck.Requery(); t_crm_client_hangkong.Requery(); t_crm_client_baoguan.Requery(); t_crm_client_weituo.Requery(); t_crm_client_daili.Requery(); t_crm_client_huodai.Requery(); t_crm_client_shiper.Requery(); t_crm_client_shouhuo.Requery(); t_crm_client_tongzhi.Requery(); t_crm_client_other.Requery(); end; end; 52: begin tell_message(from_emp+'升级软件:'+tell_str); end; 53: begin if not strtobool(get_parameters_value(4,'false')) then tell_message(from_emp+'客户通告:'+tell_str); with frm_data_share do begin t_crm_client.Requery(); t_crm_client_all.Requery(); t_crm_client_ship.Requery(); t_crm_client_changzhan.Requery(); t_crm_client_truck.Requery(); t_crm_client_hangkong.Requery(); t_crm_client_baoguan.Requery(); t_crm_client_weituo.Requery(); t_crm_client_daili.Requery(); t_crm_client_huodai.Requery(); t_crm_client_shiper.Requery(); t_crm_client_shouhuo.Requery(); t_crm_client_tongzhi.Requery(); t_crm_client_other.Requery(); end; end; 54: begin with frm_data_share do begin t_crm_client.Requery(); t_crm_client_all.Requery(); t_crm_client_ship.Requery(); t_crm_client_changzhan.Requery(); t_crm_client_truck.Requery(); t_crm_client_hangkong.Requery(); t_crm_client_baoguan.Requery(); t_crm_client_weituo.Requery(); t_crm_client_daili.Requery(); t_crm_client_huodai.Requery(); t_crm_client_shiper.Requery(); t_crm_client_shouhuo.Requery(); t_crm_client_tongzhi.Requery(); t_crm_client_other.Requery(); end; end; 55: begin frm_data_share.t_sys_parameters_value.requery; end; 56: begin frm_data_share.t_code_fee.requery; end; 57: begin frm_data_share.t_code_currency.requery; end; 58: begin frm_data_share.t_code_ctn.requery; frm_data_share.t_code_ctn_de.requery; frm_data_share.t_code_ctn_kind.requery; end; 59: begin frm_data_share.t_sys_code_emp.Requery(); frm_data_share.t_sys_code_data.Requery(); end; 60: begin tell_message(from_emp+'退舱提醒:'+tell_str); t_sys_message_no.Requery(); end ; 161: begin tell_message(tell_str); end; end; end; procedure Tfrm_main.dxDBGrid4Click(Sender: TObject); begin { if not t_chat_man.IsEmpty then begin RxDBLookupCombo1.DisplayValue:=t_chat_man.fieldbyname('在线职员').asstring; end else begin RxDBLookupCombo1.ClearValue; end; } end; procedure Tfrm_main.ApplicationEvents1Exception(Sender: TObject; E: Exception); begin //错误处理 if pos('PRIM',UpperCase(E.Message))<>0 then begin showmessage('主键重复,不能保存,请刷新数据后重新录入'); // exit; end; if pos('唯一索引',UpperCase(E.Message))<>0 then begin showmessage('主键重复,不能保存,请刷新数据后重新录入'); // exit; end; if pos('NULL',UpperCase(E.Message))<>0 then begin showmessage('数据项不能为空,当前修改不能保存'+#13#10+'请重新录入'); // exit; end; if pos('SOME VALUES MAY HAVE BEEN CHANGED',UpperCase(E.Message))<>0 then begin showmessage('数据已经被其它用户修改,当前修改不能保存'+#13#10+'请刷新数据后重新录入'); // exit; end; if (pos('connection', lowercase(E.Message))<>0) or (pos('dbnmp', lowercase(E.Message))<>0) then begin showmessage('数据库连接错误,请重新启动程序!!'); // application.Terminate; // exit; end; update_wenti(E); end; procedure Tfrm_main.FormShow(Sender: TObject); begin // bsSkinData1.LoadFromFile(ExtractFilePath(ParamStr(0))+'skins\skin.ini'); if not if_log then begin try frm_sys_login:=tfrm_sys_login.Create (application); frm_sys_login.ShowModal; finally frm_sys_login.Free; frm_sys_login:=NIL; end; end; G_ZWCHK:=get_parameters_value(109,'FALSE') ; G_Arrivdate:=get_parameters_value(110,'false') ; orderState:=get_parameters_value(114,'订舱') ; backstate:=get_parameters_value(113,'退舱') ; getview(t_project); // if not if_log then exit; try t_chat_man.close; t_sys_message_no.close; t_sys_message_yes.close; t_do_shenhe_fee.close; t_do_shenhe_other.close; t_chat_man.open; t_sys_message_no.open; t_sys_message_yes.Parameters[0].value:=employee; t_sys_message_yes.open; t_do_shenhe_fee.sql.text:='select 人员,权限代码 from t_sys_code_emp' +' where 权限代码 in (''025'',''026'',''058'',''059'',''077'',''078'',''085'',''086'') and 是否可操作=1' +' and 人员 in (select distinct 人员 from t_sys_code_data where 是否可操作=1 ' +' and 属性 in(''0011'',''0012'',''0013'',''0014'') and 职员='''+employee+''')'; t_do_shenhe_fee.open; t_do_shenhe_other.open; finally LocalIp:=GetLocalIP; SetBroadCastIP; SendlogIn(); end; {$IFDEF Primary} caption := '东胜物流信息管理系统(普及版)'; {$ENDIF} {$IFDEF Stand} caption := '东胜物流信息管理系统(标准版)'; {$ENDIF} {$IFDEF Support} caption := '东胜物流信息管理系统 '+subComp+' '+employee; {$ENDIF} Application.Title:=caption; /////////////////调入 dll 模块 //根据个人设置判断是否启动消息客户端 if frm_data_share.t_sys_employee.Locate('姓名',employee,[]) then begin yctx:=frm_data_share.t_sys_employee.fieldbyname('远程提醒').asstring; isclosewoke:=frm_data_share.t_sys_employee.fieldbyname('提醒是否随东胜关闭').asstring; end else yctx:='不启用' ; if (yctx='启用') then begin end ; end; procedure Tfrm_main.dbBeforeConnect(Sender: TObject); begin db.ConnectionString:=connect_string('main.ini'); end; procedure Tfrm_main.getview(t_project: boolean); begin if t_project then begin //新界面 LoadView ; if not assigned(frm_tree_main) then frm_tree_main:=tfrm_tree_main.Create (self); frm_tree_main.ManualDock(Panel1,nil,alClient); frm_tree_main.show; end else begin //旧界面 bsSkinData1.StoredSkin:=bsStoredSkin1 ; if not assigned(frm_dxbar_main) then frm_dxbar_main:=tfrm_dxbar_main.Create (self); frm_dxbar_main.ManualDock(Panel1,nil,alClient); frm_dxbar_main.show; end ; end; procedure Tfrm_main.LoadView; var inifile1:Tinifile; skinName:string ; begin inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini'); skinName:=inifile1.readString('View','Viewskin','1') ; if skinName='1' then frm_main.bsSkinData1.StoredSkin:=frm_main.bsStoredSkin1 else if skinName='2' then frm_main.bsSkinData1.StoredSkin:=frm_main.bsStoredSkin2 else if skinName='3' then frm_main.bsSkinData1.StoredSkin:=frm_main.bsStoredSkin3 else if skinName='4' then frm_main.bsSkinData1.StoredSkin:=frm_main.bsStoredSkin4 ; inifile1.Free ; end; procedure Tfrm_main.ApplicationEvents1ShortCut(var Msg: TWMKey; var Handled: Boolean); var Shift : TShiftState; begin //快捷键 Shift:=KeyDataToShiftState(Msg.KeyData); if Shift=[ssCtrl,ssShift] then begin //CTRL+SHIFT+F12 case Msg.CharCode of VK_F12 : begin if not assigned(frm_sys_module) then frm_sys_module:=tfrm_sys_module.Create (self); frm_sys_module.ManualDock(frm_main.SearchTabs('frm_sys_module',frm_sys_module.caption),nil,alClient); frm_sys_module.show; end; end; end; if Shift=[ssCtrl] then begin case Msg.CharCode of //CTRL+F1 VK_F1: begin if not assigned(frm_op_fee_view) then frm_op_fee_view:=tfrm_op_fee_view.Create (self); frm_op_fee_view.ManualDock(frm_main.SearchTabs('frm_op_fee_view',frm_op_fee_view.caption),nil,alClient); frm_op_fee_view.show; end; //CTRL+F2 VK_F2: begin if if_reg(3001) and (not vold) then begin if not if_open('312') then begin showmessage('对不起你没有此模块的操作权限!'); exit; end; if not assigned(frm_op_state_view) then frm_op_state_view:=tfrm_op_state_view.Create (self); frm_op_state_view.ManualDock(frm_main.SearchTabs('frm_op_state_view',frm_op_state_view.caption),nil,alClient); frm_op_state_view.show; end; end; VK_F3: begin if not assigned(frm_op_fee_view_all) then frm_op_fee_view_all:=tfrm_op_fee_view_all.Create (self); frm_op_fee_view_all.ManualDock(frm_main.SearchTabs('frm_op_fee_view_all',frm_op_fee_view_all.caption),nil,alClient); frm_op_fee_view_all.show; end; VK_F5: begin if not assigned(FRM_SHIPINGBOX_SI) then FRM_SHIPINGBOX_SI:=tFRM_SHIPINGBOX_SI.Create (self); FRM_SHIPINGBOX_SI.ManualDock(frm_main.SearchTabs('FRM_SHIPINGBOX_SI',FRM_SHIPINGBOX_SI.caption),nil,alClient); FRM_SHIPINGBOX_SI.show; end; end; end; end; { procedure Tfrm_main.loaddsdll; begin DLLHandle := LoadLibrary('dsdll.dll'); try if DLLHandle =0 then begin showmessage('调入dsdll失败,系统将不能对外通讯!'); exit ; end ; @funcload:= GetProcAddress(DLLHandle,'loaddllmsg'); @funcsend := GetProcAddress(DLLHandle,'senddllmsg'); if assigned(@funcload) then begin // funcloadthreahhand:=CreateThread(nil,0,@funcload(pchar(employee)),nil,0,ThreadId); funcload(pchar(employee)); end; except showmessage('调入dsdll失败,系统将不能对外通讯!'); exit ; end; end; } procedure getmsg(msg:widestring); var str, stype, bl, bsno, ttype:string; RDATA:Boolean; begin //接受消息客户端消息处理 str:=trim(msg); if str='' then exit; if pos('DSHUODAI',str)>0 then str:=copy(str,pos('DSHUODAI',str)+8,length(str)-(pos('DSHUODAI',str)+7)); if str='' then exit; stype:=copy(str,1,3);// 消息类型 bl:=copy(str,4,1); // 是否只打开此票 ttype:=copy(str,5,1);// 业务类型 bsno:=copy(str,6,length(str)-5);// 业务编号 if (stype='006') or (stype='007') or (stype='008') then begin if ttype='1' then begin if not if_open('024') then begin exit; end; RDATA:=true; if not assigned(frm_ch_fee_check_seae) then begin frm_ch_fee_check_seae:=tfrm_ch_fee_check_seae.Create(Application); RDATA:=false; end; frm_ch_fee_check_seae.ManualDock(frm_main.SearchTabs('frm_ch_fee_check_seae',frm_ch_fee_check_seae.caption,'30101'),nil,alClient); frm_ch_fee_check_seae.show; if RDATA then frm_ch_fee_check_seae.t_op_seae.Requery(); if bsno<>'' then begin frm_ch_fee_check_seae.t_op_seae.Locate('业务编号',bsno,[]); end; end else if ttype='2' then begin if not if_open('060') then begin exit; end; RDATA:=true; if not assigned(frm_ch_fee_check_seai) then begin frm_ch_fee_check_seai:=tfrm_ch_fee_check_seai.Create (Application); RDATA:=false; end; frm_ch_fee_check_seai.ManualDock(frm_main.SearchTabs('frm_ch_fee_check_seai',frm_ch_fee_check_seai.caption,'30102'),nil,alClient); frm_ch_fee_check_seai.show; if RDATA then frm_ch_fee_check_seai.t_op_seai.requery(); if bsno<>'' then begin frm_ch_fee_check_seai.t_op_seai.Locate('业务编号',bsno,[]); end; end else if ttype='3' then begin if not if_open('076') then begin exit; end; RDATA:=true; if not assigned(frm_ch_fee_check_aire) then begin frm_ch_fee_check_aire:=tfrm_ch_fee_check_aire.Create (Application); RDATA:=false; end; frm_ch_fee_check_aire.ManualDock(frm_main.SearchTabs('frm_ch_fee_check_aire',frm_ch_fee_check_aire.caption,'30103'),nil,alClient); frm_ch_fee_check_aire.show; if RDATA then frm_ch_fee_check_aire.t_op_aire.requery(); if bsno<>'' then begin frm_ch_fee_check_aire.t_op_aire.Locate('业务编号',bsno,[]); end; end else if ttype='4' then begin if not if_open('084') then begin exit; end; RDATA:=true; if not assigned(frm_ch_fee_check_airi) then begin frm_ch_fee_check_airi:=tfrm_ch_fee_check_airi.Create (Application); RDATA:=false; end; frm_ch_fee_check_airi.ManualDock(frm_main.SearchTabs('frm_ch_fee_check_airi',frm_ch_fee_check_airi.caption,'30104'),nil,alClient); frm_ch_fee_check_airi.show; if RDATA then frm_ch_fee_check_airi.t_op_airi.requery(); if bsno<>'' then begin frm_ch_fee_check_airi.t_op_airi.Locate('业务编号',bsno,[]); end; end else if ttype='5' then begin {$IFDEF JGCHE} if not if_open('234') then begin exit; end; RDATA:=true; if not assigned(frm_ch_fee_check_airtruck) then begin frm_ch_fee_check_airtruck:=tfrm_ch_fee_check_airtruck.Create (Application); RDATA:=false; end; frm_ch_fee_check_airtruck.ManualDock(frm_main.SearchTabs('frm_ch_fee_check_airtruck',frm_ch_fee_check_airtruck.caption,'306'),nil,alClient); frm_ch_fee_check_airtruck.show; if RDATA then frm_ch_fee_check_airtruck.t_op_airtruck.requery(); if bsno<>'' then begin frm_ch_fee_check_airtruck.t_op_airtruck.Locate('业务编号',bsno,[]); end; {$ENDIF} end; end else if (stype='015') or (stype='016') or (stype='019') then begin if strtobool(get_parameters_value(1,'false')) then begin {$IFDEF FPSHENQING} if not if_open('029') then begin showmessage('对不起你没有此模块的操作权限!'); exit; end; RDATA:=true; if not assigned(frm_ch_invoice_check) then begin frm_ch_invoice_check:=tfrm_ch_invoice_check.Create (Application); RDATA:=false; end; frm_ch_invoice_check.ManualDock(frm_main.SearchTabs('frm_ch_invoice_check',frm_ch_invoice_check.caption,'412'),nil,alClient); frm_ch_invoice_check.show; if RDATA then frm_ch_invoice_check.t_ch_invoice_shen.requery(); if bsno<>'' then begin frm_ch_invoice_check.t_ch_invoice_shen.Locate('申请编号',bsno,[]); end; {$ENDIF} end else begin if not if_open('030') then begin showmessage('对不起你没有此模块的操作权限!'); exit; end; RDATA:=true; if not assigned(frm_ch_invoice) then begin frm_ch_invoice:=tfrm_ch_invoice.Create (Application); RDATA:=false; end; frm_ch_invoice.ManualDock(frm_main.SearchTabs('frm_ch_invoice',frm_ch_invoice.caption,'413'),nil,alClient); frm_ch_invoice.show; frm_ch_invoice.bsSkinPageControl1.ActivePageIndex:=2; if RDATA then frm_ch_invoice.t_ch_invoice_shen.requery(); if bsno<>'' then begin frm_ch_invoice.t_ch_invoice_shen.Locate('申请编号',bsno,[]); end; end; end else if (stype='017') or (stype='018') then begin {$IFDEF FFLIUCHENG} if not if_open('037') then begin showmessage('对不起你没有此模块的操作权限!'); exit; end; RDATA:=true; if not assigned(frm_ch_check_check) then begin frm_ch_check_check:=tfrm_ch_check_check.Create (Application); RDATA:=false; end; frm_ch_check_check.ManualDock(frm_main.SearchTabs('frm_ch_check_check',frm_ch_check_check.caption,'452'),nil,alClient); frm_ch_check_check.show; if RDATA then frm_ch_check_check.t_ch_check.requery(); if bsno<>'' then begin frm_ch_check_check.t_ch_check.locate('申请编号',bsno,[]); end; {$ENDIF} end else if (stype='100') then begin if not assigned(frm_op_fee_view) then begin frm_op_fee_view:=tfrm_op_fee_view.Create (Application); end; frm_op_fee_view.ManualDock(frm_main.SearchTabs('frm_op_fee_view',frm_op_fee_view.caption),nil,alClient); frm_op_fee_view.show; frm_op_fee_view.Edit16.Text:=bsno; frm_op_fee_view.bsSkinButton44.OnClick(nil); end; Application.Restore; end; procedure Tfrm_main.Timer2Timer(Sender: TObject); begin try qrytmp3.Close; qrytmp3.sql.Add('select 版本号 from t_sys_soft'); qrytmp3.open; except end; end; procedure Tfrm_main.webdbBeforeConnect(Sender: TObject); var connstr:string; begin //如果是网上信息时不同的数据库,连不同的数据库INI connstr:=get_parameters_value(159,'false'); if strtobool(get_parameters_value(154,'false')) then webdb.ConnectionString:=connstr else webdb.ConnectionString:=connect_string('main.ini') end; end.