From 30a00c8bc8b9412b8088bc4f4c1519ed767f09d2 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期二, 29 四月 2025 16:54:24 +0800
Subject: [PATCH] 2025/4/29 提交

---
 WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormBillController.cs |  292 +++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 229 insertions(+), 63 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 6e89700..51d3fcb 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"
@@ -62,6 +62,54 @@
             }
         }
 
+        [Route("JIT_DayPlanPlatFormBill/JIT_DayPlanPlatFormBillListExtendMakeDate")]
+        [HttpGet]
+        public object JIT_DayPlanPlatFormBillListExtendMakeDate(string sWhere, string user)
+        {
+            try
+            {
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Sc_WorkBillSortBill_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                List<object> columnNameList = new List<object>();  //瀹氫箟澹版槑鍙橀噺 锛屾妸閫氳繃 new List<object>()鍒涘缓鐨� 瀹炰緥锛岃祴鍊肩粰鍙橀噺
+                omdelMian = JsonConvert.DeserializeObject<Sc_WorkBillSortBillMain>(sWhere);
+
+                ds = oCN.RunProcReturn($"exec h_p_JIT_Sc_WorkBillSortBill_Query_ExtendMakeDate '{omdelMian.HPlanBeginDate}',{(omdelMian.HProdORGID == null ? 0 : omdelMian.HProdORGID)},'{omdelMian.HSeOrderBillNo}'" +
+                    $",'{omdelMian.HPlanEndDate.AddDays(1)}',{omdelMian.HMaterID},'{omdelMian.HICMOBillNo}',{omdelMian.HWorkShopID}" +
+                    $",'{omdelMian.HMastersDate}','{ omdelMian.HMakeDate }','{omdelMian.sWheres}'", "h_p_JIT_Sc_WorkBillSortBill_QueryExtendMakeDate");
+
+
+                foreach (DataColumn col in ds.Tables[0].Columns)//閬嶅巻ds涓涓�涓〃锛圱ables[0]锛夌殑鎵�鏈夊垪锛圕olumns锛夋瘡娆″惊鐜腑锛宑ol鍙橀噺浼氭寔鏈夊綋鍓嶅垪鐨勫紩鐢�
+                {
+                    Type dataType = col.DataType; //鑾峰彇褰撳墠鏁版嵁绫诲瀷浼犲叆 鑷畾涔夊彉閲廳atadataType
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //瀛楃涓叉嫾鎺�         // 灏嗗垪鍚嶅拰鏁版嵁绫诲瀷淇℃伅鎷兼帴鎴愪竴涓狫SON鏍煎紡鐨勫瓧绗︿覆
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
         /// <summary>
         /// 鏍规嵁ID鏌ヨ 榻愬鐘舵�� 鍜� 閿佸畾鐘舵��
         /// </summary>
@@ -254,7 +302,7 @@
                             }
                         }
                         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");
+                            $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID} and ISNULL(HDeleteMan,'')=''", "Sc_WorkBillSortBillMain");
 
                         if (ds.Tables[0].Rows.Count > 0)
                         {
@@ -470,13 +518,13 @@
                         else
                         {
                             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");
+                             $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID} and ISNULL(HDeleteMan,'') = ''", "Sc_WorkBillSortBillMain");
 
                             if (ds.Tables[0].Rows.Count > 1)
                             {
                                 LogService.CustomWriteLog("绗�" + i + 1 + "琛岀敓浜ц祫婧愭湁閲嶅,璇蜂慨鏀�", DateTime.Now.ToString("yyyy-MM-dd"));
                                 LogService.CustomWriteLog($"select * from  Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" +
-                                  $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", DateTime.Now.ToString("yyyy-MM-dd"));
+                                  $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID} and ISNULL(HDeleteMan,'')=''", DateTime.Now.ToString("yyyy-MM-dd"));
                                 objJsonResult.code = "0";
                                 objJsonResult.count = 0;
                                 objJsonResult.Message = $"绗瑊i + 1}琛岀敓浜ц祫婧愭湁閲嶅,璇蜂慨鏀�!";
@@ -990,9 +1038,9 @@
         }
         #endregion
 
-        [Route("JIT_DayPlanPlatFormBill/JIT_CompleteSetAnalysis")]
-        [HttpGet]
-        public object JIT_CompleteSetAnalysis(string sWhere, string user)
+        #region 榻愬鍒嗘瀽    鍘熻皟鐢ㄦ柟娉�
+
+        public object JIT_CompleteSetAnalysis_Old(string sWhere, string user)
         {
             try
             {
@@ -1439,6 +1487,103 @@
                 return objJsonResult;
             }
         }
+
+        #endregion
+
+        #region 榻愬鍒嗘瀽璋冪敤鏂规硶    20250402
+
+        [Route("JIT_DayPlanPlatFormBill/JIT_CompleteSetAnalysis")]
+        [HttpGet]
+        public object JIT_CompleteSetAnalysis(string sWhere, string user)
+        {
+            try
+            {
+                string sErrMsg = "";
+                if (oSystemParameter.ShowBill(ref sErrMsg) == true)
+                {
+                    if (oSystemParameter.omodel.WMS_CampanyName == "甯呭▉"
+                        || oSystemParameter.omodel.WMS_CampanyName == "鍑礉濂堢壒"
+                        || oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧"
+                        || oSystemParameter.omodel.WMS_CampanyName == "瀹濆伐")     //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                    {
+                        objJsonResult = (json)JIT_CompleteSetAnalysis_Old(sWhere, user);
+                    }
+                    else
+                    {
+                        objJsonResult = (json)JIT_CompleteSetAnalysis_New(sWhere, user);
+                    }
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                LogService.Write("榻愬鍒嗘瀽鎿嶄綔澶辫触锛�" + e.Message.ToString());
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.Message.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        /// <summary>
+        /// 榻愬鍒嗘瀽    鏂拌皟鐢ㄦ柟娉�
+        /// </summary>
+        /// <returns></returns>
+        public object JIT_CompleteSetAnalysis_New(string sWhere, string user)
+        {
+            try
+            {
+                omdelMian = JsonConvert.DeserializeObject<Sc_WorkBillSortBillMain>(sWhere);
+                string HWorkShopID = omdelMian.HWorkShopID.ToString();
+                var HStockOrgID = omdelMian.HProdORGID;
+
+                ds = oCN.RunProcReturn("exec h_p_JIT_CompleteSetAnalysis " + HWorkShopID.ToString() + ",'" + user + "'," + HStockOrgID.ToString(), "h_p_JIT_CompleteSetAnalysis");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "榻愬鍒嗘瀽鍙戠敓閿欒锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);    //杩愮畻鎴愬姛
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "榻愬鍒嗘瀽澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        #endregion
+
         #endregion
 
         #region 鐢熶骇鏃ヨ鍒掑钩鍙� 鎻愭枡杩愮畻
@@ -1812,14 +1957,17 @@
                     if (oSystemParameter.omodel.WMS_CampanyName == "甯呭▉")
                     {
                         sqlName = "AIS20230129011339";
+                        WMS_CampanyName = "甯呭▉";
                     }
                     else if (oSystemParameter.omodel.WMS_CampanyName == "鍑礉濂堢壒")
                     {
                         sqlName = "AIS20210820164804";
+                        WMS_CampanyName = "鍑礉濂堢壒";
                     }
                     else if (oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧")
                     {
                         sqlName = "AIS20240809105013";
+                        WMS_CampanyName = "娣诲悍绉戞妧";
                     }
                     else if (oSystemParameter.omodel.WMS_CampanyName == "瀹濆伐")
                     {
@@ -1830,22 +1978,37 @@
                     {
                         sqlName = "AIS20210811135644";
                     }
-                }
 
-                if (WMS_CampanyName == "瀹濆伐")
-                {
-                    objJsonResult = (json)JIT_MOMaterLack(fProWorkShopId, fPrdOrgId, user, sqlName);
-                }
-                else if (HTLType == "缂烘枡")
-                {
-                    objJsonResult = (json)JIT_QL(fProWorkShopId, fPrdOrgId, user, sqlName);
-                }
-                else if (HTLType == "鐢熶骇鐢ㄦ枡娓呭崟")
-                {
-                 objJsonResult=(json)JIT_PPBOM(fProWorkShopId, fPrdOrgId, user, sqlName);
-                }
+                    if (WMS_CampanyName == "瀹濆伐")
+                    {
+                        objJsonResult = (json)JIT_MOMaterLack(fProWorkShopId, fPrdOrgId, user);
+                    }
+                    else if (HTLType == "缂烘枡")
+                    {
+                        if (WMS_CampanyName == "甯呭▉" || WMS_CampanyName == "鍑礉濂堢壒" || WMS_CampanyName == "娣诲悍绉戞妧")
+                        {
+                            objJsonResult = (json)JIT_QL(fProWorkShopId, fPrdOrgId, user, sqlName);
+                        }
+                        else
+                        {
+                            objJsonResult = (json)JIT_MOMaterReady(fProWorkShopId, fPrdOrgId, user);
+                        }
+                    }
+                    else if (HTLType == "鐢熶骇鐢ㄦ枡娓呭崟")
+                    {
+                        objJsonResult = (json)JIT_PPBOM(fProWorkShopId, fPrdOrgId, user, sqlName);
+                    }
 
-                return objJsonResult;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErr;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
             }
             catch (Exception e)
             {
@@ -2772,11 +2935,55 @@
         /// 閫氳繃娆犳枡琛�   绠楁彁鏂� 瀹濆伐
         /// </summary>
         /// <returns></returns>
-        public object JIT_MOMaterLack(string HWorkShopID, int? HProdORGID, string user, string sqlName)
+        public object JIT_MOMaterLack(string HWorkShopID, int? HProdORGID, string user)
         {
             try
             {
                 ds = oCN.RunProcReturn("exec h_p_JIT_PODemandPlanBill_MOMaterLack " + HWorkShopID.ToString() + ",'" + user + "'," + HProdORGID.ToString(), "h_p_JIT_PODemandPlanBill_MOMaterLack");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎻愭枡杩愮畻鍙戠敓閿欒锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);    //杩愮畻鎴愬姛
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎻愭枡杩愮畻澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        /// <summary>
+        /// 閫氳繃榻愬琛�   绠楁彁鏂�
+        /// </summary>
+        /// <returns></returns>
+        public object JIT_MOMaterReady(string HWorkShopID, int? HProdORGID, string user)
+        {
+            try
+            {
+                ds = oCN.RunProcReturn("exec h_p_JIT_PODemandPlanBill_MOMaterReady " + HWorkShopID.ToString() + ",'" + user + "'," + HProdORGID.ToString(), "h_p_JIT_PODemandPlanBill_MOMaterReady");
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
@@ -3455,48 +3662,7 @@
         }
         #endregion
 
-        #region 宸ュ簭璐熻嵎鍒嗘瀽姹囨�绘姤琛� 鏌ヨ
-        /// <summary>
-        /// 杩斿洖椤圭洰闃舵鍒楄〃
-        ///鍙傛暟锛歴tring sql銆�
-        ///杩斿洖鍊硷細object銆�
-        /// </summary>
-        [Route("JIT_DayPlanPlatFormBill/JIT_FuHeFenXiReport")]
-        [HttpGet]
-        public object JIT_FuHeFenXiReport(string sWhere, string user)
-        {
-            try
-            {
-                List<object> columnNameList = new List<object>();
-                string sql = "exec h_p_JIT_FuHeFenXiReport   '" + sWhere + "','" + user + "'";
-
-                ds = oCN.RunProcReturn(sql, "h_p_JIT_FuHeFenXiReport");
-
-                //娣诲姞鍒楀悕
-                foreach (DataColumn col in ds.Tables[0].Columns)
-                {
-                    Type dataType = col.DataType;
-                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
-                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
-                }
-
-                objJsonResult.code = "1";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "Sucess锛�";
-                objJsonResult.data = ds.Tables[0];
-                objJsonResult.list = columnNameList;
-                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