Example #1
0
        private void InitUIControls()
        {
            #region Equipment Grid

            this.grdViewEquipments.Columns.Clear();

            EMS_EQUIPMENTS_FIELDS equipmentsFields = new EMS_EQUIPMENTS_FIELDS();

            int index = 0;

            GridColumn column = new GridColumn();

            column.Name         = "RN";
            column.FieldName    = "RN";
            column.Visible      = true;
            column.VisibleIndex = index++;

            this.grdViewEquipments.Columns.Add(column);
            column.AppearanceHeader.TextOptions.HAlignment = DXUtils.HorzAlignment.Center;

            foreach (KeyValuePair <string, FieldProperties> field in equipmentsFields.FIELDS)
            {
                column = new GridColumn();

                column.Name         = field.Key;
                column.FieldName    = field.Key;
                column.Visible      = true;
                column.VisibleIndex = index++;

                this.grdViewEquipments.Columns.Add(column);
                column.AppearanceHeader.TextOptions.HAlignment = DXUtils.HorzAlignment.Center;
            }

            RepositoryItemCheckEdit checkEdit = new RepositoryItemCheckEdit();

            checkEdit.QueryCheckStateByValue += new QueryCheckStateByValueEventHandler(ControlUtils.QueryCheckStateByValue);

            this.grdViewEquipments.Columns[EMS_EQUIPMENTS_FIELDS.FIELD_ISBATCH].ColumnEdit        = checkEdit;
            this.grdViewEquipments.Columns[EMS_EQUIPMENTS_FIELDS.FIELD_ISCHAMBER].ColumnEdit      = checkEdit;
            this.grdViewEquipments.Columns[EMS_EQUIPMENTS_FIELDS.FIELD_ISMULTICHAMBER].ColumnEdit = checkEdit;

            #endregion
        }
