unit u_data_share; interface uses SysUtils, Classes, DB, ADODB, bsColorCtrls,Dialogs,Windows; type Tfrm_data_share = class(TDataModule) t_sys_company: TADOQuery; t_sys_company1: TDataSource; t_sys_employee1: TDataSource; t_sys_employee: TADOQuery; t_sys_bank1: TDataSource; t_sys_bank: TADOQuery; t_code_currency1: TDataSource; t_code_currency: TADOQuery; p_id: TADOStoredProc; t_code_fee1: TDataSource; t_code_fee: TADOQuery; t_code_goods1: TDataSource; t_code_goods: TADOQuery; t_code_items1: TDataSource; t_code_items: TADOQuery; t_code_ctn1: TDataSource; t_code_ctn: TADOQuery; t_code_country1: TDataSource; t_code_country: TADOQuery; t_code_disport1: TDataSource; t_code_disport: TADOQuery; t_code_trade1: TDataSource; t_code_trade: TADOQuery; t_code_vessel1: TDataSource; t_code_vessel: TADOQuery; t_code_package1: TDataSource; t_code_package: TADOQuery; t_sys_code_emp: TADOQuery; t_sys_code_data: TADOQuery; t_code_ctn_de: TADOQuery; t_code_ctn_de1: TDataSource; t_crm_client1: TDataSource; t_crm_client: TADOQuery; t_code_free1: TDataSource; t_code_free: TADOQuery; t_sys_department1: TDataSource; t_sys_department: TADOQuery; p_no_replace: TADOStoredProc; p_no_get: TADOStoredProc; t_code_code1: TDataSource; t_code_code: TADOQuery; t_code_ctn_kind1: TDataSource; t_code_ctn_kind: TADOQuery; t_code_loaport1: TDataSource; t_code_loaport: TADOQuery; t_sys_parameters_value: TADOQuery; t_code_state: TADOQuery; t_code_state1: TDataSource; t_sys_report_head1: TDataSource; t_sys_report_head: TADOQuery; t_load_employee1: TDataSource; t_load_employee: TADOQuery; t_code_signbill1: TDataSource; t_code_signbill: TADOQuery; t_code_price1: TDataSource; t_code_price: TADOQuery; t_code_client_parameter1: TDataSource; t_code_client_parameter: TADOQuery; t_code_contract1: TDataSource; t_code_contract: TADOQuery; t_code_price_ctn1: TDataSource; t_code_price_ctn: TADOQuery; t_code_voyage1: TDataSource; t_code_voyage: TADOQuery; t_code_truck_client: TADOQuery; t_code_truck_client1: TDataSource; t_code_truck_changzhan: TADOQuery; t_code_truck_changzhan1: TDataSource; t_code_send_head: TADOQuery; t_code_send_head1: TDataSource; t_code_card1: TDataSource; t_code_card: TADOQuery; t_code_card_project1: TDataSource; t_code_card_project: TADOQuery; t_code_card_project_de1: TDataSource; t_code_card_project_de: TADOQuery; t_crm_client_all1: TDataSource; t_crm_client_all: TADOQuery; t_crm_client_ship1: TDataSource; t_crm_client_ship: TADOQuery; t_crm_client_changzhan1: TDataSource; t_crm_client_changzhan: TADOQuery; t_crm_client_truck1: TDataSource; t_crm_client_truck: TADOQuery; t_crm_client_baoguan1: TDataSource; t_crm_client_baoguan: TADOQuery; t_crm_client_weituo1: TDataSource; t_crm_client_weituo: TADOQuery; t_crm_client_daili1: TDataSource; t_crm_client_daili: TADOQuery; t_crm_client_huodai1: TDataSource; t_crm_client_huodai: TADOQuery; t_crm_client_shiper1: TDataSource; t_crm_client_shiper: TADOQuery; t_crm_client_shouhuo1: TDataSource; t_crm_client_shouhuo: TADOQuery; t_crm_client_tongzhi1: TDataSource; t_crm_client_tongzhi: TADOQuery; t_crm_client_hangkong1: TDataSource; t_crm_client_hangkong: TADOQuery; t_crm_client_other1: TDataSource; t_crm_client_other: TADOQuery; t_code_state_project1: TDataSource; t_code_state_project: TADOQuery; t_code_state_project_de1: TDataSource; t_code_state_project_de: TADOQuery; t_code_fee_color1: TDataSource; t_code_fee_color: TADOQuery; t_code_source1: TDataSource; t_code_source: TADOQuery; t_op_letter_free1: TDataSource; t_op_letter_free: TADOQuery; t_op_letter_free_detail1: TDataSource; t_op_letter_free_detail: TADOQuery; p_update: TADOStoredProc; t_code_fee_type1: TDataSource; t_code_fee_type: TADOQuery; t_code_port_air1: TDataSource; t_code_port_air: TADOQuery; t_crm_client_kuaidi1: TDataSource; t_crm_client_kuaidi: TADOQuery; t_code_send_address1: TDataSource; t_code_send_address: TADOQuery; t_code_empty1: TDataSource; t_code_empty: TADOQuery; v_employee_shenhe: TADOQuery; v_employee_other: TADOQuery; t_code_edi_port: TADOQuery; t_code_edi_port1: TDataSource; t_code_tiaokuan1: TDataSource; t_code_tiaokuan: TADOQuery; t_code_shiyan1: TDataSource; t_code_shiyan: TADOQuery; t_code_package_edi: TADOQuery; t_code_package_edi1: TDataSource; t_code_shiper_edi: TADOQuery; t_code_shiper_edi1: TDataSource; t_code_line_ctn: TADOQuery; ds_code_line_ctn1: TDataSource; t_code_ctn_detail: TADOQuery; ds_code_ctn_detail1: TDataSource; t_code_ctn_detailID: TAutoIncField; t_code_ctn_detailDSDesigner: TStringField; t_code_ctn_detailDSDesigner2: TStringField; t_code_ctn_detailDSDesigner3: TStringField; t_code_ctn_detailDSDesigner4: TBCDField; t_crm_client_cd: TADOQuery; t_crm_client_cd1: TDataSource; WebServiceURLQry: TADOQuery; t_crm_client_sales: TADOQuery; t_code_filetype1: TDataSource; t_code_filetype: TADOQuery; t_sys_skjlset: TADOQuery; t_sys_skjlset1: TDataSource; t_crm_client_full1: TDataSource; t_crm_client_full: TADOQuery; t_code_billstatus: TADOQuery; t_code_billstatus1: TDataSource; procedure t_sys_bankBeforePost(DataSet: TDataSet); procedure t_code_currencyBeforePost(DataSet: TDataSet); procedure t_code_feeBeforePost(DataSet: TDataSet); procedure t_code_goodsBeforePost(DataSet: TDataSet); procedure t_code_itemsBeforePost(DataSet: TDataSet); procedure t_code_ctnBeforePost(DataSet: TDataSet); procedure t_code_countryBeforePost(DataSet: TDataSet); procedure t_code_tradeBeforePost(DataSet: TDataSet); procedure t_code_vesselBeforePost(DataSet: TDataSet); procedure t_code_packageBeforePost(DataSet: TDataSet); procedure t_code_freeBeforePost(DataSet: TDataSet); procedure t_code_codeBeforePost(DataSet: TDataSet); procedure t_code_codeAfterInsert(DataSet: TDataSet); procedure t_code_ctn_deBeforeInsert(DataSet: TDataSet); procedure t_code_ctn_dePostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); procedure t_code_ctnPostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); procedure t_code_ctn_kindBeforePost(DataSet: TDataSet); procedure t_code_ctn_kindPostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); procedure t_code_disportPostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); procedure t_code_loaportBeforePost(DataSet: TDataSet); procedure t_code_loaportPostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); procedure t_code_stateBeforePost(DataSet: TDataSet); procedure t_code_signbillBeforePost(DataSet: TDataSet); procedure t_code_stateAfterInsert(DataSet: TDataSet); procedure t_code_priceBeforePost(DataSet: TDataSet); procedure t_code_priceAfterInsert(DataSet: TDataSet); procedure t_code_client_parameterBeforePost(DataSet: TDataSet); procedure t_code_contractBeforePost(DataSet: TDataSet); procedure t_code_voyageAfterInsert(DataSet: TDataSet); procedure t_code_voyageBeforePost(DataSet: TDataSet); procedure t_code_voyageBeforeInsert(DataSet: TDataSet); procedure t_code_truck_clientBeforePost(DataSet: TDataSet); procedure t_code_truck_changzhanBeforePost(DataSet: TDataSet); procedure t_code_send_headBeforePost(DataSet: TDataSet); procedure t_code_cardBeforePost(DataSet: TDataSet); procedure t_code_card_projectBeforePost(DataSet: TDataSet); procedure t_code_card_projectAfterInsert(DataSet: TDataSet); procedure t_code_card_project_deBeforePost(DataSet: TDataSet); procedure t_code_card_project_deBeforeDelete(DataSet: TDataSet); procedure t_code_state_projectAfterInsert(DataSet: TDataSet); procedure t_code_state_projectBeforeDelete(DataSet: TDataSet); procedure t_code_state_projectBeforePost(DataSet: TDataSet); procedure t_code_state_project_deBeforePost(DataSet: TDataSet); procedure t_code_sourceBeforePost(DataSet: TDataSet); procedure t_op_letter_freeBeforePost(DataSet: TDataSet); procedure t_op_letter_free_detailBeforePost(DataSet: TDataSet); procedure t_op_letter_freeAfterInsert(DataSet: TDataSet); procedure t_op_letter_freeAfterPost(DataSet: TDataSet); procedure t_op_letter_freeAfterCancel(DataSet: TDataSet); procedure t_op_letter_freeAfterDelete(DataSet: TDataSet); procedure t_op_letter_free_detailBeforeInsert(DataSet: TDataSet); procedure t_op_letter_free_detailBeforeDelete(DataSet: TDataSet); procedure t_op_letter_freeBeforeDelete(DataSet: TDataSet); procedure t_code_fee_typeBeforePost(DataSet: TDataSet); procedure t_code_port_airBeforePost(DataSet: TDataSet); procedure t_op_letter_free_detailAfterInsert(DataSet: TDataSet); procedure t_code_send_addressBeforePost(DataSet: TDataSet); procedure t_code_send_addressBeforeInsert(DataSet: TDataSet); procedure t_code_truck_changzhanBeforeInsert(DataSet: TDataSet); procedure t_code_truck_clientBeforeInsert(DataSet: TDataSet); procedure t_code_stateBeforeInsert(DataSet: TDataSet); procedure t_code_send_headBeforeEdit(DataSet: TDataSet); procedure t_code_countryBeforeEdit(DataSet: TDataSet); procedure t_code_tradeBeforeEdit(DataSet: TDataSet); procedure t_code_edi_portBeforePost(DataSet: TDataSet); procedure t_code_tiaokuanBeforePost(DataSet: TDataSet); procedure t_code_shiyanBeforePost(DataSet: TDataSet); private { Private declarations } public { Public declarations } function AnsiStringToWideString(const strAnsi: AnsiString;codepage: Word): WideString; function countString(_s1,s2:string):integer; function GettimePotion(n:integer;c:string;s:string):integer; function GetXMLValue(c:string;s:string):string; function REHH(str: string): string; end; var frm_data_share: Tfrm_data_share; if_all_letter:boolean; implementation uses u_main, my_sys_function; {$R *.dfm} procedure Tfrm_data_share.t_sys_bankBeforePost(DataSet: TDataSet); begin table_before_post(t_sys_bank,'代码'); table_before_post(t_sys_bank,'币别'); table_before_post(t_sys_bank,'银行名称'); table_before_post(t_sys_bank,'银行账号'); end; procedure Tfrm_data_share.t_code_currencyBeforePost(DataSet: TDataSet); begin table_before_post(t_code_currency,'币别'); table_before_post(t_code_currency,'中文名'); table_before_post(t_code_currency,'汇率'); end; procedure Tfrm_data_share.t_code_feeBeforePost(DataSet: TDataSet); begin table_before_post(t_code_fee,'代码'); table_before_post(t_code_fee,'中文名'); table_before_post(t_code_fee,'费用类别'); end; procedure Tfrm_data_share.t_code_goodsBeforePost(DataSet: TDataSet); begin table_before_post(t_code_goods,'代码'); table_before_post(t_code_goods,'货物名称'); end; procedure Tfrm_data_share.t_code_itemsBeforePost(DataSet: TDataSet); begin table_before_post(t_code_items,'代码'); table_before_post(t_code_items,'运输条款'); end; procedure Tfrm_data_share.t_code_ctnBeforePost(DataSet: TDataSet); begin table_before_post(t_code_ctn,'代码'); table_before_post(t_code_ctn,'箱型'); table_before_post(t_code_ctn,'尺寸'); table_before_post(t_code_ctn,'表现形式'); if (t_code_ctn.FieldByName('尺寸').asstring<>'20')and (t_code_ctn.FieldByName('尺寸').asstring<>'40')and (t_code_ctn.FieldByName('尺寸').asstring<>'45')then begin showmessage('箱尺寸只能输入20、40、45,请重新输入!!'); abort; end; end; procedure Tfrm_data_share.t_code_countryBeforePost(DataSet: TDataSet); begin table_before_post(t_code_country,'代码'); table_before_post(t_code_country,'国家名称'); table_before_post(t_code_country,'洲'); end; procedure Tfrm_data_share.t_code_tradeBeforePost(DataSet: TDataSet); begin table_before_post(t_code_trade,'航线代码'); table_before_post(t_code_trade,'航线'); end; procedure Tfrm_data_share.t_code_vesselBeforePost(DataSet: TDataSet); begin table_before_post(t_code_vessel,'英文船名'); table_before_post(t_code_vessel,'中文船名'); end; procedure Tfrm_data_share.t_code_packageBeforePost(DataSet: TDataSet); begin table_before_post(t_code_package,'代码'); table_before_post(t_code_package,'包装名称'); end; procedure Tfrm_data_share.t_code_freeBeforePost(DataSet: TDataSet); begin table_before_post(t_code_free,'付费方式'); end; procedure Tfrm_data_share.t_code_codeBeforePost(DataSet: TDataSet); begin table_before_post(t_code_code,'代码'); table_before_post(t_code_code,'简称'); table_before_post(t_code_code,'内容'); if (t_code_code.fieldbyname('发货人').asboolean=false)and (t_code_code.fieldbyname('收货人').asboolean=false)and (t_code_code.fieldbyname('通知人').asboolean=false)and (t_code_code.fieldbyname('代理').asboolean=false)then begin showmessage('发货人、收货人、通知人必须选择其一!'); abort; end; end; procedure Tfrm_data_share.t_code_codeAfterInsert(DataSet: TDataSet); begin if t_code_code.Filtered=true then begin if copy(t_code_code.Filter,1,2)='发'then t_code_code['发货人']:=1; if copy(t_code_code.Filter,1,2)='收'then t_code_code['收货人']:=1; if copy(t_code_code.Filter,1,2)='通'then t_code_code['通知人']:=1; end; end; procedure Tfrm_data_share.t_code_ctn_deBeforeInsert(DataSet: TDataSet); begin abort; end; procedure Tfrm_data_share.t_code_ctn_dePostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); begin table_post_error_primary('箱型代码',E); end; procedure Tfrm_data_share.t_code_ctnPostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); begin table_post_error_primary('箱型代码',E); table_post_error_index('表现形式',E); end; procedure Tfrm_data_share.t_code_ctn_kindBeforePost(DataSet: TDataSet); begin table_before_post(t_code_ctn_kind,'代码'); table_before_post(t_code_ctn_kind,'箱型'); end; procedure Tfrm_data_share.t_code_ctn_kindPostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); begin table_post_error_primary('箱型代码',E); end; procedure Tfrm_data_share.t_code_disportPostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); begin table_post_error_primary('港口代码',E); table_post_error_index('港口英文名',E); end; procedure Tfrm_data_share.t_code_loaportBeforePost(DataSet: TDataSet); begin table_before_post(t_code_loaport,'港口代码'); table_before_post(t_code_loaport,'英文名'); table_before_post(t_code_loaport,'中文名'); end; procedure Tfrm_data_share.t_code_loaportPostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); begin table_post_error_primary('港口代码',E); table_post_error_index('港口英文名',E); end; procedure Tfrm_data_share.t_code_stateBeforePost(DataSet: TDataSet); begin if t_code_state.fieldbyname('业务状态').AsString='业务封帐' then begin showmessage('当前业务状态为系统使用状态,不能使用!!'); abort; end; table_before_post(t_code_state,'业务状态'); table_before_post(t_code_state,'颜色'); table_before_post(t_code_state,'业务状态'); table_before_post(t_code_state,'业务状态'); table_before_post(t_code_state,'业务状态'); end; procedure Tfrm_data_share.t_code_signbillBeforePost(DataSet: TDataSet); begin table_before_post(t_code_signbill,'代码'); table_before_post(t_code_signbill,'签单方式'); end; procedure Tfrm_data_share.t_code_stateAfterInsert(DataSet: TDataSet); begin t_code_state['业务种类']:=copy(t_code_state.Filter,11,8); t_code_state['业务是否可以修改']:=1; end; procedure Tfrm_data_share.t_code_priceBeforePost(DataSet: TDataSet); begin table_before_post(t_code_price,'客户价值'); table_before_post(t_code_price,'颜色'); table_before_post(t_code_price,'利润最低'); table_before_post(t_code_price,'利润最高'); end; procedure Tfrm_data_share.t_code_priceAfterInsert(DataSet: TDataSet); begin t_code_price['利润最高']:=0; t_code_price['利润最低']:=0; end; procedure Tfrm_data_share.t_code_client_parameterBeforePost( DataSet: TDataSet); begin if t_code_client_parameter.fieldbyname('利润值').asfloat<=0 then begin showmessage('不能小于等于零!!'); abort; end; if t_code_client_parameter.fieldbyname('工作量').asfloat<=0 then begin showmessage('不能小于等于零!!'); abort; end; if t_code_client_parameter.fieldbyname('标准利润').asfloat<=0 then begin showmessage('不能小于等于零!!'); abort; end; if t_code_client_parameter.fieldbyname('月利润').asfloat<=0 then begin showmessage('不能小于等于零!!'); abort; end; t_code_client_parameter['标准利润']:=t_code_client_parameter['利润值']/t_code_client_parameter['工作量']; end; procedure Tfrm_data_share.t_code_contractBeforePost(DataSet: TDataSet); begin table_before_post(t_code_contract,'合约类型'); end; procedure Tfrm_data_share.t_code_voyageAfterInsert(DataSet: TDataSet); begin t_code_voyage['VS_ID']:=t_code_vessel['VS_ID']; end; procedure Tfrm_data_share.t_code_voyageBeforePost(DataSet: TDataSet); begin table_before_post(t_code_voyage,'航次'); end; procedure Tfrm_data_share.t_code_voyageBeforeInsert(DataSet: TDataSet); begin if t_code_vessel.state=dsinsert then t_code_vessel.Post; end; procedure Tfrm_data_share.t_code_truck_clientBeforePost(DataSet: TDataSet); begin table_before_post(t_code_truck_client,'厂家名称'); end; procedure Tfrm_data_share.t_code_truck_changzhanBeforePost( DataSet: TDataSet); begin table_before_post(t_code_truck_changzhan,'场站名称'); end; procedure Tfrm_data_share.t_code_send_headBeforePost(DataSet: TDataSet); begin table_before_post(t_code_send_head,'HEAD_TO'); end; procedure Tfrm_data_share.t_code_cardBeforePost(DataSet: TDataSet); begin table_before_post(t_code_card,'单证名称'); end; procedure Tfrm_data_share.t_code_card_projectBeforePost(DataSet: TDataSet); begin table_before_post(t_code_card_project,'单证方案'); end; procedure Tfrm_data_share.t_code_card_projectAfterInsert( DataSet: TDataSet); begin t_code_card_project['录入人']:=employee; t_code_card_project['录入日期']:=now; end; procedure Tfrm_data_share.t_code_card_project_deBeforePost( DataSet: TDataSet); begin table_before_post(t_code_card_project_de,'单证名称'); end; procedure Tfrm_data_share.t_code_card_project_deBeforeDelete( DataSet: TDataSet); begin if t_code_card_project.fieldbyname('录入人').asstring<>employee then begin showmessage('当前单证方案是'+employee+'制作的,你无权修改!!'); abort; end; end; procedure Tfrm_data_share.t_code_state_projectAfterInsert( DataSet: TDataSet); begin t_code_state_project['录入人']:=employee; t_code_state_project['录入日期']:=now; t_code_state_project['业务种类']:=copy(t_code_state_project.Filter,11,8); end; procedure Tfrm_data_share.t_code_state_projectBeforeDelete( DataSet: TDataSet); begin if t_code_state_project.fieldbyname('录入人').asstring<>employee then begin showmessage('当前状态方案是'+t_code_state_project.fieldbyname('录入人').asstring+'制作的,你无权修改!!'); abort; end; end; procedure Tfrm_data_share.t_code_state_projectBeforePost( DataSet: TDataSet); begin table_before_post(t_code_state_project,'状态方案'); end; procedure Tfrm_data_share.t_code_state_project_deBeforePost( DataSet: TDataSet); begin table_before_post(t_code_state_project_de,'状态名称'); end; procedure Tfrm_data_share.t_code_sourceBeforePost(DataSet: TDataSet); begin table_before_post(t_code_source,'代码'); table_before_post(t_code_source,'业务来源'); end; procedure Tfrm_data_share.t_op_letter_freeBeforePost(DataSet: TDataSet); begin if t_op_letter_free.State=dsinsert then begin t_op_letter_free['LF']:=trim(get_id); end; table_before_post(t_op_letter_free,'业务类别'); table_before_post(t_op_letter_free,'函电名称'); end; procedure Tfrm_data_share.t_op_letter_free_detailBeforePost( DataSet: TDataSet); var str:widestring; begin table_before_post(t_op_letter_free_detail,'字段名称'); table_before_post(t_op_letter_free_detail,'数据类型'); IF t_op_letter_free_detail.State=dsinsert then begin str:='alter TABLE t_op_letter_free'+t_op_letter_free.fieldbyname('LF').asstring +' add '+t_op_letter_free_detail.fieldbyname('字段名称').asstring +' varchar(400) null'; p_update.Parameters.ParamByName('SQLStr').VALUE:=STR; p_update.ExecProc; end else begin if t_op_letter_free_detail.fieldbyname('字段名称').OldValue<>t_op_letter_free_detail.fieldbyname('字段名称').asstring then begin str:='alter TABLE t_op_letter_free'+t_op_letter_free.fieldbyname('LF').asstring +' drop column '+t_op_letter_free_detail.fieldbyname('字段名称').OldValue; p_update.Parameters.ParamByName('SQLStr').VALUE:=STR; p_update.ExecProc; str:='alter TABLE t_op_letter_free'+t_op_letter_free.fieldbyname('LF').asstring +' add '+t_op_letter_free_detail.fieldbyname('字段名称').asstring +' varchar(400) null'; p_update.Parameters.ParamByName('SQLStr').VALUE:=STR; p_update.ExecProc; end; end; end; procedure Tfrm_data_share.t_op_letter_freeAfterInsert(DataSet: TDataSet); begin t_op_letter_free['业务类别']:=copy(t_op_letter_free.Filter,11,8); if_all_letter:=true; end; procedure Tfrm_data_share.t_op_letter_freeAfterPost(DataSet: TDataSet); var str:widestring; begin if if_all_letter then begin str:='CREATE TABLE [t_op_letter_free'+t_op_letter_free.fieldbyname('LF').asstring +'] ( [ID] [int] IDENTITY (1, 1) NOT NULL ,' +'[LE_ID] INT NULL ' +'CONSTRAINT [PK_t_op_letter_free'+t_op_letter_free.fieldbyname('LF').asstring +'] PRIMARY KEY CLUSTERED ([ID]) ON [PRIMARY]' +' ) ON [PRIMARY] '; p_update.Parameters.ParamByName('SQLStr').VALUE:=STR; p_update.ExecProc; end; if_all_letter:=false; end; procedure Tfrm_data_share.t_op_letter_freeAfterCancel(DataSet: TDataSet); begin if_all_letter:=false; end; procedure Tfrm_data_share.t_op_letter_freeAfterDelete(DataSet: TDataSet); begin if_all_letter:=false; end; procedure Tfrm_data_share.t_op_letter_free_detailBeforeInsert( DataSet: TDataSet); begin table_post(t_op_letter_free); end; procedure Tfrm_data_share.t_op_letter_free_detailBeforeDelete( DataSet: TDataSet); var str:widestring; begin str:='alter TABLE t_op_letter_free'+t_op_letter_free.fieldbyname('LF').asstring +' drop column '+t_op_letter_free_detail.fieldbyname('字段名称').asstring; p_update.Parameters.ParamByName('SQLStr').VALUE:=STR; p_update.ExecProc; end; procedure Tfrm_data_share.t_op_letter_freeBeforeDelete(DataSet: TDataSet); var str:widestring; begin if not if_all_letter then begin p_update.CLOSE; str:='select * from t_op_letter where LF='+''''+t_op_letter_free.fieldbyname('LF').asstring+''''; p_update.Parameters.ParamByName('SQLStr').VALUE:=STR; p_update.OPEN; IF NOT p_update.IsEmpty THEN BEGIN SHOWMESSAGE('当前函电格式已经使用,不能删除!!'); ABORT; END; str:='drop TABLE t_op_letter_free'+t_op_letter_free.fieldbyname('LF').asstring; p_update.Parameters.ParamByName('SQLStr').VALUE:=STR; p_update.ExecProc; end; end; procedure Tfrm_data_share.t_code_fee_typeBeforePost(DataSet: TDataSet); begin table_before_post(t_code_fee_type,'代码'); table_before_post(t_code_fee_type,'费用类别'); end; procedure Tfrm_data_share.t_code_port_airBeforePost(DataSet: TDataSet); begin table_before_post(t_code_port_air,'代码'); table_before_post(t_code_port_air,'英文名'); table_before_post(t_code_port_air,'中文名'); end; procedure Tfrm_data_share.t_op_letter_free_detailAfterInsert( DataSet: TDataSet); begin t_op_letter_free_detail['数据类型']:='短'; end; procedure Tfrm_data_share.t_code_send_addressBeforePost(DataSet: TDataSet); begin table_before_post(t_code_send_address,'收件人姓名'); table_before_post(t_code_send_address,'收件人公司'); table_before_post(t_code_send_address,'收件人地址'); table_before_post(t_code_send_address,'目的地'); table_before_post(t_code_send_address,'收件人电话'); table_before_post(t_code_send_address,'收件人邮编'); end; procedure Tfrm_data_share.t_code_send_addressBeforeInsert( DataSet: TDataSet); begin if not if_open('164') then begin showmessage('对不起你没有此模块的操作权限!'); abort; end; end; procedure Tfrm_data_share.t_code_truck_changzhanBeforeInsert( DataSet: TDataSet); begin if not if_open('143') then begin showmessage('对不起你没有此模块的操作权限!'); abort; end; end; procedure Tfrm_data_share.t_code_truck_clientBeforeInsert( DataSet: TDataSet); begin if not if_open('142') then begin showmessage('对不起你没有此模块的操作权限!'); abort; end; end; procedure Tfrm_data_share.t_code_stateBeforeInsert(DataSet: TDataSet); begin if not if_open('052') then begin showmessage('对不起你没有此模块的操作权限!'); abort; end; end; procedure Tfrm_data_share.t_code_send_headBeforeEdit(DataSet: TDataSet); begin if not if_open('144') then begin showmessage('对不起你没有此模块的操作权限!'); abort; end; end; procedure Tfrm_data_share.t_code_countryBeforeEdit(DataSet: TDataSet); begin if not if_open('010') then begin showmessage('对不起你没有此模块的操作权限!'); abort; end; end; procedure Tfrm_data_share.t_code_tradeBeforeEdit(DataSet: TDataSet); begin if not if_open('012') then begin showmessage('对不起你没有此模块的操作权限!'); abort; end; end; procedure Tfrm_data_share.t_code_edi_portBeforePost(DataSet: TDataSet); begin table_before_post(t_code_edi_port,'EDI代码'); table_before_post(t_code_edi_port,'港口名称'); end; procedure Tfrm_data_share.t_code_tiaokuanBeforePost(DataSet: TDataSet); begin table_before_post(t_code_tiaokuan,'代码'); table_before_post(t_code_tiaokuan,'名称'); table_before_post(t_code_tiaokuan,'附加条款'); end; procedure Tfrm_data_share.t_code_shiyanBeforePost(DataSet: TDataSet); begin table_before_post(t_code_shiyan,'实验内容'); end; function Tfrm_data_share.AnsiStringToWideString(const strAnsi: AnsiString;codepage:word): WideString; var Len: integer; begin Result := ''; if strAnsi = '' then Exit; Len := MultiByteToWideChar(CodePage, MB_PRECOMPOSED, PChar(@strAnsi[1]), -1, nil, 0); SetLength(Result, Len - 1); if Len > 1 then MultiByteToWideChar(CodePage, MB_PRECOMPOSED, PChar(@strAnsi[1]), -1, PWideChar(@Result[1]), Len - 1); end; function Tfrm_data_share.countString(_s1,s2:string):integer; var s1:string; begin result:=0; s1:='<'+_s1+'>'; while pos(s1,s2)>0 do begin s2:=copy(s2,pos(s1,s2)+1,length(s2)); //假设s2最大长度为9999个字符 result:=result+1 ; end; s1:='<'+_s1+' />'; while pos(s1,s2)>0 do begin s2:=copy(s2,pos(s1,s2)+1,length(s2)); //假设s2最大长度为9999个字符 result:=result+1 ; end; end; function Tfrm_data_share.GettimePotion(n:integer;c:string;s:string):integer; var p,i:integer; begin result:=0; p:=0; for i:=1 to length(s) do begin if copy(s,i,length(c))=c then p:=p+1; if p=n then begin result:=i; break; end; end; end; function Tfrm_data_share.GetXMLValue(c:string;s:string):string; var p1,p2:integer; _c1,_c2,_c3,_r:string; begin _c1:='<'+c+ ' />'; _c2:='<'+c+ '>'; _c3:=''; if (Pos(_c1,s)>0) then begin result:=''; //值为空 end else if (Pos(_c2,s)>0) then begin p1:=pos(_c2,s)+length(_c2); p2:=pos(_c3,s)-p1; result:=copy(s,p1,p2); //WriteLog(inttostr(P1)+'_'+inttostr(P2)+'__'+s); end else result:=''; end; function Tfrm_data_share.REHH(str: string): string; var _r:string; begin _r:=StringReplace (str, '\\\\', #13#10, [rfReplaceAll]); result:=_r; end; end.