热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

事件驱动调度

问题如下:设有K个工序,每个工序编号为Ji,i1,2,…,K。总工序数。在M个设备上加工
问题如下:
设有K个工序,每个工序编号为Ji,i=1,2,…,K。总工序数。
在M个设备上加工,要求:
1.一台设备在某一时刻只能加工一道工序;
2.一台设备一旦加工某道工序,则直到该工序加工完毕后,这台设备才能加工其它工序;
3.一道工序只能被一台设备加工;
4.每道工序都必须在其紧前工序加工完后,方可开始加工;
5.每道工序的加工时间已知,且与加工顺序无关;
6.允许工序之间等待,允许设备在工序达到之前闲置










针对加工工序加工顺序的不确定性,利用构造事件驱动的思想,提出根据事件驱动产品加工的综合调度。
系统初始时所有设备的均空闲,此时由系统产生设备空闲事件,并驱动工序集中的可调度工序可在其加工设备上安排调度,使得该时刻工序集产生加工开始事件。随着系统加工时间推移,当有工序加工完毕时,工序集产生加工完毕事件,同时由于有工序加工完毕,其加工设备会在此时出现空闲,此时设备集产生设备空闲事件。
加工完毕事件与设备空闲事件在同一时刻发生,该时刻设备集中产生了新的空闲设备,工序集中产生了加工完毕的工序且有可能产生新的可调度工序。这两个事件更新了设备集和工序集中元素的状态,为触发新的加工开始事件创造了条件。
此时产生的设备空闲事件驱动空闲设备进行一次可调度工序的寻找,对于满足可调度约束条件的工序(即可调度工序),在该时刻安排调度,并由工序集产生新的加工开始事件。
通过以上描述,每次加工开始事件代表着工序的一次调度,加工完毕事件代表工序调度的结束,如此反复当加工完毕事件和设备空闲事件发生时,若所有设备均空闲,且无可调度工序,即工序集中的所有工序均已加工完毕,则系统加工结束。
具体思路是以每次工序加工结束作为一次设备空闲事件,驱动空闲设备进行一次可调度工序的寻找;如果可调度工序唯一,则调度此工序;如果可调度工序不唯一,选择用时短的工序。
数据结构分析

