246 lines
7.0 KiB
ObjectPascal
246 lines
7.0 KiB
ObjectPascal
unit U_ClothHCList_WGH;
|
||
|
||
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, cxDropDownEdit,
|
||
cxCheckBox, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxSkinsCore,
|
||
dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee,
|
||
dxSkinDarkRoom, dxSkinDarkSide, dxSkinDevExpressDarkStyle,
|
||
dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast,
|
||
dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky,
|
||
dxSkinMcSkin, dxSkinMetropolis, dxSkinMetropolisDark, dxSkinMoneyTwins,
|
||
dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
|
||
dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
|
||
dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinOffice2013DarkGray,
|
||
dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven,
|
||
dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver,
|
||
dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld,
|
||
dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint,
|
||
dxSkinXmas2008Blue, dxSkinscxPCPainter, dxBarBuiltInMenu, cxPC;
|
||
|
||
type
|
||
TfrmClothHCList_WGH = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
BegDate: TDateTimePicker;
|
||
EndDate: TDateTimePicker;
|
||
Label1: TLabel;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
Label3: TLabel;
|
||
MJstr4: TEdit;
|
||
Order_Main: TClientDataSet;
|
||
Label6: TLabel;
|
||
YS: TEdit;
|
||
cxGrid2: TcxGrid;
|
||
TV2: TcxGridDBTableView;
|
||
cxGridLevel1: TcxGridLevel;
|
||
SH: TEdit;
|
||
conNo: TEdit;
|
||
Label9: TLabel;
|
||
prtCodeName: TEdit;
|
||
Label2: TLabel;
|
||
prtspec: TEdit;
|
||
Label10: TLabel;
|
||
Label4: TLabel;
|
||
Button1: TButton;
|
||
PRTHX: TEdit;
|
||
Label5: TLabel;
|
||
TV2Column1: TcxGridDBColumn;
|
||
TV2Column2: TcxGridDBColumn;
|
||
cxTabControl1: TcxTabControl;
|
||
TV2Column3: TcxGridDBColumn;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBFindClick(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure MJstr4Change(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure MJstr4KeyPress(Sender: TObject; var Key: Char);
|
||
procedure TV2DblClick(Sender: TObject);
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
private
|
||
FInt, PFInt: Integer;
|
||
procedure InitGrid();
|
||
procedure InitForm();
|
||
procedure InitGridWSQL(FWSQL: string);
|
||
{ Private declarations }
|
||
public
|
||
fType: string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmClothHCList_WGH: TfrmClothHCList_WGH;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_ClothContractInPut, U_Fun, U_ProductOrderList, U_ZDYHelp,
|
||
U_ProductOrderNewList_JD;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmClothHCList_WGH.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmClothHCList_WGH := nil;
|
||
end;
|
||
|
||
procedure TfrmClothHCList_WGH.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmClothHCList_WGH.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
WriteCxGrid(self.Caption + tv2.Name, Tv2, 'ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmClothHCList_WGH.InitGrid();
|
||
begin
|
||
|
||
try
|
||
//ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
Filtered := False;
|
||
sql.Clear;
|
||
sql.Add('select distinct isnull(mjstr4,'''')mjstr4,SH,YS from WFB_MJJY ');
|
||
if cxTabControl1.TabIndex = 0 then
|
||
SQL.Add('where isnull(WCfalg,0)<>''1''');
|
||
if cxTabControl1.TabIndex = 1 then
|
||
SQL.Add('where isnull(WCfalg,0)=''1''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
finally
|
||
//ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothHCList_WGH.InitGridWSQL(FWSQL: string);
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_View_HC :begdate,:enddate,:WSQL');
|
||
Parameters.ParamByName('begdate').Value := '2014-01-01';
|
||
Parameters.ParamByName('enddate').Value := '2050-01-01';
|
||
Parameters.ParamByName('WSQL').Value := FWSQL;
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothHCList_WGH.InitForm();
|
||
begin
|
||
ReadCxGrid(self.Caption + tv2.Name, Tv2, 'ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
EndDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
||
BegDate.DateTime := EndDate.DateTime;
|
||
//InitGrid();
|
||
end;
|
||
|
||
procedure TfrmClothHCList_WGH.TBFindClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
end;
|
||
|
||
procedure TfrmClothHCList_WGH.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmClothHCList_WGH.MJstr4Change(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
end;
|
||
|
||
procedure TfrmClothHCList_WGH.FormShow(Sender: TObject);
|
||
begin
|
||
InitForm();
|
||
TBRafresh.Click;
|
||
end;
|
||
|
||
procedure TfrmClothHCList_WGH.MJstr4KeyPress(Sender: TObject; var Key: Char);
|
||
var
|
||
fsj: string;
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
if Length(Trim(MJstr4.Text)) < 4 then
|
||
Exit;
|
||
// fsj := ' and A.MJstr4 like ''' + '%' + Trim(MJstr4.Text) + '%' + '''';
|
||
// InitGridWSQL(fsj);
|
||
try
|
||
//ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
Filtered := False;
|
||
sql.Clear;
|
||
sql.Add('select distinct isnull(mjstr4,'''')mjstr4,SH from WFB_MJJY where isnull(WCfalg,0)<>''1'' ');
|
||
sql.Add(' and MJstr4 like ''' + '%' + Trim(MJstr4.Text) + '%' + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
finally
|
||
//ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothHCList_WGH.TV2DblClick(Sender: TObject);
|
||
begin
|
||
if fType = '10' then
|
||
frmClothHCList_WGH.ModalResult := 1;
|
||
end;
|
||
|
||
procedure TfrmClothHCList_WGH.Button1Click(Sender: TObject);
|
||
begin
|
||
if fType = '10' then
|
||
frmClothHCList_WGH.ModalResult := 1;
|
||
end;
|
||
|
||
procedure TfrmClothHCList_WGH.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
end.
|
||
|