cdk
2025-09-22 e7ce5805983cac708c2feb2d60dbf90eedfa123d
DevApp/Gs.DevApp/DevFrm/Rpt/RptQT.cs
@@ -1,6 +1,5 @@
using DevExpress.Pdf.Native.BouncyCastle.Utilities.Collections;
using DevExpress.Utils;
using DevExpress.Utils.DirectXPaint;
using DevExpress.XtraGrid.Views.Grid;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Gs.DevApp.UserControl;
@@ -9,7 +8,7 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlTypes;
using System.Drawing;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -23,6 +22,7 @@
        public RptQT()
        {
            InitializeComponent();
            gridView2.RowCellStyle += gridView2_RowCellStyle;
            this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
            this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
            this.toolBarMenu1.getXmlConfig();
@@ -31,6 +31,7 @@
            // 添加gridView1的行选择变化事件
            gridView1.FocusedRowChanged += GridView1_FocusedRowChanged;
            // 设置gridView2参数
            gridView1.RowCellStyle += gridView1_RowCellStyle;
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gridView2);
            Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
            {
@@ -236,5 +237,46 @@
                ToolBox.MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
        private void gridView1_RowCellStyle(object sender, RowCellStyleEventArgs e)
        {
            // 确保只处理minQT列
            if (e.Column.FieldName == "minQT")
            {
                // 获取当前行的数据
                DataRowView row = gridView1.GetRow(e.RowHandle) as DataRowView;
                if (row != null && row["minQT"] != DBNull.Value)
                {
                    double minQT = Convert.ToDouble(row["minQT"]);
                    if (minQT < 1.0)
                    {
                        e.Appearance.ForeColor = Color.Red;
                    }
                }
            }
        }
        private void gridView2_RowCellStyle(object sender, RowCellStyleEventArgs e)
        {
            // 确保只处理qtNum列
            if (e.Column.FieldName == "qtNum")
            {
                // 获取当前行的数据
                DataRowView row = gridView2.GetRow(e.RowHandle) as DataRowView;
                if (row != null)
                {
                    // 检查qtNum值是否小于1(100%)
                    if (row["qtNum"] != DBNull.Value)
                    {
                        double qtNum = Convert.ToDouble(row["qtNum"]);
                        if (qtNum < 1.0)
                        {
                            e.Appearance.ForeColor = Color.Red;
                        }
                    }
                }
            }
        }
    }
}