コード例 #1
0
        /// <summary>
        /// 处理批量录入控件数据源
        /// </summary>
        /// <param name="startIndex">开始位</param>
        /// <param name="fabCount">匹数</param>
        /// <param name="perQty">每匹数量</param>
        /// <returns>true/false 表格行数有没有改变</returns>
        bool ProBatchDataSource(int startIndex, int fabCount, decimal perQty)
        {
            bool AddFlag = false;
            int  fabNo   = 0;                                          //卷号,当前已录入卷号

            if (m_UCDataSource.Rows.Count < startIndex + fabCount + 1) //如果行数不足,一般不会影响,事先判断好
            {
                UCFabCommon.AddDtRow(m_UCDataSource, startIndex + fabCount + 1);
                AddFlag = true;
            }
            //if (startIndex > 0)//获取上一卷号
            //{
            //    fabNo = SysConvert.ToInt32(m_UCDataSource.Rows[startIndex - 1]["SubSeq"]);
            //}

            //获取最大卷号
            DataRow[] drA = m_UCDataSource.Select("1=1", "SubSeq DESC");
            if (drA.Length > 0)
            {
                fabNo = SysConvert.ToInt32(drA[0]["SubSeq"]);
            }

            for (int i = startIndex; i < startIndex + fabCount; i++)//开始循环赋值
            {
                m_UCDataSource.Rows[i]["SubSeq"] = (fabNo + i - startIndex + 1).ToString();
                m_UCDataSource.Rows[i]["Qty"]    = perQty;
            }

            return(AddFlag);
        }
コード例 #2
0
 /// <summary>
 /// 绑定Grid
 /// </summary>
 void BindGrid()
 {
     UCFabCommon.AddDtRow(UCDataSource, UCInputCount);
     gridView1.GridControl.DataSource = ConvertDataSource(UCDataSource);
     gridView1.GridControl.Show();
     DataSourceTotalCalcAll();//计算小计
     DataSourceTotalInfoSet();
     //lblFabCount.Text = "匹数:" + SysConvert.ToString(UCDataSource.Compute("COUNT(Qty)", " ISNULL(Qty,0)<>0")); //UCDataSource.Rows.Count.ToString();
     //lblFabQty.Text = "数量:"+SysConvert.ToString(UCDataSource.Compute("SUM(Qty)", ""));
 }
コード例 #3
0
ファイル: UCFabIGridView.cs プロジェクト: zhp-apeng/HTMLTERP
 /// <summary>
 /// 绑定Grid
 /// </summary>
 void BindGrid()
 {
     UCFabCommon.AddDtRow(UCDataSource, UCInputCount);
     gridView1.GridControl.DataSource = UCDataSource;
     gridView1.GridControl.Show();
 }
コード例 #4
0
ファイル: UCFabITileGroup.cs プロジェクト: zhp-apeng/HTMLTERP
 /// <summary>
 /// 执行绘画
 /// 一般在全部赋值完成后
 /// </summary>
 public override void UCAct()
 {
     UCFabCommon.AddDtRow(UCDataSource, UCInputCount);
     CreateFabTile(UCDataSource, UCColumnCount);
 }
