281 lines
7.4 KiB
ObjectPascal
281 lines
7.4 KiB
ObjectPascal
![]() |
unit U_GDCKList; //
|
|||
|
|
|||
|
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, cxPC, cxCheckBox, cxDropDownEdit;
|
|||
|
|
|||
|
type
|
|||
|
TfrmGDCKList = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBFind: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
TBExport: TToolButton;
|
|||
|
Order_Main: TClientDataSet;
|
|||
|
Panel1: TPanel;
|
|||
|
Label4: TLabel;
|
|||
|
GDPerson: TEdit;
|
|||
|
Label2: TLabel;
|
|||
|
FactoryName: TEdit;
|
|||
|
Label3: TLabel;
|
|||
|
BPCode: TEdit;
|
|||
|
Label10: TLabel;
|
|||
|
DQFactoryName: TEdit;
|
|||
|
Label5: TLabel;
|
|||
|
BPName: TEdit;
|
|||
|
Label6: TLabel;
|
|||
|
BPSpec: TEdit;
|
|||
|
Label1: TLabel;
|
|||
|
TaiTou: TEdit;
|
|||
|
Label7: TLabel;
|
|||
|
ColorName: TEdit;
|
|||
|
Label8: TLabel;
|
|||
|
GangNo: TEdit;
|
|||
|
Label9: TLabel;
|
|||
|
KZ: TEdit;
|
|||
|
Label11: TLabel;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v1Column28: TcxGridDBColumn;
|
|||
|
v1FactoryName: TcxGridDBColumn;
|
|||
|
v1Column27: TcxGridDBColumn;
|
|||
|
v1OrderNo: TcxGridDBColumn;
|
|||
|
v1PSName: TcxGridDBColumn;
|
|||
|
v1Column20: TcxGridDBColumn;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
v1GDPerson: TcxGridDBColumn;
|
|||
|
v1ToFactoryName: TcxGridDBColumn;
|
|||
|
v1QtyUnit: TcxGridDBColumn;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
v1Column10: TcxGridDBColumn;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
v1Column18: TcxGridDBColumn;
|
|||
|
v1Column19: TcxGridDBColumn;
|
|||
|
v1Column11: TcxGridDBColumn;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
Label12: TLabel;
|
|||
|
ColorType: TComboBox;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
v1Column14: TcxGridDBColumn;
|
|||
|
v1Column15: TcxGridDBColumn;
|
|||
|
v1Column16: TcxGridDBColumn;
|
|||
|
v1Column17: TcxGridDBColumn;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure TBFindClick(Sender: TObject);
|
|||
|
procedure TBExportClick(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure FPNoChange(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure v1Column11CustomDrawCell(Sender: TcxCustomGridTableView;
|
|||
|
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
|
|||
|
var ADone: Boolean);
|
|||
|
procedure v1Column7CustomDrawCell(Sender: TcxCustomGridTableView;
|
|||
|
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
|
|||
|
var ADone: Boolean);
|
|||
|
procedure ColorTypeChange(Sender: TObject);
|
|||
|
procedure v1Column14CustomDrawCell(Sender: TcxCustomGridTableView;
|
|||
|
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
|
|||
|
var ADone: Boolean);
|
|||
|
private
|
|||
|
FInt,PFInt:Integer;
|
|||
|
canshu1:string;
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitGridWSql(fsj:string);
|
|||
|
procedure InitForm();
|
|||
|
function DelData():Boolean;
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmGDCKList: TfrmGDCKList;
|
|||
|
|
|||
|
implementation
|
|||
|
uses
|
|||
|
U_DataLink,U_RTFun;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmGDCKList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmGDCKList:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDCKList.FormClose(Sender: TObject;
|
|||
|
var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action:=caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDCKList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDCKList.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' exec P_View_GDCPCK :BegDate,:EndDate ');
|
|||
|
Parameters.ParamByName('BegDate').Value:=Trim(FormatDateTime('yyyy-MM-dd',BegDate.Date));
|
|||
|
Parameters.ParamByName('EndDate').Value:=Trim(FormatDateTime('yyyy-MM-dd',EndDate.Date));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDCKList.InitGridWSql(fsj:string);
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDCKList.InitForm();
|
|||
|
begin
|
|||
|
EndDate.DateTime:=SGetServerDate10(ADOQueryTemp)+1;
|
|||
|
BegDate.DateTime:=SGetServerDate10(ADOQueryTemp);
|
|||
|
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDCKList.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;
|
|||
|
|
|||
|
function TfrmGDCKList.DelData():Boolean;
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDCKList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then Exit;
|
|||
|
TcxGridToExcel(Self.Caption,cxGrid1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDCKList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDCKList.FPNoChange(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 TfrmGDCKList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
InitForm();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDCKList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
canshu1:=Trim(DParameters1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDCKList.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDCKList.v1Column11CustomDrawCell(
|
|||
|
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
|
|||
|
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
var
|
|||
|
Id:Integer;
|
|||
|
begin
|
|||
|
|
|||
|
Id:=TV1.GetColumnByFieldName('TPJGSHQty').Index;
|
|||
|
if Id<0 then Exit;
|
|||
|
if AViewInfo.GridRecord.Values[id]=Null then Exit;
|
|||
|
if AViewInfo.GridRecord.Values[id]<0 then
|
|||
|
begin
|
|||
|
ACanvas.Brush.Color:=clRed;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDCKList.v1Column7CustomDrawCell(
|
|||
|
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
|
|||
|
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
var
|
|||
|
Id:Integer;
|
|||
|
begin
|
|||
|
|
|||
|
Id:=TV1.GetColumnByFieldName('TPZGHSHZ').Index;
|
|||
|
if Id<0 then Exit;
|
|||
|
if AViewInfo.GridRecord.Values[id]=Null then Exit;
|
|||
|
if AViewInfo.GridRecord.Values[id]<0 then
|
|||
|
begin
|
|||
|
ACanvas.Brush.Color:=clRed;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDCKList.ColorTypeChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDCKList.v1Column14CustomDrawCell(
|
|||
|
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
|
|||
|
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
var
|
|||
|
Id,id10:Integer;
|
|||
|
begin
|
|||
|
Id:=TV1.GetColumnByFieldName('TPPS').Index;
|
|||
|
id10:=TV1.GetColumnByFieldName('WCPS').Index;
|
|||
|
if Id<0 then Exit; if id10<0 then Exit;
|
|||
|
if AViewInfo.GridRecord.Values[id]=Null then Exit;
|
|||
|
if AViewInfo.GridRecord.Values[id10]=Null then Exit;
|
|||
|
if AViewInfo.GridRecord.Values[id]<>AViewInfo.GridRecord.Values[id10] then
|
|||
|
begin
|
|||
|
ACanvas.Brush.Color:=clRed; //clGreen
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|