From 02ba47f5a081fcfe6d7ea3a829769db5bf8b2c2b Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期一, 24 七月 2023 13:32:33 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/工资管理/Pay_SingleBalBillController.cs |  903 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 900 insertions(+), 3 deletions(-)

diff --git "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_SingleBalBillController.cs" "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_SingleBalBillController.cs"
index f3f86b5..413dab1 100644
--- "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_SingleBalBillController.cs"
+++ "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_SingleBalBillController.cs"
@@ -6,7 +6,9 @@
 using System.Data;
 using System.Data.SqlClient;
 using System.Web.Http;
+using System.Windows.Forms;
 using WebAPI.Models;
+using Newtonsoft.Json;
 
 namespace WebAPI.Controllers
 {
@@ -19,10 +21,11 @@
         public DataSet ds = new DataSet();
         public WebServer webserver = new WebServer();
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-
+        public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill();
         public DLL.ClsPay_SingleBalBill BillNew0 = new DLL.ClsPay_SingleBalBill();   // 
         public DLL.ClsPay_SingleBalBill BillOld0 = new DLL.ClsPay_SingleBalBill();   //                                                                                         
 
+        #region 宸ヨ祫缁撶畻鍗曚釜浜�-鏌ヨ
         /// <summary>
         /// 杩斿洖宸ヨ祫缁撶畻涓汉鍒楄〃(涓汉)
         ///鍙傛暟锛歴tring sql銆�
@@ -74,7 +77,8 @@
             }
 
         }
-       
+        #endregion
+
         #region[宸ヨ祫缁撶畻涓汉鍗曠紪杈戞椂鑾峰彇琛ㄥご鏁版嵁]
         [Route("Pay_SingleBalBill/Pay_SingleBalBillListCheckDetail")]
         [HttpGet]
@@ -123,6 +127,7 @@
         }
         #endregion
 
+        #region 宸ヨ祫缁撶畻鍗曚釜浜烘柊澧�
         [Route("Pay_SingleBalBill/SaveGetSingleBalBillList")]
         [HttpPost]
        
@@ -319,7 +324,9 @@
                 return objJsonResult;
             }
         }
+        #endregion
 
+        #region 宸ヨ祫缁撶畻鍗曚釜浜哄垹闄�
         /// <summary>
         ///宸ヨ祫缁撶畻涓汉鍗曞垹闄ゅ姛鑳�
         /// </summary>
@@ -358,7 +365,7 @@
                 return objJsonResult;
             }
         }
-
+        #endregion
 
         [Route("Pay_SingleBalBill/getSingleBalBillPrice")]
         [HttpGet]
@@ -414,5 +421,895 @@
             }
         }
         //
