From cee055eb7cdecf5d995cc65d379494e471bde9c8 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期三, 02 四月 2025 10:06:03 +0800
Subject: [PATCH] 合并
---
WebAPI/Controllers/SCGL/Sc_ICMOChangeBillController.cs | 174 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 169 insertions(+), 5 deletions(-)
diff --git a/WebAPI/Controllers/SCGL/Sc_ICMOChangeBillController.cs b/WebAPI/Controllers/SCGL/Sc_ICMOChangeBillController.cs
index 8fed87d..f1450e1 100644
--- a/WebAPI/Controllers/SCGL/Sc_ICMOChangeBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_ICMOChangeBillController.cs
@@ -48,12 +48,12 @@
if (sWhere == null || sWhere.Equals(""))
{
- ds = oCN.RunProcReturn("select * from h_v_Sc_ICMOChangeBillList_Query order by 鍗曟嵁鍙� ", "h_v_Sc_ICMOChangeBillList_Query");
+ ds = oCN.RunProcReturn("select * from h_v_Sc_ICMOChangeBillList_Query order by 鍗曟嵁鍙� desc", "h_v_Sc_ICMOChangeBillList_Query");
}
else
{
string sql1 = "select * from h_v_Sc_ICMOChangeBillList_Query where 1 = 1 ";
- string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� ";
+ string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
ds = oCN.RunProcReturn(sql, "h_v_Sc_ICMOChangeBillList_Query");
}
@@ -311,6 +311,8 @@
{
try
{
+ string s = "";
+
//鏌ョ湅鏉冮檺
if (!DBUtility.ClsPub.Security_Log("Sc_ICMOChangeBill_Drop", 1, false, user))
{
@@ -330,10 +332,75 @@
return objJsonResult;
}
+ if (BillOld.ShowBill(long.Parse(HInterID), ref s) == false)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ //鍒ゆ柇鏄惁鍙紪杈�
+ if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽鍒犻櫎锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+
+ //鍒犻櫎鍓嶆帶鍒�=========================================
+ string sql1 = "exec h_p_Sc_ICMOChangeBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_Sc_ICMOChangeBill_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;
+ }
+ //==================================================================================
+
oCN.BeginTran();
oCN.RunProc("delete from Sc_ICMOChangeBillMain where HInterID = " + HInterID);
oCN.RunProc("delete from Sc_ICMOChangeBillSub where HInterID= " + HInterID);
+
+ //鍒犻櫎鍚庢帶鍒�==================================================================================
+ string sql2 = "exec h_p_Sc_ICMOChangeBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
+ ds = oCN.RunProcReturn(sql2, "h_p_h_p_Sc_ICMOChangeBill_AfterDelCtrl");
+ if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+ {
+ s = "鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s;
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ s = ds.Tables[0].Rows[0]["HRemark"].ToString();
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s;
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+ //==============================================================================================
oCN.Commit();
@@ -448,9 +515,79 @@
//杩涜闇�瑕佽繘琛岀殑瀹℃牳/鍙嶅鏍告搷浣�
if (IsAudit == 0) //瀹℃牳鎻愪氦
{
- //瀹℃牳鎻愪氦
- if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+ //妫�楠屽瓙琛ㄦ暟鎹�
+ string errorMessage = "";
+ foreach (Model.ClsSc_ICMOChangeBillSub oSub in oBill.DetailColl)
{
+ //鍒ゆ柇鏂版暟閲忔槸鍚﹀皬浜庡崟鎹叧鑱旀暟閲�
+ if (oSub.HQty_New < oSub.HRelationQty)
+ {
+ errorMessage += "鐗╂枡鏂版暟閲忓皬浜庡崟鎹鍏宠仈鏁伴噺!";
+ }
+ }
+ if (errorMessage != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + errorMessage;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //妫�鏌ユ簮鍗曟槸鍚﹀瓨鍦�
+ string sql = "select * from Sc_ICMOBillMain as a " +
+ " inner join Sc_ICMOBillSub as b on a.HInterID = b.HInterID " +
+ " where b.HInterID = " + oBill.omodel.HMainSourceInterID + " and b.HEntryID =" + oBill.omodel.HMainSourceEntryID;
+ ds = oCN.RunProcReturn(sql, "Sc_ICMOBill");
+ if(ds==null || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:婧愬崟鏁版嵁涓嶅瓨鍦紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else if (ds.Tables[0].Rows[0]["HBillStatus"].ToString() != "2")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:婧愬崟鏈浜庡鏍哥姸鎬�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //瀹℃牳鍓嶆帶鍒�=========================================
+ string sql1 = "exec h_p_Sc_ICMOChangeBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_Sc_ICMOChangeBill_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;
+ 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;
+ }
+ //==================================================================================
+
+ oCN.BeginTran();
+ //鍙嶅啓婧愬崟鏁版嵁
+ sql = "exec h_p_Sc_ICMOBill_ReWriteByICMOChangeBill " + oBill.omodel.HInterID;
+ oCN.RunProc(sql);
+
+ //瀹℃牳鎻愪氦
+ if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Sc_ICMOChangeBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+ {
+ oCN.Commit();
+
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "瀹℃牳鎴愬姛";
@@ -459,6 +596,8 @@
}
else
{
+ oCN.RollBack();
+
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
@@ -468,8 +607,31 @@
}
if (IsAudit == 1) //鍙嶅鏍告彁浜�
{
+ //鍙嶅鏍稿墠鎺у埗=========================================
+ string sql1 = "exec h_p_Sc_ICMOChangeBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_Sc_ICMOChangeBill_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(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+ if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Sc_ICMOChangeBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
{
objJsonResult.code = "1";
objJsonResult.count = 1;
@@ -490,6 +652,8 @@
}
catch (Exception e)
{
+ oCN.RollBack();
+
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString();
--
Gitblit v1.9.1