Esempio n. 1
0
        /// <summary>
        /// Increase versions of sub spc models
        /// </summary>
        /// <param name="subConfigRawids">sub spc model's rawid</param>
        /// <returns>error message or empty</returns>
        private string IncreaseVersionOfSubConfigs(string[] subConfigRawids)
        {
            BISTel.eSPC.Data.Server.Common.CommonData commonData = new BISTel.eSPC.Data.Server.Common.CommonData();
            foreach (string s in subConfigRawids)
            {
                foreach (string query in commonData.GetIncreaseATTVersionQuery(s))
                {
                    this.Query(query);
                    if (this.ErrorMessage.Length > 0)
                    {
                        return(ErrorMessage);
                    }
                }
            }

            return(string.Empty);
        }
Esempio n. 2
0
 public SPCControlChartBiz()
 {
     this._dacData    = new BISTel.eSPC.Data.Server.Report.SPCATTControlChartData();
     this._commonData = new BISTel.eSPC.Data.Server.Common.CommonData();
 }
Esempio n. 3
0
        public DataSet SaveSPCModelData(byte[] param)
        {
            string configRawID = "";

            DataSet dsReturn = new DataSet();

            bool   _isGroup   = false;
            string groupRawid = null; //SPC-1292, KBLEE, GroupRawId 정보 담는 변수

            try
            {
                spcModelData.ParentSQLHandler = this;

                LinkedList llstParam = new LinkedList();
                llstParam.SetSerialData(param);
                bool useComma = false;

                if (llstParam[Definition.VARIABLE_USE_COMMA] is bool)
                {
                    useComma = (bool)llstParam[Definition.VARIABLE_USE_COMMA];
                }

                string sUserID = llstParam[Definition.CONDITION_KEY_USER_ID].ToString();
                BISTel.eSPC.Common.ConfigMode configMode = (BISTel.eSPC.Common.ConfigMode)llstParam[Definition.CONDITION_KEY_CONFIG_MODE];

                DataTable dtModel     = (DataTable)llstParam[BISTel.eSPC.Common.TABLE.MODEL_ATT_MST_SPC];
                DataTable dtConfig    = (DataTable)llstParam[BISTel.eSPC.Common.TABLE.MODEL_CONFIG_ATT_MST_SPC];
                DataTable dtConfigOpt = (DataTable)llstParam[BISTel.eSPC.Common.TABLE.MODEL_CONFIG_OPT_ATT_MST_SPC];
                DataTable dtContext   = (DataTable)llstParam[BISTel.eSPC.Common.TABLE.MODEL_CONTEXT_ATT_MST_SPC];
                DataTable dtRule      = (DataTable)llstParam[BISTel.eSPC.Common.TABLE.MODEL_RULE_ATT_MST_SPC];
                DataTable dtRuleOpt   = (DataTable)llstParam[BISTel.eSPC.Common.TABLE.MODEL_RULE_OPT_ATT_MST_SPC];
                DataTable dtAutoCalc  = (DataTable)llstParam[BISTel.eSPC.Common.TABLE.MODEL_AUTOCALC_ATT_MST_SPC];

                string _sMainYN        = "";
                string sConfigRawid    = "";
                string srefConfigRawid = "";
                bool   bOnlyMain       = false;
                bool   bOnlyMainGroup  = false;

                if (llstParam[Definition.CONDITION_KEY_MAIN_YN] != null)
                {
                    _sMainYN = llstParam[Definition.CONDITION_KEY_MAIN_YN].ToString();
                }

                bool _hasSubconfigs = Convert.ToBoolean(llstParam[Definition.CONDITION_KEY_HAS_SUBCONFIG].ToString());

                if (llstParam.Contains(BISTel.eSPC.Common.COLUMN.GROUP_YN))
                {
                    _isGroup = true;
                }

                if (llstParam.Contains(BISTel.eSPC.Common.COLUMN.GROUP_RAWID))
                {
                    groupRawid = llstParam[BISTel.eSPC.Common.COLUMN.GROUP_RAWID].ToString();
                }

                base.BeginTrans();

                switch (configMode)
                {
                case BISTel.eSPC.Common.ConfigMode.CREATE_MAIN:
                case BISTel.eSPC.Common.ConfigMode.SAVE_AS:
                    dsReturn = spcModelData.CreateSPCModel(configMode, sUserID, dtModel, dtConfig, dtConfigOpt, dtContext, dtRule, dtRuleOpt, dtAutoCalc, ref srefConfigRawid, groupRawid, useComma);
                    break;

                case BISTel.eSPC.Common.ConfigMode.CREATE_SUB:
                    dsReturn = spcModelData.CreateSPCModel(configMode, sUserID, dtModel, dtConfig, dtConfigOpt, dtContext, dtRule, dtRuleOpt, dtAutoCalc, ref srefConfigRawid, groupRawid, useComma);
                    break;

                case BISTel.eSPC.Common.ConfigMode.MODIFY:
                case BISTel.eSPC.Common.ConfigMode.ROLLBACK:
                    List <string> lstChangedMasterColList = (List <string>)llstParam["CHANGED_MASTER_COL_LIST"];
                    dsReturn = spcModelData.ModifySPCModel(sUserID, dtModel, dtConfig, dtConfigOpt, dtContext, dtRule, dtRuleOpt, dtAutoCalc, lstChangedMasterColList, groupRawid, useComma);
                    break;

                case BISTel.eSPC.Common.ConfigMode.DEFAULT:
                    dsReturn = spcModelData.SaveDefaultConfig(sUserID, dtModel, dtConfig, dtConfigOpt, dtContext, dtRule, dtRuleOpt, dtAutoCalc, useComma);
                    break;
                }

                if (base.ErrorMessage.Length > 0 || DSUtil.GetResultSucceed(dsReturn) == 0)
                {
                    this.RollBack();
                    return(dsReturn);
                }

                if (configMode.Equals(BISTel.eSPC.Common.ConfigMode.MODIFY) || configMode.Equals(BISTel.eSPC.Common.ConfigMode.ROLLBACK))
                {
                    configRawID = dtConfig.Rows[0][BISTel.eSPC.Common.COLUMN.RAWID].ToString();
                }

                if ((configMode.Equals(BISTel.eSPC.Common.ConfigMode.MODIFY) || configMode.Equals(BISTel.eSPC.Common.ConfigMode.ROLLBACK)) && _sMainYN.Equals(Definition.VARIABLE_Y) &&
                    _hasSubconfigs)
                {
                    if (llstParam.Contains("ONLY_MAIN"))
                    {
                        if (llstParam["ONLY_MAIN"].ToString() == Definition.VARIABLE_Y)
                        {
                            bOnlyMain = true;
                        }
                    }
                    if (llstParam.Contains("ONLY_MAIN_GROUP"))
                    {
                        if (llstParam["ONLY_MAIN_GROUP"].ToString() == Definition.VARIABLE_Y)
                        {
                            bOnlyMainGroup = true;
                        }
                    }
                    if (!bOnlyMain)
                    {
                        dsReturn = spcModelData.ModifyATTSPCSubModel(configRawID, dtRule, dtRuleOpt, sUserID, ref sConfigRawid);

                        if (sConfigRawid.Length > 0)
                        {
                            sConfigRawid = sConfigRawid.Substring(1);
                        }
                    }

                    dsReturn = spcModelData.ModifyATTSPCSubModelContext(configRawID, dtContext, sUserID, bOnlyMainGroup, groupRawid);

                    if (_isGroup) //기존 Sub 전체 삭제.
                    {
                        bool bResult = spcModelData.DeleteATTSPCModelConfig(sConfigRawid);
                        if (!bResult)
                        {
                            base.RollBack();
                        }
                    }
                }

                this.Commit();

                // Increase version
                BISTel.eSPC.Data.Server.Common.CommonData commonData = new BISTel.eSPC.Data.Server.Common.CommonData();
                switch (configMode)
                {
                case BISTel.eSPC.Common.ConfigMode.CREATE_MAIN:
                case BISTel.eSPC.Common.ConfigMode.SAVE_AS:
                case BISTel.eSPC.Common.ConfigMode.CREATE_SUB:
                    this.BeginTrans();
                    foreach (string query in commonData.GetIncreaseATTVersionQuery(srefConfigRawid.ToString()))
                    {
                        this.Query(query);
                    }
                    this.Commit();
                    break;

                case BISTel.eSPC.Common.ConfigMode.MODIFY:
                case BISTel.eSPC.Common.ConfigMode.ROLLBACK:
                    this.BeginTrans();
                    foreach (DataRow dr in dtConfig.Rows)
                    {
                        foreach (string query in commonData.GetIncreaseATTVersionQuery(dr[BISTel.eSPC.Common.COLUMN.RAWID].ToString()))
                        {
                            this.Query(query);
                        }
                    }

                    if (!bOnlyMain && _sMainYN.Equals(Definition.VARIABLE_Y) && _hasSubconfigs)
                    {
                        //modified by enkim 2012.05.18 SPC-739
                        //IncreaseVersionOfSubConfigs(sConfigRawid.Split(';'));
                        //ATT//
                        bool bResultTmp = spcModelData.IncreaseVersionOfSubConfigs(configRawID);
                        /// ATT//
                        //modified end SPC-739
                    }
                    this.Commit();
                    break;
                }

                if (configMode.Equals(BISTel.eSPC.Common.ConfigMode.MODIFY) || configMode.Equals(BISTel.eSPC.Common.ConfigMode.ROLLBACK))
                {
                    LinkedList llstCondition = new LinkedList();
                    llstCondition.Add(Definition.CONDITION_KEY_MODEL_CONFIG_RAWID, configRawID);
                    llstCondition.Add(Definition.CONDITION_KEY_MAIN_YN, _sMainYN);
                    llstCondition.Add(Definition.CONDITION_KEY_FUNCTION, "update");
                    llstCondition.Add(Definition.CONDITION_KEY_USER_ID, llstParam[BISTel.eSPC.Common.COLUMN.USER_ID].ToString());

                    //수정했을 경우 Server로 변경에 대한 Inform을 준다.
                    Interface.MsgInterfaceBusiness msgBussiness = new BISTel.eSPC.Business.Server.ATT.Interface.MsgInterfaceBusiness();
                    msgBussiness.SetSPCModel(llstCondition.GetSerialData());
                }

                if ((configMode.Equals(BISTel.eSPC.Common.ConfigMode.MODIFY) || configMode.Equals(BISTel.eSPC.Common.ConfigMode.ROLLBACK)) && _sMainYN.Equals(Definition.VARIABLE_Y) && _hasSubconfigs)
                {
                    if (!_isGroup)
                    {
                        if (!bOnlyMain)
                        {
                            LinkedList llstCondition = new LinkedList();
                            llstCondition.Add(Definition.CONDITION_KEY_MODEL_CONFIG_RAWID, sConfigRawid);
                            llstCondition.Add(Definition.CONDITION_KEY_MAIN_YN, Definition.VARIABLE_N);
                            llstCondition.Add(Definition.CONDITION_KEY_FUNCTION, "update");
                            llstCondition.Add(Definition.CONDITION_KEY_USER_ID, llstParam[BISTel.eSPC.Common.COLUMN.USER_ID].ToString());

                            //수정했을 경우 Server로 변경에 대한 Inform을 준다.
                            Interface.MsgInterfaceBusiness msgBussiness = new BISTel.eSPC.Business.Server.ATT.Interface.MsgInterfaceBusiness();
                            msgBussiness.SetSPCModel(llstCondition.GetSerialData());
                        }
                    }
                    else
                    {
                        if (!bOnlyMain)
                        {
                            LinkedList llstCondition = new LinkedList();
                            llstCondition.Add(Definition.CONDITION_KEY_MODEL_CONFIG_RAWID, sConfigRawid);
                            llstCondition.Add(Definition.CONDITION_KEY_MAIN_YN, Definition.VARIABLE_N);
                            llstCondition.Add(Definition.CONDITION_KEY_FUNCTION, "remove");
                            llstCondition.Add(Definition.CONDITION_KEY_USER_ID, llstParam[BISTel.eSPC.Common.COLUMN.USER_ID].ToString());

                            //수정했을 경우 Server로 변경에 대한 Inform을 준다.
                            Interface.MsgInterfaceBusiness msgBussiness = new BISTel.eSPC.Business.Server.ATT.Interface.MsgInterfaceBusiness();
                            msgBussiness.SetSPCModel(llstCondition.GetSerialData());
                        }
                    }
                }

                if (configMode.Equals(BISTel.eSPC.Common.ConfigMode.CREATE_MAIN) || configMode.Equals(BISTel.eSPC.Common.ConfigMode.SAVE_AS))
                {
                    if (srefConfigRawid.Length > 0)
                    {
                        LinkedList llstCondition = new LinkedList();
                        llstCondition.Add(Definition.CONDITION_KEY_MODEL_CONFIG_RAWID, srefConfigRawid);
                        llstCondition.Add(Definition.CONDITION_KEY_MAIN_YN, Definition.VARIABLE_Y);
                        llstCondition.Add(Definition.CONDITION_KEY_FUNCTION, "add");
                        llstCondition.Add(Definition.CONDITION_KEY_USER_ID, llstParam[BISTel.eSPC.Common.COLUMN.USER_ID].ToString());
                        Interface.MsgInterfaceBusiness msgBussiness = new BISTel.eSPC.Business.Server.ATT.Interface.MsgInterfaceBusiness();
                        msgBussiness.SetSPCModel(llstCondition.GetSerialData());
                    }
                }

                if (configMode.Equals(BISTel.eSPC.Common.ConfigMode.CREATE_SUB))
                {
                    if (srefConfigRawid.Length > 0)
                    {
                        LinkedList llstCondition = new LinkedList();
                        llstCondition.Add(Definition.CONDITION_KEY_MODEL_CONFIG_RAWID, srefConfigRawid);
                        llstCondition.Add(Definition.CONDITION_KEY_MAIN_YN, Definition.VARIABLE_N);
                        llstCondition.Add(Definition.CONDITION_KEY_FUNCTION, "add");
                        llstCondition.Add(Definition.CONDITION_KEY_USER_ID, llstParam[BISTel.eSPC.Common.COLUMN.USER_ID].ToString());
                        Interface.MsgInterfaceBusiness msgBussiness = new BISTel.eSPC.Business.Server.ATT.Interface.MsgInterfaceBusiness();
                        msgBussiness.SetSPCModel(llstCondition.GetSerialData());
                    }
                }
            }
            catch (Exception ex)
            {
                BISTel.PeakPerformance.Client.CommonLibrary.LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME, ex);
                base.RollBack();
            }
            finally
            {
                this.Close();
            }

            return(dsReturn);
        }