From 8aa14bb80960d9698ca9b041347040a4fadce3de Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期二, 07 四月 2026 15:57:07 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs |  280 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 279 insertions(+), 1 deletions(-)

diff --git a/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs b/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs
index 038a859..3e0b57d 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
@@ -143,6 +143,188 @@
                 res.Message = "Exception锛�" + e.ToString();
                 res.data = null;
                 return res;
+            }
+        }
+        #endregion
+
+
+        #region 閲囪喘鍏ュ簱淇濆瓨
+        /// <summary>
+        /// 淇濆瓨閿�鍞嚭搴撳崟
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("Kf_POStockInBill/SaveSellOutBillList")]
+        [HttpPost]
+        public object SaveSellOutBillList([FromBody] JObject msg)
+        {
+            var _value = msg["msg"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();
+            string user = sArray[2].ToString();
+            string OperationType = sArray[3].ToString();
+
+            ListModels oListModels = new ListModels();
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                //if (!DBUtility.ClsPub.Security_Log("Kf_SellOutBill_Edit", 1, false, user))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犱繚瀛樻潈闄�";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+                DAL.ClsKf_POStockInBill1 oBill = new DAL.ClsKf_POStockInBill1();
+                List<Model.ClsKf_SellOutBillMain> lsmain = new List<Model.ClsKf_SellOutBillMain>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getSellOutBillMainByJson(msg2);
+                foreach (Model.ClsKf_SellOutBillMain oItem in lsmain)
+                {
+                    oItem.HMaker = user;
+                    oItem.HUpDater = user;
+
+                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    oBill.omodel = oItem;
+                }
+                //琛ㄤ綋鏁版嵁
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                msg3 = msg3.Substring(1, msg3.Length - 2);
+                msg3 = msg3.Replace("\\", "");
+                msg3 = msg3.Replace("\n", "");  //\n
+                List<Model.ClsKf_SellOutBillSub> ls = new List<Model.ClsKf_SellOutBillSub>();
+                ls = oListModels.getSellOutBillSubByJson(msg3);
+                int i = 0;
+                foreach (Model.ClsKf_SellOutBillSub oItemSub in ls)
+                {
+                    i++;
+                    oItemSub.HEntryID = i;
+                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                    oItemSub.HCloseType = false;
+                    oItemSub.HCloseMan = "";
+                    oBill.DetailColl.Add(oItemSub);
+                }
+
+                //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗
+                string s = "";
+                int sYear = 0;
+                int sPeriod = 0;
+                DateTime HDate = DateTime.Now;
+                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false)
+                {
+                    objJsonResult.Message = s;
+                    return objJsonResult;
+                }
+
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                bool bResult;
+                if (Convert.ToInt32(OperationType) == 1)                                //鏂板淇濆瓨
+                {
+                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                else if (Convert.ToInt32(OperationType) == 4)                          //涓嬫帹淇濆瓨
+                {
+                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                else                                                                    //缂栬緫淇濆瓨
+                {
+                    if (BillOld.ShowBill(lsmain[0].HInterID, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    //鍒ゆ柇鏄惁鍙紪杈�
+                    if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    if (BillOld.omodel.HBillStatus > 1)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld, ref s))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s + "锛屼笉鍏佽淇敼";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+
+                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+
+                //鑷姩瀹℃牳璁剧疆
+                if (Convert.ToInt32(OperationType) == 1 || Convert.ToInt32(OperationType) == 4)
+                {
+                    objJsonResult.HInterID = oBill.omodel.HInterID.ToString(); //杩斿洖涓籌D
+                    //绯荤粺鍙傛暟  鑷姩瀹℃牳
+                    string sReturn = "";
+                    if (oSystemParameter.ShowBill(ref sReturn) == true)
+                    {
+                        if (oSystemParameter.omodel.Kf_SellOutBill_AutoCheck == "Y") //绯荤粺鍙傛暟  鑷姩瀹℃牳 
+                        {
+                            objJsonResult.Verify = "Y";
+                        }
+                        else
+                        {
+                            objJsonResult.Verify = "N";
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.HInterID = oBill.omodel.HInterID.ToString(); //杩斿洖涓籌D
+                    objJsonResult.Verify = "N";
+                }
+
+                if (bResult)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
             }
         }
         #endregion
@@ -617,6 +799,102 @@
             }
         }
         #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 = "鎵樻暟涓嶈兘涓鸿礋鏁帮紒" };
+
+
+
+
+                // 鐩存帴鏇存柊鎵樻暟
+                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 閲囪喘鍏ュ簱鍗� - 璐存爣绛炬暟鍙樻洿鍔熻兘
+        [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