RTFormwork/项目代码/RTBasicsV1/E02梭织经轴仓库/U_WarpBeamInfoList.pas

307 lines
7.3 KiB
ObjectPascal
Raw Normal View History

2024-07-07 09:35:27 +08:00
unit U_WarpBeamInfoList;
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;
type
TfrmWarpBeamInfoList = 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;
cxGrid2: TcxGrid;
Tv1: TcxGridDBTableView;
cxGrid2Level1: TcxGridLevel;
v1Column1: TcxGridDBColumn;
Label4: TLabel;
WBNo: TEdit;
ToolButton1: TToolButton;
Tv1Column1: TcxGridDBColumn;
<EFBFBD><EFBFBD>ӡ: TToolButton;
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);
procedure <EFBFBD><EFBFBD>ӡClick(Sender: TObject);
private
canshu1, FSTKName, canshu3: string;
procedure InitGrid();
{ Private declarations }
public
{ Public declarations }
end;
implementation
uses
U_DataLink, U_RTFun, U_WarpBeamInfoInPut, U_LabelPrint;
{$R *.dfm}
procedure TfrmWarpBeamInfoList.FormClose(Sender: TObject; var Action: TCloseAction);
begin
inherited;
Action := caFree;
end;
procedure TfrmWarpBeamInfoList.FormCreate(Sender: TObject);
begin
inherited;
canshu1 := Trim(DParameters1);
FSTKName := Trim(DParameters2);
canshu3 := Trim(DParameters3);
end;
procedure TfrmWarpBeamInfoList.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered := False;
Close;
sql.Clear;
sql.Add(' select A.* ');
sql.Add(' from Tat_WB_Stk A');
Open;
end;
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
SCreateCDS(ADOQueryMain, CDS_Main);
SInitCDSData(ADOQueryMain, CDS_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmWarpBeamInfoList.TBRafreshClick(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmWarpBeamInfoList.ToolButton1Click(Sender: TObject);
begin
WriteCxGrid(Self.Caption, Tv1, 'Ⱦɫ<C8BE><C9AB><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
end;
procedure TfrmWarpBeamInfoList.<EFBFBD><EFBFBD>ӡClick(Sender: TObject);
var
MWBID: string;
begin
if CDS_Main.IsEmpty then
Exit;
if CDS_Main.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
MWBID := '';
CDS_Main.DisableControls;
with CDS_Main do
begin
First;
while CDS_Main.Locate('SSel', True, []) do
begin
MWBID := MWBID + ',' + (Trim(CDS_Main.fieldbyname('WBID').AsString));
Edit;
FieldByName('SSel').Value := False;
Post;
end;
end;
CDS_Main.EnableControls;
try
frmLabelPrint := TfrmLabelPrint.Create(Application);
with frmLabelPrint do
begin
FLMType := 'TatWBPrt1';
FFiltration1 := MWBID;
if ShowModal = 1 then
begin
// Self.InitGrid();
end;
end;
finally
frmLabelPrint.Free;
end;
end;
procedure TfrmWarpBeamInfoList.ConNoMChange(Sender: TObject);
begin
if ADOQueryMain.Active then
begin
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
end;
end;
procedure TfrmWarpBeamInfoList.TBCloseClick(Sender: TObject);
begin
Close;
end;
procedure TfrmWarpBeamInfoList.FormShow(Sender: TObject);
begin
inherited;
ReadCxGrid(Self.Caption, Tv1, 'Ⱦɫ<C8BE><C9AB><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
InitGrid();
end;
procedure TfrmWarpBeamInfoList.TBExportClick(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then
exit;
TcxGridToExcel(trim(self.Caption), cxGrid2);
end;
procedure TfrmWarpBeamInfoList.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 TfrmWarpBeamInfoList.N1Click(Sender: TObject);
begin
SelOKNo(CDS_Main, True);
end;
procedure TfrmWarpBeamInfoList.N2Click(Sender: TObject);
begin
SelOKNo(CDS_Main, False);
end;
procedure TfrmWarpBeamInfoList.TBDelClick(Sender: TObject);
begin
if CDS_Main.IsEmpty then
Exit;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from Tat_WB_IO where WBNo=''' + Trim(CDS_Main.fieldbyname('WBNo').AsString) + '''');
Open;
end;
if ADOQueryTemp.IsEmpty = False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD><DCB2><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 Tat_WB_Stk where WBID=''' + Trim(CDS_Main.fieldbyname('WBID').AsString) + '''');
ExecSQL;
end;
ADOQueryCmd.Connection.CommitTrans;
CDS_Main.Delete;
except
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C9BE><EFBFBD>쳣!', '<27><>ʾ', 0);
end;
end;
procedure TfrmWarpBeamInfoList.TBAddClick(Sender: TObject);
begin
try
frmWarpBeamInfoInPut := TfrmWarpBeamInfoInPut.Create(Application);
with frmWarpBeamInfoInPut do
begin
FBCId := '';
FSTKName := self.FSTKName;
if ShowModal = 1 then
begin
Self.InitGrid();
end;
end;
finally
frmWarpBeamInfoInPut.Free;
end;
end;
procedure TfrmWarpBeamInfoList.TBEditClick(Sender: TObject);
begin
if CDS_Main.IsEmpty then
Exit;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from Tat_WB_IO where WBNo=''' + Trim(CDS_Main.fieldbyname('WBNo').AsString) + '''');
Open;
end;
if ADOQueryTemp.IsEmpty = False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
try
frmWarpBeamInfoInPut := TfrmWarpBeamInfoInPut.Create(Application);
with frmWarpBeamInfoInPut do
begin
FBCId := Trim(CDS_Main.fieldbyname('WBID').AsString);
FSTKName := self.FSTKName;
TBDel.Visible := False;
TBAdd.Visible := False;
if ShowModal = 1 then
begin
Self.InitGrid();
end;
end;
finally
frmWarpBeamInfoInPut.Free;
end;
end;
end.