unit u_code_port_modify; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Grids, Wwdbigrd, Wwdbgrid, bsSkinCtrls, ExtCtrls, dxExEdtr, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxDBGrid, dxCntner, DB, ADODB, StdCtrls, Mask, DBCtrls, RxLookup, wwdbedit, Wwdotdot, Wwdbcomb, BusinessSkinForm; type Tfrm_code_port_modify = class(TForm) bsSkinPanel1: TbsSkinPanel; Panel1: TPanel; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton5: TbsSkinButton; Label2: TLabel; DBEdit2: TDBEdit; Label3: TLabel; DBEdit3: TDBEdit; Label4: TLabel; Label5: TLabel; RxDBLookupCombo3: TRxDBLookupCombo; RxDBLookupCombo1: TRxDBLookupCombo; Label6: TLabel; DBEdit4: TDBEdit; Label7: TLabel; DBEdit5: TDBEdit; Label8: TLabel; wwDBComboBox1: TwwDBComboBox; Label9: TLabel; wwDBComboBox2: TwwDBComboBox; Label10: TLabel; DBEdit6: TDBEdit; Label11: TLabel; DBEdit7: TDBEdit; bsBusinessSkinForm1: TbsBusinessSkinForm; Label1: TLabel; DBEdit1: TDBEdit; Label12: TLabel; DBEdit8: TDBEdit; wwDBComboBox3: TwwDBComboBox; Label13: TLabel; Label14: TLabel; wwDBComboBox4: TwwDBComboBox; Label15: TLabel; DBEdit9: TDBEdit; bsSkinGroupBox1: TbsSkinGroupBox; bsSkinPanel2: TbsSkinPanel; bsSkinPanel3: TbsSkinPanel; bsSkinPanel4: TbsSkinPanel; bsSkinCheckRadioBox1: TbsSkinCheckRadioBox; bsSkinCheckRadioBox2: TbsSkinCheckRadioBox; bsSkinCheckRadioBox3: TbsSkinCheckRadioBox; bsSkinCheckRadioBox4: TbsSkinCheckRadioBox; bsSkinCheckRadioBox5: TbsSkinCheckRadioBox; bsSkinCheckRadioBox6: TbsSkinCheckRadioBox; bsSkinCheckRadioBox7: TbsSkinCheckRadioBox; bsSkinCheckRadioBox8: TbsSkinCheckRadioBox; bsSkinCheckRadioBox9: TbsSkinCheckRadioBox; bsSkinGroupBox2: TbsSkinGroupBox; DBMemo1: TDBMemo; bsSkinButton7: TbsSkinButton; bsSkinButton6: TbsSkinButton; DBEdit10: TDBEdit; bsSkinButton8: TbsSkinButton; bsSkinButton9: TbsSkinButton; Label16: TLabel; DBEdit11: TDBEdit; bsSkinButton10: TbsSkinButton; DBEdit12: TDBEdit; Label17: TLabel; procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton7Click(Sender: TObject); procedure bsSkinButton6Click(Sender: TObject); procedure DBEdit10Change(Sender: TObject); procedure RxDBLookupCombo1Change(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure bsSkinButton8Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_code_port_modify: Tfrm_code_port_modify; implementation uses u_main, u_code_port, u_data_share, my_sys_function; {$R *.dfm} procedure Tfrm_code_port_modify.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin CanClose:=frm_close_query(frm_code_port.t_code_disport); end; procedure Tfrm_code_port_modify.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_code_port_modify.bsSkinButton3Click(Sender: TObject); var str:widestring; begin table_cancel(frm_code_port.t_code_disport); begin str:=frm_code_port.t_code_disport.fieldbyname('港口功能').asstring; bsSkinCheckRadioBox1.Checked:=false; bsSkinCheckRadioBox2.Checked:=false; bsSkinCheckRadioBox3.Checked:=false; bsSkinCheckRadioBox4.Checked:=false; bsSkinCheckRadioBox5.Checked:=false; bsSkinCheckRadioBox6.Checked:=false; bsSkinCheckRadioBox7.Checked:=false; bsSkinCheckRadioBox8.Checked:=false; bsSkinCheckRadioBox9.Checked:=false; if pos('P',str)<>0 then bsSkinCheckRadioBox1.Checked:=true; if pos('Q',str)<>0 then bsSkinCheckRadioBox2.Checked:=true; if pos('Y',str)<>0 then bsSkinCheckRadioBox3.Checked:=true; if pos('G',str)<>0 then bsSkinCheckRadioBox4.Checked:=true; if pos('C',str)<>0 then bsSkinCheckRadioBox5.Checked:=true; if pos('R',str)<>0 then bsSkinCheckRadioBox6.Checked:=true; if pos('B',str)<>0 then bsSkinCheckRadioBox7.Checked:=true; if pos('T',str)<>0 then bsSkinCheckRadioBox8.Checked:=true; if pos('D',str)<>0 then bsSkinCheckRadioBox9.Checked:=true; end; end; procedure Tfrm_code_port_modify.bsSkinButton2Click(Sender: TObject); var str:string; begin if frm_code_port.t_code_disport.IsEmpty then exit; if bsSkinCheckRadioBox1.Checked then str:='P'; if bsSkinCheckRadioBox2.Checked then begin if str=''then str:='Q' else str:=str+','+'Q'; end; if bsSkinCheckRadioBox3.Checked then begin if str=''then str:='Y' else str:=str+','+'Y'; end; if bsSkinCheckRadioBox4.Checked then begin if str=''then str:='G' else str:=str+','+'G'; end; if bsSkinCheckRadioBox5.Checked then begin if str=''then str:='C' else str:=str+','+'C'; end; if bsSkinCheckRadioBox6.Checked then begin if str=''then str:='R' else str:=str+','+'R'; end; if bsSkinCheckRadioBox7.Checked then begin if str=''then str:='B' else str:=str+','+'B'; end; if bsSkinCheckRadioBox8.Checked then begin if str=''then str:='T' else str:=str+','+'T'; end; if bsSkinCheckRadioBox9.Checked then begin if str=''then str:='D' else str:=str+','+'D'; end; if str<>''then str:='('+str+')'; frm_code_port.t_code_disport.edit; frm_code_port.t_code_disport['港口功能']:=str; frm_code_port.t_code_disport.post; end; procedure Tfrm_code_port_modify.bsSkinButton4Click(Sender: TObject); begin table_delete(frm_code_port.t_code_disport); end; procedure Tfrm_code_port_modify.bsSkinButton1Click(Sender: TObject); begin frm_code_port.t_code_disport.Insert; bsSkinCheckRadioBox1.Checked:=false; bsSkinCheckRadioBox2.Checked:=false; bsSkinCheckRadioBox3.Checked:=false; bsSkinCheckRadioBox4.Checked:=false; bsSkinCheckRadioBox5.Checked:=false; bsSkinCheckRadioBox6.Checked:=false; bsSkinCheckRadioBox7.Checked:=false; bsSkinCheckRadioBox8.Checked:=false; bsSkinCheckRadioBox9.Checked:=false; end; procedure Tfrm_code_port_modify.FormClose(Sender: TObject; var Action: TCloseAction); begin frm_data_share.t_code_disport.requery; end; procedure Tfrm_code_port_modify.bsSkinButton7Click(Sender: TObject); begin table_Prior(frm_code_port.t_code_disport); end; procedure Tfrm_code_port_modify.bsSkinButton6Click(Sender: TObject); begin table_Next(frm_code_port.t_code_disport); end; procedure Tfrm_code_port_modify.DBEdit10Change(Sender: TObject); var str:widestring; begin begin str:=frm_code_port.t_code_disport.fieldbyname('港口功能').asstring; bsSkinCheckRadioBox1.Checked:=false; bsSkinCheckRadioBox2.Checked:=false; bsSkinCheckRadioBox3.Checked:=false; bsSkinCheckRadioBox4.Checked:=false; bsSkinCheckRadioBox5.Checked:=false; bsSkinCheckRadioBox6.Checked:=false; bsSkinCheckRadioBox7.Checked:=false; bsSkinCheckRadioBox8.Checked:=false; bsSkinCheckRadioBox9.Checked:=false; if pos('P',str)<>0 then bsSkinCheckRadioBox1.Checked:=true; if pos('Q',str)<>0 then bsSkinCheckRadioBox2.Checked:=true; if pos('Y',str)<>0 then bsSkinCheckRadioBox3.Checked:=true; if pos('G',str)<>0 then bsSkinCheckRadioBox4.Checked:=true; if pos('C',str)<>0 then bsSkinCheckRadioBox5.Checked:=true; if pos('R',str)<>0 then bsSkinCheckRadioBox6.Checked:=true; if pos('B',str)<>0 then bsSkinCheckRadioBox7.Checked:=true; if pos('T',str)<>0 then bsSkinCheckRadioBox8.Checked:=true; if pos('D',str)<>0 then bsSkinCheckRadioBox9.Checked:=true; end; end; procedure Tfrm_code_port_modify.RxDBLookupCombo1Change(Sender: TObject); begin if(frm_code_port.t_code_disport.state=dsinsert) or(frm_code_port.t_code_disport.state=dsedit)then begin if RxDBLookupCombo1.DisplayValue<>''then begin if frm_data_share.t_code_country.Locate('代码',RxDBLookupCombo1.DisplayValues[0],[])then begin frm_code_port.t_code_disport['国家']:=frm_data_share.t_code_country['国家名称']; frm_code_port.t_code_disport['洲']:=frm_data_share.t_code_country['洲']; end; end; end; end; procedure Tfrm_code_port_modify.bsSkinButton9Click(Sender: TObject); begin if frm_code_port.t_code_disport.IsEmpty then exit; frm_code_port.t_code_disport.edit; frm_code_port.t_code_disport['港口全名']:=frm_code_port.t_code_disport['中文名'] +'('+frm_code_port.t_code_disport['英文名']+')'; end; procedure Tfrm_code_port_modify.bsSkinButton8Click(Sender: TObject); var str_list:Tstringlist; i:integer; begin if frm_code_port.t_code_disport.IsEmpty then exit; str_list:=Tstringlist.create; str_list.Add('【英 文 名】'+frm_code_port.t_code_disport.fieldbyname('英文名').asstring); str_list.Add('【中 文 名】'+frm_code_port.t_code_disport.fieldbyname('中文名').asstring); str_list.Add('【位 置】'+frm_code_port.t_code_disport.fieldbyname('纬度_1').asstring +'°'+frm_code_port.t_code_disport.fieldbyname('纬度_2').asstring+'''' +frm_code_port.t_code_disport.fieldbyname('纬度').asstring+' ' +frm_code_port.t_code_disport.fieldbyname('经度_1').asstring +'°'+frm_code_port.t_code_disport.fieldbyname('经度_2').asstring+'''' +frm_code_port.t_code_disport.fieldbyname('经度').asstring); str_list.Add('【类 型】'+frm_code_port.t_code_disport.fieldbyname('港口类型').asstring); str_list.Add('【所属辖区】'+frm_code_port.t_code_disport.fieldbyname('洲').asstring +'-'+frm_code_port.t_code_disport.fieldbyname('国家').asstring); str_list.Add('【港口功能】'); i:=1; if bsSkinCheckRadioBox1.Checked then begin str_list.Add(inttostr(i)+'. '+bsSkinCheckRadioBox1.Caption); i:=i+1; end; if bsSkinCheckRadioBox2.Checked then begin str_list.Add(inttostr(i)+'. '+bsSkinCheckRadioBox2.Caption); i:=i+1; end; if bsSkinCheckRadioBox3.Checked then begin str_list.Add(inttostr(i)+'. '+bsSkinCheckRadioBox3.Caption); i:=i+1; end; if bsSkinCheckRadioBox4.Checked then begin str_list.Add(inttostr(i)+'. '+bsSkinCheckRadioBox4.Caption); i:=i+1; end; if bsSkinCheckRadioBox5.Checked then begin str_list.Add(inttostr(i)+'. '+bsSkinCheckRadioBox5.Caption); i:=i+1; end; if bsSkinCheckRadioBox6.Checked then begin str_list.Add(inttostr(i)+'. '+bsSkinCheckRadioBox6.Caption); i:=i+1; end; if bsSkinCheckRadioBox7.Checked then begin str_list.Add(inttostr(i)+'. '+bsSkinCheckRadioBox7.Caption); i:=i+1; end; if bsSkinCheckRadioBox8.Checked then begin str_list.Add(inttostr(i)+'. '+bsSkinCheckRadioBox8.Caption); i:=i+1; end; if bsSkinCheckRadioBox9.Checked then begin str_list.Add(inttostr(i)+'. '+bsSkinCheckRadioBox9.Caption); i:=i+1; end; str_list.Add(' '); str_list.Add('【最大承载力】'); frm_code_port.t_code_disport.edit; frm_code_port.t_code_disport['港口描述']:=str_list.text; str_list.free; end; procedure Tfrm_code_port_modify.bsSkinButton10Click(Sender: TObject); var ASqlQuery:TAdoQuery; begin if frm_code_port.t_code_disport['EDI代码']='' then begin ShowMessage('EDI代码不能为空'); exit; end; ASqlQuery:=CreateAdoQuery; with ASqlQuery do try Close;sql.clear; sql.add('select * from t_code_edi_port'); sql.add('where edi代码=:EDINO'); Parameters.ParamByName('EDINO').Value:=frm_code_port.t_code_disport['EDI代码']; open; if IsEmpty then begin Insert; fieldbyname('EDI代码').value:=frm_code_port.t_code_disport['EDI代码']; fieldbyname('港口名称').value:=frm_code_port.t_code_disport['英文名']; post; end else begin Edit; fieldbyname('EDI代码').value:=frm_code_port.t_code_disport['EDI代码']; fieldbyname('港口名称').value:=frm_code_port.t_code_disport['英文名']; post; end; finally FreeAndNil(ASqlQuery); end; end; end.