大家好我在vc ++中有一个代码,有兴趣的人请尽快回复我................... !!!!! [英] Hi guys I'm having a code here in vc++ for who have interested please reply me as fast you can...................!!!!!

查看:84
本文介绍了大家好我在vc ++中有一个代码,有兴趣的人请尽快回复我................... !!!!!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这里,代码我会告诉我这里发生了什么关于该图表上的甘特图,当我选择一个批次并移动它时有批次。日期将改变它发生在这里很好,它发生在空旷的地区。我的问题是,当我将批次移动到批次集合时,批次集必须给予新移动的批次,即批次日期必须相应地改变,但这不会发生在这里。请告诉我该怎么办我已经卡在这里......... !!

Here, is the code i will tell what is happening here this about gantt chart on that chart there is batches when i'm selecting a batch and moving it. the dates will change it is happening here thats fine and it is happening in empty area. what my problem is that when i'm moving the batch into set of batches the set of batches have to give place to the newly moving batch i.e., set of batches date has to change accordingly but it is not happening here. pls tell me what to do i have stuck here.........!!

void CGanttChartView::OnControlclickActiveganttvcctl1(LPDISPATCH e)
{
	// TODO: Add your message handler code here
	int Index;
	CclsTask oTask;
	CString strBatchCode, m_strRecDelID;;
	CMouseEventArgs oE(e);
	CPoint right;
	right.x = oE.GetX();
	right.y = oE.GetY();
	CRecordset ganttChartRecordSet;

	
	if (oE.GetEventTarget() == EVT_TASK||oE.GetEventTarget() == EVT_SELECTEDTASK) {
      Index = ActiveGanttVCCtl1.GetMathLib().GetTaskIndexByPosition(oE.GetX(), oE.GetY());
		if (Index < 1)
		{
			return;
        }
		oTask= ActiveGanttVCCtl1.GetTasks().Item(CStr(Index));
		//
		//oTask1=oTask;

		//oTask1=ActiveGanttVCCtl1.GetTasks().Item(CStr(Index));
		strBatchCode=oTask.GetText();
		//HighlightSelectedBatch(ganttChartRecordSet,strBatchCode);
		//StoreGanttNode();

		// Store the batch information into a structure
		
		sRowKey = oTask.GetRowKey();

		m_dtStartDate.CreateDispatch(_T("AGVC.DateTime"));
		m_dtEndDate.CreateDispatch(_T("AGVC.DateTime"));

		sbatchNode.dtStartDate = oTask.GetStartDate();
		sbatchNode.dtEndDate = oTask.GetEndDate();
		m_dtStartDate=oTask.GetStartDate();
		m_dtEndDate=oTask.GetEndDate();

		m_sStDate=m_dtStartDate.ToString(_T("MM/dd/yy HH:mm"));
		m_sEndDate=m_dtEndDate.ToString(_T("MM/dd/yy HH:mm"));
		sbatchNode.sStartDate = sbatchNode.dtStartDate.ToString(_T("MM/dd/yyyy HH:mm:ss"));
		sbatchNode.sEndDate =sbatchNode.dtEndDate.ToString(_T("MM/dd/yyyy HH:mm:ss"));
		
			CString sTaskKey = oTask.GetKey();

			CString csRowNo;
			csRowNo.Format(_T("%c"),sRowKey.GetAt(1));
			CRecordset		ganttRecordSet(&theApp.data);
			if (theApp.m_pGeneric->OpenRecordSet(&ganttRecordSet, GetSQLStatement(GANTT_CHART_DELIVERY_TYPE,CRecordset::readOnly,csRowNo) ))
	
			ganttRecordSet.GetFieldValue((short)0, csRecDelType);
			ganttRecordSet.GetFieldValue((short)1, m_sLocationId);
			ganttRecordSet.GetFieldValue((short)2,m_sRecDelId);

			ganttRecordSet.Close();
	
		m_strRecDelID.LoadStringA(IDS_CALCTYPE);
		

		m_mapBatchFlow.Lookup(sTaskKey, SBatchFlowRec);
		//CString csDuration=SBatchFlowRec->strDuration;
		sbatchNode.strBatchCode= SBatchFlowRec->strBatch_Desc;
		sbatchNode.strRate=m_sSimRate=SBatchFlowRec->strRate;
		sbatchNode.strVolume=m_sVolume=SBatchFlowRec->strVolume_In_Barrels;
		sbatchNode.strDuration=m_sDuration=SBatchFlowRec->strDuration;
		sbatchNode.strProduct=SBatchFlowRec->strProduct;

		sbatchNode.dtStartDate.ReleaseDispatch();
		sbatchNode.dtEndDate.ReleaseDispatch();
		m_dtStartDate.ReleaseDispatch();
		m_dtEndDate.ReleaseDispatch();
		m_startDateTime=sbatchNode.sStartDate;
		m_completeDateTime=sbatchNode.sEndDate;
		//CRecordset	ganttRecordSet(&theApp.data);
		//ganttRecordSet.Open(CRecordset::forwardOnly,GetSQLStatement(HIGHLIGHT_SELECTED_BATCH,ACTIVE,strBatch,EQUAL), CRecordset::readOnly);
		//if(!ganttRecordSet.IsOpen())
		ganttRecordSet.Open(CRecordset::forwardOnly,GetSQLStatement(GET_PRM_ID,ACTIVE,sbatchNode.strBatchCode),CRecordset::readOnly);
		ganttRecordSet.GetFieldValue((short)0, nPrmId);
		m_sID=nPrmId;
		sbatchNode.strPrmBatchID=nPrmId;
		
		ganttRecordSet.GetFieldValue((short)1, nSecId);
		sbatchNode.strSecBatchID=nSecId;
		ganttRecordSet.Close();
		
	}
	if((oE.GetButton() == BTN_RIGHT) && !(csRecDelType == m_strRecDelID) && (oE.GetEventTarget() == EVT_TASK||oE.GetEventTarget() == EVT_SELECTEDTASK))
	{
			CMenu mnuPopupSubmit;
			mnuPopupSubmit.LoadMenu(IDR_MENU1);
	
			CMenu *mnuPopupMenu = mnuPopupSubmit.GetSubMenu(0);
			ASSERT(mnuPopupMenu);
	
			ClientToScreen(&right);
			//ScreenToClient(&right);
			mnuPopupMenu->TrackPopupMenu( TPM_LEFTALIGN, right.x, right.y, this);
			//MessageBox("right");
	}
	
}

推荐答案

如果您想获得答案,您需要更具体地了解您的要求。

从第一眼看,我看到函数中有太多的代码行。

我建议将这个函数分解为几个具有逻辑意义的小函数。

另外,你说我正在移动批次是什么意思?

申请表中的批处理是什么?
You need to be more specific on what you ask if you like to get answers.
From first look I see that the function has too many lines of code in it.
I would suggest breaking this function to several smaller functions with logical meaning.
Also, what do you mean by saying "i'm moving the batch"?
What is a batch in your application?


这篇关于大家好我在vc ++中有一个代码,有兴趣的人请尽快回复我................... !!!!!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