private bool SBOMDownloadCheck(object obj)
        {
            SBOM sbom = (SBOM)obj;

            //检查日期格式
            if (sbom.SBOMItemEffectiveDate < 20000101)
            {
                ExceptionManager.Raise(this.GetType().BaseType, "$Error_EffectiveDate_Format");
            }
            if (sbom.SBOMItemInvalidDate < 20000101)
            {
                ExceptionManager.Raise(this.GetType().BaseType, "$Error_InvalidDate_Format");
            }

            // 检查 ItemCode
            if ((sbom.SBOMItemCode == string.Empty) || (sbom.SBOMItemCode == null))
            {
                ExceptionManager.Raise(this.GetType().BaseType, "$Error_OPBOMItem_NotNull");
            }
            // 检查 首选料
            if ((sbom.SBOMSourceItemCode == string.Empty) || (sbom.SBOMSourceItemCode == null))
            {
                ExceptionManager.Raise(this.GetType().BaseType, "$Error_OPBOMSourceItem_NotNull");
            }
            //检查单机用量
            if (!(sbom.SBOMItemQty > 0))
            {
                ExceptionManager.Raise(this.GetType().BaseType, "$Error_SBOMItemQty_Format");
            }

            itemFacade = new ItemFacade(base.DataProvider);
            object item = itemFacade.GetItem(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(sbom.ItemCode)), GlobalVariables.CurrentOrganizations.First().OrganizationID);

            if (item == null)
            {
                ExceptionManager.Raise(this.GetType().BaseType, "$Error_ItemCode_NotExisted", String.Format("[$ItemCode='{0}']", sbom.ItemCode));
            }
            return(true);
        }
Beispiel #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();
                }
            }
        }