#include "stdafx.h" #include "CJobDataS.h" #include "ToolUnits.h" namespace SERVO { CJobDataS::CJobDataS() { m_nCassetteSequenceNo = 0; m_nJobSequenceNo = 0; m_nJobType = 0; m_nMaterialsType = 0; m_nProductType = 0; m_nDummyType = 0; m_nSkipFlag = 0; m_nProcessFlag = 0; m_nProcessResonCode = 0; m_nLastGlassFlag = 0; m_nFirstGlassFlag = 0; m_nQTime[3] = {0}; m_nQTimeOverFlag = 0; m_nMasterRecipe = 0; m_nMode = 0; m_nSlotUnitSelectFlag = 0; m_nSourcePortNo = 0; m_nSourceSlotNo = 0; m_nTargetPortNo = 0; m_nTargetSlotNo = 0; } CJobDataS::~CJobDataS() { } int CJobDataS::getCassetteSequenceNo() { return m_nCassetteSequenceNo; } void CJobDataS::setCassetteSequenceNo(int no) { m_nCassetteSequenceNo = no; } int CJobDataS::getJobSequenceNo() { return m_nJobSequenceNo; } void CJobDataS::setJobSequenceNo(int no) { m_nJobSequenceNo = no; } std::string& CJobDataS::getLotId() { return m_strLotId; } void CJobDataS::setLotId(const char* pszId) { m_strLotId = pszId; } std::string& CJobDataS::getProductId() { return m_strProductId; } void CJobDataS::setProductId(const char* pszId) { m_strProductId = pszId; } std::string& CJobDataS::getOperationId() { return m_strOperationId; } void CJobDataS::setOperationId(const char* pszId) { m_strOperationId = pszId; } std::string& CJobDataS::getGlass1Id() { return m_strGlass1Id; } void CJobDataS::setGlass1Id(const char* pszId) { m_strGlass1Id = pszId; } std::string& CJobDataS::getGlass2Id() { return m_strGlass2Id; } void CJobDataS::setGlass2Id(const char* pszId) { m_strGlass2Id = pszId; } int CJobDataS::getJobType() { return m_nJobType; } void CJobDataS::setJobType(int type) { m_nJobType = type; } int CJobDataS::getMaterialsType() { return m_nMaterialsType; } void CJobDataS::setMaterialsType(int type) { m_nMaterialsType = type; } int CJobDataS::getProductType() { return m_nProductType; } void CJobDataS::setProductType(int type) { m_nProductType = type; } int CJobDataS::getDummyType() { return m_nDummyType; } void CJobDataS::setDummyType(int type) { m_nDummyType = type; } int CJobDataS::getSkipFlag() { return m_nSkipFlag; } void CJobDataS::setSkipFlag(int flag) { m_nSkipFlag = flag; } int CJobDataS::getProcessFlag() { return m_nProcessFlag; } void CJobDataS::setProcessFlag(int flag) { m_nProcessFlag = flag; } int CJobDataS::getProcessResonCode() { return m_nProcessResonCode; } void CJobDataS::setProcessResonCode(int code) { m_nProcessResonCode = code; } int CJobDataS::getLastGlassFlag() { return m_nLastGlassFlag; } void CJobDataS::setLastGlassFlag(int flag) { m_nLastGlassFlag = flag; } int CJobDataS::getFirstGlassFlag() { return m_nFirstGlassFlag; } void CJobDataS::setFirstGlassFlag(int flag) { m_nFirstGlassFlag = flag; } int CJobDataS::getQTime(int index) { if (0 <= index && index <= 2) { return m_nQTime[index]; } return 0; } void CJobDataS::setQTime(int index, int time) { if (0 <= index && index <= 2) { m_nQTime[index] = time; } } int CJobDataS::getQTimeOverFlag() { return m_nQTimeOverFlag; } void CJobDataS::setQTimeOverFlag(int flag) { m_nQTimeOverFlag = flag; } int CJobDataS::getMasterRecipe() { return m_nMasterRecipe; } void CJobDataS::setMasterRecipe(int recipe) { m_nMasterRecipe = recipe; } std::string& CJobDataS::getProductRecipeId() { return m_strProductRecipeId; } void CJobDataS::setProductRecipeId(const char* pszId) { m_strProductRecipeId = pszId; } std::string& CJobDataS::getPCode() { return m_strPCode; } void CJobDataS::setPCode(const char* pszCode) { m_strPCode = pszCode; } std::string& CJobDataS::getUseType() { return m_strPCode; } void CJobDataS::setUseType(const char* pszType) { m_strPCode = pszType; } std::string& CJobDataS::getPanelMeasure() { return m_strPanelMeasure; } void CJobDataS::setPanelMeasure(const char* pszMeasure) { m_strPanelMeasure = pszMeasure; } int CJobDataS::getMode() { return m_nMode; } void CJobDataS::setMode(int mode) { m_nMode = mode; } int CJobDataS::getSlotUnitSelectFlag() { return m_nSlotUnitSelectFlag; } void CJobDataS::setSlotUnitSelectFlag(int flag) { m_nSlotUnitSelectFlag = flag; } int CJobDataS::getSourcePortNo() { return m_nSourcePortNo; } void CJobDataS::setSourcePortNo(int no) { m_nSourcePortNo = no; } int CJobDataS::getSourceSlotNo() { return m_nSourceSlotNo; } void CJobDataS::setSourceSlotNo(int no) { m_nSourceSlotNo = no; } int CJobDataS::getTargetPortNo() { return m_nTargetPortNo; } void CJobDataS::setTargetPortNo(int no) { m_nTargetPortNo = no; } int CJobDataS::getTargetSlotNo() { return m_nTargetSlotNo; } void CJobDataS::setTargetSlotNo(int no) { m_nTargetSlotNo = no; } int CJobDataS::serialize(char* pszBuffer, int nBufferSize) { if (nBufferSize < 256 * 2) return -1; int index = 0; memcpy(&pszBuffer[index], &m_nCassetteSequenceNo, sizeof(short)); index += sizeof(short); memcpy(&pszBuffer[index], &m_nJobSequenceNo, sizeof(short)); index += sizeof(short); int strLen = min(40, m_strLotId.size()); memcpy(&pszBuffer[index], m_strLotId.c_str(), strLen); index += 40; strLen = min(20, m_strProductId.size()); memcpy(&pszBuffer[index], m_strProductId.c_str(), strLen); index += 20; strLen = min(20, m_strOperationId.size()); memcpy(&pszBuffer[index], m_strOperationId.c_str(), strLen); index += 20; strLen = min(20, m_strGlass1Id.size()); memcpy(&pszBuffer[index], m_strGlass1Id.c_str(), strLen); index += 20; strLen = min(20, m_strGlass2Id.size()); memcpy(&pszBuffer[index], m_strGlass2Id.c_str(), strLen); index += 20; memcpy(&pszBuffer[index], &m_nJobType, sizeof(short)); index += sizeof(short); memcpy(&pszBuffer[index], &m_nMaterialsType, sizeof(short)); index += sizeof(short); memcpy(&pszBuffer[index], &m_nProductType, sizeof(short)); index += sizeof(short); memcpy(&pszBuffer[index], &m_nDummyType, sizeof(short)); index += sizeof(short); memcpy(&pszBuffer[index], &m_nSkipFlag, sizeof(int)); index += sizeof(int); memcpy(&pszBuffer[index], &m_nProcessFlag, sizeof(int)); index += sizeof(int); memcpy(&pszBuffer[index], &m_nProcessResonCode, sizeof(short)); index += sizeof(short); memcpy(&pszBuffer[index], &m_nLastGlassFlag, sizeof(short)); index += sizeof(short); memcpy(&pszBuffer[index], &m_nFirstGlassFlag, sizeof(short)); index += sizeof(short); memcpy(&pszBuffer[index], &m_nLastGlassFlag, sizeof(short)); index += sizeof(short); memcpy(&pszBuffer[index], &m_nQTime[0], sizeof(short)); index += sizeof(short); memcpy(&pszBuffer[index], &m_nQTime[1], sizeof(short)); index += sizeof(short); memcpy(&pszBuffer[index], &m_nQTime[2], sizeof(short)); index += sizeof(short); memcpy(&pszBuffer[index], &m_nQTimeOverFlag, sizeof(short)); index += sizeof(short); memcpy(&pszBuffer[index], &m_nMasterRecipe, sizeof(short)); index += sizeof(short); strLen = min(10, m_strProductRecipeId.size()); memcpy(&pszBuffer[index], m_strProductRecipeId.c_str(), strLen); index += 10; strLen = min(10, m_strPCode.size()); memcpy(&pszBuffer[index], m_strPCode.c_str(), strLen); index += 10; strLen = min(10, m_strUseType.size()); memcpy(&pszBuffer[index], m_strUseType.c_str(), strLen); index += 10; strLen = min(80, m_strPanelMeasure.size()); memcpy(&pszBuffer[index], m_strPanelMeasure.c_str(), strLen); index += 80; memcpy(&pszBuffer[index], &m_nMode, sizeof(short)); index += sizeof(short); memcpy(&pszBuffer[index], &m_nSlotUnitSelectFlag, sizeof(short)); index += sizeof(short); memcpy(&pszBuffer[index], &m_nSourcePortNo, sizeof(short)); index += sizeof(short); memcpy(&pszBuffer[index], &m_nSourceSlotNo, sizeof(short)); index += sizeof(short); memcpy(&pszBuffer[index], &m_nTargetPortNo, sizeof(short)); index += sizeof(short); memcpy(&pszBuffer[index], &m_nTargetSlotNo, sizeof(short)); index += sizeof(short); return 256 * 2; } int CJobDataS::unserialize(const char* pszBuffer, int nBufferSize) { if (nBufferSize < 256 * 2) return -1; int index = 0; memcpy(&m_nCassetteSequenceNo, &pszBuffer[index], sizeof(short)); index += sizeof(short); memcpy(&m_nJobSequenceNo, &pszBuffer[index], sizeof(short)); index += sizeof(short); CToolUnits::convertString(&pszBuffer[index], 40, m_strLotId); index += 40; CToolUnits::convertString(&pszBuffer[index], 20, m_strProductId); index += 20; CToolUnits::convertString(&pszBuffer[index], 20, m_strOperationId); index += 20; CToolUnits::convertString(&pszBuffer[index], 20, m_strGlass1Id); index += 20; CToolUnits::convertString(&pszBuffer[index], 20, m_strGlass2Id); index += 20; memcpy(&m_nJobType, &pszBuffer[index], sizeof(short)); index += sizeof(short); memcpy(&m_nMaterialsType, &pszBuffer[index], sizeof(short)); index += sizeof(short); memcpy(&m_nProductType, &pszBuffer[index], sizeof(short)); index += sizeof(short); memcpy(&m_nDummyType, &pszBuffer[index], sizeof(short)); index += sizeof(short); memcpy(&m_nSkipFlag, &pszBuffer[index], sizeof(int)); index += sizeof(int); memcpy(&m_nProcessFlag, &pszBuffer[index], sizeof(int)); index += sizeof(int); memcpy(&m_nProcessResonCode, &pszBuffer[index], sizeof(short)); index += sizeof(short); memcpy(&m_nLastGlassFlag, &pszBuffer[index], sizeof(short)); index += sizeof(short); memcpy(&m_nFirstGlassFlag, &pszBuffer[index], sizeof(short)); index += sizeof(short); memcpy(&m_nQTime[0], &pszBuffer[index], sizeof(short)); index += sizeof(short); memcpy(&m_nQTime[1], &pszBuffer[index], sizeof(short)); index += sizeof(int); memcpy(&m_nQTime[2], &pszBuffer[index], sizeof(int)); index += sizeof(short); memcpy(&m_nQTimeOverFlag, &pszBuffer[index], sizeof(short)); index += sizeof(short); memcpy(&m_nMasterRecipe, &pszBuffer[index], sizeof(short)); index += sizeof(short); CToolUnits::convertString(&pszBuffer[index], 10, m_strProductRecipeId); index += 10; CToolUnits::convertString(&pszBuffer[index], 10, m_strProductRecipeId); index += 10; CToolUnits::convertString(&pszBuffer[index], 10, m_strProductRecipeId); index += 10; CToolUnits::convertString(&pszBuffer[index], 80, m_strProductRecipeId); index += 80; memcpy(&m_nMode, &pszBuffer[index], sizeof(short)); index += sizeof(short); memcpy(&m_nSlotUnitSelectFlag, &pszBuffer[index], sizeof(short)); index += sizeof(short); memcpy(&m_nSourcePortNo, &pszBuffer[index], sizeof(short)); index += sizeof(short); memcpy(&m_nSourceSlotNo, &pszBuffer[index], sizeof(short)); index += sizeof(short); memcpy(&m_nTargetPortNo, &pszBuffer[index], sizeof(short)); index += sizeof(short); memcpy(&m_nTargetSlotNo, &pszBuffer[index], sizeof(short)); index += sizeof(short); return 256 * 2; } }