/// <summary> /// Load Operation Equipments Data /// </summary> /// <param name="operationKey"></param> /// Owner:Andy Gao 2010-08-11 13:33:50 private void LoadOperationEquipmentsData(string operationKey) { #region Variables DataSet resDS = new DataSet(); #endregion #region Call Remoting Interface try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (serverFactory != null) { resDS = serverFactory.CreateIOperationEquipments().GetOperationEquipments(operationKey); } } catch (Exception ex) { MessageService.ShowError(ex); return; } finally { CallRemotingService.UnregisterChannel(); } #endregion #region Process Output Parameters string returnMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(resDS); if (string.IsNullOrEmpty(returnMsg)) { BindDataToEquipmentsGrid(resDS.Tables[EMS_OPERATION_EQUIPMENT_FIELDS.DATABASE_TABLE_NAME]); } else { MessageService.ShowError(returnMsg); } #endregion }
/// <summary> /// 工序名称改变时触发。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OperationName_EditValueChanged(object sender, EventArgs e) { if (this.lueOperationName.Text != "") { IServerObjFactory sof = CallRemotingService.GetRemoteObject(); DataSet dsLines = sof.CreateIOperationEquipments().GetOperationEquipments(this.lueOperationName.EditValue.ToString()); if (dsLines != null && dsLines.Tables.Count > 0) { this.lueEquipmentKey.Properties.Items.Clear(); foreach (DataRow dr in dsLines.Tables[0].Rows) { string equipmentName = Convert.ToString(dr[EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_NAME]); string equipmentCode = Convert.ToString(dr[EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_CODE]); string equipmentKey = Convert.ToString(dr[EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_KEY]); string description = string.Format("{0}({1})", equipmentName, equipmentCode); this.lueEquipmentKey.Properties.Items.Add(equipmentKey.Trim(), description); } } CallRemotingService.UnregisterChannel(); } }
/// <summary> /// 根据工序主键绑定设备数据。 /// </summary> private void BindEquipmentData() { this.teEquipmentKey.Properties.Items.Clear(); if (edcPoint == null || string.IsNullOrEmpty(edcPoint.OperationKey)) { return; } IServerObjFactory sof = CallRemotingService.GetRemoteObject(); DataSet dsLines = sof.CreateIOperationEquipments().GetOperationEquipments(edcPoint.OperationKey); if (dsLines != null && dsLines.Tables.Count > 0) { foreach (DataRow dr in dsLines.Tables[0].Rows) { string equipmentName = Convert.ToString(dr[EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_NAME]); string equipmentCode = Convert.ToString(dr[EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_CODE]); string equipmentKey = Convert.ToString(dr[EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_KEY]); string description = string.Format("{0}({1})", equipmentName, equipmentCode); this.teEquipmentKey.Properties.Items.Add(equipmentKey, description); } } CallRemotingService.UnregisterChannel(); }
/// <summary> /// Update Operation Equipments Data /// </summary> /// <returns></returns> /// Owner:Andy Gao 2010-08-11 16:05:22 private bool UpdateOperationEquipmentsData() { #region Variables DataSet reqDS = new DataSet(); DataSet resDS = new DataSet(); #endregion #region Build Equipment Change Reasons Data if (this.grdEquipments.DataSource != null && this.grdEquipments.DataSource is DataTable) { DataTable equipmentsDataTable = (DataTable)this.grdEquipments.DataSource; DataTable addedDataTable = equipmentsDataTable.GetChanges(DataRowState.Added); DataTable modifiedDataTable = equipmentsDataTable.GetChanges(DataRowState.Modified); DataTable deletedDataTable = equipmentsDataTable.GetChanges(DataRowState.Deleted); if ((addedDataTable != null && addedDataTable.Rows.Count > 0) || (modifiedDataTable != null && modifiedDataTable.Rows.Count > 0) || (deletedDataTable != null && deletedDataTable.Rows.Count > 0)) { equipmentsDataTable.TableName = EMS_OPERATION_EQUIPMENT_FIELDS.DATABASE_TABLE_NAME; reqDS.Tables.Add(equipmentsDataTable.Copy()); } else { MessageService.ShowMessage("${res:FanHai.Hemera.Addins.EMS.OperationEquipments.M0002}", "${res:Global.SystemInfo}"); return(false); } } #endregion #region Call Remoting Interface try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (serverFactory != null) { resDS = serverFactory.CreateIOperationEquipments().UpdateOperationEquipments(reqDS); } } catch (Exception ex) { MessageService.ShowError(ex); return(false); } finally { CallRemotingService.UnregisterChannel(); } #endregion #region Process Output Parameters string returnMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(resDS); if (string.IsNullOrEmpty(returnMsg)) { return(true); } else { MessageService.ShowError(returnMsg); return(false); } #endregion }