Example #2
0
        /// <summary>
        /// 删除设备组数据。
        /// </summary>
        /// <param name="dsParams">包含删除条件的数据集对象。</param>
        /// <returns>包含执行结果的数据集对象。</returns>
        public DataSet DeleteEquipmentGroups(DataSet reqDS)
        {
            DataSet resDS = new DataSet();

            try
            {
                if (reqDS != null && reqDS.Tables.Contains(PARAMETERS_INPUT.DATABASE_TABLE_NAME))
                {
                    DataTable inputParamDataTable = reqDS.Tables[PARAMETERS_INPUT.DATABASE_TABLE_NAME];

                    #region Build Conditions List

                    List <Conditions> conditionsList = new List <Conditions>();

                    foreach (DataRow row in inputParamDataTable.Rows)
                    {
                        Conditions conditions = new Conditions();

                        Condition keyCondition;

                        if (row[PARAMETERS_INPUT.FIELD_KEY] != null && row[PARAMETERS_INPUT.FIELD_KEY] != DBNull.Value)
                        {
                            keyCondition = new Condition(DatabaseLogicOperator.And, EMS_EQUIPMENT_GROUPS_FIELDS.FIELD_EQUIPMENT_GROUP_KEY,
                                                         DatabaseCompareOperator.Equal, row[PARAMETERS_INPUT.FIELD_KEY].ToString());
                        }
                        else
                        {
                            keyCondition = new Condition(DatabaseLogicOperator.And, EMS_EQUIPMENT_GROUPS_FIELDS.FIELD_EQUIPMENT_GROUP_KEY,
                                                         DatabaseCompareOperator.Null, string.Empty);
                        }

                        conditions.Add(keyCondition);

                        Condition editorCondition;

                        if (row[PARAMETERS_INPUT.FIELD_EDITOR] != null && row[PARAMETERS_INPUT.FIELD_EDITOR] != DBNull.Value)
                        {
                            editorCondition = new Condition(DatabaseLogicOperator.And, EMS_EQUIPMENT_GROUPS_FIELDS.FIELD_EDITOR,
                                                            DatabaseCompareOperator.Equal, row[PARAMETERS_INPUT.FIELD_EDITOR].ToString());
                        }
                        else
                        {
                            editorCondition = new Condition(DatabaseLogicOperator.And, EMS_EQUIPMENT_GROUPS_FIELDS.FIELD_EDITOR,
                                                            DatabaseCompareOperator.Null, string.Empty);
                        }

                        conditions.Add(editorCondition);

                        Condition editTimeCondition;

                        if (row[PARAMETERS_INPUT.FIELD_EDIT_TIME] != null && row[PARAMETERS_INPUT.FIELD_EDIT_TIME] != DBNull.Value)
                        {
                            editTimeCondition = new Condition(DatabaseLogicOperator.And, EMS_EQUIPMENT_GROUPS_FIELDS.FIELD_EDIT_TIME,
                                                              DatabaseCompareOperator.Equal, row[PARAMETERS_INPUT.FIELD_EDIT_TIME].ToString());
                        }
                        else
                        {
                            editTimeCondition = new Condition(DatabaseLogicOperator.And, EMS_EQUIPMENT_GROUPS_FIELDS.FIELD_EDIT_TIME,
                                                              DatabaseCompareOperator.Null, string.Empty);
                        }

                        conditions.Add(editTimeCondition);

                        conditionsList.Add(conditions);
                    }

                    #endregion

                    EMS_EQUIPMENT_GROUPS_FIELDS equipmentGroupsFields = new EMS_EQUIPMENT_GROUPS_FIELDS();

                    List <string> sqlStringList = DatabaseTable.BuildDeleteSqlStatements(equipmentGroupsFields, conditionsList);

                    string sqlString = string.Empty;

                    if (sqlStringList.Count > 0)
                    {
                        sqlString = sqlStringList[0];
                    }

                    #region Check Equipments Reference

                    string equipmentGroupKey = inputParamDataTable.Rows[0][PARAMETERS_INPUT.FIELD_KEY].ToString();

                    Conditions checkConditions = new Conditions();

                    checkConditions.Add(DatabaseLogicOperator.And, EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_GROUP_KEY, DatabaseCompareOperator.Equal, equipmentGroupKey);

                    EMS_EQUIPMENTS_FIELDS equipmentsFields = new EMS_EQUIPMENTS_FIELDS();

                    List <string> interestColumns = new List <string>()
                    {
                        EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_KEY
                    };

                    string checkSqlString = DatabaseTable.BuildQuerySqlStatement(equipmentsFields, interestColumns, checkConditions);

                    object scalar = db.ExecuteScalar(CommandType.Text, checkSqlString);

                    if (scalar != null && scalar != DBNull.Value)
                    {
                        throw new Exception("${res:FanHai.Hemera.Modules.EMS.EquipmentGroups.M0002}");
                    }

                    #endregion

                    if (db.ExecuteNonQuery(CommandType.Text, sqlString) > 0)
                    {
                        FanHai.Hemera.Share.Common.ReturnMessageUtils.AddServerReturnMessage(resDS, string.Empty);
                    }
                    else
                    {
                        throw new Exception("${res:FanHai.Hemera.Module.Common.M0002}");
                    }
                }
                else
                {
                    FanHai.Hemera.Share.Common.ReturnMessageUtils.AddServerReturnMessage(resDS, "${res:FanHai.Hemera.Module.Common.M0001}");
                }
            }
            catch (Exception ex)
            {
                FanHai.Hemera.Share.Common.ReturnMessageUtils.AddServerReturnMessage(resDS, ex.Message);
                LogService.LogError("DeleteEquipmentGroups Error: " + ex.Message);
            }

            return(resDS);
        }
