338 lines
12 KiB
ObjectPascal
338 lines
12 KiB
ObjectPascal
![]() |
unit U_CWGYSDZMXList;
|
|||
|
|
|||
|
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, cxDropDownEdit, RM_e_Xls, cxGridBandedTableView,
|
|||
|
cxGridDBBandedTableView, BtnEdit, cxLookAndFeels, cxLookAndFeelPainters,
|
|||
|
cxNavigator, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges,
|
|||
|
dxBarBuiltInMenu;
|
|||
|
|
|||
|
type
|
|||
|
TfrmCWGYSDZMXList = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
Panel1: TPanel;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
Label1: TLabel;
|
|||
|
MPRTCodeName: TEdit;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
Label3: TLabel;
|
|||
|
OrderNo: TEdit;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
Label2: TLabel;
|
|||
|
Label6: TLabel;
|
|||
|
begdate: TDateTimePicker;
|
|||
|
Enddate: TDateTimePicker;
|
|||
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
DS_HZ: TDataSource;
|
|||
|
CDS_HZ: TClientDataSet;
|
|||
|
Label4: TLabel;
|
|||
|
OrdDefNote3: TComboBox;
|
|||
|
Label5: TLabel;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
RMGridReport1: TRMGridReport;
|
|||
|
RMDBDataSet1: TRMDBDataSet;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
Panetime: TPanel;
|
|||
|
TV1: TcxGridDBBandedTableView;
|
|||
|
V1Column1: TcxGridDBBandedColumn;
|
|||
|
V1Column2: TcxGridDBBandedColumn;
|
|||
|
V1Column4: TcxGridDBBandedColumn;
|
|||
|
V1Column5: TcxGridDBBandedColumn;
|
|||
|
V1Column6: TcxGridDBBandedColumn;
|
|||
|
V1Column7: TcxGridDBBandedColumn;
|
|||
|
V1Column8: TcxGridDBBandedColumn;
|
|||
|
V1Column9: TcxGridDBBandedColumn;
|
|||
|
V1Column12: TcxGridDBBandedColumn;
|
|||
|
V1Column15: TcxGridDBBandedColumn;
|
|||
|
V1Column3: TcxGridDBBandedColumn;
|
|||
|
factoryName: TBtnEditA;
|
|||
|
V1Column10: TcxGridDBBandedColumn;
|
|||
|
V1Column14: TcxGridDBBandedColumn;
|
|||
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
cxStyle1: TcxStyle;
|
|||
|
V1Column16: TcxGridDBBandedColumn;
|
|||
|
V1Column17: TcxGridDBBandedColumn;
|
|||
|
V1Column18: TcxGridDBBandedColumn;
|
|||
|
V1Column19: TcxGridDBBandedColumn;
|
|||
|
V1Column20: TcxGridDBBandedColumn;
|
|||
|
V1Column21: TcxGridDBBandedColumn;
|
|||
|
V1Column22: TcxGridDBBandedColumn;
|
|||
|
V1Column23: TcxGridDBBandedColumn;
|
|||
|
V1Column24: TcxGridDBBandedColumn;
|
|||
|
V1Column25: TcxGridDBBandedColumn;
|
|||
|
V1Column26: TcxGridDBBandedColumn;
|
|||
|
V1Column33: TcxGridDBBandedColumn;
|
|||
|
V1Column34: TcxGridDBBandedColumn;
|
|||
|
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 P_OrderNo_YSK(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure OrderNoChange(Sender: TObject);
|
|||
|
procedure MPRTCodeNameChange(Sender: TObject);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure factoryNameBtnClick(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 V1Column14CompareRowValuesForCellMerging(Sender: TcxGridColumn; ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties; const AValue1: Variant; ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties; const AValue2: Variant; var AAreEqual: Boolean);
|
|||
|
procedure V1Column2CompareRowValuesForCellMerging(Sender: TcxGridColumn; ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties; const AValue1: Variant; ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties; const AValue2: Variant; var AAreEqual: Boolean);
|
|||
|
procedure V1Column27CompareRowValuesForCellMerging(Sender: TcxGridColumn; ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties; const AValue1: Variant; ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties; const AValue2: Variant; var AAreEqual: Boolean);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
|
|||
|
procedure InitGrid();
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
RKFlag, FCYID, FZKType, FBZType: string;
|
|||
|
fType: string;
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmCWGYSDZMXList: TfrmCWGYSDZMXList;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_ZDYHelp, U_GYSSel;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmCWGYSDZMXList.InitGrid();
|
|||
|
begin
|
|||
|
if trim(factoryName.Text) = '' then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>߲<EFBFBD>ѯ<EFBFBD>ٶȣ<D9B6>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
screen.Cursor := crsqlwait;
|
|||
|
Panetime.Visible := true;
|
|||
|
Panetime.Left := (Width - Panetime.Width) div 2;
|
|||
|
Panetime.top := (Height - Panetime.Height - 200) div 2;
|
|||
|
application.ProcessMessages;
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
Filtered := False;
|
|||
|
sql.Add(' exec P_CW_YFFKMX ');
|
|||
|
sql.Add(' @begdate=' + QuotedStr(Trim(FormatDateTime('yyyy-MM-dd', begdate.DateTime))));
|
|||
|
sql.Add(' ,@Enddate=' + QuotedStr(Trim(FormatDateTime('yyyy-MM-dd', Enddate.DateTime + 1))));
|
|||
|
sql.Add(' ,@factoryNAME=' + QuotedStr(Trim(factoryName.TEXT)));
|
|||
|
// sql.Add(' ,@BZType=' + QuotedStr(Trim(FBZType)));
|
|||
|
// showmessage(sql.text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryMain, CDS_HZ);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_HZ);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
ToolButton2.Click;
|
|||
|
Panetime.Visible := false;
|
|||
|
screen.Cursor := crdefault;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWGYSDZMXList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmCWGYSDZMXList := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWGYSDZMXList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWGYSDZMXList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxBandedGrid(self.Caption + '2', Tv1, 'Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWGYSDZMXList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
readCxBandedGrid(self.Caption + '2', Tv1, 'Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>');
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWGYSDZMXList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
begdate.SetFocus;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWGYSDZMXList.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 TfrmCWGYSDZMXList.P_OrderNo_YSK(Sender: TObject);
|
|||
|
begin
|
|||
|
ToolButton2.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWGYSDZMXList.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
Exit;
|
|||
|
TcxGridToExcel(self.Caption + '-' + trim(factoryName.Text), cxgrid2);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWGYSDZMXList.OrderNoChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if Length(Trim(OrderNo.Text)) < 3 then
|
|||
|
Exit;
|
|||
|
ToolButton2.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWGYSDZMXList.MPRTCodeNameChange(Sender: TObject);
|
|||
|
begin
|
|||
|
ToolButton2.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWGYSDZMXList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
cxGrid2.Align := AlClient;
|
|||
|
Enddate.DateTime := SGetServerDate(ADOQueryTemp);
|
|||
|
begdate.DateTime := Enddate.DateTime;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWGYSDZMXList.ToolButton3Click(Sender: TObject);
|
|||
|
var
|
|||
|
filepath: string;
|
|||
|
mBegdate, mEnddate: string;
|
|||
|
begin
|
|||
|
mBegdate := FormatDateTime('yyyy-MM-dd', begdate.Date);
|
|||
|
mEnddate := FormatDateTime('yyyy-MM-dd', enddate.Date);
|
|||
|
if CDS_HZ.IsEmpty then
|
|||
|
exit;
|
|||
|
// with ADOQueryPrint do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// SQL.Clear;
|
|||
|
// sql.Add(' exec P_YSSK_List_MxPrint ');
|
|||
|
// sql.Add('@enddate=''' + Trim(FormatDateTime('yyyy-MM-dd', Enddate.DateTime)) + ''' ');
|
|||
|
// sql.Add(',@factoryName=''' + Trim(CDS_HZ.fieldbyname('factoryName').AsString) + ''' ');
|
|||
|
// Open;
|
|||
|
// end;
|
|||
|
|
|||
|
try
|
|||
|
|
|||
|
filepath := ExtractFilePath(Application.ExeName) + 'report\Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD>˵<EFBFBD>.rmf';
|
|||
|
if not FileExists(Pchar(filepath)) then
|
|||
|
begin
|
|||
|
application.MessageBox(pchar('<27>ļ<EFBFBD>[' + filepath + ']<5D><><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>'), '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_IConError);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
// RMVariables['dtxz'] :=FormatDateTime('yyyy-mm-dd',date());
|
|||
|
|
|||
|
RMGridReport1.LoadFromFile(filepath);
|
|||
|
|
|||
|
RMGridReport1.ShowReport;
|
|||
|
finally
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWGYSDZMXList.factoryNameBtnClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmGYSSel := TfrmGYSSel.Create(Application);
|
|||
|
with frmGYSSel do
|
|||
|
begin
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
FactoryName.Text := Trim(CDS_HZ.fieldbyname('CoName').AsString);
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmGYSSel.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWGYSDZMXList.V1Column9CompareRowValuesForCellMerging(Sender: TcxGridColumn; ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties; const AValue1: Variant; ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties; const AValue2: Variant; var AAreEqual: Boolean);
|
|||
|
begin
|
|||
|
if ARow1.Values[V1Column10.Index] = ARow2.Values[V1Column10.Index] then
|
|||
|
AAreEqual := True
|
|||
|
else
|
|||
|
AAreEqual := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWGYSDZMXList.TV1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
begin
|
|||
|
// if (AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('keyNO').Index]) mod 2 = 0 then
|
|||
|
// begin
|
|||
|
// ACanvas.Brush.Color := $EEF5FF;
|
|||
|
// end
|
|||
|
// else
|
|||
|
// begin
|
|||
|
// ACanvas.Brush.Color := $FFF8F0;
|
|||
|
// end;
|
|||
|
//
|
|||
|
// if (AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('KPMoney').Index]) <> 0 then
|
|||
|
// begin
|
|||
|
// ACanvas.Font.Color := $FF0000;
|
|||
|
// end
|
|||
|
// else if (AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('MxMoney').Index]) <> 0 then
|
|||
|
// begin
|
|||
|
// ACanvas.Font.Color := $0000FF;
|
|||
|
// end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWGYSDZMXList.V1Column14CompareRowValuesForCellMerging(Sender: TcxGridColumn; ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties; const AValue1: Variant; ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties; const AValue2: Variant; var AAreEqual: Boolean);
|
|||
|
begin
|
|||
|
if ARow1.Values[V1Column14.Index] = ARow2.Values[V1Column14.Index] then
|
|||
|
AAreEqual := True
|
|||
|
else
|
|||
|
AAreEqual := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWGYSDZMXList.V1Column2CompareRowValuesForCellMerging(Sender: TcxGridColumn; ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties; const AValue1: Variant; ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties; const AValue2: Variant; var AAreEqual: Boolean);
|
|||
|
begin
|
|||
|
if (ARow1.Values[V1Column10.Index] = ARow2.Values[V1Column10.Index]) and (ARow1.Values[V1Column2.Index] = ARow2.Values[V1Column2.Index]) then
|
|||
|
AAreEqual := True
|
|||
|
else
|
|||
|
AAreEqual := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWGYSDZMXList.V1Column27CompareRowValuesForCellMerging(Sender: TcxGridColumn; ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties; const AValue1: Variant; ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties; const AValue2: Variant; var AAreEqual: Boolean);
|
|||
|
begin
|
|||
|
if ARow1.Values[V1Column2.Index] = ARow2.Values[V1Column2.Index] then
|
|||
|
AAreEqual := True
|
|||
|
else
|
|||
|
AAreEqual := False;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|