241 lines
6.2 KiB
ObjectPascal
241 lines
6.2 KiB
ObjectPascal
unit U_FactoryGYS;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
|
||
cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin, StdCtrls,
|
||
cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
|
||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
|
||
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
|
||
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
|
||
IdTCPClient, IdFTP, ShellAPI, IniFiles, cxCheckBox, cxCalendar, cxButtonEdit,
|
||
cxTextEdit, cxDBLookupComboBox;
|
||
|
||
type
|
||
TfrmFactoryGYS = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBClose: TToolButton;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
Panel1: TPanel;
|
||
ToolButton2: TToolButton;
|
||
ADOQueryMain: TADOQuery;
|
||
RM1: TRMGridReport;
|
||
RMDB_Main: TRMDBDataSet;
|
||
Label3: TLabel;
|
||
Name: TEdit;
|
||
cxGrid2: TcxGrid;
|
||
Tv2: TcxGridDBTableView;
|
||
cxGridLevel1: TcxGridLevel;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
DS_HZ: TDataSource;
|
||
CDS_HZ: TClientDataSet;
|
||
v2Column6: TcxGridDBColumn;
|
||
v2Column1: TcxGridDBColumn;
|
||
v2Column2: TcxGridDBColumn;
|
||
v2Column7: TcxGridDBColumn;
|
||
Label1: TLabel;
|
||
Code: TEdit;
|
||
v2DEFStr7: TcxGridDBColumn;
|
||
v2Column12: TcxGridDBColumn;
|
||
area: TEdit;
|
||
Label4: TLabel;
|
||
v2Column15: TcxGridDBColumn;
|
||
CDS_LXR: TClientDataSet;
|
||
DSLXR: TDataSource;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v3Column3: TcxGridDBColumn;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
cxGridDBColumn2: TcxGridDBColumn;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
cxGridDBColumn4: TcxGridDBColumn;
|
||
cxGridDBColumn5: TcxGridDBColumn;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
v3Column2: TcxGridDBColumn;
|
||
cxGridLevel2: TcxGridLevel;
|
||
v2Column3: TcxGridDBColumn;
|
||
FactType: TComboBox;
|
||
Label5: TLabel;
|
||
v2Column4: TcxGridDBColumn;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBDelClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure NameChange(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure TBuserClick(Sender: TObject);
|
||
procedure Tv2FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
procedure Tv2DblClick(Sender: TObject);
|
||
private
|
||
|
||
{ Private declarations }
|
||
procedure InitGrid();
|
||
public
|
||
end;
|
||
|
||
var
|
||
frmFactoryGYS: TfrmFactoryGYS;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_Fun, U_ZDYHelp, U_FactoryInput;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmFactoryGYS.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select * from BS_Company_Main A left join BS_Company_Sub B ');
|
||
sql.Add(' on A.CoID=B.CoID and B.IsDefault=1 where A.CoType=''<27><>Ӧ<EFBFBD><D3A6>'' and A.Valid=''Y'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, CDS_HZ);
|
||
SInitCDSData20(ADOQueryMain, CDS_HZ);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmFactoryGYS.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmFactoryGYS := nil;
|
||
end;
|
||
|
||
procedure TfrmFactoryGYS.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmFactoryGYS.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(trim(self.caption), Tv2, '<27><>Ӧ<EFBFBD>̹<EFBFBD><CCB9><EFBFBD>');
|
||
ModalResult := 1;
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmFactoryGYS.TBDelClick(Sender: TObject);
|
||
begin
|
||
if CDS_HZ.IsEmpty then
|
||
Exit;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
if Trim(CDS_HZ.fieldbyname('COID').AsString) <> '' then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('update BS_Company_Main set Valid=''N'' where COID=''' + Trim(CDS_HZ.fieldbyname('COID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
CDS_HZ.Delete;
|
||
end;
|
||
|
||
procedure TfrmFactoryGYS.FormShow(Sender: TObject);
|
||
begin
|
||
ReadCxGrid(trim(self.Caption), Tv2, '<27><>Ӧ<EFBFBD>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmFactoryGYS.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmFactoryGYS.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS20(ADOQueryMain, CDS_HZ);
|
||
SInitCDSData20(ADOQueryMain, CDS_HZ);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmFactoryGYS.NameChange(Sender: TObject);
|
||
begin
|
||
ToolButton2.Click;
|
||
end;
|
||
|
||
procedure TfrmFactoryGYS.ToolButton4Click(Sender: TObject);
|
||
begin
|
||
if CDS_HZ.IsEmpty then
|
||
exit;
|
||
try
|
||
frmFactoryInput := TfrmFactoryInput.Create(Application);
|
||
with frmFactoryInput do
|
||
begin
|
||
FCOID := Trim(Self.CDS_HZ.fieldbyname('COID').AsString);
|
||
if ShowModal = 1 then
|
||
begin
|
||
TBRafresh.Click;
|
||
end;
|
||
end;
|
||
finally
|
||
frmFactoryInput.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmFactoryGYS.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmFactoryInput := TfrmFactoryInput.Create(Application);
|
||
with frmFactoryInput do
|
||
begin
|
||
FCOID := '';
|
||
if ShowModal = 1 then
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmFactoryInput.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmFactoryGYS.TBuserClick(Sender: TObject);
|
||
var
|
||
FuserName: string;
|
||
begin
|
||
|
||
end;
|
||
|
||
procedure TfrmFactoryGYS.Tv2FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select * from BS_Company_Sub where COID=' + quotedstr(Trim(CDS_HZ.FieldByName('COID').AsString)));
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_LXR);
|
||
SInitCDSData20(ADOQueryTemp, CDS_LXR);
|
||
end;
|
||
|
||
procedure TfrmFactoryGYS.Tv2DblClick(Sender: TObject);
|
||
begin
|
||
ModalResult := 1;
|
||
end;
|
||
|
||
end.
|
||
|