RTFormwork/项目代码/RTBasicsV1/B02基础纱线仓库/U_YarnInfoList.pas
“ddf” 719cdbc141 1
2024-07-07 19:26:56 +08:00

305 lines
8.1 KiB
ObjectPascal
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_YarnInfoList;
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, dxSkinWXI,
dxScrollbarAnnotations, cxContainer, dxSkinBasic, dxSkinBlack, dxSkinBlue,
dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkroom, dxSkinDarkSide,
dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray,
dxSkinOffice2013White, dxSkinOffice2016Colorful, dxSkinOffice2016Dark,
dxSkinOffice2019Black, dxSkinOffice2019Colorful, dxSkinOffice2019DarkGray,
dxSkinOffice2019White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic,
dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringtime, dxSkinStardust,
dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinTheBezier, dxSkinValentine,
dxSkinVisualStudio2013Blue, dxSkinVisualStudio2013Dark,
dxSkinVisualStudio2013Light, dxSkinVS2010, dxSkinWhiteprint,
dxSkinXmas2008Blue, cxMaskEdit;
type
TfrmYarnInfoList = 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;
TBDel: TToolButton;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
TBAdd: TToolButton;
TBEdit: TToolButton;
cxGrid1: TcxGrid;
Tv1: TcxGridDBTableView;
v2Column1: TcxGridDBColumn;
v1Column8: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
v1Column12: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
v1Column1: TcxGridDBColumn;
v1Column10: TcxGridDBColumn;
v1Column17: TcxGridDBColumn;
v1Column18: TcxGridDBColumn;
v1Column9: TcxGridDBColumn;
Tv1Column2: TcxGridDBColumn;
Label2: TLabel;
Label4: TLabel;
Label5: TLabel;
Y_Name: TcxTextEdit;
Y_Spec: TcxTextEdit;
Brand: TcxTextEdit;
ToolButton1: TToolButton;
Tv1Column1: TcxGridDBColumn;
ToolButton2: TToolButton;
Tv1Column3: TcxGridDBColumn;
lbl1: TLabel;
Y_Type: TcxComboBox;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure TBRafreshClick(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);
procedure ToolButton2Click(Sender: TObject);
procedure BrandPropertiesChange(Sender: TObject);
private
canshu1, FSTKName, canshu3: string;
procedure InitGrid();
{ Private declarations }
public
{ Public declarations }
end;
implementation
uses
U_DataLink, U_RTFun, U_YarnInfoInPut, U_ZDYHelp;
{$R *.dfm}
procedure TfrmYarnInfoList.BrandPropertiesChange(Sender: TObject);
begin
TBFind.Click;
end;
procedure TfrmYarnInfoList.FormClose(Sender: TObject; var Action: TCloseAction);
begin
inherited;
Action := caFree;
end;
procedure TfrmYarnInfoList.FormCreate(Sender: TObject);
begin
inherited;
canshu1 := Trim(DParameters1);
FSTKName := Trim(DParameters2);
canshu3 := Trim(DParameters3);
end;
procedure TfrmYarnInfoList.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered := False;
Close;
sql.Clear;
sql.Add(' select A.* ');
sql.Add(' from BS_Yarn_Info A');
Open;
end;
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
SCreateCDS(ADOQueryMain, CDS_Main);
SInitCDSData(ADOQueryMain, CDS_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmYarnInfoList.TBRafreshClick(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmYarnInfoList.ToolButton1Click(Sender: TObject);
begin
WriteCxGrid(Self.Caption, Tv1, 'Ⱦɫ<C8BE><C9AB><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
end;
procedure TfrmYarnInfoList.ToolButton2Click(Sender: TObject);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'YType';
flagname := '<27><><EFBFBD><EFBFBD>';
MainType := <>ߵ<EFBFBD><DFB5><EFBFBD>';
if ShowModal = 1 then
begin
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmYarnInfoList.TBCloseClick(Sender: TObject);
begin
Close;
end;
procedure TfrmYarnInfoList.FormShow(Sender: TObject);
var
fsj: string;
begin
inherited;
ReadCxGrid(Self.Caption, Tv1, 'Ⱦɫ<C8BE><C9AB><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
fsj := ' select Code=ZDYNo,Name=ZDYName from KH_ZDY where Type=''YType'' and MainType='<>ߵ<EFBFBD><DFB5><EFBFBD>'' ';
SInitTcxComBoxBySql(ADOQueryTemp, Y_Type, false, fsj);
InitGrid();
end;
procedure TfrmYarnInfoList.TBExportClick(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then
exit;
TcxGridToExcel(trim(self.Caption), cxGrid1);
end;
procedure TfrmYarnInfoList.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 TfrmYarnInfoList.N1Click(Sender: TObject);
begin
SelOKNo(CDS_Main, True);
end;
procedure TfrmYarnInfoList.N2Click(Sender: TObject);
begin
SelOKNo(CDS_Main, False);
end;
procedure TfrmYarnInfoList.TBDelClick(Sender: TObject);
begin
if CDS_Main.IsEmpty then
Exit;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from BS_Yarn_IO where Y_Code=''' + Trim(CDS_Main.fieldbyname('Y_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_Yarn_Info where BYIID=''' + Trim(CDS_Main.fieldbyname('BYIID').AsString) + '''');
ExecSQL;
end;
ADOQueryCmd.Connection.CommitTrans;
CDS_Main.Delete;
except
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C9BE><EFBFBD>쳣!', '<27><>ʾ', 0);
end;
end;
procedure TfrmYarnInfoList.TBAddClick(Sender: TObject);
begin
try
frmYarnInfoInPut := TfrmYarnInfoInPut.Create(Application);
with frmYarnInfoInPut do
begin
FBYIID := '';
FSTKName := self.FSTKName;
if ShowModal = 1 then
begin
Self.InitGrid();
end;
end;
finally
frmYarnInfoInPut.Free;
end;
end;
procedure TfrmYarnInfoList.TBEditClick(Sender: TObject);
begin
if CDS_Main.IsEmpty then
Exit;
try
frmYarnInfoInPut := TfrmYarnInfoInPut.Create(Application);
with frmYarnInfoInPut do
begin
FBYIID := Trim(CDS_Main.fieldbyname('BYIID').AsString);
FSTKName := self.FSTKName;
if ShowModal = 1 then
begin
Self.InitGrid();
end;
end;
finally
frmYarnInfoInPut.Free;
end;
end;
end.