コード例 #1
0
        private void WriteResList()
        {
            //当查询条件中没有Resource时,要自己查出来
            if (_resList.Count == 0)
            {
                int iFromTime = 0;
                if (this._fromTime != null && this._fromTime != string.Empty)
                {
                    iFromTime = int.Parse(this._fromTime);
                }
                BenQGuru.eMES.SPCDataCenter.DataHandler dataHandler = new BenQGuru.eMES.SPCDataCenter.DataHandler(this._provider);
                string[] arrRes = dataHandler.QuerySPCDataResource(this._itemCode, this._testName, int.Parse(this._groupSeq), this._resourceCode, FormatHelper.TODateInt(this._dateFrom), FormatHelper.TODateInt(this._dateTo), _testResult, iFromTime);
                for (int i = 0; i < arrRes.Length; i++)
                {
                    _resList.Add(arrRes[i]);
                }
            }

            string[] arr = new string[_resList.Count];

            for (int i = 0; i < _resList.Count; i++)
            {
                arr[i] = ((string)_resList[i]).Replace(",", " ");
            }

            string res = string.Join(",", arr);

            this.Writeln(res);
        }
コード例 #2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                try
                {
                    _provider   = BenQGuru.eMES.Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider();
                    _query      = new BenQGuru.eMES.WebQuery.QuerySPC(this._provider);
                    _itemfacade = new ItemFacade(this._provider);

                    GetParam();

                    #region 返回基本资料部分
                    if (_fromTime == null || _fromTime == string.Empty)//第一次查询,不是刷新
                    {
                        /*产品别
                         * 品名
                         * 日期								(YYYY-MM-DD)
                         * 资源列表                             (以逗号分割,资源代码里的逗号用空格代替)
                         * 测试项
                         * USL,LSL,UCL,LCL,是否自动产生
                         */
                        ModelFacade modelfacade = new FacadeFactory(_provider).CreateModelFacade();
                        Model       model       = (Model)modelfacade.GetModelByItemCode(_itemCode);
                        this.Writeln(model != null ? model.ModelCode : "");

                        Item item = (Item)_itemfacade.GetItem(_itemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID);
                        this.Writeln(item != null ? item.ItemName : "");

                        //this.Writeln(_dateFrom);
                        WriteDateList();

                        WriteResList();

                        this.Writeln(this._testName);

                        string strtest = string.Empty;

                        strtest = itemSpec.USL.ToString() + ","
                                  + itemSpec.LSL.ToString() + ","
                                  + itemSpec.UCL.ToString() + ","
                                  + itemSpec.LCL.ToString() + ","
                                  + itemSpec.AutoCL + ","
                                  + itemSpec.LimitUpOnly + ","
                                  + itemSpec.LimitLowOnly;

                        this.Writeln(strtest);
                    }
                    else //刷新
                    {
                        WriteDateList();
                        //资源列表
                        WriteResList();
                    }
                    #endregion

                    #region 测试数据部分
                    //总数								(以下记录数的总和)
                    //HHMMSS数值,工作站					(时间和数值间没有空格)

                    //从SQL Server中查询数据
                    if (_query == null)
                    {
                        _query = new BenQGuru.eMES.WebQuery.QuerySPC(this._provider);
                    }



                    BenQGuru.eMES.SPCDataCenter.DataHandler dataHandler = new BenQGuru.eMES.SPCDataCenter.DataHandler(this._provider);
                    int iFromTime = 0;
                    if (this._fromTime != null && this._fromTime != string.Empty)
                    {
                        iFromTime = int.Parse(this._fromTime);
                    }
                    string[][] spcData = dataHandler.QuerySPCData(this._itemCode, this._testName, int.Parse(this._groupSeq), this._resourceCode, FormatHelper.TODateInt(this._dateFrom), FormatHelper.TODateInt(this._dateTo), _testResult, iFromTime);
                    if ((_fromTime == null || _fromTime == string.Empty) && spcData.Length < 10)
                    {
                        ExceptionManager.Raise(this.GetType(), "$SPC_SamplePoint_Too_Little");
                    }
                    // 记录数
                    this.Writeln(spcData.Length);
                    for (int i = 0; i < spcData.Length; i++)
                    {
                        string strLine = string.Empty;
                        strLine = this._dateList.IndexOf(spcData[i][1]) + "," + FormatHelper.ToTimeString(int.Parse(spcData[i][2])).Replace(":", "") + spcData[i][3];
                        if (this._resList.Count > 1)
                        {
                            strLine += "," + this._resList.IndexOf(spcData[i][0]);
                        }
                        this.Writeln(strLine);
                    }

                    #endregion

                    Response.End();

                    if (!IsPostBack)
                    {
                        // 初始化页面语言
                        //this.InitPageLanguage(this.languageComponent1, false);
                    }
                }
                catch (System.Threading.ThreadAbortException)
                {
                }
                catch (System.Exception ex)
                {
                    Response.Clear();
                    string msg = MessageCenter.ParserMessage(ex.Message, this.languageComponent1);
                    if (ex.InnerException != null)
                    {
                        msg = msg + " " + ex.InnerException.Message;
                    }
                    msg = msg.Replace("\r", "");
                    msg = msg.Replace("\n", "");
                    Response.Write(msg);
                    try
                    {
                        Response.End();
                    }
                    catch (System.Threading.ThreadAbortException)
                    {
                    }
                }
            }
            finally             //关闭数据库连接
            {
                if (_query != null && this._query.SPCBroker != null)
                {
                    this._query.SPCBroker.CloseConnection();
                }

                if (_provider != null)
                {
                    ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_provider).PersistBroker.CloseConnection();
                }
            }
        }