+
+
+
+
+        #region 宸ヨ祫缁撶畻鍗曚釜浜�-鏂板
+        #region 琛ㄥご鏁版嵁
+        public class Pay_SingleBalBillMain
+        {
+            public int HInterID;
+            public string HBillNo;
+            public string HDate;
+            public string HInnerBillNo;
+            public int HGroupID;
+            public string HGroupName;
+            public int HDeptID;
+            public string HDeptName;
+            public int HEmpID;
+            public string HEmpName;
+            public int HPayTypeID;
+            public string HPayTypeName;
+            public string HSourceBillType;
+            public int HSourceBillID;
+            public string HSourceBillNo;
+            public string HExplanation;
+            public string HRemark;
+            public string HMaker;
+            public string HMakerDate;
+            public string HUpdater;
+            public string HUpdaterDate;
+            public string HChecker;
+            public string HCheckerDate;
+            public string HCloseMan;
+            public string HCloseManDate;
+            public string HDeleteMan;
+            public string HDeleteManDate;
+            public string HBacker;
+            public string HBackerDate;
+            public string HBackRemark;
+        }
+        #endregion
+        #region 瀛愯〃鏁版嵁
+        public class Pay_SingleBalBillSub
+        {
+            public int RowID;
+            public int HMaterID;
+            public string HMaterNumber;
+            public string HMaterName;
+            public string HMaterModel;
+            public int HProcID;
+            public string HProcNumber;
+            public string HProcName;
+            public int HEmpID;
+            public string HEmpNumber;
+            public string HEmpName;
+            public double HTimes;
+            public double HQty;
+            public double HPrice;
+            public double HPriceRate;
+            public double HSubsidyQty;
+            public double HSubsidyMoney;
+            public double HSubsidyTotal;
+            public double HDeuctTotal;
+            public double HPackQty;
+            public double HPackPrice;
+            public double HPackMoney;
+            public int HPackMaterID;
+            public string HPackMaterName;
+            public double HMoney;
+            public int HICMOInterID;
+            public string HICMOBillNo;
+            public int HProcReportInterID;
+            public int HProcReportEntryID;
+            public string HProcReportBillNo;
+            public int HProcPlanInterID;
+            public int HProcPlanEntryID;
+            public string HProcPlanBillNo;
+            public string HRemark;
+            public int HSourceInterID;
+            public int HSourceEntryID;
+            public string HSourceBillNo;
+            public string HSourceBillType;
+            public double HRelationQty;
+            public double HRelationMoney;
+            public string HCloseMan;
+            public string HEntryCloseDate;
+        }
+        #endregion
+
+        #region 宸ヨ祫缁撶畻鍗�(涓汉) 鏂板/缂栬緫-淇濆瓨
+        /// <summary>
+        /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Pay_SingleBalBillMain/AddBill")]
+        [HttpPost]
+        public object AddBill_Pay_SingleBalBillMain([FromBody] JObject sMainSub)
+        {
+            //鑾峰彇鍙傛暟
+            var _value = sMainSub["sMainSub"].ToString();
+            string msg1 = _value.ToString();
+            //寮�濮嬩簨鍔�
+            oCN.BeginTran();
+            //淇濆瓨涓昏〃
+            objJsonResult = AddBillMain_Pay_SingleBalBillMain(msg1);
+            if (objJsonResult.code == "0")
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = objJsonResult.Message;
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            oCN.Commit();
+            objJsonResult.code = "1";
+            objJsonResult.count = 1;
+            objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�";
+            objJsonResult.data = ds.Tables[0];
+            return objJsonResult;
+        }
+        #endregion
+        #region 娣诲姞 宸ヨ祫缁撶畻鍗�(涓汉) 涓昏〃
+        public json AddBillMain_Pay_SingleBalBillMain(string msg1)
+        {
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();
+            int OperationType = int.Parse(sArray[2].ToString());//鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗
+            string user = sArray[3].ToString();//鐢ㄦ埛鍚�
+            string HComputerName = SystemInformation.ComputerName; //璁惧鍚嶇О
+            try
+            {
+                if (OperationType == 1)
+                {
+                    //鍒ゆ柇鏄惁鏈夌紪杈戞潈闄�
+                    if (!DBUtility.ClsPub.Security_Log("Pay_SingleBalBill_Edit", 1, false, user))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鏃犳柊澧炴潈闄�!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else if (OperationType == 3)
+                {
+                    //鍒ゆ柇鏄惁鏈夌紪杈戞潈闄�
+                    if (!DBUtility.ClsPub.Security_Log("Pay_SingleBalBill_Edit", 1, false, user))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鏃犵紪杈戞潈闄�!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                msg2 = "[" + msg2.ToString() + "]";
+                List<Pay_SingleBalBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Pay_SingleBalBillMain>>(msg2);
+
+                int HYear = int.Parse(mainList[0].HDate.Split('-')[0]);
+                int HPeriod = int.Parse(mainList[0].HDate.Split('-')[1]);
+                string HBillType = "2205";
+                string HBillSubType = "";
+                int HBillStatus = 1;
+
+                int HInterID = mainList[0].HInterID;
+                string HBillNo = mainList[0].HBillNo;
+                string HDate = mainList[0].HDate;
+                string HInnerBillNo = mainList[0].HInnerBillNo;
+                int HGroupID = mainList[0].HGroupID;
+                int HDeptID = mainList[0].HDeptID;
+                int HEmpID = mainList[0].HEmpID;
+                int HPayType = mainList[0].HPayTypeID;
+                int HMainSourceInterID = mainList[0].HSourceBillID;
+                string HMainSourceBillNo = mainList[0].HSourceBillNo;
+                string HMainSourceBillType = mainList[0].HSourceBillType;
+                string HExplanation = mainList[0].HExplanation;
+                string HRemark = mainList[0].HRemark;
+                
+                //鍒跺崟銆佷慨鏀�
+                string HMaker = mainList[0].HMaker;
+                string HMakerDate = mainList[0].HMakerDate;
+                string HUpdater = mainList[0].HUpdater;
+                string HUpdaterDate = mainList[0].HUpdaterDate;
+                
+
+                //if (OperationType == 2)
+                //{
+                //    ds = oCN.RunProcReturn("select * from PM_ProjectStageBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectStageBill");
+                //    if (ds.Tables[0].Rows.Count > 0)
+                //    {
+                //        objJsonResult.code = "0";
+                //        objJsonResult.count = 0;
+                //        objJsonResult.Message = "鍗曟嵁鍙烽噸澶�,璇烽噸鏂拌緭鍏�!";
+                //        objJsonResult.data = null;
+                //        return objJsonResult;
+                //    }
+                //}
+
+                ds = oCN.RunProcReturn("select * from Pay_SingleBalBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_SingleBalBillMain");
+
+                if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//鏂板
+                {
+                    string sql = "insert into Pay_SingleBalBillMain" +
+                        "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate,HBillNo,HBillStatus,HGroupID,HDeptID,HEmpID,HPayType,HExplanation,HInnerBillNo,HRemark,HMaker,HMakeDate,HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType) " +
+                        "values(" +
+                        "" + HYear +
+                        "," + HPeriod +
+                        ",'" + HBillType +
+                        "','" + HBillSubType +
+                        "'," + HInterID +
+                        ",'" + HDate +
+                        "','" + HBillNo +
+                        "'," + HBillStatus +
+                        "," + HGroupID +
+                        "," + HDeptID +
+                        "," + HEmpID +
+                        "," + HPayType +
+                        ",'" + HExplanation +
+                        "','" + HInnerBillNo +
+                        "','" + HRemark +
+                        "','" + HMaker +
+                        "','" + HMakerDate +
+                        "'," + HMainSourceInterID +
+                        ",'" + HMainSourceBillNo +
+                        "','" + HMainSourceBillType +
+                        "')";
+
+                    //涓昏〃
+                    oCN.RunProc(sql);
+                    LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",鏂板宸ヨ祫缁撶畻鍗�(涓汉):" + HBillNo);
+                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鏂板宸ヨ祫缁撶畻鍗�(涓汉)锛�" + HBillNo + "','LMES-宸ヨ祫缁撶畻鍗�(涓汉)妯″潡','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)                    //缂栬緫
+                {
+                    string sql = "update Pay_SingleBalBillMain set " +
+                        "HYear = " + HYear +
+                        ",HPeriod = " + HPeriod +
+                        ",HBillType = '" + HBillType +
+                        "',HBillSubType = '" + HBillSubType +
+                        "',HDate = '" + HDate +
+                        "',HBillNo = '" + HBillNo +
+                        "',HGroupID = " + HGroupID +
+                        ",HDeptID = " + HDeptID +
+                        ",HEmpID = " + HEmpID +
+                        ",HPayType = " + HPayType +
+                        ",HExplanation = '" + HExplanation +
+                        "',HInnerBillNo = '" + HInnerBillNo +
+                        "',HRemark = '" + HRemark +
+                        "',HUPdater = '" + HUpdater +
+                        "',HUpdateDate = '" + HUpdaterDate +
+                        "',HMainSourceInterID = " + HMainSourceInterID +
+                        ",HMainSourceBillNo = '" + HMainSourceBillNo +
+                        "',HMainSourceBillType = '" + HMainSourceBillType +
+                        "' where HInterID = " + HInterID;
+
+                    oCN.RunProc(sql);
+
+                    //鍒犻櫎瀛愯〃
+                    oCN.RunProc("delete from Pay_SingleBalBillSub where HInterID=" + HInterID + "");
+                    //璁板綍鏃ュ織
+                    LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",淇敼宸ヨ祫缁撶畻鍗�(涓汉):" + HBillNo);
+                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼宸ヨ祫缁撶畻鍗�(涓汉)锛�" + HBillNo + "','LMES-宸ヨ祫缁撶畻鍗�(涓汉)妯″潡','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                //淇濆瓨瀛愯〃
+                objJsonResult = AddBillSub_Pay_SingleBalBillMain(msg3, HInterID, HBillNo, OperationType);
+
+                if (objJsonResult.code == "0")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = objJsonResult.Message;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = null;
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+        #region 娣诲姞 宸ヨ祫缁撶畻鍗�(涓汉) 瀛愯〃
+        public json AddBillSub_Pay_SingleBalBillMain(string msg3, long HInterID, string HBillNo, int OperationType)
+        {
+            List<Pay_SingleBalBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Pay_SingleBalBillSub>>(msg3);
+            int i = 0;                                          //浣滀负瀛愯〃鍐呯爜
+            foreach (Pay_SingleBalBillSub oSub in DetailColl)
+            {
+                i++;                                            //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
+
+                int HEntryID = i;
+
+                int HMaterID = oSub.HMaterID;
+                int HProcID = oSub.HProcID;
+                int HEmpID = oSub.HEmpID;
+
+
+                double HTimes = oSub.HTimes;
+                double HQty = oSub.HQty;
+                double HPrice = oSub.HPrice;
+                double HPriceRate = oSub.HPriceRate;
+                double HSubsidyQty = oSub.HSubsidyQty;
+                double HSubsidyMoney = oSub.HSubsidyMoney;
+                double HSubsidyTotal = oSub.HSubsidyTotal;
+                double HDeuctTotal = oSub.HDeuctTotal;
+                double HPackQty = oSub.HPackQty;
+                double HPackPrice = oSub.HPackPrice;
+                double HPackMoney = oSub.HPackMoney;
+                int HPackMaterID = oSub.HPackMaterID;
+                double HMoney = oSub.HMoney;
+
+                int HICMOInterID = oSub.HICMOInterID;
+                string HICMOBillNo = oSub.HICMOBillNo;
+                int HProcReportInterID = oSub.HProcReportInterID;
+                int HProcReportEntryID = oSub.HProcReportEntryID;
+                string HProcReportBillNo = oSub.HProcReportBillNo;
+                int HProcPlanInterID = oSub.HProcPlanInterID;
+                int HProcPlanEntryID = oSub.HProcPlanEntryID;
+                string HProcPlanBillNo = oSub.HProcPlanBillNo;
+
+                string HRemark = oSub.HRemark;
+
+                int HSourceInterID = oSub.HSourceInterID;
+                int HSourceEntryID = oSub.HSourceEntryID;
+                string HSourceBillNo = oSub.HSourceBillNo;
+                string HSourceBillType = oSub.HSourceBillType;
+                double HRelationQty = oSub.HRelationQty;
+                double HRelationMoney = oSub.HRelationMoney;
+                string HCloseMan = oSub.HCloseMan;
+                string HEntryCloseDate = oSub.HEntryCloseDate;
+
+                string sql = "insert into Pay_SingleBalBillSub" +
+                    "(HInterID,HEntryID,HMaterID,HProcID,HEmpID,HTimes,HQty,HPrice,HPriceRate,HSubsidyQty,HSubsidyMoney,HSubsidyTotal,HDeuctTotal" +
+                    ",HPackQty,HPackPrice,HPackMoney,HPackMaterID,HMoney,HICMOInterID,HICMOBillNo,HProcReportInterID,HProcReportEntryID,HProcReportBillNo" +
+                    ",HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
+                    ",HCloseMan,HEntryCloseDate) " +
+                    "values(" +
+                    "" + HInterID +
+                    "," + HEntryID +
+                    "," + HMaterID +
+                    "," + HProcID +
+                    "," + HEmpID +
+                    "," + HTimes +
+                    "," + HQty +
+                    "," + HPrice +
+                    "," + HPriceRate +
+                    "," + HSubsidyQty +
+                    "," + HSubsidyMoney +
+                    "," + HSubsidyTotal +
+                    "," + HDeuctTotal +
+                    "," + HPackQty +
+                    "," + HPackPrice +
+                    "," + HPackMoney +
+                    "," + HPackMaterID +
+                    "," + HMoney +
+                    "," + HICMOInterID +
+                    ",'" + HICMOBillNo +
+                    "'," + HProcReportInterID +
+                    "," + HProcReportEntryID +
+                    ",'" + HProcReportBillNo +
+                    "'," + HProcPlanInterID +
+                    "," + HProcPlanEntryID +
+                    ",'" + HProcPlanBillNo +
+                    "','" + HRemark +
+                    "'," + HSourceInterID +
+                    "," + HSourceEntryID +
+                    ",'" + HSourceBillNo +
+                    "','" + HSourceBillType +
+                    "'," + HRelationQty +
+                    "," + HRelationMoney +
+                    ",'" + HCloseMan +
+                    "','" + HEntryCloseDate +
+                    "')";
+
+                oCN.RunProc(sql);
+            }
+
+            objJsonResult.code = "1";
+            objJsonResult.count = 1;
+            objJsonResult.Message = null;
+            objJsonResult.data = null;
+            return objJsonResult;
+        }
+        #endregion
+        #endregion
+
+        #region 宸ヨ祫缁撶畻鍗�(涓汉)-鏌ヨ
+        /// <summary>
+        /// 杩斿洖椤圭洰闃舵鍒楄〃
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Pay_SingleBalBill/list")]
+        [HttpGet]
+        public object getSingleBalBill(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                if (!DBUtility.ClsPub.Security_Log("Pay_SingleBalBillList", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("select * from h_v_Pay_SingleBalBillList order by hmainid desc", "h_v_Pay_SingleBalBillList");
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_Pay_SingleBalBillList where 1 = 1 ";
+                    string sql = sql1 + sWhere + " order by hmainid desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_Pay_SingleBalBillList");
+                }
+
+                //娣诲姞鍒楀悕
+                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鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 宸ヨ祫缁撶畻鍗� 缂栬緫-椤甸潰璧嬪��
+        /// <summary>
+        ///鍙傛暟锛歴tring HInterID銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Pay_SingleBalBill/editInit")]
+        [HttpGet]
+        public object getSingleBalBilleditInit(string HInterID, string user)
+        {
+            try
+            {
+                List<DataTable> tableList = new List<DataTable>();
+
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Pay_SingleBalBill_Edit", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犵紪杈戞潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (HInterID == null || HInterID.Equals(""))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ds = oCN.RunProcReturn("exec h_p_Pay_SingleBalBill_EditInit " + HInterID, "h_p_Pay_SingleBalBill_EditInit");
+                tableList.Add(ds.Tables[0]);
+                tableList.Add(ds.Tables[1]);
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = tableList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 宸ヨ祫缁撶畻鍗�(涓汉) 鍒犻櫎
+        /// <summary>
+        ///鍙傛暟锛歴tring HInterID銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Pay_SingleBalBill/delete")]
+        [HttpGet]
+        public object deleteSingleBalBill(string HInterID, string user)
+        {
+            try
+            {
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Pay_SingleBalBill_Drop", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (HInterID == null || HInterID.Equals(""))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.BeginTran();
+
+                oCN.RunProc("delete from Pay_SingleBalBillMain where HInterID = " + HInterID);
+                oCN.RunProc("delete from Pay_SingleBalBillSub where HInterID='" + HInterID + "'");
+
+                oCN.Commit();
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 宸ヨ祫缁撶畻鍗�(涓汉) 瀹℃牳/鍙嶅鏍�
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
+        /// <param name="CurUserName">瀹℃牳浜�</param>
+        /// <returns></returns>
+        [Route("Pay_SingleBalBill/AuditPay_SingleBalBill")]
+        [HttpGet]
+        public object AuditPM_ProjectReportBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Pay_SingleBalBill_Check", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愬鏍�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (string.IsNullOrWhiteSpace(HInterID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                ClsPub.CurUserName = user;
+                BillOld.MvarItemKey = "Pay_SingleBalBillMain";
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //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)
+                    {
+                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶉渶瑕佸啀瀹℃牳!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    //瀹℃牳鍗曟嵁
+                    if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                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)
+                    {
+                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插弽瀹℃牳!涓嶉渶瑕佸啀鍙嶅鏍�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    //鍙嶅鏍稿崟鎹�
+                    if (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                oCN.Commit();//鎻愪氦浜嬪姟
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎵ц鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 宸ヨ祫缁撶畻鍗�(涓汉) 鍏抽棴/鍙嶅叧闂姛鑳�
+        [Route("Pay_SingleBalBill/ClosePay_SingleBalBill")]
+        [HttpGet]
+        public object ClosePay_SingleBalBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Pay_SingleBalBill_Close", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愬叧闂�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (string.IsNullOrWhiteSpace(HInterID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ClsPub.CurUserName = user;
+                BillOld.MvarItemKey = "Pay_SingleBalBillMain";
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //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)
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶉渶瑕佸啀鍏抽棴!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    //鍏抽棴鍗曟嵁
+                    if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                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)
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插弽鍏抽棴!涓嶉渶瑕佸啀鍙嶅叧闂�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    //鍙嶅叧闂崟鎹�
+                    if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                oCN.Commit();//鎻愪氦浜嬪姟
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎵ц鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 宸ヨ祫缁撶畻鍗�(涓汉) 浣滃簾/鍙嶄綔搴熷姛鑳�
+        [Route("Pay_SingleBalBill/DropPay_SingleBalBill")]
+        [HttpGet]
+        public object DropPay_SingleBalBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈変綔搴熸潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Pay_SingleBalBill_Delete", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愪綔搴�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (string.IsNullOrWhiteSpace(HInterID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ClsPub.CurUserName = user;
+                BillOld.MvarItemKey = "Pay_SingleBalBillMain";
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //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)
+                    {
+                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶉渶瑕佸啀浣滃簾!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    //浣滃簾鍗曟嵁
+                    if (!BillOld.Cancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                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)
+                    {
+                        if (ds.Tables[0].Rows[0]["HDeleteMan"] == null || ds.Tables[0].Rows[0]["HDeleteMan"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插弽浣滃簾!涓嶉渶瑕佸啀鍙嶄綔搴�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    //鍙嶄綔搴熷崟鎹�
+                    if (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                oCN.Commit();//鎻愪氦浜嬪姟
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎵ц鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1