RTFormwork/项目代码/RTBasicsV1/D03针织坯布仓库/U_KnitClothWaitStorage.pas
“ddf” 61630656e9 1
2024-07-07 09:35:27 +08:00

185 lines
5.3 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_KnitClothWaitStorage;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
cxEdit, DB, cxDBData, StdCtrls, ADODB, DBClient, ComCtrls, ExtCtrls,
cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
cxClasses, cxControls, cxGridCustomView, cxGrid, cxGridCustomPopupMenu,
cxGridPopupMenu, cxCheckBox, cxLookAndFeels, cxLookAndFeelPainters,
dxSkinsCore, dxSkinsDefaultPainters, cxNavigator, dxDateRanges,
dxBarBuiltInMenu, Vcl.ToolWin;
type
TfrmKnitClothWaitStorage = class(TForm)
Panel1: TPanel;
Label2: TLabel;
OrderNo: TEdit;
Label3: TLabel;
C_Color: TEdit;
CDS_OrderSel: TClientDataSet;
DataSource1: TDataSource;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
cxGridPopupMenu1: TcxGridPopupMenu;
Label8: TLabel;
CustName: TEdit;
cxGrid1: TcxGrid;
Tv2: TcxGridDBTableView;
v2Column3: TcxGridDBColumn;
v2Column2: TcxGridDBColumn;
cxGridDBColumn2: TcxGridDBColumn;
v1Column10: TcxGridDBColumn;
v1Column14: TcxGridDBColumn;
cxGridDBColumn3: TcxGridDBColumn;
v1PRTMF: TcxGridDBColumn;
v1PRTKZ: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
v2Column8: TcxGridDBColumn;
ToolBar3: TToolBar;
ToolButton5: TToolButton;
ToolButton1: TToolButton;
ToolButton8: TToolButton;
ToolButton7: TToolButton;
Tv2Column1: TcxGridDBColumn;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormDestroy(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure OrderNoChange(Sender: TObject);
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
procedure ToolButton5Click(Sender: TObject);
procedure ToolButton7Click(Sender: TObject);
procedure ToolButton8Click(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
private
{ Private declarations }
procedure InitGrid();
public
{ Public declarations }
end;
var
frmKnitClothWaitStorage: TfrmKnitClothWaitStorage;
implementation
uses
U_DataLink, U_RTFun;
{$R *.dfm}
procedure TfrmKnitClothWaitStorage.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
procedure TfrmKnitClothWaitStorage.FormDestroy(Sender: TObject);
begin
frmKnitClothWaitStorage := nil;
end;
procedure TfrmKnitClothWaitStorage.FormShow(Sender: TObject);
begin
ReadCxGrid('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>1', Tv2, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
InitGrid();
end;
procedure TfrmKnitClothWaitStorage.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered := False;
Close;
sql.Clear;
sql.Add('select A.*');
sql.Add(',ZPPS=(select Count(KC.StkID) from Knit_Cloth_Stock KC where KC.StkCycles=0 AND KC.SubID=A.SubID and KC.StkExists=0 ) ');
sql.Add(',ZPKGQty=(select sum(StkGrossWeight) from Knit_Cloth_Stock KC where KC.StkCycles=0 AND KC.SubID=A.SubID and KC.StkExists=0 ) ');
sql.Add(',ZPQty=(select sum(StkMeter) from Knit_Cloth_Stock KC where KC.StkCycles=0 AND KC.SubID=A.SubID and KC.StkExists=0 ) ');
sql.Add(' from Knit_Plan_Card A ');
sql.Add(' where exists(select KC.SubID from Knit_Cloth_Stock KC where KC.StkCycles=0 AND KC.SubID=A.SubID and KC.StkExists=0)');
// ShowMessage(sql.Text);
Open;
end;
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
SCreateCDS(ADOQueryMain, CDS_OrderSel);
SInitCDSData(ADOQueryMain, CDS_OrderSel);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmKnitClothWaitStorage.OrderNoChange(Sender: TObject);
begin
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
SCreateCDS(ADOQueryMain, CDS_OrderSel);
SInitCDSData(ADOQueryMain, CDS_OrderSel);
end;
procedure TfrmKnitClothWaitStorage.ToolButton1Click(Sender: TObject);
var
KHName: string;
begin
if CDS_OrderSel.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
CDS_OrderSel.DisableControls;
KHName := '';
with CDS_OrderSel do
begin
First;
while not Eof do
begin
if FieldByName('SSel').AsBoolean = True then
begin
if Trim(KHName) = '' then
begin
KHName := Trim(fieldbyname('CustNo').AsString);
end
else
begin
if Trim(fieldbyname('CustNo').AsString) <> KHName then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ͬ<EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
end;
end;
Next;
end;
end;
CDS_OrderSel.EnableControls;
ModalResult := 1;
end;
procedure TfrmKnitClothWaitStorage.ToolButton5Click(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmKnitClothWaitStorage.ToolButton7Click(Sender: TObject);
begin
Close;
end;
procedure TfrmKnitClothWaitStorage.ToolButton8Click(Sender: TObject);
begin
WriteCxGrid('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>1', Tv2, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
end;
procedure TfrmKnitClothWaitStorage.Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
begin
ModalResult := 1;
end;
end.