From 9124a9b2e9f4a041da4509039c65a70cc81dd033 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期五, 16 五月 2025 15:49:58 +0800
Subject: [PATCH] 组织物料启动检查项目防错装置优化

---
 WebAPI/Controllers/WebAPIController.cs |   85 ++++++++++++++++++++++++++++++------------
 1 files changed, 60 insertions(+), 25 deletions(-)

diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index 914c003..0305209 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -14637,7 +14637,7 @@
                     }
                     //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
 
-                    ds = oCN.RunProcReturn("select * from  Gy_PreventErrMould where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_PreventErrMould");
+                    //ds = oCN.RunProcReturn("select * from  Gy_PreventErrMould where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_PreventErrMould");
                     if (oItem.HNumber.Trim() == "")
                     {
                         objJsonResult.code = "0";
@@ -14646,21 +14646,32 @@
                         objJsonResult.data = 1;
                         return objJsonResult;
                     }
+                    //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
+                    ds = oCN.RunProcReturn("Select HItemID from Gy_PreventErrMould  Where HItemID<>" + oItem.HItemID + " and HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID=" + oItem.HUSEORGID, "Gy_PreventErrMould");
+
+                    if (ds.Tables[0].Rows.Count > 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
                     //鏂板鏃跺垽鏂�
                     if (oItem.HItemID == 0)
                     {
-                        if (ds == null || ds.Tables[0].Rows.Count == 0)
-                        {
+                        //if (ds == null || ds.Tables[0].Rows.Count == 0)
+                        //{
 
-                        }
-                        else
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
-                            objJsonResult.data = 1;
-                            return objJsonResult;
-                        }
+                        //}
+                        //else
+                        //{
+                        //    objJsonResult.code = "0";
+                        //    objJsonResult.count = 0;
+                        //    objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                        //    objJsonResult.data = 1;
+                        //    return objJsonResult;
+                        //}
                         //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
                         string sParent;
                         sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
@@ -14686,6 +14697,18 @@
                     }
                     else//缂栬緫鏃跺垽鏂�
                     {
+                        //宸插鏍镐笉鍏佽淇敼
+                        DataSet dss;
+                        dss = oCN.RunProcReturn("select * from Gy_PreventErrMould where HItemID=" + oItem.HItemID, "Gy_PreventErrMould");
+                        //鍒ゆ柇鏄惁鍙紪杈�
+                        if (dss.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹姸鎬佸凡缁忓鏍革紝涓嶅厑璁镐慨鏀癸紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
                         //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
                         string sParent;
                         sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
@@ -15275,7 +15298,7 @@
                     }
                     //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
 
-                    ds = oCN.RunProcReturn("select * from  Gy_CheckNoteItem where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_CheckNoteItem");
+                    //ds = oCN.RunProcReturn("select * from  Gy_CheckNoteItem where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_CheckNoteItem");
                     if (oItem.HNumber.Trim() == "")
                     {
                         objJsonResult.code = "0";
@@ -15284,21 +15307,21 @@
                         objJsonResult.data = 1;
                         return objJsonResult;
                     }
+                    //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
+                    ds = oCN.RunProcReturn("Select HItemID from Gy_CheckNoteItem  Where HItemID<>" + oItem.HItemID + " and HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID=" + oItem.HUSEORGID, "Gy_CheckNoteItem");
+
+                    if (ds.Tables[0].Rows.Count > 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
                     //鏂板鏃跺垽鏂�
                     if (oItem.HItemID == 0)
                     {
-                        if (ds == null || ds.Tables[0].Rows.Count == 0)
-                        {
-
-                        }
-                        else
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
-                            objJsonResult.data = 1;
-                            return objJsonResult;
-                        }
+                        
                         //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
                         string sParent;
                         sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
@@ -15324,6 +15347,18 @@
                     }
                     else//缂栬緫鏃跺垽鏂�
                     {
+                        //宸插鏍镐笉鍏佽淇敼
+                        DataSet dss;
+                        dss = oCN.RunProcReturn("select * from Gy_CheckNoteItem where HItemID=" + oItem.HItemID, "Gy_CheckNoteItem");
+                        //鍒ゆ柇鏄惁鍙紪杈�
+                        if (dss.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹姸鎬佸凡缁忓鏍革紝涓嶅厑璁镐慨鏀癸紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
                         //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
                         string sParent;
                         sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());

--
Gitblit v1.9.1