From 99bd816e3c11999b7dea0571e1041508d761834b Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期三, 30 八月 2023 09:03:03 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 DAL/生产管理/ClsSc_ICMOBill.cs |   80 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 77 insertions(+), 3 deletions(-)

diff --git "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/ClsSc_ICMOBill.cs" "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/ClsSc_ICMOBill.cs"
index b396298..2a58585 100644
--- "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/ClsSc_ICMOBill.cs"
+++ "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/ClsSc_ICMOBill.cs"
@@ -34,6 +34,21 @@
         {
             try
             {
+                //淇濆瓨鍓嶆帶鍒�=========================================
+                string HBillNote = "";
+                DataSet ds = oCn.RunProcReturn("Exec h_p_Sc_ICMOBill_BeforeSaveCtrl " + lngBillKey.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',2 ", "h_p_Sc_ICMOBill_BeforeSaveCtrl");
+                if (ds == null)
+                {
+                    sReturn = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    sReturn = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                    return false;
+                }
+                //=========================================================
+
                 //
                 oCn.BeginTran();
                 //鏇存柊涓昏〃
@@ -90,6 +105,25 @@
                 //      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                 //      ") ");
                 //}
+
+                //=========================淇濆瓨鍚庢帶鍒�  
+                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Sc_ICMOBill_AfterSaveCtrl " + lngBillKey.ToString() + ", '" + omodel.HBillNo + "',2 ", "h_p_Sc_ICMOBill_AfterSaveCtrl");
+                if (ds2 == null)
+                {
+                    sReturn = "淇濆瓨鍚庢帶鍒跺垽鏂け璐ワ紒";
+                    oCn.RollBack();
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    sReturn = "淇濆瓨澶辫触2锛�" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
+                    oCn.RollBack();
+                    return false;
+                }
+                //============================
+
+
+
                 sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
                 oCn.Commit();
                 return true;
@@ -101,6 +135,9 @@
                 throw (e);
             }
         }
+
+
+
         //鏂板鍗曟嵁
         public override bool AddBill(ref string sReturn)
         {
@@ -108,7 +145,22 @@
             {
                 //寰楀埌mainid
                 omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
-                //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
+
+                //淇濆瓨鍓嶆帶鍒�=========================h_p_Sc_ICMOBill_BeforeDeleteCtrl
+                string HBillNote = "";
+                DataSet ds = oCn.RunProcReturn("Exec h_p_Sc_ICMOBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '"+ omodel.HBillNo +"','" + HBillNote + "','1' ", "h_p_Sc_ICMOBill_BeforeSaveCtrl");
+                if(ds==null)
+                {
+                    sReturn = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
+                    return false;
+                }
+                if(DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"])!= "0")
+                {
+                    sReturn = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]) ;
+                    return false;
+                }
+                //=========================================================
+
                 oCn.BeginTran();
                 //涓昏〃
                 oCn.RunProc("Insert Into Sc_ICMOBillMain   " +
@@ -137,6 +189,25 @@
                 //      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                 //      ") ");
                 //}
+
+
+                //=========================淇濆瓨鍚庢帶鍒� 
+                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Sc_ICMOBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_Sc_ICMOBill_AfterSaveCtrl");
+                if (ds2 == null)
+                {
+                    sReturn = "淇濆瓨鍚庢帶鍒跺垽鏂け璐ワ紒";
+                    oCn.RollBack();
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    sReturn = "淇濆瓨澶辫触2锛�" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
+                    oCn.RollBack();
+                    return false;
+                }
+                //============================
+
+
                 sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
                 oCn.Commit();
                 return true;
@@ -148,6 +219,8 @@
                 throw (e);
             }
         }
+
+
         //鏄剧ず鍗曟嵁
         public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
         {
@@ -256,9 +329,10 @@
                 //鏈夊叧鑱旀暟閲忓垯涓嶅厑璁稿垹闄�
                 DataSet ds;
                 ds = oCn.RunProcReturn("exec h_p_Mes_ICMODeleteCtrl " + lngBillKey.ToString(), "h_p_Mes_ICMODeleteCtrl");
-                if(ds==null || ds.Tables[0].Rows.Count==0)
+                //ds = oCn.RunProcReturn("exec h_p_Sc_ICMOBill_BeforeDeleteCtrl " + lngBillKey.ToString(), "h_p_Sc_ICMOBill_BeforeDeleteCtrl");
+                if (ds==null || ds.Tables[0].Rows.Count==0)
                 {
-                    sReturn = "鍒ゆ柇鍏宠仈鏁伴噺澶辫触,260琛�!  ";
+                    sReturn = "鍒ゆ柇鍏宠仈鏁伴噺澶辫触!  ";
                     return false;
                 }
                 if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0)

--
Gitblit v1.9.1