346 lines
9.4 KiB
ObjectPascal
346 lines
9.4 KiB
ObjectPascal
![]() |
unit U_ClothHCList;
|
|||
|
|
|||
|
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, Buttons;
|
|||
|
|
|||
|
type
|
|||
|
TfrmClothHCList = 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;
|
|||
|
OrderNoM: TEdit;
|
|||
|
Order_Main: TClientDataSet;
|
|||
|
Label6: TLabel;
|
|||
|
PRTColor: TEdit;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
TV2: TcxGridDBTableView;
|
|||
|
V2filltime: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
V2Column10: TcxGridDBColumn;
|
|||
|
V2Column13: TcxGridDBColumn;
|
|||
|
V2Subid: TcxGridDBColumn;
|
|||
|
V2KHOrderNo: TcxGridDBColumn;
|
|||
|
V2Column14: TcxGridDBColumn;
|
|||
|
conNo: TEdit;
|
|||
|
Label9: TLabel;
|
|||
|
V2Column15: TcxGridDBColumn;
|
|||
|
V2Column16: TcxGridDBColumn;
|
|||
|
prtCodeName: TEdit;
|
|||
|
Label2: TLabel;
|
|||
|
prtspec: TEdit;
|
|||
|
Label10: TLabel;
|
|||
|
V2MPRTNiuDu: TcxGridDBColumn;
|
|||
|
V2MPRTBZNote: TcxGridDBColumn;
|
|||
|
V2PRTOrderQty: TcxGridDBColumn;
|
|||
|
V2OrderUnit: TcxGridDBColumn;
|
|||
|
Button1: TButton;
|
|||
|
V2Column1: TcxGridDBColumn;
|
|||
|
V2Column2: TcxGridDBColumn;
|
|||
|
PRTHX: TEdit;
|
|||
|
Label5: TLabel;
|
|||
|
Panel3: TPanel;
|
|||
|
SpeedButton1: TSpeedButton;
|
|||
|
SpeedButton2: TSpeedButton;
|
|||
|
SpeedButton3: TSpeedButton;
|
|||
|
SpeedButton4: TSpeedButton;
|
|||
|
SpeedButton5: TSpeedButton;
|
|||
|
SpeedButton6: TSpeedButton;
|
|||
|
SpeedButton7: TSpeedButton;
|
|||
|
SpeedButton8: TSpeedButton;
|
|||
|
SpeedButton9: TSpeedButton;
|
|||
|
SpeedButton10: TSpeedButton;
|
|||
|
SpeedButton11: TSpeedButton;
|
|||
|
SpeedButton12: TSpeedButton;
|
|||
|
SpeedButton49: TSpeedButton;
|
|||
|
Panel2: TPanel;
|
|||
|
SpeedButton48: TSpeedButton;
|
|||
|
SpeedButton58: TSpeedButton;
|
|||
|
SpeedButton67: TSpeedButton;
|
|||
|
SpeedButton76: TSpeedButton;
|
|||
|
SpeedButton83: TSpeedButton;
|
|||
|
SpeedButton84: TSpeedButton;
|
|||
|
SpeedButton86: TSpeedButton;
|
|||
|
SpeedButton87: TSpeedButton;
|
|||
|
TV2Column1: TcxGridDBColumn;
|
|||
|
TV2Column2: TcxGridDBColumn;
|
|||
|
Label7: TLabel;
|
|||
|
prtmf: TEdit;
|
|||
|
Label8: TLabel;
|
|||
|
PRTkz: TEdit;
|
|||
|
SpeedButton13: TSpeedButton;
|
|||
|
SpeedButton14: TSpeedButton;
|
|||
|
SpeedButton15: TSpeedButton;
|
|||
|
SpeedButton16: TSpeedButton;
|
|||
|
SpeedButton17: TSpeedButton;
|
|||
|
SpeedButton18: TSpeedButton;
|
|||
|
SpeedButton19: TSpeedButton;
|
|||
|
SpeedButton20: TSpeedButton;
|
|||
|
SpeedButton21: TSpeedButton;
|
|||
|
SpeedButton22: TSpeedButton;
|
|||
|
SpeedButton23: TSpeedButton;
|
|||
|
SpeedButton24: TSpeedButton;
|
|||
|
SpeedButton25: TSpeedButton;
|
|||
|
SpeedButton26: TSpeedButton;
|
|||
|
SpeedButton27: TSpeedButton;
|
|||
|
SpeedButton28: TSpeedButton;
|
|||
|
SpeedButton29: TSpeedButton;
|
|||
|
SpeedButton30: TSpeedButton;
|
|||
|
SpeedButton31: TSpeedButton;
|
|||
|
SpeedButton32: TSpeedButton;
|
|||
|
SpeedButton33: TSpeedButton;
|
|||
|
SpeedButton34: TSpeedButton;
|
|||
|
SpeedButton35: TSpeedButton;
|
|||
|
SpeedButton36: TSpeedButton;
|
|||
|
SpeedButton37: TSpeedButton;
|
|||
|
SpeedButton38: TSpeedButton;
|
|||
|
SpeedButton39: TSpeedButton;
|
|||
|
SpeedButton40: TSpeedButton;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure TBFindClick(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure OrderNoMChange(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure OrderNoMKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure TV2DblClick(Sender: TObject);
|
|||
|
procedure Button1Click(Sender: TObject);
|
|||
|
procedure OrderNoMClick(Sender: TObject);
|
|||
|
procedure SpeedButton49Click(Sender: TObject);
|
|||
|
procedure SpeedButton87Click(Sender: TObject);
|
|||
|
procedure SpeedButton76Click(Sender: TObject);
|
|||
|
procedure SpeedButton86Click(Sender: TObject);
|
|||
|
private
|
|||
|
FInt, PFInt: Integer;
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitForm();
|
|||
|
procedure InitGridWSQL(FWSQL: string);
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
fType: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmClothHCList: TfrmClothHCList;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_ClothContractInPut, U_Fun, U_ProductOrderList, U_ZDYHelp,
|
|||
|
U_ProductOrderNewList_JD;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmClothHCList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmClothHCList := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothHCList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothHCList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
WriteCxGrid(self.Caption + tv2.Name, Tv2, 'ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothHCList.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
//ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
|
|||
|
Close;
|
|||
|
Filtered := False;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_View_HC :begdate,:enddate,:WSQL');
|
|||
|
Parameters.ParamByName('begdate').Value := FormatDateTime('yyyy-MM-dd', BegDate.Date);
|
|||
|
Parameters.ParamByName('enddate').Value := FormatDateTime('yyyy-MM-dd', EndDate.Date + 1);
|
|||
|
Parameters.ParamByName('WSQL').Value := '';
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, Order_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, Order_Main);
|
|||
|
finally
|
|||
|
//ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothHCList.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.InitForm();
|
|||
|
begin
|
|||
|
ReadCxGrid(self.Caption + tv2.Name, Tv2, 'ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
EndDate.DateTime := SGetServerDateTime(ADOQueryTemp); // SGetServerDateTime(ADOQueryTemp)
|
|||
|
BegDate.DateTime := SGetServerDateTime(ADOQueryTemp) - 10000;
|
|||
|
Panel2.Visible := False;
|
|||
|
Panel3.Visible := False;
|
|||
|
//InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothHCList.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.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothHCList.OrderNoMChange(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.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
InitForm();
|
|||
|
TBRafresh.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothHCList.OrderNoMKeyPress(Sender: TObject; var Key: Char);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
if Length(Trim(OrderNoM.Text)) < 4 then
|
|||
|
Exit;
|
|||
|
fsj := ' and B.OrderNo like ''' + '%' + Trim(OrderNoM.Text) + '%' + '''';
|
|||
|
InitGridWSQL(fsj);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothHCList.TV2DblClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if fType = '10' then
|
|||
|
frmClothHCList.ModalResult := 1;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothHCList.Button1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if fType = '10' then
|
|||
|
frmClothHCList.ModalResult := 1;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothHCList.OrderNoMClick(Sender: TObject);
|
|||
|
var
|
|||
|
i: Integer;
|
|||
|
begin
|
|||
|
Panel3.Visible := True;
|
|||
|
with Panel3 do
|
|||
|
begin
|
|||
|
for i := 0 to ControlCount - 1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TSpeedButton then
|
|||
|
begin
|
|||
|
TSpeedButton(Controls[i]).Hint := Trim(TEdit(Sender).Name);
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
with Panel2 do
|
|||
|
begin
|
|||
|
for i := 0 to ControlCount - 1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TSpeedButton then
|
|||
|
begin
|
|||
|
TSpeedButton(Controls[i]).Hint := Trim(TEdit(Sender).Name);
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothHCList.SpeedButton49Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel3.Visible := False;
|
|||
|
Panel2.Visible := TRUE;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothHCList.SpeedButton87Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel2.Visible := False;
|
|||
|
Panel3.Visible := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothHCList.SpeedButton76Click(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
fsj := Trim(TSpeedButton(Sender).Hint);
|
|||
|
if Trim(fsj) = '' then
|
|||
|
Exit;
|
|||
|
fsj := Trim(TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text);
|
|||
|
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text := fsj + Trim(TSpeedButton(Sender).Caption);
|
|||
|
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).SelectAll;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothHCList.SpeedButton86Click(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
fsj := Trim(TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text);
|
|||
|
if Trim(fsj) = '' then
|
|||
|
Exit;
|
|||
|
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text := Copy(fsj, 1, Length(fsj) - 1);
|
|||
|
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).SelectAll;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|