From 81456046161696d3e1e31a8d9eb428f3b7a3442f Mon Sep 17 00:00:00 2001
From: jhz <jinghz@oceic.com>
Date: 星期四, 22 九月 2022 10:44:56 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
---
WebAPI/Controllers/SBGL/Gy_EquipTypeController.cs | 330 ++++++++++++++++++++++++++++++++++--------------------
1 files changed, 207 insertions(+), 123 deletions(-)
diff --git a/WebAPI/Controllers/SBGL/Gy_EquipTypeController.cs b/WebAPI/Controllers/SBGL/Gy_EquipTypeController.cs
index c556479..dab55bc 100644
--- a/WebAPI/Controllers/SBGL/Gy_EquipTypeController.cs
+++ b/WebAPI/Controllers/SBGL/Gy_EquipTypeController.cs
@@ -17,34 +17,43 @@
private json objJsonResult = new json();
public DataSet ds = new DataSet();
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
- public DLL.ClsGy_EquipTypeBill BillNew0 = new DLL.ClsGy_EquipTypeBill(); //妯″叿鎶ュ簾鍏ュ簱瀵瑰簲鍗曟嵁绫�
- public DLL.ClsGy_EquipTypeBill BillOld0 = new DLL.ClsGy_EquipTypeBill(); //妯″叿鎶ュ簾鍏ュ簱瀵瑰簲鍗曟嵁绫�
+ public DLL.ClsGy_EquipTypeBill BillNew0 = new DLL.ClsGy_EquipTypeBill();
+ public DLL.ClsGy_EquipTypeBill BillOld0 = new DLL.ClsGy_EquipTypeBill();
#region 璁惧鍒嗙被鍒楄〃
[Route("Gy_EquipType/GetList")]
[HttpGet]
- public object GetList(string sWhere)
+ public object GetList(string sWhere,string user)
{
try
{
- ds = Sc_GetEquipTypeList(sWhere);
- if (ds == null)
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�";
- objJsonResult.data = null;
- return objJsonResult;
- }
- else
- {
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�";
- objJsonResult.data = ds.Tables[0];
- return objJsonResult;
- }
+ //if (!DBUtility.ClsPub.Security_Log("Gy_EquipTypeList", 1, false, user))
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+ ds = oCN.RunProcReturn("select HItemID,HParentID,HNumber,HName,HLevel, case when HEndFlag<>0 then 'Y'else ' 'end HEndFlag,case when HStopFlag <> 0 then 'Y'else ' 'end HStopFlag, HRemark, HUseFlag from Gy_EquipFileType where 1=1 " + sWhere+ " order by HItemID ", "Gy_EquipFileType");
+
+ //if (ds.Tables[0].Rows.Count != 0 || ds != null)
+ //{
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ //}
+ //else
+ //{
+ //objJsonResult.code = "0";
+ //objJsonResult.count = 0;
+ //objJsonResult.Message = "鏃犳暟鎹�";
+ //objJsonResult.data = null;
+ //return objJsonResult;
+ //}
}
catch (Exception ex)
{
@@ -56,28 +65,22 @@
}
}
- public static DataSet Sc_GetEquipTypeList(string sWhere)
- {
- string sql1 = string.Format(@"select * from h_v_Gy_EquipTypeList");
- if (sWhere == null || sWhere.Equals(""))
- {
- return new SQLHelper.ClsCN().RunProcReturn(sql1 + sWhere + " order by HItemID desc", "h_v_Gy_EquipTypeList");
- }
- else
- {
- string sql = sql1 + sWhere + " order by HItemID desc";
- return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Gy_EquipTypeList");
- }
-
- }
-
#endregion
#region [璁惧鍒嗙被鍒犻櫎鍔熻兘]
[Route("Gy_EquipType/Delete_EquipType")]
[HttpGet]
- public object Delete_EquipType(string HItemID)
+ public object Delete_EquipType(string HItemID,string user)
{
+ if (!DBUtility.ClsPub.Security_Log("Gy_EquipType_Delete", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
string s = "";
Int64 lngBillKey = 0;
lngBillKey = DBUtility.ClsPub.isLong(HItemID);
@@ -92,23 +95,12 @@
DLL.ClsGy_EquipTypeBill oBill = new DLL.ClsGy_EquipTypeBill();
if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
{
- bool IsDete = oBill.DeleteBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo);
- if (IsDete)
- {
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
- objJsonResult.data = null;
- return objJsonResult;
- }
- else
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
- objJsonResult.data = null;
- return objJsonResult;
- }
+ oCN.RunProc("Delete From Gy_EquipFileType where HItemID=" + lngBillKey);
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎鎴愬姛";
+ objJsonResult.data = null;
+ return objJsonResult;
}
else
{
@@ -122,91 +114,183 @@
#endregion
- #region 璁惧鍒嗙被淇濆瓨/缂栬緫
- [Route("Gy_EquipType/SaveEquipTypeList")]
+ #region 妯℃不鍏峰垎绫绘柊澧炰繚瀛�
+ /// <summary>
+ /// 妯℃不鍏峰垎绫�-淇濆瓨鎸夐挳
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Gy_EquipType/AddBill")]
[HttpPost]
- public object SaveEquipTypeList([FromBody] JObject msg)
+ public object AddBill([FromBody] JObject oMain)
{
- var _value = msg["msg"].ToString();
- string msg1 = _value.ToString();
- string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
- string msg2 = sArray[0].ToString();
- string refSav = sArray[1].ToString();
-
- ListModels oListModels = new ListModels();
try
{
- DLL.ClsGy_EquipTypeBill oBill = new DLL.ClsGy_EquipTypeBill();
- List<Models.ClsGy_EquipFileType> lsmain = new List<Models.ClsGy_EquipFileType>();
- msg2 = msg2.Replace("\\", "");
- msg2 = msg2.Replace("\n", ""); //\n
- lsmain = oListModels.getObjectByJson_Gy_EquipFileType(msg2);
+ var _value = oMain["oMain"].ToString();
+ string msg1 = _value.ToString();
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString();
+ string msg4 = sArray[1].ToString();
- long HItemID = lsmain[0].HItemID;
- string HNumber = lsmain[0].HNumber;
- string HName = lsmain[0].HName;
- string HShortNumber = lsmain[0].HNumber;
- long HParentID = lsmain[0].HParentID;
- long HLevel = lsmain[0].HLevel;
- string HHelpCode = lsmain[0].HHelpCode;
- string HRemark = lsmain[0].HRemark;
- bool HStopflag = lsmain[0].HStopflag;
- string HUseFlag = lsmain[0].HUseFlag;
- bool HEndFlag = lsmain[0].HEndFlag;
+ if (!DBUtility.ClsPub.Security_Log("Gy_EquipType_Edit", 1, false, msg4))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍙嶅簭鍒楀寲
+ msg2 = "[" + msg2.ToString() + "]";
- if (refSav == "Add")
+ List<Models.ClsGy_EquipFileType> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsGy_EquipFileType>>(msg2);
+
+ string HNumber = list[0].HNumber;
+ string HName = list[0].HName;
+ string HShortNumber = list[0].HNumber;
+ long HParentID = list[0].HParentID;
+ long HLevel = list[0].HLevel;
+ string HHelpCode = list[0].HHelpCode;
+ string HRemark = list[0].HRemark;
+ bool HStopflag = list[0].HStopflag;
+ string HUseFlag = list[0].HUseFlag;
+ bool HEndFlag = list[0].HEndFlag;
+
+
+ if (!DBUtility.ClsPub.AllowNumber(HNumber))
{
- //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
- oCN.BeginTran();
- //涓昏〃
- oCN.RunProc("Insert into Gy_EquipFileType " +
- " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
- ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime) " +
- " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HParentID +
- "," + HLevel + "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "',getdate())", ref DBUtility.ClsPub.sExeReturnInfo);
- //淇敼涓婄骇涓洪潪鏈骇浠g爜
- oCN.RunProc("Update Gy_EquipFileType set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
- oCN.Commit();
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "鏂板鎴愬姛锛�";
- //objJsonResult.data = null;
- return objJsonResult;
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒";
+ objJsonResult.data = null;
+ return objJsonResult;
}
- if (refSav == "Update")
- {
- oCN.BeginTran();
- //涓昏〃
- oCN.RunProc("Update Gy_EquipFileType set " +
- " HNumber='" + HNumber + "'" +
- ",HName='" + HName + "'" +
- ",HShortNumber='" +HShortNumber + "'" +
- ",HHelpCode='" + HHelpCode + "'" +
- ",HParentID=" + HParentID +
- ",HStopflag='" + HStopflag + "'" +
- ",HRemark= '" + HRemark + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
- //淇敼瀛愰」鐩唬鐮�
- //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_RepairCheck,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
- //灏嗕笂绾� 涓洪潪鏈骇
- oCN.RunProc("Update Gy_EquipFileType set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
- //
- oCN.Commit();
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "淇敼鎴愬姛锛�";
- //objJsonResult.data = null;
- return objJsonResult;
- }
+
+
+
+ //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
+ oCN.BeginTran();
+ //涓昏〃
+ oCN.RunProc("Insert into Gy_EquipFileType " +
+ " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
+ ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime) " +
+ " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HParentID +
+ "," + HLevel + "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "',getdate())", ref DBUtility.ClsPub.sExeReturnInfo);
+ //淇敼涓婄骇涓洪潪鏈骇浠g爜
+ oCN.RunProc("Update Gy_EquipFileType set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鏂板鎴愬姛锛�";
+ //objJsonResult.data = null;
+ return objJsonResult;
}
catch (Exception e)
{
+ oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
- objJsonResult.data = 1;
+ objJsonResult.Message = "Exception锛�" + e.Message;
+ objJsonResult.data = null;
return objJsonResult;
}
- return false;
+ }
+ #endregion
+
+ #region 妯℃不鍏峰垎绫讳慨鏀逛繚瀛�
+ /// <summary>
+ /// 淇敼鍗曟嵁-淇濆瓨鎸夐挳
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Gy_EquipType/EditBill")]
+ [HttpPost]
+ public object EditBill([FromBody] JObject oMain)
+ {
+
+ try
+ {
+ var _value = oMain["oMain"].ToString();
+ string msg1 = _value.ToString();
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString();
+ string msg3 = sArray[1].ToString();
+ string msg4 = sArray[2].ToString();
+
+ if (!DBUtility.ClsPub.Security_Log("Gy_EquipType_Edit", 1, false, msg4))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍙嶅簭鍒楀寲
+ msg2 = "[" + msg2.ToString() + "]";
+ List<Models.ClsGy_EquipFileType> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsGy_EquipFileType>>(msg2);
+
+ long HItemID = int.Parse(msg3);
+ string HNumber = list[0].HNumber;
+ string HName = list[0].HName;
+ string HShortNumber = list[0].HNumber;
+ long HParentID = list[0].HParentID.ToString() == "" ? 0 : list[0].HParentID;
+ string HHelpCode = list[0].HHelpCode;
+ string HRemark = list[0].HRemark;
+ bool HStopflag = list[0].HStopflag;
+ string HUseFlag = list[0].HUseFlag;
+
+ if (!DBUtility.ClsPub.AllowNumber(HNumber))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ DataSet DS = oCN.RunProcReturn("Select * from Gy_EquipFileType Where HStopflag=0 and HNumber='" + HItemID + "' and HItemID<>" + HNumber, "Gy_EquipFileType", ref Pub_Class.ClsPub.sExeReturnInfo);
+ if (DS.Tables[0].Rows.Count != 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "浠g爜閲嶅锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+
+ //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
+ oCN.BeginTran();
+ //涓昏〃
+ oCN.RunProc("Update Gy_EquipFileType set " +
+ " HNumber='" + HNumber + "'" +
+ ",HName='" + HName + "'" +
+ ",HShortNumber='" + HShortNumber + "'" +
+ ",HHelpCode='" + HHelpCode + "'" +
+ ",HParentID=" + HParentID +
+ ",HStopflag='" + HStopflag + "'" +
+ ",HRemark= '" + HRemark + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
+ //淇敼瀛愰」鐩唬鐮�
+ //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_RepairCheck,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
+ //灏嗕笂绾� 涓洪潪鏈骇
+ oCN.RunProc("Update Gy_EquipFileType set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
+ //
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "淇敼鎴愬姛锛�";
+ //objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
}
#endregion
--
Gitblit v1.9.1