RTFormwork/项目代码/RTBasicsV1/F02染色计划单/U_DyePlanForCardSel.pas
“ddf” 61630656e9 1
2024-07-07 09:35:27 +08:00

244 lines
6.6 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_DyePlanForCardSel;
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, cxCheckBox, cxCalendar, cxSplitter, RM_Dataset, RM_System,
RM_Common, RM_Class, RM_GridReport, RM_e_Xls, Menus, cxLookAndFeels,
cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu, cxPC, dxSkinsCore,
dxSkinsDefaultPainters, dxDateRanges;
type
TfrmProductOrderListSel = class(TForm)
ToolBar1: TToolBar;
TBClose: TToolButton;
Panel1: TPanel;
Tv1: TcxGridDBTableView;
cxGrid1Level1: TcxGridLevel;
cxGrid1: TcxGrid;
cxGridPopupMenu1: TcxGridPopupMenu;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
DataSource1: TDataSource;
Label3: TLabel;
OrderNoM: TEdit;
OrderNo: TcxGridDBColumn;
DeliveryDate: TcxGridDBColumn;
ConNo: TcxGridDBColumn;
C_COLOR: TcxGridDBColumn;
C_Spec: TcxGridDBColumn;
Order_Main: TClientDataSet;
C_CodeName: TcxGridDBColumn;
C_Width: TcxGridDBColumn;
AnticipateQTY: TcxGridDBColumn;
C_GramWeight: TcxGridDBColumn;
C_Code: TcxGridDBColumn;
ToolButton3: TToolButton;
v1Column4: TcxGridDBColumn;
C_COLORNO: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
OrderUnit: TcxGridDBColumn;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
C_Pattern: TcxGridDBColumn;
C_BKCOLOR: TcxGridDBColumn;
TBRafresh: TToolButton;
TBFind: TToolButton;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
Label1: TLabel;
Label2: TLabel;
cxTabControl1: TcxTabControl;
CustNoName: TcxGridDBColumn;
Tv1Column11: TcxGridDBColumn;
Tv1Column13: TcxGridDBColumn;
Tv1Column14: TcxGridDBColumn;
Tv1Column15: TcxGridDBColumn;
Tv1Column16: TcxGridDBColumn;
ToolButton1: TToolButton;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure OrderNoMKeyPress(Sender: TObject; var Key: Char);
procedure Tv1DblClick(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure TBFindClick(Sender: TObject);
procedure cxTabControl1Change(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
private
DQdate: TDateTime;
procedure InitGrid();
procedure InitForm();
{ Private declarations }
public
FFInt, FCloth: Integer;
fWorkshop: string;
{ Public declarations }
end;
var
frmProductOrderListSel: TfrmProductOrderListSel;
implementation
uses
U_DataLink, U_RTFun;
{$R *.dfm}
procedure TfrmProductOrderListSel.FormDestroy(Sender: TObject);
begin
frmProductOrderListSel := nil;
end;
procedure TfrmProductOrderListSel.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
procedure TfrmProductOrderListSel.TBCloseClick(Sender: TObject);
begin
Close;
end;
procedure TfrmProductOrderListSel.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Close;
Filtered := False;
sql.Clear;
sql.Add('select B.*,A.* ');
sql.add('from Dye_Plan_sub A');
sql.Add('inner join Dye_Plan_Main B on B.mainID=A.mainID ');
sql.Add('where B.FillTime>=''' + formatdateTime('yyyy-MM-dd', begdate.Date) + ''' ');
sql.Add('and B.FillTime<''' + formatdateTime('yyyy-MM-dd', enddate.Date + 1) + ''' ');
sql.Add('and B.Workshop=' + quotedstr(fWorkshop));
sql.Add('and isnull(B.status,''0'')=''9''');
if cxTabControl1.TabIndex = 0 then
sql.Add('and not exists(select PCID from Dye_Plan_Card X where X.subID=A.subID)');
if cxTabControl1.TabIndex = 1 then
sql.Add('and exists(select PCID from Dye_Plan_Card X where X.subID=A.subID)');
Open;
end;
SCreateCDS(ADOQueryMain, Order_Main);
SInitCDSData(ADOQueryMain, Order_Main);
finally
ADOQueryMain.EnableControls;
Tbfind.Click;
end;
end;
procedure TfrmProductOrderListSel.InitForm();
begin
ReadCxGrid(ʾ<D6B8><CABE><EFBFBD>б<EFBFBD>ѡ<EFBFBD><D1A1>', Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
BegDate.DateTime := SGetServerDate(ADOQueryTemp) - 15;
EndDate.DateTime := SGetServerDate(ADOQueryTemp);
InitGrid();
end;
procedure TfrmProductOrderListSel.FormShow(Sender: TObject);
begin
InitForm();
if FFInt = 1 then
begin
v1Column4.Visible := False;
v1Column4.Hidden := True;
end;
// InitGrid();
end;
procedure TfrmProductOrderListSel.ToolButton1Click(Sender: TObject);
begin
WriteCxGrid(ʾ<D6B8><CABE><EFBFBD>б<EFBFBD>ѡ<EFBFBD><D1A1>', Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmProductOrderListSel.ToolButton3Click(Sender: TObject);
begin
if Order_Main.IsEmpty then
exit;
ModalResult := 1;
end;
procedure TfrmProductOrderListSel.OrderNoMKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
if Length(Trim(OrderNoM.Text)) < 3 then
Exit;
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Close;
Filtered := False;
sql.Clear;
sql.Add('select B.*,A.*,A.OrderNo orderNoM ');
sql.add('from Dye_Plan_sub A');
sql.Add('inner join Dye_Plan_Main B on B.mainID=A.mainID ');
// sql.Add('left join Dye_PlanCon_Main C on C.conNO=B.conNO ');
SQL.Add('where B.OrderNo like ''' + '%' + Trim(OrderNoM.Text) + '%' + '''');
Open;
end;
SCreateCDS(ADOQueryMain, Order_Main);
SInitCDSData(ADOQueryMain, Order_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
end;
procedure TfrmProductOrderListSel.Tv1DblClick(Sender: TObject);
begin
ToolButton3.Click;
end;
procedure TfrmProductOrderListSel.N1Click(Sender: TObject);
begin
SelOKNo(Order_Main, True);
end;
procedure TfrmProductOrderListSel.N2Click(Sender: TObject);
begin
SelOKNo(Order_Main, false);
end;
procedure TfrmProductOrderListSel.TBRafreshClick(Sender: TObject);
begin
initgrid();
end;
procedure TfrmProductOrderListSel.TBFindClick(Sender: TObject);
begin
if ADOQueryMain.Active = False then
Exit;
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
SCreateCDS(ADOQueryMain, Order_Main);
SInitCDSData(ADOQueryMain, Order_Main);
end;
procedure TfrmProductOrderListSel.cxTabControl1Change(Sender: TObject);
begin
TBRafresh.Click;
end;
end.