325 lines
11 KiB
ObjectPascal
325 lines
11 KiB
ObjectPascal
![]() |
unit U_CHDDLIST;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
|
|||
|
cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin, StdCtrls,
|
|||
|
cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
|
|||
|
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
|
|||
|
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
|
|||
|
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
|
|||
|
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
|
|||
|
IdTCPClient, IdFTP, ShellAPI, IniFiles, cxCheckBox, cxCalendar, cxButtonEdit,
|
|||
|
cxTextEdit, cxDBLookupComboBox, cxGridBandedTableView, cxGridDBBandedTableView,
|
|||
|
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, U_BaseHelp, dxSkinsCore,
|
|||
|
dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu, System.ImageList,
|
|||
|
Vcl.ImgList, U_BaseList, RM_e_Xls;
|
|||
|
|
|||
|
type
|
|||
|
TfrmDDCHLIST = class(TfrmBaseList)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
Panel1: TPanel;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMDBHZ: TRMDBDataSet;
|
|||
|
Label3: TLabel;
|
|||
|
MPRTCodeName: TEdit;
|
|||
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
Label1: TLabel;
|
|||
|
MPRTCode: TEdit;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
Label4: TLabel;
|
|||
|
Label5: TLabel;
|
|||
|
Begdate: TDateTimePicker;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
TV1: TcxGridDBBandedTableView;
|
|||
|
cxGridDBBandedColumn35: TcxGridDBBandedColumn;
|
|||
|
cxGridDBBandedColumn42: TcxGridDBBandedColumn;
|
|||
|
cxGridDBBandedColumn62: TcxGridDBBandedColumn;
|
|||
|
cxGridDBBandedColumn64: TcxGridDBBandedColumn;
|
|||
|
cxGridDBBandedColumn79: TcxGridDBBandedColumn;
|
|||
|
cxGridDBBandedColumn81: TcxGridDBBandedColumn;
|
|||
|
cxGridLevel2: TcxGridLevel;
|
|||
|
V1Column26: TcxGridDBBandedColumn;
|
|||
|
V1Column27: TcxGridDBBandedColumn;
|
|||
|
Label2: TLabel;
|
|||
|
OrderNo: TEdit;
|
|||
|
V1Column7: TcxGridDBBandedColumn;
|
|||
|
Label6: TLabel;
|
|||
|
ConNo: TEdit;
|
|||
|
CDSPRTHZ: TClientDataSet;
|
|||
|
CDSPRTMX: TClientDataSet;
|
|||
|
RMDBMX: TRMDBDataSet;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
CDS_HZ: TClientDataSet;
|
|||
|
TV1Column4: TcxGridDBBandedColumn;
|
|||
|
TV1Column5: TcxGridDBBandedColumn;
|
|||
|
TV1Column6: TcxGridDBBandedColumn;
|
|||
|
TV1Column9: TcxGridDBBandedColumn;
|
|||
|
TV1Column14: TcxGridDBBandedColumn;
|
|||
|
Label7: TLabel;
|
|||
|
PRTKUANNO: TEdit;
|
|||
|
TV1Column15: TcxGridDBBandedColumn;
|
|||
|
TV1Column1: TcxGridDBBandedColumn;
|
|||
|
TV1Column2: TcxGridDBBandedColumn;
|
|||
|
TV1Column3: TcxGridDBBandedColumn;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
TV1Column7: TcxGridDBBandedColumn;
|
|||
|
TV1Column8: TcxGridDBBandedColumn;
|
|||
|
ToolButton5: TToolButton;
|
|||
|
RM2: TRMGridReport;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure MPRTCodeNameChange(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure V1Column9CompareRowValuesForCellMerging(Sender: TcxGridColumn; ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties; const AValue1: Variant; ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties; const AValue2: Variant; var AAreEqual: Boolean);
|
|||
|
procedure TV1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
procedure cxGridDBBandedColumn64CompareRowValuesForCellMerging(Sender: TcxGridColumn; ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties; const AValue1: Variant; ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties; const AValue2: Variant; var AAreEqual: Boolean);
|
|||
|
procedure TV1Column6CompareRowValuesForCellMerging(Sender: TcxGridColumn; ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties; const AValue1: Variant; ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties; const AValue2: Variant; var AAreEqual: Boolean);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
private
|
|||
|
|
|||
|
{ Private declarations }
|
|||
|
canshu1: string;
|
|||
|
procedure InitGrid();
|
|||
|
public
|
|||
|
fkhType: string;
|
|||
|
Fmanage: string;
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmDDCHLIST: TfrmDDCHLIST;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_ZDYHelp, U_CHDDLISTMX;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmDDCHLIST.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(' exec P_DD_CKLIST @Begdate=' + quotedstr(trim(FormatDateTime('yyyy-MM-dd', Begdate.DateTime))));
|
|||
|
sql.Add(' ,@enddate=' + quotedstr(trim(FormatDateTime('yyyy-MM-dd', EndDate.DateTime + 1))));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryMain, CDS_HZ);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_HZ);
|
|||
|
// CDS_HZ.Last;
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDDCHLIST.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
frmDDCHLIST := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDDCHLIST.cxGridDBBandedColumn64CompareRowValuesForCellMerging(Sender: TcxGridColumn; ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties; const AValue1: Variant; ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties; const AValue2: Variant; var AAreEqual: Boolean);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
if (ARow1.Values[TV1Column2.Index] = ARow2.Values[TV1Column2.Index]) then
|
|||
|
AAreEqual := True
|
|||
|
else
|
|||
|
AAreEqual := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDDCHLIST.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDDCHLIST.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxBandedGrid(trim(self.caption), Tv1, '<27><><EFBFBD>ȹ<EFBFBD><C8B9><EFBFBD>77');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDDCHLIST.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
ReadCxBandedGrid(trim(self.caption), Tv1, '<27><><EFBFBD>ȹ<EFBFBD><C8B9><EFBFBD>77');
|
|||
|
// InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDDCHLIST.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDDCHLIST.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, CDS_HZ);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_HZ);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDDCHLIST.ToolButton3Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
Porderno, LBName, SYRName: string;
|
|||
|
i, j: Integer;
|
|||
|
OrderKg: Double;
|
|||
|
begin
|
|||
|
if CDS_HZ.IsEmpty then
|
|||
|
Exit;
|
|||
|
|
|||
|
LBName := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
ExportFtErpFile('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.rmf', ADOQueryTemp);
|
|||
|
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.add('exec P_PRINT_DD_CKLIST @mainid=' + quotedstr(Trim(cds_hz.fieldbyname('MainId').AsString)));
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryPrint, CDSPRTHZ);
|
|||
|
SInitCDSData(ADOQueryPrint, CDSPRTHZ);
|
|||
|
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(LBName) + '.rmf';
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMXLSExport1 := TRMXLSExport.Create(RMXLSExport1);
|
|||
|
rm1.PreviewButtons := [rmpbZoom, rmpbLoad, rmpbSave, rmpbPrint, rmpbFind, rmpbPageSetup, rmpbExit, rmpbSaveToXLS, rmpbExport, rmpbNavigator];
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
// RMVariables['SYRName'] := Trim(SYRName);
|
|||
|
// RMVariables['ZJGFACTORYNAME'] := Trim(ORDER_SUB.fieldbyname('ZJGFACTORYNAME').AsString);
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\' + Trim(LBName) + '.rmf'), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDDCHLIST.ToolButton4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
// try
|
|||
|
// frmDDCHLISTMX := TfrmDDCHLISTMX.Create(Application);
|
|||
|
// with frmDDCHLISTMX do
|
|||
|
// begin
|
|||
|
//
|
|||
|
// FMainId := '';
|
|||
|
//
|
|||
|
// if ShowModal = 1 then
|
|||
|
// begin
|
|||
|
// InitGrid();
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
// finally
|
|||
|
// frmDDCHLISTMX.Free;
|
|||
|
// end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDDCHLIST.ToolButton5Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
Porderno, LBName, SYRName: string;
|
|||
|
i, j: Integer;
|
|||
|
OrderKg: Double;
|
|||
|
begin
|
|||
|
if CDS_HZ.IsEmpty then
|
|||
|
Exit;
|
|||
|
|
|||
|
LBName := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2';
|
|||
|
ExportFtErpFile('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2.rmf', ADOQueryTemp);
|
|||
|
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(LBName) + '.rmf';
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMXLSExport1 := TRMXLSExport.Create(RMXLSExport1);
|
|||
|
rm2.PreviewButtons := [rmpbZoom, rmpbLoad, rmpbSave, rmpbPrint, rmpbFind, rmpbPageSetup, rmpbExit, rmpbSaveToXLS, rmpbExport, rmpbNavigator];
|
|||
|
RM2.LoadFromFile(fPrintFile);
|
|||
|
// RMVariables['SYRName'] := Trim(SYRName);
|
|||
|
// RMVariables['ZJGFACTORYNAME'] := Trim(ORDER_SUB.fieldbyname('ZJGFACTORYNAME').AsString);
|
|||
|
RM2.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\' + Trim(LBName) + '.rmf'), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDDCHLIST.TV1Column6CompareRowValuesForCellMerging(Sender: TcxGridColumn; ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties; const AValue1: Variant; ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties; const AValue2: Variant; var AAreEqual: Boolean);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
if (ARow1.Values[TV1Column1.Index] = ARow2.Values[TV1Column1.Index]) then
|
|||
|
AAreEqual := True
|
|||
|
else
|
|||
|
AAreEqual := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDDCHLIST.TV1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
// if (ARow1.Values[cxGridDBBandedColumn62.Index] = ARow2.Values[cxGridDBBandedColumn62.Index]) and (ARow1.Values[TV1Column6.Index] = ARow2.Values[TV1Column6.Index]) and (ARow1.Values[TV1Column5.Index] = ARow2.Values[TV1Column5.Index]) and (ARow1.Values[TV1Column15.Index] = ARow2.Values[TV1Column15.Index]) then
|
|||
|
// AAreEqual := True
|
|||
|
// else
|
|||
|
// AAreEqual := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDDCHLIST.V1Column9CompareRowValuesForCellMerging(Sender: TcxGridColumn; ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties; const AValue1: Variant; ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties; const AValue2: Variant; var AAreEqual: Boolean);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
if (ARow1.Values[TV1Column1.Index] = ARow2.Values[TV1Column1.Index]) then
|
|||
|
AAreEqual := True
|
|||
|
else
|
|||
|
AAreEqual := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDDCHLIST.MPRTCodeNameChange(Sender: TObject);
|
|||
|
begin
|
|||
|
ToolButton2.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDDCHLIST.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
Exit;
|
|||
|
TcxGridToExcel(self.Caption, cxgrid1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDDCHLIST.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
canshu1 := Trim(DParameters1);
|
|||
|
EndDate.DateTime := SGetServerDate(ADOQueryTemp);
|
|||
|
BegDate.DateTime := EndDate.DateTime - 90;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|