698 lines
20 KiB
ObjectPascal
698 lines
20 KiB
ObjectPascal
![]() |
unit U_CKProductBCPInList;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
|||
|
cxEdit, DB, cxDBData, cxGridCustomTableView, cxGridTableView,
|
|||
|
cxGridBandedTableView, cxGridDBBandedTableView, cxGridLevel, cxClasses,
|
|||
|
cxControls, cxGridCustomView, cxGridDBTableView, cxGrid, StdCtrls, ComCtrls,
|
|||
|
ExtCtrls, ToolWin, cxGridCustomPopupMenu, cxGridPopupMenu, ADODB, DBClient,
|
|||
|
cxDropDownEdit, cxCheckBox, RM_Common, RM_Class, RM_e_Xls, RM_Dataset,
|
|||
|
RM_System, RM_GridReport, Menus, cxCalendar, MovePanel, Math, Clipbrd, cxPC,
|
|||
|
cxLookAndFeels, cxLookAndFeelPainters, 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, cxNavigator, dxBarBuiltInMenu;
|
|||
|
|
|||
|
type
|
|||
|
TfrmCKProductBCPInList = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBExport: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
Label2: TLabel;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
CDS_Main: TClientDataSet;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
cxgrdMPRTCodeName: TcxGridDBColumn;
|
|||
|
cxgrdPRTColor: TcxGridDBColumn;
|
|||
|
cxgrdMPRTMF: TcxGridDBColumn;
|
|||
|
cxgrdMPRTKZ: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
cxgrdKGQty: TcxGridDBColumn;
|
|||
|
cxgrdQty: TcxGridDBColumn;
|
|||
|
cxgrdQtyUnit: TcxGridDBColumn;
|
|||
|
cxgrdMPRTSpec: TcxGridDBColumn;
|
|||
|
cxGrid2Level1: TcxGridLevel;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
TBRKCX: TToolButton;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
cxgrdNetKGQty: TcxGridDBColumn;
|
|||
|
cxgrdKuangHao: TcxGridDBColumn;
|
|||
|
v1Column19: TcxGridDBColumn;
|
|||
|
v1Column20: TcxGridDBColumn;
|
|||
|
lblAPID: TLabel;
|
|||
|
cxgrdAPID: TcxGridDBColumn;
|
|||
|
v1Column22: TcxGridDBColumn;
|
|||
|
begtime: TDateTimePicker;
|
|||
|
endTime: TDateTimePicker;
|
|||
|
RMDBPRT: TRMDBDataSet;
|
|||
|
MovePanel2: TMovePanel;
|
|||
|
IsJYTime: TCheckBox;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
cxgrdCustomerNoName: TcxGridDBColumn;
|
|||
|
APID: TEdit;
|
|||
|
lblMPRTCodeName: TLabel;
|
|||
|
lblMJID: TLabel;
|
|||
|
lblMPRTKZ: TLabel;
|
|||
|
lblMPRTMF: TLabel;
|
|||
|
lblCPType: TLabel;
|
|||
|
lblPRTColor: TLabel;
|
|||
|
lblMPRTSpec: TLabel;
|
|||
|
lblRKplace: TLabel;
|
|||
|
lblConNo: TLabel;
|
|||
|
lblRKOrdID: TLabel;
|
|||
|
lblKuangHao: TLabel;
|
|||
|
Label14: TLabel;
|
|||
|
MPRTCodeName: TEdit;
|
|||
|
MJID: TEdit;
|
|||
|
MPRTKZ: TEdit;
|
|||
|
MPRTMF: TEdit;
|
|||
|
CPType: TComboBox;
|
|||
|
RKplace: TEdit;
|
|||
|
PRTColor: TEdit;
|
|||
|
MPRTSpec: TEdit;
|
|||
|
ConNo: TEdit;
|
|||
|
RKOrdID: TEdit;
|
|||
|
KuangHao: TEdit;
|
|||
|
CustomerNoName: TEdit;
|
|||
|
cxgrdJQty: TcxGridDBColumn;
|
|||
|
N3: TMenuItem;
|
|||
|
lblorderNo: TLabel;
|
|||
|
orderNo: TEdit;
|
|||
|
Panel2: TPanel;
|
|||
|
Panel3: TPanel;
|
|||
|
Panel6: TPanel;
|
|||
|
Label31: TLabel;
|
|||
|
LBCPAP: TLabel;
|
|||
|
BTLP: TButton;
|
|||
|
BTNP: TButton;
|
|||
|
TCBNOR: TComboBox;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure ConNoMChange(Sender: TObject);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure TBExportClick(Sender: TObject);
|
|||
|
procedure orderNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure TBRKCXClick(Sender: TObject);
|
|||
|
procedure Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
procedure BTNPClick(Sender: TObject);
|
|||
|
procedure BTLPClick(Sender: TObject);
|
|||
|
procedure TCBNORChange(Sender: TObject);
|
|||
|
procedure CPTypeChange(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure N3Click(Sender: TObject);
|
|||
|
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure CustomerNoNameKeyPress(Sender: TObject; var Key: Char);
|
|||
|
private
|
|||
|
canshu2: string;
|
|||
|
CurrentPage, RecordsNumber: Integer;
|
|||
|
procedure InitGrid();
|
|||
|
procedure SetStatus();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
canshu1: string;
|
|||
|
FLeft, FTop: Integer;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
//var
|
|||
|
// frmCKProductBCPInList: TfrmCKProductBCPInList;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_Fun, U_SysLogHelp;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
procedure TfrmCKProductBCPInList.SetStatus();
|
|||
|
var
|
|||
|
i: Integer;
|
|||
|
begin
|
|||
|
lblorderNo.Visible := True;
|
|||
|
orderNo.Visible := True;
|
|||
|
|
|||
|
lblMPRTCodeName.Visible := True;
|
|||
|
MPRTCodeName.Visible := True;
|
|||
|
|
|||
|
lblMPRTSpec.Visible := True;
|
|||
|
MPRTSpec.Visible := True;
|
|||
|
|
|||
|
lblMPRTMF.Visible := True;
|
|||
|
MPRTMF.Visible := True;
|
|||
|
|
|||
|
lblMPRTKZ.Visible := True;
|
|||
|
MPRTKZ.Visible := True;
|
|||
|
|
|||
|
lblPRTColor.Visible := True;
|
|||
|
PRTColor.Visible := True;
|
|||
|
|
|||
|
lblCPType.Visible := True;
|
|||
|
CPType.Visible := True;
|
|||
|
|
|||
|
lblConNo.Visible := True;
|
|||
|
ConNo.Visible := True;
|
|||
|
|
|||
|
lblRKOrdID.Visible := True;
|
|||
|
RKOrdID.Visible := True;
|
|||
|
|
|||
|
lblRKplace.Visible := True;
|
|||
|
RKplace.Visible := True;
|
|||
|
|
|||
|
lblKuangHao.Visible := True;
|
|||
|
KuangHao.Visible := True;
|
|||
|
|
|||
|
lblMJID.Visible := True;
|
|||
|
MJID.Visible := True;
|
|||
|
|
|||
|
lblAPID.Visible := True;
|
|||
|
APID.Visible := True;
|
|||
|
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
Panel6.Visible := False;
|
|||
|
for i := 0 to tv1.ColumnCount - 1 do
|
|||
|
begin
|
|||
|
tv1.Columns[i].Visible := false;
|
|||
|
end;
|
|||
|
cxgrdJQty.Visible := True;
|
|||
|
cxgrdCustomerNoName.Visible := True;
|
|||
|
cxgrdKGQty.Visible := True;
|
|||
|
cxgrdNETKGQty.Visible := True;
|
|||
|
cxgrdQty.Visible := True;
|
|||
|
cxgrdQtyUnit.Visible := True;
|
|||
|
|
|||
|
lblorderNo.Visible := False;
|
|||
|
orderNo.Text := '';
|
|||
|
orderNo.Visible := False;
|
|||
|
|
|||
|
lblMPRTCodeName.Visible := False;
|
|||
|
MPRTCodeName.Text := '';
|
|||
|
MPRTCodeName.Visible := False;
|
|||
|
|
|||
|
lblMPRTSpec.Visible := False;
|
|||
|
MPRTSpec.Text := '';
|
|||
|
MPRTSpec.Visible := False;
|
|||
|
|
|||
|
lblMPRTMF.Visible := False;
|
|||
|
MPRTMF.Text := '';
|
|||
|
MPRTMF.Visible := False;
|
|||
|
|
|||
|
lblMPRTKZ.Visible := False;
|
|||
|
MPRTKZ.Text := '';
|
|||
|
MPRTKZ.Visible := False;
|
|||
|
|
|||
|
lblPRTColor.Visible := False;
|
|||
|
PRTColor.Text := '';
|
|||
|
PRTColor.Visible := False;
|
|||
|
|
|||
|
lblCPType.Visible := False;
|
|||
|
CPType.Text := '';
|
|||
|
CPType.Visible := False;
|
|||
|
|
|||
|
lblConNo.Visible := False;
|
|||
|
ConNo.Text := '';
|
|||
|
ConNo.Visible := False;
|
|||
|
|
|||
|
lblRKOrdID.Visible := False;
|
|||
|
RKOrdID.Text := '';
|
|||
|
RKOrdID.Visible := False;
|
|||
|
|
|||
|
lblRKplace.Visible := False;
|
|||
|
RKplace.Text := '';
|
|||
|
RKplace.Visible := False;
|
|||
|
|
|||
|
lblKuangHao.Visible := False;
|
|||
|
KuangHao.Text := '';
|
|||
|
KuangHao.Visible := False;
|
|||
|
|
|||
|
lblMJID.Visible := False;
|
|||
|
MJID.Text := '';
|
|||
|
MJID.Visible := False;
|
|||
|
|
|||
|
lblAPID.Visible := False;
|
|||
|
APID.Text := '';
|
|||
|
APID.Visible := False;
|
|||
|
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
Panel6.Visible := False;
|
|||
|
for i := 0 to tv1.ColumnCount - 1 do
|
|||
|
begin
|
|||
|
tv1.Columns[i].Visible := false;
|
|||
|
end;
|
|||
|
cxgrdJQty.Visible := True;
|
|||
|
cxgrdCustomerNoName.Visible := True;
|
|||
|
cxgrdKGQty.Visible := True;
|
|||
|
cxgrdNETKGQty.Visible := True;
|
|||
|
cxgrdQty.Visible := True;
|
|||
|
cxgrdQtyUnit.Visible := True;
|
|||
|
cxgrdMPRTCodeName.Visible := True;
|
|||
|
cxgrdMPRTSpec.Visible := True;
|
|||
|
cxgrdMPRTMF.Visible := True;
|
|||
|
cxgrdMPRTKZ.Visible := True;
|
|||
|
cxgrdPRTColor.Visible := True;
|
|||
|
|
|||
|
lblorderNo.Visible := False;
|
|||
|
orderNo.Text := '';
|
|||
|
orderNo.Visible := False;
|
|||
|
|
|||
|
lblCPType.Visible := False;
|
|||
|
CPType.Text := '';
|
|||
|
CPType.Visible := False;
|
|||
|
|
|||
|
lblConNo.Visible := False;
|
|||
|
ConNo.Text := '';
|
|||
|
ConNo.Visible := False;
|
|||
|
|
|||
|
lblRKOrdID.Visible := False;
|
|||
|
RKOrdID.Text := '';
|
|||
|
RKOrdID.Visible := False;
|
|||
|
|
|||
|
lblRKplace.Visible := False;
|
|||
|
RKplace.Text := '';
|
|||
|
RKplace.Visible := False;
|
|||
|
|
|||
|
lblKuangHao.Visible := False;
|
|||
|
KuangHao.Text := '';
|
|||
|
KuangHao.Visible := False;
|
|||
|
|
|||
|
lblMJID.Visible := False;
|
|||
|
MJID.Text := '';
|
|||
|
MJID.Visible := False;
|
|||
|
|
|||
|
lblAPID.Visible := False;
|
|||
|
APID.Text := '';
|
|||
|
APID.Visible := False;
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
for i := 0 to tv1.ColumnCount - 1 do
|
|||
|
begin
|
|||
|
tv1.Columns[i].Visible := True;
|
|||
|
end;
|
|||
|
cxgrdJQty.Visible := false;
|
|||
|
Panel6.Visible := True;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
EndDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
|||
|
BegDate.DateTime := EndDate.DateTime - 20;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.InitGrid();
|
|||
|
var
|
|||
|
fwhere, Pwhere: string;
|
|||
|
begin
|
|||
|
MovePanel2.Left := (self.Width - MovePanel2.Width) div 2;
|
|||
|
MovePanel2.Visible := True;
|
|||
|
MovePanel2.Refresh;
|
|||
|
Pwhere := SGetFilters(Panel1, 1, 2);
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
if trim(Pwhere) <> '' then
|
|||
|
fwhere := fwhere + ' where ' + trim(Pwhere);
|
|||
|
sql.Add('select * from ( ');
|
|||
|
sql.Add('select SUM(A.KGQty) KGQty,SUM(A.Qty) Qty,SUM(A.NetKGQty) NETKGQty,count(A.MJID) JQty,A.QtyUnit ');
|
|||
|
sql.Add(',B.CustomerNoName');
|
|||
|
sql.Add('from CK_BanCP_CR A inner join JYOrder_Main B on A.MainId=B.MainId ');
|
|||
|
sql.Add('inner join JYOrder_Sub C on A.SubId=C.SubId where A.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.Add(' and A.CRTime>' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)));
|
|||
|
sql.Add(' and A.CRTime<=' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1)));
|
|||
|
sql.Add(' group by B.CustomerNoName,A.QtyUnit');
|
|||
|
sql.Add(' ) AA ' + fwhere);
|
|||
|
end;
|
|||
|
|
|||
|
1:
|
|||
|
begin
|
|||
|
if trim(Pwhere) <> '' then
|
|||
|
fwhere := fwhere + ' where ' + trim(Pwhere);
|
|||
|
sql.Add('select * from ( ');
|
|||
|
sql.Add('select SUM(A.KGQty) KGQty,SUM(A.Qty) Qty,SUM(A.NetKGQty) NetKGQty,count(A.MJID) JQty,A.QtyUnit,A.ganghao ');
|
|||
|
sql.Add(' ,B.CustomerNoName,B.ConNo,B.OrderNo,B.MPRTCode,B.MPRTCodeName,B.MPRTMF,B.MPRTKZ ,B.MPRTSpec,C.PRTColor ');
|
|||
|
sql.Add('from CK_BanCP_CR A inner join JYOrder_Main B on A.MainId=B.MainId ');
|
|||
|
sql.Add('inner join JYOrder_Sub C on A.SubId=C.SubId where A.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.Add(' and A.CRTime>' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)));
|
|||
|
sql.Add(' and A.CRTime<=' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1)));
|
|||
|
sql.Add(' group by B.CustomerNoName,A.QtyUnit,A.ganghao,B.ConNo,B.OrderNo,B.MPRTCode,B.MPRTCodeName,B.MPRTMF,B.MPRTKZ ,B.MPRTSpec,C.PRTColor ');
|
|||
|
sql.Add(' ) AA ' + fwhere);
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
if IsJYTime.Checked then
|
|||
|
begin
|
|||
|
fwhere := ' where CRTime>' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime));
|
|||
|
fwhere := fwhere + ' and CRTime<=' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1));
|
|||
|
if trim(Pwhere) <> '' then
|
|||
|
fwhere := fwhere + ' and ' + trim(Pwhere);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if trim(Pwhere) <> '' then
|
|||
|
fwhere := fwhere + ' where ' + trim(Pwhere);
|
|||
|
end;
|
|||
|
sql.Add('exec P_Page_FinishClothRK ');
|
|||
|
sql.Add('@pageIndex=' + inttostr(CurrentPage));
|
|||
|
sql.Add(',@pageSize=' + inttostr(RecordsNumber));
|
|||
|
sql.Add(',@criteria= ' + quotedstr(fwhere));
|
|||
|
end;
|
|||
|
end;
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
if cxTabControl1.TabIndex = 2 then
|
|||
|
LBCPAP.Caption := inttostr(CurrentPage) + '/' + inttostr(ceil(CDS_Main.FieldByName('TotalCount').AsInteger / RecordsNumber));
|
|||
|
MovePanel2.Visible := false;
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
MovePanel2.Visible := false;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
SetStatus();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.ConNoMChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid(trim(self.Caption), Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
ReadCxGrid(trim(self.Caption), Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
CurrentPage := 1;
|
|||
|
RecordsNumber := 500;
|
|||
|
SetStatus();
|
|||
|
canshu2 := Trim(DParameters2);
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
exit;
|
|||
|
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>', cxGrid2);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.orderNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.TBRKCXClick(Sender: TObject);
|
|||
|
var
|
|||
|
strsql: string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
if cxTabControl1.TabIndex <> 2 then
|
|||
|
Exit;
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
BegDate.SetFocus;
|
|||
|
MovePanel2.Visible := True;
|
|||
|
MovePanel2.Refresh;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
while Locate('SSel', True, []) do
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_BanCP_CR where CRID=' + Trim(CDS_Main.fieldbyname('CRID').AsString));
|
|||
|
sql.Add('and CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.RecordCount >= 1 then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
MovePanel2.Visible := False;
|
|||
|
Application.MessageBox('<27>ѳ<EFBFBD><D1B3>ⲻ<EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
// with ADOQueryTemp do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// sql.Clear;
|
|||
|
// SQL.Add('select * from CK_BanCP_CR A ');
|
|||
|
// SQL.Add('where CRTime>=getdate()-1 and MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + ''' and CRFlag=''<27><><EFBFBD><EFBFBD>''');
|
|||
|
//// ShowMessage(SQL.text);
|
|||
|
// Open;
|
|||
|
// end;
|
|||
|
// if not ADOQueryTemp.IsEmpty = False then
|
|||
|
// begin
|
|||
|
// Application.MessageBox('¼<><C2BC>ʱ<EFBFBD>䳬<EFBFBD><E4B3AC>24Сʱ<D0A1><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
// Exit;
|
|||
|
// end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' Update CK_BanCP_CR Set CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',CRType='''',CRTime=NULL,RKOrdId='''',RKStage='''' ');
|
|||
|
sql.Add(' where CRID=''' + Trim(CDS_Main.fieldbyname('CRID').AsString) + ''' ');
|
|||
|
sql.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.Add(' Update WFB_MJJY Set MJStr2=''δ<><CEB4><EFBFBD><EFBFBD>'' where exists(select MJID from CK_BanCP_CR X where X.MJID=WFB_MJJY.MJID and X.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' and MJStr2<>''δ<><CEB4><EFBFBD><EFBFBD>'')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
strsql := '<27><>ID<49><44>' + trim(CDS_Main.FieldByName('MJID').AsString) + ' <20><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('RKOrdID').AsString);
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
sql.Add(',getdate() ');
|
|||
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><E2B3B7>')));
|
|||
|
sql.Add(',' + quotedstr(trim(strsql)));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
CDS_Main.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
MovePanel2.Visible := False;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
MovePanel2.Visible := False;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
begin
|
|||
|
FLeft := X;
|
|||
|
FTop := Y;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.BTNPClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CurrentPage < CDS_Main.FieldByName('TotalCount').AsInteger / RecordsNumber then
|
|||
|
CurrentPage := CurrentPage + 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.BTLPClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CurrentPage > 1 then
|
|||
|
CurrentPage := CurrentPage - 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.TCBNORChange(Sender: TObject);
|
|||
|
begin
|
|||
|
RecordsNumber := StrToInt(TCBNOR.Text);
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.CPTypeChange(Sender: TObject);
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
SetStatus();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
frmSysLogHelp := TfrmSysLogHelp.create(self);
|
|||
|
with frmSysLogHelp do
|
|||
|
begin
|
|||
|
fModel := self.caption;
|
|||
|
// facction:='<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>ɾ<EFBFBD><C9BE>';
|
|||
|
showmodal;
|
|||
|
free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
CustomerNoName.Text := '';
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
orderNo.Text := '';
|
|||
|
|
|||
|
MPRTCodeName.Text := '';
|
|||
|
|
|||
|
MPRTSpec.Text := '';
|
|||
|
|
|||
|
MPRTMF.Text := '';
|
|||
|
|
|||
|
MPRTKZ.Text := '';
|
|||
|
|
|||
|
PRTColor.Text := '';
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
SetStatus();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.N3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Clipboard.SetTextBuf(PChar(Trim(CDS_Main.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
var
|
|||
|
Tabint: integer;
|
|||
|
begin
|
|||
|
Tabint := cxTabControl1.TabIndex;
|
|||
|
case Tabint of
|
|||
|
0:
|
|||
|
begin
|
|||
|
CustomerNoName.Text := CDS_Main.FieldByName('CustomerNoName').AsString;
|
|||
|
cxTabControl1.TabIndex := 1;
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
MPRTCodeName.Text := CDS_Main.FieldByName('MPRTCodeName').AsString;
|
|||
|
MPRTSpec.Text := CDS_Main.FieldByName('MPRTSpec').AsString;
|
|||
|
MPRTMF.Text := CDS_Main.FieldByName('MPRTMF').AsString;
|
|||
|
MPRTKZ.Text := CDS_Main.FieldByName('MPRTKZ').AsString;
|
|||
|
PRTColor.Text := CDS_Main.FieldByName('PRTColor').AsString;
|
|||
|
cxTabControl1.TabIndex := 2;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPInList.CustomerNoNameKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
SetStatus();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|