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 | 344 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 311 insertions(+), 33 deletions(-)
diff --git a/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs b/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs
index ba1fba1..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>
@@ -2115,39 +2393,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