// BatchDis.cpp : Defines the class behaviors for the application.
//#include "stdafx.h"
#include "BatchDis.h"
#include "BatchDisDlg.h"
#pragma comment(lib,"SkinPPWTL.lib");
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/
// CBatchDisAppBEGIN_MESSAGE_MAP(CBatchDisApp, CWinApp)//{{AFX_MSG_MAP(CBatchDisApp)// NOTE - the ClassWizard will add and remove mapping macros here.// DO NOT EDIT what you see in these blocks of generated code!//}}AFX_MSGON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()/
// CBatchDisApp constructionCBatchDisApp::CBatchDisApp()
{// TODO: add construction code here,// Place all significant initialization in InitInstance
}/
// The one and only CBatchDisApp objectCBatchDisApp theApp;/
// CBatchDisApp initializationBOOL CBatchDisApp::InitInstance()
{AfxEnableControlContainer();// Standard initialization// If you are not using these features and wish to reduce the size// of your final executable, you should remove from the following// the specific initialization routines you do not need.skinppLoadSkin(_T("Devoir.ssk"));
#ifdef _AFXDLLEnable3dControls(); // Call this when using MFC in a shared DLL
#elseEnable3dControlsStatic(); // Call this when linking to MFC statically
#endifCBatchDisDlg dlg;m_pMainWnd = &dlg;int nResponse = dlg.DoModal();if (nResponse == IDOK){// TODO: Place code here to handle when the dialog is// dismissed with OK}else if (nResponse == IDCANCEL){// TODO: Place code here to handle when the dialog is// dismissed with Cancel}// Since the dialog has been closed, return FALSE so that we exit the// application, rather than start the application's message pump.return FALSE;
}int CBatchDisApp::ExitInstance()
{// TODO: Add your specialized code here and/or call the base classskinppExitSkin();return CWinApp::ExitInstance();
}// BatchDisDlg.cpp : implementation file
//#include "stdafx.h"
#include "BatchDis.h"
#include "BatchDisDlg.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/
// CAboutDlg dialog used for App Aboutclass CAboutDlg : public CDialog
{
public:CAboutDlg();// Dialog Data//{{AFX_DATA(CAboutDlg)enum { IDD = IDD_ABOUTBOX };//}}AFX_DATA// ClassWizard generated virtual function overrides//{{AFX_VIRTUAL(CAboutDlg)protected:virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support//}}AFX_VIRTUAL// Implementation
protected://{{AFX_MSG(CAboutDlg)//}}AFX_MSGDECLARE_MESSAGE_MAP()
};CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{//{{AFX_DATA_INIT(CAboutDlg)//}}AFX_DATA_INIT
}void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{CDialog::DoDataExchange(pDX);//{{AFX_DATA_MAP(CAboutDlg)//}}AFX_DATA_MAP
}BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)//{{AFX_MSG_MAP(CAboutDlg)// No message handlers//}}AFX_MSG_MAP
END_MESSAGE_MAP()/
// CBatchDisDlg dialogCBatchDisDlg::CBatchDisDlg(CWnd* pParent /*=NULL*/): CDialog(CBatchDisDlg::IDD, pParent)
{//{{AFX_DATA_INIT(CBatchDisDlg)// NOTE: the ClassWizard will add member initialization here//}}AFX_DATA_INIT// Note that LoadIcon does not require a subsequent DestroyIcon in Win32m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);}void CBatchDisDlg::DoDataExchange(CDataExchange* pDX)
{CDialog::DoDataExchange(pDX);//{{AFX_DATA_MAP(CBatchDisDlg)// NOTE: the ClassWizard will add DDX and DDV calls here//}}AFX_DATA_MAP
}BEGIN_MESSAGE_MAP(CBatchDisDlg, CDialog)//{{AFX_MSG_MAP(CBatchDisDlg)ON_WM_SYSCOMMAND()ON_WM_PAINT()ON_WM_QUERYDRAGICON()ON_BN_CLICKED(IDC_ADD_DATA, OnAddData)ON_BN_CLICKED(IDC_DATA_SHOW, OnDataShow)ON_WM_MOUSEMOVE()//}}AFX_MSG_MAP
END_MESSAGE_MAP()/
// CBatchDisDlg message handlersBOOL CBatchDisDlg::OnInitDialog()
{CDialog::OnInitDialog();// Add "About..." menu item to system menu.// IDM_ABOUTBOX must be in the system command range.ASSERT((IDM_ABOUTBOX & 0xFFF0) &#61;&#61; IDM_ABOUTBOX);ASSERT(IDM_ABOUTBOX <0xF000);CMenu* pSysMenu &#61; GetSystemMenu(FALSE);if (pSysMenu !&#61; NULL){CString strAboutMenu;strAboutMenu.LoadString(IDS_ABOUTBOX);if (!strAboutMenu.IsEmpty()){pSysMenu->AppendMenu(MF_SEPARATOR);pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);}}// Set the icon for this dialog. The framework does this automatically// when the application&#39;s main window is not a dialogSetIcon(m_hIcon, TRUE); // Set big iconSetIcon(m_hIcon, FALSE);// Set small iconthis->SetWindowText(_T("主对话框"));GetDlgItem(IDC_DATA_SHOW)->EnableWindow(FALSE);// TODO: Add extra initialization hereCShowDlg dlgshow;dlgshow.DoModal();return TRUE; // return TRUE unless you set the focus to a control
}void CBatchDisDlg::OnSysCommand(UINT nID, LPARAM lParam)
{if ((nID & 0xFFF0) &#61;&#61; IDM_ABOUTBOX){CAboutDlg dlgAbout;dlgAbout.DoModal();}else{CDialog::OnSysCommand(nID, lParam);}
}// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.void CBatchDisDlg::OnPaint()
{if (IsIconic()){CPaintDC dc(this); // device context for paintingSendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);// Center icon in client rectangleint cxIcon &#61; GetSystemMetrics(SM_CXICON);int cyIcon &#61; GetSystemMetrics(SM_CYICON);CRect rect;GetClientRect(&rect);int x &#61; (rect.Width() - cxIcon &#43; 1) / 2;int y &#61; (rect.Height() - cyIcon &#43; 1) / 2;// Draw the icondc.DrawIcon(x, y, m_hIcon);}else{CDialog::OnPaint();}
}// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CBatchDisDlg::OnQueryDragIcon()
{return (HCURSOR) m_hIcon;
}void CBatchDisDlg::OnAddData()
{// TODO: Add your control notification handler code hereif(dlg.DoModal() &#61;&#61; IDOK){GetDlgItem(IDC_DATA_SHOW)->EnableWindow(TRUE);}
}
void CBatchDisDlg::OnDataShow()
{// TODO: Add your control notification handler code hereCClientDC dc(this);//dc.Ellipse(CRect(100,100,200,200));//划y拱形线dc.MoveTo(65,55);dc.LineTo(70,50);dc.LineTo(75,55);//划xy轴dc.MoveTo(70,50);dc.LineTo(70,420);dc.LineTo(800,420);//画x拱形线dc.MoveTo(795,415);dc.LineTo(800,420);dc.LineTo(795,425);//画机器标线dc.MoveTo(70,330);dc.LineTo(76,330);dc.MoveTo(70,240);dc.LineTo(76,240);dc.MoveTo(70,150);dc.LineTo(76,150);//画机器坐标并且画出M0-7机器int zone&#61; (420-50)/dlg.m_macCount;int halfzone&#61;zone/2;UINT i;for(i&#61;0;i&#61;mylist[minRange].GetAt(mylist[minRange].FindIndex(i)).childFinishTime){have&#61;true;break;}}if(have){CRect rect&#61;CRect(time[minRange]&#43;70,420-halfzone-minRange*zone-10,time[minRange]\&#43;70&#43;mylist[minRange].GetAt(mylist[minRange].FindIndex(i)).m_usedtime*2,\420-halfzone-minRange*zone&#43;10);dc.FillRect(rect,&brush);dc.TextOut(time[minRange]&#43;70,420-halfzone-minRange*zone&#43;10,\mylist[minRange].GetAt(mylist[minRange].FindIndex(i)).m_name);time[minRange]&#43;&#61;mylist[minRange].GetAt(mylist[minRange].FindIndex(i)).m_usedtime*2;if(mylist[minRange].GetAt(mylist[minRange].FindIndex(i)).m_parent !&#61; NULL){if(mylist[minRange].GetAt(mylist[minRange].FindIndex(i)).m_parent->childFinishTimechildFinishTime&#61;time[minRange];}}mylist[minRange].RemoveAt(mylist[minRange].FindIndex(i));InitialMylist(mylist);}else{UINT min;min&#61;mylist[minRange].GetHead().childFinishTime;i&#61;0;for(UINT pp&#61;0;ppmylist[minRange].GetAt(mylist[minRange].FindIndex(pp)).childFinishTime){min&#61;mylist[minRange].GetAt(mylist[minRange].FindIndex(pp)).childFinishTime;i&#61;pp;}}dc.FillRect(CRect(min&#43;70,420-halfzone-minRange*zone-10,min\&#43;70&#43;mylist[minRange].GetAt(mylist[minRange].FindIndex(i)).m_usedtime*2,\420-halfzone-minRange*zone&#43;10),&brush);dc.TextOut(min&#43;70,420-halfzone-minRange*zone&#43;10,\mylist[minRange].GetAt(mylist[minRange].FindIndex(i)).m_name);time[minRange]&#61;min&#43;mylist[minRange].GetAt(mylist[minRange].FindIndex(i)).m_usedtime*2;if(mylist[minRange].GetAt(mylist[minRange].FindIndex(i)).m_parent !&#61; NULL){mylist[minRange].GetAt(mylist[minRange].FindIndex(i)).m_parent->childFinishTime&#61;time[minRange];}mylist[minRange].RemoveAt(mylist[minRange].FindIndex(i));InitialMylist(mylist);}clor[minRange]&#43;&#43;;brush.Detach();for(i&#61;0;i}
//找出第几xiao的数的索引&#xff1f;还未解决
// 程序已经验证了&#xff0c;符合ok
UINT CBatchDisDlg::CompareTime(UINT *time,int parmMin)
{UINT maxNumber&#61;0;UINT min&#61;10000;CArray tmp;BOOL judge&#61;FALSE;for(int m&#61;1;m<&#61;parmMin;m&#43;&#43;){ min&#61;10000;for(UINT i&#61;0;itime[i]){maxNumber&#61;i;min&#61;time[i];}}tmp.Add(maxNumber);}return tmp[parmMin-1];
}
//这个函数应该没问题
// this function is OK
//这个函数是为了把m_vecTotalTrue中的变量加入到mylist链表中&#xff08;按增序&#xff09;同时删除该元素在m_vecTotalTrue中的存在
void CBatchDisDlg::InitialMylist(CMyList *mylist)
{for(int i&#61;0;i/* if(m_vecTotalTrue[i].m_parent->m_leftchild &#61;&#61; &m_vecTotalTrue[i]){m_vecTotalTrue[i].m_parent->m_leftchild &#61;NULL;}else{m_vecTotalTrue[i].m_parent->m_rightchild &#61;NULL;}
*/for(j&#61;0;jm_childAddress.GetCount();j&#43;&#43;){if(m_vecTotalTrue[i].m_parent->m_childAddress.GetAt(\m_vecTotalTrue[i].m_parent->m_childAddress.FindIndex(j)) &#61;&#61; &m_vecTotalTrue[i]){m_vecTotalTrue[i].m_parent->m_childAddress.SetAt(\m_vecTotalTrue[i].m_parent->m_childAddress.FindIndex(j),NULL);break;}}}// m_vecTotalTrue.RemoveAt(i);// i--;m_vecTotalTrue[i].m_flags &#61;FALSE;if(mylist[tmp.m_machine].GetCount() &#61;&#61; 0){mylist[tmp.m_machine].AddHead(tmp);//continue;}else{pt&#61;mylist[tmp.m_machine].GetHeadPosition();for(int p&#61;0; p}
//this function is OK
//confirm
//查找name所代表的父节点
ListStructTrue * CBatchDisDlg::FindParent(CString name)
{if(name !&#61;""){for(int i&#61;0; i }//this function is OK
//confirm
//查找name所代表的昨孩子
ListStructTrue * CBatchDisDlg::FindLeftChild(CString name)
{if(name !&#61; ""){for(int i&#61;0; i }
//this function is OK
//confirm
//查找name所代表的右孩子
ListStructTrue* CBatchDisDlg::FindRightChild(CString name)
{if(name !&#61; ""){for(int i&#61;0; i }void CBatchDisDlg::OnMouseMove(UINT nFlags, CPoint point)
{// TODO: Add your message handler code here and/or call defaultCFont font;CClientDC dc(GetDlgItem(IDC_ZUOBIAO));font.CreateFont(10,10,0,0,FW_NORMAL,false,false,false,CHINESEBIG5_CHARSET,OUT_CHARACTER_PRECIS,CLIP_CHARACTER_PRECIS,DEFAULT_QUALITY,FF_MODERN,"黑体");dc.SelectObject(&font);CPen pen(PS_SOLID,1,RGB(255,0,0));
// dc.SetBkMode(TRANSPARENT);dc.SelectObject(&pen);CString str&#61;"";str.Format("x&#61;%d,y&#61;%d",(point.x-70)/2,420-point.y);dc.SetTextColor(RGB(255,0,0));dc.TextOut(2,2,str);CDialog::OnMouseMove(nFlags, point);
}// DataDlg.cpp : implementation file
//#include "stdafx.h"
#include "BatchDis.h"
#include "DataDlg.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] &#61; __FILE__;
#endif/
// CDataDlg dialogCDataDlg::CDataDlg(CWnd* pParent /*&#61;NULL*/): CDialog(CDataDlg::IDD, pParent)
{//{{AFX_DATA_INIT(CDataDlg)m_macCount &#61; 0;//}}AFX_DATA_INITm_vecTmp.RemoveAll();m_vecTotal.RemoveAll();m_hIcon&#61;(HICON)LoadImage(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDI_ICON1),IMAGE_ICON,0,0,LR_DEFAULTSIZE);m_images.Create(32,32,ILC_COLOR32,1,1);m_images.Add(m_hIcon);
}void CDataDlg::DoDataExchange(CDataExchange* pDX)
{CDialog::DoDataExchange(pDX);//{{AFX_DATA_MAP(CDataDlg)DDX_Control(pDX, IDC_LIST1, m_list);DDX_Text(pDX, IDC_MAC_COUNT, m_macCount);DDV_MinMaxUInt(pDX, m_macCount, 1, 8);//}}AFX_DATA_MAP
}BEGIN_MESSAGE_MAP(CDataDlg, CDialog)//{{AFX_MSG_MAP(CDataDlg)ON_BN_CLICKED(IDC_ADD, OnAdd)ON_BN_CLICKED(IDC_CANCLE, OnCancle)ON_BN_CLICKED(IDC_DELETE, OnDelete)//}}AFX_MSG_MAP
END_MESSAGE_MAP()/
// CDataDlg message handlersvoid CDataDlg::OnAdd()
{// TODO: Add your control notification handler code hereint nCount &#61; m_list.GetItemCount();ListStruct m_lineTmp;CInsertDlg dlg;if(dlg.DoModal() &#61;&#61; IDOK){ CString m_tmp;m_lineTmp.m_name &#61; dlg.m_name;m_lineTmp.m_parent &#61; dlg.m_parent;//m_lineTmp.m_leftchild &#61; dlg.m_leftchild;//m_lineTmp.m_rightchild &#61; dlg.m_rightchild;m_tmp&#61;dlg.m_child;m_tmp.Replace(&#39;&#64;&#39;,&#39; &#39;);m_lineTmp.m_child &#61; m_tmp;m_lineTmp.m_usedtime &#61; dlg.m_usedtime;m_lineTmp.m_machine &#61; dlg.m_machine;m_list.InsertItem(nCount,m_lineTmp.m_name);m_list.SetItemText(nCount,1,m_lineTmp.m_parent);m_list.SetItemText(nCount,2,m_lineTmp.m_child);// m_list.SetItemText(nCount,3,m_lineTmp.m_rightchild);m_tmp&#61;"";m_tmp.Format("%d",dlg.m_usedtime);m_list.SetItemText(nCount,3,m_tmp);m_tmp&#61;"";m_tmp.Format("%d",m_lineTmp.m_machine);m_list.SetItemText(nCount,4,m_tmp);m_vecTmp.Add(m_lineTmp);}
}BOOL CDataDlg::OnInitDialog()
{CDialog::OnInitDialog();this->SetWindowText(_T("插入数据对话框"));// TODO: Add extra initialization hereif(m_list.InsertColumn(0,_T("工序名"),LVCFMT_LEFT,100)&#61;&#61;-1){MessageBox("插入失败");}m_list.InsertColumn(1,_T("父节点"),LVCFMT_LEFT,100);m_list.InsertColumn(2,_T("儿子节点"),LVCFMT_LEFT,200);
// m_list.InsertColumn(3,_T("右子节点"),LVCFMT_LEFT,100);m_list.InsertColumn(3,_T("所用时间"),LVCFMT_LEFT,100);m_list.InsertColumn(4,_T("所用机器"),LVCFMT_LEFT,100);int nCount &#61; m_list.GetItemCount();for(int i&#61;0;i}void CDataDlg::OnDataSave2()
{// TODO: Add your control notification handler code herefor(int m&#61;0;mDestroyWindow();
}void CDataDlg::OnCancle()
{// TODO: Add your control notification handler code hereEndDialog(IDCANCEL);
}void CDataDlg::OnOK()
{// TODO: Add extra validation hereListStructTrue tmp;for(int m&#61;0;m}void CDataDlg::OnDelete()
{// TODO: Add your control notification handler code hereint nCount &#61;m_list.GetItemCount()-1;for(int i&#61;nCount;i>&#61;0;i--){if(m_list.GetItemState(i,LVIS_SELECTED) &#61;&#61; LVIS_SELECTED){m_list.DeleteItem(i);if(i<&#61;(m_vecTotal.GetSize()-1)){m_vecTotal.RemoveAt(i);m_vecTotalTrue.RemoveAt(i);}else{int test&#61; m_vecTmp.GetSize();test&#61; i-m_vecTotal.GetSize();m_vecTmp.RemoveAt(test);}}}
}void CDataDlg::TravelTree( ListStructTrue *root)
{//注释是2叉遍历
// if(root)
// {
// root->m_flags&#61;TRUE;
//
// TravelTree(root->m_leftchild);
// TravelTree(root->m_rightchild);
// }//遍历n叉树
/* queue queue ;queue.push((TreeNode*)this);TreeNode *p &#61; NULL;while (!queue.empty()){p &#61; queue.front();queue.pop();cout<<"treenode is: "<getSelfId()<getChildList()){list::iterator it &#61; (p->getChildList())->begin();while(it!&#61; (p->getChildList())->end()){queue.push((*it));&#43;&#43;it;}}}
*/CList Travel;Travel.AddHead(root);ListStructTrue* p&#61;NULL;while(Travel.GetCount()){p&#61;Travel.GetHead();p->m_flags&#61;TRUE;if(p->m_childAddress.GetCount()){for(int i&#61;0;i<(p->m_childAddress.GetCount());i&#43;&#43;){Travel.AddTail(p->m_childAddress.GetAt(p->m_childAddress.FindIndex(i)));}}Travel.RemoveHead();}
}ListStructTrue * CDataDlg::FindParent(CString name)
{if(name !&#61;""){for(int i&#61;0; i }ListStructTrue * CDataDlg::FindLeftChild(CString name)
{ if(name !&#61; ""){for(int i&#61;0; i }ListStructTrue * CDataDlg::FindRightChild(CString name)
{ if(name !&#61; ""){for(int i&#61;0; i }CString CDataDlg::SplitCString(CString &str, char split_char)
{str.TrimLeft();str.TrimRight();int index&#61;str.Find(split_char);if(index&#61;&#61;-1){return "";}else{CString tmp&#61; str.Left(index);str&#61;str.Right(str.GetLength()-index);return tmp;}
}// InsertDlg.cpp : implementation file
//#include "stdafx.h"
#include "BatchDis.h"
#include "InsertDlg.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] &#61; __FILE__;
#endif/
// CInsertDlg dialogCInsertDlg::CInsertDlg(CWnd* pParent /*&#61;NULL*/): CDialog(CInsertDlg::IDD, pParent)
{//{{AFX_DATA_INIT(CInsertDlg)m_name &#61; _T("");m_parent &#61; _T("");m_usedtime &#61; 0;m_machine &#61; 0;m_child &#61; _T("");//}}AFX_DATA_INIT
}void CInsertDlg::DoDataExchange(CDataExchange* pDX)
{CDialog::DoDataExchange(pDX);//{{AFX_DATA_MAP(CInsertDlg)DDX_Text(pDX, IDC_EDIT1, m_name);DDX_Text(pDX, IDC_EDIT2, m_parent);DDX_Text(pDX, IDC_EDIT5, m_usedtime);DDX_Text(pDX, IDC_EDIT6, m_machine);DDV_MinMaxUInt(pDX, m_machine, 1, 8);DDX_Text(pDX, IDC_EDIT3, m_child);//}}AFX_DATA_MAP
}BEGIN_MESSAGE_MAP(CInsertDlg, CDialog)//{{AFX_MSG_MAP(CInsertDlg)//}}AFX_MSG_MAP
END_MESSAGE_MAP()/
// CInsertDlg message handlersvoid CInsertDlg::OnOK()
{// TODO: Add extra validation hereCString name;CString usedtime;CString machine;this->GetDlgItem(IDC_EDIT1)->GetWindowText(name);this->GetDlgItem(IDC_EDIT5)->GetWindowText(usedtime);this->GetDlgItem(IDC_EDIT6)->GetWindowText(machine);if(name.IsEmpty()){MessageBox("工序名称不能为空");return;}if(usedtime&#61;&#61;"0"){MessageBox("所用时间不能为0");return;}if(!machine){MessageBox("所使用的机器编号不能为0");return;}CDialog::OnOK();
}BOOL CInsertDlg::OnInitDialog()
{CDialog::OnInitDialog();// TODO: Add extra initialization herethis->SetWindowText(_T("插入一条数据"));return TRUE; // return TRUE unless you set the focus to a control// EXCEPTION: OCX Property Pages should return FALSE
}// ShowDlg.cpp : implementation file
//#include "stdafx.h"
#include "BatchDis.h"
#include "ShowDlg.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] &#61; __FILE__;
#endif/
// CShowDlg dialogCShowDlg::CShowDlg(CWnd* pParent /*&#61;NULL*/): CDialog(CShowDlg::IDD, pParent)
{//{{AFX_DATA_INIT(CShowDlg)// NOTE: the ClassWizard will add member initialization here//}}AFX_DATA_INIT
}void CShowDlg::DoDataExchange(CDataExchange* pDX)
{CDialog::DoDataExchange(pDX);//{{AFX_DATA_MAP(CShowDlg)// NOTE: the ClassWizard will add DDX and DDV calls here//}}AFX_DATA_MAP
}BEGIN_MESSAGE_MAP(CShowDlg, CDialog)//{{AFX_MSG_MAP(CShowDlg)//}}AFX_MSG_MAP
END_MESSAGE_MAP()/
// CShowDlg message handlersBOOL CShowDlg::OnInitDialog()
{CDialog::OnInitDialog();// TODO: Add extra initialization herethis->SetWindowText(_T("软件使用说明"));GetDlgItem(IDC_EDIT2)->SetWindowText(" 软件说明 \n 软件仅仅支持二叉树&#xff0c;即&#xff1a;加工树的度最多为2 。数据\n 输入后进行树的遍历&#xff0c;可以对用户输入的数据进行验证\n\n 软件所用算法&#xff1a;\n 把加工树的叶子节点截取下来&#xff0c;根据该节点所用机器编号加入到相对应的链表中&#xff0c;之后再遍历所用的链表时间&#xff0c;看哪个时间最短&#xff0c;之后处理时间最短的链表中数据&#xff0c;如果链表中没数据的话&#xff0c;就在比较时间找第二小的&#xff0c;以此类推&#xff0c;进行处理&#xff0c;直到链表和树中的数据处理完之后&#xff0c;进行算法演示");return TRUE; // return TRUE unless you set the focus to a control// EXCEPTION: OCX Property Pages should return FALSE
}
皮肤文件#ifndef _SKINPPWTL_H_
#define _SKINPPWTL_H_#ifdef _SKINPP_STATIC#define SKINPPWTL_API
#else#ifdef SKINPPWTL_EXPORTS#define SKINPPWTL_API __declspec(dllexport)#else#define SKINPPWTL_API __declspec(dllimport)#endif
#endif#define WM_TOOLBARPAINTPRE (WM_USER &#43; 802)
#define WM_TOOLBARPAINTEND (WM_USER &#43; 803)#define SM_LBUTTONUP (WM_USER &#43; 804)//按钮状态
enum BUTTONSTATE
{NORMAL &#61; 0,PRESS &#61; 1,DISABLE &#61; 2,HOT &#61; 3,FOCUS &#61; 4,LAST &#61; 5
};//绘制类型
enum DRAWTYPE
{BUTTON &#61; 0,SCROLLARROWUP &#61; 1,SCROLLARROWDOWN &#61; 2,SPLITTERBARHORZ &#61; 3,SPLITTERBARVERT &#61; 4,SPLITTERBARBORDER &#61; 5,LISTHEAD &#61; 6
};//获得皮肤资源的类型
enum SKINOBJTYPE
{DIALOGTYPE &#61; 0,BUTTONTYPE &#61; 1,CHECKBOXTYPE &#61; 2,RADIOBOXTYPE &#61; 3,STATICTYPE &#61; 4,TRACKBARTYPE &#61; 5,
};struct ListBoxItem
{HIMAGELIST hImageList;int nImageIndex;ListBoxItem(){hImageList &#61; NULL;nImageIndex &#61; -1;}
};#define REST_BITMAP 0x0001 //.bmp
#define REST_ICON 0x0002 //.ico
#define REST_CURSOR 0x0003 //.cur
#define REST_ANIMATE 0x0004 //.anitypedef struct _ResourceInfo
{HGDIOBJ hGdiObj;//[OUT]DWORD dwType; //[OUT]int nWidth; //[OUT]int nHeight;//[OUT]TCHAR szResImageName[_MAX_FNAME];//[IN]BOOL bHorzSplit;//[IN]int nLength;//[IN]int nCount; //[IN]int nIndex; //[IN]_ResourceInfo(){hGdiObj &#61; NULL;dwType &#61; REST_BITMAP;nWidth &#61; 0;nHeight &#61; 0;_tcscpy(szResImageName,_T(""));bHorzSplit &#61; TRUE;nLength &#61; -1;nCount &#61; -1;nIndex &#61; -1;}}ResInfo,* PRESINFO;////加载皮肤
//SkinFile :皮肤路径,注意可以是*.ssk,也可以是皮肤目录中的INI文件.
//bFromIni :该参数指定皮肤文件是从*.ssk读取,还是从INI文件读取.
SKINPPWTL_API BOOL skinppLoadSkin(TCHAR* szSkinFile,BOOL bFromIni &#61; FALSE);SKINPPWTL_API BOOL skinppLoadSkinFromRes(HINSTANCE hInstance,LPCTSTR szResourceName,LPCTSTR szResourceType,TCHAR* szSkinFileName);//移除皮肤
SKINPPWTL_API BOOL skinppRemoveSkin();//退出界面库&#xff0c;做清理工作。
SKINPPWTL_API BOOL skinppExitSkin();//设置ListBox控件的自画信息
//hWnd : ListBox控件的句柄
//nIndex : Item项的索引
//pListBoxItem : Item项自画的结构信息
SKINPPWTL_API void skinppSetListBoxItemDrawInfo(HWND hWnd,int nIndex,struct ListBoxItem* pListBoxItem);//获得换肤后的系统颜色
//nColorIndex : 要获取的颜色类型
SKINPPWTL_API COLORREF skinppGetSkinSysColor(int nColorIndex);//获得Windows系统默认的颜色
//nColorIndex : 要获取的颜色类型
SKINPPWTL_API COLORREF skinppGetDefaultSysColor(int nColorIndex);//hWnd : 对话框窗口的句柄
//nResID : 对话框资源ID
SKINPPWTL_API BOOL skinppSetWindowResID(HWND hWnd,int nResID);//[多语言]SKINPPWTL_API BOOL skinppSetFreeDlgID(HWND hWnd,int nResID);SKINPPWTL_API BOOL skinppSetSkinResID(HWND hWnd,int nResID);//设置ListHeader窗口的排序信息
//hWnd : ListHeader的窗口句柄
//nSortColumn : 要对ListHeader排序的列的索引
//bSortAscending: 是否为升序
SKINPPWTL_API void skinppSetListHeaderSortInfo(HWND hWnd,int nSortColumn,BOOL bSortAscending &#61; TRUE);//在给定的HDC上,指定相应的绘制类型和状态,在相应的矩形区域中进行绘制.
//hdc :目标DC
//rect :绘制区域
//eDrawType :绘制类型&#xff0c;目前支持SPLITTERBARHORZ,SPLITTERBARVERT,SPLITTERBARBORDER
//nState :选择绘制状态
SKINPPWTL_API void skinppDrawSkinObject(HDC hdc,RECT rect,DRAWTYPE eDrawType,int nState);//通过资源ID,获得相应类型的皮肤资源位图句柄
//nSkinObjType : 皮肤类型,目前支持 DIALOGTYPE,BUTTONTYPE,CHECKBOXTYPE,RADIOBOXTYPE
//nResID : 资源ID
//nState : 状态,对BUTTONTYPE,CHECKBOXTYPE,RADIOBOXTYPE有效
SKINPPWTL_API HBITMAP skinppGetResFromID(SKINOBJTYPE nSkinObjType,int nResID,int nState &#61;0 );//设置是否自己画对话框背景,该方法用在需要自己对背景进行处理的情况下.
//hWnd : 对话框的句柄
//bErase : TRUE 为自己画背景,FALSE 为Skin&#43;&#43;画,如果没有调用该方法,Skin&#43;&#43;将画对话框背景.
SKINPPWTL_API void skinppSetDialogEraseBkgnd(HWND hWnd,BOOL bErase);//设置对话框背景是否剪切子控件区域。
//hWnd : 对话框句柄
//bNoClip : TRUE为不需要剪切,FALSE为需要剪切区域
//bAllChild : TRUE为该窗体的所有子对话框都剪切.
SKINPPWTL_API void skinppSetDialogBkClipRgn(HWND hWnd,BOOL bClip,BOOL bAllChild &#61; TRUE);//通过皮肤资源名称获得皮肤资源中位图
//szName : 皮肤资源名称
//HBITMAP : 返回资源中的位图
SKINPPWTL_API HBITMAP skinppGetBitmapRes(LPCTSTR szName);//通过资源名称取资源的内存指针
//szName : 资源名称
//nSize : 资源大小
//pByte : 返回值&#xff0c;成功返回非NULL&#xff0c;失败返回NULL
SKINPPWTL_API BYTE* skinppGetSkinResource(LPCTSTR szName,int& nSize);//通过皮肤资源的名称获得位图不被拉伸的区域值
//szName : 皮肤资源名称
//nTopHeight : 返回不被拉伸的顶高
//nBottomHeight : 返回不被拉伸的底高
//nLeftWidth : 返回不被拉伸的左宽
//nRightWidth : 返回不被拉伸的右宽
SKINPPWTL_API BOOL skinppGetBitmapResRect(LPCTSTR szName,int& nTopHeight,int& nBottomHeight,int& nLeftWidth,int& nRightWidth);//设置窗口自画是否自己来处理,该方法用于自画部分需要自己处理的情况下
//hWnd : 要自画的窗口句柄
//bCustomDraw : TRUE为自己处理自画,FALSE为交给Skin&#43;&#43;处理自画
SKINPPWTL_API void skinppSetCustomDraw(HWND hWnd,BOOL bCustomDraw);//设置菜单的皮肤标识
//hWnd : 拥有菜单的窗口句柄
//nSkinObjectID : 菜单皮肤的标识
SKINPPWTL_API void skinppSetMenuSkinObjectID(HWND hWnd,int nSkinObjectID);//设置是否对自画菜单进行换肤
//bSkin : TRUE为换肤
SKINPPWTL_API void skinppSetSkinOwnerMenu(BOOL bSkin);//对菜单进行换肤控制
//hMenu : 想换肤的菜单句柄
//bNoSkin : 是否换肤,TRUE为不换肤,FALSE为换肤
SKINPPWTL_API void skinppSetDrawMenu(HMENU hMenu,BOOL bNoSkin);//对指定的窗口去掉皮肤,并且保证不会再被换肤,即使使用SetSkinHwnd也不会换肤.
//hWnd : 指定的窗口句柄
//bChildNoSkin : 是否对该窗口中的子窗口去掉皮肤
SKINPPWTL_API void skinppSetNoSkinHwnd(HWND hWnd,BOOL bChildNoSkin &#61; TRUE);//对指定的窗口进行换肤
//hWnd : 指定的窗口句柄
//szClassName : 要子类化的Skin类型 WC_DIALOGBOX/WC_CONTROLBAR等
SKINPPWTL_API void skinppSetSkinHwnd(HWND hWnd,LPCTSTR szClassName &#61; NULL);//对指定的窗口临时去掉皮肤,可以通过SetSkinHwnd进行再次换肤
SKINPPWTL_API void skinppRemoveSkinHwnd(HWND hWnd);//是对SetNoSkinHwnd的进一步处理,可以解决使用SetNoSkinHwnd引起的Debug版的断言错
#define SETNOSKINHWND(x) {\HWND w&#61;(x).UnsubclassWindow();\skinppSetNoSkinHwnd(w);\(x).SubclassWindow(w);\
} //是对RemoveSkinHwnd的进一步处理,可以解决使用RemoveSkinHwnd引起的Debug版的断言错
#define REMOVESKINHWND(x){\HWND w&#61;(x).UnsubclassWindow();\skinppRemoveSkinHwnd(w);\(x).SubclassWindow(w);\
}SKINPPWTL_API HGDIOBJ skinppGetResFromID(PRESINFO pResInfo);#endif //_SKINPPWTL_H_







推荐阅读
  • Echarts图表重复加载、axis重复多次请求问题解决记录
    文章目录1.需求描述2.问题描述正常状态:问题状态:3.解决方法1.需求描述使用Echats实现了一个中国地图:通过选择查询周期&#x ... [详细]
  • 本文介绍了设计师伊振华受邀参与沈阳市智慧城市运行管理中心项目的整体设计,并以数字赋能和创新驱动高质量发展的理念,建设了集成、智慧、高效的一体化城市综合管理平台,促进了城市的数字化转型。该中心被称为当代城市的智能心脏,为沈阳市的智慧城市建设做出了重要贡献。 ... [详细]
  • Python正则表达式学习记录及常用方法
    本文记录了学习Python正则表达式的过程,介绍了re模块的常用方法re.search,并解释了rawstring的作用。正则表达式是一种方便检查字符串匹配模式的工具,通过本文的学习可以掌握Python中使用正则表达式的基本方法。 ... [详细]
  • 本文介绍了游标的使用方法,并以一个水果供应商数据库为例进行了说明。首先创建了一个名为fruits的表,包含了水果的id、供应商id、名称和价格等字段。然后使用游标查询了水果的名称和价格,并将结果输出。最后对游标进行了关闭操作。通过本文可以了解到游标在数据库操作中的应用。 ... [详细]
  • CF:3D City Model(小思维)问题解析和代码实现
    本文通过解析CF:3D City Model问题,介绍了问题的背景和要求,并给出了相应的代码实现。该问题涉及到在一个矩形的网格上建造城市的情景,每个网格单元可以作为建筑的基础,建筑由多个立方体叠加而成。文章详细讲解了问题的解决思路,并给出了相应的代码实现供读者参考。 ... [详细]
  • 欢乐的票圈重构之旅——RecyclerView的头尾布局增加
    项目重构的Git地址:https:github.comrazerdpFriendCircletreemain-dev项目同步更新的文集:http:www.jianshu.comno ... [详细]
  • CSS3选择器的使用方法详解,提高Web开发效率和精准度
    本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ... [详细]
  • 本文介绍了九度OnlineJudge中的1002题目“Grading”的解决方法。该题目要求设计一个公平的评分过程,将每个考题分配给3个独立的专家,如果他们的评分不一致,则需要请一位裁判做出最终决定。文章详细描述了评分规则,并给出了解决该问题的程序。 ... [详细]
  • 本文讨论了使用差分约束系统求解House Man跳跃问题的思路与方法。给定一组不同高度,要求从最低点跳跃到最高点,每次跳跃的距离不超过D,并且不能改变给定的顺序。通过建立差分约束系统,将问题转化为图的建立和查询距离的问题。文章详细介绍了建立约束条件的方法,并使用SPFA算法判环并输出结果。同时还讨论了建边方向和跳跃顺序的关系。 ... [详细]
  • sklearn数据集库中的常用数据集类型介绍
    本文介绍了sklearn数据集库中常用的数据集类型,包括玩具数据集和样本生成器。其中详细介绍了波士顿房价数据集,包含了波士顿506处房屋的13种不同特征以及房屋价格,适用于回归任务。 ... [详细]
  • 本文介绍了三种方法来实现在Win7系统中显示桌面的快捷方式,包括使用任务栏快速启动栏、运行命令和自己创建快捷方式的方法。具体操作步骤详细说明,并提供了保存图标的路径,方便以后使用。 ... [详细]
  • 本文介绍了iOS数据库Sqlite的SQL语句分类和常见约束关键字。SQL语句分为DDL、DML和DQL三种类型,其中DDL语句用于定义、删除和修改数据表,关键字包括create、drop和alter。常见约束关键字包括if not exists、if exists、primary key、autoincrement、not null和default。此外,还介绍了常见的数据库数据类型,包括integer、text和real。 ... [详细]
  • 本文介绍了在处理不规则数据时如何使用Python自动提取文本中的时间日期,包括使用dateutil.parser模块统一日期字符串格式和使用datefinder模块提取日期。同时,还介绍了一段使用正则表达式的代码,可以支持中文日期和一些特殊的时间识别,例如'2012年12月12日'、'3小时前'、'在2012/12/13哈哈'等。 ... [详细]
  • 本文介绍了在iOS开发中使用UITextField实现字符限制的方法,包括利用代理方法和使用BNTextField-Limit库的实现策略。通过这些方法,开发者可以方便地限制UITextField的字符个数和输入规则。 ... [详细]
  • Whatsthedifferencebetweento_aandto_ary?to_a和to_ary有什么区别? ... [详细]
author-avatar
我心飞翔
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有