From 14bab3ef497965e21ef8f6eac144d0b403e4c073 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期一, 17 二月 2025 17:32:07 +0800
Subject: [PATCH] 优化首巡末检自动返回检验方案
---
WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormBillController.cs | 181 ++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 168 insertions(+), 13 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 64463ce..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
@@ -169,6 +169,9 @@
try
{
+ Stopwatch sw = new Stopwatch();//璁℃椂鍣�
+ sw.Start();//寮�濮嬭鏃�
+
if (!DBUtility.ClsPub.Security_Log("Sc_WorkBillSortBill_Edit", 1, false, user))
{
objJsonResult.code = "0";
@@ -198,9 +201,8 @@
string sReturn = "";
oSystemParameter.ShowBill(ref sReturn);
-
for (int i = 0; i < list.Count; i++)
- {
+ {
TrueCount = 0;
SumCount = 0;
long HInterID = 0;
@@ -248,10 +250,10 @@
objJsonResult.data = null;
return objJsonResult;
}
- }
-
- ds = oCN.RunProcReturn($"select * from Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" +
+ }
+ ds = oCN.RunProcReturn($"select HInterID,HICMOBillNo from Sc_WorkBillSortBillMain with(nolock) where HMainSourceInterID={HMainSourceInterID}" +
$" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", "Sc_WorkBillSortBillMain");
+
if (ds.Tables[0].Rows.Count > 0)
{
objJsonResult.code = "0";
@@ -331,7 +333,7 @@
return objJsonResult;
}
- ds = oCN.RunProcReturn($"select * from Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" +
+ ds = oCN.RunProcReturn($"select HInterID,HICMOBillNo from Sc_WorkBillSortBillMain with(nolock) where HMainSourceInterID={HMainSourceInterID}" +
$" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", "Sc_WorkBillSortBillMain");
if (ds.Tables[0].Rows.Count > 1)
@@ -355,7 +357,25 @@
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 == "娣诲悍绉戞妧") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤
+ {
+ SumDay = 180;
+ }
LogService.CustomWriteLog("2.3:" + i, DateTime.Now.ToString("yyyy-MM-dd"));
for (int j = 0; j < SumDay; j++)
@@ -376,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]);
@@ -393,6 +413,8 @@
objJsonResult.data = null;
return objJsonResult;
}
+
+
}
LogService.CustomWriteLog("2.5:", DateTime.Now.ToString("yyyy-MM-dd"));
@@ -401,6 +423,8 @@
oCN.RunProc("exec REALESE_SC_ICMOBILLSTATUS_TMP");
LogService.CustomWriteLog("2.6:", DateTime.Now.ToString("yyyy-MM-dd"));
+ sw.Stop();//缁撴潫璁℃椂
+ LogService.Write($"========================1.鎺掍骇璁㈠崟鎬荤敤鏃讹細" + sw.Elapsed);
objJsonResult.code = "1";
objJsonResult.count = 1;
@@ -421,7 +445,7 @@
public json AddBillSub(string HInterID, string HBillNo, DateTime date, double HQTY, Dictionary<string, string> dic)
{
//鑾峰彇琛ㄦ牸鏁版嵁
- ds = oCN.RunProcReturn($"select * from h_v_JIT_Sc_WorkBillSortBillList where 鍗曟嵁鍙�='{HBillNo}'", "h_v_JIT_Sc_WorkBillSortBillList");
+ ds = oCN.RunProcReturn($"select * from h_v_JIT_Sc_WorkBillSortBill_PC where 鍗曟嵁鍙�='{HBillNo}'", "h_v_JIT_Sc_WorkBillSortBill_PC");
int count = 0;
if (ds.Tables[0].Rows.Count > 0)
{
@@ -444,6 +468,15 @@
"HMasterDate,HQty,HUseTimes)" +
$"values({HInterID}, {(ds.Tables[0].Rows.Count + 1)}," +
$" '{date}', {HQTY},{ ((dic["灏忔椂浜ц兘"] == "0.0000" ? 0 : dic["灏忔椂浜ц兘"] == "0" ? 0 : HQTY / float.Parse(dic["灏忔椂浜ц兘"].ToString())).ToString() == "闈炴暟瀛�" ? 0 : dic["灏忔椂浜ц兘"] == "0.0000" ? 0 : dic["灏忔椂浜ц兘"] == "0" ? 0 : HQTY / float.Parse(dic["灏忔椂浜ц兘"].ToString())) })");
+ }
+
+ string sReturn = "";
+ oSystemParameter.ShowBill(ref sReturn);
+ if (oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤
+ {
+ //鎶婃帓浜ц鍗曞畬宸ユ棩鏈熷弽鍐欏埌閲戣澏閿�鍞鍗曚笂
+ string sql = "exec h_p_JIT_UpdateEndDateToERP " + HInterID + ",'" + HBillNo + "'";
+ oCN.RunProc(sql);
}
objJsonResult.code = "1";
@@ -2623,6 +2656,58 @@
}
#endregion
+ #region 鐢熶骇鏃ヨ鍒掑钩鍙� 閿佸畾宸ュ崟
+ [Route("JIT_DayPlanPlatFormBill/JIT_DayPlanPlatFormBillHLockedOrder")]
+ [HttpGet]
+ public object JIT_DayPlanPlatFormBillHLockedOrder(string HInterIDs)
+ {
+ try
+ {
+ oCN.RunProc($"update Sc_WorkBillSortBillMain set HLockOrder = 1 where HInterID in ({HInterIDs})");
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 鐢熶骇鏃ヨ鍒掑钩鍙� 瑙i攣宸ュ崟
+ [Route("JIT_DayPlanPlatFormBill/JIT_DayPlanPlatFormBillHUnlockOrder")]
+ [HttpGet]
+ public object JIT_DayPlanPlatFormBillHUnlockOrder(string HInterIDs)
+ {
+ try
+ {
+ oCN.RunProc($"update Sc_WorkBillSortBillMain set HLockOrder = 0 where HInterID in ({HInterIDs})");
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
#region 鐢熶骇鏃ヨ鍒掑钩鍙� 鐢熶骇璁㈠崟鏌ヨ
[Route("JIT_DayPlanPlatFormBill/JIT_ICMOBillList")]
[HttpGet]
@@ -2863,16 +2948,31 @@
{
try
{
+ //鑾峰彇鏄剧ず绯荤粺鍙傛暟
+ string sReturn = "";
+ oSystemParameter.ShowBill(ref sReturn);
+
//鏌ヨ閫夋嫨杞﹂棿涓湭鎺掍骇杩囩殑鐢熶骇璁㈠崟淇℃伅锛堟坊搴风鎶�--鐢熶骇璁㈠崟鐘舵�佷负涓嬭揪锛�
ds = oCN.RunProcReturn($"exec h_p_JIT_ICMOBillListByDept '{HDeptID}'", "h_p_JIT_ICMOBillListByDept");
if (ds.Tables[0].Rows.Count > 0 && ds != null)
{
- //鏁版嵁琛ㄦ牸娣诲姞鍔ㄦ�佹棩鏈�
- for (int j = 1; j <= 31; j++)
+ if (oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤
{
- ds.Tables[0].Columns.Add(DateTime.Now.AddDays(j - 1).ToString("yyyy-MM-dd"), typeof(Int32));
+ //鏁版嵁琛ㄦ牸娣诲姞鍔ㄦ�佹棩鏈�
+ for (int j = 1; j <= 180; j++)
+ {
+ ds.Tables[0].Columns.Add(DateTime.Now.AddDays(j - 1).ToString("yyyy-MM-dd"), typeof(Int32));
+ }
}
+ else
+ {
+ //鏁版嵁琛ㄦ牸娣诲姞鍔ㄦ�佹棩鏈�
+ for (int j = 1; j <= 31; j++)
+ {
+ ds.Tables[0].Columns.Add(DateTime.Now.AddDays(j - 1).ToString("yyyy-MM-dd"), typeof(Int32));
+ }
+ }
objJsonResult.code = "1";
objJsonResult.count = 1;
@@ -2900,5 +3000,60 @@
}
}
#endregion
+
+ #region 鐢熶骇鏃ヨ鍒掑钩鍙� 鑾峰彇瀹屽伐鏃ユ湡
+ [Route("JIT_DayPlanPlatFormBill/GetICMOCompletionDate")]
+ [HttpGet]
+ public object GetICMOCompletionDate(string HDeptID)
+ {
+ try
+ {
+ //鏇存柊鏃ヨ鍒掑伐鍗曠殑瀹屽伐鏃ユ湡
+ oCN.RunProc($"exec h_p_JIT_GetICMOCompletionDate '{HDeptID}'");
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鑾峰彇瀹屽伐鏃ユ湡鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 鐢熶骇鏃ヨ鍒掑钩鍙� 鑾峰彇鏈�鏃╁紑宸ユ棩鏈�
+ [Route("JIT_DayPlanPlatFormBill/GetICMOEarlyDate")]
+ [HttpGet]
+ public object GetICMOEarlyDate(string HDeptID)
+ {
+ try
+ {
+ //鏇存柊鐢熶骇璁㈠崟鐨勬渶鏃╁紑宸ユ棩鏈�
+ oCN.RunProc($"exec h_p_JIT_GetICMOEarlyDate '{HDeptID}'");
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鑾峰彇鏈�鏃╁紑宸ユ棩鏈熸垚鍔燂紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
}
}
\ No newline at end of file
--
Gitblit v1.9.1