From 7eb2427db47b9cd9413a3ef51afd34658ed71c3d Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期三, 26 三月 2025 10:58:25 +0800
Subject: [PATCH] 销售核销

---
 WebAPI/Controllers/SCGL/Sc_ICMOReportBillController.cs |  302 +++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 273 insertions(+), 29 deletions(-)

diff --git a/WebAPI/Controllers/SCGL/Sc_ICMOReportBillController.cs b/WebAPI/Controllers/SCGL/Sc_ICMOReportBillController.cs
index 16ac943..54694f7 100644
--- a/WebAPI/Controllers/SCGL/Sc_ICMOReportBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_ICMOReportBillController.cs
@@ -1,11 +1,10 @@
 锘縰sing Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using Pub_Class;
+using SyntacticSugar.constant;
 using System;
-using System.Collections;
 using System.Collections.Generic;
 using System.Data;
-using System.Data.SqlClient;
 using System.Web.Http;
 using WebAPI.Models;
 
@@ -38,6 +37,7 @@
         {
             try
             {
+                List<object> a = new List<object>();
                 //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
                 if (!DBUtility.ClsPub.Security_Log("Sc_ICMOReportBillQuery", 1, false, user))
                 {
@@ -50,21 +50,27 @@
 
                 if (sWhere == null || sWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn("select * from h_v_IF_ICMOReportBillList_Edit order by hmainid desc ", "h_v_IF_ICMOReportBillList_Edit");
+                    ds = oCN.RunProcReturn("select * from h_v_IF_ICMOReportBillList order by hmainid desc ", "h_v_IF_ICMOReportBillList_Edit");
                 }
                 else
                 {
-                    string sql1 = "select * from h_v_IF_ICMOReportBillList_Edit where 1 = 1 ";
+                    string sql1 = "select * from h_v_IF_ICMOReportBillList where 1 = 1 ";
                     string sql = sql1 + sWhere + " order by hmainid desc ";
-                    ds = oCN.RunProcReturn(sql, "h_v_IF_ICMOReportBillList_Edit");
+                    ds = oCN.RunProcReturn(sql, "h_v_IF_ICMOReportBillList");
                 }
-
+                foreach (DataColumn col in ds.Tables[0].Columns)//閬嶅巻ds涓涓�涓〃锛圱ables[0]锛夌殑鎵�鏈夊垪锛圕olumns锛夋瘡娆″惊鐜腑锛宑ol鍙橀噺浼氭寔鏈夊綋鍓嶅垪鐨勫紩鐢�
+                {
+                    Type dataType = col.DataType; //鑾峰彇褰撳墠鏁版嵁绫诲瀷浼犲叆 鑷畾涔夊彉閲廳atadataType
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //瀛楃涓叉嫾鎺�         // 灏嗗垪鍚嶅拰鏁版嵁绫诲瀷淇℃伅鎷兼帴鎴愪竴涓狫SON鏍煎紡鐨勫瓧绗︿覆
+                    a.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
                 //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                 //{
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
                 objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = a;
                 return objJsonResult;
                 //}
                 //else
@@ -84,6 +90,61 @@
                 objJsonResult.Message = "Exception锛�" + e.ToString();
                 objJsonResult.data = null;
                 return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鐢熶骇姹囨姤鍗� 鍒嗛〉鍒楄〃
+        [Route("Sc_ICMOReportBill/Sc_ICMOReportBillListPage")]
+        [HttpGet]
+        public json Sc_ICMOReportBillListPage(string sWhere, string user, int page, int size)
+        {
+            DataSet ds;
+            json res = new json();
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Sc_ICMOReportBillQuery", 3, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愭煡璇紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                sWhere = sWhere.Replace("'", "''");
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("exec h_p_Sc_ICMOReportBillMainList " + page + "," + size + ",''", "h_p_Sc_ICMOReportBillMainList");
+                }
+                else
+                {
+                    ds = oCN.RunProcReturn("exec h_p_Sc_ICMOReportBillMainList " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_ICMOReportBillMainList");
+                }
+
+                //娣诲姞鍒楀悕
+                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鍒楀璞$殑鍒楀悕
+                }
+
+                res.code = CodeConstant.SUCCEED;
+                res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
+                res.Message = "Sucess锛�";
+                res.list = columnNameList;
+                res.data = ds.Tables[0];
+                return res;
+            }
+            catch (Exception e)
+            {
+                res.code = CodeConstant.FAIL;
+                res.count = CountConstant.FAIL;
+                res.Message = "Exception锛�" + e.ToString();
+                res.data = null;
+                return res;
             }
         }
         #endregion
@@ -118,7 +179,9 @@
                 {
                     ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,鐗╂枡浠g爜 HMaterCode,鐗╂枡鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,
                                             HUnitID, 璁¢噺鍗曚綅浠g爜 HUnitCode, 璁¢噺鍗曚綅 HUnitName,HSourceID,鐢熶骇璧勬簮浠g爜 HSourceCode,鐢熶骇璧勬簮 HSourceName,
-                                            HWorkerid,鎿嶄綔鍛樹唬鐮� HWorkerCode,鎿嶄綔鍛� HWorkerName,鐢熶骇鏁伴噺 HQty,琛ㄤ綋澶囨敞 HRemark
+                                            HWorkerid,鎿嶄綔鍛樹唬鐮� HWorkerCode,鎿嶄綔鍛� HWorkerName,鐢熶骇鏁伴噺 HQty,琛ㄤ綋澶囨敞 HRemark,
+                                            HICMOInterID,HICMOEntryID,HICMOBillNo,HICMOInterID as HSourceInterID,HICMOEntryID as HSourceEntryID,
+                                            HICMOBillNo as HSourceBillNo,3710 as HSourceBillType,涓嶈壇鏁伴噺 HBadQty
                                             FROM h_v_IF_ICMOReportBillList_Edit"), "h_v_IF_ICMOReportBillList_Edit");
 
                     objJsonResult.code = "0";
@@ -132,7 +195,10 @@
                     //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark  from Sc_MouldRepairCheckBillSub where 1 = 1 ";
                     string sql1 = string.Format(@"SELECT HMaterID,鐗╂枡浠g爜 HMaterCode,鐗╂枡鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,
                                             HUnitID, 璁¢噺鍗曚綅浠g爜 HUnitCode, 璁¢噺鍗曚綅 HUnitName,HSourceID,鐢熶骇璧勬簮浠g爜 HSourceCode,鐢熶骇璧勬簮 HSourceName,
-                                            HWorkerid,鎿嶄綔鍛樹唬鐮� HWorkerCode,鎿嶄綔鍛� HWorkerName,鐢熶骇鏁伴噺 HQty,琛ㄤ綋澶囨敞 HRemark
+                                            HWorkerid,鎿嶄綔鍛樹唬鐮� HWorkerCode,鎿嶄綔鍛� HWorkerName,鐢熶骇鏁伴噺 HQty,琛ㄤ綋澶囨敞 
+                                            HRemark,HICMOInterID,HICMOEntryID,HICMOBillNo,
+                                            HICMOInterID as HSourceInterID,HICMOEntryID as HSourceEntryID,
+                                            HICMOBillNo as HSourceBillNo,3710 as HSourceBillType,涓嶈壇鏁伴噺 HBadQty
                                             FROM h_v_IF_ICMOReportBillList_Edit where 1 = 1 ");
                     string sql = sql1 + sqlWhere;
                     ds = oCN.RunProcReturn(sql, "h_v_IF_ICMOReportBillList_Edit");
@@ -298,8 +364,8 @@
                     oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                     oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
                     //oItemSub.HRemark = "";         //澶囨敞
-                    oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
-                    oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
+                    //oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
+                    //oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
                     //oItemSub.HSourceBillNo = "";  //婧愬崟鍗曞彿
                     //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
                     //oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
@@ -327,7 +393,6 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
@@ -436,11 +501,8 @@
             }
         }
         #endregion
-        #region 鐢熶骇姹囨姤鍗曞垹闄ゅ姛鑳�
-        /// <summary>
-        /// 妯″叿澶勭悊棰嗙敤鍗曞垹闄ゅ姛鑳�
-        /// </summary>
-        /// <returns></returns>
+
+        #region 鐢熶骇姹囨姤鍗曞垹闄ゅ姛鑳�      
         [Route("Sc_ICMOReportBill/DeltetICMOReportBill")]
         [HttpGet]
         public object DeltetMouldLifeChangeBill(string HInterID, string user)
@@ -493,9 +555,60 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                string HBillNo = "";
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+                ds = oCN.RunProcReturn("select * from Sc_ICMOReportBillMain where HInterID=" + lngBillKey, "Sc_ICMOReportBillMain");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒";
+                    objJsonResult.data = null;
+                    oCN.RollBack();
+                    return objJsonResult; ;
+                }
+                else
+                {
+                    HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+                }
+
+                //鍒犻櫎鍓嶆帶鍒�=========================================      
+                DataSet Ds;
+
+                string sql1 = "exec h_p_Sc_ICMOReportBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
+                Ds = oCN.RunProcReturn(sql1, "h_p_Sc_ICMOReportBill_BeforeDelCtrl");
+                if (Ds == null || Ds.Tables.Count == 0 || Ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                    objJsonResult.data = null;
+                    oCN.RollBack();
+                    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;
+                    oCN.RollBack();
+                    return objJsonResult;
+                }
+                //==================================================================================    
+
+
+                oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + "" + "','" + "鍒犻櫎鐢熶骇姹囨姤鍗曞崟鎹細" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','LMES-鐢熶骇姹囨姤鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','鍒犻櫎鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+
+
+                bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, HBillNo, "h_p_Sc_ICMOReportBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo);
+
+
                 if (IsDete)
                 {
+                    oCN.Commit();//鎻愪氦浜嬪姟
+
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
@@ -504,11 +617,11 @@
                 }
                 else
                 {
-
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
                     objJsonResult.data = null;
+                    oCN.RollBack();
                     return objJsonResult;
                 }
             }
