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.

104 lines
2.4 KiB
C++

#include "stdafx.h"
#include "LaiPuLaser.h"
#include "DlgWorkRecord.h"
#include "afxdialogex.h"
#include "WorkRecord.h"
#include "ProgramLaserTuiHuo.h"
#include "PenParMgr.h"
#include "LogMgr.h"
#include "MsgBox.h"
#include "GlobalFunction.h"
IMPLEMENT_DYNAMIC(CDlgWorkRecord, CDialogEx)
CDlgWorkRecord::CDlgWorkRecord(CWnd* pParent /*=NULL*/)
: CDialogEx(CDlgWorkRecord::IDD, pParent)
{
m_CurSelIdx = -1;//当前选中的索引值
}
CDlgWorkRecord::~CDlgWorkRecord()
{
}
void CDlgWorkRecord::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_SEARCH_BTN, m_SearchBtn);
DDX_Control(pDX, IDC_RECORD_LIST, m_RecordList);
DDX_Control(pDX, IDC_RECORD_INFO_LIST, m_RecordInfoList);
DDX_Control(pDX, IDC_MONTHCALENDAR1, m_montCtrl);
DDX_Text(pDX, IDC_LOT_NUMBER, m_SearchNumber);
}
BEGIN_MESSAGE_MAP(CDlgWorkRecord, CDialogEx)
ON_NOTIFY(MCN_SELCHANGE, IDC_MONTHCALENDAR1, OnMcnSelchangecalendar)
ON_BN_CLICKED(IDC_SEARCH_BTN, &CDlgWorkRecord::OnBnClickedSearchBtn)
ON_NOTIFY(NM_CLICK, IDC_RECORD_LIST, &CDlgWorkRecord::OnNMClickList)
ON_BN_CLICKED(IDC_TO_EXCEL_BTN, &CDlgWorkRecord::OnBnClickedToExcelBtn)
END_MESSAGE_MAP()
BOOL CDlgWorkRecord::OnInitDialog()
{
CDialogEx::OnInitDialog();
m_SearchBtn.SetUpColor(RGB_GREEN);
UpdateData(FALSE);
return TRUE;
}
//响应日期变化
void CDlgWorkRecord::OnMcnSelchangecalendar(NMHDR *pNMHDR, LRESULT *pResult)
{
m_CurSelIdx = -1;
*pResult = 0;
}
CString CDlgWorkRecord::GetSelDate()
{
CTime month;
m_montCtrl.GetCurSel(month); //获取当前日期信息
CWorkTime WorkTime;
CString SelDate = WorkTime.GetDateStr(month,"_");
return SelDate;
}
//单击列表
void CDlgWorkRecord::OnNMClickList(NMHDR *pNMHDR, LRESULT *pResult)
{
*pResult = 0;
int idx = GetCurListIdx(m_RecordList);
if(idx>=0)
{
//设置选择的idx 为当前记录
m_CurSelIdx = idx;
}
}
//检查选中行号
bool CDlgWorkRecord::CheckCurSelIdx()
{
if(m_CurSelIdx<0)
{
CMsgBox MsgBox;
MsgBox.Show("请先选则要操作的记录!");
return false;
}
return true;
}
//通过ID 号查找记录
void CDlgWorkRecord::OnBnClickedSearchBtn()
{
if(!UpdateData(TRUE))
return;
m_CurSelIdx = -1;
}
//选中的记录导出excel
void CDlgWorkRecord::OnBnClickedToExcelBtn()
{
//检查选中行号
if(!CheckCurSelIdx())
return;
}