750 lines
21 KiB
ObjectPascal
750 lines
21 KiB
ObjectPascal
![]() |
unit U_CKProductBCPOutList;
|
|||
|
|
|||
|
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, RM_Common, RM_Class, RM_e_Xls, RM_Dataset, RM_System,
|
|||
|
RM_GridReport, cxCheckBox, Menus, MovePanel, cxCalendar, Math, Clipbrd,
|
|||
|
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxSkinsCore,
|
|||
|
dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu, U_BaseList, cxTextEdit,
|
|||
|
cxPC;
|
|||
|
|
|||
|
type
|
|||
|
TfrmCKProductBCPOutList = class(TFrmBaseList)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBExport: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DS_1: TDataSource;
|
|||
|
Label2: TLabel;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
CDS_Main: TClientDataSet;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
TBCKCX: TToolButton;
|
|||
|
MovePanel2: TMovePanel;
|
|||
|
GPM_1: TcxGridPopupMenu;
|
|||
|
begtime: TDateTimePicker;
|
|||
|
endTime: TDateTimePicker;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
RMDB_Main: TRMDBDataSet;
|
|||
|
RMDBHZ: TRMDBDataSet;
|
|||
|
CDS_HZ: TClientDataSet;
|
|||
|
RM3: TRMGridReport;
|
|||
|
IsJYTime: TCheckBox;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
CDS_Label: TClientDataSet;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
CDS_PRT: TClientDataSet;
|
|||
|
GPM_2: TcxGridPopupMenu;
|
|||
|
CDS_2: TClientDataSet;
|
|||
|
DS_2: TDataSource;
|
|||
|
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;
|
|||
|
v1Column11: TcxGridDBColumn;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v1Column23: TcxGridDBColumn;
|
|||
|
v2Column1: TcxGridDBColumn;
|
|||
|
v2Column3: TcxGridDBColumn;
|
|||
|
v1Column18: TcxGridDBColumn;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
v1Column15: TcxGridDBColumn;
|
|||
|
v2Column5: TcxGridDBColumn;
|
|||
|
v1Column21: TcxGridDBColumn;
|
|||
|
v2Column6: TcxGridDBColumn;
|
|||
|
v1Column10: TcxGridDBColumn;
|
|||
|
v1Column19: TcxGridDBColumn;
|
|||
|
v1Column20: TcxGridDBColumn;
|
|||
|
v1Column22: TcxGridDBColumn;
|
|||
|
v1rkplace: TcxGridDBColumn;
|
|||
|
v1Column24: TcxGridDBColumn;
|
|||
|
v1Column14: TcxGridDBColumn;
|
|||
|
v1Column16: TcxGridDBColumn;
|
|||
|
v1Column17: TcxGridDBColumn;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
Panel6: TPanel;
|
|||
|
Label31: TLabel;
|
|||
|
LBCPAP: TLabel;
|
|||
|
BTLP: TButton;
|
|||
|
BTNP: TButton;
|
|||
|
TCBNOR: TComboBox;
|
|||
|
Label3: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
Label5: TLabel;
|
|||
|
Label7: TLabel;
|
|||
|
Label10: TLabel;
|
|||
|
Label12: TLabel;
|
|||
|
Label14: TLabel;
|
|||
|
Label16: TLabel;
|
|||
|
Label18: TLabel;
|
|||
|
Label11: TLabel;
|
|||
|
Label13: TLabel;
|
|||
|
Label19: TLabel;
|
|||
|
Label1: TLabel;
|
|||
|
P_CodeName: TEdit;
|
|||
|
orderNo: TEdit;
|
|||
|
JYType: TComboBox;
|
|||
|
RKOrdID: TEdit;
|
|||
|
conNo: TEdit;
|
|||
|
APID: TEdit;
|
|||
|
RKPlace: TEdit;
|
|||
|
P_Color: TEdit;
|
|||
|
ganghao: TEdit;
|
|||
|
P_HX: TEdit;
|
|||
|
P_Code: TEdit;
|
|||
|
BaoID: TEdit;
|
|||
|
JYID: TEdit;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
RM1: TRMGridReport;
|
|||
|
Panel4: TPanel;
|
|||
|
Label20: TLabel;
|
|||
|
Panel10: TPanel;
|
|||
|
Image2: TImage;
|
|||
|
Button1: TButton;
|
|||
|
RadioGroup1: TRadioGroup;
|
|||
|
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 TBCKCXClick(Sender: TObject);
|
|||
|
procedure orderNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
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 CPTypeChange(Sender: TObject);
|
|||
|
procedure CRTypeChange(Sender: TObject);
|
|||
|
procedure edtSMNOKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure cxPageControl1Change(Sender: TObject);
|
|||
|
procedure TV2DblClick(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure Button1Click(Sender: TObject);
|
|||
|
procedure Image2Click(Sender: TObject);
|
|||
|
private
|
|||
|
FLeft, FTop: Integer;
|
|||
|
CurrentPage, RecordsNumber: Integer;
|
|||
|
procedure InitGrid();
|
|||
|
procedure PrintMD(MStatus: string);
|
|||
|
procedure SetStatus();
|
|||
|
procedure GetLabel();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
canshu1: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_LbaelMap;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
procedure TfrmCKProductBCPOutList.GetLabel();
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
ReadCxGrid(trim(self.Caption) + 'Tv1', Tv1, '<27><><EFBFBD><EFBFBD>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
ReadCxGrid(trim(self.Caption) + 'Tv2', Tv2, '<27><><EFBFBD><EFBFBD>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
fsj := 'select distinct(LMName) name from Lbael_Map where LMType=''<27><><EFBFBD><EFBFBD>Ʒ<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><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>뵥''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryTemp, CDS_Label);
|
|||
|
SInitCDSData(ADOQueryTemp, CDS_Label);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.SetStatus();
|
|||
|
begin
|
|||
|
TBCKCX.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
|
|||
|
|
|||
|
TBCKCX.Enabled := True;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.PrintMD(MStatus: string);
|
|||
|
var
|
|||
|
fImagePath2, fPrintFile, fPrintFile10, FMainID, FKHName, FFPNo, LBName: string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
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;
|
|||
|
|
|||
|
LBName := RadioGroup1.Items.Strings[RadioGroup1.ItemIndex];
|
|||
|
ExportFtErpFile(trim(LBName) + '.rmf', ADOQueryTemp);
|
|||
|
|
|||
|
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)));
|
|||
|
// sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql').AsString) + ' @CKOrdNo=' + quotedstr(Trim(CDS_Main.fieldbyname('CKOrdNo').AsString)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryPrint, CDS_PRT);
|
|||
|
SInitCDSData(ADOQueryPrint, CDS_PRT);
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Print_CKMD_DXHZ @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
|
|||
|
if MStatus = 'Excel' then
|
|||
|
begin
|
|||
|
RM3.LoadFromFile(fPrintFile);
|
|||
|
fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\label0001.xls';
|
|||
|
if FileExists(fImagePath2) then
|
|||
|
DeleteFile(fImagePath2);
|
|||
|
fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\label.xls';
|
|||
|
RM3.PrepareReport;
|
|||
|
RM3.ExportTo(RMXLSExport1, fImagePath2);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
RM3.LoadFromFile(fPrintFile);
|
|||
|
RMVariables['ZDR'] := trim(DName);
|
|||
|
RM3.ShowReport;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD>ҵ<EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
EndDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
|||
|
BegDate.DateTime := EndDate.DateTime - 20;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.Image2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel4.Visible := false;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.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 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_BCP_CK A ');
|
|||
|
sql.Add('where 1=1 ' + (WSql));
|
|||
|
sql.Add('group by 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_BCP_CK AA where 1=1 ' + WSql);
|
|||
|
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 TfrmCKProductBCPOutList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.ConNoMChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid(trim(self.Caption) + 'Tv1', Tv1, '<27><><EFBFBD><EFBFBD>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
WriteCxGrid(trim(self.Caption) + 'Tv2', Tv2, '<27><><EFBFBD><EFBFBD>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.FormShow(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
ReadCxGrid(trim(self.Caption) + 'Tv1', Tv1, '<27><><EFBFBD><EFBFBD>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
ReadCxGrid(trim(self.Caption) + 'Tv2', Tv2, '<27><><EFBFBD><EFBFBD>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
CurrentPage := 1;
|
|||
|
RecordsNumber := 500;
|
|||
|
SetStatus();
|
|||
|
GetLabel();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
exit;
|
|||
|
// SelExportData(Tv1, ADOQueryMain, '');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.TBCKCXClick(Sender: TObject);
|
|||
|
var
|
|||
|
FFMainId, FPrice, 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>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
MovePanel2.Visible := True;
|
|||
|
MovePanel2.Refresh;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
CDS_Main.DisableControls;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
while CDS_Main.Locate('SSel', True, []) = True do
|
|||
|
begin
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update CK_Cloth_CR Set CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ,CRType='''',CRTime=NULL ,CKNo='''' ');
|
|||
|
sql.Add(' where JYID=''' + Trim(CDS_Main.fieldbyname('JYID').AsString) + '''');
|
|||
|
sql.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>''');
|
|||
|
|
|||
|
sql.Add(' UPdate CK_Cloth_KC Set Valid=''Y'' ');
|
|||
|
SQL.Add(' where JYID=''' + Trim(CDS_Main.fieldbyname('JYID').AsString) + '''');
|
|||
|
|
|||
|
sql.Add(' Update JY_Cloth Set JYCRType=''<27><><EFBFBD><EFBFBD><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('CKNo').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;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_FH_UP_FHQty ''' + Trim(Trim(CDS_Main.fieldbyname('CKNo').AsString)) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
CDS_Main.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
MovePanel2.Visible := False;
|
|||
|
Exit;
|
|||
|
except
|
|||
|
MovePanel2.Visible := False;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.orderNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.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 TfrmCKProductBCPOutList.Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
begin
|
|||
|
FLeft := X;
|
|||
|
FTop := Y;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.TV2DblClick(Sender: TObject);
|
|||
|
begin
|
|||
|
AssignmentControls(Panel1, CDS_2, '0');
|
|||
|
cxPageControl1.ActivePageIndex := 1;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.BTNPClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CurrentPage < CDS_Main.FieldByName('TotalCount').AsInteger / RecordsNumber then
|
|||
|
CurrentPage := CurrentPage + 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.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 TfrmCKProductBCPOutList.BTLPClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CurrentPage > 1 then
|
|||
|
CurrentPage := CurrentPage - 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.TCBNORChange(Sender: TObject);
|
|||
|
begin
|
|||
|
RecordsNumber := StrToInt(TCBNOR.Text);
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.CPTypeChange(Sender: TObject);
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.CRTypeChange(Sender: TObject);
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.cxPageControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
SetStatus();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.edtSMNOKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel4.Visible := true;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.ToolButton2Click(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 TfrmCKProductBCPOutList.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
PrintMD('Excel');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.ToolButton4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmLbaelMap := TfrmLbaelMap.Create(Application);
|
|||
|
with frmLbaelMap do
|
|||
|
begin
|
|||
|
FLMType := '<27><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>뵥';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmLbaelMap.Free;
|
|||
|
end;
|
|||
|
GetLabel();
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|