📄 plcinidlg.cpp
字号:
// PlcINIDlg.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "PlcINIDlg.h"
#include "FLADS.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPlcINIDlg dialog
extern CFLADSApp theApp;
CPlcINIDlg::CPlcINIDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPlcINIDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CPlcINIDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CPlcINIDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPlcINIDlg)
DDX_Control(pDX, IDC_CHECK16, m_soepm);
DDX_Control(pDX, IDC_CHECK15, m_dnmc);
DDX_Control(pDX, IDC_CHECK14, m_upmc);
DDX_Control(pDX, IDC_CHECK13, m_pin8);
DDX_Control(pDX, IDC_CHECK12, m_pin7);
DDX_Control(pDX, IDC_CHECK11, m_pin6);
DDX_Control(pDX, IDC_CHECK10, m_pin5);
DDX_Control(pDX, IDC_CHECK9, m_pin4);
DDX_Control(pDX, IDC_CHECK8, m_pin3);
DDX_Control(pDX, IDC_CHECK7, m_pin2);
DDX_Control(pDX, IDC_CHECK6, m_pin1);
DDX_Control(pDX, IDC_CHECK5, m_not);
DDX_Control(pDX, IDC_CHECK4, m_clr);
DDX_Control(pDX, IDC_CHECK3, m_set);
DDX_Control(pDX, IDC_CHECK1, m_and);
DDX_Control(pDX, IDC_CHECK2, m_or);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPlcINIDlg, CDialog)
//{{AFX_MSG_MAP(CPlcINIDlg)
ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
ON_BN_CLICKED(IDC_CHECK2, OnCheck2)
ON_BN_CLICKED(IDC_CHECK3, OnCheck3)
ON_BN_CLICKED(IDC_CHECK4, OnCheck4)
ON_BN_CLICKED(IDC_CHECK5, OnCheck5)
ON_BN_CLICKED(IDC_CHECK6, OnCheck6)
ON_BN_CLICKED(IDC_CHECK7, OnCheck7)
ON_BN_CLICKED(IDC_CHECK8, OnCheck8)
ON_BN_CLICKED(IDC_CHECK9, OnCheck9)
ON_BN_CLICKED(IDC_CHECK10, OnCheck10)
ON_BN_CLICKED(IDC_CHECK11, OnCheck11)
ON_BN_CLICKED(IDC_CHECK12, OnCheck12)
ON_BN_CLICKED(IDC_CHECK13, OnCheck13)
ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1)
ON_EN_CHANGE(IDC_EDIT2, OnChangeEdit2)
ON_EN_CHANGE(IDC_EDIT4, OnChangeEdit4)
ON_EN_CHANGE(IDC_EDIT3, OnChangeEdit3)
ON_EN_CHANGE(IDC_EDIT5, OnChangeEdit5)
ON_EN_CHANGE(IDC_EDIT6, OnChangeEdit6)
ON_EN_CHANGE(IDC_EDIT7, OnChangeEdit7)
ON_EN_CHANGE(IDC_EDIT8, OnChangeEdit8)
ON_EN_CHANGE(IDC_EDIT9, OnChangeEdit9)
ON_EN_CHANGE(IDC_EDIT10, OnChangeEdit10)
ON_BN_CLICKED(IDC_CHECK14, OnCheck14)
ON_BN_CLICKED(IDC_CHECK15, OnCheck15)
ON_BN_CLICKED(IDC_CHECK16, OnCheck16)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPlcINIDlg message handlers
BOOL CPlcINIDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
int i,j;
CString string;
string.Format(_T("%03d输入类型"),theApp.krnum+1);
SetDlgItemText(IDC_TYPE,string);
SetDlgItemText(IDC_README,theApp.Warninformatiom[theApp.krnum]);
switch(theApp.yxtask.con_in[theApp.krnum].B.log_enable)
{
case 0:m_and.SetCheck(1);
m_or.SetCheck(0);
m_set.SetCheck(0);
m_clr.SetCheck(0);
break;
case 1:m_and.SetCheck(0);
m_or.SetCheck(1);
m_set.SetCheck(0);
m_clr.SetCheck(0);
break;
case 2:m_and.SetCheck(0);
m_or.SetCheck(0);
m_set.SetCheck(1);
m_clr.SetCheck(0);
break;
case 3:m_and.SetCheck(0);
m_or.SetCheck(0);
m_set.SetCheck(0);
m_clr.SetCheck(1);
break;
}
m_not.SetCheck((int)theApp.yxtask.con_in[theApp.krnum].B.kgbf);
i=(int)theApp.yxtask.con_in[theApp.krnum].B.unit_num;
string.Format(_T("%3d"),i+1);
SetDlgItemText(IDC_EDIT1,string);
m_pin1.SetCheck((int)theApp.yxtask.con_in[theApp.krnum].B.u0_kgbf);
m_pin2.SetCheck((int)theApp.yxtask.con_in[theApp.krnum].B.u1_kgbf);
m_pin3.SetCheck((int)theApp.yxtask.con_in[theApp.krnum].B.u2_kgbf);
m_pin4.SetCheck((int)theApp.yxtask.con_in[theApp.krnum].B.u3_kgbf);
m_pin5.SetCheck((int)theApp.yxtask.con_in[theApp.krnum].B.u4_kgbf);
m_pin6.SetCheck((int)theApp.yxtask.con_in[theApp.krnum].B.u5_kgbf);
m_pin7.SetCheck((int)theApp.yxtask.con_in[theApp.krnum].B.u6_kgbf);
m_pin8.SetCheck((int)theApp.yxtask.con_in[theApp.krnum].B.u7_kgbf);
string.Format(_T("%3d"),(int)theApp.yxtask.us[theApp.krnum][0]+1);
SetDlgItemText(IDC_EDIT2,string);
string.Format(_T("%3d"),(int)theApp.yxtask.us[theApp.krnum][2]+1);
SetDlgItemText(IDC_EDIT3,string);
string.Format(_T("%3d"),(int)theApp.yxtask.us[theApp.krnum][1]+1);
SetDlgItemText(IDC_EDIT4,string);
string.Format(_T("%3d"),(int)theApp.yxtask.us[theApp.krnum][3]+1);
SetDlgItemText(IDC_EDIT5,string);
string.Format(_T("%3d"),(int)theApp.yxtask.us[theApp.krnum][4]+1);
SetDlgItemText(IDC_EDIT6,string);
string.Format(_T("%3d"),(int)theApp.yxtask.us[theApp.krnum][5]+1);
SetDlgItemText(IDC_EDIT7,string);
string.Format(_T("%3d"),(int)theApp.yxtask.us[theApp.krnum][6]+1);
SetDlgItemText(IDC_EDIT8,string);
string.Format(_T("%3d"),(int)theApp.yxtask.us[theApp.krnum][7]+1);
SetDlgItemText(IDC_EDIT9,string);
j=theApp.yxtask.bvtm[theApp.krnum];
string.Format(_T("%3d"),j);
SetDlgItemText(IDC_EDIT10,string);
m_upmc. SetCheck(theApp.yxtask.con_in[theApp.krnum].B.upm_enable);
m_dnmc. SetCheck(theApp.yxtask.con_in[theApp.krnum].B.dnm_enable);
m_soepm.SetCheck(theApp.yxtask.con_in[theApp.krnum].B.soe_enable);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CPlcINIDlg::OnCheck1()
{//与门
// TODO: Add your control notification handler code here
if((m_and.GetCheck()%2)!=0)
{
m_and.SetCheck(1);
m_or.SetCheck(0);
m_set.SetCheck(0);
m_clr.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.log_enable=0;
}else
{
m_and.SetCheck(0);
m_or.SetCheck(0);
m_set.SetCheck(0);
m_clr.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.log_enable=3;
}
}
void CPlcINIDlg::OnCheck2()
{//或门
// TODO: Add your control notification handler code here
if((m_or.GetCheck()%2)!=0)
{
m_and.SetCheck(0);
m_or.SetCheck(1);
m_set.SetCheck(0);
m_clr.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.log_enable=1;
}else
{
m_and.SetCheck(0);
m_or.SetCheck(0);
m_set.SetCheck(0);
m_clr.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.log_enable=3;
}
}
void CPlcINIDlg::OnCheck3()
{//设置
// TODO: Add your control notification handler code here
if((m_set.GetCheck()%2)!=0)
{
m_and.SetCheck(0);
m_or.SetCheck(0);
m_set.SetCheck(1);
m_clr.SetCheck(0);
theApp.yxtask.BitSetChar(theApp.yxtask.yxbuf,theApp.krnum);
theApp.yxtask.con_in[theApp.krnum].B.log_enable=2;
}else
{
m_and.SetCheck(0);
m_or.SetCheck(0);
m_set.SetCheck(0);
m_clr.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.log_enable=3;
}
}
void CPlcINIDlg::OnCheck4()
{//清零
// TODO: Add your control notification handler code here
if((m_clr.GetCheck()%2)!=0)
{
m_and.SetCheck(0);
m_or.SetCheck(0);
m_set.SetCheck(0);
m_clr.SetCheck(1);
theApp.yxtask.BitClrChar(theApp.yxtask.yxbuf,theApp.krnum);
theApp.yxtask.con_in[theApp.krnum].B.log_enable=3;
}else
{
m_and.SetCheck(1);
m_or.SetCheck(0);
m_set.SetCheck(0);
m_clr.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.log_enable=0;
}
}
void CPlcINIDlg::OnCheck5()
{//取反
// TODO: Add your control notification handler code here
if((m_not.GetCheck()%2)!=0)
{
m_not.SetCheck(1);
theApp.yxtask.BitXorChar(theApp.yxtask.yxbuf,theApp.krnum);
theApp.yxtask.con_in[theApp.krnum].B.kgbf=1;
}else
{
m_not.SetCheck(0);
theApp.yxtask.BitXorChar(theApp.yxtask.yxbuf,theApp.krnum);
theApp.yxtask.con_in[theApp.krnum].B.kgbf=0;
}
}
void CPlcINIDlg::OnCheck6()
{//子项1
// TODO: Add your control notification handler code here
if((m_pin1.GetCheck()%2)!=0)
{
m_pin1.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.u0_kgbf=1;
}else
{
m_pin1.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.u0_kgbf=0;
}
}
void CPlcINIDlg::OnCheck7()
{//子项2
// TODO: Add your control notification handler code here
if((m_pin2.GetCheck()%2)!=0)
{
m_pin2.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.u1_kgbf=1;
}else
{
m_pin2.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.u1_kgbf=0;
}
}
void CPlcINIDlg::OnCheck8()
{//子项3
// TODO: Add your control notification handler code here
if((m_pin3.GetCheck()%2)!=0)
{
m_pin3.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.u2_kgbf=1;
}else
{
m_pin3.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.u2_kgbf=0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -