RTFormwork/项目代码/RTBasicsV1/D01针织生产计划/U_ClothSCSelList.pas

213 lines
5.7 KiB
ObjectPascal
Raw Permalink Normal View History

2024-07-07 09:35:27 +08:00
unit U_ClothSCSelList;
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, cxButtonEdit, cxSplitter,
RM_Common, RM_Class, RM_e_Xls, RM_Dataset, RM_System, RM_GridReport,
cxTextEdit, cxCheckBox, cxPC, cxLookAndFeels, cxLookAndFeelPainters,
cxNavigator, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges,
dxBarBuiltInMenu;
type
TfrmClothSCSelList = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBFind: TToolButton;
TBClose: TToolButton;
Panel1: TPanel;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
Label1: TLabel;
Label2: TLabel;
cxGridPopupMenu1: TcxGridPopupMenu;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
DataSource1: TDataSource;
Label3: TLabel;
ConNo: TEdit;
Label5: TLabel;
C_CodeName: TEdit;
Order_Main: TClientDataSet;
cxGrid1: TcxGrid;
Tv1: TcxGridDBTableView;
v1OrderNo: TcxGridDBColumn;
v1Column2: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
v1Column5: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
v1Column21: TcxGridDBColumn;
Label10: TLabel;
C_Code: TEdit;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBCloseClick(Sender: TObject);
procedure TBFindClick(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure ConNoChange(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure conPress(Sender: TObject; var Key: Char);
procedure FormDestroy(Sender: TObject);
procedure Tv1DblClick(Sender: TObject);
procedure C_CodeKeyPress(Sender: TObject; var Key: Char);
private
FInt,PFInt:Integer;
canshu1:string;
procedure InitGrid();
procedure InitForm();
{ Private declarations }
public
{ Public declarations }
end;
var
frmClothSCSelList: TfrmClothSCSelList;
implementation
uses
U_DataLink,U_RTFun;
{$R *.dfm}
procedure TfrmClothSCSelList.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmClothSCSelList.TBCloseClick(Sender: TObject);
begin
Close;
WriteCxGrid(Self.Caption+'FSJK',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmClothSCSelList.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add('select A.*,B.*,CZCarPrice=B.JGPrice ');
sql.Add(' from Cloth_Main A inner join CLoth_Sub B on A.Mainid=B.MainId where 1=1');
sql.Add(' and A.QDTime>='''+Trim(FormatDateTime('yyyy-MM-dd',BegDate.DateTime))+'''');
sql.Add(' and A.QDTime<'''+Trim(FormatDateTime('yyyy-MM-dd',EndDate.DateTime+1))+'''');
sql.Add('order by QDTime desc');
Open;
end;
SCreateCDS(ADOQueryMain,Order_Main);
SInitCDSData(ADOQueryMain,Order_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmClothSCSelList.InitForm();
begin
ReadCxGrid(Self.Caption+'FSJK',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
BegDate.DateTime:=SGetServerDate(ADOQueryTemp)-30;
EndDate.DateTime:=SGetServerDate(ADOQueryTemp);
InitGrid();
end;
procedure TfrmClothSCSelList.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 TfrmClothSCSelList.TBRafreshClick(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmClothSCSelList.ConNoChange(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 TfrmClothSCSelList.FormShow(Sender: TObject);
begin
InitForm();
end;
procedure TfrmClothSCSelList.conPress(Sender: TObject;
var Key: Char);
begin
if Key=#13 then
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add('select A.*,B.* ');
sql.Add(',YQZhuanQty=Cast(B.CZJiSu*720*B.CZYQXiaoLv*0.01 as int)');
sql.Add(' from Cloth_Main A inner join CLoth_Sub B on A.Mainid=B.MainId where isnull(A.ConNo,'''') like '''+'%'+Trim(ConNo.Text)+'%'+'''');
Open;
end;
SCreateCDS(ADOQueryMain,Order_Main);
SInitCDSData(ADOQueryMain,Order_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
end;
procedure TfrmClothSCSelList.FormDestroy(Sender: TObject);
begin
frmClothSCSelList:=nil;
end;
procedure TfrmClothSCSelList.Tv1DblClick(Sender: TObject);
begin
if Order_Main.IsEmpty then Exit;
if Application.MessageBox(<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>¼<EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then exit;
ModalResult:=1;
end;
procedure TfrmClothSCSelList.C_CodeKeyPress(Sender: TObject;
var Key: Char);
begin
if Key=#13 then
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add('select A.*,B.* ');
sql.Add(',YQZhuanQty=Cast(B.CZJiSu*720*B.CZYQXiaoLv*0.01 as int)');
sql.Add(' from Cloth_Main A inner join CLoth_Sub B on A.Mainid=B.MainId where isnull(B.C_Code,'''') like '''+'%'+Trim(C_Code.Text)+'%'+'''');
Open;
end;
SCreateCDS(ADOQueryMain,Order_Main);
SInitCDSData(ADOQueryMain,Order_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
end;
end.