/// <summary> /// 设置工序自定义属性。 /// </summary> /// <param name="dtAttribute">包含工序自定义属性数据的数据表。</param> internal void SetOperationUDAs(DataTable dt) { try { if (dt != null) { foreach (DataRow dr in dt.Rows) { string linkedToItemKey = dr[POR_ROUTE_OPERATION_ATTR_FIELDS.FIELD_OPERATION_VER_KEY].ToString(); string attributeKey = dr[BASE_ATTRIBUTE_FIELDS.FIELDS_ATTRIBUTE_KEY].ToString(); string attributeName = dr[BASE_ATTRIBUTE_FIELDS.FIELDS_ATTRIBUTE_NAME].ToString(); string attributeValue = string.Empty; if (attributeName == COMMON_NAMES.LINKED_ITEM_EDC) { attributeValue = ConvertEdcKeyOrName(dr[POR_ROUTE_OPERATION_ATTR_FIELDS.FIELD_ATTRIBUTE_VALUE].ToString(), "O"); } else { attributeValue = dr[POR_ROUTE_OPERATION_ATTR_FIELDS.FIELD_ATTRIBUTE_VALUE].ToString(); } UserDefinedAttr uda = new UserDefinedAttr(linkedToItemKey, attributeKey, attributeName, attributeValue, ""); uda.DataType = dr[BASE_ATTRIBUTE_FIELDS.FIELDS_DATA_TYPE].ToString(); uda.OperationAction = OperationAction.Update; _operationUDAs.UserDefinedAttrAdd(uda); } } } catch (Exception ex) { this.ErrorMsg = ex.Message; MessageService.ShowError(ex); } }
/// <summary> /// 设置工步的自定义属性。 /// </summary> /// <param name="dtAttribute">包含自定义属性数据的数据行。</param> internal void SetStepUDAs(DataRow dataRow) { try { string linkedToItemKey = dataRow[POR_ROUTE_STEP_ATTR_FIELDS.FIELD_ROUTE_STEP_KEY].ToString(); string attributeKey = dataRow[BASE_ATTRIBUTE_FIELDS.FIELDS_ATTRIBUTE_KEY].ToString(); string attributeName = dataRow[BASE_ATTRIBUTE_FIELDS.FIELDS_ATTRIBUTE_NAME].ToString(); string attributeValue = string.Empty; if (attributeName == COMMON_NAMES.LINKED_ITEM_EDC) { attributeValue = ConvertEdcKeyOrName(dataRow[POR_ROUTE_STEP_ATTR_FIELDS.FIELD_ATTRIBUTE_VALUE].ToString(), "O"); } else { attributeValue = dataRow[POR_ROUTE_STEP_ATTR_FIELDS.FIELD_ATTRIBUTE_VALUE].ToString(); } UserDefinedAttr uda = new UserDefinedAttr(linkedToItemKey, attributeKey, attributeName, attributeValue, ""); uda.DataType = dataRow[BASE_ATTRIBUTE_FIELDS.FIELDS_DATA_TYPE].ToString(); uda.OperationAction = OperationAction.Update; _stepUDAs.UserDefinedAttrAdd(uda); } catch (Exception ex) { MessageService.ShowError(ex); } }
private void SetObjUda(DataTable objUdaTable) { foreach (DataRow dataRow in objUdaTable.Rows) { string linkedObjKey = dataRow[objUdaTable.Columns[COMPUTER_ATTR_FIELDS.FIELDS_COMPUTER_KEY]].ToString(); string attributeKey = dataRow[objUdaTable.Columns[COMPUTER_ATTR_FIELDS.FIELDS_ATTRIBUTE_KEY]].ToString(); string attributeName = dataRow[objUdaTable.Columns[COMPUTER_ATTR_FIELDS.FIELDS_ATTRIBUTE_NAME]].ToString(); string attributeValue = dataRow[objUdaTable.Columns[COMPUTER_ATTR_FIELDS.FIELDS_ATTRIBUTE_VALUE]].ToString(); UserDefinedAttr uda = new UserDefinedAttr(linkedObjKey, attributeKey, attributeName, attributeValue, ""); uda.DataType = dataRow[objUdaTable.Columns["DATA_TYPE"]].ToString(); uda.OperationAction = OperationAction.Update; _UDAs.UserDefinedAttrAdd(uda); } }
private void SetPartUda(DataTable partUdaTable) { foreach (DataRow dataRow in partUdaTable.Rows) { string linkedPartKey = dataRow[partUdaTable.Columns[POR_PART_FIELDS.FIELD_PART_KEY]].ToString(); string attributeKey = dataRow[partUdaTable.Columns[BASE_ATTRIBUTE_FIELDS.FIELDS_ATTRIBUTE_KEY]].ToString(); string attributeName = dataRow[partUdaTable.Columns[BASE_ATTRIBUTE_FIELDS.FIELDS_ATTRIBUTE_NAME]].ToString(); string attributeValue = dataRow[partUdaTable.Columns[POR_PART_ATTR_FIELDS.FIELDS_ATTRIBUTE_VALUE]].ToString(); UserDefinedAttr uda = new UserDefinedAttr(linkedPartKey, attributeKey, attributeName, attributeValue, ""); uda.DataType = dataRow[partUdaTable.Columns["DATA_TYPE"]].ToString(); uda.OperationAction = OperationAction.Update; _uda.UserDefinedAttrAdd(uda); } }
/// <summary> /// 设置工序自定义属性。 /// </summary> /// <param name="dr">包含工序自定义属性数据的数据行。</param> internal void SetOperationUDAs(DataRow dr) { try { string linkedToItemKey = dr[POR_ROUTE_OPERATION_ATTR_FIELDS.FIELD_OPERATION_VER_KEY].ToString(); string attributeKey = dr[BASE_ATTRIBUTE_FIELDS.FIELDS_ATTRIBUTE_KEY].ToString(); string attributeName = dr[BASE_ATTRIBUTE_FIELDS.FIELDS_ATTRIBUTE_NAME].ToString(); string attributeValue = dr[POR_ROUTE_OPERATION_ATTR_FIELDS.FIELD_ATTRIBUTE_VALUE].ToString(); UserDefinedAttr uda = new UserDefinedAttr(linkedToItemKey, attributeKey, attributeName, attributeValue, ""); uda.DataType = dr[BASE_ATTRIBUTE_FIELDS.FIELDS_DATA_TYPE].ToString(); uda.OperationAction = OperationAction.Update; _operationUDAs.UserDefinedAttrAdd(uda); } catch (Exception ex) { this.ErrorMsg = ex.Message; MessageService.ShowError(ex); } }
public UserDefinedAttrs(DataTable table) { if (null == table || table.Columns.Count != 7) { throw (new Exception("UserDefinedAttrs::UserDefinedAttrs(DataTable)")); } foreach (DataRow dataRow in table.Rows) { string linkedItemKey = dataRow[table.Columns[COLUMN_LINKED_ITEM_KEY]].ToString(); string udaKey = dataRow[table.Columns[COLUMN_ATTRIBUTE_KEY]].ToString(); string udaName = dataRow[table.Columns[COLUMN_ATTRIBUTE_NAME]].ToString(); string udaValue = dataRow[table.Columns[COLUMN_ATTRIBUTE_VALUE]].ToString(); string udaLastUpdateTime = dataRow[table.Columns[COLUMN_LAST_UPDATE_TIME]].ToString(); string udaDataType = dataRow[table.Columns[COLUMN_ATTRIBUTE_DATE_TYPE]].ToString(); UserDefinedAttr uda = new UserDefinedAttr(linkedItemKey, udaKey, udaName, udaValue, ""); uda.LastEditTime = udaLastUpdateTime; uda.DataType = udaDataType; uda.OperationAction = OperationAction.Update; _udaList.Add(uda); } }
public bool UserDefinedAttrAdd(UserDefinedAttr uda) { foreach (UserDefinedAttr itemUDA in _udaList) { if (itemUDA.Key == uda.Key) { if (OperationAction.Delete == itemUDA.OperationAction) { itemUDA.OperationAction = OperationAction.Modified; itemUDA.Value = ""; return(true); } return(false); } } if (OperationAction.None == uda.OperationAction) { uda.OperationAction = OperationAction.New; } _udaList.Add(uda); AddToInitDictionary(uda.Key, uda.Value); return(true); }
public bool UserDefinedAttrDelete(UserDefinedAttr uda) { return(UserDefinedAttrDelete(uda.Key)); }