From c4c02944532a9bfda6de9a0cd85a9dfa631ed003 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期六, 17 五月 2025 15:28:19 +0800
Subject: [PATCH] 1
---
WebAPI/Controllers/工资管理/Pay_GroupBalBillController.cs | 1779 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 1,740 insertions(+), 39 deletions(-)
diff --git "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_GroupBalBillController.cs" "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_GroupBalBillController.cs"
index 69329ae..4d8865a 100644
--- "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_GroupBalBillController.cs"
+++ "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_GroupBalBillController.cs"
@@ -1,4 +1,5 @@
-锘縰sing Newtonsoft.Json.Linq;
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections;
@@ -7,6 +8,8 @@
using System.Data.SqlClient;
using System.Web.Http;
using WebAPI.Models;
+using System.Windows.Forms;
+using SyntacticSugar.constant;
namespace WebAPI.Controllers
{
@@ -14,27 +17,1012 @@
public class Pay_GroupBalBillController : ApiController
{
public DBUtility.ClsPub.Enum_BillStatus BillStatus;
-
- private json objJsonResult = new json();
+ public const string ModName = "2201"; //鍗曟嵁绫诲瀷
+ public const string ModCaption = "宸ヨ祫缁撶畻鍗曪紙闆嗕綋锛�"; //鍗曟嵁鍚嶇О
+ public const string ModRightName = "Pay_GroupBalBill";
+ public const string ModRightNameList = ModRightName + "List"; //鍒楄〃
+ public const string ModRightNameEdit = ModRightName + "_Edit"; //缂栬緫
+ public const string ModRightNameCheck = ModRightName + "_Check"; //瀹℃牳
+ public const string ModRightNameClose = ModRightName + "_Close"; //鍏抽棴
+ public const string ModRightNameDelete = ModRightName + "_Delete"; //浣滃簾
+ public const string ModRightNameDrop = ModRightName + "_Drop"; //鍒犻櫎
+ public const string ModRightNameMoney = ModRightName + "_Money"; //閲戦
+ public const string ModRightNameQty = ModRightName + "_Qty"; //鏁伴噺
public DataSet ds = new DataSet();
- public WebServer webserver = new WebServer();
- SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
- //DataSet ds;
+ private json objJsonResult = new json();
+ SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+ public DAL.ClsPay_GroupBalBill oBill = new DAL.ClsPay_GroupBalBill();
+ #region 宸ヨ祫缁撶畻鍗曪紙闆嗕綋锛夊垪琛�
/// <summary>
- /// 杩斿洖宸ヨ祫缁撶畻涓汉鍒楄〃
- ///鍙傛暟锛歴tring sql銆�
- ///杩斿洖鍊硷細object銆�
+ /// 鑾峰彇宸ヨ祫缁撶畻鍗曪紙闆嗕綋锛夊垪琛ㄤ俊鎭�
/// </summary>
- [Route("Pay_GroupBalBill/GetGroupBalBill")]
+ /// <returns></returns>
+ [Route("Pay_GroupBalBillController/GetPay_GroupBalBillList_Json")]
[HttpGet]
- public object GetGroupBalBill(string sWhere)
+ public object GetPay_GroupBalBillList_Json(string sWhere, string HMaker)
{
try
{
+ //鍒ゆ柇鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log(ModRightNameList, 3, false, HMaker))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍒ゆ柇鏄惁鏈夋煡鐪嬪叏閮ㄧ彮缁勭殑鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_Group_AllQuery", 3, false, HMaker))
+ {
+ //濡傛灉娌℃湁杩欎釜鏉冮檺
+ //鏍规嵁鐢ㄦ埛瀵瑰簲鐝粍鐨勫叧绯伙紝杩囨护鏉′欢涓鍔犲彧鏄剧ず瀵瑰簲鐨勭彮缁�
+ DataSet dsHitemID = oCn.RunProcReturn("exec h_p_Gy_GetSQLGroupByUser '" + HMaker + "'", "h_p_Gy_GetSQLGroupByUser");
+ string sqlGroupID = DBUtility.ClsPub.isStrNull(dsHitemID.Tables[0].Rows[0]["HBack"]);
+ if (sqlGroupID == "" || sqlGroupID == null)//濡傛灉娌℃湁缁戝畾鐝粍鍒欒浠栫湅涓嶅埌鎵�鏈�
+ {
+ sqlGroupID = "and 1 = 2";
+ }
+ sqlGroupID = sqlGroupID.Replace("HitemID", "HGroupID");//鏇挎崲sql璇彞涓殑HitemID
+ sWhere = sWhere + sqlGroupID;
+ }
+ //杩斿洖鍒楄〃淇℃伅
+ ds = oCn.RunProcReturn("select * from h_v_Pay_GroupBalBillList where 1=1 " + sWhere + " order by hmainid desc", "h_v_Pay_GroupBalBillList");
+ List<object> columnNameList = new List<object>();
+ //娣诲姞鍒楀悕
+ 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 = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鎴愬姛锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ヨ鍒楄〃淇℃伅澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 宸ヨ祫缁撶畻鍗�(闆嗕綋)鍒嗛〉鍒楄〃
+ [Route("Pay_GroupBalBillController/page")]
+ [HttpGet]
+ public json Pay_GroupBalBillPage(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(ModRightNameList, 3, false, user))
+ {
+ objJsonResult.code = CodeConstant.FAIL;
+ objJsonResult.count = CountConstant.FAIL;
+ objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍒ゆ柇鏄惁鏈夋煡鐪嬪叏閮ㄧ彮缁勭殑鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_Group_AllQuery", 3, false, user))
+ {
+ //濡傛灉娌℃湁杩欎釜鏉冮檺
+ //鏍规嵁鐢ㄦ埛瀵瑰簲鐝粍鐨勫叧绯伙紝杩囨护鏉′欢涓鍔犲彧鏄剧ず瀵瑰簲鐨勭彮缁�
+ DataSet dsHitemID = oCn.RunProcReturn("exec h_p_Gy_GetSQLGroupByUser '" + user + "'", "h_p_Gy_GetSQLGroupByUser");
+ string sqlGroupID = DBUtility.ClsPub.isStrNull(dsHitemID.Tables[0].Rows[0]["HBack"]);
+ if (sqlGroupID == "" || sqlGroupID == null)//濡傛灉娌℃湁缁戝畾鐝粍鍒欒浠栫湅涓嶅埌鎵�鏈�
+ {
+ sqlGroupID = "and 1 = 2";
+ }
+ sqlGroupID = sqlGroupID.Replace("HitemID", "HGroupID");//鏇挎崲sql璇彞涓殑HitemID
+ sWhere = sWhere + sqlGroupID;
+ }
+ sWhere = sWhere.Replace("'", "''");
+ if (sWhere == null || sWhere.Equals(""))
+ {
+ ds = oCn.RunProcReturn("exec h_p_Pay_GroupBalBillList " + page + "," + size + ",''", "h_p_Pay_GroupBalBillList");
+ }
+ else
+ {
+ ds = oCn.RunProcReturn("exec h_p_Pay_GroupBalBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_Pay_GroupBalBillList");
+ }
+
+ //娣诲姞鍒楀悕
+ 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
+
+ #region 宸ヨ祫缁撶畻鍗曪紙闆嗕綋锛� 鍒犻櫎
+ /// <summary>
+ /// 鍒犻櫎宸ヨ祫缁撶畻鍗曪紙闆嗕綋锛�
+ /// </summary>
+ /// <returns></returns>
+ [Route("Pay_GroupBalBillController/GetPay_GroupBalBill_Delete_Json")]
+ [HttpGet]
+ public object GetPay_GroupBalBill_Delete_Json(Int64 HInterID, string HMaker)
+ {
+ try
+ {
+ //鍒ゆ柇鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log(ModRightNameDrop, 3, false, HMaker))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鍒犻櫎鍔熻兘鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //鍒ゆ柇瀛樺湪鎬�
+ if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+ {
+ //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+ string s = "";
+ int sYear = 0;
+ int sPeriod = 0;
+ if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = s;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍒犻櫎鍓嶆帶鍒�
+ DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Pay_GroupBalBill_BeforeDelCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Pay_GroupBalBill_BeforeDelCtrl");
+ if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍒犻櫎鍓嶅垽鏂け璐ワ紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍒犻櫎澶辫触锛�" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ //鍒犻櫎鍗曟嵁锛堝寘鍚垹闄ゅ悗鎺у埗銆佸啓鍏ユ棩蹇楋級
+ if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Pay_GroupBalBill_AfterDelCtrl", HMaker, ref ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎宸ヨ祫缁撶畻鍗曪紙闆嗕綋锛夋垚鍔燂紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ 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 宸ヨ祫缁撶畻鍗曪紙闆嗕綋锛� 瀹℃牳/鍙嶅鏍�
+ /// <summary>
+ /// 瀹℃牳/鍙嶅鏍稿伐璧勭粨绠楀崟锛堥泦浣擄級
+ /// </summary>
+ /// <param name="HInterID">鍗曟嵁ID</param>
+ /// <param name="Type">瀹℃牳(1),鍙嶅鏍�(2)</param>
+ /// <param name="HMaker">瀹℃牳浜�</param>
+ /// <returns></returns>
+ [Route("Pay_GroupBalBillController/GetPay_GroupBalBill_Check_Json")]
+ [HttpGet]
+ public object GetPay_GroupBalBill_Check_Json(Int64 HInterID, int Type, string HMaker)
+ {
+ try
+ {
+ //鍒ゆ柇鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 3, false, HMaker))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡瀹℃牳/鍙嶅鏍稿姛鑳芥潈闄�,璇蜂笌绠$悊鍛樿仈绯伙紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //鍒ゆ柇瀛樺湪鎬�
+ if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+ {
+ //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+ string s = "";
+ int sYear = 0;
+ int sPeriod = 0;
+ if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = s;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //Type 1 瀹℃牳 2 鍙嶅鏍�
+ if (Type == 1)
+ {
+ if (oBill.omodel.HChecker.Trim() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插鏍革紝涓嶈兘鍐嶆瀹℃牳锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (oBill.omodel.HCloseMan.Trim() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插叧闂紝涓嶈兘鍐嶆瀹℃牳锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (oBill.omodel.HDeleteMan.Trim() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸蹭綔搴燂紝涓嶈兘鍐嶆瀹℃牳锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //瀹℃牳鍓嶆帶鍒�
+ DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Pay_GroupBalBill_BeforeCheckCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Pay_GroupBalBill_BeforeCheckCtrl");
+ if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳鍓嶅垽鏂け璐ワ紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触锛�" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ //瀹℃牳鍗曟嵁
+ if (!oBill.CheckBill(HInterID, oBill.omodel.HBillNo, "h_p_Pay_GroupBalBill_AfterCheckCtrl", HMaker, ref ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 瀹℃牳鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult; ;
+ }
+ }
+ else
+ {
+ if (oBill.omodel.HChecker.Trim() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁鏈鏍革紝涓嶉渶瑕佸弽瀹℃牳锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍙嶅鏍稿墠鎺у埗
+ DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Pay_GroupBalBill_BeforeUnCheckCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Pay_GroupBalBill_BeforeUnCheckCtrl");
+ if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶅鏍稿墠鍒ゆ柇澶辫触锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶅鏍稿け璐ワ紒" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ //鍙嶅鏍稿崟鎹�
+ if (!oBill.AbandonCheck(HInterID, oBill.omodel.HBillNo, "h_p_Pay_GroupBalBill_AfterUnCheckCtrl", HMaker, ref ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍙嶅鏍告垚鍔燂紒";
+ objJsonResult.data = null;
+ return objJsonResult; ;
+ }
+ }
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ 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 宸ヨ祫缁撶畻鍗�(闆嗕綋) 鎵归噺瀹℃牳
+ /// <summary>
+ /// 瀹℃牳/鍙嶅鏍稿伐璧勭粨绠楀崟(闆嗕綋)
+ /// </summary>
+ /// <param name="HInterID">鍗曟嵁ID</param>
+ /// <param name="Type">瀹℃牳(1),鍙嶅鏍�(2)</param>
+ /// <param name="HMaker">瀹℃牳浜�</param>
+ /// <returns></returns>
+ [Route("Pay_GroupBalBillController/CheckAll")]
+ [HttpGet]
+ public object CheckAll(string ids, int Type, string HMaker)
+ {
+ try
+ {
+ //澶勭悊瀛楃涓�
+ if (!string.IsNullOrEmpty(ids))
+ {
+ long[] idArray = Array.ConvertAll(ids.Split(','), long.Parse);
+ // 澶勭悊idArray...
+ oCn.BeginTran();
+ for (int i = 0; i < idArray.Length; i++)
+ {
+ objJsonResult = (json)GetPay_GroupBalBill_Check_Json(idArray[i], Type, HMaker);//瀹℃牳鎵ц
+ if (objJsonResult.count == 0)
+ {
+ oCn.RollBack();
+ objJsonResult.Message += "绗�" + (i + 1) + "琛屽嚭鐜伴棶棰樻棤娉曠户缁畬鎴�";
+ return objJsonResult;
+ }
+ }
+ oCn.Commit();
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "璇烽�夋嫨姝g‘琛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ objJsonResult.code = CodeConstant.SUCCEED;
+ objJsonResult.count = CountConstant.SUCCEED;
+ objJsonResult.Message = "鎵ц鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ oCn.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳鎴栧弽瀹℃牳宸ヨ祫缁撶畻鍗�(涓汉)澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 宸ヨ祫缁撶畻鍗曢泦浣撴壒閲忓鏍镐簩鐗�
+ /// <summary>
+ /// 宸ヨ祫缁撶畻鍗曟壒閲忓鏍镐簩鐗�
+ /// </summary>
+ /// <returns></returns>
+ [Route("Pay_GroupBalBillController/CheckAllByTimeAndGroup")]
+ [HttpGet]
+ public object CheckAllByTimeAndGroup(string sWhere, string HMaker)
+ {
+ try
+ {
+ //鍒ゆ柇鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 3, false, HMaker))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ ds = oCn.RunProcReturn($"exec h_p_Pay_GroupBalBill_CheckAllByTimeAndGroup " + sWhere + "", "h_p_Pay_GroupBalBill_CheckAllByTimeAndGroup");
+ if (ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀛樺偍杩囩▼鍒ゆ柇澶辫触锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鎴愬姛锛�";
+ objJsonResult.data = ds.Tables[0].Rows[0]["HRemark"];
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ヨ鍒楄〃淇℃伅澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 宸ヨ祫缁撶畻鍗曪紙闆嗕綋锛� 鍏抽棴/鍙嶅叧闂�
+ /// <summary>
+ /// 鍏抽棴/鍙嶅叧闂伐璧勭粨绠楀崟锛堥泦浣擄級
+ /// </summary>
+ /// <param name="HInterID">鍗曟嵁ID</param>
+ /// <param name="Type">鍏抽棴(1),鍙嶅叧闂�(2)</param>
+ /// <param name="HMaker">鍏抽棴浜�</param>
+ /// <returns></returns>
+ [Route("Pay_GroupBalBillController/GetPay_GroupBalBill_Close_Json")]
+ [HttpGet]
+ public object GetPay_GroupBalBill_Close_Json(Int64 HInterID, int Type, string HMaker)
+ {
+ try
+ {
+ //鍒ゆ柇鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log(ModRightNameClose, 3, false, HMaker))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鍏抽棴/鍙嶅叧闂姛鑳芥潈闄�,璇蜂笌绠$悊鍛樿仈绯伙紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //鍒ゆ柇瀛樺湪鎬�
+ if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+ {
+ //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+ string s = "";
+ int sYear = 0;
+ int sPeriod = 0;
+ if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = s;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //Type 1 鍏抽棴 2 鍙嶅叧闂�
+ if (Type == 1)
+ {
+ if (oBill.omodel.HCloseMan.Trim() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插叧闂紝涓嶈兘鍐嶆鍏抽棴锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍏抽棴鍗曟嵁
+ if (!oBill.CloseBill(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍏抽棴鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult; ;
+ }
+ }
+ else
+ {
+ if (oBill.omodel.HCloseMan.Trim() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁鏈叧闂紝涓嶉渶瑕佸弽鍏抽棴锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍙嶅叧闂崟鎹�
+ if (!oBill.CancelClose(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍙嶅叧闂垚鍔燂紒";
+ objJsonResult.data = null;
+ return objJsonResult; ;
+ }
+ }
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ 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 宸ヨ祫缁撶畻鍗曪紙闆嗕綋锛� 浣滃簾/鍙嶄綔搴�
+ /// <summary>
+ /// 浣滃簾/鍙嶄綔搴熷伐璧勭粨绠楀崟锛堥泦浣擄級
+ /// </summary>
+ /// <param name="HInterID">鍗曟嵁ID</param>
+ /// <param name="Type">浣滃簾(1),鍙嶄綔搴�(2)</param>
+ /// <param name="HMaker">浣滃簾浜�</param>
+ /// <returns></returns>
+ [Route("Pay_GroupBalBillController/GetPay_GroupBalBill_Cancelltion_Json")]
+ [HttpGet]
+ public object GetPay_GroupBalBill_Cancelltion_Json(Int64 HInterID, int Type, string HMaker)
+ {
+ try
+ {
+ //鍒ゆ柇鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 3, false, HMaker))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡浣滃簾/鍙嶄綔搴熷姛鑳芥潈闄�,璇蜂笌绠$悊鍛樿仈绯伙紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //鍒ゆ柇瀛樺湪鎬�
+ if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+ {
+ //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+ string s = "";
+ int sYear = 0;
+ int sPeriod = 0;
+ if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = s;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //Type 1 浣滃簾 2 鍙嶄綔搴�
+ if (Type == 1)
+ {
+ if (oBill.omodel.HDeleteMan.Trim() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸蹭綔搴燂紝涓嶈兘鍐嶆浣滃簾锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //浣滃簾鍗曟嵁
+ if (!oBill.Cancelltion(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 浣滃簾鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult; ;
+ }
+ }
+ else
+ {
+ if (oBill.omodel.HDeleteMan.Trim() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁鏈綔搴燂紝涓嶉渶瑕佸弽浣滃簾锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍙嶄綔搴熷崟鎹�
+ if (!oBill.AbandonCancelltion(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍙嶄綔搴熸垚鍔燂紒";
+ objJsonResult.data = null;
+ return objJsonResult; ;
+ }
+ }
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ 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 宸ヨ祫缁撶畻鍗�(闆嗕綋)妯″潡 浠庡垪琛ㄩ�変腑鎵撳紑鍗曟嵁锛岃繑鍥炲崟鎹俊鎭椂璋冪敤
+ /// <summary>
+ /// 宸ヨ祫缁撶畻鍗�(闆嗕綋)缂栬緫鏃讹紝鏍规嵁鍗曟嵁ID鑾峰彇鍗曟嵁淇℃伅
+ /// </summary>
+ /// <returns></returns>
+ [Route("Pay_GroupBalBillController/GetPay_GroupBalBill_Json")]
+ [HttpGet]
+ public object GetPay_GroupBalBill_Json(Int64 HInterID, string HMaker)
+ {
+ try
+ {
+ //鍒ゆ柇鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log(ModRightNameEdit, 3, false, HMaker))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡缂栬緫鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //杩斿洖鍒楄〃淇℃伅
+ ds = oCn.RunProcReturn("exec h_p_Pay_GroupBalBill_EditInit " + HInterID, "h_p_Pay_GroupBalBill_EditInit");
+ 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 = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鎴愬姛锛�";
+ objJsonResult.data = new
+ {
+ Mainlist = ds.Tables[0], //杩斿洖涓昏〃淇℃伅锛�0锛�
+ Sublist = ds.Tables[1], //杩斿洖瀛愯〃1淇℃伅锛�1锛�
+ Emplist = ds.Tables[2], //杩斿洖瀛愯〃2淇℃伅锛�2锛�
+ };
+ return objJsonResult;
+ }
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "杩斿洖宸ヨ祫缁撶畻鍗�(闆嗕綋)淇℃伅澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 宸ヨ祫缁撶畻鍗�(闆嗕綋)淇濆瓨
+ /// <summary>
+ /// 宸ヨ祫缁撶畻鍗�(闆嗕綋)淇濆瓨
+ /// </summary>
+ [Route("Pay_GroupBalBillController/GetPay_GroupBalBill_Save_Json")]
+ [HttpPost]
+ public object GetPay_GroupBalBill_Save_Json([FromBody] JObject sMainSub)
+ {
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string sMainStr = sArray[0].ToString(); //涓昏〃鏁版嵁
+ string sSubStr = sArray[1].ToString(); //瀛愯〃鏁版嵁
+ string sSubStr2 = sArray[2].ToString(); //瀛愯〃鏁版嵁2
+ string OperationType = sArray[3].ToString(); //鎿嶄綔绫诲瀷锛�1鏂板銆�2缂栬緫锛�
+ string HMaker = sArray[4].ToString(); //鍒跺崟浜�
+ try
+ {
+ //鍒ゆ柇鏉冮檺
+ if (OperationType == "1")
+ {
+ BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
+ //鍒ゆ柇鏂板鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log(ModRightName, 1, false, HMaker))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏂板鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ else
+ {
+ BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify;
+ //鍒ゆ柇缂栬緫鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log(ModRightNameEdit, 1, false, HMaker))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡缂栬緫鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ //琛ㄥご璧嬪��
+ sMainStr = sMainStr.Replace("\\", "");
+ sMainStr = sMainStr.Replace("\n", "");
+ sMainStr = "[" + sMainStr.ToString() + "]";
+ List<Model.ClsPay_GroupBalBillMain> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsPay_GroupBalBillMain>>(sMainStr);
+ foreach (Model.ClsPay_GroupBalBillMain oItem in lsmain)
+ {
+ //鍗曟嵁鍙锋槸鍚﹂噸澶�
+ if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, oItem.HInterID))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+ string s = "";
+ int sYear = 0;
+ int sPeriod = 0;
+ if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oItem.HDate, ref sYear, ref sPeriod, ref s) == false)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = s;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oItem.HYear = sYear;
+ oItem.HPeriod = sPeriod;
+ DBUtility.ClsPub.CurUserName = oItem.HMaker;
+ oBill.omodel = oItem;
+ }
+ //琛ㄤ綋璧嬪��
+ //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+ sSubStr = sSubStr.Substring(1, sSubStr.Length - 2);
+ sSubStr = sSubStr.Replace("\\", "");
+ sSubStr = sSubStr.Replace("\n", "");
+ sSubStr = "[" + sSubStr.ToString() + "]";
+ List<Model.ClsPay_GroupBalBillSub> ls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsPay_GroupBalBillSub>>(sSubStr);
+ int i = 0;
+ foreach (Model.ClsPay_GroupBalBillSub oItemSub in ls)
+ {
+ i++;
+ oItemSub.HEntryID = i;
+ oBill.DetailColl.Add(oItemSub);
+ }
+ //琛ㄤ綋璧嬪��2
+ //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+ sSubStr2 = sSubStr2.Substring(1, sSubStr2.Length - 2);
+ sSubStr2 = sSubStr2.Replace("\\", "");
+ sSubStr2 = sSubStr2.Replace("\n", "");
+ sSubStr2 = "[" + sSubStr2.ToString() + "]";
+ List<Model.ClsPay_GroupBalBillEmp> ls2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsPay_GroupBalBillEmp>>(sSubStr2);
+ int j = 0;
+ foreach (Model.ClsPay_GroupBalBillEmp oItemSub2 in ls2)
+ {
+ j++;
+ oItemSub2.HEntryID = j;
+ oBill.DetailEmpColl.Add(oItemSub2);
+ }
+
+ //淇濆瓨
+ bool bResult;
+ if (OperationType == "1") //鏂板淇濆瓨
+ {
+ bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+ }
+ else //缂栬緫淇濆瓨
+ {
+ bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+ }
+
+ if (bResult)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; //鎴愬姛锛�
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ #endregion
+
+
+
+
+
+
+
+
+ /// <summary>
+ /// 杩斿洖宸ヨ祫缁撶畻涓汉鍒楄〃(闆嗕綋)
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Pay_GroupBalBill/GetGroupBalBill")]
+ [HttpGet]
+ public object GetGroupBalBill(string sWhere,string user)
+ {
+ try
+ {
+ if (!DBUtility.ClsPub.Security_Log("Pay_SingleBalBillList", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
ds = Sc_GetGroupBalBill(sWhere);
+
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�";
@@ -55,17 +1043,17 @@
{
if (sWhere == null || sWhere.Equals(""))
{
- return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Pay_GroupBalBillList order by 鏃ユ湡 desc", "h_v_Pay_GroupBalBillList");
+ return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Pay_GroupBalBillList order by hmainid desc", "h_v_Pay_GroupBalBillList");
}
else
{
string sql1 = "select * from h_v_Pay_GroupBalBillList where 1 = 1 ";
- string sql = sql1 + sWhere + "order by 鏃ユ湡 desc";
+ string sql = sql1 + sWhere + " order by hmainid desc";
return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Pay_GroupBalBillList");
}
}
-
+
#region[宸ヨ祫缁撶畻闆嗕綋鍗曠紪杈戞椂鑾峰彇琛ㄥご鏁版嵁]
[Route("Pay_GroupBalBill/Pay_GroupBalBillListCheckDetail")]
[HttpGet]
@@ -89,19 +1077,25 @@
public object Pay_GroupBalBillListProjectDetai(string sqlWhere)
{
DataSet ds;
+ DataSet ds1;
+ List<object> list = new List<object>();
try
{
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
- string sql1 = "SELECT HMaterID,HMaterCode,HMaterName, HDeptID,閮ㄩ棬浠g爜,閮ㄩ棬" +
- ",HGroupID,鐝粍浠g爜,鐝粍,鎽樿,鍐呴儴鍗曟嵁鍙�,琛ㄥご澶囨敞,鍒跺崟浜�,鍒跺崟鏃ユ湡" +
- ",瀹℃牳浜�,瀹℃牳鏃ユ湡,淇敼浜�,淇敼鏃ユ湡,鍏抽棴浜�, 鍏抽棴鏃ユ湡,HProcID,HProcNumber,HProcName" +
- ",鏁伴噺,閲戦 FROM h_v_Pay_GroupBalBillList where 1 = 1 ";
- string sql = sql1 + sqlWhere;
+ string sql = @"SELECT HMaterID,HMaterCode,HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,HUnitID,HUnitNumber,HUnitName,
+ HProcID,HProcNumber,HProcName,HSourceID,HSourceNumber,HSourceName,宸ユ椂 HTimes,鏁伴噺 HQty,宸ヤ环 HPrice,閲戦 HMoney, HSumMoney,HOtherSubsidy,HOtherDeduct,HPayMoney FROM h_v_Pay_GroupBalBillList where 1 = 1 " + sqlWhere;
ds = oCN.RunProcReturn(sql, "h_v_Pay_GroupBalBillList");
+ string sql1 = @"select
+ HEmpID ,b.HNumber HEmpNumber, b.HName HEmpName, b.HEmpRate HEmpRate, HBaseTimes, HMoney, HOtherSubsidy, HOtherSubsidy, HYF,'' HISZF ,'' HISFT , a.HRemark
+from Pay_GroupBalBillEmp a
+ left join Gy_Employee b on a.HEmpID = b.HItemID where 1 = 1 " + sqlWhere.Replace("hmainid", "HInterID");
+ ds1 = oCN.RunProcReturn(sql1, "Pay_GroupBalBillEmp");
+ list.Add(ds.Tables[0]);
+ list.Add(ds1.Tables[0]);
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
- objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = list;
}
catch (Exception e)
{
@@ -113,46 +1107,164 @@
return objJsonResult;
}
#endregion
-
+
+
+
+ #region 璁惧淇濆吇璁″垝琛� 淇濆瓨/缂栬緫
/// <summary>
- ///宸ヨ祫缁撶畻涓汉鍗曞垹闄ゅ姛鑳�
+ /// 淇濆瓨妯″叿缁翠慨鍗�
/// </summary>
+ /// <param name="msg"></param>
/// <returns></returns>
- [Route("Pay_GroupBalBill/DeltetGroupBalBill")]
- [HttpGet]
- public object Pay_GroupBalBill(string HInterID)
+ [Route("Pay_GroupBalBill/AddBill")]
+ [HttpPost]
+ public object AddBill([FromBody] JObject sMainSub)
{
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString();
+ string msg3 = sArray[1].ToString();
+ string msg4 = sArray[2].ToString();
+ string msg5 = sArray[3].ToString();
+ string UserName = "";
+ ListModels oListModels = new ListModels();
try
{
- oCN.BeginTran();
- oCN.RunProc("Delete From Pay_GroupBalBillMain where HInterID = " + HInterID);
- oCN.RunProc("Delete From Pay_GroupBalBillSub where HInterID = " + HInterID);
- oCN.Commit();
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
- objJsonResult.data = null;
- return objJsonResult;
+ if (!DBUtility.ClsPub.Security_Log("Pay_SingleBalBill_Edit", 1, false, msg5))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ DLL.ClsPay_GroupBalBill oBill = new DLL.ClsPay_GroupBalBill();
+ List<Models.ClsPay_GroupBalBillMain> lsmain = new List<Models.ClsPay_GroupBalBillMain>();
+ msg2 = msg2.Replace("\\", "");
+ msg2 = msg2.Replace("\n", ""); //\n
+ lsmain = oListModels.getObjectByJson_Pay_GroupBalBillMain(msg2);
+ foreach (Models.ClsPay_GroupBalBillMain oItem in lsmain)
+ {
+ UserName = oItem.HMaker; //鍒跺崟浜�
+ oItem.HBillType = "2202";
+ oItem.HBillSubType = "2202";
+ //oItem.HInterID =0;
+ //oItem.HBillNo = "";
+ oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡
+ oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+ //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
+ if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ oBill.omodel = oItem;
+ }
+ //淇濆吇椤硅〃浣撴暟鎹�
+ //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+ msg3 = msg3.Substring(1, msg3.Length - 2);
+ msg3 = msg3.Replace("\\", "");
+ msg3 = msg3.Replace("\n", ""); //\n
+ //msg2 = msg2.Replace("'", "鈥�");
+ List<Models.ClsPay_GroupBalBillSub> ls = new List<Models.ClsPay_GroupBalBillSub>();
+ ls = oListModels.getObjectByJson_Pay_GroupBalBillSub(msg3);
+ int i = 0;
+ foreach (Models.ClsPay_GroupBalBillSub item in ls)
+ {
+ i++;
+ item.HEntryID = i;
+ //oItemSub.HCloseMan = ""; //琛屽叧闂�
+ item.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+ item.HCloseType = false; //鍏抽棴绫诲瀷
+ //oItemSub.HRemark = ""; //澶囨敞
+ item.HSourceInterID = 0; // 婧愬崟涓诲唴鐮�
+ item.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮�
+ //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿
+ //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
+ item.HRelationQty = 0; //鍏宠仈鏁伴噺
+ oBill.DetailColl.Add(item);
+
+ }
+ //閰嶄欢椤硅〃浣撴暟鎹�
+ //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+ msg4 = msg4.Substring(1, msg4.Length - 2);
+ msg4 = msg4.Replace("\\", "");
+ msg4 = msg4.Replace("\n", ""); //\n
+ //msg2 = msg2.Replace("'", "鈥�");
+ List<Models.ClsPay_GroupBalBillEmp> ls1 = new List<Models.ClsPay_GroupBalBillEmp>();
+ ls1 = oListModels.getObjectByJson_Pay_GroupBalBillEmp(msg4);
+ int j = 0;
+ foreach (Models.ClsPay_GroupBalBillEmp oItemSub in ls1)
+ {
+
+ j++;
+ oItemSub.HEntryID = j;
+ //oItemSub.HCloseMan = ""; //琛屽叧闂�
+ oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+ oItemSub.HCloseType = false; //鍏抽棴绫诲瀷
+ //oItemSub.HRemark = ""; //澶囨敞
+ oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮�
+ oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮�
+ //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿
+ //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
+ oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺
+ oBill.DetailEmpColl.Add(oItemSub);
+
+ }
+ //淇濆瓨
+ //淇濆瓨瀹屾瘯鍚庡鐞�
+ bool bResult;
+ if (oBill.omodel.HInterID == 0)
+ {
+ // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+ bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+ }
+ else
+ {
+ bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+ }
+ if (bResult)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+ //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
}
catch (Exception e)
{
- oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "Exception锛�" + e.ToString();
- objJsonResult.data = null;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+ objJsonResult.data = 1;
return objJsonResult;
}
}
+ #endregion
+
[Route("Pay_GroupBalBill/getGroupBalBillPrice")]
[HttpGet]
- public object getGroupBalBillPrice(string HMaterID,string HProcID)
+ public object getGroupBalBillPrice(string HMaterID, string HProcID)
{
try
{
- DataSet ds = oCN.RunProcReturn("select 鍗曚环 from h_v_Gy_ProcPriceList where HMaterID='" + HMaterID + "' and HProcID='" + HProcID + "'", "h_v_Gy_ProcPriceList");
+ DataSet ds = oCn.RunProcReturn("select 鍗曚环 from h_v_Gy_ProcPriceList where HMaterID='" + HMaterID + "' and HProcID='" + HProcID + "'", "h_v_Gy_ProcPriceList");
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "鏌ヨ鎴愬姛锛�";
@@ -169,5 +1281,594 @@
}
}
//
+
+
+
+
+
+ #region 宸ヨ祫缁撶畻鍗�(闆嗕綋) 鏂板/缂栬緫-淇濆瓨
+ #region 琛ㄥご鏁版嵁
+ public class Pay_GroupBalBillMain
+ {
+ public int HInterID;
+ public string HBillNo;
+ public string HDate;
+ public string HInnerBillNo;
+ public int HGroupID;
+ public string HGroupName;
+ public double HSumMoney;
+ public double HOtherSubsidy;
+ public int HDeptID;
+ public string HDeptName;
+ public double HPayMoney;
+ public double HOtherDeduct;
+ 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 瀛愯〃1鏁版嵁
+ public class Pay_GroupBalBillSub
+ {
+ public int RowID;
+ public int HMaterID;
+ public string HMaterNumber;
+ public string HMaterName;
+ public string HMaterModel;
+ public int HUnitID;
+ public string HUnitNumber;
+ public string HUnitName;
+ public int HProcID;
+ public string HProcNumber;
+ public string HProcName;
+ public int HSourceID;
+ public string HSourceNumber;
+ public string HSourceName;
+ public double HTimes;
+ public double HQty;
+ public double HPrice;
+ public double HMoney;
+ public string HRemark;
+ 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 int HSourceInterID;
+ public int HSourceEntryID;
+ public string HSourceBillNo;
+ public string HSourceBillType;
+ public double HRelationQty;
+ public double HRelationMoney;
+ }
+ #endregion
+ #region 瀛愯〃2鏁版嵁
+ public class Pay_GroupBalBillEmp
+ {
+ public int RowID;
+ public int HEmpID;
+ public string HEmpNumber;
+ public string HEmpName;
+ public double HEmpRate;
+ public double HBaseTimes;
+ public double HMoney;
+ public double HOtherSubsidy;
+ public double HOtherDeduct;
+ public double HYF;
+ public bool HIsPay;
+ public bool HAvgFlag;
+ public string HRemark;
+ }
+ #endregion
+ #region 宸ヨ祫缁撶畻鍗�(闆嗕綋) 鏂板/缂栬緫
+ /// <summary>
+ /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Pay_GroupBalBill/AddGroupBalBill")]
+ [HttpPost]
+ public object AddBill_Pay_GroupBalBill([FromBody] JObject sMainSub)
+ {
+ //鑾峰彇鍙傛暟
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ //寮�濮嬩簨鍔�
+ oCn.BeginTran();
+ //淇濆瓨涓昏〃
+ objJsonResult = AddBillMain_Pay_GroupBalBill(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_GroupBalBill(string msg1)
+ {
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString();
+ string msg3 = sArray[1].ToString();
+ string msg4 = sArray[2].ToString();
+ int OperationType = int.Parse(sArray[3].ToString());//鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗
+ string user = sArray[4].ToString();//鐢ㄦ埛鍚�
+ string HComputerName = SystemInformation.ComputerName; //璁惧鍚嶇О
+
+ try
+ {
+ if (OperationType == 1)
+ {
+ //鍒ゆ柇鏄惁鏈夌紪杈戞潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Pay_GroupBalBill_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_GroupBalBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犵紪杈戞潈闄�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ msg2 = "[" + msg2.ToString() + "]";
+ List<Pay_GroupBalBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Pay_GroupBalBillMain>>(msg2);
+
+
+ int HYear = int.Parse(mainList[0].HDate.Split('-')[0]);
+ int HPeriod = int.Parse(mainList[0].HDate.Split('-')[1]);
+ string HBillType = "2201";
+ 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;
+ string HGroupName = mainList[0].HGroupName;
+ double HSumMoney = mainList[0].HSumMoney;
+ double HOtherSubsidy = mainList[0].HOtherSubsidy;
+ int HDeptID = mainList[0].HDeptID;
+ string HDeptName = mainList[0].HDeptName;
+ double HPayMoney = mainList[0].HPayMoney;
+ double HOtherDeduct = mainList[0].HOtherDeduct;
+ string HSourceBillType = mainList[0].HSourceBillType;
+ int HSourceBillID = mainList[0].HSourceBillID;
+ string HSourceBillNo = mainList[0].HSourceBillNo;
+ string HExplanation = mainList[0].HExplanation;
+ string HRemark = mainList[0].HRemark;
+ string HMaker = mainList[0].HMaker;
+ DateTime HMakerDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString());
+ string HUpdater = mainList[0].HUpdater;
+ DateTime HUpdaterDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString());
+ string HChecker = mainList[0].HChecker;
+ string HCheckerDate = mainList[0].HCheckerDate;
+ string HCloseMan = mainList[0].HCloseMan;
+ string HCloseManDate = mainList[0].HCloseManDate;
+ string HDeleteMan = mainList[0].HDeleteMan;
+ string HDeleteManDate = mainList[0].HDeleteManDate;
+ string HBacker = mainList[0].HBacker;
+ string HBackerDate = mainList[0].HBackerDate;
+ string HBackRemark = mainList[0].HBackRemark;
+
+ //淇濆瓨鍓嶆帶鍒�
+ DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Pay_GroupBalBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Pay_GroupBalBill_BeforeSaveCtrl");
+ if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ ds = oCn.RunProcReturn("select * from Pay_GroupBalBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_GroupBalBillMain");
+
+ if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//鏂板
+ {
+ string sql = "insert into Pay_GroupBalBillMain" +
+ "(HYear,HPeriod,HBillType,HBillSubType,HBillStatus,HInterID,HBillNo,HDate,HInnerBillNo,HGroupID,HSumMoney,HOtherSubsidy,HDeptID" +
+ ",HPayMoney,HOtherDeduct,HMainSourceBillType,HMainSourceInterID,HMainSourceBillNo,HExplanation,HRemark,HMaker,HMakeDate) " +
+ "values(" +
+ "" + HYear +
+ "," + HPeriod +
+ ",'" + HBillType +
+ "','" + HBillSubType +
+ "','" + HBillStatus +
+ "'," + HInterID +
+ ",'" + HBillNo +
+ "','" + HDate +
+ "','" + HInnerBillNo +
+ "'," + HGroupID +
+ ",'" + HSumMoney +
+ "','" + HOtherSubsidy +
+ "'," + HDeptID +
+ "," + HPayMoney +
+ "," + HOtherDeduct +
+ ",'" + HSourceBillType +
+ "'," + HSourceBillID +
+ ",'" + HSourceBillNo +
+ "','" + HExplanation +
+ "','" + HRemark +
+ "','" + HMaker +
+ "','" + HMakerDate +
+ "')";
+
+ //涓昏〃
+ 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_GroupBalBillMain set " +
+ "HYear = " + HYear +
+ ", HPeriod = " + HPeriod +
+ ", HBillNo = '" + HBillNo +
+ "', HDate = '" + HDate +
+ "', HInnerBillNo = '" + HInnerBillNo +
+ "', HGroupID = " + HGroupID +
+ ", HSumMoney = " + HSumMoney +
+ ", HOtherSubsidy = " + HOtherSubsidy +
+ ", HDeptID = " + HDeptID +
+ ", HPayMoney = " + HPayMoney +
+ ", HOtherDeduct = " + HOtherDeduct +
+ ", HMainSourceBillType = '" + HSourceBillType +
+ "', HMainSourceInterID = " + HSourceBillID +
+ ", HMainSourceBillNo = '" + HSourceBillNo +
+ "', HExplanation = '" + HExplanation +
+ "', HRemark = '" + HRemark +
+ "', HUpdater = '" + HUpdater +
+ "', HUpdateDate = '" + HUpdaterDate +
+ "' where HInterID = " + HInterID;
+
+ oCn.RunProc(sql);
+
+ //鍒犻櫎瀛愯〃
+ oCn.RunProc("delete from Pay_GroupBalBillEmp where HInterID='" + HInterID + "'");
+ oCn.RunProc("delete from Pay_GroupBalBillSub 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 = AddBillSub1_Pay_GroupBalBill(msg3, HInterID, HBillNo, OperationType);
+ objJsonResult = AddBillSub2_Pay_GroupBalBill(msg4, HInterID, HBillNo, OperationType);
+
+
+ if (objJsonResult.code == "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = objJsonResult.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //淇濆瓨鍚庢帶鍒�
+ DataSet AfterDs = oCn.RunProcReturn("Exec h_p_Pay_GroupBalBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Pay_GroupBalBill_AfterSaveCtrl");
+ if (AfterDs == null || AfterDs.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨鍚庡垽鏂け璐ワ紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ if (DBUtility.ClsPub.isLong(AfterDs.Tables[0].Rows[0]["HBack"]) == 1)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(AfterDs.Tables[0].Rows[0]["HRemark"]);
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ 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 娣诲姞 宸ヨ祫缁撶畻鍗�(闆嗕綋) 瀛愯〃1
+ public json AddBillSub1_Pay_GroupBalBill(string msg3, long HInterID, string HBillNo, int OperationType)
+ {
+ List<Pay_GroupBalBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Pay_GroupBalBillSub>>(msg3);
+ int i = 0; //浣滀负瀛愯〃鍐呯爜
+ foreach (Pay_GroupBalBillSub oSub in DetailColl)
+ {
+ i++; //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
+
+ int HEntryID = i;
+
+ int HMaterID = oSub.HMaterID;
+ int HUnitID = oSub.HUnitID;
+ int HProcID = oSub.HProcID;
+ int HSourceID = oSub.HSourceID;
+ double HTimes = oSub.HTimes;
+ double HQty = oSub.HQty;
+ double HPrice = oSub.HPrice;
+ double HMoney = oSub.HMoney;
+ string HRemark = oSub.HRemark;
+ 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;
+ 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 sql = "insert into Pay_GroupBalBillSub" +
+ "(HInterID,HEntryID,HMaterID,HUnitID,HProcID,HSourceID,HTimes,HQty,HPrice,HMoney,HRemark,HICMOInterID,HICMOBillNo,HProcReportInterID" +
+ ",HProcReportEntryID,HProcReportBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HSourceInterID,HSourceEntryID,HSourceBillNo" +
+ ",HSourceBillType,HRelationQty,HRelationMoney) " +
+ "values(" +
+ "" + HInterID +
+ "," + HEntryID +
+ "," + HMaterID +
+ "," + HUnitID +
+ "," + HProcID +
+ "," + HSourceID +
+ "," + HTimes +
+ "," + HQty +
+ "," + HPrice +
+ "," + HMoney +
+ ",'" + HRemark +
+ "'," + HICMOInterID +
+ ",'" + HICMOBillNo +
+ "'," + HProcReportInterID +
+ "," + HProcReportEntryID +
+ ",'" + HProcReportBillNo +
+ "'," + HProcPlanInterID +
+ "," + HProcPlanEntryID +
+ ",'" + HProcPlanBillNo +
+ "'," + HSourceInterID +
+ "," + HSourceEntryID +
+ ",'" + HSourceBillNo +
+ "','" + HSourceBillType +
+ "'," + HRelationQty +
+ "," + HRelationMoney +
+ ")";
+
+ oCn.RunProc(sql);
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = null;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ #endregion
+ #region 娣诲姞 宸ヨ祫缁撶畻鍗�(闆嗕綋) 瀛愯〃2
+ public json AddBillSub2_Pay_GroupBalBill(string msg3, long HInterID, string HBillNo, int OperationType)
+ {
+ List<Pay_GroupBalBillEmp> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Pay_GroupBalBillEmp>>(msg3);
+ int i = 0; //浣滀负瀛愯〃鍐呯爜
+ foreach (Pay_GroupBalBillEmp oSub in DetailColl)
+ {
+ i++; //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
+
+ int HEntryID = i;
+
+ int HEmpID = oSub.HEmpID;
+ string HEmpNumber = oSub.HEmpNumber;
+ string HEmpName = oSub.HEmpName;
+ double HEmpRate = oSub.HEmpRate;
+ double HBaseTimes = oSub.HBaseTimes;
+ double HMoney = oSub.HMoney;
+ double HOtherSubsidy = oSub.HOtherSubsidy;
+ double HOtherDeduct = oSub.HOtherDeduct;
+ double HYF = oSub.HYF;
+ int HIsPay = oSub.HIsPay?1:0;
+ int HAvgFlag = oSub.HAvgFlag?1:0;
+ string HRemark = oSub.HRemark;
+
+
+
+ string sql = "insert into Pay_GroupBalBillEmp" +
+ "(HInterID,HEntryID,HEmpID,HEmpRate,HBaseTimes,HMoney,HOtherSubsidy,HOtherDeduct,HYF,HIsPay,HAvgFlag,HRemark) " +
+ "values(" +
+ "" + HInterID +
+ "," + HEntryID +
+ "," + HEmpID +
+ "," + HEmpRate +
+ "," + HBaseTimes +
+ "," + HMoney +
+ "," + HOtherSubsidy +
+ "," + HOtherDeduct +
+ "," + HYF +
+ "," + HIsPay +
+ "," + HAvgFlag +
+ ",'" + HRemark +
+ "')";
+
+ oCn.RunProc(sql);
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = null;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ #endregion
+ #endregion
+
+ #region 宸ヨ祫缁撶畻鍗�(闆嗕綋) 缂栬緫-椤甸潰璧嬪��
+ /// <summary>
+ ///鍙傛暟锛歴tring HInterID銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Pay_GroupBalBill/editInit")]
+ [HttpGet]
+ public object getGroupBalBilleditInit(string HInterID, string user)
+ {
+ try
+ {
+ List<DataTable> tableList = new List<DataTable>();
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Pay_GroupBalBill_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_GroupBalBill_EditInit " + HInterID, "h_p_Pay_GroupBalBill_EditInit");
+ tableList.Add(ds.Tables[0]);
+ tableList.Add(ds.Tables[1]);
+ tableList.Add(ds.Tables[2]);
+
+ 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 鏍规嵁鐝粍鑾峰緱鑱屽憳鍒楄〃
+ [Route("Pay_GroupBalBill/getEmpListBasedGroupID")]
+ [HttpGet]
+ public object getEmpListBasedGroupID(int HGroupID)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+
+ string sql = "select * from Gy_Employee where HGroupID = " + HGroupID;
+ ds = oCn.RunProcReturn(sql, "EmpList");
+
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏈壘鍒拌鐝粍瀵瑰簲鐨勮亴鍛樺垪琛紒锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //娣诲姞鍒楀悕
+ 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
}
}
\ No newline at end of file
--
Gitblit v1.9.1