コード例 #5
0
        /// <summary>
        /// 值改变
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            try
            {
                if (e.Column.FieldName.IndexOf("ColVal") != -1)                         //是值
                {
                    int colIndex = SysConvert.ToInt32(e.Column.FieldName.Substring(6)); //列号 1开始
                    int rowIndex = e.RowHandle / 5;                                     //行号,取整 0开始
                    if (!UCVolumeNumberShowFlag)                                        //如果不显示卷号,就是一行数量,则行数就是GridView行号
                    {
                        rowIndex = e.RowHandle;
                    }
                    int datasourceRow = rowIndex * UCColumnCount + (colIndex - 1); //数据源行号

                    if (UCDataSource.Rows.Count <= datasourceRow)                  //溢出
                    {
                        UCFabCommon.AddDtRow(UCDataSource, datasourceRow + 2);
                    }
                    if (UCDataSource.Rows.Count > datasourceRow) //未溢出
                    {
                        if (UCVolumeNumberShowFlag)              //如果显示卷号,就是两行,一行匹号,一行卷号
                        {
                            if (e.RowHandle % 5 == 0)            //匹号
                            {
                                if (SysConvert.ToInt32(e.Value) != 0)
                                {
                                    UCDataSource.Rows[datasourceRow]["SubSeq"] = SysConvert.ToInt32(e.Value);
                                }
                                else
                                {
                                    UCDataSource.Rows[datasourceRow]["SubSeq"] = DBNull.Value;
                                }
                            }
                            else if (e.RowHandle % 5 == 1)//数量
                            {
                                if (SysConvert.ToDecimal(e.Value) != 0)
                                {
                                    UCDataSource.Rows[datasourceRow]["Qty"] = SysConvert.ToDecimal(e.Value);
                                }
                                else
                                {
                                    UCDataSource.Rows[datasourceRow]["Qty"] = DBNull.Value;
                                }
                            }
                            else if (e.RowHandle % 5 == 2)//公斤数
                            {
                                if (SysConvert.ToDecimal(e.Value) != 0)
                                {
                                    UCDataSource.Rows[datasourceRow]["Weight"] = SysConvert.ToDecimal(e.Value);
                                }
                                else
                                {
                                    UCDataSource.Rows[datasourceRow]["Weight"] = DBNull.Value;
                                }
                            }
                            else if (e.RowHandle % 5 == 3)//码数
                            {
                                if (SysConvert.ToDecimal(e.Value) != 0)
                                {
                                    UCDataSource.Rows[datasourceRow]["Yard"] = SysConvert.ToDecimal(e.Value);
                                }
                                else
                                {
                                    UCDataSource.Rows[datasourceRow]["Yard"] = DBNull.Value;
                                }
                            }
                            else
                            {
                                if (SysConvert.ToString(e.Value) != string.Empty)
                                {
                                    UCDataSource.Rows[datasourceRow]["GoodsLevel"] = SysConvert.ToString(e.Value);
                                }
                                else
                                {
                                    UCDataSource.Rows[datasourceRow]["GoodsLevel"] = DBNull.Value;
                                }
                            }
                        }
                        else//如果不显示卷号,就是一行数量
                        {
                            if (e.RowHandle % 4 == 0)//数量
                            {
                                if (SysConvert.ToDecimal(e.Value) != 0)
                                {
                                    UCDataSource.Rows[datasourceRow]["Qty"] = SysConvert.ToDecimal(e.Value);
                                }
                                else
                                {
                                    UCDataSource.Rows[datasourceRow]["Qty"] = DBNull.Value;
                                }
                            }
                            else if (e.RowHandle % 4 == 1)//公斤数
                            {
                                if (SysConvert.ToDecimal(e.Value) != 0)
                                {
                                    UCDataSource.Rows[datasourceRow]["Weight"] = SysConvert.ToDecimal(e.Value);
                                }
                                else
                                {
                                    UCDataSource.Rows[datasourceRow]["Weight"] = DBNull.Value;
                                }
                            }
                            else if (e.RowHandle % 4 == 2)
                            {
                                if (SysConvert.ToDecimal(e.Value) != 0)
                                {
                                    UCDataSource.Rows[datasourceRow]["Yard"] = SysConvert.ToDecimal(e.Value);
                                }
                                else
                                {
                                    UCDataSource.Rows[datasourceRow]["Yard"] = DBNull.Value;
                                }
                            }
                            else
                            {
                                if (SysConvert.ToString(e.Value) != string.Empty)
                                {
                                    UCDataSource.Rows[datasourceRow]["GoodsLevel"] = SysConvert.ToString(e.Value);
                                }
                                else
                                {
                                    UCDataSource.Rows[datasourceRow]["GoodsLevel"] = DBNull.Value;
                                }
                            }
                        }
                    }

                    DataSourceTotalCalc(e.RowHandle);//计算小计
                    DataSourceTotalInfoSet();
                }
            }
            catch (Exception E)
            {
                this.ShowMessage(E.Message);
            }
        }