D10SZKaiXiYa/E01梭织生产计划/U_TatOrderProdTJ.pas

214 lines
6.3 KiB
ObjectPascal
Raw Normal View History

2026-10-28 17:12:57 +08:00
unit U_TatOrderProdTJ;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses, cxControls,
cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
cxGrid, DBClient, cxCalendar, cxTextEdit, cxLookAndFeels,
cxLookAndFeelPainters, cxNavigator, Vcl.Menus, cxContainer, dxCore,
cxDateUtils, cxMaskEdit, cxDropDownEdit, dxSkinsCore, cxProgressBar,
cxGridBandedTableView, cxGridDBBandedTableView, U_BaseList, dxSkinWXI,
dxDateRanges, dxScrollbarAnnotations, dxBarBuiltInMenu;
type
TfrmTatOrderProdTJ = class(TfrmBaseList)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
TBClose: TToolButton;
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
BegDate: TcxDateEdit;
EndDate: TcxDateEdit;
ConNo: TcxTextEdit;
CustName: TcxTextEdit;
C_Name: TcxTextEdit;
cxGrid1: TcxGrid;
TV1: TcxGridDBBandedTableView;
ColConNo: TcxGridDBBandedColumn;
ColCustName: TcxGridDBBandedColumn;
ColC_Name: TcxGridDBBandedColumn;
ColC_Spec: TcxGridDBBandedColumn;
ColOrdQty: TcxGridDBBandedColumn;
ColJHDate: TcxGridDBBandedColumn;
ColYType: TcxGridDBBandedColumn;
ColYZS: TcxGridDBBandedColumn;
ColYGYS: TcxGridDBBandedColumn;
ColLLYarnLen: TcxGridDBBandedColumn;
ColLLYarnQty: TcxGridDBBandedColumn;
ColAZGroup: TcxGridDBBandedColumn;
ColAZCard: TcxGridDBBandedColumn;
ColAZLen: TcxGridDBBandedColumn;
ColWSCard: TcxGridDBBandedColumn;
ColWSLen: TcxGridDBBandedColumn;
ColSCCard: TcxGridDBBandedColumn;
ColSCLen: TcxGridDBBandedColumn;
ColJLCard: TcxGridDBBandedColumn;
ColJLLen: TcxGridDBBandedColumn;
ColMBMeter: TcxGridDBBandedColumn;
ColYBMeter: TcxGridDBBandedColumn;
ColRKQty: TcxGridDBBandedColumn;
ColQSQty: TcxGridDBBandedColumn;
ColIsRed: TcxGridDBBandedColumn;
cxGridLevel1: TcxGridLevel;
GPM_1: TcxGridPopupMenu;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
DS_1: TDataSource;
CDS_1: TClientDataSet;
cxStyleRepository1: TcxStyleRepository;
cxStyleRed: TcxStyle;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBCloseClick(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure EdtPropertiesChange(Sender: TObject);
procedure TV1CompareRowValuesForCellMerging(Sender: TcxGridColumn;
ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties;
const AValue1: Variant; ARow2: TcxGridDataRow;
AProperties2: TcxCustomEditProperties; const AValue2: Variant;
var AAreEqual: Boolean);
procedure TV1StylesGetContentStyle(Sender: TcxCustomGridTableView;
ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem;
var AStyle: TcxStyle);
private
procedure InitGrid();
{ Private declarations }
public
{ Public declarations }
end;
implementation
uses
U_DataLink, U_RTFun;
{$R *.dfm}
procedure TfrmTatOrderProdTJ.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
Action := caFree;
end;
procedure TfrmTatOrderProdTJ.TBCloseClick(Sender: TObject);
begin
Close;
end;
procedure TfrmTatOrderProdTJ.InitGrid();
var
fwhere, Pwhere: string;
begin
Pwhere := SGetFilters(Panel1, 1, 2);
if trim(Pwhere) <> '' then
fwhere := ' and ' + trim(Pwhere)
else
fwhere := '';
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Close;
SQL.Clear;
sql.Add(' exec P_Tat_OrderProdTJ @Begdate=' + quotedstr(trim(FormatDateTime('yyyy-MM-dd', Begdate.Date))));
sql.Add(',@enddate=' + quotedstr(trim(FormatDateTime('yyyy-MM-dd', EndDate.Date + 1))));
sql.Add(',@criteria= ' + quotedstr(fwhere));
Open;
end;
SCreateCDS(ADOQueryMain, CDS_1);
SInitCDSData(ADOQueryMain, CDS_1);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmTatOrderProdTJ.N1Click(Sender: TObject);
begin
SelOKNo(CDS_1, True);
end;
procedure TfrmTatOrderProdTJ.N2Click(Sender: TObject);
begin
SelOKNo(CDS_1, False);
end;
procedure TfrmTatOrderProdTJ.TBRafreshClick(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmTatOrderProdTJ.ToolButton1Click(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then
Exit;
TcxGridToExcel(self.Caption, cxGrid1);
end;
procedure TfrmTatOrderProdTJ.ToolButton2Click(Sender: TObject);
begin
WriteCxBandedGrid(trim(self.Caption) + 'Tv1', Tv1, 'ͳ<>Ʋ<EFBFBD>ѯ');
end;
procedure TfrmTatOrderProdTJ.TV1CompareRowValuesForCellMerging(
Sender: TcxGridColumn; ARow1: TcxGridDataRow;
AProperties1: TcxCustomEditProperties; const AValue1: Variant;
ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties;
const AValue2: Variant; var AAreEqual: Boolean);
begin
if ARow1.Values[ColConNo.Index] = ARow2.Values[ColConNo.Index] then
AAreEqual := True
else
AAreEqual := False;
end;
procedure TfrmTatOrderProdTJ.TV1StylesGetContentStyle(
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
AItem: TcxCustomGridTableItem; var AStyle: TcxStyle);
begin
if (AItem = ColQSQty) and (ARecord <> nil) then
begin
if (not VarIsNull(ARecord.Values[ColIsRed.Index]))
and (ARecord.Values[ColIsRed.Index] = 1) then
AStyle := cxStyleRed;
end;
end;
procedure TfrmTatOrderProdTJ.EdtPropertiesChange(Sender: TObject);
begin
if ADOQueryMain.Active = False then
Exit;
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
SCreateCDS(ADOQueryMain, CDS_1);
SInitCDSData(ADOQueryMain, CDS_1);
end;
procedure TfrmTatOrderProdTJ.FormShow(Sender: TObject);
begin
inherited;
ReadCxBandedGrid(trim(self.Caption) + 'Tv1', Tv1, 'ͳ<>Ʋ<EFBFBD>ѯ');
EndDate.Date := SGetServerDate(ADOQueryTemp);
BegDate.Date := EndDate.Date - 90;
InitGrid();
end;
end.