From b42dcfe29398938b639d607b53bed95d953c262f Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期一, 12 五月 2025 17:45:04 +0800
Subject: [PATCH] bug修改

---
 DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs |   31 +++++++++++++++++++++----------
 1 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
index 4102f34..b968cb5 100644
--- a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
+++ b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
@@ -2113,6 +2113,15 @@
                 return true;
             return false;
         }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="box1">txt_psnQty_1:姣忓紶鏉$爜鏁伴噺</param>
+        /// <param name="box2">txt_iCount_1:鏁村紶鏁板��</param>
+        /// <param name="sum">txt_kQty:鍙墦鍗伴噺</param>
+        /// <param name="rd"></param>
+        /// <param name="txt_yuliang">txt_yuliang:浣欓噺</param>
         public static void PrintJiSuan(DevExpress.XtraEditors.TextEdit box1, DevExpress.XtraEditors.TextEdit box2, string sum, DevExpress.XtraEditors.RadioGroup rd, DevExpress.XtraEditors.TextEdit txt_yuliang = null)
         {
             if (rd.SelectedIndex == 2)
@@ -2123,25 +2132,27 @@
                 string t2 = box2.Text.Trim();
                 if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric2(t1))
                     return;
+                if (Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(t1) <= 0)
+                    return;
                 decimal? dc = Gs.DevApp.ToolBox.UtilityHelper.GetDecimal(sum);
                 decimal? dc1 = Gs.DevApp.ToolBox.UtilityHelper.GetDecimal(t1);
+                decimal dividend = decimal.Parse(sum); // 琚櫎鏁�
+                decimal divisor = decimal.Parse(t1);   // 闄ゆ暟
+                decimal shang = dividend / divisor;
 
-                int dividend = int.Parse(sum); // 琚櫎鏁�
-                int divisor = int.Parse(t1);   // 闄ゆ暟
+                decimal integerPart = Math.Truncate(shang); // 鑾峰彇鏁存暟閮ㄥ垎
+                decimal decimalPart = dividend - divisor* integerPart; // 鑾峰彇灏忔暟閮ㄥ垎
 
-                int quotient = dividend / divisor; // 鏁存暟閮ㄥ垎
-                int remainder = dividend % divisor; // 浣欐暟
-
-                box2.Text = quotient.ToString();
-
+                //decimal quotient = dividend / divisor; // 鏁存暟閮ㄥ垎
+                //decimal remainder = dividend % divisor; // 浣欐暟
+                box2.Text = integerPart.ToString();
                 if (rd.SelectedIndex == 0)
-                    txt_yuliang.Text = remainder.ToString();
+                    txt_yuliang.Text = decimalPart.ToString();
             }
             catch (Exception ex)
             {
-                Gs.DevApp.ToolBox.MsgHelper.ShowError(ex.Message);
+              Gs.DevApp.ToolBox.MsgHelper.ShowError("杈撳叆鏁版嵁閿欒:"+ex.Message);
             }
-
         }
         public static void PrintAuto(DevExpress.XtraEditors.TextEdit txt_psnQty_1, DevExpress.XtraEditors.TextEdit txt_iCount_1, DevExpress.XtraEditors.RadioGroup radOut, DevExpress.XtraEditors.TextEdit txt_yuliang = null)
         {

--
Gitblit v1.9.3