コード例 #1
0
        private void SetGridColumn(object[] output, object[] dataSource)
        {
            this.gridWebGrid.Columns.Clear();
            this._gridHelper.AddColumn("ErrorCode", "不良代码", null);
            ArrayList list = new ArrayList();

            _htDateItemIdx = new Hashtable();
            SortedList sortList = new SortedList();

            if (output != null)
            {
                for (int i = 0; i < output.Length; i++)
                {
                    QDOTSErrorCodeAnalyse item = (QDOTSErrorCodeAnalyse)output[i];
                    if (list.Contains(item.DateGroup.ToString() + ":" + item.ModelCode) == false)
                    {
                        sortList.Add(item.DateGroup.ToString() + ":" + item.ModelCode, item);
                        list.Add(item.DateGroup.ToString() + ":" + item.ModelCode);
                    }
                }
            }
            for (int i = 0; i < dataSource.Length; i++)
            {
                QDOTSErrorCodeAnalyse item = (QDOTSErrorCodeAnalyse)dataSource[i];
                if (list.Contains(item.DateGroup.ToString() + ":" + item.ModelCode) == false)
                {
                    sortList.Add(item.DateGroup.ToString() + ":" + item.ModelCode, item);
                    list.Add(item.DateGroup.ToString() + ":" + item.ModelCode);
                }
            }
            foreach (object objTmp in sortList.Keys)
            {
                QDOTSErrorCodeAnalyse item = (QDOTSErrorCodeAnalyse)sortList[objTmp];
                this._gridHelper.AddColumn(item.DateGroup.ToString() + ":" + item.ModelCode + ":ErrorQty", item.ModelCode);
                this._gridHelper.AddColumn(item.DateGroup.ToString() + ":" + item.ModelCode + ":DPPM", "DPPM(K)");
                _htDateItemIdx.Add(this.gridWebGrid.Columns.Count - 2, new string[] { item.DateGroup.ToString(), item.ModelCode });
            }
            if (this.gridWebGrid.Columns.Count > 15)
            {
                this.gridWebGrid.Columns[0].Width = Unit.Pixel(120);
                for (int i = 1; i < this.gridWebGrid.Columns.Count; i++)
                {
                    this.gridWebGrid.Columns[i].Width = Unit.Pixel(60);
                }
            }
        }
コード例 #2
0
 // 加入产量数据
 private void AddOutputRow(object[] output)
 {
     // 加入产量数据
     object[] objRow = new object[this.gridWebGrid.Columns.Count];
     objRow[0]    = "Output";
     _htOutputQty = new Hashtable();
     if (output != null)
     {
         for (int i = 0; i < output.Length; i++)
         {
             QDOTSErrorCodeAnalyse item = (QDOTSErrorCodeAnalyse)output[i];
             _htOutputQty.Add(item.DateGroup.ToString() + ":" + item.ModelCode, item.Quantity);
             UltraGridColumn column = this.gridWebGrid.Columns.FromKey(item.DateGroup.ToString() + ":" + item.ModelCode + ":ErrorQty");
             if (column != null)
             {
                 objRow[column.Index] = item.Quantity;
             }
         }
     }
     this.gridWebGrid.Rows.Add(new UltraGridRow(objRow));
     this.gridWebGrid.Rows[this.gridWebGrid.Rows.Count - 1].Style.ForeColor = Color.Blue;
 }
コード例 #3
0
        private void DomainObjectToGridRow(object[] dataSource)
        {
            string strPrevErrorGroupCode = string.Empty;
            string strPrevErrorCode      = string.Empty;

            object[]              objRow      = null;
            Hashtable             htQtyTotal  = new Hashtable();
            Hashtable             htDppmTotal = new Hashtable();
            QDOTSErrorCodeAnalyse item        = null;

            for (int i = 0; i < dataSource.Length; i++)
            {
                item = (QDOTSErrorCodeAnalyse)dataSource[i];
                if (item.ErrorCodeGroup != strPrevErrorGroupCode ||
                    item.ErrorCode != strPrevErrorCode)
                {
                    if (objRow != null)
                    {
                        this.gridWebGrid.Rows.Add(new UltraGridRow(objRow));
                    }

                    if (item.ErrorCodeGroup != strPrevErrorGroupCode)
                    {
                        if (strPrevErrorGroupCode != string.Empty)
                        {
                            AddGroupTotalDataRow(htQtyTotal, htDppmTotal, strPrevErrorGroupCode);
                        }
                        // 添加不良代码组
                        objRow    = new object[this.gridWebGrid.Columns.Count];
                        objRow[0] = item.ErrorCodeGroupDesc;
                        this.gridWebGrid.Rows.Add(new UltraGridRow(objRow));
                        this.gridWebGrid.Rows[this.gridWebGrid.Rows.Count - 1].Style.BackColor = Color.Linen;
                        this.gridWebGrid.Rows[this.gridWebGrid.Rows.Count - 1].Style.Font.Bold = true;

                        htQtyTotal  = new Hashtable();
                        htDppmTotal = new Hashtable();
                    }
                    //
                    objRow    = new object[this.gridWebGrid.Columns.Count];
                    objRow[0] = item.ErrorCodeDesc;

                    strPrevErrorGroupCode = item.ErrorCodeGroup;
                    strPrevErrorCode      = item.ErrorCode;
                }
                UltraGridColumn column = this.gridWebGrid.Columns.FromKey(item.DateGroup.ToString() + ":" + item.ModelCode + ":ErrorQty");
                if (column != null)
                {
                    objRow[column.Index] = item.Quantity;
                    if (htQtyTotal.ContainsKey(column.Index) == false)
                    {
                        htQtyTotal.Add(column.Index, item.Quantity);
                    }
                    else
                    {
                        htQtyTotal[column.Index] = Convert.ToInt32(htQtyTotal[column.Index]) + item.Quantity;
                    }
                    if (this._htOutputQty.Contains(item.DateGroup.ToString() + ":" + item.ModelCode) &&
                        Convert.ToInt32(this._htOutputQty[item.DateGroup.ToString() + ":" + item.ModelCode]) != 0)
                    {
                        objRow[column.Index + 1] = item.Quantity * 1000 / Convert.ToInt32(this._htOutputQty[item.DateGroup.ToString() + ":" + item.ModelCode]);
                        if (htDppmTotal.ContainsKey(column.Index + 1) == false)
                        {
                            htDppmTotal.Add(column.Index + 1, objRow[column.Index + 1]);
                        }
                        else
                        {
                            htDppmTotal[column.Index + 1] = Convert.ToInt32(htDppmTotal[column.Index + 1]) + Convert.ToInt32(objRow[column.Index + 1]);
                        }
                    }
                }
            }
            // 添加最后一行
            this.gridWebGrid.Rows.Add(new UltraGridRow(objRow));

            AddGroupTotalDataRow(htQtyTotal, htDppmTotal, strPrevErrorGroupCode);

            AddGlobalTotalDataRow();
        }