unit u_op_seai_order; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, bsSkinCtrls, ExtCtrls, DB, ADODB, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, ComCtrls, bsSkinTabs, RxLookup, StdCtrls, Mask, DBCtrls, wwdbdatetimepicker, wwdblook, Menus, dxDBTLCl, dxGrClms, bsdbctrls, XPMenu; type Tfrm_op_seai_order = class(TForm) Panel2: TPanel; bsSkinButton7: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinButton1: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinButton38: TbsSkinButton; Notebook1: TNotebook; t_op_seai: TADOQuery; t_op_seai1: TDataSource; dxDBGrid1: TdxDBGrid; PopupMenu3: TPopupMenu; N37: TMenuItem; N38: TMenuItem; N62: TMenuItem; N25: TMenuItem; N64: TMenuItem; N63: TMenuItem; N17: TMenuItem; N18: TMenuItem; N34: TMenuItem; N35: TMenuItem; N36: TMenuItem; dxDBGrid1Column4: TdxDBGridDateColumn; dxDBGrid1Column9: TdxDBGridMaskColumn; dxDBGrid1Column10: TdxDBGridMaskColumn; dxDBGrid1Column11: TdxDBGridMaskColumn; dxDBGrid1Column12: TdxDBGridDateColumn; dxDBGrid1Column13: TdxDBGridMaskColumn; dxDBGrid1Column14: TdxDBGridMaskColumn; dxDBGrid1Column15: TdxDBGridMaskColumn; dxDBGrid1Column16: TdxDBGridMaskColumn; dxDBGrid1Column17: TdxDBGridColumn; XPMenu1: TXPMenu; PopupMenu2: TPopupMenu; N10: TMenuItem; N11: TMenuItem; N14: TMenuItem; N13: TMenuItem; N12: TMenuItem; N15: TMenuItem; N16: TMenuItem; bsSkinPanel2: TbsSkinPanel; Label49: TLabel; wwDBDateTimePicker9: TwwDBDateTimePicker; wwDBDateTimePicker12: TwwDBDateTimePicker; Label52: TLabel; Label54: TLabel; RxDBLookupCombo2: TRxDBLookupCombo; bsSkinButton8: TbsSkinButton; bsSkinButton12: TbsSkinButton; d_onlineBooking: TADOQuery; dsrd_onlineBooking: TDataSource; dxDBGrid1Column23: TdxDBGridColumn; t_op_ctn: TADOQuery; t_op_ctn1: TDataSource; dxDBGrid1Column29: TdxDBGridColumn; dxDBGrid1Column21: TdxDBGridColumn; dxDBGrid1Column22: TdxDBGridColumn; dxDBGrid1Column24: TdxDBGridColumn; d_onlineBookingDSDesigner: TIntegerField; d_onlineBookingDSDesigner2: TStringField; d_onlineBookingDSDesigner3: TStringField; d_onlineBookingDSDesigner4: TStringField; d_onlineBookingDSDesigner5: TStringField; d_onlineBookingDSDesigner6: TDateTimeField; d_onlineBookingDSDesigner7: TStringField; d_onlineBookingDSDesigner8: TStringField; d_onlineBookingDSDesigner9: TStringField; d_onlineBookingDSDesigner10: TBooleanField; d_onlineBookingDSDesigner11: TStringField; d_onlineBookingDSDesigner12: TStringField; d_onlineBookingDSDesigner13: TStringField; d_onlineBookingDSDesigner14: TStringField; d_onlineBookingDSDesigner15: TStringField; d_onlineBookingDSDesigner16: TStringField; d_onlineBookingDSDesigner17: TStringField; d_onlineBookingDSDesigner18: TStringField; d_onlineBookingDSDesigner19: TStringField; d_onlineBookingDSDesigner20: TStringField; d_onlineBookingDSDesigner21: TStringField; d_onlineBookingDSDesigner22: TStringField; d_onlineBookingDSDesigner23: TStringField; d_onlineBookingDSDesigner24: TDateTimeField; d_onlineBookingDSDesigner25: TStringField; d_onlineBookingDSDesigner26: TStringField; d_onlineBookingDSDesigner27: TStringField; d_onlineBookingDSDesigner28: TStringField; d_onlineBookingDSDesigner29: TStringField; d_onlineBookingDSDesigner30: TStringField; d_onlineBookingDSDesigner31: TStringField; d_onlineBookingDSDesigner32: TDateTimeField; d_onlineBookingDSDesigner33: TStringField; d_onlineBookingDSDesigner34: TStringField; d_onlineBookingDSDesigner35: TStringField; d_onlineBookingDSDesigner36: TStringField; d_onlineBookingDSDesigner37: TStringField; d_onlineBookingDSDesigner38: TIntegerField; d_onlineBookingDSDesigner39: TStringField; d_onlineBookingDSDesigner40: TBCDField; d_onlineBookingDSDesigner41: TBCDField; d_onlineBookingDSDesigner1: TStringField; d_onlineBookingDSDesigner210: TStringField; d_onlineBookingDSDesigner310: TStringField; d_onlineBookingDSDesigner110: TIntegerField; d_onlineBookingDSDesigner211: TIntegerField; d_onlineBookingDSDesigner311: TIntegerField; d_onlineBookingDSDesigner42: TStringField; d_onlineBookingid: TAutoIncField; d_onlineBookingDSDesigner43: TIntegerField; d_onlineBookingDSDesigner44: TStringField; d_onlineBookingDSDesigner45: TStringField; d_onlineBookingDSDesigner46: TStringField; d_onlineBookingDSDesigner47: TStringField; d_onlineBookingDSDesigner48: TDateTimeField; d_onlineBookingDSDesigner49: TIntegerField; d_onlineBookingDSDesigner50: TStringField; d_onlineBookingDSDesigner51: TStringField; d_onlineBookingDSDesigner52: TStringField; d_onlineBookingDSDesigner53: TStringField; d_onlineBookingDSDesigner54: TStringField; d_onlineBookingDSDesigner55: TDateTimeField; d_onlineBookingDSDesigner56: TDateTimeField; d_onlineBookingDSDesigner57: TStringField; d_onlineBookingDSDesigner58: TStringField; d_onlineBookingDSDesigner59: TDateTimeField; d_onlineBookingDSDesigner60: TStringField; d_onlineBookingDSDesigner61: TStringField; d_onlineBookingDSDesigner62: TStringField; d_onlineBookingDSDesigner63: TStringField; d_onlineBookingDSDesigner64: TStringField; d_onlineBookingDSDesigner65: TStringField; d_onlineBookingDSDesigner66: TStringField; d_onlineBookingDSDesigner67: TStringField; d_onlineBookingDSDesigner68: TStringField; d_onlineBookingDSDesigner69: TStringField; d_onlineBookingDSDesigner70: TStringField; d_onlineBookingDSDesigner71: TStringField; d_onlineBookingDSDesigner72: TStringField; d_onlineBookingDSDesigner73: TStringField; d_onlineBookingDSDesigner74: TStringField; d_onlineBookingDSDesigner75: TDateTimeField; d_onlineBookingDSDesigner76: TStringField; d_onlineBookingDSDesigner77: TStringField; d_onlineBookingDSDesigner78: TStringField; d_onlineBookingDSDesigner79: TStringField; d_onlineBookingDSDesigner80: TStringField; d_onlineBookingDSDesigner81: TStringField; d_onlineBookingDSDesigner82: TStringField; d_onlineBookingDSDesigner83: TStringField; d_onlineBookingDSDesigner84: TStringField; d_onlineBookingDSDesigner85: TBooleanField; d_onlineBookingDSDesigner86: TBooleanField; d_onlineBookingDSDesigner87: TBooleanField; d_onlineBookingDSDesigner88: TBooleanField; d_onlineBookingDSDesigner89: TBooleanField; d_onlineBookingDSDesigner90: TDateTimeField; d_onlineBookingDSDesigner91: TStringField; d_onlineBookingDSDesigner92: TStringField; d_onlineBookingDSDesigner93: TStringField; d_onlineBookingDSDesigner94: TStringField; d_onlineBookingDSDesigner95: TStringField; d_onlineBookingDSDesigner96: TStringField; d_onlineBookingDSDesigner97: TStringField; d_onlineBookingDSDesigner98: TBooleanField; d_onlineBookingDSDesigner99: TDateTimeField; d_onlineBookingDSDesigner100: TBooleanField; d_onlineBookingDSDesigner101: TDateTimeField; d_onlineBookingDSDesigner102: TStringField; d_onlineBookingDSDesigner103: TStringField; d_onlineBookingDSDesigner104: TStringField; d_onlineBookingDSDesigner105: TStringField; d_onlineBookingDSDesigner106: TStringField; d_onlineBookingDSDesigner107: TStringField; d_onlineBookingDSDesigner108: TStringField; d_onlineBookingDSDesigner109: TStringField; d_onlineBookingDSDesigner111: TStringField; d_onlineBookingDSDesigner112: TStringField; d_onlineBookingDSDesigner113: TStringField; d_onlineBookingDSDesigner114: TIntegerField; d_onlineBookingDSDesigner115: TStringField; d_onlineBookingDSDesigner116: TBooleanField; d_onlineBookingDSDesigner117: TBooleanField; d_onlineBookingDSDesigner118: TBooleanField; d_onlineBookingDSDesigner119: TBooleanField; d_onlineBookingDSDesigner120: TStringField; d_onlineBookingDSDesigner121: TBooleanField; d_onlineBookingDSDesigner122: TDateTimeField; d_onlineBookingDSDesigner123: TBooleanField; d_onlineBookingDSDesigner124: TBooleanField; d_onlineBookingDSDesigner125: TDateTimeField; d_onlineBookingDSDesigner126: TDateTimeField; d_onlineBookingDSDesigner127: TStringField; d_onlineBookingDSDesigner128: TStringField; d_onlineBookingDSDesigner129: TStringField; d_onlineBookingDSDesigner130: TBooleanField; d_onlineBookingDSDesigner131: TStringField; d_onlineBookingDSDesigner132: TDateTimeField; d_onlineBookingDSDesigner133: TBCDField; d_onlineBookingDSDesigner134: TBCDField; d_onlineBookingDSDesigner135: TBCDField; d_onlineBookingDSDesigner136: TDateTimeField; d_onlineBookingDSDesigner137: TDateTimeField; d_onlineBookingDSDesigner138: TDateTimeField; d_onlineBookingDSDesigner139: TDateTimeField; d_onlineBookingDSDesigner140: TStringField; d_onlineBookingDSDesigner141: TStringField; d_onlineBookingDSDesigner142: TStringField; d_onlineBookingDSDesigner143: TBooleanField; d_onlineBookingDSDesigner144: TStringField; d_onlineBookingDSDesigner145: TStringField; d_onlineBookingDSDesigner146: TStringField; d_onlineBookingDSDesigner147: TStringField; d_onlineBookingDSDesigner148: TStringField; d_onlineBookingDSDesigner149: TStringField; d_onlineBookingDSDesigner150: TBCDField; d_onlineBookingDSDesigner151: TStringField; d_onlineBookingDSDesigner152: TStringField; d_onlineBookingDSDesigner153: TDateTimeField; d_onlineBookingDSDesigner154: TDateTimeField; d_onlineBookingDSDesigner155: TStringField; d_onlineBookingDSDesigner156: TDateTimeField; d_onlineBookingDSDesigner157: TDateTimeField; d_onlineBookingDSDesigner158: TDateTimeField; d_onlineBookingDSDesigner159: TDateTimeField; d_onlineBookingDSDesigner160: TStringField; d_onlineBookingDSDesigner161: TStringField; d_onlineBookingDSDesigner162: TStringField; d_onlineBookingDSDesigner163: TStringField; d_onlineBookingDSDesigner164: TStringField; d_onlineBookingDSDesigner165: TStringField; d_onlineBookingDSDesigner166: TStringField; d_onlineBookingDSDesigner167: TStringField; d_onlineBookingDSDesigner168: TBooleanField; d_onlineBookingDSDesigner169: TDateTimeField; d_onlineBookingDSDesigner170: TStringField; d_onlineBookingDSDesigner171: TStringField; d_onlineBookingDSDesigner172: TStringField; d_onlineBookingDSDesigner173: TStringField; d_onlineBookingDSDesigner174: TBooleanField; d_onlineBookingDSDesigner175: TStringField; bsSkinPanel1: TbsSkinPanel; dxDBGrid1Column18: TdxDBGridColumn; dxDBGrid1Column19: TdxDBGridColumn; dxDBGrid1Column20: TdxDBGridColumn; dxDBGrid1Column25: TdxDBGridColumn; procedure bsSkinButton5Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure Panel2Resize(Sender: TObject); procedure bsSkinButton7Click(Sender: TObject); procedure bsSkinButton6Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton38Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure t_op_seaiBeforePost(DataSet: TDataSet); procedure t_op_seaiPostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure N10Click(Sender: TObject); procedure N14Click(Sender: TObject); procedure N12Click(Sender: TObject); procedure N16Click(Sender: TObject); procedure bsSkinButton8Click(Sender: TObject); procedure bsSkinButton12Click(Sender: TObject); procedure RxDBLookupCombo20KeyPress(Sender: TObject; var Key: Char); procedure t_op_ctnAfterPost(DataSet: TDataSet); procedure dxDBGrid1Column29CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); procedure d_onlineBookingDSDesignerGetText(Sender: TField; var Text: String; DisplayText: Boolean); procedure d_onlineBookingDSDesigner1GetText(Sender: TField; var Text: String; DisplayText: Boolean); procedure d_onlineBookingDSDesigner210GetText(Sender: TField; var Text: String; DisplayText: Boolean); procedure d_onlineBookingDSDesigner310GetText(Sender: TField; var Text: String; DisplayText: Boolean); private function GetCntr(Code:String):String; { Private declarations } public { Public declarations } end; var frm_op_seai_order: Tfrm_op_seai_order; implementation uses u_main,u_data_share, my_sys_function, u_sys_progress, u_op_seai_oder_add, u_op_ctn; {$R *.dfm} function Tfrm_op_seai_order.GetCntr(Code:String):String; var aQuery:TAdoQuery; begin aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('select 表现形式 from t_code_ctn where 代码='''+Code+''''); Open; Result:=FieldByName('表现形式').AsString; end; finally freeAndNil(aQuery); end; end; procedure Tfrm_op_seai_order.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_seai_order.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption); frm_op_seai_order.Hide; frm_op_seai_order.ManualFloat(frm_op_seai_order.BoundsRect ); frm_main.freeTabs('frm_op_seai_order'); action:=cafree; frm_op_seai_order:=nil; end; procedure Tfrm_op_seai_order.Panel2Resize(Sender: TObject); var i:integer; begin i:=round(Panel2.Width/11); bsSkinButton7.Width:=i; bsSkinButton6.Width:=i; bsSkinButton9.Width:=i; bsSkinButton1.Width:=i; bsSkinButton3.Width:=i; bsSkinButton38.Width:=i; end; procedure Tfrm_op_seai_order.bsSkinButton7Click(Sender: TObject); begin table_Prior(t_op_seai); end; procedure Tfrm_op_seai_order.bsSkinButton6Click(Sender: TObject); begin table_next(t_op_seai); end; procedure Tfrm_op_seai_order.bsSkinButton2Click(Sender: TObject); begin table_post(t_op_seai); end; procedure Tfrm_op_seai_order.bsSkinButton9Click(Sender: TObject); begin sys_print('海运进口网上订舱',2,t_op_seai1,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil); end; procedure Tfrm_op_seai_order.bsSkinButton3Click(Sender: TObject); begin d_onlineBooking.Edit; d_onlineBooking['订舱状态']:=3; d_onlineBooking.Post; end; procedure Tfrm_op_seai_order.bsSkinButton38Click(Sender: TObject); var book1:Tbookmark; begin book1:=d_onlineBooking.GetBookmark; d_onlineBooking.Refresh; d_onlineBooking.GotoBookmark(book1); end; procedure Tfrm_op_seai_order.FormShow(Sender: TObject); begin if not ASSIGNED(frm_sys_progress) then frm_sys_progress:=tfrm_sys_progress.Create(self); frm_sys_progress.bsSkinGauge1.ProgressText:='加载数据请等候。。。'; frm_sys_progress.Show; frm_sys_progress.bsSkinGauge1.MaxValue:=28; frm_sys_progress.bsSkinGauge1.MinValue:=0; frm_sys_progress.bsSkinGauge1.Value:=0; frm_sys_progress.Update; t_op_seai.Close; t_op_seai.open; d_onlineBooking.Close; d_onlineBooking.open; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; loadreggrid(dxdbgrid1,false,caption); { if frm_data_share.t_code_ctn.locate('代码',trim(frm_data_share.t_code_ctn_de.fieldbyname('箱型1').asstring),[]) then dxdbgrid1.ColumnByFieldName('箱量1').Caption:= trim(frm_data_share.t_code_ctn.fieldbyname('表现形式').asstring); } frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_sys_progress.close; frm_sys_progress:=nil; end; procedure Tfrm_op_seai_order.t_op_seaiBeforePost(DataSet: TDataSet); var BSNO:String; begin if t_op_seai.State=dsinsert then begin // t_op_seai['主编号']:=t_op_seai['编号']; t_op_seai['业务状态']:='接受委托'; t_op_seai['费用状态']:='录入状态'; end; end; procedure Tfrm_op_seai_order.t_op_seaiPostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); var str:widestring; begin if pos('SOME VALUES MAY HAVE BEEN CHANGED',UpperCase(E.Message))<>0 then begin showmessage('数据已经被其它用户修改,当前修改不能保存'+#13#10+'请刷新数据后重新录入'); abort; end; end; procedure Tfrm_op_seai_order.bsSkinButton1Click(Sender: TObject); begin if t_op_seai=nil then exit; if d_onlineBooking=nil then exit; if (d_onlineBooking['订舱状态']=1) or (d_onlineBooking['订舱状态']=3) then begin MessageDlg('当前状态下不能接受订舱!', mtConfirmation, [mbYes],0); exit; end; if (t_op_seai.State=dsinsert)or(t_op_seai.State=dsedit) then t_op_seai.post; try frm_op_seai_order_add:=tfrm_op_seai_order_add.Create (self); frm_op_seai_order_add.data1.Enabled:=false; frm_op_seai_order_add.data1.DataSet:=t_op_seai; frm_op_seai_order_add.data1.Enabled:=true; frm_op_seai_order_add.data2.Enabled:=false; frm_op_seai_order_add.data2.DataSet:=d_onlineBooking; frm_op_seai_order_add.data2.Enabled:=true; frm_op_seai_order_add.data3.Enabled:=false; frm_op_seai_order_add.data3.DataSet:=t_op_ctn; frm_op_seai_order_add.data3.Enabled:=true; frm_op_seai_order_add.ShowModal; finally frm_op_seai_order_add.Free; frm_op_seai_order_add:=nil; end; end; procedure Tfrm_op_seai_order.bsSkinButton10Click(Sender: TObject); begin // query_seae(11,'0001'); end; procedure Tfrm_op_seai_order.N10Click(Sender: TObject); begin update_grid_view_no(dxdbgrid1); end; procedure Tfrm_op_seai_order.N14Click(Sender: TObject); begin update_grid_view_all(dxdbgrid1); end; procedure Tfrm_op_seai_order.N12Click(Sender: TObject); begin update_grid(dxdbgrid1,203); end; procedure Tfrm_op_seai_order.N16Click(Sender: TObject); begin grid_save_xls(dxdbgrid1); end; procedure Tfrm_op_seai_order.bsSkinButton8Click(Sender: TObject); VAR str:widestring; begin str:='where 进出口=''import'' and 海运空运=''sea'''; if RxDBLookupCombo2.DisplayValue<>''then str:=str+' and 委托单位='+''''+RxDBLookupCombo2.DisplayValues[1]+''''; if wwDBDateTimePicker9.text<>''then str:=str+' and 申请时间>='+''''+wwDBDateTimePicker9.text+''''; if wwDBDateTimePicker12.text<>''then str:=str+' and 申请时间<='+''''+wwDBDateTimePicker12.text+''''; d_onlineBooking.close; d_onlineBooking.sql.clear; d_onlineBooking.sql.add('select * from d_onlineBooking '+str+' order by 业务编号'); d_onlineBooking.open; end; procedure Tfrm_op_seai_order.bsSkinButton12Click(Sender: TObject); begin RxDBLookupCombo2.ClearValue; wwDBDateTimePicker9.text:=''; wwDBDateTimePicker12.text:=''; end; procedure Tfrm_op_seai_order.RxDBLookupCombo20KeyPress(Sender: TObject; var Key: Char); begin // key_wwDBLookupCombo(Key,wwDBLookupCombo1); end; procedure Tfrm_op_seai_order.t_op_ctnAfterPost(DataSet: TDataSet); begin update_ctn(t_op_ctn); end; procedure Tfrm_op_seai_order.dxDBGrid1Column29CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); begin if ANode.Strings[dxDBGrid1Column29.Index]='接受订舱' then AColor:=clgreen else if ANode.Strings[dxDBGrid1Column29.Index]='拒绝订舱' then AColor:=clred else AColor:=clWhite; AFont.Color:=clblack; end; procedure Tfrm_op_seai_order.d_onlineBookingDSDesignerGetText( Sender: TField; var Text: String; DisplayText: Boolean); begin if Sender.Value='0' then Text:='等待订舱' else if Sender.Value='3' then Text:='拒绝订舱' else Text:='接受订舱'; end; procedure Tfrm_op_seai_order.d_onlineBookingDSDesigner1GetText( Sender: TField; var Text: String; DisplayText: Boolean); begin if sender.DataSet['箱量1']<>0 then Text:=GetCntr(Sender.AsString)+'X'+sender.DataSet.fieldbyname('箱量1').asstring; end; procedure Tfrm_op_seai_order.d_onlineBookingDSDesigner210GetText( Sender: TField; var Text: String; DisplayText: Boolean); begin if sender.DataSet['箱量2']<>0 then Text:=GetCntr(Sender.AsString)+'X'+sender.DataSet.fieldbyname('箱量2').asstring; end; procedure Tfrm_op_seai_order.d_onlineBookingDSDesigner310GetText( Sender: TField; var Text: String; DisplayText: Boolean); begin if sender.DataSet['箱量3']<>0 then Text:=GetCntr(Sender.AsString)+'X'+sender.DataSet.fieldbyname('箱量3').asstring; end; end.