Example #3
0
        protected override void InitUIControls()
        {
            #region Repository Controls

            RepositoryItemCheckEdit checkEdit = new RepositoryItemCheckEdit();

            checkEdit.QueryCheckStateByValue += new QueryCheckStateByValueEventHandler(ControlUtils.QueryCheckStateByValue);

            RepositoryItemTextEdit textEdit = new RepositoryItemTextEdit();

            textEdit.CustomDisplayText += new CustomDisplayTextEventHandler(textEdit_CustomDisplayText);

            #endregion

            #region Operation Grid

            this.grdViewOperations.Columns.Clear();

            int index = 0;

            GridColumn column = new GridColumn();

            column.Name         = "RN";
            column.FieldName    = "RN";
            column.Visible      = true;
            column.VisibleIndex = index++;

            this.grdViewOperations.Columns.Add(column);

            column = new GridColumn();

            column.Name         = POR_ROUTE_OPERATION_VER_FIELDS.FIELD_ROUTE_OPERATION_VER_KEY;
            column.FieldName    = POR_ROUTE_OPERATION_VER_FIELDS.FIELD_ROUTE_OPERATION_VER_KEY;
            column.Visible      = false;
            column.VisibleIndex = index++;

            this.grdViewOperations.Columns.Add(column);

            column = new GridColumn();

            column.Name         = POR_ROUTE_OPERATION_VER_FIELDS.FIELD_ROUTE_OPERATION_NAME;
            column.FieldName    = POR_ROUTE_OPERATION_VER_FIELDS.FIELD_ROUTE_OPERATION_NAME;
            column.Visible      = true;
            column.VisibleIndex = index++;

            this.grdViewOperations.Columns.Add(column);

            column = new GridColumn();

            column.Name         = POR_ROUTE_OPERATION_VER_FIELDS.FIELD_DESCRIPTIONS;
            column.FieldName    = POR_ROUTE_OPERATION_VER_FIELDS.FIELD_DESCRIPTIONS;
            column.Visible      = true;
            column.VisibleIndex = index++;

            this.grdViewOperations.Columns.Add(column);

            column = new GridColumn();

            column.Name         = POR_ROUTE_OPERATION_VER_FIELDS.FIELD_IMAGE_KEY;
            column.FieldName    = POR_ROUTE_OPERATION_VER_FIELDS.FIELD_IMAGE_KEY;
            column.Visible      = true;
            column.VisibleIndex = index++;

            this.grdViewOperations.Columns.Add(column);

            column = new GridColumn();

            column.Name         = POR_ROUTE_OPERATION_VER_FIELDS.FIELD_DURATION;
            column.FieldName    = POR_ROUTE_OPERATION_VER_FIELDS.FIELD_DURATION;
            column.Visible      = true;
            column.VisibleIndex = index++;

            this.grdViewOperations.Columns.Add(column);

            column = new GridColumn();

            column.Name         = POR_ROUTE_OPERATION_VER_FIELDS.FIELD_OPERATION_VERSION;
            column.FieldName    = POR_ROUTE_OPERATION_VER_FIELDS.FIELD_OPERATION_VERSION;
            column.Visible      = true;
            column.VisibleIndex = index++;

            this.grdViewOperations.Columns.Add(column);

            column = new GridColumn();

            column.Name         = POR_ROUTE_OPERATION_VER_FIELDS.FIELD_OPERATION_STATUS;
            column.FieldName    = POR_ROUTE_OPERATION_VER_FIELDS.FIELD_OPERATION_STATUS;
            column.Visible      = true;
            column.VisibleIndex = index++;
            column.ColumnEdit   = textEdit;

            this.grdViewOperations.Columns.Add(column);

            column = new GridColumn();

            column.Name         = POR_ROUTE_OPERATION_VER_FIELDS.FIELD_IS_REWORKABLE;
            column.FieldName    = POR_ROUTE_OPERATION_VER_FIELDS.FIELD_IS_REWORKABLE;
            column.Visible      = true;
            column.VisibleIndex = index++;
            column.ColumnEdit   = checkEdit;

            this.grdViewOperations.Columns.Add(column);

            #endregion

            #region Equipment Grid

            this.grdViewEquipments.Columns.Clear();

            EMS_EQUIPMENTS_FIELDS equipmentsFields = new EMS_EQUIPMENTS_FIELDS();

            index = 0;

            foreach (KeyValuePair <string, FieldProperties> field in equipmentsFields.FIELDS)
            {
                column = new GridColumn();

                column.Name         = field.Key;
                column.FieldName    = field.Key;
                column.Visible      = true;
                column.VisibleIndex = index++;

                this.grdViewEquipments.Columns.Add(column);
            }

            this.grdViewEquipments.Columns[EMS_EQUIPMENTS_FIELDS.FIELD_ISBATCH].ColumnEdit        = checkEdit;
            this.grdViewEquipments.Columns[EMS_EQUIPMENTS_FIELDS.FIELD_ISCHAMBER].ColumnEdit      = checkEdit;
            this.grdViewEquipments.Columns[EMS_EQUIPMENTS_FIELDS.FIELD_ISMULTICHAMBER].ColumnEdit = checkEdit;

            #endregion
        }
