688 lines
21 KiB
ObjectPascal
688 lines
21 KiB
ObjectPascal
![]() |
unit U_DBKCList;
|
|||
|
|
|||
|
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
|
|||
|
TfrmDBKCList = 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;
|
|||
|
begtime: TDateTimePicker;
|
|||
|
endTime: TDateTimePicker;
|
|||
|
RMDB_Main: TRMDBDataSet;
|
|||
|
MovePanel2: TMovePanel;
|
|||
|
IsJYTime: TCheckBox;
|
|||
|
CDS_Label: TClientDataSet;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
RMDBHZ: TRMDBDataSet;
|
|||
|
CDS_HZ: TClientDataSet;
|
|||
|
CDS_PRT: TClientDataSet;
|
|||
|
Label3: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
Label5: TLabel;
|
|||
|
Label10: TLabel;
|
|||
|
Label14: TLabel;
|
|||
|
Label16: TLabel;
|
|||
|
Label19: TLabel;
|
|||
|
P_CodeName: TEdit;
|
|||
|
orderNo: TEdit;
|
|||
|
conNo: TEdit;
|
|||
|
APID: TEdit;
|
|||
|
P_Color: TEdit;
|
|||
|
GangNo: TEdit;
|
|||
|
BaoID: TEdit;
|
|||
|
GPM_2: TcxGridPopupMenu;
|
|||
|
CDS_2: TClientDataSet;
|
|||
|
DS_2: TDataSource;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
cxPageControl1: TcxPageControl;
|
|||
|
cxTabSheet1: TcxTabSheet;
|
|||
|
cxTabSheet2: TcxTabSheet;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
v1Column15: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v2Column1: TcxGridDBColumn;
|
|||
|
v1Column10: TcxGridDBColumn;
|
|||
|
v1Column19: TcxGridDBColumn;
|
|||
|
v2Column3: TcxGridDBColumn;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
v1Column21: TcxGridDBColumn;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
v1Column16: TcxGridDBColumn;
|
|||
|
v2Column5: TcxGridDBColumn;
|
|||
|
v2Column6: TcxGridDBColumn;
|
|||
|
v1Column11: TcxGridDBColumn;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
v1Column14: TcxGridDBColumn;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
TV2: TcxGridDBTableView;
|
|||
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
cxGridDBColumn2: TcxGridDBColumn;
|
|||
|
cxGridDBColumn3: TcxGridDBColumn;
|
|||
|
cxGridDBColumn4: TcxGridDBColumn;
|
|||
|
cxGridDBColumn5: TcxGridDBColumn;
|
|||
|
cxGridDBColumn6: TcxGridDBColumn;
|
|||
|
cxGridDBColumn7: TcxGridDBColumn;
|
|||
|
cxGridDBColumn8: TcxGridDBColumn;
|
|||
|
cxGridDBColumn9: TcxGridDBColumn;
|
|||
|
cxGridDBColumn10: TcxGridDBColumn;
|
|||
|
cxGridDBColumn11: TcxGridDBColumn;
|
|||
|
cxGridDBColumn12: TcxGridDBColumn;
|
|||
|
cxGridDBColumn13: TcxGridDBColumn;
|
|||
|
cxGridDBColumn14: TcxGridDBColumn;
|
|||
|
cxGridDBColumn15: TcxGridDBColumn;
|
|||
|
cxGridDBColumn16: TcxGridDBColumn;
|
|||
|
cxGridDBColumn17: TcxGridDBColumn;
|
|||
|
cxGridDBColumn18: TcxGridDBColumn;
|
|||
|
cxGridDBColumn19: TcxGridDBColumn;
|
|||
|
cxGridDBColumn20: TcxGridDBColumn;
|
|||
|
cxGridDBColumn21: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
cxGrid3: TcxGrid;
|
|||
|
TV3: TcxGridDBTableView;
|
|||
|
cxGridDBColumn22: TcxGridDBColumn;
|
|||
|
cxGridDBColumn23: TcxGridDBColumn;
|
|||
|
cxGridDBColumn24: TcxGridDBColumn;
|
|||
|
cxGridDBColumn25: TcxGridDBColumn;
|
|||
|
cxGridDBColumn28: TcxGridDBColumn;
|
|||
|
cxGridDBColumn29: TcxGridDBColumn;
|
|||
|
cxGridDBColumn30: TcxGridDBColumn;
|
|||
|
cxGridDBColumn32: TcxGridDBColumn;
|
|||
|
cxGridDBColumn33: TcxGridDBColumn;
|
|||
|
cxGridDBColumn34: TcxGridDBColumn;
|
|||
|
cxGridDBColumn35: TcxGridDBColumn;
|
|||
|
cxGridDBColumn36: TcxGridDBColumn;
|
|||
|
cxGridDBColumn37: TcxGridDBColumn;
|
|||
|
cxGridDBColumn38: TcxGridDBColumn;
|
|||
|
cxGridDBColumn41: TcxGridDBColumn;
|
|||
|
cxGridLevel2: TcxGridLevel;
|
|||
|
GPM_3: TcxGridPopupMenu;
|
|||
|
CDS_3: TClientDataSet;
|
|||
|
DS_3: TDataSource;
|
|||
|
gpm_4: TcxGridPopupMenu;
|
|||
|
CDS_4: TClientDataSet;
|
|||
|
DS_4: TDataSource;
|
|||
|
Panel4: TPanel;
|
|||
|
Label20: TLabel;
|
|||
|
Panel10: TPanel;
|
|||
|
Image2: TImage;
|
|||
|
Button1: TButton;
|
|||
|
RadioGroup1: TRadioGroup;
|
|||
|
TV3Column1: TcxGridDBColumn;
|
|||
|
TV3Column2: TcxGridDBColumn;
|
|||
|
TV3Column3: TcxGridDBColumn;
|
|||
|
TV3Column4: TcxGridDBColumn;
|
|||
|
Tv1Column5: 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 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 TV2DblClick(Sender: TObject);
|
|||
|
procedure cxPageControl1Change(Sender: TObject);
|
|||
|
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure Button1Click(Sender: TObject);
|
|||
|
procedure Image2Click(Sender: TObject);
|
|||
|
private
|
|||
|
CurrentPage, RecordsNumber: Integer;
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitSUB();
|
|||
|
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 TfrmDBKCList.GetLabel();
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
|
|||
|
fsj := 'select distinct(LMName) name from Lbael_Map where LMType=''<27><><EFBFBD><EFBFBD><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><EFBFBD><EFBFBD>뵥''');
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryTemp, CDS_Label);
|
|||
|
SInitCDSData(ADOQueryTemp, CDS_Label);
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDBKCList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDBKCList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
EndDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
|||
|
BegDate.DateTime := EndDate.DateTime - 7;
|
|||
|
canshu2 := Trim(DParameters2);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDBKCList.Image2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
panel4.Visible := false;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDBKCList.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 A.CRTime>=' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime));
|
|||
|
WSql := WSql + ' and A.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; //convert(varchar(10),CRTIME,120)
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select A.OrderNo,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,A.BAONO,A.BAOID ');
|
|||
|
sql.Add(' ,sum(A.JYGW) JYGW, sum(A.JYTare) JYTare, sum(A.JYNW) JYNW,sum(A.JYLen) JYLen, sum(A.JYYLen) JYYLen,count(A.jyid) ps ');
|
|||
|
|
|||
|
SQL.Add(',lotno=(SELECT lotno FROM CK_SXPB_CR e where e.spid=a.apid)');
|
|||
|
sql.Add('from CK_Cloth_CR A ');
|
|||
|
sql.Add('where 1=1 and A.ClothDegree=''<27><>Ʒ'' and A.crflag=''<27><><EFBFBD><EFBFBD>'' ' + (WSql));
|
|||
|
SQL.Add('AND ISNULL(A.BAOID,'''')<>''''');
|
|||
|
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 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,A.BAONO,A.BAOID ');
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_Main);
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close; //convert(varchar(10),CRTIME,120)
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('with C1 AS (SELECT ORDERNO AS OEDERNOM,COUNT(JYID)SYPS,sum(JYGW) SYGW, sum(JYTare) SYTare, ');
|
|||
|
SQL.Add('sum(JYNW) SYNW,sum(JYLen) SYLen, sum(JYYLen) SYYLen ,SYBS=(SELECT COUNT(DISTINCT BAOID) from V_Cloth_CP_KC g WHERE g.orderno=D.orderno AND ISNULL(BAOID,'''')<>'''')');
|
|||
|
SQL.Add('FROM V_Cloth_CP_KC d GROUP BY ORDERNO )');
|
|||
|
|
|||
|
sql.Add('select A.OrderNo,A.ConNo,A.P_Code,A.P_CodeName,A.P_Spec,A.P_KuanNo,A.P_MF,A.P_KZ ');
|
|||
|
sql.Add(' ,sum(A.JYGW) JYGW, sum(A.JYTare) JYTare, sum(A.JYNW) JYNW,sum(A.JYLen) JYLen, sum(A.JYYLen) JYYLen,count(A.jyid) ps ');
|
|||
|
sql.Add(',ZBS=(SELECT COUNT(DISTINCT BAOID) from CK_Cloth_CR g where g.ClothDegree=''<27><>Ʒ'' and g.crflag=''<27><><EFBFBD><EFBFBD>'' and g.orderno=a.orderno )');
|
|||
|
SQL.Add(',SYPS,SYBS,SYLen,SYYLen,SYGW,SYNW');
|
|||
|
sql.Add('from CK_Cloth_CR A LEFT JOIN C1 ON A.ORDERNO=C1.OEDERNOM');
|
|||
|
sql.Add('where 1=1 and ClothDegree=''<27><>Ʒ'' and crflag=''<27><><EFBFBD><EFBFBD>'' ' + (WSql));
|
|||
|
SQL.Add('AND ISNULL(BAOID,'''')<>''''');
|
|||
|
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 A.OrderNo,A.ConNo,A.P_Code,A.P_CodeName,A.P_Spec,A.P_KuanNo,A.P_MF,A.P_KZ,SYPS,SYBS,SYLen,SYYLen,SYGW,SYNW ');
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryMain, CDS_3);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_3);
|
|||
|
// LBCPAP.Caption := inttostr(CurrentPage) + '/' + inttostr(ceil(CDS_Main.FieldByName('TotalCount').AsInteger / RecordsNumber));
|
|||
|
end;
|
|||
|
end;
|
|||
|
MovePanel2.Visible := false;
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
MovePanel2.Visible := false;
|
|||
|
end;
|
|||
|
|
|||
|
// try
|
|||
|
// ADOQueryMain.DisableControls;
|
|||
|
//
|
|||
|
// with ADOQueryMain do
|
|||
|
// begin
|
|||
|
// Filtered := False;
|
|||
|
// Close; //convert(varchar(10),CRTIME,120)
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add('select A.OrderNo,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,A.BAONO,A.BAOID ');
|
|||
|
// sql.Add(' ,sum(A.JYGW) JYGW, sum(A.JYTare) JYTare, sum(A.JYNW) JYNW,sum(A.JYLen) JYLen, sum(A.JYYLen) JYYLen,count(A.jyid) ps ');
|
|||
|
// sql.Add('from CK_Cloth_CR A ');
|
|||
|
// sql.Add('where 1=1 and ClothDegree=''<27><>Ʒ'' and crflag=''<27><><EFBFBD><EFBFBD>'' ' + (WSql));
|
|||
|
// SQL.Add('AND ISNULL(BAOID,'''')<>''''');
|
|||
|
// 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,BAONO,BAOID ');
|
|||
|
//// ShowMessage(SQL.Text);
|
|||
|
// Open;
|
|||
|
// end;
|
|||
|
// SCreateCDS(ADOQueryMain, CDS_Main);
|
|||
|
// SInitCDSData(ADOQueryMain, CDS_Main);
|
|||
|
//
|
|||
|
// MovePanel2.Visible := false;
|
|||
|
// finally
|
|||
|
// ADOQueryMain.EnableControls;
|
|||
|
// MovePanel2.Visible := false;
|
|||
|
// end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDBKCList.InitSUB();
|
|||
|
var
|
|||
|
WSql: string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty = TRUE then
|
|||
|
EXIT;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.DisableControls;
|
|||
|
//and A.CRFlag=''<27><><EFBFBD><EFBFBD>''
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('SELECT * FROM CK_Cloth_CR A WHERE isnull(A.BAOID,'''')=' + QuotedStr(Trim(CDS_Main.fieldbyname('BAOID').AsString)));
|
|||
|
SQL.Add('AND BAONO=' + QuotedStr(Trim(CDS_Main.fieldbyname('BAONO').AsString)));
|
|||
|
sql.Add(' and A.CRFlag=''<27><><EFBFBD><EFBFBD>'' and ClothDegree=''<27><>Ʒ''');
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryCmd, CDS_2);
|
|||
|
SInitCDSData(ADOQueryCmd, CDS_2);
|
|||
|
|
|||
|
MovePanel2.Visible := false;
|
|||
|
finally
|
|||
|
ADOQueryCmd.EnableControls;
|
|||
|
MovePanel2.Visible := false;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDBKCList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDBKCList.ConNoMChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDBKCList.cxPageControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
case cxPageControl1.ActivePageIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
|
|||
|
ClearOrHideControls(Panel1, '0', false, True);
|
|||
|
ClearOrHideControls(Panel1, '1', True, True);
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
|
|||
|
ClearOrHideControls(Panel1, '0', True, True);
|
|||
|
ClearOrHideControls(Panel1, '1', True, False);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDBKCList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid(trim(self.Caption) + 'Tv1', Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
WriteCxGrid(trim(self.Caption) + 'Tv2', Tv2, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
WriteCxGrid(trim(self.Caption) + 'Tv3', Tv3, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDBKCList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
|
|||
|
ReadCxGrid(trim(self.Caption) + 'Tv1', Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
ReadCxGrid(trim(self.Caption) + 'Tv2', Tv2, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
ReadCxGrid(trim(self.Caption) + 'Tv3', Tv3, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
|
|||
|
CurrentPage := 1;
|
|||
|
RecordsNumber := 500;
|
|||
|
canshu1 := Trim(Self.fParameters1);
|
|||
|
GetLabel();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDBKCList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
exit;
|
|||
|
case cxPageControl1.ActivePageIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
TcxGridToExcel('<27><><EFBFBD>б<EFBFBD>', cxGrid1);
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
TcxGridToExcel('<27><><EFBFBD>б<EFBFBD>', cxGrid3);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDBKCList.orderNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDBKCList.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 CRID=''' + Trim(CDS_Main.fieldbyname('CRID').AsString) + ''' ');
|
|||
|
sql.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.Add(' Update JY_Cloth Set JYCRType=''δ<><CEB4><EFBFBD><EFBFBD>'' where exists(select JYID from CK_Cloth_CR X where X.JYID=JY_Cloth.JYID and X.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' and JYCRType<>''δ<><CEB4><EFBFBD><EFBFBD>'')');
|
|||
|
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;
|
|||
|
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 TfrmDBKCList.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 TfrmDBKCList.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
initsub();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDBKCList.Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
begin
|
|||
|
FLeft := X;
|
|||
|
FTop := Y;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDBKCList.TV2DblClick(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
AssignmentControls(Panel1, CDS_2, '0');
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDBKCList.BTNPClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CurrentPage < CDS_Main.FieldByName('TotalCount').AsInteger / RecordsNumber then
|
|||
|
CurrentPage := CurrentPage + 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDBKCList.Button1Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile, fPrintFile10, FMainID, LBName: string;
|
|||
|
FORDERNO, fckno: 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 (CDS_Main.IsEmpty) and (cds_2.IsEmpty) then
|
|||
|
Exit;
|
|||
|
LBName := RadioGroup1.Items.Strings[RadioGroup1.ItemIndex];
|
|||
|
ExportFtErpFile(LBName + '.rmf', ADOQueryTemp);
|
|||
|
case cxPageControl1.ActivePageIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
FORDERNO := cds_main.fieldbyname('ORDERNO').AsString;
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
FORDERNO := cds_3.fieldbyname('ORDERNO').AsString;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
if CDS_Label.Locate('LMName', LBName, []) then
|
|||
|
begin
|
|||
|
if CDS_Label.fieldbyname('LMSql').AsString = 'P_MD_FHMD' then
|
|||
|
begin
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_MD_FHMD @Code=' + quotedstr(Trim(fckno)));
|
|||
|
// ShowMessage(sql.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql').AsString) + ' @Code=' + quotedstr(Trim(FORDERNO)));
|
|||
|
// ShowMessage(sql.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
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(FORDERNO)));
|
|||
|
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 TfrmDBKCList.BTLPClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CurrentPage > 1 then
|
|||
|
CurrentPage := CurrentPage - 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDBKCList.TCBNORChange(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDBKCList.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
try
|
|||
|
frmLbaelMap := TfrmLbaelMap.Create(Application);
|
|||
|
with frmLbaelMap do
|
|||
|
begin
|
|||
|
FLMType := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmLbaelMap.Free;
|
|||
|
end;
|
|||
|
GetLabel();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDBKCList.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Panel4.Visible := true;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDBKCList.JYTypeChange(Sender: TObject);
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|