From 823d41cfb4d4a2e679d883ce3cac680f94e02b75 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期一, 18 八月 2025 16:43:20 +0800
Subject: [PATCH] 1
---
WebAPI/Controllers/基础资料/基础资料/Gy_EquipStatusController.cs | 285 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 270 insertions(+), 15 deletions(-)
diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_EquipStatusController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_EquipStatusController.cs"
index 45a9080..a048b9c 100644
--- "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_EquipStatusController.cs"
+++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_EquipStatusController.cs"
@@ -1,5 +1,7 @@
-锘縰sing Newtonsoft.Json;
+锘縰sing DBUtility;
+using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
+using Pub_Class;
using System;
using System.Collections.Generic;
using System.Data;
@@ -16,6 +18,7 @@
private json objJsonResult = new json();
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
DataSet ds;
+ public DAL.ClsGy_EquipStatus_Ctl BillOld = new DAL.ClsGy_EquipStatus_Ctl();
#region 璁惧鐘舵�� 鍒楄〃
[Route("Gy_EquipStatus/Gy_EquipStatusList")]
@@ -57,6 +60,46 @@
}
#endregion
+ #region 璁惧鐘舵�� 缂栬緫鍒楄〃
+ [Route("Gy_EquipStatus/Gy_EquipStatusEdit")]
+ [HttpGet]
+ public object Gy_EquipStatusEdit(string sWhere, string user, string Organization)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+
+ string sql1 = string.Format(@"select * from h_v_Gy_EquipStatus_Edit where 浣跨敤缁勭粐='" + Organization + "'");
+
+ string sql = sql1 + sWhere;
+ ds = oCN.RunProcReturn(sql, "h_v_Gy_EquipStatus_Edit");
+
+ //娣诲姞鍒楀悕
+ 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.list = columnNameList;
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
#region 璁惧鐘舵�� 缂栬緫
[Route("Gy_EquipStatus/Gy_EquipStatusEdit")]
[HttpPost]
@@ -68,9 +111,11 @@
string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
string msg1 = sArray[0].ToString();
string msg2 = sArray[1].ToString();
+ string OperationType = sArray[2].ToString();
//string msg_HUSEORGID = sArray[2].ToString();
Int64 HItemID = 0;
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ ClsXt_SystemParameter oClsXt_SystemParameter = new ClsXt_SystemParameter();
ListModels oListModels = new ListModels();
@@ -88,7 +133,7 @@
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷笉鑳戒负绌猴紒";
- objJsonResult.data = 1;
+ objJsonResult.data = null;
return objJsonResult;
}
if (oItem.HName.Trim() == "")
@@ -96,12 +141,12 @@
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "淇濆瓨澶辫触锛佸悕绉颁笉鑳戒负绌猴紒";
- objJsonResult.data = 1;
+ objJsonResult.data = null;
return objJsonResult;
}
//鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
- ds = oCN.RunProcReturn("select * from Gy_EquipStatus where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_EquipStatus");
+ ds = oCN.RunProcReturn("select * from Gy_EquipStatus with(nolock) where HNumber='" + oItem.HNumber.Trim() + "'", "Gy_EquipStatus");
if (oItem.HItemID == 0)
{
if (ds.Tables[0].Rows.Count > 0)
@@ -200,7 +245,7 @@
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�";
- objJsonResult.data = 1;
+ objJsonResult.data = null;
return objJsonResult;
}
//oItem.HUSEORGID = Convert.ToInt32(msg_HUSEORGID); //缁勭粐id
@@ -212,21 +257,57 @@
//淇濆瓨
//淇濆瓨瀹屾瘯鍚庡鐞�
bool bResult;
- if (oBill.oModel.HItemID == 0)
+ if (Convert.ToInt32(OperationType) == 1 || Convert.ToInt32(OperationType) == 2)
{
- bResult = oBill.AddNew();
+ bResult = oBill.AddNew(ref DBUtility.ClsPub.sExeReturnInfo);
}
else
{
- bResult = oBill.ModifyByID(oBill.oModel.HItemID);
+ bResult = oBill.ModifyByID(oBill.oModel.HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
}
if (bResult)
{
+ //鑷姩瀹℃牳鍔熻兘
+ if (oBill.oModel.HItemID == 0)
+ {
+ ds = oCN.RunProcReturn("select HItemID,HNumber,HName from Gy_EquipStatus with(nolock) where HNumber='" + oBill.oModel.HNumber.Trim() + "' and HUSEORGID = " + oBill.oModel.HUSEORGID, "Gy_EquipStatus");
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "淇濆瓨鎴愬姛锛佽嚜鍔ㄥ鏍稿け璐ユ壘涓嶅埌瀵瑰簲鍗曟嵁";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else if (ds.Tables[0].Rows.Count > 1)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鐩稿悓浣跨敤缁勭粐涓嬶紝鍑虹幇" + ds.Tables[0].Rows.Count + "涓浉鍚岀殑浠g爜锛�" + ds.Tables[0].Rows[0]["HNumber"];
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ string sAutoCheck = oClsXt_SystemParameter.GetSingleSystemParameter("Gy_EquipStatus_AutoCheck", ref DBUtility.ClsPub.sExeReturnInfo);
+ objJsonResult.Verify = "N";
+ if (sAutoCheck == "Y")
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "淇濆瓨鎴愬姛";
+ objJsonResult.data = ds.Tables[0].Rows[0]["HItemID"].ToString();
+ objJsonResult.Verify = "Y";
+ return objJsonResult;
+ }
+ }
+ }
+
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
//WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
- objJsonResult.data = 1;
+ objJsonResult.data = null;
return objJsonResult;
}
else
@@ -234,7 +315,7 @@
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
- objJsonResult.data = 1;
+ objJsonResult.data = null;
return objJsonResult;
}
}
@@ -243,7 +324,7 @@
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
- objJsonResult.data = 1;
+ objJsonResult.data = null;
return objJsonResult;
}
}
@@ -267,8 +348,8 @@
objJsonResult.data = null;
return objJsonResult;
}
- oCN.BeginTran();//寮�濮嬩簨鍔�
- ds = oCN.RunProcReturn("select * from Gy_EquipStatus where HItemID=" + HItemID, "Gy_EquipStatus");
+
+ ds = oCN.RunProcReturn("select * from Gy_EquipStatus with(nolock) where HItemID=" + HItemID, "Gy_EquipStatus");
if (ds == null || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
@@ -277,10 +358,21 @@
objJsonResult.data = null;
return objJsonResult; ;
}
+ else
+ {
+ if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "" || ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵�侊紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]);
if (HStopflag)
{
- oCN.RollBack();//鍥炴粴浜嬪姟
+
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "鏁版嵁宸茬鐢ㄦ棤娉曞垹闄わ紒";
@@ -289,7 +381,7 @@
}
oCN.RunProc("delete from Gy_EquipStatus where HItemID=" + HItemID);
- oCN.Commit();//鎻愪氦浜嬪姟
+
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "* 鏁版嵁鍒犻櫎鎴愬姛锛�";
@@ -307,5 +399,168 @@
}
}
#endregion
+
+ #region 璁惧鐘舵�佸鏍�/鍙嶅鏍稿姛鑳�
+ [Route("Gy_EquipStatus/CheckGy_EquipStatus")]
+ [HttpGet]
+ public object CheckGy_EquipStatus(string HInterID, int Type, string user)
+ {
+ try
+ {
+ if (string.IsNullOrWhiteSpace(HInterID))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //瀹℃牳鍓嶆帶鍒�=========================================
+ ds = oCN.RunProcReturn("Exec h_p_Gy_EquipStatus_BeforeAuditCtrl " + HInterID + ",'" + Type + "'", " h_p_Gy_EquipStatus_BeforeAuditCtrl ");
+ if (ds == null)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏍¢獙鍒ゆ柇澶辫触锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //=========================================================
+
+ DBUtility.ClsPub.CurUserName = user;
+
+ //Type 1 瀹℃牳 2 鍙嶅鏍�
+ if (Type == 1)
+ {
+ if (!BillOld.AuditByID2(int.Parse(HInterID), ref DBUtility.ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ else
+ {
+ if (BillOld.DeAuditByID2(int.Parse(HInterID), ref DBUtility.ClsPub.sExeReturnInfo))
+ {
+ SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鎵ц鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult; ;
+
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 璁惧鐘舵�佺鐢ㄣ�佸弽绂佺敤
+ [Route("Gy_EquipStatus/StopGy_EquipStatus")]
+ [HttpGet]
+ public object StopGy_EquipStatus(int HInterID, int IsStop, string CurUserName)
+ {
+ try
+ {
+ var ds = oCN.RunProcReturn("select * from Gy_EquipStatus with(nolock) where HItemID=" + HInterID, "Gy_EquipStatus");
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ if (IsStop == 0) //绂佺敤鍒ゆ柇
+ {
+ if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸茬鐢�!涓嶈兘鍐嶆绂佺敤锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ if (IsStop == 1) //鍙嶇鐢ㄥ垽鏂�
+ {
+ if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁鏈鐢�!涓嶉渶瑕佸弽绂佺敤!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oCN.BeginTran();
+
+ if (IsStop == 0) //绂佺敤鍒ゆ柇
+ {
+ oCN.RunProc("update Gy_EquipStatus set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "绂佺敤鎴愬姛";
+ objJsonResult.data = null;
+ }
+ if (IsStop == 1) //鍙嶇鐢ㄥ垽鏂�
+ {
+ oCN.RunProc("update Gy_EquipStatus set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶇鐢ㄦ垚鍔�";
+ objJsonResult.data = null;
+ }
+ oCN.Commit();
+
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绂佺敤澶辫触鎴栬�呭弽绂佺敤澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
}
}
\ No newline at end of file
--
Gitblit v1.9.1