From 1a29ebb99b0b49c4e08fbf95bac0e66f0112e5ed Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期一, 13 十月 2025 09:21:53 +0800
Subject: [PATCH] 案例,按照类型控制
---
WebAPI/Controllers/MJGL/Sc_MouldMaintainRuleBillController.cs | 129 ++++++++++++++++++++++++++++++++++++-------
1 files changed, 108 insertions(+), 21 deletions(-)
diff --git a/WebAPI/Controllers/MJGL/Sc_MouldMaintainRuleBillController.cs b/WebAPI/Controllers/MJGL/Sc_MouldMaintainRuleBillController.cs
index 1583617..3b7269e 100644
--- a/WebAPI/Controllers/MJGL/Sc_MouldMaintainRuleBillController.cs
+++ b/WebAPI/Controllers/MJGL/Sc_MouldMaintainRuleBillController.cs
@@ -194,7 +194,29 @@
return objJsonResult;
}
- bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+ //鍒犻櫎鍓嶆帶鍒�=========================================
+ string sql1 = "exec h_p_Sc_MouldMaintainRuleBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldMaintainRuleBill_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;
+ }
+
+ 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(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Sc_MouldMaintainRuleBill_AfterDelCtrl",user, ref DBUtility.ClsPub.sExeReturnInfo);
if (IsDete)
{
objJsonResult.code = "0";
@@ -345,6 +367,7 @@
string msg3 = sArray[1].ToString();
string msg4 = sArray[2].ToString();
string msg5 = sArray[3].ToString();
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
ListModels oListModels = new ListModels();
try
@@ -363,6 +386,8 @@
List<Model.ClsSc_MouldMaintainRuleBillMain> lsmain = new List<Model.ClsSc_MouldMaintainRuleBillMain>();
msg2 = msg2.Replace("\\", "");
msg2 = msg2.Replace("\n", ""); //\n
+
+
//涓昏〃
lsmain = oListModels.getObjectByJson_Sc_MouldMaintainRuleBillMain(msg2);
foreach (Model.ClsSc_MouldMaintainRuleBillMain oItem in lsmain)
@@ -384,7 +409,23 @@
return objJsonResult;
}
oBill.omodel = oItem;
+
+ if (oItem.HInterID == 0)
+ {
+ // 鍒ゆ柇鏂板鐨勮〃鍗曚笌琛ㄦ牸涓殑琛ㄥ崟鏄惁鏈夐噸澶�
+ DataSet ds = oCN.RunProcReturn("select * from h_v_Sc_MouldMaintainRuleBillList where 鍗曟嵁鍙� = '" + oItem.HBillNo + "'", "h_v_Sc_MouldMaintainRuleBillList");
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佸崟鎹彿涓嶅緱鏈夐噸澶嶏紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
}
+
+
//淇濆吇椤硅〃浣撴暟鎹�
//鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
@@ -440,7 +481,7 @@
//淇濆瓨瀹屾瘯鍚庡鐞�
bool bResult;
if (oBill.omodel.HInterID == 0)
- {
+ {
// bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
}
@@ -657,36 +698,81 @@
}
DAL.ClsSc_MouldMaintainRuleBill oBill = new DAL.ClsSc_MouldMaintainRuleBill();
ClsPub.CurUserName = user;
+ Int64 lngBillKey = 0;
+ lngBillKey = DBUtility.ClsPub.isLong(HInterID);
+ //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+ if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁
+ {
+ if (oBill.omodel.HChecker.Trim() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (Type == 1) //浣滃簾鍒ゆ柇
+ {
+ if (oBill.omodel.HDeleteMan.Trim() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶄綔搴燂紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ if (Type == 2) //鍙嶄綔搴熷垽鏂�
+ {
+ if (oBill.omodel.HDeleteMan.Trim() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ 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.BeginTran();//寮�濮嬩簨鍔�
//Type 1 浣滃簾 2 鍙嶄綔搴�
if (Type == 1)
{
- //浣滃簾鍓嶆帶鍒�
- string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
- string sql = "";
- sql = "exec h_p_Sc_MouldMaintainRuleBill_BeforeCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
- ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldMaintainRuleBill_BeforeCheckCtrl");
+ //浣滃簾鍓嶆帶鍒�=========================================
+ string sql1 = "exec h_p_Sc_MouldMaintainRuleBill_BeforeDropCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldMaintainRuleBill_BeforeDropCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
- objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ 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.Message = "浣滃簾澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
+ oCN.RollBack();
return objJsonResult;
}
+ //==================================================================================
- if (!oBill.Cancelltion(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ if (!oBill.Cancelltion(int.Parse(HInterID), oBill.omodel.HBillNo, "h_p_Sc_MouldMaintainRuleBill_AfterDropCtrl", user, ref ClsPub.sExeReturnInfo))
{
objJsonResult.code = "0";
objJsonResult.count = 1;
@@ -694,15 +780,17 @@
objJsonResult.data = null;
return objJsonResult;
}
-
- //浣滃簾鍚庢帶鍒�
- sql = "exec h_p_Sc_MouldMaintainRuleBill_BeforeCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
- ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldMaintainRuleBill_BeforeCheckCtrl");
+ }
+ else
+ {
+ //鍙嶄綔搴熷墠鎺у埗=========================================
+ string sql1 = "exec h_p_Sc_MouldMaintainRuleBill_BeforeUnDropCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldMaintainRuleBill_BeforeUnDropCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
- objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:鍙嶄綔搴熷墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
objJsonResult.data = null;
return objJsonResult;
@@ -711,14 +799,13 @@
{
objJsonResult.code = "0";
objJsonResult.count = 1;
- objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
return objJsonResult;
}
- }
- else
- {
- if (!oBill.AbandonCancelltion(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ //===========================================================
+
+ if (!oBill.AbandonCancelltion(int.Parse(HInterID), oBill.omodel.HBillNo, "h_p_Sc_MouldMaintainRuleBill_AfterUnDropCtrl", user, ref ClsPub.sExeReturnInfo))
{
objJsonResult.code = "0";
objJsonResult.count = 1;
--
Gitblit v1.9.1