@@ -518,6 +631,7 @@
                 objJsonResult.count = 0;
                 objJsonResult.Message = "鍗曟嵁鏈壘鍒�";
                 objJsonResult.data = null;
+                oCN.RollBack();
                 return objJsonResult;
             }
         }
@@ -537,6 +651,7 @@
         {
             string ModRightNameCheck = "Sc_ICMOReportBill_Check";
             DBUtility.ClsPub.CurUserName = CurUserName;
+            string sql = "";
             try
             {
                 //瀹℃牳鏉冮檺
@@ -611,8 +726,30 @@
                 }
                 if (IsAudit == 0) //瀹℃牳鎻愪氦
                 {
+                    //瀹℃牳鍓嶆帶鍒�===============================================Begin===================================================================
+                    sql = "exec h_p_Sc_ICMOReportBill_BeforeCheckCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_Sc_ICMOReportBill_BeforeCheckCtrl");
+                    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 (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    if (oBill.CheckBill(lngBillKey, oBill.omodel.HBillNo, "h_p_Sc_ICMOReportBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                     {
                         objJsonResult.code = "1";
                         objJsonResult.count = 1;
@@ -622,8 +759,8 @@
                     }
                     else
                     {
-                        objJsonResult.code = "1";
-                        objJsonResult.count = 1;
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
                         objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
                         objJsonResult.data = null;
                         return objJsonResult;
@@ -631,8 +768,30 @@
                 }
                 if (IsAudit == 1) //鍙嶅鏍告彁浜�
                 {
+                    //鍙嶅鏍稿墠鎺у埗===============================================Begin===================================================================
+                    sql = "exec h_p_Sc_ICMOReportBill_BeforeUnCheckCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_Sc_ICMOReportBill_BeforeUnCheckCtrl");
+                    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===================================================================
+
                     //鍙嶅鏍告彁浜bandonCheck
-                    if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    if (oBill.AbandonCheck(lngBillKey, oBill.omodel.HBillNo, "h_p_Sc_ICMOReportBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                     {
                         objJsonResult.code = "1";
                         objJsonResult.count = 1;
@@ -642,8 +801,8 @@
                     }
                     else
                     {
-                        objJsonResult.code = "1";
-                        objJsonResult.count = 1;
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
                         objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
                         objJsonResult.data = null;
                         return objJsonResult;
@@ -691,12 +850,13 @@
                 ClsPub.CurUserName = user;
                 BillOld.MvarItemKey = "Sc_ICMOReportBillMain";
                 oCN.BeginTran();//寮�濮嬩簨鍔�
-
+                DataSet ds;
+                DataSet ds1;
                 //Type 1 鍏抽棴  2  鍙嶅叧闂�
                 if (Type == 1)
                 {
                     //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍏抽棴
-                    DataSet ds;
+                    
                     string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                     ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                     if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
@@ -710,8 +870,32 @@
                             return objJsonResult;
                         }
                     }
+
+                    //鍏抽棴鍓嶆帶鍒�===============================================Begin===================================================================
+                    sql = "exec h_p_Sc_ICMOReportBill_BeforeCloseCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','" + user + "'";
+                    ds1 = oCN.RunProcReturn(sql, "h_p_Sc_ICMOReportBill_BeforeUnCheckCtrl");
+                    if (ds1 == null || ds1.Tables.Count == 0 || ds1.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:鍏抽棴鍓嶅墠鍒ゆ柇澶辫触锛屾棤杩斿洖淇℃伅锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+
+                    }
+                    if (ds1.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ds1.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //鍏抽棴鍓嶆帶鍒�===============================================End===================================================================
+
+
                     //鍏抽棴鍗曟嵁
-                    if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    if (!BillOld.CloseBill(Int64.Parse(HInterID), ds.Tables[0].Rows[0]["HBillNo"].ToString(), "h_p_Sc_ICMOReportBill_AfterCloseCtrl",  user , ref ClsPub.sExeReturnInfo))
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 1;
@@ -723,7 +907,6 @@
                 else
                 {
                     //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅叧闂�
-                    DataSet ds;
                     string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                     ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                     if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
@@ -737,8 +920,31 @@
                             return objJsonResult;
                         }
                     }
+                    //鍙嶅叧闂墠鎺у埗===============================================Begin===================================================================
+                    sql = "exec h_p_Sc_ICMOReportBill_BeforeUnCloseCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','" + user + "'";
+                    ds1 = oCN.RunProcReturn(sql, "h_p_Sc_ICMOReportBill_BeforeUnCheckCtrl");
+                    if (ds1 == null || ds1.Tables.Count == 0 || ds1.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:鍙嶅叧闂墠鍓嶅垽鏂け璐ワ紝鏃犺繑鍥炰俊鎭紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+
+                    }
+                    if (ds1.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ds1.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //鍙嶅叧闂墠鎺у埗===============================================End===================================================================
+
+
                     //鍙嶅叧闂崟鎹�
-                    if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    if (!BillOld.CancelClose(Int64.Parse(HInterID), ds.Tables[0].Rows[0]["HBillNo"].ToString(), "h_p_Sc_ICMOReportBill_AfterUnCloseCtrl", user, ref ClsPub.sExeReturnInfo))
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 1;
@@ -1168,5 +1374,43 @@
         }
         #endregion
 
+
+        #region 鐢熶骇姹囨姤鍗� 鏍规嵁涓诲唴鐮佷笌瀛愬唴鐮佽幏鍙栫敓浜ф眹鎶ュ崟鏁版嵁
+        [Route("Sc_ICMOReportBill/loadSc_ICMOReportBill_Push")]
+        [HttpGet]
+        public object loadSc_ICMOReportBill_Push(long HInterID, long HSubID)
+        {
+            try
+            {
+
+                ds = oCN.RunProcReturn("select * from h_v_IF_ICMOReportBillList_Edit where hmainid =" + HInterID + " and hsubid = " + HSubID, "h_v_IF_ICMOReportBillList_Edit");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌婧愬崟淇℃伅锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1