From 6956b68704a297a7f7a5352063442d906e07f648 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期二, 29 四月 2025 16:21:12 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
---
WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs | 213 +++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 199 insertions(+), 14 deletions(-)
diff --git a/WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs
index 4e2c548..bb78471 100644
--- a/WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs
+++ b/WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs
@@ -1,6 +1,7 @@
锘縰sing DBUtility;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
+using SyntacticSugar.constant;
using System;
using System.Collections.Generic;
using System.Data;
@@ -81,6 +82,62 @@
return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sb_EquipMaintainPlanBillList ", "h_v_Sb_EquipMaintainPlanBillList");
}
#endregion
+
+ /// <summary>
+ /// 璁惧淇濆吇璁″垝鍗曞垎椤靛垪琛�
+ /// </summary>
+ /// <returns></returns>
+ [Route("Sb_EquipMaintainPlanBill/GetEquipMaintainPlanBillListPage")]
+ [HttpGet]
+ public object GetEquipMaintainPlanBillListPage(string sWhere, string user, int page, int size)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ if (!DBUtility.ClsPub.Security_Log("Sb_EquipMaintainPlanBillList", 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_Sb_EquipMaintainPlanBillList " + page + "," + size + ",''", "h_p_Sb_EquipMaintainPlanBillList");
+ }
+ else
+ {
+ sWhere = sWhere.Replace("'", "''");
+ ds = oCN.RunProcReturn("exec h_p_Sb_EquipMaintainPlanBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_Sb_EquipMaintainPlanBillList");
+ }
+
+ //娣诲姞鍒楀悕
+ 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 = CodeConstant.SUCCEED;
+ objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception ex)
+ {
+ objJsonResult.code = CodeConstant.FAIL;
+ objJsonResult.count = CountConstant.FAIL;
+ objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
#region 璁惧淇濆吇璁″垝琛� 淇濆瓨/缂栬緫
/// <summary>
@@ -297,8 +354,30 @@
objJsonResult.data = null;
return objJsonResult;
}
+ //鍒犻櫎鍓嶆帶鍒�=========================================
+ string sql1 = "exec h_p_Sb_EquipMaintainPlanBill_BeforeDelCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_Sb_EquipMaintainPlanBill_BeforeDelCtrl");
+ 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;
+ }
- bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //==================================================================================
+
+ bool IsDete = oBill.DeleteBill(lngBillKey, oBill.omodel.HBillNo, "h_p_Sb_EquipMaintainPlanBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo);
+
if (IsDete)
{
objJsonResult.code = "0";
@@ -335,7 +414,7 @@
if (string.IsNullOrEmpty(HID))
return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" };
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
- var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sb_EquipMaintainPlanBillList where hmainid= " + HID + " ", "h_v_Sb_EquipMaintainPlanBillList");
+ var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sb_EquipMaintainPlanBill_Edit where hmainid= " + HID + " ", "h_v_Sb_EquipMaintainPlanBill_Edit");
if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄧ偣妫�璁″垝琛�" };
return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet };
@@ -404,8 +483,8 @@
string sql = "select HMaintainItemID, 淇濆吇椤圭洰浠g爜 HMaintainItemNumber,淇濆吇椤圭洰鍚嶇О HMaintainItem,淇濆吇閮ㄤ綅 HMaintainPart,鍏蜂綋瑕佹眰 HClaim,HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜� HManagerName,琛ㄤ綋澶囨敞 HRemark from h_v_Sb_EquipMaintainPlanBillSub_Item where 1 = 1 " + Swhere + "";
ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipMaintainPlanBillSub_Item");
//鑾峰彇閰嶄欢椤圭洰缂栬緫鏁版嵁
- string sql1 = "select HMaterID, 閰嶄欢浠g爜 HMaterNumber,閰嶄欢鍚嶇О HMaterName,鍗曚綅ID HUnitID,鍗曚綅浠g爜 HUnitNumber,鍗曚綅鍚嶇О HUnitName,鐢ㄩ噺 HQty,鏍囧噯鐢ㄩ噺 HQtyMust,琛ㄤ綋澶囨敞 HRemark,璐熻矗浜篒D HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜� HManagerName from h_v_Sb_EquipMaintainPlanBillList where 1 = 1 " + Swhere + "";
- ds1 = oCN.RunProcReturn(sql1, "h_v_Sb_EquipMaintainPlanBillList");
+ string sql1 = "select HMaterID, 閰嶄欢浠g爜 HMaterNumber,閰嶄欢鍚嶇О HMaterName,鍗曚綅ID HUnitID,鍗曚綅浠g爜 HUnitNumber,鍗曚綅鍚嶇О HUnitName,鐢ㄩ噺 HQty,鏍囧噯鐢ㄩ噺 HQtyMust,琛ㄤ綋澶囨敞 HRemark,璐熻矗浜篒D HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜� HManagerName from h_v_Sb_EquipMaintainPlanBill_Edit where 1 = 1 " + Swhere + "";
+ ds1 = oCN.RunProcReturn(sql1, "h_v_Sb_EquipMaintainPlanBill_Edit");
list.Add(ds.Tables[0]);
list.Add(ds1.Tables[0]);
@@ -544,7 +623,31 @@
//Type 1 瀹℃牳 2 鍙嶅鏍�
if (Type == 1)
{
- if (!BillOld.CheckBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ //瀹℃牳鍓嶆帶鍒�=========================================
+ string sql1 = "exec h_p_Sb_EquipMaintainPlanBill_BeforeCheckCtrl " + HInterID + ",'','" + user + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_Sb_EquipMaintainPlanBill_BeforeCheckCtrl");
+ if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+ //==================================================================================
+
+ if (!BillOld.CheckBill(int.Parse(HInterID), "", "h_p_Sb_EquipMaintainPlanBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
{
objJsonResult.code = "0";
objJsonResult.count = 1;
@@ -552,23 +655,42 @@
objJsonResult.data = null;
return objJsonResult;
}
+
//鑷姩鐢熸垚鐐规璁″垝鍗�
oCN.RunProc("exec h_p_Sb_EquipMaintainPlan_Auto " + HInterID);
}
else
{
- if (BillOld.AbandonCheck(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ //鍙嶅鏍稿墠鎺у埗=========================================
+ string sql1 = "exec h_p_Sb_EquipMaintainPlanBill_BeforeUnCheckCtrl " + HInterID + ",'','" + user + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_Sb_EquipMaintainPlanBill_BeforeUnCheckCtrl");
+ if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
- SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+ objJsonResult.data = null;
+ return objJsonResult;
+
}
- else
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //===========================================================
+
+ if (!BillOld.AbandonCheck(int.Parse(HInterID), "", "h_p_Sb_EquipMaintainPlanBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
objJsonResult.data = null;
return objJsonResult;
- }
+ }
}
oCN.Commit();//鎻愪氦浜嬪姟
@@ -624,22 +746,85 @@
//Type 1 鍏抽棴 2 鍙嶅叧闂�
if (Type == 1)
{
- if (!BillOld.CloseBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ string sql = "";
+ //鍏抽棴鍓嶆帶鍒�===============================================Begin===================================================================
+ sql = "exec h_p_Sb_EquipMaintainPlanBill_BeforeCloseCtrl " + HInterID + ",'','" + user + "'";
+ ds = oCN.RunProcReturn(sql, "h_p_Sb_EquipMaintainPlanBill_BeforeCloseCtrl");
+ if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
- objJsonResult.count = 1;
- objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:鍏抽棴鍓嶅墠鍒ゆ柇澶辫触锛屾棤杩斿洖淇℃伅锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+ objJsonResult.data = null;
+ return objJsonResult;
+
+ }
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
return objJsonResult;
}
+ //鍏抽棴鍓嶆帶鍒�===============================================End===================================================================
+
+ //鍏抽棴鎻愪氦
+ if (BillOld.CloseBill(Convert.ToInt32(HInterID), BillOld.omodel.HBillNo, "h_p_Sb_EquipMaintainPlanBill_AfterCloseCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍏抽棴鎴愬姛";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
}
else
{
- if (!BillOld.CancelClose(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ string sql = "";
+ //鍙嶅叧闂墠鎺у埗===============================================Begin===================================================================
+ sql = "exec h_p_Sb_EquipMaintainPlanBill_BeforeUnCloseCtrl " + HInterID + ",'','" + user + "'";
+ ds = oCN.RunProcReturn(sql, "h_p_Sb_EquipMaintainPlanBill_BeforeUnCloseCtrl");
+ if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:鍙嶅叧闂墠鍓嶅垽鏂け璐ワ紝鏃犺繑鍥炰俊鎭紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍙嶅叧闂墠鎺у埗===============================================End===================================================================
+
+ //鍙嶅叧闂彁浜�
+ if (BillOld.CancelClose(Convert.ToInt32(HInterID), BillOld.omodel.HBillNo, "h_p_Sb_EquipMaintainPlanBill_AfterUnCloseCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+ {
+ objJsonResult.code = "1";
objJsonResult.count = 1;
- objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.Message = "鍙嶅叧闂垚鍔�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
objJsonResult.data = null;
return objJsonResult;
}
--
Gitblit v1.9.1