From ec622206f5adcbd7cb96f06d75ec03e6dc83a7fd Mon Sep 17 00:00:00 2001
From: zrg <z1873@LAPTOP-EAVL132E>
Date: 星期二, 07 四月 2026 12:39:35 +0800
Subject: [PATCH] 1
---
WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs | 261 +++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 238 insertions(+), 23 deletions(-)
diff --git a/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs b/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs
index ff2a970..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,7 +799,6 @@
}
}
#endregion
-
#region 閲囪喘鍏ュ簱鍗� - 鎵樻暟鍙樻洿鍔熻兘
[Route("Kf_POStockInBill/UpdatePallet")]
[HttpPost]
@@ -632,35 +813,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 +846,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