unit u_op_seae_ctn; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, DB, ADODB, ExtCtrls, bsSkinCtrls; type Tfrm_op_seae_ctn = class(TForm) ADOQuery_CtnList1: TDataSource; ADOQuery_CtnList: TADOQuery; dxDBGrid2: TdxDBGrid; dxDBGrid2Column1: TdxDBGridColumn; dxDBGrid2Column2: TdxDBGridColumn; dxDBGrid2Column3: TdxDBGridColumn; dxDBGrid2Column4: TdxDBGridColumn; dxDBGrid2Column5: TdxDBGridColumn; dxDBGrid2Column6: TdxDBGridColumn; dxDBGrid2Column7: TdxDBGridColumn; dxDBGrid2Column8: TdxDBGridColumn; dxDBGrid2Column9: TdxDBGridColumn; dxDBGrid2Column10: TdxDBGridColumn; Panel1: TPanel; bsSkinButton5: TbsSkinButton; t_op_ctn1: TDataSource; procedure FormShow(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); private { Private declarations } public { Public declarations } CorpName,Vsl,Voy,bsNo:string; end; var frm_op_seae_ctn: Tfrm_op_seae_ctn; implementation uses u_main; {$R *.dfm} procedure Tfrm_op_seae_ctn.FormShow(Sender: TObject); begin with ADOQuery_CtnList do begin Close;SQL.Clear; SQL.Add('select t_op_seae.主提单号,t_op_seae.委托单位,t_op_seae.开船日期,t_op_ctn.* from t_op_seae'); SQL.Add('left join t_op_ctn on t_op_seae.编号=t_op_ctn.编号'); SQL.Add('where t_op_seae.委托单位=:CorpName and t_op_seae.船名=:Vsl and t_op_seae.航次=:voy'); SQL.Add('and t_op_seae.编号<>:bsno'); Parameters.ParamByName('CorpName').Value:=CorpName; Parameters.ParamByName('bsno').Value:=bsno; Parameters.ParamByName('vsl').Value:=Vsl; Parameters.ParamByName('Voy').Value:=Voy; Open; end; end; procedure Tfrm_op_seae_ctn.bsSkinButton5Click(Sender: TObject); var i:integer; begin if ADOQuery_CtnList.IsEmpty then exit; if dxDBGrid2.SelectedCount>=1 then begin for i:=0 to dxDBGrid2.SelectedCount-1 do begin ADOQuery_CtnList.GotoBookmark(pointer(dxDBGrid2.selectedrows[i])); t_op_ctn1.Dataset.Append; t_op_ctn1.Dataset.FieldByName('编号').Value:=bsno; t_op_ctn1.Dataset.FieldByName('代码').Value:=ADOQuery_CtnList.FieldByName('代码').Value; t_op_ctn1.Dataset.FieldByName('尺寸').Value:=ADOQuery_CtnList.FieldByName('尺寸').Value; t_op_ctn1.Dataset.FieldByName('箱型').Value:=ADOQuery_CtnList.FieldByName('箱型').Value; t_op_ctn1.Dataset.FieldByName('数量').Value:=ADOQuery_CtnList.FieldByName('数量').Value; t_op_ctn1.Dataset.FieldByName('TEU').Value:=ADOQuery_CtnList.FieldByName('TEU').Value; t_op_ctn1.Dataset.FieldByName('TEU').Value:=ADOQuery_CtnList.FieldByName('TEU').Value; t_op_ctn1.Dataset.FieldByName('表现形式').Value:=ADOQuery_CtnList.FieldByName('表现形式').Value; t_op_ctn1.Dataset.FieldByName('箱号').Value:=ADOQuery_CtnList.FieldByName('箱号').Value; t_op_ctn1.Dataset.FieldByName('封号').Value:=ADOQuery_CtnList.FieldByName('封号').Value; t_op_ctn1.Dataset.FieldByName('件数').Value:=ADOQuery_CtnList.FieldByName('件数').Value; t_op_ctn1.Dataset.FieldByName('包装').Value:=ADOQuery_CtnList.FieldByName('包装').Value; t_op_ctn1.Dataset.FieldByName('重量').Value:=ADOQuery_CtnList.FieldByName('重量').Value; t_op_ctn1.Dataset.FieldByName('尺码').Value:=ADOQuery_CtnList.FieldByName('尺码').Value; t_op_ctn1.Dataset.post; // Create. end; end; end; end.