272 lines
6.7 KiB
ObjectPascal
272 lines
6.7 KiB
ObjectPascal
unit U_PrtDyeInfoList;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
||
cxEdit, DB, cxDBData, cxGridCustomTableView, cxGridTableView,
|
||
cxGridBandedTableView, cxGridDBBandedTableView, cxGridLevel, cxClasses,
|
||
cxControls, cxGridCustomView, cxGridDBTableView, cxGrid, StdCtrls, ComCtrls,
|
||
ExtCtrls, ToolWin, cxGridCustomPopupMenu, cxGridPopupMenu, ADODB, DBClient,
|
||
cxDropDownEdit, cxCheckBox, RM_Common, RM_Class, RM_e_Xls, RM_Dataset,
|
||
RM_System, RM_GridReport, Menus, cxCalendar, cxButtonEdit, cxTextEdit, cxPC,
|
||
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu,
|
||
dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, U_BaseList, cxContainer;
|
||
|
||
type
|
||
TfrmPrtDyeInfoList = class(TfrmBaseList)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBExport: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
CDS_Main: TClientDataSet;
|
||
RM1: TRMGridReport;
|
||
RMDBMain: TRMDBDataSet;
|
||
RMXLSExport1: TRMXLSExport;
|
||
RMDBHZ: TRMDBDataSet;
|
||
CDS_HZ: TClientDataSet;
|
||
CDS_PRT: TClientDataSet;
|
||
TBDel: TToolButton;
|
||
PopupMenu1: TPopupMenu;
|
||
N1: TMenuItem;
|
||
N2: TMenuItem;
|
||
TBAdd: TToolButton;
|
||
TBEdit: TToolButton;
|
||
Label3: TLabel;
|
||
Label8: TLabel;
|
||
P_Name: TcxTextEdit;
|
||
P_Spec: TcxTextEdit;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v2Column1: TcxGridDBColumn;
|
||
v1Column8: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column12: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
v1Column17: TcxGridDBColumn;
|
||
v1Column18: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
Tv1Column2: TcxGridDBColumn;
|
||
Label1: TLabel;
|
||
P_Code: TcxTextEdit;
|
||
ToolButton1: TToolButton;
|
||
Tv1Column3: TcxGridDBColumn;
|
||
Tv1Column4: TcxGridDBColumn;
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ConNoMChange(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBExportClick(Sender: TObject);
|
||
procedure TBFindClick(Sender: TObject);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure TBDelClick(Sender: TObject);
|
||
procedure TBAddClick(Sender: TObject);
|
||
procedure TBEditClick(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
private
|
||
procedure InitGrid();
|
||
{ Private declarations }
|
||
public
|
||
canshu1, FSTKName, canshu3: string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_PrtDyeInfoInPut;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmPrtDyeInfoList.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmPrtDyeInfoList.FormCreate(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
canshu1 := Trim(Self.fParameters1);
|
||
FSTKName := Trim(Self.fParameters2);
|
||
canshu3 := Trim(Self.fParameters3);
|
||
end;
|
||
|
||
procedure TfrmPrtDyeInfoList.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select A.* ');
|
||
sql.Add(' from BS_Product_Info A');
|
||
sql.Add(' where isnull(STKNAME,'''')=''' + Trim(FSTKName) + '''');
|
||
Open;
|
||
end;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, CDS_Main);
|
||
SInitCDSData(ADOQueryMain, CDS_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPrtDyeInfoList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmPrtDyeInfoList.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(Self.Caption, Tv1, 'Ⱦ<><C8BE><EFBFBD>ϲֿ<CFB2>');
|
||
|
||
end;
|
||
|
||
procedure TfrmPrtDyeInfoList.ConNoMChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPrtDyeInfoList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmPrtDyeInfoList.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
ReadCxGrid(Self.Caption, Tv1, 'Ⱦ<><C8BE><EFBFBD>ϲֿ<CFB2>');
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmPrtDyeInfoList.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then
|
||
exit;
|
||
TcxGridToExcel(trim(self.Caption), cxGrid1);
|
||
end;
|
||
|
||
procedure TfrmPrtDyeInfoList.TBFindClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, CDS_Main);
|
||
SInitCDSData(ADOQueryMain, CDS_Main);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPrtDyeInfoList.N1Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_Main, True);
|
||
end;
|
||
|
||
procedure TfrmPrtDyeInfoList.N2Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_Main, False);
|
||
end;
|
||
|
||
procedure TfrmPrtDyeInfoList.TBDelClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from BS_Product_IO where P_Code=''' + Trim(CDS_Main.fieldbyname('P_Code').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ⲻ<EFBFBD><E2B2BB><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' delete BS_Product_Info where BPIID=''' + Trim(CDS_Main.fieldbyname('BPIID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
CDS_Main.Delete;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ɾ<><C9BE><EFBFBD>쳣!', '<27><>ʾ', 0);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmPrtDyeInfoList.TBAddClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmPrtDyeInfoInPut := TfrmPrtDyeInfoInPut.Create(Application);
|
||
with frmPrtDyeInfoInPut do
|
||
begin
|
||
FBCId := '';
|
||
FSTKName := self.FSTKName;
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmPrtDyeInfoInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPrtDyeInfoList.TBEditClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
|
||
try
|
||
frmPrtDyeInfoInPut := TfrmPrtDyeInfoInPut.Create(Application);
|
||
with frmPrtDyeInfoInPut do
|
||
begin
|
||
FBCId := Trim(CDS_Main.fieldbyname('BPIID').AsString);
|
||
FSTKName := self.FSTKName;
|
||
TBDel.Visible := False;
|
||
TBAdd.Visible := False;
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmPrtDyeInfoInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|