You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

730 lines
25 KiB
Plaintext

unit u_op_ctn_status;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bsSkinCtrls, ExtCtrls, dxExEdtr, dxCntner, dxTL, dxDBCtrl,
dxDBGrid, DB, ADODB, StdCtrls, DBCtrls, wwdbdatetimepicker, wwdbedit,
Wwdotdot, Wwdbcomb, Mask, RxLookup, ComCtrls, bsSkinTabs, wwdblook,
dxDBTLCl, dxGrClms, Menus;
type
TRecordStatus=Record
StatusDate,statusCz :string;
end;
Tfrm_op_ctn_status = class(TForm)
Panel1: TPanel;
bsSkinButton7: TbsSkinButton;
bsSkinButton6: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
bsSkinPanel1: TbsSkinPanel;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
bsSkinPanel2: TbsSkinPanel;
bsSkinButton44: TbsSkinButton;
Edit1: TEdit;
Label6: TLabel;
Label11: TLabel;
wwDBDateTimePicker3: TwwDBDateTimePicker;
Label12: TLabel;
wwDBDateTimePicker4: TwwDBDateTimePicker;
Label3: TLabel;
RxDBLookupCombo1: TRxDBLookupCombo;
bsSkinPanel3: TbsSkinPanel;
Label4: TLabel;
RxDBLookupCombo2: TRxDBLookupCombo;
Label7: TLabel;
wwDBDateTimePicker5: TwwDBDateTimePicker;
Label15: TLabel;
Edit5: TEdit;
bsSkinButton2: TbsSkinButton;
t_op_ctn_detail: TADOQuery;
t_op_ctn_detail1: TDataSource;
t_code_ctn_status1: TDataSource;
t_code_ctn_status: TADOQuery;
bsSkinPanel4: TbsSkinPanel;
bsSkinGroupBox1: TbsSkinGroupBox;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridColumn;
dxDBGrid1Column2: TdxDBGridColumn;
dxDBGrid1Column3: TdxDBGridColumn;
dxDBGrid1Column9: TdxDBGridColumn;
dxDBGrid1Column10: TdxDBGridColumn;
dxDBGrid1Column11: TdxDBGridColumn;
Label16: TLabel;
RxDBLookupCombo9: TRxDBLookupCombo;
t_op_ctn_status1: TDataSource;
t_op_ctn_status: TADOQuery;
dxDBGrid2: TdxDBGrid;
dxDBGridColumn2: TdxDBGridColumn;
dxDBGridColumn3: TdxDBGridColumn;
dxDBGrid2Column3: TdxDBGridColumn;
dxDBGrid2Column4: TdxDBGridColumn;
dxDBGrid1Column7: TdxDBGridColumn;
dxDBGrid1Column8: TdxDBGridColumn;
dxDBGrid1Column12: TdxDBGridCheckColumn;
wwDBComboBox1: TwwDBComboBox;
Label5: TLabel;
Label10: TLabel;
wwDBComboBox2: TwwDBComboBox;
Memo1: TMemo;
Label1: TLabel;
Edit2: TEdit;
Label13: TLabel;
RxDBLookupCombo4: TRxDBLookupCombo;
dxDBGrid1Column13: TdxDBGridColumn;
dxDBGrid1Column14: TdxDBGridColumn;
dxDBGrid1Column15: TdxDBGridColumn;
wwDBLookupCombo2: TwwDBLookupCombo;
Label27: TLabel;
Label2: TLabel;
wwDBLookupCombo3: TwwDBLookupCombo;
dxDBGrid2Column5: TdxDBGridColumn;
dxDBGrid2Column6: TdxDBGridColumn;
Label8: TLabel;
wwDBComboBox3: TwwDBComboBox;
t_op_railway1: TDataSource;
t_op_railway: TADOQuery;
bsSkinGroupBox7: TbsSkinGroupBox;
Label118: TLabel;
Label119: TLabel;
Label120: TLabel;
Label121: TLabel;
Label122: TLabel;
Label123: TLabel;
Label124: TLabel;
Label126: TLabel;
Label127: TLabel;
Label128: TLabel;
Label129: TLabel;
Label130: TLabel;
Label131: TLabel;
Label132: TLabel;
Label133: TLabel;
Label134: TLabel;
Label137: TLabel;
Label138: TLabel;
Label139: TLabel;
Label140: TLabel;
Label141: TLabel;
wwDBDateTimePicker23: TwwDBDateTimePicker;
wwDBDateTimePicker24: TwwDBDateTimePicker;
wwDBDateTimePicker25: TwwDBDateTimePicker;
wwDBDateTimePicker26: TwwDBDateTimePicker;
DBEdit50: TDBEdit;
wwDBDateTimePicker27: TwwDBDateTimePicker;
wwDBDateTimePicker28: TwwDBDateTimePicker;
RxDBLookupCombo19: TRxDBLookupCombo;
RxDBLookupCombo3: TRxDBLookupCombo;
wwDBDateTimePicker29: TwwDBDateTimePicker;
wwDBDateTimePicker30: TwwDBDateTimePicker;
DBEdit52: TDBEdit;
wwDBDateTimePicker31: TwwDBDateTimePicker;
wwDBDateTimePicker32: TwwDBDateTimePicker;
DBEdit53: TDBEdit;
wwDBDateTimePicker33: TwwDBDateTimePicker;
RxDBLookupCombo20: TRxDBLookupCombo;
wwDBDateTimePicker35: TwwDBDateTimePicker;
wwDBDateTimePicker36: TwwDBDateTimePicker;
wwDBDateTimePicker37: TwwDBDateTimePicker;
RxDBLookupCombo21: TRxDBLookupCombo;
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox3: TbsSkinCheckRadioBox;
PopupMenu2: TPopupMenu;
N16: TMenuItem;
SaveDialog: TSaveDialog;
RxDBLookupCombo5: TRxDBLookupCombo;
Label9: TLabel;
Edit3: TEdit;
Label14: TLabel;
dxDBGrid1Column16: TdxDBGridColumn;
dxDBGrid2Column7: TdxDBGridColumn;
PopupMenu1: TPopupMenu;
MenuItem1: TMenuItem;
dxDBGrid1Column17: TdxDBGridColumn;
dxDBGrid1Column18: TdxDBGridCheckColumn;
dxDBGrid1Column19: TdxDBGridCheckColumn;
dxDBGrid1Column20: TdxDBGridCheckColumn;
dxDBGrid1Column21: TdxDBGridCheckColumn;
dxDBGrid1Column22: TdxDBGridCheckColumn;
dxDBGrid1Column23: TdxDBGridCheckColumn;
dxDBGrid1Column24: TdxDBGridCheckColumn;
dxDBGrid1Column25: TdxDBGridColumn;
dxDBGrid1Column26: TdxDBGridColumn;
dxDBGrid1Column27: TdxDBGridColumn;
dxDBGrid1Column28: TdxDBGridColumn;
t_op_ctn_detailctnid: TAutoIncField;
t_op_ctn_detailDSDesigner: TStringField;
t_op_ctn_detailDSDesigner2: TStringField;
t_op_ctn_detailDSDesigner3: TStringField;
t_op_ctn_detailDSDesigner4: TDateTimeField;
t_op_ctn_detailDSDesigner5: TStringField;
t_op_ctn_detailDSDesigner6: TStringField;
t_op_ctn_detailDSDesigner7: TStringField;
t_op_ctn_detailDSDesigner8: TStringField;
t_op_ctn_detailDSDesigner9: TBooleanField;
t_op_ctn_detailDSDesigner10: TStringField;
t_op_ctn_detailDSDesigner11: TStringField;
t_op_ctn_detailDSDesigner12: TStringField;
t_op_ctn_detailDSDesigner13: TStringField;
t_op_ctn_detailaddctnid: TIntegerField;
t_op_ctn_detailDSDesigner14: TDateTimeField;
t_op_ctn_detailDSDesigner15: TStringField;
t_op_ctn_detailDSDesigner16: TDateTimeField;
t_op_ctn_detailDSDesigner17: TBooleanField;
t_op_ctn_detailDSDesigner18: TStringField;
t_op_ctn_detailDSDesigner19: TStringField;
t_op_ctn_detailDSDesigner20: TDateTimeField;
t_op_ctn_detailDSDesigner21: TStringField;
t_op_ctn_detailDSDesigner22: TStringField;
t_op_ctn_detailDSDesigner23: TStringField;
t_op_ctn_detailDSDesigner24: TDateTimeField;
t_op_ctn_detailDSDesigner25: TStringField;
t_op_ctn_detailDSDesigner26: TStringField;
t_op_ctn_detailDSDesigner27: TDateTimeField;
t_op_ctn_detailDSDesigner28: TStringField;
t_op_ctn_detailDSDesigner29: TStringField;
t_op_ctn_detailDSDesigner30: TStringField;
t_op_ctn_detailDSDesigner31: TStringField;
t_op_ctn_detailDSDesigner32: TStringField;
t_op_ctn_detailDSDesigner33: TDateTimeField;
t_op_ctn_detailDSDesigner34: TDateTimeField;
t_op_ctn_detailDSDesigner35: TStringField;
t_op_ctn_detailDSDesigner36: TDateTimeField;
t_op_ctn_detailDSDesigner37: TIntegerField;
t_op_ctn_detailDSDesigner38: TIntegerField;
t_op_ctn_detailDSDesigner39: TIntegerField;
t_op_ctn_detailDSDesigner40: TIntegerField;
t_op_ctn_detailDSDesigner41: TIntegerField;
t_op_ctn_detailDSDesigner42: TIntegerField;
t_op_ctn_detailDSDesigner43: TIntegerField;
t_ctn_status: TADOQuery;
dxDBGrid1Column29: TdxDBGridColumn;
t_op_ctn_detailField: TStringField;
t_op_ctn_detailField2: TStringField;
t_op_ctn_detailField3: TStringField;
dxDBGrid1Column30: TdxDBGridColumn;
dxDBGrid1Column31: TdxDBGridColumn;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bsSkinButton5Click(Sender: TObject);
procedure Panel1Resize(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure bsSkinButton44Click(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure t_op_ctn_statusAfterInsert(DataSet: TDataSet);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinCheckRadioBox1Click(Sender: TObject);
procedure N16Click(Sender: TObject);
procedure MenuItem1Click(Sender: TObject);
procedure t_op_ctn_detailCalcFields(DataSet: TDataSet);
private
{ Private declarations }
public
{ Public declarations }
function GetCtnStatus(ctnid:integer;ctnstatus:string):string;
function GetczCtnStatus(ctnid:integer;ctnstatus:string):TRecordStatus;
end;
var
frm_op_ctn_status: Tfrm_op_ctn_status;
implementation
uses u_main, my_sys_function;
{$R *.dfm}
function Tfrm_op_ctn_status.GetczCtnStatus(ctnid:integer;ctnstatus:string):TRecordStatus;
var aAdoQuery:TAdoQuery;
begin
Result.StatusDate:='';
Result.Statuscz:='';
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
close;sql.Clear;
sql.Add('select <20><>̬ʱ<CCAC><CAB1>,<2C><>վ from t_op_ctnmg_status');
sql.Add('where ctnid=:ctnid and <20><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>=:ctnstatus');
Parameters.ParamByName('ctnid').Value:=ctnid;
Parameters.ParamByName('ctnstatus').Value:=ctnstatus;
open;
if not IsEmpty then
begin
Result.StatusDate:=FieldByName('<27><>̬ʱ<CCAC><CAB1>').AsString;
Result.Statuscz:=FieldByName('<27><>վ').AsString;
end;
finally
Free;
end;
end;
function Tfrm_op_ctn_status.GetCtnStatus(ctnid:integer;ctnstatus:string):string;
var aAdoQuery:TAdoQuery;
begin
Result:='';
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
close;sql.Clear;
sql.Add('select <20><>̬ʱ<CCAC><CAB1> from t_op_ctnmg_status');
sql.Add('where ctnid=:ctnid and <20><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>=:ctnstatus');
Parameters.ParamByName('ctnid').Value:=ctnid;
Parameters.ParamByName('ctnstatus').Value:=ctnstatus;
open;
if not IsEmpty then
begin
Result:=FieldByName('<27><>̬ʱ<CCAC><CAB1>').AsString;
end;
finally
Free;
end;
end;
procedure Tfrm_op_ctn_status.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
savereggrid(dxdbgrid1,caption);
frm_op_ctn_status.Hide;
frm_op_ctn_status.ManualFloat(frm_op_ctn_status.BoundsRect );
frm_main.freeTabs('frm_op_ctn_status');
action:=cafree;
frm_op_ctn_status:=nil;
end;
procedure Tfrm_op_ctn_status.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_op_ctn_status.Panel1Resize(Sender: TObject);
var
i:integer;
begin
i:=round(panel1.Width/8);
bsSkinButton7.Width:=i;
bsSkinButton6.Width:=i;
end;
procedure Tfrm_op_ctn_status.FormShow(Sender: TObject);
begin
t_code_ctn_status.Open;
loadreggrid(dxdbgrid1,true,caption);
end;
procedure Tfrm_op_ctn_status.bsSkinButton44Click(Sender: TObject);
var
ctnstr,ctn:string;
i:integer;
begin
t_op_ctn_status.Close;
t_op_ctn_detail.close;
t_op_ctn_detail.SQL.clear;
t_op_ctn_detail.SQL.add('select v_op_ctnmg_detail.*');
t_op_ctn_detail.SQL.add(',t_op_railway.<2E><><EFBFBD><EFBFBD>,t_op_railway.<2E><EFBFBD><E4B4AC><EFBFBD><EFBFBD>,t_op_railway.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_op_railway.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_op_railway.<2E><><EFBFBD><EFBFBD>վ,t_op_railway.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
t_op_ctn_detail.SQL.add(',status.<2E><><EFBFBD><EFBFBD>,status.<2E><><EFBFBD><EFBFBD>,status.<2E><><EFBFBD><EFBFBD>,status.<2E><><EFBFBD><EFBFBD>,status.<2E><><EFBFBD><EFBFBD>,status.<2E><><EFBFBD><EFBFBD>,status.<2E><><EFBFBD><EFBFBD>');
t_op_ctn_detail.SQL.add('from v_op_ctnmg_detail');
t_op_ctn_detail.SQL.add('left join t_op_railway on v_op_ctnmg_detail.ctnid=t_op_railway.ctnid and t_op_railway.<2E><>Դ in(''<27><>˾<EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>'',''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'')');
t_op_ctn_detail.SQL.add('left join ');
t_op_ctn_detail.SQL.add('(select ctnid');
t_op_ctn_detail.SQL.add(',sum(case when <20><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD>'' then 1 else 0 end) <20><><EFBFBD><EFBFBD>');
t_op_ctn_detail.SQL.add(',sum(case when <20><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD>'' then 1 else 0 end) <20><><EFBFBD><EFBFBD>');
t_op_ctn_detail.SQL.add(',sum(case when <20><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD>'' then 1 else 0 end) <20><><EFBFBD><EFBFBD>');
t_op_ctn_detail.SQL.add(',sum(case when <20><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD>'' then 1 else 0 end) <20><><EFBFBD><EFBFBD>');
t_op_ctn_detail.SQL.add(',sum(case when <20><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD>'' then 1 else 0 end) <20><><EFBFBD><EFBFBD>');
t_op_ctn_detail.SQL.add(',sum(case when <20><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD>'' then 1 else 0 end) <20><><EFBFBD><EFBFBD>');
t_op_ctn_detail.SQL.add(',sum(case when <20><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD>'' then 1 else 0 end) <20><><EFBFBD><EFBFBD>');
t_op_ctn_detail.SQL.add('from t_op_ctnmg_status');
t_op_ctn_detail.SQL.add('group by ctnid) as status on v_op_ctnmg_detail.ctnid=status.ctnid');
t_op_ctn_detail.SQL.add('where 1=1 and '+open_data('0008','v_op_ctnmg_detail.¼<><C2BC><EFBFBD><EFBFBD>','no','no','no','no') );
if Edit2.Text<>'' then
t_op_ctn_detail.SQL.add(' and v_op_ctnmg_detail.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4B5A5>='+''''+edit2.text+'''');
if RxDBLookupCombo4.DisplayValues[1]<>'' then begin
ctn:=RxDBLookupCombo4.DisplayValues[1];
ctn:=StringReplace(ctn,'''','?''',[rfReplaceAll]);
ctn:=StringReplace(ctn,'?','''',[rfReplaceAll]);
t_op_ctn_detail.SQL.add(' and v_op_ctnmg_detail.<2E><><EFBFBD><EFBFBD>='+''''+ctn+'''');
end;
if wwDBDateTimePicker3.text<>''then
t_op_ctn_detail.SQL.add(' and v_op_ctnmg_detail.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>>='+''''+wwDBDateTimePicker3.text+'''');
if wwDBDateTimePicker4.text<>''then
t_op_ctn_detail.SQL.add(' and v_op_ctnmg_detail.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><='+''''+wwDBDateTimePicker4.text+'''');
if Edit1.Text<>'' then
t_op_ctn_detail.SQL.add(' and v_op_ctnmg_detail.<2E><><EFBFBD><EFBFBD>='+''''+edit1.Text+'''');
if RxDBLookupCombo1.DisplayValue<>'' then
t_op_ctn_detail.SQL.add(' and v_op_ctnmg_detail.<2E><>ǰ<EFBFBD><C7B0>̬='+''''+RxDBLookupCombo1.DisplayValue+'''');
if wwDBLookupCombo2.Text<>'' then
t_op_ctn_detail.SQL.add(' and v_op_ctnmg_detail.<2E><>ǰ<EFBFBD>ص<EFBFBD>='+''''+wwDBLookupCombo2.Text+'''');
if RxDBLookupCombo5.DisplayValues[1]<>'' then
t_op_ctn_detail.SQL.add(' and v_op_ctnmg_detail.<2E><>ǰ<EFBFBD><C7B0>վ='+''''+RxDBLookupCombo5.DisplayValues[1]+'''');
if wwDBComboBox3.Text<>'' then
t_op_ctn_detail.SQL.add(' and v_op_ctnmg_detail.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+wwDBComboBox3.text+'''');
if bsSkinCheckRadioBox2.checked then
t_op_ctn_detail.SQL.add(' and ctnid in (select ctnid from t_op_railway where <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>=''<27><>'' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> is null)');
if bsSkinCheckRadioBox3.checked then
t_op_ctn_detail.SQL.add(' and ctnid in (select ctnid from t_op_railway where <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>=''<27><>'' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> is null and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> is null)');
if Memo1.Lines.Count<>0 then begin
ctnstr:=ctnstr+'and (';
for i:=0 to Memo1.Lines.Count-1 do begin
if i=0 then
ctnstr:=ctnstr+'v_op_ctnmg_detail.<2E><><EFBFBD><EFBFBD>='+''''+Trim(Memo1.Lines.Strings[i])+''''
else
ctnstr:=ctnstr+' or v_op_ctnmg_detail.<2E><><EFBFBD><EFBFBD>='+''''+Trim(Memo1.Lines.Strings[i])+'''';
end;
ctnstr:=ctnstr+') ';
end else begin
if Edit1.Text<>'' then
ctnstr:=' and v_op_ctnmg_detail.<2E><><EFBFBD><EFBFBD>='+''''+Trim(Edit1.Text)+'''';
end;
if ctnstr<>'' then
t_op_ctn_detail.SQL.add(ctnstr);
t_op_ctn_detail.SQL.add(' order by v_op_ctnmg_detail.ctnid');
t_op_ctn_detail.open;
t_op_ctn_status.Open;
end;
procedure Tfrm_op_ctn_status.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key<>#13 then exit;
if (Trim(Edit1.Text)<>'') then begin
Memo1.Lines.Add(Trim(Edit1.Text));
Edit1.Text:='';
end;
end;
procedure Tfrm_op_ctn_status.bsSkinButton2Click(Sender: TObject);
var
i:Integer;
aQuery:TADOQuery;
begin
if RxDBLookupCombo2.DisplayValue='' then begin
MessageDlg('<27><>̬<EFBFBD><CCAC><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbyes],0);
exit;
end;
if wwDBDateTimePicker5.Text='' then begin
MessageDlg('<27><>̬<EFBFBD><CCAC><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbyes],0);
exit;
end;
if RxDBLookupCombo2.DisplayValue='<27><><EFBFBD><EFBFBD>' then begin
if RxDBLookupCombo9.DisplayValue='' then begin
MessageDlg('<27><>վ<EFBFBD><D5BE><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbyes],0);
exit;
end;
end;
if dxdbgrid1.SelectedCount>0 then
begin
for i:=0 to dxdbgrid1.SelectedCount-1 do
begin
t_op_ctn_detail.GotoBookmark(pointer(dxdbgrid1.selectedrows[i]));
if t_op_ctn_detail.FieldByName('<27><>ǰ<EFBFBD><C7B0>̬').AsString<>'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
t_op_ctn_detail.Edit;
t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0>̬']:=RxDBLookupCombo2.DisplayValue;
t_op_ctn_detail['<27><>̬ʱ<CCAC><CAB1>']:=wwDBDateTimePicker5.Date;
if Edit5.Text<>'' then
t_op_ctn_detail['<27><><EFBFBD><EFBFBD><E1B5A5>']:=Edit5.Text;
if wwDBComboBox1.Text<>'' then
t_op_ctn_detail['<27><>ǰ״̬']:=wwDBComboBox1.Text;
if wwDBComboBox2.Text<>'' then begin
if wwDBComboBox2.Text='<27><>' then
t_op_ctn_detail['<27><><EFBFBD><EFBFBD>']:=true;
if wwDBComboBox2.Text='<27><>' then
t_op_ctn_detail['<27><><EFBFBD><EFBFBD>']:=false;
end;
// if wwDBLookupCombo3.Text<>'' then
t_op_ctn_detail['<27><>ǰ<EFBFBD>ص<EFBFBD>']:=wwDBLookupCombo3.Text;
if edit3.text<>'' then
t_op_ctn_detail['<27><>ע']:=edit3.Text;
// if RxDBLookupCombo9.DisplayValues[1]<>'' then
t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0>վ']:=RxDBLookupCombo9.DisplayValues[1];
t_op_ctn_detail.Post;
t_op_ctn_status.Insert;
t_op_ctn_status.Post;
if (RxDBLookupCombo2.DisplayValue='<27><><EFBFBD><EFBFBD>') or (RxDBLookupCombo2.DisplayValue='<27><><EFBFBD><EFBFBD>') or (RxDBLookupCombo2.DisplayValue='<27><><EFBFBD><EFBFBD>') then begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
close;
if RxDBLookupCombo2.DisplayValue='<27><><EFBFBD><EFBFBD>' then begin
SQL.text:='update t_op_railway set <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>=''<27><>'',<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> where ctnid='+t_op_ctn_status.fieldbyname('ctnid').AsString;
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=wwDBDateTimePicker5.Date;
ExecSQL;
end;
if RxDBLookupCombo2.DisplayValue='<27><><EFBFBD><EFBFBD>' then begin
SQL.text:='update t_op_railway set <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> where ctnid='+t_op_ctn_status.fieldbyname('ctnid').AsString;
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=wwDBDateTimePicker5.Date;
ExecSQL;
end;
if RxDBLookupCombo2.DisplayValue='<27><><EFBFBD><EFBFBD>' then begin
SQL.text:='update t_op_railway set <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>ܶѳ<DCB6>=:<3A><><EFBFBD>ܶѳ<DCB6> where ctnid='+t_op_ctn_status.fieldbyname('ctnid').AsString;
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=wwDBDateTimePicker5.Date;
aQuery.Parameters.ParamByName('<27><><EFBFBD>ܶѳ<DCB6>').Value:=RxDBLookupCombo9.DisplayValues[1];
ExecSQL;
end;
end;
finally
FreeAndNil(aQuery);
end;
end;
end else begin
end;
end;
end
{
t_op_ctn_detail.First;
while not t_op_ctn_detail.Eof do begin
if t_op_ctn_detail.FieldByName('<27><>ǰ<EFBFBD><C7B0>̬').AsString<>'<27>ѻ<EFBFBD><D1BB><EFBFBD>' then begin
t_op_ctn_detail.Edit;
t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0>̬']:=RxDBLookupCombo2.DisplayValue;
t_op_ctn_detail['<27><>̬ʱ<CCAC><CAB1>']:=wwDBDateTimePicker5.Date;
if Edit5.Text<>'' then
t_op_ctn_detail['<27><>ǰ<EFBFBD><EFBFBD><E1B5A5>']:=Edit5.Text;
if wwDBLookupCombo1.Text<>'' then
t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>']:=wwDBLookupCombo1.Text;
if Edit4.Text<>'' then
t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>']:=Edit4.Text;
if RxDBLookupCombo9.DisplayValues[1]<>'' then
t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0>վ']:=RxDBLookupCombo9.DisplayValues[1];
t_op_ctn_detail.Post;
t_op_ctn_status.Insert;
t_op_ctn_status.Post;
end else begin
end;
t_op_ctn_detail.Next;
end;
}
end;
procedure Tfrm_op_ctn_status.bsSkinButton4Click(Sender: TObject);
var
i:Integer;
begin
if MessageDlg('ȷʵҪȷ<D2AA>ϻ<EFBFBD><CFBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbYes,mbNo],0)<>mryes then
exit;
if wwDBDateTimePicker5.Text='' then begin
MessageDlg('<27><>̬<EFBFBD><CCAC><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>',mtWarning,[mbyes],0);
exit;
end;
if dxdbgrid1.SelectedCount>0 then
begin
for i:=0 to dxdbgrid1.SelectedCount-1 do
begin
t_op_ctn_detail.GotoBookmark(pointer(dxdbgrid1.selectedrows[i]));
t_op_ctn_detail.Edit;
t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0>̬']:='<27>ѻ<EFBFBD><D1BB><EFBFBD>';
t_op_ctn_detail['<27><>̬ʱ<CCAC><CAB1>']:=wwDBDateTimePicker5.Date;
t_op_ctn_detail['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=1;
t_op_ctn_detail['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>']:=wwDBDateTimePicker5.Date;
if Edit5.Text<>'' then
t_op_ctn_detail['<27><><EFBFBD><EFBFBD><E1B5A5>']:=Edit5.Text;
if RxDBLookupCombo9.DisplayValues[1]<>'' then
t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0>վ']:=RxDBLookupCombo9.DisplayValues[1];
if edit3.text<>'' then
t_op_ctn_detail['<27><>ע']:=edit3.Text;
t_op_ctn_detail.Post;
end;
end
{
t_op_ctn_detail.First;
while not t_op_ctn_detail.Eof do begin
t_op_ctn_detail.Edit;
t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0>̬']:='<27>ѻ<EFBFBD><D1BB><EFBFBD>';
t_op_ctn_detail['<27><>̬ʱ<CCAC><CAB1>']:=wwDBDateTimePicker5.Date;
t_op_ctn_detail['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=1;
t_op_ctn_detail['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>']:=wwDBDateTimePicker5.Date;
if Edit5.Text<>'' then
t_op_ctn_detail['<27><>ǰ<EFBFBD><EFBFBD><E1B5A5>']:=Edit5.Text;
if wwDBLookupCombo1.Text<>'' then
t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>']:=wwDBLookupCombo1.Text;
if Edit4.Text<>'' then
t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>']:=Edit4.Text;
if RxDBLookupCombo9.DisplayValues[1]<>'' then
t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0>վ']:=RxDBLookupCombo9.DisplayValues[1];
t_op_ctn_detail.Post;
t_op_ctn_detail.Next;
end;
}
end;
procedure Tfrm_op_ctn_status.t_op_ctn_statusAfterInsert(DataSet: TDataSet);
function getmaxno:Integer;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('select MAx(stno) stno from t_op_ctn_status where ctnid='+t_op_ctn_detail.fieldbyname('ctnid').AsString);
open;
if IsEmpty then
result:=1
else
Result:=fieldbyname('stno').AsInteger+1;
end;
finally
FreeAndNil(aQuery);
end;
end;
begin
t_op_ctn_status['ctnid']:=t_op_ctn_detail['ctnid'];
// t_op_ctn_status['stno']:=getmaxno;
t_op_ctn_status['<27><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>']:=t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0>̬'];
t_op_ctn_status['<27><>̬ʱ<CCAC><CAB1>']:=t_op_ctn_detail['<27><>̬ʱ<CCAC><CAB1>'];
t_op_ctn_status['״̬']:=t_op_ctn_detail['<27><>ǰ״̬'];
t_op_ctn_status['<27><><EFBFBD><EFBFBD>']:=t_op_ctn_detail['<27><><EFBFBD><EFBFBD>'];
t_op_ctn_status['<27><><EFBFBD><EFBFBD>Ա']:=employee;
t_op_ctn_status['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>']:=now;
t_op_ctn_status['<27><EFBFBD><E1B5A5>']:=t_op_ctn_detail['<27><><EFBFBD><EFBFBD><E1B5A5>'];
t_op_ctn_status['<27>ص<EFBFBD>']:=t_op_ctn_detail['<27><>ǰ<EFBFBD>ص<EFBFBD>'];
t_op_ctn_status['<27><>վ']:=t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0>վ'];
t_op_ctn_status['<27><>ע']:=t_op_ctn_detail['<27><>ע'];
end;
procedure Tfrm_op_ctn_status.bsSkinButton3Click(Sender: TObject);
var
aQuery:TADOQuery;
i:Integer;
begin
if MessageDlg('ȷʵҪȡ<D2AA><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbYes,mbNo],0)<>mryes then
exit;
aQuery:=CreateAdoQuery;
TRY
if dxdbgrid1.SelectedCount>0 then
begin
for i:=0 to dxdbgrid1.SelectedCount-1 do
begin
t_op_ctn_detail.GotoBookmark(pointer(dxdbgrid1.selectedrows[i]));
if t_op_ctn_detail.FieldByName('<27><>ǰ<EFBFBD><C7B0>̬').AsString='<27>ѻ<EFBFBD><D1BB><EFBFBD>' then
begin
aQuery.SQL.Text:='select * from t_op_ctn_status where <20><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><>''<27>ѻ<EFBFBD><D1BB><EFBFBD>'' and ctnid='+t_op_ctn_detail.fieldbyname('ctnid').AsString+' order by stid desc';
aQuery.Open;
t_op_ctn_detail.Edit;
t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0>̬']:=aQuery.fieldbyname('<27><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>').AsString;
t_op_ctn_detail['<27><>̬ʱ<CCAC><CAB1>']:=aQuery['<27><>̬ʱ<CCAC><CAB1>'];
t_op_ctn_detail['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=0;
t_op_ctn_detail['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>']:=null;
t_op_ctn_detail['<27><>ǰ<EFBFBD><EFBFBD><E1B5A5>']:=aQuery.fieldbyname('<27><EFBFBD><E1B5A5>').AsString;
t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>']:=aQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>']:=aQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0>վ']:=aQuery.fieldbyname('<27><>վ').AsString;
t_op_ctn_detail.Post;
end;
end;
end
{
t_op_ctn_detail.First;
while not t_op_ctn_detail.Eof do begin
if t_op_ctn_detail.FieldByName('<27><>ǰ<EFBFBD><C7B0>̬').AsString='<27>ѻ<EFBFBD><D1BB><EFBFBD>' then begin
aQuery.SQL.Text:='select * from t_op_ctn_status where <20><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><>''<27>ѻ<EFBFBD><D1BB><EFBFBD>'' and ctnid='+t_op_ctn_detail.fieldbyname('ctnid').AsString+' order by stid desc';
aQuery.Open;
t_op_ctn_detail.Edit;
t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0>̬']:=aQuery.fieldbyname('<27><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>').AsString;
t_op_ctn_detail['<27><>̬ʱ<CCAC><CAB1>']:=aQuery['<27><>̬ʱ<CCAC><CAB1>'];
t_op_ctn_detail['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=0;
t_op_ctn_detail['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>']:=null;
t_op_ctn_detail['<27><>ǰ<EFBFBD><EFBFBD><E1B5A5>']:=aQuery.fieldbyname('<27><EFBFBD><E1B5A5>').AsString;
t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>']:=aQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>']:=aQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
t_op_ctn_detail['<27><>ǰ<EFBFBD><C7B0>վ']:=aQuery.fieldbyname('<27><>վ').AsString;
t_op_ctn_detail.Post;
end;
t_op_ctn_detail.Next;
end;
}
finally
FreeAndNil(aQuery);
end;
end;
procedure Tfrm_op_ctn_status.bsSkinCheckRadioBox1Click(Sender: TObject);
begin
if bsSkinCheckRadioBox1.Checked then
begin
t_op_railway.Close;
t_op_railway.Open;
bsSkinGroupBox7.Visible:=True;
end else begin
t_op_railway.Close;
bsSkinGroupBox7.Visible:=false;
end;
end;
procedure Tfrm_op_ctn_status.N16Click(Sender: TObject);
begin
with SaveDialog do
begin
DefaultExt :='xls';
Filter := '(*.xls)|*.xls';
if Execute then
begin
dxDBGrid1.SaveToXLS(FileName,true);
end;
end;
end;
procedure Tfrm_op_ctn_status.MenuItem1Click(Sender: TObject);
begin
if MessageDlg('ȷʵҪɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>',mtWarning,[mbYes,mbNo],0)<>mryes then
exit;
t_op_ctn_status.delete;
end;
procedure Tfrm_op_ctn_status.t_op_ctn_detailCalcFields(DataSet: TDataSet);
var RecordStatus:TRecordStatus;
begin
t_op_ctn_detail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=GetCtnStatus(t_op_ctn_detail.FieldByName('ctnid').AsInteger,'<27><><EFBFBD><EFBFBD>');
RecordStatus:=GetczCtnStatus(t_op_ctn_detail.FieldByName('ctnid').AsInteger,'<27><><EFBFBD><EFBFBD>');
t_op_ctn_detail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=RecordStatus.StatusDate;
t_op_ctn_detail.FieldByName('<27><><EFBFBD>䳡վ').AsString:=RecordStatus.statusCz;
end;
end.