📄 fms_simulationdoc.cpp
字号:
// FMS_SIMULATIONDoc.cpp : implementation of the CFMS_SIMULATIONDoc class
//
#include "stdafx.h"
#include "FMS_SIMULATION.h"
#include "FMS_SIMULATIONDoc.h"
#include "FMS_SIMULATIONView.h"
#include "NewTask.h"
#include "FMS.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern int task_inall;
extern int doc_flag;
/////////////////////////////////////////////////////////////////////////////
// CFMS_SIMULATIONDoc
IMPLEMENT_DYNCREATE(CFMS_SIMULATIONDoc, CDocument)
BEGIN_MESSAGE_MAP(CFMS_SIMULATIONDoc, CDocument)
//{{AFX_MSG_MAP(CFMS_SIMULATIONDoc)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFMS_SIMULATIONDoc construction/destruction
CFMS_SIMULATIONDoc::CFMS_SIMULATIONDoc()
{
// TODO: add one-time construction code here
}
CFMS_SIMULATIONDoc::~CFMS_SIMULATIONDoc()
{
}
BOOL CFMS_SIMULATIONDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CFMS_SIMULATIONDoc serialization
void CFMS_SIMULATIONDoc::Serialize(CArchive& ar)
{
// CFMS_SIMULATIONView *pView;
CFile *myfile;
myfile=ar.GetFile();
int i,j;
char name[50];
if (ar.IsStoring())
{
// TODO: add storing code here
myfile->Flush();
for(i=0;plan[i].amount>0;i++)
{
sprintf(name,"%d %d %d ",plan[i].amount,plan[i].priority,plan[i].time);
myfile->Write(name,strlen(name));
for(j=1;atoi(plan[i].working_procedure[j])>0;j++)
{
myfile->Write(plan[i].working_procedure[j],strlen(plan[i].working_procedure[j]));
myfile->Write(" ",1);
}
myfile->Write("-1 ",3);
}
}
else
{
// TODO: add loading code here
task_inall=0;
FILE *fp;
CString file_path;
file_path=myfile->GetFilePath();
int d=0;
if((fp=fopen(file_path,"r"))!=NULL)
{
for(i=0;!feof(fp);i++)
{
task_inall++;
fscanf(fp,"%d",&plan[i].amount);
fscanf(fp,"%d",&plan[i].priority);
fscanf(fp,"%d",&plan[i].time);
fscanf(fp,"%d",&d);
for(j=1;d>=0;j++)
{
sprintf(plan[i].working_procedure[j],"%d",d);
fscanf(fp,"%d",&d);
}
}
task_inall--;
doc_flag=1;
UpdateAllViews(NULL);
fclose(fp);
}
else
AfxMessageBox("Can not open the specified file!");
}
}
/////////////////////////////////////////////////////////////////////////////
// CFMS_SIMULATIONDoc diagnostics
#ifdef _DEBUG
void CFMS_SIMULATIONDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CFMS_SIMULATIONDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CFMS_SIMULATIONDoc commands
void CFMS_SIMULATIONDoc::SetTitle(LPCTSTR lpszTitle)
{
// TODO: Add your specialized code here and/or call the base class
lpszTitle="liyanbing_s0705307";
CDocument::SetTitle(lpszTitle);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -