From 0a667f1827405b9190f7dd0c242126c6f62e6448 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期三, 26 二月 2025 10:32:11 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/BaseSet/Gy_MaterialController.cs |  113 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 110 insertions(+), 3 deletions(-)

diff --git a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
index f729bb2..d034440 100644
--- a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
@@ -134,12 +134,14 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
+
                 if (sWhere == null || sWhere.Equals(""))
                 {
                     ds = oCN.RunProcReturn("exec h_p_Gy_MaterialList " + page + "," + size + ",'" + Organization +"'," + "''", "h_p_Gy_MaterialList");
                 }
                 else
                 {
+                    sWhere = sWhere.Replace("'", "''");
                     ds = oCN.RunProcReturn("exec h_p_Gy_MaterialList " + page + "," + size + ",'" + Organization + "','" + sWhere + "'", "h_p_Gy_MaterialList");
                 }
 
@@ -1433,6 +1435,63 @@
             }
         }
 
+        #region 妯″叿鍒楄〃鍒嗛〉鍒楄〃
+        [Route("Gy_Mould/page")]
+        [HttpGet]
+        public object Gy_MouldPage(string sWhere,string ModRightNameSelect,string user, int page, int size)
+        {
+            DataSet ds;
+            json res = new json();
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameSelect, 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "娌℃湁鏌ョ湅鏉冮檺";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("exec h_p_Gy_MouldFileList " + page + "," + size + ",''", "h_p_Gy_MouldFileList");
+                }
+                else
+                {
+                    sWhere = sWhere.Replace("'", "''");
+                    ds = oCN.RunProcReturn("exec h_p_Gy_MouldFileList " + page + "," + size + ",'" + sWhere + "'", "h_p_Gy_MouldFileList");
+                }
+
+                //娣诲姞鍒楀悕
+                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鍒楀璞$殑鍒楀悕
+                }
+
+                res.code = CodeConstant.SUCCEED;
+                res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
+                res.Message = "Sucess锛�";
+                res.list = columnNameList;
+                res.data = ds.Tables[0];
+                return res;
+            }
+            catch (Exception e)
+            {
+                res.code = CodeConstant.FAIL;
+                res.count = CountConstant.FAIL;
+                res.Message = "Exception锛�" + e.ToString();
+                res.data = null;
+                return res;
+            }
+        }
+        #endregion
+
+
+
 
         #region 鍣ㄥ叿妗f鍒楄〃 鏍戠姸鍥� 璁惧鍒嗙被鏌ヨ
         public class TreeModel
@@ -2036,6 +2095,30 @@
                 string HMouldClass = mainList[0].HMouldClass;
                 int HNowWHID = mainList[0].HNowWHID;
                 int HNowSPID = mainList[0].HNowSPID;
+                string HMouldUseStatus = mainList[0].HMouldUseStatus;
+
+                //淇濆瓨鍓嶆帶鍒�=========================================
+                string HBillNote = "";
+                ds = oCN.RunProcReturn("Exec h_p_Gy_MouldFileMain_BeforeSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "','" + HBillNote + "',1 ", "h_p_Gy_MouldFileMain_BeforeSaveCtrl");
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:淇濆瓨鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); ;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //=========================================================
+
 
                 //涓昏〃
                 oCN.RunProc("Insert Into Gy_MouldFileMain   " +
@@ -2048,7 +2131,7 @@
                 ",HPrintQty,HMouldStatus,HWhID,HRoutingID,HCaveQty" +
                 ",HBomID,HVersion,HSPGroupID,HSPID,HDesignLife,HNowSupID,HNowSupTypeID" +
                 ",HUseLife,HLeaveLife,HProdQty,HProdWeight,HMouldOWNER,HSaveLife,HMouldDotCheckRuleInterID,HMouldMaintainRuleInterID,HBarCode,HMadeSupID" +
-                ",HMouldClass,HNowWHID,HNowSPID,HInitLife) " +
+                ",HMouldClass,HNowWHID,HNowSPID,HInitLife,HMouldUseStatus) " +
                 " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                 "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()" +
                 ",'" + HMouldNo + "','" + HName + "','" + HModel + "','" + HModel2 + "','" + HDiameter + "'" +
@@ -2058,7 +2141,7 @@
                 "," + HPrintQty + ",'" + HMouldStatus + "'," + HWHID + "," + HRoutingID + "," + HCaveQty +
                 "," + HBOMID + ",'" + HVersion + "'," + HSPGroupID + "," + HSPID + ",'" + HDesignLife + "','" + HNowSupID + "','" + HNowSupTypeID + "'" +
                 ",'" + HUseLife + "','" + HLeaveLife + "','" + HProdQty + "','" + HProdWeight + "','" + HMouldOWNER + "','" + HSaveLife + "','" + HMouldDotCheckRuleInterID + "','" + HMouldMaintainRuleInterID + "','" + HBarCode + "'," + HMadeSupID +
-                ",'"+ HMouldClass + "'," + HNowWHID + "," + HNowSPID + ",'" + HInitLife + "') ");
+                ",'"+ HMouldClass + "'," + HNowWHID + "," + HNowSPID + ",'" + HInitLife + "','" + HMouldUseStatus + "') ");
 
                 //瀛愯〃
                 oCN.RunProc("Insert into Gy_MouldFileSub " +
@@ -2070,6 +2153,29 @@
                 ") ");
 
                 objJsonResult = AddBillSub(msg5,msg6,msg7,HInterID, HBillNo);
+
+                //淇濆瓨鍚庢帶鍒�=========================================
+                ds = oCN.RunProcReturn("Exec h_p_Gy_MouldFileMain_AfterSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "','" + HBillNote + "',1 ", "h_p_Gy_MouldFileMain_AfterSaveCtrl");
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:淇濆瓨鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); ;
+                    objJsonResult.data = null;
+                    oCN.RollBack();
+                    return objJsonResult;
+                }
+                //=========================================================
+
 
                 if (objJsonResult.code == "0")
                 {
@@ -2185,7 +2291,7 @@
                 string HMouldClass = mainList[0].HMouldClass;
                 int HNowWHID = mainList[0].HNowWHID;
                 int HNowSPID = mainList[0].HNowSPID;
-
+                string HMouldUseStatus = mainList[0].HMouldUseStatus;
                 //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
                 oCN.BeginTran();
                 //涓昏〃
@@ -2242,6 +2348,7 @@
                 ",HNowWHID=" + HNowWHID +
                 ",HNowSPID=" + HNowSPID +
                 ",HInitLife='" + HInitLife +
+                "',HMouldUseStatus='" + HMouldUseStatus +
                 "' where HInterID=" + HInterID.ToString());
 
                 //淇敼瀛愰」鐩唬鐮�

--
Gitblit v1.9.1