From 9ec7cf906a983509fccd9ab360e1ac0e46a904eb Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期六, 12 四月 2025 15:38:48 +0800
Subject: [PATCH] 生产退料

---
 DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 55 insertions(+), 5 deletions(-)

diff --git a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
index 37f6cca..65c3af7 100644
--- a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
+++ b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
@@ -17,7 +17,6 @@
 using DevExpress.Utils;
 using DevExpress.XtraEditors;
 using DevExpress.XtraEditors.Controls;
-using DevExpress.XtraEditors.Repository;
 using DevExpress.XtraGrid;
 using DevExpress.XtraGrid.Columns;
 using DevExpress.XtraGrid.Menu;
@@ -1692,7 +1691,7 @@
         /// <param name="fileName">瀛楁</param>
         /// <param name="icoName">鍥炬爣璺緞</param>
         /// <param name="action"></param>
-        public static void SetGridViewParameter(GridView gridView1, PictureBox picCheckBox = null, Form fm = null, string fileName = "checkStatus", string icoName = "", DelegateGetModel action = null, DevExpress.Utils.ToolTipController tips = null,bool isSearch=true)
+        public static void SetGridViewParameter(GridView gridView1, PictureBox picCheckBox = null, Form fm = null, string fileName = "checkStatus", string icoName = "", DelegateGetModel action = null, DevExpress.Utils.ToolTipController tips = null, bool isSearch = true)
         {
             gridView1.PopupMenuShowing += (s, e) =>
             {
@@ -1715,7 +1714,8 @@
             };
             gridView1.OptionsView.ColumnAutoWidth = false;//鑷姩璋冩暣鍒楀
 
-            if (isSearch == true) {
+            if (isSearch == true)
+            {
                 gridView1.OptionsView.ShowGroupPanel = false;
                 gridView1.OptionsCustomization.AllowGroup = false;
                 gridView1.OptionsFilter.AllowAutoFilterConditionChange = DevExpress.Utils.DefaultBoolean.False;
@@ -1753,7 +1753,7 @@
                         column.OptionsFilter.AllowAutoFilter = false;
                 }
             }
-         
+
             gridView1.IndicatorWidth = 50;
             gridView1.CustomDrawRowIndicator += (s, e) =>
             {
@@ -1885,7 +1885,7 @@
                     column.Width = 500;
             }
         }
-      
+
         /// <summary>
         /// 璁剧疆閫夐」鍗�
         /// </summary>
@@ -2032,6 +2032,56 @@
             bool isNumeric = decimal.TryParse(input, out number);
             return isNumeric;
         }
+
+        public static void PrintJiSuan(Form fm, DevExpress.XtraEditors.TextEdit box1, DevExpress.XtraEditors.TextEdit box2, string sum, DevExpress.XtraEditors.RadioGroup rd)
+        {
+            if (rd.SelectedIndex == 2)
+                return;
+            try
+            {
+                if (fm.ActiveControl is DevExpress.XtraEditors.TextEdit textBox)
+                {
+                    if (textBox.Name != box1.Name)
+                        return;
+                }
+                string t1 = box1.Text.Trim();
+                string t2 = box2.Text.Trim();
+                if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric2(t1))
+                    return;
+                decimal? dc = Gs.DevApp.ToolBox.UtilityHelper.GetDecimal(sum);
+                decimal? dc1 = Gs.DevApp.ToolBox.UtilityHelper.GetDecimal(t1);
+
+                int dividend = int.Parse(sum); // 琚櫎鏁�
+                int divisor = int.Parse(t1);   // 闄ゆ暟
+
+                int quotient = dividend / divisor; // 鏁存暟閮ㄥ垎
+                int remainder = dividend % divisor; // 浣欐暟
+
+                box2.Text = quotient.ToString();
+
+                if (rd.SelectedIndex == 0)
+                    rd.Properties.Items[0].Description = "鍏ㄨ嚜鍔ㄣ��" + remainder.ToString() + "銆�";
+            }
+            catch (Exception ex)
+            {
+
+                Gs.DevApp.ToolBox.MsgHelper.ShowError(ex.Message);
+            }
+
+        }
+
+        public static decimal PrintYuLiang(DevExpress.XtraEditors.RadioGroup rd)
+        {
+            decimal dc = 0;
+            if (rd.SelectedIndex != 0)
+                return 0;
+            string txt = rd.Properties.Items[0].Description;// = "鍏ㄨ嚜鍔ㄣ��" + remainder.ToString() + "銆�";
+            txt = txt.Trim().Replace("鍏ㄨ嚜鍔ㄣ��", "");
+            txt = txt.Replace("銆�", "");
+            if (string.IsNullOrEmpty(txt))
+                return 0;
+            return decimal.Parse(txt);
+        }
     }
 
     /// <summary>

--
Gitblit v1.9.3