#include "vst_work_transfer.h"
#include "vsm_thread.h"
#include "logic.h"
VST_Work_Transfer::VST_Work_Transfer(int iID, const QString &sName,
                                     VSM_Thread *pParent,
                                     VS_Thread *pPreState,
                                     VS_Thread *pNextState)
    :VST_Work_Base(iID,sName,pParent,pPreState,pNextState)
{

}

//仅提供单步流程
void VST_Work_Transfer::do_Msg(const V_Msg &msg)
{
    switch(msg.m_iID)
    {
    case VarMsg_Transfer_Step :
    {
        if(!m_pNextState)
        {
            CProcess_Trans* processTrans = GET_PROCESS(PROCESS_TRANS, SM_TRANS, CProcess_Trans);
            QString sStateName = processTrans->GetMsgName(msg.m_vlInput[0].toInt());
            bool bIsAuto = msg.m_vlInput[1].toBool();
            m_pNextState= new VST_Work_Transfer(VarState_Transfer_Count_ID,
                                                sStateName/*QObject::trUtf8("Transfer Wafer")*/, m_pParent,
                                                this,0);
            for(int i=0;i<300;i++)
            {
                ((VST_Work_Transfer*)m_pNextState)->m_VarMsgProcess.
                        pushback_Msg(VarMsg_Process_ID,
                                     msg.m_sName,
                                     QVariantList()<<PROCESS_TRANS
                                     <<msg.m_vlInput[0]<< i << bIsAuto);
            }
            ((VST_Work_Transfer*)m_pNextState)->LoadMsgProcess();
        }
        m_pParent->SetState(m_pNextState);
    }
        break;
    }
    VST_Work_Base::do_Msg(msg);

}

