From 6f50ff6cdf04a7207156a23b9e2d4702cb0b5b2d Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期二, 16 四月 2024 15:33:31 +0800
Subject: [PATCH] 设备运行状态报表
---
WebAPI/Controllers/JHGL/Gy_MaterialTechParamBillController.cs | 155 ++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 133 insertions(+), 22 deletions(-)
diff --git a/WebAPI/Controllers/JHGL/Gy_MaterialTechParamBillController.cs b/WebAPI/Controllers/JHGL/Gy_MaterialTechParamBillController.cs
index ba7850a..a19588e 100644
--- a/WebAPI/Controllers/JHGL/Gy_MaterialTechParamBillController.cs
+++ b/WebAPI/Controllers/JHGL/Gy_MaterialTechParamBillController.cs
@@ -358,12 +358,13 @@
#region 浜у搧宸ヨ壓鍙傛暟娓呭崟鍒楄〃 瀹℃牳/鍙嶅鏍稿姛鑳�
[Route("Gy_MaterialTechParamBill/CheckGy_MaterialTechParamBillMain")]
[HttpGet]
- public object CheckGy_MaterialTechParamBillMain(string HInterID, int IsAudit, string user)
+ public object CheckGy_MaterialTechParamBillMain(int HInterID, int IsAudit, string CurUserName)
{
+ DBUtility.ClsPub.CurUserName = CurUserName;
try
{
//瀹℃牳鏉冮檺
- if (!DBUtility.ClsPub.Security_Log_second("Gy_MaterialTechParamBillMain_Check", 1, false, user))
+ if (!DBUtility.ClsPub.Security_Log_second("Gy_MaterialTechParamBillMain_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -372,12 +373,43 @@
return objJsonResult;
}
- var ds = oCN.RunProcReturn("select * from Gy_MaterialTechParamBillMain where HInterID=" + HInterID, "Gy_MaterialTechParamBillMain ");
- if (ds.Tables[0].Rows.Count > 0)
+ //HInterID鏁版嵁鍒ゆ柇
+ if (HInterID <= 0)
{
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID灏忎簬0锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+
+ Int64 lngBillKey = 0;
+ lngBillKey = DBUtility.ClsPub.isLong(HInterID); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹�
+ DAL.ClsGy_MaterialTechParamBillMain oBill = new DAL.ClsGy_MaterialTechParamBillMain(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+ //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+ if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁
+ {
+ if (oBill.omodel.HCloseMan.Trim() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (oBill.omodel.HDeleteMan.Trim() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
if (IsAudit == 0) //瀹℃牳鍒ゆ柇
{
- if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+ if (oBill.omodel.HChecker.Trim() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -388,7 +420,7 @@
}
if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
{
- if (ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
+ if (oBill.omodel.HChecker.Trim() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -402,38 +434,117 @@
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+ objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
objJsonResult.data = null;
return objJsonResult;
}
- oCN.BeginTran();
- if (IsAudit == 0) //瀹℃牳鍒ゆ柇
+ //杩涜闇�瑕佽繘琛岀殑瀹℃牳/鍙嶅鏍告搷浣�
+ if (IsAudit == 0) //瀹℃牳鎻愪氦
{
- oCN.RunProc("update Gy_MaterialTechParamBillMain set HChecker='" + user + "',HCheckDate=getdate() where HInterID=" + HInterID);
+ oCN.BeginTran();
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "瀹℃牳鎴愬姛";
- objJsonResult.data = null;
+ //璁板綍杩斿洖淇℃伅
+ string msg = "";
+
+
+
+ //瀹℃牳鍓嶆帶鍒�=========================================
+ string sql1 = "exec h_p_Gy_MaterialTechParamBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaterialTechParamBill_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 (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Gy_MaterialTechParamBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+ {
+ oCN.Commit();
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳鎴愬姛锛�" + msg;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ oCN.RollBack();
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
}
- if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+ if (IsAudit == 1) //鍙嶅鏍告彁浜�
{
- oCN.RunProc("update Gy_MaterialTechParamBillMain set HChecker='',HCheckDate=null where HInterID=" + HInterID);
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "鍙嶅鏍告垚鍔�";
- objJsonResult.data = null;
+ //鍙嶅鏍稿墠鎺у埗=========================================
+ string sql1 = "exec h_p_Gy_MaterialTechParamBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaterialTechParamBill_BeforeUnCheckCtrl");
+ 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]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //===========================================================
+
+ //鍙嶅鏍告彁浜bandonCheck
+ if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Gy_MaterialTechParamBill_AfterUnCheckCtrl", CurUserName, 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;
+ }
}
- oCN.Commit();
-
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
+
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString();
--
Gitblit v1.9.1