⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cgqdlg.cpp

📁 实现规则推理 模糊识别 神经网络的专家系统
💻 CPP
字号:
// cgqDlg.cpp : implementation file
//

#include "stdafx.h"
#include "AcquireKlg.h"
#include "AcquireKlgDoc.h"
#include "MainFrm.h"
#include "RuleDefineView.h"
#include "Global.h"
#include <math.h>
#include "cgqDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CcgqDlg dialog
extern CADODatabase GlDataBase;

CcgqDlg::CcgqDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CcgqDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CcgqDlg)
	//}}AFX_DATA_INIT
}


void CcgqDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CcgqDlg)
	DDX_Control(pDX, IDC_COMBO_NodeSN, m_combo_NodeSN);
	DDX_Control(pDX, IDC_COMBO_busfun, m_combo_busfun);
	DDX_Control(pDX, IDC_ADODC_mhhs, m_adoc_mhhs);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CcgqDlg, CDialog)
	//{{AFX_MSG_MAP(CcgqDlg)
	ON_BN_CLICKED(IDC_BUTTON_addcgq, OnBUTTONaddcgq)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//获得指定的视图类指针
CView* CcgqDlg::GetView(CRuntimeClass* pClass) 
{ 
	CAcquireKlgDoc* pDoc=(CAcquireKlgDoc*)GetParentFrame()->GetActiveView()->GetDocument();
	ASSERT(pDoc);
	CView* pView = NULL; 
	POSITION pos=pDoc->GetFirstViewPosition(); 
	while(pos!=NULL){ 
		pView=pDoc->GetNextView(pos); 
		if(pView->IsKindOf(pClass)) 
			break;
	} 
	if(!pView->IsKindOf(pClass)){ 
		AfxMessageBox("Can't Locate the View."); 
		return NULL;
	} 
	return pView;
} 

/////////////////////////////////////////////////////////////////////////////
// CcgqDlg message handlers

BOOL CcgqDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
    m_pNtView = (CNodeTreeView*)GetView(RUNTIME_CLASS(CNodeTreeView));
	m_pRDView=(CRuleDefineView*)GetView(RUNTIME_CLASS(CRuleDefineView));
	//子结点序号
	CADORecordset recordset(&GlDataBase);
	int nodenum = m_pNtView->GetNodeID();
	if(nodenum == ERR_NOSELETED) return false;
	CString str;
	str.Format("select 结点号 from 结点表 where 父结点号=%d",nodenum);
	recordset.SetQuery(str);
	recordset.Open();
	CString strelement;
	m_combo_NodeSN.ResetContent();
	while(recordset.IsEof()!=TRUE){
		recordset.GetFieldValue("结点号",strelement);
		m_combo_NodeSN.AddString(strelement);
		recordset.MoveNext();
	}
	recordset.Close();
//
	shownew();
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
void CcgqDlg::shownew() 
{

	CString xh=m_pRDView->m_cBlurMergePage.xh;
	SetDlgItemText(IDC_EDIT_FR_id,xh);

	m_adoc_mhhs.SetConnectionString((LPCTSTR)"Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=TDESdb");
	m_adoc_mhhs.SetCommandType(1);
	CString str;
	str.Format("select  FR_id 融合规则ID号,SensorSN 传感器序号,Nodeorder 结点序号,NodeSN 结点编号,busfun 模糊函数类型  from Fuse_Node_Func_Table where FR_id=%d",atoi(xh.GetBuffer(0)));
	m_adoc_mhhs.SetRecordSource(str);
	m_adoc_mhhs.Refresh();
	
	return;  // 
}
void CcgqDlg::clearinput() 
{
	SetDlgItemText(IDC_EDIT_SensorSN,"");
	SetDlgItemText(IDC_COMBO_busfun,"");
	SetDlgItemText(IDC_EDIT_Nodeorder,"");
	SetDlgItemText(IDC_COMBO_NodeSN,"");
}

void CcgqDlg::OnBUTTONaddcgq() 
{
		CADORecordset recordset(&GlDataBase);
		CString strQuery;
		int nodenum = m_pNtView->GetNodeID();
		if(nodenum == ERR_NOSELETED) return;

		CString strFR_id, strSensorSN,strNodeorder,strNodeSN,strbusfun;
		int intbusfun;
		GetDlgItemText(IDC_EDIT_FR_id,strFR_id);
		GetDlgItemText(IDC_EDIT_SensorSN,strSensorSN);	
		GetDlgItemText(IDC_EDIT_Nodeorder,strNodeorder);
		GetDlgItemText(IDC_COMBO_NodeSN,strNodeSN);
		
	 	intbusfun=m_combo_busfun.GetCurSel()+1;
		strFR_id.TrimRight(); strSensorSN.TrimRight();strNodeorder.TrimRight();
		strNodeSN.TrimRight();strbusfun.TrimRight();
		
		if(strFR_id.GetLength()==0||strSensorSN.GetLength()==0||
			strNodeorder.GetLength()==0||strNodeSN.GetLength()==0){
			AfxMessageBox("请完整输入模糊函数情况信息!");
			return;
		}
				
			strQuery.Format("insert into Fuse_Node_Func_Table(FR_id,SensorSN,Nodeorder,NodeSN,busfun) values(%d,%d,%d,%d,%d)",atoi(strFR_id.GetBuffer(0)),atoi(strSensorSN.GetBuffer(0)),atoi(strNodeorder.GetBuffer(0)),atoi(strNodeSN.GetBuffer(0)),intbusfun);
			recordset.SetQuery(strQuery);
			if(recordset.Open() == TRUE){
				AfxMessageBox("模糊函数情况信息插入成功!");
			}
	shownew();
//	m_datagrid1.Refresh();
	clearinput();
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -