727 lines
21 KiB
ObjectPascal
727 lines
21 KiB
ObjectPascal
unit U_CKProductCPInList;
|
||
|
||
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,
|
||
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, cxTextEdit, dxSkinsCore,
|
||
dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu, U_BaseList, cxPC;
|
||
|
||
type
|
||
TfrmCKProductCPInList = class(TfrmBaseList)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBExport: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DS_1: TDataSource;
|
||
GPM_1: TcxGridPopupMenu;
|
||
Label2: TLabel;
|
||
BegDate: TDateTimePicker;
|
||
EndDate: TDateTimePicker;
|
||
CDS_Main: TClientDataSet;
|
||
RM1: TRMGridReport;
|
||
RMXLSExport1: TRMXLSExport;
|
||
TBRKCX: TToolButton;
|
||
begtime: TDateTimePicker;
|
||
endTime: TDateTimePicker;
|
||
RMDB_Main: TRMDBDataSet;
|
||
MovePanel2: TMovePanel;
|
||
IsJYTime: TCheckBox;
|
||
ToolButton2: TToolButton;
|
||
CDS_Label: TClientDataSet;
|
||
ADOQueryPrint: TADOQuery;
|
||
ToolButton3: TToolButton;
|
||
RMDBHZ: TRMDBDataSet;
|
||
CDS_HZ: TClientDataSet;
|
||
CDS_PRT: TClientDataSet;
|
||
Label3: TLabel;
|
||
Label4: TLabel;
|
||
Label5: TLabel;
|
||
Label7: TLabel;
|
||
Label10: TLabel;
|
||
Label12: TLabel;
|
||
Label14: TLabel;
|
||
Label16: TLabel;
|
||
Label11: TLabel;
|
||
Label13: TLabel;
|
||
Label19: TLabel;
|
||
P_CodeName: TEdit;
|
||
orderNo: TEdit;
|
||
JYType: TComboBox;
|
||
p_colorno: TEdit;
|
||
conNo: TEdit;
|
||
APID: TEdit;
|
||
P_Color: TEdit;
|
||
gangno: TEdit;
|
||
P_HX: TEdit;
|
||
P_Code: TEdit;
|
||
BaoID: TEdit;
|
||
Label1: TLabel;
|
||
JYID: TEdit;
|
||
cxPageControl1: TcxPageControl;
|
||
cxTabSheet1: TcxTabSheet;
|
||
cxGrid2: TcxGrid;
|
||
TV2: TcxGridDBTableView;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
cxGridDBColumn4: TcxGridDBColumn;
|
||
cxGridDBColumn5: TcxGridDBColumn;
|
||
cxGridDBColumn6: TcxGridDBColumn;
|
||
cxGridDBColumn27: TcxGridDBColumn;
|
||
cxGridDBColumn28: TcxGridDBColumn;
|
||
cxGridDBColumn7: TcxGridDBColumn;
|
||
cxGridDBColumn37: TcxGridDBColumn;
|
||
cxGridDBColumn41: TcxGridDBColumn;
|
||
cxGridDBColumn31: TcxGridDBColumn;
|
||
cxGridDBColumn11: TcxGridDBColumn;
|
||
cxGridDBColumn13: TcxGridDBColumn;
|
||
cxGridDBColumn14: TcxGridDBColumn;
|
||
cxGridDBColumn15: TcxGridDBColumn;
|
||
cxGridDBColumn16: TcxGridDBColumn;
|
||
cxGridDBColumn18: TcxGridDBColumn;
|
||
cxGridDBColumn19: TcxGridDBColumn;
|
||
cxGridDBColumn20: TcxGridDBColumn;
|
||
cxGridDBColumn40: TcxGridDBColumn;
|
||
cxGridDBColumn21: TcxGridDBColumn;
|
||
cxGridDBColumn32: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
cxTabSheet2: TcxTabSheet;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1Column4: TcxGridDBColumn;
|
||
v1Column1: TcxGridDBColumn;
|
||
v2Column1: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
v2Column3: TcxGridDBColumn;
|
||
v1Column8: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column13: TcxGridDBColumn;
|
||
v1Column21: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column16: TcxGridDBColumn;
|
||
v2Column5: TcxGridDBColumn;
|
||
v2Column6: TcxGridDBColumn;
|
||
v1Column19: TcxGridDBColumn;
|
||
v1Column22: TcxGridDBColumn;
|
||
v1Column11: TcxGridDBColumn;
|
||
v1Column12: TcxGridDBColumn;
|
||
v1Column14: TcxGridDBColumn;
|
||
v1Column15: TcxGridDBColumn;
|
||
Tv1Column2: TcxGridDBColumn;
|
||
Tv1Column3: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
Panel6: TPanel;
|
||
Label31: TLabel;
|
||
LBCPAP: TLabel;
|
||
BTLP: TButton;
|
||
BTNP: TButton;
|
||
TCBNOR: TComboBox;
|
||
GPM_2: TcxGridPopupMenu;
|
||
CDS_2: TClientDataSet;
|
||
DS_2: TDataSource;
|
||
ToolButton1: TToolButton;
|
||
Panel4: TPanel;
|
||
Label20: TLabel;
|
||
Panel10: TPanel;
|
||
Image2: TImage;
|
||
Button1: TButton;
|
||
RadioGroup1: TRadioGroup;
|
||
TV2Column1: TcxGridDBColumn;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
Label6: TLabel;
|
||
ckstatus: TComboBox;
|
||
PopupMenu1: TPopupMenu;
|
||
N1: TMenuItem;
|
||
N2: TMenuItem;
|
||
Tv1Column4: TcxGridDBColumn;
|
||
TV2Column2: TcxGridDBColumn;
|
||
Label8: TLabel;
|
||
LOTNO: TEdit;
|
||
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 TBRKCXClick(Sender: TObject);
|
||
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
procedure Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
procedure BTNPClick(Sender: TObject);
|
||
procedure BTLPClick(Sender: TObject);
|
||
procedure TCBNORChange(Sender: TObject);
|
||
procedure JYTypeChange(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure TV2DblClick(Sender: TObject);
|
||
procedure cxPageControl1Change(Sender: TObject);
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure Image2Click(Sender: TObject);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
private
|
||
CurrentPage, RecordsNumber: Integer;
|
||
procedure InitGrid();
|
||
procedure SetStatus();
|
||
procedure GetLabel();
|
||
{ Private declarations }
|
||
public
|
||
canshu1, canshu2: string;
|
||
FLeft, FTop: Integer;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_LbaelMap;
|
||
|
||
{$R *.dfm}
|
||
procedure TfrmCKProductCPInList.GetLabel();
|
||
var
|
||
fsj: string;
|
||
begin
|
||
fsj := 'select distinct(LMName) name from Lbael_Map where LMType=''<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>뵥'' ';
|
||
SInitRadioGroupBySql(ADOQueryCmd, RadioGroup1, true, fsj);
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
Sql.Add('select * from Lbael_Map where LMType=''<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>뵥''');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryTemp, CDS_Label);
|
||
SInitCDSData(ADOQueryTemp, CDS_Label);
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.SetStatus();
|
||
begin
|
||
TBRKCX.Enabled := False;
|
||
|
||
case cxPageControl1.ActivePageIndex of
|
||
0:
|
||
begin
|
||
ClearOrHideControls(Panel1, '0', True, True);
|
||
ClearOrHideControls(Panel1, '1', True, False);
|
||
end;
|
||
1:
|
||
begin
|
||
ClearOrHideControls(Panel1, '0', false, True);
|
||
ClearOrHideControls(Panel1, '1', True, True);
|
||
if canshu1 = '<27><><EFBFBD><EFBFBD>' then
|
||
begin
|
||
|
||
TBRKCX.Enabled := True;
|
||
|
||
end;
|
||
end;
|
||
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.FormCreate(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
EndDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
||
BegDate.DateTime := EndDate.DateTime - 20;
|
||
canshu2 := Trim(DParameters2);
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.Image2Click(Sender: TObject);
|
||
begin
|
||
Panel4.Visible := false;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.InitGrid();
|
||
var
|
||
WSql: string;
|
||
begin
|
||
MovePanel2.Left := (self.Width - MovePanel2.Width) div 2;
|
||
MovePanel2.Visible := True;
|
||
MovePanel2.Refresh;
|
||
WSql := SGetFilters(Panel1, 1, 2);
|
||
if Trim(WSql) <> '' then
|
||
WSql := ' and ' + WSql;
|
||
if IsJYTime.Checked then
|
||
begin
|
||
WSql := WSql + ' and CRTime>=' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime));
|
||
WSql := WSql + ' and CRTime<' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1));
|
||
end;
|
||
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
case cxPageControl1.ActivePageIndex of
|
||
0:
|
||
begin
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select LOTNO,A.OrderNo,A.ConNo,A.P_Code,A.P_CodeName,A.P_Spec,A.P_Color,A.P_ColorNo,A.P_KuanNo,A.P_MF,A.P_KZ,A.P_HX,A.APID,A.GangNo,A.RCGangNo ');
|
||
sql.Add(' ,sum(A.JYGW) JYGW, sum(A.JYTare) JYTare, sum(A.JYNW) JYNW,sum(A.JYLen) JYLen, sum(A.JYYLen) JYYLen ');
|
||
sql.Add('from V_Cloth_CP_RK A ');
|
||
sql.Add('where 1=1 ' + (WSql));
|
||
sql.Add('and exists(select jyid from jy_cloth E WHERE E.JYID=A.JYID AND E.fdanwei= ' + QuotedStr(Trim(canshu2)));
|
||
sql.Add(')');
|
||
sql.Add('group by LOTNO,A.OrderNo,A.ConNo,A.P_Code,A.P_CodeName,A.P_Spec,A.P_Color,A.P_ColorNo,A.P_KuanNo,A.P_MF,A.P_KZ,A.P_HX,A.APID,A.GangNo,A.RCGangNo ');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryMain, CDS_2);
|
||
SInitCDSData(ADOQueryMain, CDS_2);
|
||
end;
|
||
1:
|
||
begin
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select top ' + inttostr(RecordsNumber) + ' * ');
|
||
sql.Add(' ,DJBRCGangNo =(select X.RCGangNo from CK_SXPB_CR X where X.SPID=temp_row.APID)');
|
||
sql.Add(' from ');
|
||
sql.Add('(select rownumber=cast((row_number() over(order by AA.filltime desc)) as int)');
|
||
sql.Add(',COUNT(1) OVER() AS TotalCount');
|
||
sql.Add(',* from V_Cloth_CP_RK AA where 1=1 ' + WSql);
|
||
sql.Add('and exists(select jyid from jy_cloth E WHERE E.JYID=AA.JYID AND E.fdanwei= ' + QuotedStr(Trim(canshu2)));
|
||
sql.Add(')');
|
||
sql.Add(') temp_row');
|
||
sql.Add(' where rownumber> ' + inttostr(((CurrentPage - 1) * RecordsNumber)));
|
||
sql.Add(' order by rownumber');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryMain, CDS_Main);
|
||
SInitCDSData(ADOQueryMain, CDS_Main);
|
||
LBCPAP.Caption := inttostr(CurrentPage) + '/' + inttostr(ceil(CDS_Main.FieldByName('TotalCount').AsInteger / RecordsNumber));
|
||
end;
|
||
end;
|
||
|
||
MovePanel2.Visible := false;
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
MovePanel2.Visible := false;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
CurrentPage := 1;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.ConNoMChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.cxPageControl1Change(Sender: TObject);
|
||
begin
|
||
CurrentPage := 1;
|
||
SetStatus();
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(trim(self.Caption) + 'Tv1', Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>2');
|
||
WriteCxGrid(trim(self.Caption) + 'Tv2', Tv2, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>2');
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
|
||
ReadCxGrid(trim(self.Caption) + 'Tv1', Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>2');
|
||
ReadCxGrid(trim(self.Caption) + 'Tv2', Tv2, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>2');
|
||
CurrentPage := 1;
|
||
RecordsNumber := 500;
|
||
canshu1 := Trim(Self.fParameters1);
|
||
GetLabel();
|
||
SetStatus();
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then
|
||
exit;
|
||
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>', cxGrid2);
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.orderNoKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
CurrentPage := 1;
|
||
InitGrid();
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.TBRKCXClick(Sender: TObject);
|
||
var
|
||
strsql: string;
|
||
begin
|
||
if CDS_Main.IsEmpty 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_Cloth_CR where CRID=' + QuotedStr(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 ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' Update CK_Cloth_CR Set CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',CRType='''',CRTime=NULL,RKNO='''' ');
|
||
sql.Add(' where JYID=''' + Trim(CDS_Main.fieldbyname('JYID').AsString) + ''' ');
|
||
sql.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
||
sql.Add(' Update JY_Cloth Set JYCRType=''δ<><CEB4><EFBFBD><EFBFBD>'' where JYID=''' + Trim(CDS_Main.fieldbyname('JYID').AsString) + ''' ');
|
||
ExecSQL;
|
||
end;
|
||
|
||
strsql := '<27><>ID<49><44>' + trim(CDS_Main.FieldByName('JYID').AsString) + ' <20><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('RKNO').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;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
||
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 TfrmCKProductCPInList.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
Clipboard.SetTextBuf(PChar(Trim(CDS_Main.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
FLeft := X;
|
||
FTop := Y;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.TV2DblClick(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
AssignmentControls(Panel1, CDS_2, '0');
|
||
cxPageControl1.ActivePageIndex := 1;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.BTNPClick(Sender: TObject);
|
||
begin
|
||
if CurrentPage < CDS_Main.FieldByName('TotalCount').AsInteger / RecordsNumber then
|
||
CurrentPage := CurrentPage + 1;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.Button1Click(Sender: TObject);
|
||
var
|
||
fPrintFile, fPrintFile10, FMainID, LBName: string;
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
if CDS_Main.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
LBName := RadioGroup1.Items.Strings[RadioGroup1.ItemIndex];
|
||
ExportFtErpFile(LBName + '.rmf', ADOQueryTemp);
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete TBSubID where DName=''' + Trim(DCode) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('SELECT * FROM TBSubID where 1=2 ');
|
||
open;
|
||
end;
|
||
FMainID := '';
|
||
CDS_Main.DisableControls;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with CDS_Main do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Fieldbyname('Ssel').AsBoolean then
|
||
begin
|
||
ADOQueryCmd.append;
|
||
ADOQueryCmd.fieldbyname('SubId').Value := Trim(CDS_Main.fieldbyname('JYID').AsString);
|
||
ADOQueryCmd.fieldbyname('Dname').Value := Trim(DCode);
|
||
ADOQueryCmd.post;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
end;
|
||
CDS_Main.EnableControls;
|
||
if CDS_Label.Locate('LMName', LBName, []) then
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql').AsString) + ' @Code=' + quotedstr(Trim(DCode)));
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryPrint, CDS_PRT);
|
||
SInitCDSData(ADOQueryPrint, CDS_PRT);
|
||
if trim(CDS_Label.fieldbyname('LMSql1').AsString) <> '' then
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql1').AsString) + ' @Code=' + quotedstr(Trim(DCode)));
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryPrint, CDS_HZ);
|
||
SInitCDSData(ADOQueryPrint, CDS_HZ);
|
||
end;
|
||
end;
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + LBName + '.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RM1.ShowReport;
|
||
Panel4.Visible := false;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.BTLPClick(Sender: TObject);
|
||
begin
|
||
if CurrentPage > 1 then
|
||
CurrentPage := CurrentPage - 1;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.TCBNORChange(Sender: TObject);
|
||
begin
|
||
RecordsNumber := StrToInt(TCBNOR.Text);
|
||
CurrentPage := 1;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.JYTypeChange(Sender: TObject);
|
||
begin
|
||
CurrentPage := 1;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.N1Click(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
SelOKNoFiler(tv1, true);
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.N2Click(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
SelOKNoFiler(tv1, false);
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmLbaelMap := TfrmLbaelMap.Create(Application);
|
||
with frmLbaelMap do
|
||
begin
|
||
FLMType := '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>뵥';
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmLbaelMap.Free;
|
||
end;
|
||
GetLabel();
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
Panel4.Visible := true;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPInList.ToolButton3Click(Sender: TObject);
|
||
var
|
||
fPrintFile, fPrintFile10, FMainID, fImagePath2, LBName: string;
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
if CDS_Main.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
LBName := RadioGroup1.Items.Strings[RadioGroup1.ItemIndex];
|
||
ExportFtErpFile(LBName + '.rmf', ADOQueryTemp);
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete TBSubID where DName=''' + Trim(DCode) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('SELECT * FROM TBSubID where 1=2 ');
|
||
open;
|
||
end;
|
||
FMainID := '';
|
||
CDS_Main.DisableControls;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with CDS_Main do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Fieldbyname('Ssel').AsBoolean then
|
||
begin
|
||
ADOQueryCmd.append;
|
||
ADOQueryCmd.fieldbyname('SubId').Value := Trim(CDS_Main.fieldbyname('JYID').AsString);
|
||
ADOQueryCmd.fieldbyname('Dname').Value := Trim(DCode);
|
||
ADOQueryCmd.post;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
end;
|
||
CDS_Main.EnableControls;
|
||
if CDS_Label.Locate('LMName', trim(LBName), []) then
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql').AsString) + ' @Code=' + quotedstr(Trim(DCode)));
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryPrint, CDS_PRT);
|
||
SInitCDSData(ADOQueryPrint, CDS_PRT);
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql1').AsString) + ' @Code=' + quotedstr(Trim(DCode)));
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryPrint, CDS_HZ);
|
||
SInitCDSData(ADOQueryPrint, CDS_HZ);
|
||
end;
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(LBName) + '.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RM1.LoadFromFile(fPrintFile);
|
||
|
||
fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\label0001.xls';
|
||
if FileExists(fImagePath2) then
|
||
DeleteFile(fImagePath2);
|
||
fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\label.xls';
|
||
RM1.PrepareReport;
|
||
RM1.ExportTo(RMXLSExport1, fImagePath2);
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
||
end;
|
||
|
||
end;
|
||
|
||
end.
|
||
|