protected override bool ActionGenuine(out string errorInfo) { string itemName = GetInitParamValue(PN_ItemName) as string; bool initVal = Convert.ToBoolean(GetInitParamValue(PN_InitValue)); IJFDataPool sysPool = JFHubCenter.Instance.DataPool; if (sysPool.ContainItem(PN_ItemName)) { if (sysPool.GetItemType(itemName) == typeof(bool)) { errorInfo = "Sucess"; return(true); } else { errorInfo = "系统数据池已存在数据项:\"" + itemName + "\",类型:" + sysPool.GetItemType(itemName).Name; return(false); } } if (!sysPool.RegistItem(PN_ItemName, typeof(bool), initVal)) { errorInfo = "注册bool数据项失败!"; return(false); } errorInfo = "Success"; return(true); }
protected override bool ActionGenuine(out string errorInfo) { if (null == _owner) { errorInfo = "Owner MethodFlow is unset/null"; return(false); } if (_station == null) { errorInfo = "工站未设置"; return(false); } IJFDataPool stationDataPool = _station.DataPool; object srcItem = GetMethodInputValue(IN_LocItem); string stationItemName = GetInitParamValue(PN_StationItemName) as string; Type srcItemType = typeof(object); if (srcItem != null) { srcItemType = srcItem.GetType(); } if (!stationDataPool.ContainItem(stationItemName)) { if (!stationDataPool.RegistItem(stationItemName, srcItemType, srcItem)) { errorInfo = "向工站数据池写入/注册 数据项失败 stationItemName = \"" + stationItemName + "\", Type=" + srcItemType + ",Value=" + srcItem.ToString(); return(false); } } else { if (!stationDataPool.SetItemValue(stationItemName, srcItem)) { errorInfo = "向工站数据池写入 数据项失败 stationItemName = \"" + stationItemName + "\", Type=" + srcItemType + ",Value=" + srcItem.ToString(); return(false); } } errorInfo = "Success"; return(true); }
protected override bool ActionGenuine(out string errorInfo) { if (null == _owner) { errorInfo = "Method's owner Flow is null"; //异常 return(false); } string locItemName = GetInitParamValue(PN_LocPoolItemName) as string; if (!_owner.DataPool.ContainsKey(locItemName)) { errorInfo = "动作流数据池中未包含数据项项名:\"" + locItemName + "\""; return(false); } string sysItemName = GetInitParamValue(PN_SysPoolItemName) as string; object locVal = _owner.DataPool[locItemName]; IJFDataPool sysDataPool = JFHubCenter.Instance.DataPool; if (!sysDataPool.ContainItem(sysItemName))//注册并写入新值 { if (!sysDataPool.RegistItem(sysItemName, _owner.TypePool[locItemName], locVal)) { errorInfo = string.Format("向系统数据池写入/注册 失败,SysItemName = {0},Type = {1},Value = {2}", sysItemName, _owner.TypePool[locItemName].Name, locVal.ToString()); return(false); } } else //覆盖写入 { if (!sysDataPool.SetItemValue(sysItemName, locVal)) { errorInfo = string.Format("向系统数据池写入 失败,SysItemName = {0},本地类型 = {1}, 系统类型:{2},Value = {3}", sysItemName, _owner.TypePool[locItemName].Name, sysDataPool.GetItemType(sysItemName).Name, locVal.ToString()); return(false); } } errorInfo = "Success"; return(true); }
protected override bool ActionGenuine(out string errorInfo) { string itemName = GetInitParamValue(PN_SysPoolItemName) as string; IJFDataPool sysDataPool = JFHubCenter.Instance.DataPool; if (!sysDataPool.ContainItem(itemName)) { errorInfo = "系统数据池不包含数据项名:" + itemName; return(false); } object val; if (!sysDataPool.GetItemValue(itemName, out val)) { errorInfo = "获取系统数据项失败:名称:\"" + itemName + "\""; return(false); } SetOutputParamValue(ON_CurrVal, val); errorInfo = "Success"; return(true); }