unit u_code_truck_changzhan; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, bsSkinCtrls, ExtCtrls, RxLookup, BusinessSkinForm, StdCtrls, Mask, DBCtrls, dxTL, dxDBCtrl, dxDBGrid, dxCntner,DB; type Tfrm_code_truck_changzhan = class(TForm) Label2: TLabel; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridMaskColumn; DBEdit2: TDBEdit; bsBusinessSkinForm1: TbsBusinessSkinForm; Label1: TLabel; DBEdit1: TDBEdit; RxDBLookupCombo1: TRxDBLookupCombo; Label4: TLabel; Panel1: TPanel; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinButton6: TbsSkinButton; procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure bsSkinButton6Click(Sender: TObject); procedure RxDBLookupCombo1Change(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_code_truck_changzhan: Tfrm_code_truck_changzhan; code_truck_changzhan_num:integer; implementation uses u_data_share, u_op_letter, my_sys_function, u_op_truck; {$R *.dfm} procedure Tfrm_code_truck_changzhan.bsSkinButton1Click(Sender: TObject); begin frm_data_share.t_code_truck_changzhan.insert; end; procedure Tfrm_code_truck_changzhan.bsSkinButton2Click(Sender: TObject); begin table_post(frm_data_share.t_code_truck_changzhan); end; procedure Tfrm_code_truck_changzhan.bsSkinButton4Click(Sender: TObject); begin table_delete(frm_data_share.t_code_truck_changzhan); end; procedure Tfrm_code_truck_changzhan.bsSkinButton3Click(Sender: TObject); begin table_cancel(frm_data_share.t_code_truck_changzhan); end; procedure Tfrm_code_truck_changzhan.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_code_truck_changzhan.FormShow(Sender: TObject); begin frm_data_share.t_code_truck_changzhan.requery; end; procedure Tfrm_code_truck_changzhan.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin CanClose:=frm_close_query(frm_data_share.t_code_truck_changzhan); end; procedure Tfrm_code_truck_changzhan.bsSkinButton6Click(Sender: TObject); begin if frm_data_share.t_code_truck_changzhan.IsEmpty then exit; case code_truck_changzhan_num of 1: begin frm_op_letter.t_op_letter_pc.edit; frm_op_letter.t_op_letter_pc['背箱场站']:=frm_data_share.t_code_truck_changzhan['场站名称']; frm_op_letter.t_op_letter_pc['场站联系人']:=frm_data_share.t_code_truck_changzhan['场站联系人']; frm_op_letter.t_op_letter_pc['场站电话']:=frm_data_share.t_code_truck_changzhan['场站电话']; frm_op_letter.t_op_letter_pc.post; end; 2: begin frm_op_letter.t_op_letter_pc.edit; frm_op_letter.t_op_letter_pc['返箱地址']:=frm_data_share.t_code_truck_changzhan['场站名称']; frm_op_letter.t_op_letter_pc['返箱联系人']:=frm_data_share.t_code_truck_changzhan['场站联系人']; frm_op_letter.t_op_letter_pc['返箱联系电话']:=frm_data_share.t_code_truck_changzhan['场站电话']; frm_op_letter.t_op_letter_pc.post; end; 3: begin frm_op_letter.t_op_letter_rh.edit; frm_op_letter.t_op_letter_rh['入货场站']:=frm_data_share.t_code_truck_changzhan['场站名称']; frm_op_letter.t_op_letter_rh['场站联系人']:=frm_data_share.t_code_truck_changzhan['场站联系人']; frm_op_letter.t_op_letter_rh['场站联系电话']:=frm_data_share.t_code_truck_changzhan['场站电话']; frm_op_letter.t_op_letter_rh.post; end; 4: begin frm_op_truck.t_op_letter_pc.edit; frm_op_truck.t_op_letter_pc['背箱场站']:=frm_data_share.t_code_truck_changzhan['场站名称']; frm_op_truck.t_op_letter_pc['场站联系人']:=frm_data_share.t_code_truck_changzhan['场站联系人']; frm_op_truck.t_op_letter_pc['场站电话']:=frm_data_share.t_code_truck_changzhan['场站电话']; frm_op_truck.t_op_letter_pc.post; end; 5: begin frm_op_truck.t_op_letter_pc.edit; frm_op_truck.t_op_letter_pc['返箱地址']:=frm_data_share.t_code_truck_changzhan['场站名称']; frm_op_truck.t_op_letter_pc['返箱联系人']:=frm_data_share.t_code_truck_changzhan['场站联系人']; frm_op_truck.t_op_letter_pc['返箱联系电话']:=frm_data_share.t_code_truck_changzhan['场站电话']; frm_op_truck.t_op_letter_pc.post; end; end; close; end; procedure Tfrm_code_truck_changzhan.RxDBLookupCombo1Change( Sender: TObject); begin if frm_data_share.t_code_truck_changzhan.State in [dsinsert,dsedit] then begin if frm_data_share.t_crm_client_changzhan.Locate('客户简称',RxDBLookupCombo1.DisplayValues[1],[])then begin frm_data_share.t_code_truck_changzhan['场站联系人']:=frm_data_share.t_crm_client_changzhan.fieldbyname('海运联系人').asstring; frm_data_share.t_code_truck_changzhan['场站电话']:=frm_data_share.t_crm_client_changzhan.fieldbyname('海运电话').asstring; end; end; end; end.