From aca2ad77dd242fb9fe223b6cc30bbcf69e9a6eab Mon Sep 17 00:00:00 2001
From: wangyi <2946747746@qq.com>
Date: 星期三, 25 三月 2026 15:08:54 +0800
Subject: [PATCH] 托数字段修改

---
 WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs |   79 ++++++++++++++++++++++++++++-----------
 1 files changed, 56 insertions(+), 23 deletions(-)

diff --git a/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs b/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs
index ff2a970..57900c6 100644
--- a/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs
+++ b/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs
@@ -1,6 +1,5 @@
 锘縰sing Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
-using NPOI.SS.Formula.Functions;
 using Pub_Class;
 using System;
 using System.Collections;
@@ -9,6 +8,7 @@
 using System.Data.SqlClient;
 using System.Web.Http;
 using WebAPI.Models;
+using System.Windows.Forms;
 using SyntacticSugar.constant;
 
 namespace WebAPI.Controllers
@@ -617,7 +617,6 @@
             }
         }
         #endregion
-
         #region 閲囪喘鍏ュ簱鍗� - 鎵樻暟鍙樻洿鍔熻兘
         [Route("Kf_POStockInBill/UpdatePallet")]
         [HttpPost]
@@ -632,35 +631,20 @@
                 if (hmainid <= 0)
                     return new { code = "0", count = 0, Message = "鍗曟嵁ID涓嶈兘涓虹┖锛�" };
 
-                if (newPallet <= 0)
-                    return new { code = "0", count = 0, Message = "鎵樻暟蹇呴』澶т簬0锛�" };
+                if (newPallet < 0)
+                    return new { code = "0", count = 0, Message = "鎵樻暟涓嶈兘涓鸿礋鏁帮紒" };
 
-                // 妫�鏌ユ槸鍚﹀凡瀹℃牳
-                string checkAuditSql = $@"
-                    SELECT COUNT(*) as HasAudit 
-                    FROM Kf_ICStockBillMain 
-                    WHERE HInterID = {hmainid} 
-                    AND HChecker IS NOT NULL 
-                    AND HCheckDate IS NOT NULL";
 
-                DataSet dsAudit = oCN.RunProcReturn(checkAuditSql, "CheckAudit");
 
-                if (dsAudit != null && dsAudit.Tables[0].Rows.Count > 0)
-                {
-                    int hasAudit = Convert.ToInt32(dsAudit.Tables[0].Rows[0]["HasAudit"]);
-                    if (hasAudit > 0)
-                    {
-                        return new { code = "0", count = 0, Message = "鍗曟嵁宸插鏍革紝涓嶈兘淇敼鎵樻暟锛�" };
-                    }
-                }
 
-                // 鐩存帴鏇存柊鎵樻暟锛屼笉妫�鏌ヨ繑鍥炲��
+                // 鐩存帴鏇存柊鎵樻暟
                 string updateSql = $@"
-                    UPDATE Kf_ICStockBillMain 
+                    UPDATE  Kf_ICStockBillMain 
                     SET HPackQtys = {newPallet} 
                     WHERE HInterID = {hmainid}";
 
-                oCN.RunProc(updateSql); // 鐩存帴璋冪敤锛屼笉璧嬪�肩粰鍙橀噺
+
+                oCN.RunProc(updateSql);
 
                 return new
                 {
@@ -680,6 +664,55 @@
             }
         }
         #endregion
+        #region 閲囪喘鍏ュ簱鍗� - 璐存爣绛炬暟鍙樻洿鍔熻兘
+        [Route("Kf_POStockInBill/UpdateHTagCount")]
+        [HttpPost]
+        public object UpdateHTagCount([FromBody] JObject data)
+        {
+            try
+            {
+                long hmainid = data["hmainid"]?.ToObject<long>() ?? 0;
+                int newPallet = data["newPallet"]?.ToObject<int>() ?? 0;
+                string operatorName = data["operator"]?.ToString() ?? "";
+
+                if (hmainid <= 0)
+                    return new { code = "0", count = 0, Message = "鍗曟嵁ID涓嶈兘涓虹┖锛�" };
+
+                if (newPallet <= 0)
+                    return new { code = "0", count = 0, Message = "璐存爣绛炬暟蹇呴』澶т簬0锛�" };
+
+
+
+
+                // 鐩存帴鏇存柊鎵樻暟
+                string updateSql = $@"
+                    UPDATE  Kf_ICStockBillMain 
+                    SET HTagCount = {newPallet} 
+                    WHERE HInterID = {hmainid}";
+
+
+                oCN.RunProc(updateSql);
+
+                return new
+                {
+                    code = "1",
+                    count = 1,
+                    Message = "鎵樻暟淇敼鎴愬姛锛�"
+                };
+            }
+            catch (Exception e)
+            {
+                return new
+                {
+                    code = "0",
+                    count = 0,
+                    Message = "淇敼澶辫触锛�" + e.Message
+                };
+            }
+        }
+        #endregion
+
+
 
         #region 鏌ユ壘璁板綍鍔熻兘
         /// <summary>

--
Gitblit v1.9.1