Example #4
0
        public override bool Update()
        {
            #region Variables

            DataSet reqDS = new DataSet();
            DataSet resDS = new DataSet();

            #endregion

            #region Build Input Parameters

            if (!string.IsNullOrEmpty(equipmentKey))
            {
                DataTable inputParamDataTable = PARAMETERS_INPUT.CreateDataTable();

                object inputKey      = DBNull.Value;
                object inputEditor   = DBNull.Value;
                object inputEditTime = DBNull.Value;

                if (!string.IsNullOrEmpty(equipmentKey))
                {
                    inputKey = equipmentKey;
                }

                if (!string.IsNullOrEmpty(Editor))
                {
                    inputEditor = Editor;
                }

                if (!string.IsNullOrEmpty(EditTime))
                {
                    inputEditTime = EditTime;
                }

                inputParamDataTable.Rows.Add(new object[] { inputKey, inputEditor, inputEditTime });

                inputParamDataTable.AcceptChanges();

                reqDS.Tables.Add(inputParamDataTable);
            }

            #endregion

            #region Build Equipment Data

            this.DirtyList.Add(EMS_EQUIPMENTS_FIELDS.FIELD_EDIT_TIME, new DirtyItem(EMS_EQUIPMENTS_FIELDS.FIELD_EDIT_TIME, "", ""));

            Editor       = PropertyService.Get(PROPERTY_FIELDS.USER_NAME);
            EditTimeZone = PropertyService.Get(PROPERTY_FIELDS.TIMEZONE);

            DataTable equipmentsDataTable = EMS_EQUIPMENTS_FIELDS.CreateDataTable();

            FanHai.Hemera.Utils.Common.Utils.AddKeyValuesToDataTable(ref equipmentsDataTable, DirtyList);

            equipmentsDataTable.AcceptChanges();

            reqDS.Tables.Add(equipmentsDataTable);

            #endregion

            #region Call Remoting Interface

            try
            {
                IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject();

                if (serverFactory != null)
                {
                    resDS = serverFactory.CreateIEquipments().UpdateEquipments(reqDS);
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowError(ex);

                return(false);
            }
            finally
            {
                CallRemotingService.UnregisterChannel();
            }

            #endregion

            #region Process Output Parameters

            string outputEditTime = string.Empty;

            string returnMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(resDS, ref outputEditTime);

            if (string.IsNullOrEmpty(returnMsg))
            {
                EditTime = outputEditTime;

                return(true);
            }
            else
            {
                MessageService.ShowError(returnMsg);

                return(false);
            }

            #endregion
        }
Example #5
0
        public override bool Insert(DataSet ds)
        {
            #region Variables

            DataSet reqDS = new DataSet();
            DataSet resDS = new DataSet();

            #endregion

            #region Build Equipment Data
            DataTable equipmentsDataTable = EMS_EQUIPMENTS_FIELDS.CreateDataTable();

            Dictionary <string, string> dataRow = new Dictionary <string, string>()
            {
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_KEY, equipmentKey },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_NAME, equipmentName },
                { EMS_EQUIPMENTS_FIELDS.FIELD_DESCRIPTION, description },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_CODE, equipmentCode },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_MODE, equipmentMode },
                { EMS_EQUIPMENTS_FIELDS.FIELD_MAXQUANTITY, maxQuantity },
                { EMS_EQUIPMENTS_FIELDS.FIELD_MINQUANTITY, minQuantity },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_TYPE, equipmentType },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_GROUP_KEY, equipmentGroupKey },
                { EMS_EQUIPMENTS_FIELDS.FIELD_LOCATION_KEY, equipmentLocationKey },
                { EMS_EQUIPMENTS_FIELDS.FIELD_ISBATCH, isBatch },
                { EMS_EQUIPMENTS_FIELDS.FIELD_ISCHAMBER, IsChamber },
                { EMS_EQUIPMENTS_FIELDS.FIELD_CHAMBER_INDEX, chamberIndex },
                { EMS_EQUIPMENTS_FIELDS.FIELD_CHAMBER_TOTAL, chamberTotal },
                { EMS_EQUIPMENTS_FIELDS.FIELD_ISMULTICHAMBER, isMultiChamber },
                { EMS_EQUIPMENTS_FIELDS.FIELD_PARENT_EQUIPMENT_KEY, parentEquipmentKey },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_STATE_KEY, equipmentStateKey },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_CHANGE_STATE_KEY, equipmentChangeStateKey },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_REAL_KEY, equipmentRealKey },
                { EMS_EQUIPMENTS_FIELDS.FIELD_CREATOR, Creator },
                { EMS_EQUIPMENTS_FIELDS.FIELD_CREATE_TIMEZONE_KEY, CreateTimeZone },
                { EMS_EQUIPMENTS_FIELDS.FIELD_CREATE_TIME, string.Empty },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_ASSETSNO, equipment_assetsno },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_AV_TIME, equipment_av_time },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_WPH, equipment_wph },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_TRACT_TIME, equipment_tract_time }
            };

            FanHai.Hemera.Utils.Common.Utils.AddKeyValuesToDataTable(ref equipmentsDataTable, dataRow);

            equipmentsDataTable.AcceptChanges();

            //reqDS.Tables.Add(equipmentsDataTable);
            ds.Tables.Add(equipmentsDataTable);

            #endregion

            #region Build Input Parameters

            if (!string.IsNullOrEmpty(equipmentKey))
            {
                DataTable inputParamDataTable = PARAMETERS_INPUT.CreateDataTable();

                object inputKey      = DBNull.Value;
                object inputEditor   = DBNull.Value;
                object inputEditTime = DBNull.Value;

                if (!string.IsNullOrEmpty(equipmentKey))
                {
                    inputKey = equipmentKey;
                }

                if (!string.IsNullOrEmpty(Creator))
                {
                    inputEditor = Creator;
                }

                if (!string.IsNullOrEmpty(CreateTime))
                {
                    inputEditTime = CreateTime;
                }

                inputParamDataTable.Rows.Add(new object[] { inputKey, inputEditor, inputEditTime });

                inputParamDataTable.AcceptChanges();

                //reqDS.Tables.Add(inputParamDataTable);
                ds.Tables.Add(inputParamDataTable);
            }

            #endregion

            #region Call Remoting Interface

            try
            {
                IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject();

                if (serverFactory != null)
                {
                    resDS = serverFactory.CreateIEquipments().InsertEquipments(ds);
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowError(ex);

                return(false);
            }
            finally
            {
                CallRemotingService.UnregisterChannel();
            }

            #endregion

            #region Process Output Parameters

            string outputcreateTime = string.Empty;

            string returnMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(resDS, ref outputcreateTime);

            if (string.IsNullOrEmpty(returnMsg))
            {
                CreateTime = outputcreateTime;

                return(true);
            }
            else
            {
                MessageService.ShowError(returnMsg);

                return(false);
            }

            #endregion
        }