You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

242 lines
8.4 KiB
C++

#include "stdafx.h"
#include "LaiPuLaser.h"
#include "afxdialogex.h"
#include "DlgSecsModeCtrl.h"
#include "SemiSecsCommMgr.h"
#include "FoupLoadPortMgr.h"
#include "GlobalDrawMgr.h"
#include "LogMgr.h"
#include "CStringFuc.h"
#define UPDATE_INFO_TIMER 1
#define UPDATE_INFO_TIMER_DELAY 500
IMPLEMENT_DYNAMIC(CDlgSecsModeCtrl, CDialogEx)
BEGIN_MESSAGE_MAP(CDlgSecsModeCtrl, CDialogEx)
ON_WM_TIMER()
ON_BN_CLICKED(NEW_OFFLINE_BTN, &CDlgSecsModeCtrl::OnBnClickedOfflineBtn)
ON_BN_CLICKED(NEW_ONLINE_LOCAL_BTN, &CDlgSecsModeCtrl::OnBnClickedOnlineLocalBtn)
ON_BN_CLICKED(NEW_ONLINE_REMOTE_BTN, &CDlgSecsModeCtrl::OnBnClickedOnlineRemoteBtn)
ON_BN_CLICKED(NEW_PORT1_MANUAL_BTN, &CDlgSecsModeCtrl::OnBnClickedPort1AccessManualBtn)
ON_BN_CLICKED(NEW_PORT2_MANUAL_BTN, &CDlgSecsModeCtrl::OnBnClickedPort2AccessManualBtn)
ON_BN_CLICKED(NEW_PORT1_OHB_BTN, &CDlgSecsModeCtrl::OnBnClickedPort1AccessAutoBtn)
ON_BN_CLICKED(NEW_PORT2_OHB_BTN, &CDlgSecsModeCtrl::OnBnClickedPort2AccessAutoBtn)
ON_BN_CLICKED(IDC_PORT1_USE_CHECK, &CDlgSecsModeCtrl::OnBnClickedPort1UseCheck)
ON_BN_CLICKED(IDC_PORT2_USE_CHECK, &CDlgSecsModeCtrl::OnBnClickedPort2UseCheck)
END_MESSAGE_MAP()
CDlgSecsModeCtrl::CDlgSecsModeCtrl(CWnd* pParent /*=NULL*/)
: CDialogEx(CDlgSecsModeCtrl::IDD, pParent)
{
}
CDlgSecsModeCtrl::~CDlgSecsModeCtrl()
{
}
void CDlgSecsModeCtrl::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, NEW_OFFLINE_BTN, m_OfflineBtn);
DDX_Control(pDX, NEW_ONLINE_LOCAL_BTN, m_OnlineLocalBtn);
DDX_Control(pDX, NEW_ONLINE_REMOTE_BTN, m_OnlineRemoteBtn);
DDX_Control(pDX, NEW_PORT1_MANUAL_BTN, m_Port1ManualBtn);
DDX_Control(pDX, NEW_PORT1_OHB_BTN, m_Port1OhbBtn);
DDX_Control(pDX, NEW_PORT2_MANUAL_BTN, m_Port2ManualBtn);
DDX_Control(pDX, NEW_PORT2_OHB_BTN, m_Port2OhbBtn);
}
BOOL CDlgSecsModeCtrl::OnInitDialog()
{
CDialogEx::OnInitDialog();
UpdateInfoExt();
UpdateData(FALSE);
//<2F><><EFBFBD>öԻ<C3B6><D4BB><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
CRect cr;
GetClientRect(&cr);
ClientToScreen(&cr);
IntXY Pos = gDraw->GetWndPos(_eWndPos_SelSecsModeDlg);
MoveWindow(Pos.x ,Pos.y,cr.Width()+20,cr.Height()+50);
{
CFoupLoadPort &LoadPort = gFoupLoadPortMgr->GetFoupLoadPort(_LoadPortType_Port1);
((CButton*)GetDlgItem(IDC_PORT1_USE_CHECK))->SetCheck(LoadPort.m_bUsePort);
}
{
CFoupLoadPort &LoadPort = gFoupLoadPortMgr->GetFoupLoadPort(_LoadPortType_Port2);
((CButton*)GetDlgItem(IDC_PORT2_USE_CHECK))->SetCheck(LoadPort.m_bUsePort);
}
SetTimer(UPDATE_INFO_TIMER,UPDATE_INFO_TIMER_DELAY,NULL);
return TRUE;
}
void CDlgSecsModeCtrl::OnTimer(UINT nIDEvent)
{
if(nIDEvent == UPDATE_INFO_TIMER)
{
UpdateInfoExt();
}
CDialog::OnTimer(nIDEvent);
}
void CDlgSecsModeCtrl::UpdateInfoExt()
{
COLORREF ColorOn = RGB_YELLOW;
COLORREF ColorOff = RGB_GRAY2;
CONTROL_STATE State = gSemiSecsCommMgr->GetCurCtrlState();
{
COLORREF color;
color = (State!=eCONTROL_ONLINE_REMOTE && State!=eCONTROL_ONLINE_LOCAL)?(ColorOn):(ColorOff);
m_OfflineBtn.SetUpColor(color);
}
{
COLORREF color;
color = (State==eCONTROL_ONLINE_LOCAL)?(ColorOn):(ColorOff);
m_OnlineLocalBtn.SetUpColor(color);
}
{
COLORREF color;
color = (State==eCONTROL_ONLINE_REMOTE)?(ColorOn):(ColorOff);
m_OnlineRemoteBtn.SetUpColor(color);
}
bool bEnable1;
bool bEnable2;
{
CFoupLoadPort &LoadPort = gFoupLoadPortMgr->GetFoupLoadPort(_LoadPortType_Port1);
COLORREF color;
color = (LoadPort.m_AccesMode==_AccesMode_Manual)?(ColorOn):(ColorOff);
m_Port1ManualBtn.SetUpColor(color);
color = (LoadPort.m_AccesMode==_AccesMode_Auto)?(ColorOn):(ColorOff);
m_Port1OhbBtn.SetUpColor(color);
//<2F><EFBFBD><ECB3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
bEnable1 = !LoadPort.IsbOHTRunning();
GetDlgItem(IDC_PORT1_USE_CHECK)->EnableWindow(bEnable1);
GetDlgItem(NEW_PORT1_MANUAL_BTN)->EnableWindow(bEnable1);
}
{
CFoupLoadPort &LoadPort = gFoupLoadPortMgr->GetFoupLoadPort(_LoadPortType_Port2);
COLORREF color;
color = (LoadPort.m_AccesMode==_AccesMode_Manual)?(ColorOn):(ColorOff);
m_Port2ManualBtn.SetUpColor(color);
color = (LoadPort.m_AccesMode==_AccesMode_Auto)?(ColorOn):(ColorOff);
m_Port2OhbBtn.SetUpColor(color);
//<2F><EFBFBD><ECB3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
bEnable2 = !LoadPort.IsbOHTRunning();
GetDlgItem(IDC_PORT2_USE_CHECK)->EnableWindow(bEnable2);
GetDlgItem(NEW_PORT2_MANUAL_BTN)->EnableWindow(bEnable2);
}
{
bool bEnable = bEnable1&&bEnable2;
GetDlgItem(NEW_OFFLINE_BTN)->EnableWindow(bEnable);
GetDlgItem(NEW_ONLINE_LOCAL_BTN)->EnableWindow(bEnable);
}
}
void CDlgSecsModeCtrl::OnBnClickedOfflineBtn()
{
CLogInfo LogInfo;
LogInfo.m_ClassName = "CDlgSecsModeCtrl";
LogInfo.m_FuncName = "OnBnClickedOfflineBtn";
gLogMgr->WriteLogInfo(LogInfo);
gSemiSecsCommMgr->ChangeCtrlMode(eCONTROL_MODE_OFFLINE);
}
void CDlgSecsModeCtrl::OnBnClickedOnlineLocalBtn()
{
CLogInfo LogInfo;
LogInfo.m_ClassName = "CDlgSecsModeCtrl";
LogInfo.m_FuncName = "OnBnClickedOnlineLocalBtn";
gLogMgr->WriteLogInfo(LogInfo);
gSemiSecsCommMgr->ChangeCtrlMode(eCONTROL_MODE_ONLINE_LOCAL);
}
void CDlgSecsModeCtrl::OnBnClickedOnlineRemoteBtn()
{
CLogInfo LogInfo;
LogInfo.m_ClassName = "CDlgSecsModeCtrl";
LogInfo.m_FuncName = "OnBnClickedOnlineRemoteBtn";
gLogMgr->WriteLogInfo(LogInfo);
gSemiSecsCommMgr->ChangeCtrlMode(eCONTROL_MODE_ONLINE_REMOTE);
}
void CDlgSecsModeCtrl::OnBnClickedPort1AccessManualBtn()
{
CLogInfo LogInfo;
LogInfo.m_ClassName = "CDlgSecsModeCtrl";
LogInfo.m_FuncName = "OnBnClickedPort1AccessManualBtn";
gLogMgr->WriteLogInfo(LogInfo);
gFoupLoadPortMgr->ChangeLoadPortAccessState(_LoadPortType_Port1,_AccesMode_Manual);
}
void CDlgSecsModeCtrl::OnBnClickedPort1AccessAutoBtn()
{
CLogInfo LogInfo;
LogInfo.m_ClassName = "CDlgSecsModeCtrl";
LogInfo.m_FuncName = "OnBnClickedPort1AccessAutoBtn";
gLogMgr->WriteLogInfo(LogInfo);
gFoupLoadPortMgr->ChangeLoadPortAccessState(_LoadPortType_Port1,_AccesMode_Auto);
}
void CDlgSecsModeCtrl::OnBnClickedPort2AccessManualBtn()
{
CLogInfo LogInfo;
LogInfo.m_ClassName = "CDlgSecsModeCtrl";
LogInfo.m_FuncName = "OnBnClickedPort2AccessManualBtn";
gLogMgr->WriteLogInfo(LogInfo);
gFoupLoadPortMgr->ChangeLoadPortAccessState(_LoadPortType_Port2,_AccesMode_Manual);
}
void CDlgSecsModeCtrl::OnBnClickedPort2AccessAutoBtn()
{
CLogInfo LogInfo;
LogInfo.m_ClassName = "CDlgSecsModeCtrl";
LogInfo.m_FuncName = "OnBnClickedPort2AccessAutoBtn";
gLogMgr->WriteLogInfo(LogInfo);
gFoupLoadPortMgr->ChangeLoadPortAccessState(_LoadPortType_Port2,_AccesMode_Auto);
}
void CDlgSecsModeCtrl::OnBnClickedPort1UseCheck()
{
bool b = ((CButton*)GetDlgItem(IDC_PORT1_USE_CHECK))->GetCheck();
CLogInfo LogInfo;
LogInfo.m_ClassName = "CDlgSecsModeCtrl";
LogInfo.m_FuncName = "OnBnClickedPort1UseCheck";
LogInfo.m_LogMsg = Bool2CStringYesNo(b);
gLogMgr->WriteLogInfo(LogInfo);
CFoupLoadPort &LoadPort = gFoupLoadPortMgr->GetFoupLoadPort(_LoadPortType_Port1);
LoadPort.m_bUsePort = b;
gSemiSecsCommMgr->ChangeEapFlowStepState(_LoadPortType_Port1);
//<2F><>ʹ<EFBFBD><CAB9>port<72><74>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>access mode<64>Զ<EFBFBD><D4B6>л<EFBFBD>Ϊmanual
if(!b)
{
gFoupLoadPortMgr->ChangeLoadPortAccessState(_LoadPortType_Port1,_AccesMode_Manual);
}
}
void CDlgSecsModeCtrl::OnBnClickedPort2UseCheck()
{
bool b = ((CButton*)GetDlgItem(IDC_PORT2_USE_CHECK))->GetCheck();
CLogInfo LogInfo;
LogInfo.m_ClassName = "CDlgSecsModeCtrl";
LogInfo.m_FuncName = "OnBnClickedPort2UseCheck";
LogInfo.m_LogMsg = Bool2CStringYesNo(b);
gLogMgr->WriteLogInfo(LogInfo);
CFoupLoadPort &LoadPort = gFoupLoadPortMgr->GetFoupLoadPort(_LoadPortType_Port2);
LoadPort.m_bUsePort = b;
gSemiSecsCommMgr->ChangeEapFlowStepState(_LoadPortType_Port2);
//<2F><>ʹ<EFBFBD><CAB9>port<72><74>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>access mode<64>Զ<EFBFBD><D4B6>л<EFBFBD>Ϊmanual
if(!b)
{
gFoupLoadPortMgr->ChangeLoadPortAccessState(_LoadPortType_Port2,_AccesMode_Manual);
}
}