From 5988d90fa9cf34d86e2e3e8b5311317f07f341a2 Mon Sep 17 00:00:00 2001
From: wangyi <2946747746@qq.com>
Date: 星期五, 26 十二月 2025 08:44:56 +0800
Subject: [PATCH] 1
---
WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs | 127 +++++++++++++++++++++++++++++++----------
1 files changed, 95 insertions(+), 32 deletions(-)
diff --git a/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs b/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs
index ba1fba1..ff2a970 100644
--- a/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs
+++ b/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs
@@ -618,6 +618,69 @@
}
#endregion
+ #region 閲囪喘鍏ュ簱鍗� - 鎵樻暟鍙樻洿鍔熻兘
+ [Route("Kf_POStockInBill/UpdatePallet")]
+ [HttpPost]
+ public object UpdatePallet([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 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
+ SET HPackQtys = {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>
/// 鏍规嵁鍩虹璧勬枡ID 鏌ユ壘璁板綍
@@ -2115,39 +2178,39 @@
List<ClsKf_ICStockBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsKf_ICStockBillSub>>(entry);
// 鍒ゆ柇 鏁版嵁搴撲腑鏄惁瀛樺湪id鍜屽崟鎹彿鐩哥瓑鐨勫崟鎹紝瀛樺湪锛屽垯閲嶅缓锛屽彧鏈塱d鍙风浉绛夛紝鍒欑敵璇锋柊鐨刬d鍙�
- // var ds1 = oCN.RunProcReturn($@"
- // select hmainid HInterID, 鍗曟嵁鍙� HBillNO from h_v_Kf_POStockInBillList where hmainid = {mainList[0].HInterID}
- // ", "h_v_Kf_POStockInBillList");
- // var HInterID_Old = mainList[0].HInterID;
- // if (ds1.Tables[0].Rows.Count > 0 && ds1.Tables[0].Rows[0]["HInterID"] != null)
- // {
- // if (string.Equals(ds1.Tables[0].Rows[0]["HBillNo"].ToString(), mainList[0].HBillNo, StringComparison.OrdinalIgnoreCase))
- // {
- // string sql = string.Empty;
- // sql = $"delete Kf_ICStockBillMain where HinterID = {mainList[0].HInterID}";
- // oCN.RunProc(sql);
- // sql = $"delete Kf_ICStockBillSub where HinterID = {mainList[0].HInterID}";
- // oCN.RunProc(sql);
- // }
- // else
- // {
- // // 閲嶆柊鐢宠HInterID
- // var HInterID_Exch = DBUtility.ClsPub.CreateBillID("1201", ref DBUtility.ClsPub.sExeReturnInfo);
- // mainList[0].HInterID = HInterID_Exch;
- //
- // foreach (var oSub in subList)
- // {
- // oSub.HInterID = HInterID_Exch;
- // }
- //
- // }
- // }
+ var ds1 = oCN.RunProcReturn($@"
+ select hmainid HInterID, 鍗曟嵁鍙� HBillNO from h_v_Kf_POStockInBillList where hmainid = {mainList[0].HInterID}
+ ", "h_v_Kf_POStockInBillList");
+ var HInterID_Old = mainList[0].HInterID;
+ if (ds1.Tables[0].Rows.Count > 0 && ds1.Tables[0].Rows[0]["HInterID"] != null)
+ {
+ if (string.Equals(ds1.Tables[0].Rows[0]["HBillNo"].ToString(), mainList[0].HBillNo, StringComparison.OrdinalIgnoreCase))
+ {
+ string sql = string.Empty;
+ sql = $"delete Kf_ICStockBillMain where HinterID = {mainList[0].HInterID}";
+ oCN.RunProc(sql);
+ sql = $"delete Kf_ICStockBillSub where HinterID = {mainList[0].HInterID}";
+ oCN.RunProc(sql);
+ }
+ else
+ {
+ // 閲嶆柊鐢宠HInterID
+ var HInterID_Exch = DBUtility.ClsPub.CreateBillID("1201", ref DBUtility.ClsPub.sExeReturnInfo);
+ mainList[0].HInterID = HInterID_Exch;
+
+ foreach (var oSub in subList)
+ {
+ oSub.HInterID = HInterID_Exch;
+ }
+
+ }
+ }
- string sql = string.Empty;
- sql = $"delete Kf_ICStockBillMain where HinterID = {mainList[0].HInterID}";
- oCN.RunProc(sql);
- sql = $"delete Kf_ICStockBillSub where HinterID = {mainList[0].HInterID}";
- oCN.RunProc(sql);
+ // string sql = string.Empty;
+ // sql = $"delete Kf_ICStockBillMain where HinterID = {mainList[0].HInterID}";
+ // oCN.RunProc(sql);
+ // sql = $"delete Kf_ICStockBillSub where HinterID = {mainList[0].HInterID}";
+ // oCN.RunProc(sql);
// 涓昏〃鎻掑叆
oCN.RunProc($@"Insert Into Kf_ICStockBillMain
(
--
Gitblit v1.9.1