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.

437 lines
12 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

unit u_piliang_railway_state;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bsSkinCtrls, BusinessSkinForm, dxExEdtr, dxDBTLCl, dxGrClms,
dxDBGrid, dxTL, dxDBCtrl, dxCntner, DB, ADODB, Grids, DBGrids,
kbmMemTable, ExtCtrls, XPMenu, Menus;
type
Tfrm_piliang_railway_state = class(TForm)
bsSkinPanel1: TbsSkinPanel;
bsBusinessSkinForm1: TbsBusinessSkinForm;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridMaskColumn;
dxDBGrid1Column4: TdxDBGridMaskColumn;
dxDBGrid1Column6: TdxDBGridMaskColumn;
dxDBGrid1Column7: TdxDBGridMaskColumn;
dxDBGrid1Column16: TdxDBGridDateColumn;
dxDBGrid1Column19: TdxDBGridMaskColumn;
dxDBGrid1Column20: TdxDBGridMaskColumn;
dxDBGrid1Column64: TdxDBGridMaskColumn;
dxDBGrid1Column65: TdxDBGridDateColumn;
dxDBGrid1Column66: TdxDBGridMaskColumn;
dxDBGrid1Column67: TdxDBGridMaskColumn;
t_op_seae: TADOStoredProc;
t_op_state: TkbmMemTable;
Panel1: TPanel;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton11: TbsSkinButton;
bsSkinButton7: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
dxDBGrid2: TdxDBGrid;
dxDBGridMaskColumn1: TdxDBGridMaskColumn;
dxDBGrid1Column2: TdxDBGridCheckColumn;
dxDBGrid1Column3: TdxDBGridDateColumn;
dxDBGridMaskColumn2: TdxDBGridMaskColumn;
dxDBGridMaskColumn3: TdxDBGridMaskColumn;
dxDBGridMaskColumn4: TdxDBGridMaskColumn;
dxDBGridDateColumn1: TdxDBGridDateColumn;
dxDBGrid1Column8: TdxDBGridColumn;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
XPMenu1: TXPMenu;
bsSkinButton5: TbsSkinButton;
bsSkinSplitter1: TbsSkinSplitter;
t_op_state1: TDataSource;
t_op_seae1: TDataSource;
t_op_stateField2: TStringField;
t_op_stateField3: TBooleanField;
t_op_stateField4: TDateTimeField;
t_op_stateField5: TStringField;
t_op_stateField6: TStringField;
t_op_stateField7: TStringField;
t_op_stateField8: TDateTimeField;
t_op_stateField9: TIntegerField;
bsSkinButton6: TbsSkinButton;
t_op_state2: TADOQuery;
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton6Click(Sender: TObject);
procedure t_op_stateAfterInsert(DataSet: TDataSet);
procedure t_op_stateBeforeDelete(DataSet: TDataSet);
procedure bsSkinButton11Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure bsSkinButton9Click(Sender: TObject);
procedure bsSkinButton7Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure t_op_state2AfterInsert(DataSet: TDataSet);
private
procedure add_state_menu(n1:TPopupMenu);
procedure add_state(Sender:TObject);
procedure add_all(Sender:TObject);
{ Private declarations }
public
{ Public declarations }
end;
var
frm_piliang_railway_state: Tfrm_piliang_railway_state;
implementation
uses u_main, my_sys_function, u_data_share, u_op_state_add,
u_piliang_send_msg;
{$R *.dfm}
procedure Tfrm_piliang_railway_state.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_piliang_railway_state.bsSkinButton1Click(Sender: TObject);
var
Pnt:Tpoint;
begin
Pnt:=bsSkinButton1.ClientToScreen(Point(0,bsSkinButton1.Height));
PopupMenu1.Popup(Pnt.x,Pnt.y);
end;
procedure Tfrm_piliang_railway_state.add_state_menu(n1:TPopupMenu);
var
nn:Tmenuitem;
i:integer;
begin
nn:=Tmenuitem.Create(application);
with nn do
begin
caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬ ';
onclick:=add_all;
n1.Items.Add(nn);
end;
i:=0;
frm_data_share.t_code_state.first;
while not frm_data_share.t_code_state.eof do
begin
i:=i+1;
nn:=Tmenuitem.Create(application);
with nn do
begin
caption:='-';
n1.Items.Add(nn);
end;
nn:=Tmenuitem.Create(application);
with nn do
begin
caption:=frm_data_share.t_code_state.fieldbyname('ҵ<><D2B5>״̬').asstring;
nn.Hint:=frm_data_share.t_code_state.fieldbyname('˳<><CBB3>').asstring;
onclick:=add_state;
n1.Items.Add(nn);
end;
frm_data_share.t_code_state.next;
end;
end;
procedure Tfrm_piliang_railway_state.add_state(Sender:TObject);
var
menu_skins:Tmenuitem;
begin
menu_skins:= Sender as Tmenuitem;
try
modify_all:=true;
t_op_state.Append;
t_op_state['ҵ<><D2B5>״̬']:=menu_skins.caption;
try
t_op_state['˳<><CBB3>']:=strtoint(menu_skins.Hint);
except
t_op_state['˳<><CBB3>']:=0;
end;
t_op_state.post;
finally
modify_all:=false;
end;
end;
procedure Tfrm_piliang_railway_state.add_all(Sender:TObject);
var
menu_skins:Tmenuitem;
begin
menu_skins:= Sender as Tmenuitem;
try
modify_all:=true;
frm_data_share.t_code_state.first;
while not frm_data_share.t_code_state.eof do
begin
t_op_state.Append;
t_op_state['ҵ<><D2B5>״̬']:=frm_data_share.t_code_state.fieldbyname('ҵ<><D2B5>״̬').asstring;
t_op_state['˳<><CBB3>']:=frm_data_share.t_code_state.fieldbyname('˳<><CBB3>').asinteger;
t_op_state.post;
frm_data_share.t_code_state.next;
end;
finally
modify_all:=false;
end;
end;
procedure Tfrm_piliang_railway_state.bsSkinButton6Click(Sender: TObject);
begin
try
frm_op_state_add:=tfrm_op_state_add.Create (self);
frm_data_share.t_code_state_project.Filtered:=false;
frm_data_share.t_code_state_project.requery;
frm_data_share.t_code_state_project.Filter:='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+'<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'+'''';
frm_data_share.t_code_state_project.Filtered:=true;
frm_op_state_add.DataSource1.DataSet:=t_op_state;
frm_op_state_add.ShowModal;
finally
frm_op_state_add.Free;
frm_op_state_add:=nil;
end;
end;
procedure Tfrm_piliang_railway_state.t_op_stateAfterInsert(DataSet: TDataSet);
begin
t_op_state['¼<><C2BC><EFBFBD><EFBFBD>']:=employee;
t_op_state['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
end;
procedure Tfrm_piliang_railway_state.t_op_stateBeforeDelete(
DataSet: TDataSet);
begin
if t_op_state.FieldByName('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>').asboolean then
begin
showmessage('ҵ<><D2B5>״̬<D7B4>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
abort;
end;
end;
procedure Tfrm_piliang_railway_state.bsSkinButton11Click(Sender: TObject);
var
str:string;
begin
str:=t_op_state.fieldbyname('ҵ<><D2B5>״̬').asstring;
if t_op_state.IsEmpty then
exit;
t_op_seae.First;
while not t_op_seae.Eof do begin
try
modify_all:=true;
t_op_seae.edit;
if t_op_seae.FieldByName('ҵ<><D2B5>״̬').AsString<>'ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
t_op_seae['ҵ<><D2B5>״̬']:=str;
t_op_seae.Post;
finally
modify_all:=false;
end;
t_op_seae.Next;
end;
end;
procedure Tfrm_piliang_railway_state.FormShow(Sender: TObject);
begin
frm_data_share.t_code_state.Filtered:=false;
frm_data_share.t_code_state.Filter:='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+'<27><>·<EFBFBD><C2B7><EFBFBD><EFBFBD>'+'''';
frm_data_share.t_code_state.Filtered:=true;
PopupMenu1.Items.Clear;
add_state_menu(PopupMenu1);
if (yctx<>'<27><><EFBFBD><EFBFBD>') then bsSkinButton8.Visible:=false;
end;
procedure Tfrm_piliang_railway_state.bsSkinButton9Click(Sender: TObject);
var
book1:Tbookmark;
begin
if t_op_state.isempty then
exit;
if not t_op_state.FieldByName('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>').asboolean then
begin
t_op_state.edit;
t_op_state['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=1;
t_op_state['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>']:=date;
t_op_state['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=employee;
t_op_state.post;
end;
book1:=t_op_state.GetBookmark;
t_op_seae.First;
while not t_op_seae.Eof do begin
t_op_state2.Open;
t_op_state.First;
while not t_op_state.Eof do begin
if t_op_state2.Locate('ҵ<><D2B5>״̬',t_op_state['ҵ<><D2B5>״̬'],[]) then begin
t_op_state2.Edit;
t_op_state2['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=t_op_state['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>'];
t_op_state2['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_op_state['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_op_state2['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>']:=t_op_state['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>'];
t_op_state2['<27><>ע']:=t_op_state['<27><>ע'];
t_op_state2['¼<><C2BC><EFBFBD><EFBFBD>']:=t_op_state['¼<><C2BC><EFBFBD><EFBFBD>'];
t_op_state2['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_op_state['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_op_state2.Post;
end else begin
t_op_state2.insert;
t_op_state2['ҵ<><D2B5>״̬']:=t_op_state['ҵ<><D2B5>״̬'];
t_op_state2['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=t_op_state['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>'];
t_op_state2['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>']:=t_op_state['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>'];
t_op_state2['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_op_state['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_op_state2['<27><>ע']:=t_op_state['<27><>ע'];
t_op_state2['¼<><C2BC><EFBFBD><EFBFBD>']:=t_op_state['¼<><C2BC><EFBFBD><EFBFBD>'];
t_op_state2['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_op_state['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_op_state2.Post;
end;
t_op_state.Next;
end;
t_op_state2.close;
t_op_seae.next;
end;
t_op_state.GotoBookmark(book1);
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD>');
end;
procedure Tfrm_piliang_railway_state.bsSkinButton7Click(Sender: TObject);
var
book1:Tbookmark;
begin
if t_op_state.isempty then
exit;
if t_op_state.FieldByName('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>').asboolean then
begin
t_op_state.edit;
t_op_state['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=0;
t_op_state['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>']:=null;
t_op_state['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=null;
t_op_state.post;
end;
book1:=t_op_state.GetBookmark;
t_op_seae.First;
while not t_op_seae.Eof do begin
t_op_state2.Open;
t_op_state.First;
while not t_op_state.Eof do begin
if t_op_state2.Locate('ҵ<><D2B5>״̬',t_op_state['ҵ<><D2B5>״̬'],[]) then begin
t_op_state2.Edit;
t_op_state2['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=t_op_state['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>'];
t_op_state2['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_op_state['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_op_state2['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>']:=t_op_state['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>'];
t_op_state2['<27><>ע']:=t_op_state['<27><>ע'];
t_op_state2['¼<><C2BC><EFBFBD><EFBFBD>']:=t_op_state['¼<><C2BC><EFBFBD><EFBFBD>'];
t_op_state2['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_op_state['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_op_state2.Post;
end else begin
t_op_state2.insert;
t_op_state2['ҵ<><D2B5>״̬']:=t_op_state['ҵ<><D2B5>״̬'];
t_op_state2['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=t_op_state['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>'];
t_op_state2['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>']:=t_op_state['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>'];
t_op_state2['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_op_state['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_op_state2['<27><>ע']:=t_op_state['<27><>ע'];
t_op_state2['¼<><C2BC><EFBFBD><EFBFBD>']:=t_op_state['¼<><C2BC><EFBFBD><EFBFBD>'];
t_op_state2['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_op_state['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_op_state2.Post;
end;
t_op_state.Next;
end;
t_op_state2.close;
t_op_seae.next;
end;
t_op_state.GotoBookmark(book1);
end;
procedure Tfrm_piliang_railway_state.bsSkinButton4Click(Sender: TObject);
begin
if t_op_state.isempty then
exit;
if application.MessageBox('<27><>ȷ<EFBFBD><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?','<27><><EFBFBD><EFBFBD>:',MB_OKCANCEL)<>IDOK then
exit;
if dxDBGrid1.SelectedCount>=1 then
begin
while dxDBGrid1.SelectedCount>0 do
begin
t_op_state.GotoBookmark(pointer(dxDBGrid1.selectedrows[0]));
t_op_seae.First;
while not t_op_seae.Eof do begin
t_op_state2.Open;
if t_op_state2.Locate('ҵ<><D2B5>״̬',t_op_state['ҵ<><D2B5>״̬'],[]) then begin
t_op_state2.Delete;
end;
t_op_state2.close;
t_op_seae.next;
end;
t_op_state.Delete;
end;
end
else
begin
t_op_seae.First;
while not t_op_seae.Eof do begin
t_op_state2.Open;
if t_op_state2.Locate('ҵ<><D2B5>״̬',t_op_state['ҵ<><D2B5>״̬'],[]) then begin
t_op_state2.Delete;
end;
t_op_state2.close;
t_op_seae.next;
end;
t_op_state.Delete;
end;
end;
procedure Tfrm_piliang_railway_state.bsSkinButton2Click(Sender: TObject);
begin
t_op_seae.First;
while not t_op_seae.Eof do begin
t_op_state2.Open;
t_op_state.First;
while not t_op_state.Eof do begin
if t_op_state2.Locate('ҵ<><D2B5>״̬',t_op_state['ҵ<><D2B5>״̬'],[]) then begin
t_op_state2.Edit;
t_op_state2['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=t_op_state['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>'];
t_op_state2['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_op_state['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_op_state2['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>']:=t_op_state['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>'];
t_op_state2['<27><>ע']:=t_op_state['<27><>ע'];
t_op_state2['¼<><C2BC><EFBFBD><EFBFBD>']:=t_op_state['¼<><C2BC><EFBFBD><EFBFBD>'];
t_op_state2['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_op_state['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_op_state2.Post;
end else begin
t_op_state2.insert;
t_op_state2['ҵ<><D2B5>״̬']:=t_op_state['ҵ<><D2B5>״̬'];
t_op_state2['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=t_op_state['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>'];
t_op_state2['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>']:=t_op_state['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>'];
t_op_state2['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_op_state['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_op_state2['<27><>ע']:=t_op_state['<27><>ע'];
t_op_state2['¼<><C2BC><EFBFBD><EFBFBD>']:=t_op_state['¼<><C2BC><EFBFBD><EFBFBD>'];
t_op_state2['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_op_state['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_op_state2.Post;
end;
t_op_state.Next;
end;
t_op_state2.close;
t_op_seae.next;
end;
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD>');
end;
procedure Tfrm_piliang_railway_state.t_op_state2AfterInsert(
DataSet: TDataSet);
begin
t_op_state2['<27><><EFBFBD><EFBFBD>']:=t_op_seae['<27><><EFBFBD><EFBFBD>'];
end;
end.