From 12aeb6195aee6ac5be2d3c984111941c7a0b1671 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期三, 12 二月 2025 13:53:33 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormBillController.cs |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs" "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs"
index 36ca496..d88b974 100644
--- "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs"
+++ "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs"
@@ -9,7 +9,7 @@
 using Newtonsoft.Json.Linq;
 using System.Diagnostics;
 using System.Threading;
-
+using System.Globalization;
 namespace WebAPI.Controllers.SCGL.鏃ヨ鍒掔鐞�
 {
     public class JIT_DayPlanPlatFormBillController : ApiController
@@ -357,7 +357,20 @@
 
                     oCN.RunProc($"update Sc_WorkBillSortBillMain set HDayPlanSumQty={list[i]["鏃ヨ鍒掓暟閲忔�婚噺"].ToString()} where HInterID={(HInterID==0?int.Parse(list[i]["hmainid"].ToString()):HInterID)} and HBillNo='{(HBillNo==""?list[i]["鍗曟嵁鍙�"].ToString(): HBillNo)}'");
 
-                    int SumDay = 31; //鍔ㄦ�佷袱鏈堜箣宸� DateTime.Now.AddMonths(1).AddDays(-1).Subtract(DateTime.Now).Days;
+                    int SumDay = 0; //鍔ㄦ�佷袱鏈堜箣宸� DateTime.Now.AddMonths(1).AddDays(-1).Subtract(DateTime.Now).Days;
+
+                    // 缁熻鎬诲ぉ鏁�
+                    HashSet<DateTime> uniqueDates = new HashSet<DateTime>();
+
+                    foreach (var key in list[i].Keys)
+                    {
+                        if (DateTime.TryParseExact(key, "yyyy-M-d", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime date))
+                        {
+                            uniqueDates.Add(date);
+                        }
+                    }
+
+                    SumDay = uniqueDates.Count;
 
                     if (oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
                     {
@@ -383,7 +396,7 @@
                             }
                         }
                         //涓昏〃鏈夋暟鎹� 瀛愯〃鏃犳暟鎹�
-                        if (j == 30 && SumCount == 0 && HInterID != 0 && HBillNo != "")
+                        if (j == SumDay-1 && SumCount == 0 && HInterID != 0 && HBillNo != "")
                         {
                             //LogService.CustomWriteLog("3:"+ HInterID+","+ HBillNo, DateTime.Now.ToString("yyyy-MM-dd"));
                             objJsonResult = AddBillSub(HInterID.ToString(), HBillNo, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd").ToString()), 0, list[i]);

--
Gitblit v1.9.1