From 3d0568d206f913ddcbc9cb8df956af8619df2242 Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期一, 07 八月 2023 14:41:58 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
---
WebAPI/Controllers/工资管理/Pay_SalaryCalculateController.cs | 939 ++++++++
WebAPI/Controllers/工资管理/Pay_ProcPriceRequestBillController.cs | 841 +++++++
WebAPI/Controllers/工资管理/Pay_ErrWorkTimesRequestBillController.cs | 865 +++++++
WebAPI/Controllers/工资管理/Pay_OutApplyBillController.cs | 838 +++++++
WebAPI/Controllers/人事管理/职员异动单/HR_EmpChangeBillController.cs | 810 ++++++
WebAPI/Controllers/工资管理/Pay_WorkTimesBillController.cs | 50
WebAPI/Controllers/工资管理/Pay_SingleBalBillController.cs | 27
WebAPI/Properties/PublishProfiles/FolderProfile.pubxml | 2
WebAPI/WebAPI.csproj | 8
WebAPI/Controllers/工资管理/Pay_PayMentBillController.cs | 877 +++++++
WebAPI/Controllers/工资管理/Pay_DuSubsidyItemBillController.cs | 802 ++++++
WebAPI/Controllers/工资管理/Pay_OverApplyBillController.cs | 825 +++++++
WebAPI/Controllers/工资管理/Pay_GroupBalBillController.cs | 47
13 files changed, 6,929 insertions(+), 2 deletions(-)
diff --git "a/WebAPI/Controllers/\344\272\272\344\272\213\347\256\241\347\220\206/\350\201\214\345\221\230\345\274\202\345\212\250\345\215\225/HR_EmpChangeBillController.cs" "b/WebAPI/Controllers/\344\272\272\344\272\213\347\256\241\347\220\206/\350\201\214\345\221\230\345\274\202\345\212\250\345\215\225/HR_EmpChangeBillController.cs"
new file mode 100644
index 0000000..dbd028e
--- /dev/null
+++ "b/WebAPI/Controllers/\344\272\272\344\272\213\347\256\241\347\220\206/\350\201\214\345\221\230\345\274\202\345\212\250\345\215\225/HR_EmpChangeBillController.cs"
@@ -0,0 +1,810 @@
+锘縰sing DBUtility;
+using Model;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+using System.Web.Http;
+using System.Windows.Forms;
+using WebAPI.Models;
+
+namespace WebAPI.Controllers.椤圭洰绠$悊.宸ヤ綔浠诲姟
+{
+ public class HR_EmpChangeBillController : ApiController
+ {
+ public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
+ private json objJsonResult = new json();
+ public DataSet ds = new DataSet();
+ public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill();
+ string user_LongShan = "";
+ string HName_LongShan = "";
+
+ #region 鑱屽憳寮傚姩鍗� 鏂板/缂栬緫
+ #region 鑱屽憳寮傚姩鍗� 琛ㄥご鏁版嵁
+ public class HR_EmpChangeBillMain
+ {
+ public int HInterID;
+ public string HBillNo;
+ public string HDate;
+ public string HInnerBillNo;
+ public int HDeptID;
+ public string HDeptName;
+ 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 HR_EmpChangeBillSub
+ {
+ public int HEmpID;
+ public string HEmpNumber;
+ public string HEmpName;
+ public int HOldDeptID;
+ public string HOldDeptNumber;
+ public string HOldDeptName;
+ public int HDeptID;
+ public string HDeptNumber;
+ public string HDeptName;
+ public int HOldGroupID;
+ public string HOldGroupNumber;
+ public string HOldGroupName;
+ public int HGroupID;
+ public string HGroupNumber;
+ public string HGroupName;
+ public int HOldPostID;
+ public string HOldPostNumber;
+ public string HOldPostName;
+ public int HPostID;
+ public string HPostNumber;
+ public string HPostName;
+ public string HReason;
+ }
+ #endregion
+
+ #region 鑱屽憳寮傚姩鍗� 鏂板/缂栬緫
+ /// <summary>
+ /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("HR_EmpChangeBill/AddEmpChangeBill")]
+ [HttpPost]
+ public object AddBill_HR_EmpChangeBilll([FromBody] JObject sMainSub)
+ {
+ //鑾峰彇鍙傛暟
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ //寮�濮嬩簨鍔�
+ oCN.BeginTran();
+ //淇濆瓨涓昏〃
+ objJsonResult = AddBillMain_HR_EmpChangeBill(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_HR_EmpChangeBill(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("HR_EmpChangeBill_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("HR_EmpChangeBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犵紪杈戞潈闄�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ msg2 = "[" + msg2.ToString() + "]";
+ List<HR_EmpChangeBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<HR_EmpChangeBillMain>>(msg2);
+
+
+ int HYear = int.Parse(mainList[0].HDate.Split('-')[0]);
+ int HPeriod = int.Parse(mainList[0].HDate.Split('-')[1]);
+ string HBillType = "2310";
+ 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 HDeptID = mainList[0].HDeptID;
+ 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;
+ 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;
+
+
+ //if (OperationType == 2)
+ //{
+ // ds = oCN.RunProcReturn("select * from PM_ProjectBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectBillMain");
+ // 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 HR_EmpChangeBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "HR_EmpChangeBillMain");
+
+ if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//鏂板
+ {
+ string sql = "insert into HR_EmpChangeBillMain" +
+ "(HYear,HPeriod,HBillType,HBillSubType,HBillStatus,HInterID,HBillNo,HDate,HInnerBillNo,HDeptID,HExplanation,HRemark, HMaker,HMakeDate) " +
+ "values(" +
+ "" + HYear +
+ "," + HPeriod +
+ ",'" + HBillType +
+ "','" + HBillSubType +
+ "'," + HBillStatus +
+ "," + HInterID +
+ ",'" + HBillNo +
+ "','" + HDate +
+ "','" + HInnerBillNo +
+ "'," + HDeptID +
+ ",'" + 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 HR_EmpChangeBillMain set " +
+ "HYear = " + HYear +
+ ", HPeriod = " + HPeriod +
+ ", HBillNo = '" + HBillNo +
+ "', HDate = '" + HDate +
+ "', HInnerBillNo = '" + HInnerBillNo +
+ "', HDeptID = " + HDeptID +
+ ", HExplanation = '" + HExplanation +
+ "', HRemark = '" + HRemark +
+ "', HUpdater = '" + HUpdater +
+ "', HUpdateDate = '" + HUpdaterDate +
+ "' where HInterID = " + HInterID;
+
+ oCN.RunProc(sql);
+
+ //鍒犻櫎瀛愯〃
+ oCN.RunProc("delete from HR_EmpChangeBillSub 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_HR_EmpChangeBill(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 AddBillSub1_HR_EmpChangeBill(string msg3, long HInterID, string HBillNo, int OperationType)
+ {
+ List<HR_EmpChangeBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<HR_EmpChangeBillSub>>(msg3);
+ int i = 0; //浣滀负瀛愯〃鍐呯爜
+ foreach (HR_EmpChangeBillSub oSub in DetailColl)
+ {
+ i++; //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
+
+ int HEntryID = i;
+
+ int HEmpID = oSub.HEmpID;
+ int HOldDeptID = oSub.HOldDeptID;
+ int HDeptID = oSub.HDeptID;
+ int HOldGroupID = oSub.HOldGroupID;
+ int HGroupID = oSub.HGroupID;
+ int HOldPostID = oSub.HOldPostID;
+ int HPostID = oSub.HPostID;
+ string HReason = oSub.HReason;
+
+
+ string sql = "insert into HR_EmpChangeBillSub" +
+ "(HInterID,HEntryID,HEmpID,HOldDeptID,HDeptID,HOldGroupID,HGroupID,HOldPostID,HPostID,HReason) " +
+ "values(" +
+ "" + HInterID +
+ "," + HEntryID +
+ "," + HEmpID +
+ "," + HOldDeptID +
+ "," + HDeptID +
+ "," + HOldGroupID +
+ "," + HGroupID +
+ "," + HOldPostID +
+ "," + HPostID +
+ ",'" + HReason +
+ "')";
+ 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("HR_EmpChangeBill/editInit")]
+ [HttpGet]
+ public object getEmpChangeBilleditInit(string HInterID, string user)
+ {
+ try
+ {
+ List<DataTable> tableList = new List<DataTable>();
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("HR_EmpChangeBill_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_HR_EmpChangeBill_EditInit " + HInterID, "h_p_HR_EmpChangeBill_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 鑱屽憳寮傚姩鍗� 鏌ヨ
+ [Route("HR_EmpChangeBill/list")]
+ [HttpGet]
+ public object getEmpChangeBillList(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ if (!DBUtility.ClsPub.Security_Log("HR_EmpChangeBillList", 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_HR_EmpChangeBillList order by hmainid desc", "h_v_HR_EmpChangeBillList");
+ }
+ else
+ {
+ string sql1 = "select * from h_v_HR_EmpChangeBillList where 1 = 1 ";
+ string sql = sql1 + sWhere + " order by hmainid desc";
+ ds = oCN.RunProcReturn(sql, "h_v_HR_EmpChangeBillList");
+ }
+
+ //娣诲姞鍒楀悕
+ 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("HR_EmpChangeBill/delete")]
+ [HttpGet]
+ public object deleteEmpChangeBill(string HInterID, string user)
+ {
+ try
+ {
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("HR_EmpChangeBill_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 HR_EmpChangeBillMain where HInterID = " + HInterID);
+ oCN.RunProc("delete from HR_EmpChangeBillSub 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("HR_EmpChangeBill/AuditHR_EmpChangeBill")]
+ [HttpGet]
+ public object AuditHR_EmpChangeBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
+ if (!DBUtility.ClsPub.Security_Log("HR_EmpChangeBill_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 = "HR_EmpChangeBillMain";
+ 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("HR_EmpChangeBill/CloseHR_EmpChangeBill")]
+ [HttpGet]
+ public object CloseHR_EmpChangeBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+ if (!DBUtility.ClsPub.Security_Log("HR_EmpChangeBill_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 = "HR_EmpChangeBillMain";
+ 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("HR_EmpChangeBill/DropHR_EmpChangeBill")]
+ [HttpGet]
+ public object DropHR_EmpChangeBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈変綔搴熸潈闄�
+ if (!DBUtility.ClsPub.Security_Log("HR_EmpChangeBill_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 = "HR_EmpChangeBillMain";
+ 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
diff --git "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_DuSubsidyItemBillController.cs" "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_DuSubsidyItemBillController.cs"
new file mode 100644
index 0000000..9f45657
--- /dev/null
+++ "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_DuSubsidyItemBillController.cs"
@@ -0,0 +1,802 @@
+锘縰sing DBUtility;
+using Model;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+using System.Web.Http;
+using System.Windows.Forms;
+using WebAPI.Models;
+
+namespace WebAPI.Controllers.椤圭洰绠$悊.宸ヤ綔浠诲姟
+{
+ public class Pay_DuSubsidyItemBillController : ApiController
+ {
+ public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
+ private json objJsonResult = new json();
+ public DataSet ds = new DataSet();
+ public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill();
+ string user_LongShan = "";
+ string HName_LongShan = "";
+
+ #region 鎵hˉ椤圭洰璐圭敤鍗� 鏂板/缂栬緫
+ #region 鎵hˉ椤圭洰璐圭敤鍗� 琛ㄥご鏁版嵁
+ public class Pay_DuSubsidyItemBillMain
+ {
+ 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 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 鎵hˉ椤圭洰璐圭敤鍗� 瀛愯〃鏁版嵁
+ public class Pay_DuSubsidyItemBillSub
+ {
+ public int HEmpID;
+ public string HEmpNumber;
+ public string HEmpName;
+ public int HDuSubsidyItemID;
+ public string HDuSubsidyItemNumber;
+ public string HDuSubsidyItemName;
+ public double HQty;
+ public double HPrice;
+ public double HMoney;
+ public string HRemark;
+ }
+ #endregion
+
+ #region 鎵hˉ椤圭洰璐圭敤鍗� 鏂板/缂栬緫
+ /// <summary>
+ /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Pay_DuSubsidyItemBill/AddDuSubsidyItemBill")]
+ [HttpPost]
+ public object AddBill_Pay_DuSubsidyItemBill([FromBody] JObject sMainSub)
+ {
+ //鑾峰彇鍙傛暟
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ //寮�濮嬩簨鍔�
+ oCN.BeginTran();
+ //淇濆瓨涓昏〃
+ objJsonResult = AddBillMain_Pay_DuSubsidyItemBill(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 娣诲姞 鎵hˉ椤圭洰璐圭敤鍗� 涓昏〃
+ public json AddBillMain_Pay_DuSubsidyItemBill(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_DuSubsidyItemBill_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_DuSubsidyItemBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犵紪杈戞潈闄�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ msg2 = "[" + msg2.ToString() + "]";
+ List<Pay_DuSubsidyItemBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Pay_DuSubsidyItemBillMain>>(msg2);
+
+
+ int HYear = int.Parse(mainList[0].HDate.Split('-')[0]);
+ int HPeriod = int.Parse(mainList[0].HDate.Split('-')[1]);
+ string HBillType = "2233";
+ string HBillSubType = "";
+ int HBillStatus = 1;
+
+ int HAutoSaveFlag = 0;
+
+
+ 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;
+ 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;
+ 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;
+
+
+ //if (OperationType == 2)
+ //{
+ // ds = oCN.RunProcReturn("select * from PM_ProjectBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectBillMain");
+ // 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_DuSubsidyItemBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_DuSubsidyItemBillMain");
+
+ if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//鏂板
+ {
+ string sql = "insert into Pay_DuSubsidyItemBillMain" +
+ "(HYear,HPeriod,HBillType,HBillSubType,HBillStatus,HInterID,HBillNo,HDate,HInnerBillNo,HGroupID,HDeptID,HExplanation,HAutoSaveFlag,HRemark,HMaker,HMakeDate) " +
+ "values(" +
+ "" + HYear +
+ "," + HPeriod +
+ ",'" + HBillType +
+ "','" + HBillSubType +
+ "'," + HBillStatus +
+ "," + HInterID +
+ ",'" + HBillNo +
+ "','" + HDate +
+ "','" + HInnerBillNo +
+ "'," + HGroupID +
+ "," + HDeptID +
+ ",'" + HExplanation +
+ "'," + HAutoSaveFlag +
+ ",'" + HRemark +
+ "','" + HMaker +
+ "','" + HMakerDate +
+ "')";
+
+ //涓昏〃
+ oCN.RunProc(sql);
+ LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",鏂板鎵hˉ椤圭洰璐圭敤鍗�:" + HBillNo);
+ oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鏂板鎵hˉ椤圭洰璐圭敤鍗曪細" + HBillNo + "','LMES-鎵hˉ椤圭洰璐圭敤鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+ }
+ else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) //缂栬緫
+ {
+ string sql = "update Pay_DuSubsidyItemBillMain set " +
+ "HYear = " + HYear +
+ ", HPeriod = " + HPeriod +
+ ", HBillNo = '" + HBillNo +
+ "', HDate = '" + HDate +
+ "', HInnerBillNo = '" + HInnerBillNo +
+ "', HGroupID = " + HGroupID +
+ ", HDeptID = " + HDeptID +
+ ", HExplanation = '" + HExplanation +
+ "', HRemark = '" + HRemark +
+ "', HUpdater = '" + HUpdater +
+ "', HUpdateDate = '" + HUpdaterDate +
+ "' where HInterID = " + HInterID;
+
+ oCN.RunProc(sql);
+
+ //鍒犻櫎瀛愯〃
+ oCN.RunProc("delete from Pay_DuSubsidyItemBillSub where HInterID= " + HInterID);
+ //璁板綍鏃ュ織
+ LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",淇敼鎵hˉ椤圭洰璐圭敤鍗�:" + HBillNo);
+ oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼鎵hˉ椤圭洰璐圭敤鍗曪細" + HBillNo + "','LMES-鎵hˉ椤圭洰璐圭敤鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+ }
+ //淇濆瓨瀛愯〃
+ objJsonResult = AddBillSub1_Pay_DuSubsidyItemBill(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 娣诲姞 鎵hˉ椤圭洰璐圭敤鍗� 瀛愯〃
+ public json AddBillSub1_Pay_DuSubsidyItemBill(string msg3, long HInterID, string HBillNo, int OperationType)
+ {
+ List<Pay_DuSubsidyItemBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Pay_DuSubsidyItemBillSub>>(msg3);
+ int i = 0; //浣滀负瀛愯〃鍐呯爜
+ foreach (Pay_DuSubsidyItemBillSub oSub in DetailColl)
+ {
+ i++; //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
+
+ int HEntryID = i;
+
+ int HEmpID = oSub.HEmpID;
+ int HDuSubsidyItemID = oSub.HDuSubsidyItemID;
+ double HQty = oSub.HQty;
+ double HPrice = oSub.HPrice;
+ double HMoney = oSub.HMoney;
+ string HRemark = oSub.HRemark;
+
+ string sql = "insert into Pay_DuSubsidyItemBillSub" +
+ "(HInterID,HEntryID,HEmpID,HDuSubsidyItemID,HQty,HPrice,HMoney,HRemark) " +
+ "values(" +
+ "" + HInterID +
+ "," + HEntryID +
+ "," + HEmpID +
+ "," + HDuSubsidyItemID +
+ "," + HQty +
+ "," + HPrice +
+ "," + HMoney +
+ ",'" + HRemark +
+ "')";
+
+ oCN.RunProc(sql);
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = null;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ #endregion
+ #endregion
+ #region 鎵hˉ椤圭洰璐圭敤鍗� 缂栬緫-椤甸潰璧嬪��
+ /// <summary>
+ ///鍙傛暟锛歴tring HInterID銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Pay_DuSubsidyItemBill/editInit")]
+ [HttpGet]
+ public object getDuSubsidyItemBilleditInit(string HInterID, string user)
+ {
+ try
+ {
+ List<DataTable> tableList = new List<DataTable>();
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Pay_DuSubsidyItemBill_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_DuSubsidyItemBill_EditInit " + HInterID, "h_p_Pay_DuSubsidyItemBill_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 鎵hˉ椤圭洰璐圭敤鍗� 鏌ヨ
+ [Route("Pay_DuSubsidyItemBill/list")]
+ [HttpGet]
+ public object getDuSubsidyItemBillList(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ if (!DBUtility.ClsPub.Security_Log("Pay_DuSubsidyItemBillList", 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_DuSubsidyItemBillList order by hmainid desc", "h_v_Pay_DuSubsidyItemBillList");
+ }
+ else
+ {
+ string sql1 = "select * from h_v_Pay_DuSubsidyItemBillList where 1 = 1 ";
+ string sql = sql1 + sWhere + " order by hmainid desc";
+ ds = oCN.RunProcReturn(sql, "h_v_Pay_DuSubsidyItemBillList");
+ }
+
+ //娣诲姞鍒楀悕
+ 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 鎵hˉ椤圭洰璐圭敤鍗� 鍒犻櫎
+ /// <summary>
+ ///鍙傛暟锛歴tring HInterID銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Pay_DuSubsidyItemBill/delete")]
+ [HttpGet]
+ public object deleteDuSubsidyItemBill(string HInterID, string user)
+ {
+ try
+ {
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Pay_DuSubsidyItemBill_Delete", 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_DuSubsidyItemBillMain where HInterID = " + HInterID);
+ oCN.RunProc("delete from Pay_DuSubsidyItemBillSub 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 鎵hˉ椤圭洰璐圭敤鍗� 瀹℃牳/鍙嶅鏍�
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="HInterID">鍗曟嵁ID</param>
+ /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
+ /// <param name="CurUserName">瀹℃牳浜�</param>
+ /// <returns></returns>
+ [Route("Pay_DuSubsidyItemBill/AuditPay_DuSubsidyItemBill")]
+ [HttpGet]
+ public object AuditPay_DuSubsidyItemBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Pay_DuSubsidyItemBill_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_DuSubsidyItemBillMain";
+ 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 鎵hˉ椤圭洰璐圭敤鍗� 鍏抽棴/鍙嶅叧闂姛鑳�
+ [Route("Pay_DuSubsidyItemBill/ClosePay_DuSubsidyItemBill")]
+ [HttpGet]
+ public object ClosePay_DuSubsidyItemBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Pay_DuSubsidyItemBill_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_DuSubsidyItemBillMain";
+ 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 鎵hˉ椤圭洰璐圭敤鍗� 浣滃簾/鍙嶄綔搴熷姛鑳�
+ [Route("Pay_DuSubsidyItemBill/DropPay_DuSubsidyItemBill")]
+ [HttpGet]
+ public object DropPay_DuSubsidyItemBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈変綔搴熸潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Pay_DuSubsidyItemBill_Drop", 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_DuSubsidyItemBillMain";
+ 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
diff --git "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_ErrWorkTimesRequestBillController.cs" "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_ErrWorkTimesRequestBillController.cs"
new file mode 100644
index 0000000..c883bff
--- /dev/null
+++ "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_ErrWorkTimesRequestBillController.cs"
@@ -0,0 +1,865 @@
+锘縰sing DBUtility;
+using Model;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+using System.Web.Http;
+using System.Windows.Forms;
+using WebAPI.Models;
+
+namespace WebAPI.Controllers.椤圭洰绠$悊.宸ヤ綔浠诲姟
+{
+ public class Pay_ErrWorkTimesRequestBillController : ApiController
+ {
+ public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
+ private json objJsonResult = new json();
+ public DataSet ds = new DataSet();
+ public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill();
+ string user_LongShan = "";
+ string HName_LongShan = "";
+
+ #region 寮傚父宸ユ椂鐢宠鍗�
+ #region 琛ㄥご
+ public class Pay_ErrWorkTimesRequestBillMain
+ {
+ public int HInterID;
+ public string HBillNo;
+ public string HDate;
+ public string HInnerBillNo;
+ public int HDeptID;
+ public string HDeptName;
+ public int HGroupID;
+ public string HGroupName;
+ public int HMangerID;
+ public string HManagerName;
+ public int HICMOInterID;
+ public string HICMOBillNo;
+ public string HExplanation;
+ public double HSumRequestTimes;
+ public int HMaterID;
+ public string HMaterName;
+ public int HUnitID;
+ public string HUnitName;
+ public double HPlanQty;
+ public string HBatchNo;
+ 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_ErrWorkTimesRequestBillSub
+ {
+ public int HEmpID;
+ public string HEmpNumber;
+ public string HEmpName;
+ public int HWorkTypeID;
+ public string HWorkTypeNumber;
+ public string HWorkTypeName;
+ public double HPayMoney;
+ public string HBTimes;
+ public string HETimes;
+ public double HTimes;
+ public double HRelTimes;
+ public double HRelPay;
+ 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_ErrWorkTimesRequestBill/AddErrWorkTimesRequestBill")]
+ [HttpPost]
+ public object AddBill_Pay_ErrWorkTimesRequestBill([FromBody] JObject sMainSub)
+ {
+ //鑾峰彇鍙傛暟
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ //寮�濮嬩簨鍔�
+ oCN.BeginTran();
+ //淇濆瓨涓昏〃
+ objJsonResult = AddBillMain_Pay_ErrWorkTimesRequestBill(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_ErrWorkTimesRequestBill(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_ErrWorkTimesRequestBill_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_ErrWorkTimesRequestBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犵紪杈戞潈闄�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ msg2 = "[" + msg2.ToString() + "]";
+ List<Pay_ErrWorkTimesRequestBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Pay_ErrWorkTimesRequestBillMain>>(msg2);
+
+
+ int HYear = int.Parse(mainList[0].HDate.Split('-')[0]);
+ int HPeriod = int.Parse(mainList[0].HDate.Split('-')[1]);
+ string HBillType = "2231";
+ 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 HDeptID = mainList[0].HDeptID;
+ int HGroupID = mainList[0].HGroupID;
+ int HMangerID = mainList[0].HMangerID;
+ int HICMOInterID = mainList[0].HICMOInterID;
+ string HICMOBillNo = mainList[0].HICMOBillNo;
+ string HExplanation = mainList[0].HExplanation;
+ double HSumRequestTimes = mainList[0].HSumRequestTimes;
+ int HMaterID = mainList[0].HMaterID;
+ int HUnitID = mainList[0].HUnitID;
+ double HPlanQty = mainList[0].HPlanQty;
+ string HBatchNo = mainList[0].HBatchNo;
+ 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;
+ 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;
+
+
+ //if (OperationType == 2)
+ //{
+ // ds = oCN.RunProcReturn("select * from PM_ProjectBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectBillMain");
+ // 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_ErrWorkTimesRequestBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_ErrWorkTimesRequestBillMain");
+
+ if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//鏂板
+ {
+ string sql = "insert into Pay_ErrWorkTimesRequestBillMain" +
+ "(HYear,HPeriod,HBillType,HBillSubType,HBillStatus,HInterID,HBillNo,HDate,HInnerBillNo,HDeptID,HGroupID,HMangerID,HICMOInterID,HICMOBillNo,HExplanation,HSumRequestTimes,HMaterID,HUnitID,HPlanQty,HBatchNo,HRemark, HMaker,HMakeDate) " +
+ "values(" +
+ "" + HYear +
+ "," + HPeriod +
+ ",'" + HBillType +
+ "','" + HBillSubType +
+ "'," + HBillStatus +
+ "," + HInterID +
+ ",'" + HBillNo +
+ "','" + HDate +
+ "','" + HInnerBillNo +
+ "'," + HDeptID +
+ "," + HGroupID +
+ "," + HMangerID +
+ "," + HICMOInterID +
+ ",'" + HICMOBillNo +
+ "','" + HExplanation +
+ "'," + HSumRequestTimes +
+ "," + HMaterID +
+ "," + HUnitID +
+ "," + HPlanQty +
+ ",'" + HBatchNo +
+ "','" + 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_ErrWorkTimesRequestBillMain set " +
+ "HYear = " + HYear +
+ ", HPeriod = " + HPeriod +
+ ", HBillNo = '" + HBillNo +
+ "', HDate = '" + HDate +
+ "', HInnerBillNo = '" + HInnerBillNo +
+ "', HDeptID = " + HDeptID +
+ ", HGroupID = " + HGroupID +
+ ", HMangerID = " + HMangerID +
+ ", HICMOInterID = " + HICMOInterID +
+ ", HICMOBillNo = '" + HICMOBillNo +
+ "', HExplanation = '" + HExplanation +
+ "', HSumRequestTimes = " + HSumRequestTimes +
+ ", HMaterID = " + HMaterID +
+ ", HUnitID = " + HUnitID +
+ ", HPlanQty = " + HPlanQty +
+ ", HBatchNo = '" + HBatchNo +
+ "', HRemark = '" + HRemark +
+ "', HUpdater = '" + HUpdater +
+ "', HUpdateDate = '" + HUpdaterDate +
+ "' where HInterID = " + HInterID;
+
+ oCN.RunProc(sql);
+
+ //鍒犻櫎瀛愯〃
+ oCN.RunProc("delete from Pay_ErrWorkTimesRequestBillSub 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_ErrWorkTimesRequestBill(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 AddBillSub1_Pay_ErrWorkTimesRequestBill(string msg3, long HInterID, string HBillNo, int OperationType)
+ {
+ List<Pay_ErrWorkTimesRequestBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Pay_ErrWorkTimesRequestBillSub>>(msg3);
+ int i = 0; //浣滀负瀛愯〃鍐呯爜
+ foreach (Pay_ErrWorkTimesRequestBillSub oSub in DetailColl)
+ {
+ i++; //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
+
+ int HEntryID = i;
+
+ int HEmpID = oSub.HEmpID;
+ int HWorkTypeID = oSub.HWorkTypeID;
+ double HPayMoney = oSub.HPayMoney;
+ string HBTimes = oSub.HBTimes;
+ string HETimes = oSub.HETimes;
+ double HTimes = oSub.HTimes;
+ double HRelTimes = oSub.HRelTimes;
+ double HRelPay = oSub.HRelPay;
+ 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 sql = "insert into Pay_ErrWorkTimesRequestBillSub" +
+ "(HInterID,HEntryID,HEmpID,HWorkTypeID,HPayMoney,HBTimes,HETimes,HTimes,HRelTimes,HRelPay,HRemark, HSourceInterID,HSourceEntryID,HSourceBillNo" +
+ ",HSourceBillType,HRelationQty,HRelationMoney) " +
+ "values(" +
+ "" + HInterID +
+ "," + HEntryID +
+ "," + HEmpID +
+ "," + HWorkTypeID +
+ "," + HPayMoney +
+ ",'" + HBTimes +
+ "','" + HETimes +
+ "'," + HTimes +
+ "," + HRelTimes +
+ "," + HRelPay +
+ ",'" + HRemark +
+ "'," + HSourceInterID +
+ "," + HSourceEntryID +
+ ",'" + HSourceBillNo +
+ "','" + HSourceBillType +
+ "'," + HRelationQty +
+ "," + HRelationMoney +
+ ")";
+
+ 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_ErrWorkTimesRequestBill/editInit")]
+ [HttpGet]
+ public object getErrWorkTimesRequestBilleditInit(string HInterID, string user)
+ {
+ try
+ {
+ List<DataTable> tableList = new List<DataTable>();
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Pay_ErrWorkTimesRequestBill_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_ErrWorkTimesRequestBill_EditInit " + HInterID, "h_p_Pay_ErrWorkTimesRequestBill_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 寮傚父宸ユ椂鐢宠鍗� 鏌ヨ
+ [Route("Pay_ErrWorkTimesRequestBill/list")]
+ [HttpGet]
+ public object getErrWorkTimesRequestBillList(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ if (!DBUtility.ClsPub.Security_Log("Pay_ErrWorkTimesRequestBillList", 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_ErrWorkTimesRequestBillList_New order by hmainid desc", "h_v_Pay_ErrWorkTimesRequestBillList_New");
+ }
+ else
+ {
+ string sql1 = "select * from h_v_Pay_ErrWorkTimesRequestBillList_New where 1 = 1 ";
+ string sql = sql1 + sWhere + " order by hmainid desc";
+ ds = oCN.RunProcReturn(sql, "h_v_Pay_ErrWorkTimesRequestBillList_New");
+ }
+
+ //娣诲姞鍒楀悕
+ 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_ErrWorkTimesRequestBill/delete")]
+ [HttpGet]
+ public object deleteErrWorkTimesRequestBill(string HInterID, string user)
+ {
+ try
+ {
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Pay_ErrWorkTimesRequestBill_Delete", 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_ErrWorkTimesRequestBillMain where HInterID = " + HInterID);
+ oCN.RunProc("delete from Pay_ErrWorkTimesRequestBillSub 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_ErrWorkTimesRequestBill/AuditPay_ErrWorkTimesRequestBill")]
+ [HttpGet]
+ public object AuditPay_ErrWorkTimesRequestBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Pay_ErrWorkTimesRequestBill_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_ErrWorkTimesRequestBillMain";
+ 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_ErrWorkTimesRequestBill/ClosePay_ErrWorkTimesRequestBill")]
+ [HttpGet]
+ public object ClosePay_ErrWorkTimesRequestBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Pay_ErrWorkTimesRequestBill_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_ErrWorkTimesRequestBillMain";
+ 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_ErrWorkTimesRequestBill/DropPay_ErrWorkTimesRequestBill")]
+ [HttpGet]
+ public object DropPay_ErrWorkTimesRequestBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈変綔搴熸潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Pay_ErrWorkTimesRequestBill_Drop", 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_ErrWorkTimesRequestBillMain";
+ 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
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 92e9052..14df8f7 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"
@@ -1288,5 +1288,52 @@
}
}
#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
diff --git "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_OutApplyBillController.cs" "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_OutApplyBillController.cs"
new file mode 100644
index 0000000..868ad54
--- /dev/null
+++ "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_OutApplyBillController.cs"
@@ -0,0 +1,838 @@
+锘縰sing DBUtility;
+using Model;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+using System.Web.Http;
+using System.Windows.Forms;
+using WebAPI.Models;
+
+namespace WebAPI.Controllers.宸ヨ祫绠$悊.璇峰亣鐢宠
+{
+ public class Pay_OutApplyBillController : ApiController
+ {
+ public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
+ private json objJsonResult = new json();
+ public DataSet ds = new DataSet();
+ public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ public DAL.ClsPay_OutApplyBill BillOld = new DAL.ClsPay_OutApplyBill();
+ string user_LongShan = "";
+ string HName_LongShan = "";
+
+ #region 璇峰亣鐢宠鍗� 鏂板/缂栬緫
+ #region 璇峰亣鐢宠鍗� 琛ㄥご鏁版嵁
+ public class Pay_OutApplyBillMain
+ {
+ 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 HMangerID;
+ public string HMangerName;
+ public int HLeaveID;
+ public string HLeaveName;
+ 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_OutApplyBillSub
+ {
+ public int HEmpID;
+ public string HEmpNumber;
+ public string HEmpName;
+ public int HShiftsID;
+ public string HShiftsNumber;
+ public string HShiftsName;
+ public string HBTimes;
+ public string HETimes;
+ public bool HRestFlag;
+ public double HRestTimes;
+ public double HTimes;
+ public double HRelTimes;
+ public string HRemark;
+ }
+ #endregion
+
+ #region 璇峰亣鐢宠鍗� 鏂板/缂栬緫
+ /// <summary>
+ /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Pay_OutApplyBill/AddPay_OutApplyBill")]
+ [HttpPost]
+ public object AddBill_Pay_OutApplyBill([FromBody] JObject sMainSub)
+ {
+ //鑾峰彇鍙傛暟
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ //寮�濮嬩簨鍔�
+ oCN.BeginTran();
+ //淇濆瓨涓昏〃
+ objJsonResult = AddBillMain_Pay_OutApplyBill(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_OutApplyBill(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_OutApplyBill_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_OutApplyBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犵紪杈戞潈闄�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ msg2 = "[" + msg2.ToString() + "]";
+ List<Pay_OutApplyBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Pay_OutApplyBillMain>>(msg2);
+
+
+ int HYear = int.Parse(mainList[0].HDate.Split('-')[0]);
+ int HPeriod = int.Parse(mainList[0].HDate.Split('-')[1]);
+ string HBillType = "2221";
+ 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 HDeptID = mainList[0].HDeptID;
+ string HDeptName = mainList[0].HDeptName;
+ int HGroupID = mainList[0].HGroupID;
+ string HGroupName = mainList[0].HGroupName;
+ int HMangerID = mainList[0].HMangerID;
+ string HMangerName = mainList[0].HMangerName;
+ int HLeaveID = mainList[0].HLeaveID;
+ string HLeaveName = mainList[0].HLeaveName;
+ 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;
+ 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;
+
+
+ //if (OperationType == 2)
+ //{
+ // ds = oCN.RunProcReturn("select * from PM_ProjectBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectBillMain");
+ // 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_OutApplyBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_OutApplyBillMain");
+
+ if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//鏂板
+ {
+ string sql = "insert into Pay_OutApplyBillMain" +
+ "(HYear,HPeriod,HBillType,HBillSubType,HBillStatus,HInterID,HBillNo,HDate,HInnerBillNo,HDeptID,HGroupID,HMangerID,HLeaveID,HExplanation,HRemark, HMaker,HMakeDate) " +
+ "values(" +
+ "" + HYear +
+ "," + HPeriod +
+ ",'" + HBillType +
+ "','" + HBillSubType +
+ "'," + HBillStatus +
+ "," + HInterID +
+ ",'" + HBillNo +
+ "','" + HDate +
+ "','" + HInnerBillNo +
+ "'," + HDeptID +
+ "," + HGroupID +
+ "," + HMangerID +
+ "," + HLeaveID +
+ ",'" + 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_OutApplyBillMain set " +
+ "HYear = " + HYear +
+ ", HPeriod = " + HPeriod +
+ ", HBillNo = '" + HBillNo +
+ "', HDate = '" + HDate +
+ "', HInnerBillNo = '" + HInnerBillNo +
+ "', HGroupID = " + HGroupID +
+ ", HDeptID = " + HDeptID +
+ ", HMangerID = " + HMangerID +
+ ", HLeaveID = " + HLeaveID +
+ ", HExplanation = '" + HExplanation +
+ "', HRemark = '" + HRemark +
+ "', HUpdater = '" + HUpdater +
+ "', HUpdateDate = '" + HUpdaterDate +
+ "' where HInterID = " + HInterID;
+
+ oCN.RunProc(sql);
+
+ //鍒犻櫎瀛愯〃
+ oCN.RunProc("delete from Pay_OutApplyBillSub 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_OutApplyBill(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 AddBillSub1_Pay_OutApplyBill(string msg3, long HInterID, string HBillNo, int OperationType)
+ {
+ List<Pay_OutApplyBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Pay_OutApplyBillSub>>(msg3);
+ int i = 0; //浣滀负瀛愯〃鍐呯爜
+ foreach (Pay_OutApplyBillSub oSub in DetailColl)
+ {
+ i++; //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
+
+ int HEntryID = i;
+
+ int HEmpID = oSub.HEmpID;
+ string HEmpName = oSub.HEmpName;
+ int HShiftsID = oSub.HShiftsID;
+ string HShiftsName = oSub.HShiftsName;
+ string HBTimes = oSub.HBTimes;
+ string HETimes = oSub.HETimes;
+ int HRestFlag = oSub.HRestFlag ? 1 : 0;
+ double HRestTimes = oSub.HRestTimes;
+ double HTimes = oSub.HTimes;
+ double HRelTimes = oSub.HRelTimes;
+ string HRemark = oSub.HRemark;
+
+
+ string sql = "insert into Pay_OutApplyBillSub" +
+ "(HInterID,HEntryID,HEmpID,HShiftsID,HBTimes,HETimes,HRestFlag,HRestTimes,HTimes,HRelTimes,HRemark) " +
+ "values(" +
+ "" + HInterID +
+ "," + HEntryID +
+ "," + HEmpID +
+ "," + HShiftsID +
+ ",'" + HBTimes +
+ "','" + HETimes +
+ "'," + HRestFlag +
+ "," + HRestTimes +
+ "," + HTimes +
+ "," + HRelTimes +
+ ",'" + 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_OutApplyBill/editInit")]
+ [HttpGet]
+ public object getOutApplyBilleditInit(string HInterID, string user)
+ {
+ try
+ {
+ List<DataTable> tableList = new List<DataTable>();
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Pay_OutApplyBill_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("select * from Pay_OutApplyBillMain where HInterID = " + HInterID, "Pay_OutApplyBillMain");
+ string[] HBillStatusList = { "", "鏈", "瀹℃牳閫氳繃", "鍏抽棴", "浣滃簾", "瀹℃牳閫�鍥�", "瀹℃牳涓�", "宸查槄", "宸插洖澶�", "缁撴", "楠岃瘉", "涓嬭揪", "寮�宸�", "鐢宠瀹℃壒", "", "鐢宠妫�楠�", "鍒ゅ畾鍚堟牸", "鍒ゅ畾涓嶅悎鏍�" };
+ if (ds.Tables[0].Rows.Count > 0 && int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString()) > 1)
+ {
+ int HBillStatus = int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString());
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "缂栬緫澶辫触锛屽崟鎹綋鍓嶇姸鎬佷负\"" + HBillStatusList[HBillStatus] + "\"锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+
+ ds = oCN.RunProcReturn("exec h_p_Pay_OutApplyBill_EditInit " + HInterID, "h_p_Pay_OutApplyBill_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 璇峰亣鐢宠鍗� 鏌ヨ
+ [Route("Pay_OutApplyBill/list")]
+ [HttpGet]
+ public object getOutApplyBillList(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ if (!DBUtility.ClsPub.Security_Log("Pay_OutApplyBillList", 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_OutApplyBillList order by hmainid desc", "h_v_Pay_OutApplyBillList");
+ }
+ else
+ {
+ string sql1 = "select * from h_v_Pay_OutApplyBillList where 1 = 1 ";
+ string sql = sql1 + sWhere + " order by hmainid desc";
+ ds = oCN.RunProcReturn(sql, "h_v_Pay_OutApplyBillList");
+ }
+
+ //娣诲姞鍒楀悕
+ 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_OutApplyBill/delete")]
+ [HttpGet]
+ public object deleteOutApplyBill(string HInterID, string user)
+ {
+ try
+ {
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Pay_OutApplyBill_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_OutApplyBillMain where HInterID = " + HInterID);
+ oCN.RunProc("delete from Pay_OutApplyBillSub 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_OutApplyBill/AuditPay_OutApplyBill")]
+ [HttpGet]
+ public object AuditPay_OutApplyBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Pay_OutApplyBill_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_OutApplyBillMain";
+ 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_OutApplyBill/ClosePay_OutApplyBill")]
+ [HttpGet]
+ public object ClosePay_OutApplyBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Pay_OutApplyBill_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_OutApplyBillMain";
+ 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_OutApplyBill/DropPay_OutApplyBill")]
+ [HttpGet]
+ public object DropPay_OutApplyBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈変綔搴熸潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Pay_OutApplyBill_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_OutApplyBillMain";
+ 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
diff --git "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_OverApplyBillController.cs" "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_OverApplyBillController.cs"
new file mode 100644
index 0000000..602e540
--- /dev/null
+++ "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_OverApplyBillController.cs"
@@ -0,0 +1,825 @@
+锘縰sing DBUtility;
+using Model;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+using System.Web.Http;
+using System.Windows.Forms;
+using WebAPI.Models;
+
+namespace WebAPI.Controllers.宸ヨ祫绠$悊.鍔犵彮鐢宠
+{
+ public class Pay_OverApplyBillController : ApiController
+ {
+ public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
+ private json objJsonResult = new json();
+ public DataSet ds = new DataSet();
+ public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ public DAL.ClsPay_OverApplyBill BillOld = new DAL.ClsPay_OverApplyBill();
+ string user_LongShan = "";
+ string HName_LongShan = "";
+
+ #region 鍔犵彮鐢宠鍗� 鏂板/缂栬緫
+ #region 鍔犵彮鐢宠鍗� 琛ㄥご鏁版嵁
+ public class Pay_OverApplyBillMain
+ {
+ 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 HMangerID;
+ public string HMangerName;
+ 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_OverApplyBillSub
+ {
+ public int HEmpID;
+ public string HEmpNumber;
+ public string HEmpName;
+ public string HBTimes;
+ public string HETimes;
+ public bool HRestFlag;
+ public double HRestTimes;
+ public double HTimes;
+ public double HRelTimes;
+ public string HRemark;
+ }
+ #endregion
+
+ #region 鍔犵彮鐢宠鍗� 鏂板/缂栬緫
+ /// <summary>
+ /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Pay_OverApplyBill/AddPay_OverApplyBill")]
+ [HttpPost]
+ public object AddBill_Pay_OverApplyBill([FromBody] JObject sMainSub)
+ {
+ //鑾峰彇鍙傛暟
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ //寮�濮嬩簨鍔�
+ oCN.BeginTran();
+ //淇濆瓨涓昏〃
+ objJsonResult = AddBillMain_Pay_OverApplyBill(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_OverApplyBill(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_OverApplyBill_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_OverApplyBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犵紪杈戞潈闄�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ msg2 = "[" + msg2.ToString() + "]";
+ List<Pay_OverApplyBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Pay_OverApplyBillMain>>(msg2);
+
+
+ int HYear = int.Parse(mainList[0].HDate.Split('-')[0]);
+ int HPeriod = int.Parse(mainList[0].HDate.Split('-')[1]);
+ string HBillType = "2209";
+ 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 HDeptID = mainList[0].HDeptID;
+ string HDeptName = mainList[0].HDeptName;
+ int HGroupID = mainList[0].HGroupID;
+ string HGroupName = mainList[0].HGroupName;
+ int HMangerID = mainList[0].HMangerID;
+ string HMangerName = mainList[0].HMangerName;
+ 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;
+ 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;
+
+
+ //if (OperationType == 2)
+ //{
+ // ds = oCN.RunProcReturn("select * from PM_ProjectBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectBillMain");
+ // 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_OverApplyBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_PayMentBillMain");
+
+ if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//鏂板
+ {
+ string sql = "insert into Pay_OverApplyBillMain" +
+ "(HYear,HPeriod,HBillType,HBillSubType,HBillStatus,HInterID,HBillNo,HDate,HInnerBillNo,HDeptID,HGroupID,HMangerID,HExplanation,HRemark, HMaker,HMakeDate) " +
+ "values(" +
+ "" + HYear +
+ "," + HPeriod +
+ ",'" + HBillType +
+ "','" + HBillSubType +
+ "'," + HBillStatus +
+ "," + HInterID +
+ ",'" + HBillNo +
+ "','" + HDate +
+ "','" + HInnerBillNo +
+ "'," + HDeptID +
+ "," + HGroupID +
+ "," + HMangerID +
+ ",'" + 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_OverApplyBillMain set " +
+ "HYear = " + HYear +
+ ", HPeriod = " + HPeriod +
+ ", HBillNo = '" + HBillNo +
+ "', HDate = '" + HDate +
+ "', HInnerBillNo = '" + HInnerBillNo +
+ "', HGroupID = " + HGroupID +
+ ", HDeptID = " + HDeptID +
+ ", HMangerID = " + HMangerID +
+ ", HExplanation = '" + HExplanation +
+ "', HRemark = '" + HRemark +
+ "', HUpdater = '" + HUpdater +
+ "', HUpdateDate = '" + HUpdaterDate +
+ "' where HInterID = " + HInterID;
+
+ oCN.RunProc(sql);
+
+ //鍒犻櫎瀛愯〃
+ oCN.RunProc("delete from Pay_OverApplyBillSub 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_OverApplyBill(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 AddBillSub1_Pay_OverApplyBill(string msg3, long HInterID, string HBillNo, int OperationType)
+ {
+ List<Pay_OverApplyBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Pay_OverApplyBillSub>>(msg3);
+ int i = 0; //浣滀负瀛愯〃鍐呯爜
+ foreach (Pay_OverApplyBillSub oSub in DetailColl)
+ {
+ i++; //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
+
+ int HEntryID = i;
+
+ int HEmpID = oSub.HEmpID;
+ string HEmpName = oSub.HEmpName;
+ string HBTimes = oSub.HBTimes;
+ string HETimes = oSub.HETimes;
+ int HRestFlag = oSub.HRestFlag ? 1 : 0;
+ double HRestTimes = oSub.HRestTimes;
+ double HTimes = oSub.HTimes;
+ double HRelTimes = oSub.HRelTimes;
+ string HRemark = oSub.HRemark;
+
+
+ string sql = "insert into Pay_OverApplyBillSub" +
+ "(HInterID,HEntryID,HEmpID,HBTimes,HETimes,HRestFlag,HRestTimes,HTimes,HRelTimes,HRemark) " +
+ "values(" +
+ "" + HInterID +
+ "," + HEntryID +
+ "," + HEmpID +
+ ",'" + HBTimes +
+ "','" + HETimes +
+ "'," + HRestFlag +
+ "," + HRestTimes +
+ "," + HTimes +
+ "," + HRelTimes +
+ ",'" + 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_OverApplyBill/editInit")]
+ [HttpGet]
+ public object getOverApplyBilleditInit(string HInterID, string user)
+ {
+ try
+ {
+ List<DataTable> tableList = new List<DataTable>();
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Pay_OverApplyBill_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("select * from Pay_OverApplyBillMain where HInterID = " + HInterID, "Pay_PayMentBillMain");
+ string[] HBillStatusList = { "", "鏈", "瀹℃牳閫氳繃", "鍏抽棴", "浣滃簾", "瀹℃牳閫�鍥�", "瀹℃牳涓�", "宸查槄", "宸插洖澶�", "缁撴", "楠岃瘉", "涓嬭揪", "寮�宸�", "鐢宠瀹℃壒", "", "鐢宠妫�楠�", "鍒ゅ畾鍚堟牸", "鍒ゅ畾涓嶅悎鏍�" };
+ if (ds.Tables[0].Rows.Count > 0 && int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString())>1)
+ {
+ int HBillStatus = int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString());
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "缂栬緫澶辫触锛屽崟鎹綋鍓嶇姸鎬佷负\"" + HBillStatusList[HBillStatus] + "\"锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+
+ ds = oCN.RunProcReturn("exec h_p_Pay_OverApplyBill_EditInit " + HInterID, "h_p_Pay_OverApplyBill_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 鍔犵彮鐢宠鍗� 鏌ヨ
+ [Route("Pay_OverApplyBill/list")]
+ [HttpGet]
+ public object getOverApplyBillList(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ if (!DBUtility.ClsPub.Security_Log("Pay_OverApplyBillList", 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_OverApplyBillList order by hmainid desc", "h_v_Pay_OverApplyBillList");
+ }
+ else
+ {
+ string sql1 = "select * from h_v_Pay_OverApplyBillList where 1 = 1 ";
+ string sql = sql1 + sWhere + " order by hmainid desc";
+ ds = oCN.RunProcReturn(sql, "h_v_Pay_OverApplyBillList");
+ }
+
+ //娣诲姞鍒楀悕
+ 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_OverApplyBill/delete")]
+ [HttpGet]
+ public object deleteOverApplyBill(string HInterID, string user)
+ {
+ try
+ {
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Pay_OverApplyBill_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_OverApplyBillMain where HInterID = " + HInterID);
+ oCN.RunProc("delete from Pay_OverApplyBillSub 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_OverApplyBill/AuditPay_OverApplyBill")]
+ [HttpGet]
+ public object AuditPay_OverApplyBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Pay_OverApplyBill_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_OverApplyBillMain";
+ 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_OverApplyBill/ClosePay_OverApplyBill")]
+ [HttpGet]
+ public object ClosePay_OverApplyBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Pay_OverApplyBill_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_OverApplyBillMain";
+ 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_OverApplyBill/DropPay_OverApplyBill")]
+ [HttpGet]
+ public object DropPay_OverApplyBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈変綔搴熸潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Pay_OverApplyBill_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_OverApplyBillMain";
+ 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
diff --git "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_PayMentBillController.cs" "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_PayMentBillController.cs"
new file mode 100644
index 0000000..d399a15
--- /dev/null
+++ "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_PayMentBillController.cs"
@@ -0,0 +1,877 @@
+锘縰sing DBUtility;
+using Model;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+using System.Web.Http;
+using System.Windows.Forms;
+using WebAPI.Models;
+
+namespace WebAPI.Controllers.宸ヨ祫绠$悊.宸ヨ祫鍗�
+{
+ public class Pay_PayMentBillController : ApiController
+ {
+ public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
+ private json objJsonResult = new json();
+ public DataSet ds = new DataSet();
+ public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ public DAL.ClsPay_PayMentBill BillOld = new DAL.ClsPay_PayMentBill();
+ string user_LongShan = "";
+ string HName_LongShan = "";
+
+ #region 宸ヨ祫鍗� 鏂板/缂栬緫
+ #region 宸ヨ祫鍗� 琛ㄥご鏁版嵁
+ public class Pay_PayMentBillMain
+ {
+ 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 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_PayMentBillSub
+ {
+ public int HEmpID;
+ public string HEmpNumber;
+ public string HEmpName;
+ public string HEmpType;
+ public int HPostID;
+ public string HPostNumber;
+ public string HPostName;
+ public double HPiecePay;
+ public double HTimesPay;
+ public double HFixPay;
+ public double HBasePay;
+ public double HWorkTimes;
+ public double HPayTotal;
+ public double HSubsidyTotal;
+ public double HDeuctTotal;
+ public double HShoudPay;
+ public double HInsurance;
+ public double HTaxBefore;
+ public double HTax;
+ public double HRelPay;
+ public string HRemark;
+ }
+ #endregion
+
+ #region 宸ヨ祫鍗� 鏂板/缂栬緫
+ /// <summary>
+ /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Pay_PayMentBill/AddPayMentBill")]
+ [HttpPost]
+ public object AddBill_Pay_PayMentBill([FromBody] JObject sMainSub)
+ {
+ //鑾峰彇鍙傛暟
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ //寮�濮嬩簨鍔�
+ oCN.BeginTran();
+ //淇濆瓨涓昏〃
+ objJsonResult = AddBillMain_Pay_PayMentBill(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_PayMentBill(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_PayMentBill_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_PayMentBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犵紪杈戞潈闄�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ msg2 = "[" + msg2.ToString() + "]";
+ List<Pay_PayMentBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Pay_PayMentBillMain>>(msg2);
+
+
+ int HYear = int.Parse(mainList[0].HDate.Split('-')[0]);
+ int HPeriod = int.Parse(mainList[0].HDate.Split('-')[1]);
+ string HBillType = "2202";
+ 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 HDeptID = mainList[0].HDeptID;
+ string HDeptName = mainList[0].HDeptName;
+ int HGroupID = mainList[0].HGroupID;
+ string HGroupName = mainList[0].HGroupName;
+ 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;
+ 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;
+
+
+ //if (OperationType == 2)
+ //{
+ // ds = oCN.RunProcReturn("select * from PM_ProjectBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectBillMain");
+ // 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_PayMentBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_PayMentBillMain");
+
+ if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//鏂板
+ {
+ string sql = "insert into Pay_PayMentBillMain" +
+ "(HYear,HPeriod,HBillType,HBillSubType,HBillStatus,HInterID,HBillNo,HDate,HInnerBillNo,HDeptID,HDeptName,HGroupID,HGroupName,HExplanation,HRemark, HMaker,HMakeDate) " +
+ "values(" +
+ "" + HYear +
+ "," + HPeriod +
+ ",'" + HBillType +
+ "','" + HBillSubType +
+ "'," + HBillStatus +
+ "," + HInterID +
+ ",'" + HBillNo +
+ "','" + HDate +
+ "','" + HInnerBillNo +
+ "'," + HDeptID +
+ ",'" + HDeptName +
+ "'," + HGroupID +
+ ",'" + HGroupName +
+ "','" + 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_PayMentBillMain set " +
+ "HYear = " + HYear +
+ ", HPeriod = " + HPeriod +
+ ", HBillNo = '" + HBillNo +
+ "', HDate = '" + HDate +
+ "', HInnerBillNo = '" + HInnerBillNo +
+ "', HGroupID = " + HGroupID +
+ ", HGroupName = '" + HGroupName +
+ "', HDeptID = " + HDeptID +
+ ", HDeptName = '" + HDeptName +
+ "', HExplanation = '" + HExplanation +
+ "', HRemark = '" + HRemark +
+ "', HUpdater = '" + HUpdater +
+ "', HUpdateDate = '" + HUpdaterDate +
+ "' where HInterID = " + HInterID;
+
+ oCN.RunProc(sql);
+
+ //鍒犻櫎瀛愯〃
+ oCN.RunProc("delete from Pay_PayMentBillSub 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_PayMentBill(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 AddBillSub1_Pay_PayMentBill(string msg3, long HInterID, string HBillNo, int OperationType)
+ {
+ List<Pay_PayMentBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Pay_PayMentBillSub>>(msg3);
+ int i = 0; //浣滀负瀛愯〃鍐呯爜
+ foreach (Pay_PayMentBillSub oSub in DetailColl)
+ {
+ i++; //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
+
+ int HEntryID = i;
+
+ int HEmpID = oSub.HEmpID;
+ string HEmpName = oSub.HEmpName;
+ string HEmpType = oSub.HEmpType;
+ int HPostID = oSub.HPostID;
+ double HPiecePay = oSub.HPiecePay;
+ double HTimesPay = oSub.HTimesPay;
+ double HFixPay = oSub.HFixPay;
+ double HBasePay = oSub.HBasePay;
+ double HWorkTimes = oSub.HWorkTimes;
+ double HPayTotal = oSub.HPayTotal;
+ double HSubsidyTotal = oSub.HSubsidyTotal;
+ double HDeuctTotal = oSub.HDeuctTotal;
+ double HShoudPay = oSub.HShoudPay;
+ double HInsurance = oSub.HInsurance;
+ double HTaxBefore = oSub.HTaxBefore;
+ double HTax = oSub.HTax;
+ double HRelPay = oSub.HRelPay;
+ string HRemark = oSub.HRemark;
+
+
+ string sql = "insert into Pay_PayMentBillSub" +
+ "(HInterID,HEntryID,HEmpID,HEmpName,HEmpType,HPostID,HPiecePay,HTimesPay,HFixPay,HBasePay,HWorkTimes,HPayTotal,HSubsidyTotal,HDeuctTotal,HShoudPay,HInsurance,HTaxBefore,HTax,HRelPay,HRemark) " +
+ "values(" +
+ "" + HInterID +
+ "," + HEntryID +
+ "," + HEmpID +
+ ",'" + HEmpName +
+ "','" + HEmpType +
+ "'," + HPostID +
+ "," + HPiecePay +
+ "," + HTimesPay +
+ "," + HFixPay +
+ "," + HBasePay +
+ "," + HWorkTimes +
+ "," + HPayTotal +
+ "," + HSubsidyTotal +
+ "," + HDeuctTotal +
+ "," + HShoudPay +
+ "," + HInsurance +
+ "," + HTaxBefore +
+ "," + HTax +
+ "," + HRelPay +
+ ",'" + 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_PayMentBill/editInit")]
+ [HttpGet]
+ public object getPayMentBilleditInit(string HInterID, string user)
+ {
+ try
+ {
+ List<DataTable> tableList = new List<DataTable>();
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Pay_PayMentBill_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_PayMentBill_EditInit " + HInterID, "h_p_Pay_PayMentBill_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 宸ヨ祫鍗� 鏌ヨ
+ [Route("Pay_PayMentBill/list")]
+ [HttpGet]
+ public object getPayMentBillList(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ if (!DBUtility.ClsPub.Security_Log("Pay_PayMentBillList", 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_PayMentBillList order by hmainid desc", "h_v_Pay_PayMentBillList");
+ }
+ else
+ {
+ string sql1 = "select * from h_v_Pay_PayMentBillList where 1 = 1 ";
+ string sql = sql1 + sWhere + " order by hmainid desc";
+ ds = oCN.RunProcReturn(sql, "h_v_Pay_PayMentBillList");
+ }
+
+ //娣诲姞鍒楀悕
+ 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_PayMentBill/delete")]
+ [HttpGet]
+ public object deletePayMentBill(string HInterID, string user)
+ {
+ try
+ {
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Pay_PayMentBill_Delete", 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_PayMentBillMain where HInterID = " + HInterID);
+ oCN.RunProc("delete from Pay_PayMentBillSub 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_PayMentBill/AuditPay_PayMentBill")]
+ [HttpGet]
+ public object AuditPay_PayMentBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Pay_PayMentBill_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_PayMentBillMain";
+ 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_PayMentBill/ClosePay_PayMentBill")]
+ [HttpGet]
+ public object ClosePay_PayMentBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Pay_PayMentBill_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_PayMentBillMain";
+ 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_PayMentBill/DropPay_PayMentBill")]
+ [HttpGet]
+ public object DropPay_PayMentBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈変綔搴熸潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Pay_PayMentBill_Drop", 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_PayMentBillMain";
+ 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
+
+ #region 鏍规嵁鐝粍鑾峰彇宸ヨ祫鍗曞瓙琛ㄦ暟鎹�
+ [Route("Pay_PayMentBill/getPayMentBillSub")]
+ [HttpGet]
+ public object getPayMentBillSub(int HGroupID, int HYear, int HMonth, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ string sql = "exec h_v_Pay_PayMentBill_getSubDataBasedGroupID " + HGroupID + "," + HYear + "," + HMonth;
+ ds = oCN.RunProcReturn(sql, "h_v_Pay_PayMentBill_getSubDataBasedGroupID");
+
+ //娣诲姞鍒楀悕
+ 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
diff --git "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_ProcPriceRequestBillController.cs" "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_ProcPriceRequestBillController.cs"
new file mode 100644
index 0000000..4a5d3df
--- /dev/null
+++ "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_ProcPriceRequestBillController.cs"
@@ -0,0 +1,841 @@
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using Pub_Class;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Web.Http;
+using System.Windows.Forms;
+using WebAPI.Models;
+namespace WebAPI.Controllers
+{
+ //鐝粍Controller
+ public class Pay_ProcPriceRequestBillController : ApiController
+ {
+ public DBUtility.ClsPub.Enum_BillStatus BillStatus;
+
+ private json objJsonResult = new json();
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill();
+ DataSet ds;
+
+
+ #region 瀹氶鐢宠鍗� 鏂板
+ #region 涓昏〃
+ public class Pay_ProcPriceRequestBillMain
+ {
+ public int HInterID;
+ public string HBillNo;
+ public string HDate;
+ public string HInnerBillNo;
+ public int HDeptID;
+ public string HDeptName;
+ 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_ProcPriceRequestBillSub
+ {
+ public int HMaterID;
+ public string HMaterNumber;
+ public string HMaterName;
+ public string HMaterModel;
+ public int HProcID;
+ public string HProcNumber;
+ public string HProcName;
+ public int HSourceID;
+ public string HSourceNumber;
+ public string HSourceName;
+ public double HOldPrice;
+ public double HPrice;
+ public double HOldFixPrice;
+ public double HFixPrice;
+ public string HBeginDate;
+ public string HEndDate;
+ public bool HCostFlag;
+ 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_ProcPriceRequestBill/AddProcPriceRequestBill")]
+ [HttpPost]
+ public object AddBill_Pay_ProcPriceRequestBill([FromBody] JObject sMainSub)
+ {
+ //鑾峰彇鍙傛暟
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ //寮�濮嬩簨鍔�
+ oCN.BeginTran();
+ //淇濆瓨涓昏〃
+ objJsonResult = AddBillMain_Pay_ProcPriceRequestBill(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_ProcPriceRequestBill(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_ProcPriceRequestBill_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_ProcPriceRequestBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犵紪杈戞潈闄�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ msg2 = "[" + msg2.ToString() + "]";
+ List<Pay_ProcPriceRequestBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Pay_ProcPriceRequestBillMain>>(msg2);
+
+
+ int HYear = int.Parse(mainList[0].HDate.Split('-')[0]);
+ int HPeriod = int.Parse(mainList[0].HDate.Split('-')[1]);
+ string HBillType = "2219";
+ 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 HDeptID = mainList[0].HDeptID;
+ string HDeptName = mainList[0].HDeptName;
+ 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;
+ 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;
+
+
+ //if (OperationType == 2)
+ //{
+ // ds = oCN.RunProcReturn("select * from PM_ProjectBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectBillMain");
+ // 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_ProcPriceRequestBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_ProcPriceRequestBillMain");
+
+ if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//鏂板
+ {
+ string sql = "insert into Pay_ProcPriceRequestBillMain" +
+ "(HYear,HPeriod,HBillType,HBillSubType,HBillStatus,HInterID,HBillNo,HDate,HInnerBillNo,HDeptID" +
+ ",HExplanation,HRemark,HMaker,HMakeDate) " +
+ "values(" +
+ "" + HYear +
+ "," + HPeriod +
+ ",'" + HBillType +
+ "','" + HBillSubType +
+ "'," + HBillStatus +
+ "," + HInterID +
+ ",'" + HBillNo +
+ "','" + HDate +
+ "','" + HInnerBillNo +
+ "'," + HDeptID +
+ ",'" + 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_ProcPriceRequestBillMain set " +
+ "HYear = " + HYear +
+ ", HPeriod = " + HPeriod +
+ ", HBillNo = '" + HBillNo +
+ "', HDate = '" + HDate +
+ "', HInnerBillNo = '" + HInnerBillNo +
+ "', HDeptID = " + HDeptID +
+ ", HExplanation = '" + HExplanation +
+ "', HRemark = '" + HRemark +
+ "', HUpdater = '" + HUpdater +
+ "', HUpdateDate = '" + HUpdaterDate +
+ "' where HInterID = " + HInterID;
+
+ oCN.RunProc(sql);
+
+ //鍒犻櫎瀛愯〃
+ oCN.RunProc("delete from Pay_ProcPriceRequestBillSub 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_ProcPriceRequestBill(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 AddBillSub1_Pay_ProcPriceRequestBill(string msg3, long HInterID, string HBillNo, int OperationType)
+ {
+ List<Pay_ProcPriceRequestBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Pay_ProcPriceRequestBillSub>>(msg3);
+ int i = 0; //浣滀负瀛愯〃鍐呯爜
+ foreach (Pay_ProcPriceRequestBillSub oSub in DetailColl)
+ {
+ i++; //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
+
+ int HEntryID = i;
+
+ int HMaterID = oSub.HMaterID;
+ int HProcID = oSub.HProcID;
+ int HSourceID = oSub.HSourceID;
+ double HOldPrice = oSub.HOldPrice;
+ double HPrice = oSub.HPrice;
+ double HOldFixPrice = oSub.HOldFixPrice;
+ double HFixPrice = oSub.HFixPrice;
+ string HBeginDate = oSub.HBeginDate;
+ string HEndDate = oSub.HEndDate;
+ int HCostFlag = oSub.HCostFlag?1:0;
+ 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 sql = "insert into Pay_ProcPriceRequestBillSub" +
+ "(HInterID,HEntryID,HMaterID,HProcID,HSourceID,HOldPrice,HPrice,HOldFixPrice,HFixPrice,HBeginDate,HEndDate,HCostFlag,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo" +
+ ",HSourceBillType,HRelationQty,HRelationMoney) " +
+ "values(" +
+ "" + HInterID +
+ "," + HEntryID +
+ "," + HMaterID +
+ "," + HProcID +
+ "," + HSourceID +
+ "," + HOldPrice +
+ "," + HPrice +
+ "," + HOldFixPrice +
+ "," + HFixPrice +
+ ",'" + HBeginDate +
+ "','" + HEndDate +
+ "'," + HCostFlag +
+ ",'" + HRemark +
+ "'," + HSourceInterID +
+ "," + HSourceEntryID +
+ ",'" + HSourceBillNo +
+ "','" + HSourceBillType +
+ "'," + HRelationQty +
+ "," + HRelationMoney +
+ ")";
+
+ 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_ProcPriceRequestBill/editInit")]
+ [HttpGet]
+ public object getProcPriceRequestBilleditInit(string HInterID, string user)
+ {
+ try
+ {
+ List<DataTable> tableList = new List<DataTable>();
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Pay_ProcPriceRequestBill_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_ProcPriceRequestBill_EditInit " + HInterID, "h_p_Pay_ProcPriceRequestBill_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 sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Pay_ProcPriceRequestBill/list")]
+ [HttpGet]
+ public object getProcPriceRequestBillList(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ if (!DBUtility.ClsPub.Security_Log("Pay_ProcPriceRequestBillList", 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_ProcPriceRequestBillList order by hmainid desc", "h_v_Pay_ProcPriceRequestBillList");
+ }
+ else
+ {
+ string sql1 = "select * from h_v_Pay_ProcPriceRequestBillList where 1 = 1 ";
+ string sql = sql1 + sWhere + " order by hmainid desc";
+ ds = oCN.RunProcReturn(sql, "h_v_Pay_ProcPriceRequestBillList");
+ }
+
+ //娣诲姞鍒楀悕
+ 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_ProcPriceRequestBill/delete")]
+ [HttpGet]
+ public object deleteProcPriceRequestBill(string HInterID, string user)
+ {
+ try
+ {
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Pay_ProcPriceRequestBill_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_ProcPriceRequestBillMain where HInterID = " + HInterID);
+ oCN.RunProc("delete from Pay_ProcPriceRequestBillSub 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_ProcPriceRequestBill/AuditPay_ProcPriceRequestBill")]
+ [HttpGet]
+ public object AuditPay_ProcPriceRequestBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Pay_ProcPriceRequestBill_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_ProcPriceRequestBillMain";
+ 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_ProcPriceRequestBill/ClosePay_ProcPriceRequestBill")]
+ [HttpGet]
+ public object ClosePay_ProcPriceRequestBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Pay_ProcPriceRequestBill_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_ProcPriceRequestBillMain";
+ 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_ProcPriceRequestBill/DropPay_ProcPriceRequestBill")]
+ [HttpGet]
+ public object DropPay_ProcPriceRequestBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈変綔搴熸潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Pay_ProcPriceRequestBill_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_ProcPriceRequestBillMain";
+ 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
diff --git "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_SalaryCalculateController.cs" "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_SalaryCalculateController.cs"
new file mode 100644
index 0000000..f39f0ed
--- /dev/null
+++ "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_SalaryCalculateController.cs"
@@ -0,0 +1,939 @@
+锘縰sing DBUtility;
+using Model;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+using System.Web.Http;
+using System.Windows.Forms;
+using WebAPI.Models;
+using static WebAPI.Controllers.Pay_SingleBalBillController;
+using static WebAPI.Controllers.Pay_GroupBalBillController;
+
+namespace WebAPI.Controllers.宸ヨ祫绠$悊.宸ヨ祫璁$畻
+{
+ public class Pay_SalaryCulateController : ApiController
+ {
+ public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
+ private json objJsonResult = new json();
+ public DataSet ds = new DataSet();
+ public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill();
+ string user_LongShan = "";
+ string HName_LongShan = "";
+
+ #region 宸ヨ祫璁$畻-鏁版嵁鏌ヨ
+ /// <summary>
+ /// 杩斿洖椤圭洰闃舵鍒楄〃
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Pay_SalaryCalculate/list")]
+ [HttpGet]
+ public object getSalaryCalculateData(string HBeginDate, string HEndDate, int HOperatorType,string HBillType,string user)
+ {
+ try
+ {
+ string sql = "exec h_p_Pay_SalaryCalculate_getData " + HOperatorType + ",'" + HBeginDate + "','" + HEndDate + "'";
+ ds = oCN.RunProcReturn(sql, "h_p_Pay_SalaryCalculate_getData");
+
+ if (HOperatorType == 1)
+ {
+ oCN.BeginTran();
+ objJsonResult = getSalaryCalculateData_SingleBalBill(HBeginDate, HEndDate, HOperatorType, HBillType, user);
+ 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;
+ }else if(HOperatorType == 2)
+ {
+ oCN.BeginTran();
+ objJsonResult = getSalaryCalculateData_GroupBalBill(HBeginDate, HEndDate, HOperatorType, HBillType, user);
+ 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;
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 宸ヨ祫璁$畻-涓汉宸ヨ祫缁撶畻鍗�
+ #region 宸ヨ祫璁$畻-鎵归噺璁$畻-涓汉宸ヨ祫缁撶畻鍗�
+ public json getSalaryCalculateData_SingleBalBill(string HBeginDate, string HEndDate, int HOperatorType, string HBillType, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夌紪杈戞潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Pay_SingleBalBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳柊澧炴潈闄�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ ds = oCN.RunProcReturn("select * from Pay_SingleBalBillMain where HAutoCreate = 1 and CONVERT(varchar(100),HDate, 23) >= '" + HBeginDate + "' and CONVERT(varchar(100),HDate, 23) <= '" + HEndDate + "'", "Pay_SingleBalBillMain");
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ for(int i = 0; i < ds.Tables[0].Rows.Count; i++)
+ {
+ int HInterID = int.Parse(ds.Tables[0].Rows[i]["HInterID"].ToString());
+ oCN.RunProc("delete from Pay_SingleBalBillMain where HInterID = " + HInterID);
+ oCN.RunProc("delete from Pay_SingleBalBillSub where HInterID = " + HInterID);
+ }
+ }
+
+ //鑾峰彇宸ュ簭鍑虹珯姹囨姤鍗曟暟鎹�
+ string sql = "exec h_p_Pay_SalaryCalculate_getData " + HOperatorType + ",'" + HBeginDate + "','" + HEndDate + "'";
+ ds = oCN.RunProcReturn(sql, "h_p_Pay_SalaryCalculate_getData");
+ DataTable data = ds.Tables[0];
+ //鏁寸悊宸ュ簭鍑虹珯姹囨姤鍗曟暟鎹紝骞跺垎鍒敓鎴愪釜浜哄伐璧勭粨绠楀崟
+ if (data.Rows.Count > 0)
+ {
+ int HEmpIDBar = -100; //褰撳墠涓汉宸ヨ祫缁撶畻鍗�-鑱屽憳ID鏍囪
+ Pay_SingleBalBillMain mainTable = new Pay_SingleBalBillMain();
+ List<Pay_SingleBalBillController.Pay_SingleBalBillSub> subTable = new List<Pay_SingleBalBillController.Pay_SingleBalBillSub>();
+ for(int i = 0; i < data.Rows.Count; i++)
+ {
+ int HEmpID = data.Rows[i]["HEmpID"] == null ? 0 : (int)data.Rows[i]["HEmpID"];
+ if (HEmpIDBar != HEmpID)
+ {
+ if (subTable.Count > 0)
+ {
+ //鏂板鍗曟嵁
+ objJsonResult = AddBillMain_Pay_SingleBalBillMain(mainTable, user,subTable);
+ if (objJsonResult.code == "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = objJsonResult.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //娓呯┖琛ㄥご淇℃伅鍜屽瓙琛ㄤ俊鎭紝鍔犺浇鏂板崟鎹殑鏁版嵁
+ mainTable = new Pay_SingleBalBillMain();
+ subTable.Clear();
+ }
+ //鐢熸垚鍗曟嵁鍚庯紝鏇存柊褰撳墠涓汉宸ヨ祫缁撶畻鍗�-鑱屽憳ID鏍囪
+ HEmpIDBar = HEmpID;
+ //濉厖琛ㄥご淇℃伅
+ mainTable.HInterID = (int)DBUtility.ClsPub.CreateBillID(HBillType, ref DBUtility.ClsPub.sExeReturnInfo);
+ mainTable.HBillNo = DBUtility.ClsPub.CreateBillCode(HBillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
+ mainTable.HDate = DateTime.Now.ToString("yyyy-MM-dd");
+ mainTable.HInnerBillNo = mainTable.HBillNo;
+ mainTable.HDeptID = data.Rows[i]["HDeptID"] == null ? 0 : (int)data.Rows[i]["HDeptID"];
+ mainTable.HGroupID = data.Rows[i]["HGroupID"] == null ? 0 :(int)data.Rows[i]["HGroupID"];
+ mainTable.HEmpID = data.Rows[i]["HEmpID"] == null ? 0 : (int)data.Rows[i]["HEmpID"];
+ mainTable.HPayTypeID = 0;
+ mainTable.HSourceBillID = 0;
+ mainTable.HSourceBillNo = "";
+ mainTable.HSourceBillType = "";
+ mainTable.HExplanation = "";
+ mainTable.HRemark = "";
+ mainTable.HMaker = user;
+ mainTable.HMakerDate = DateTime.Now.ToString("yyyy-MM-dd");
+ }
+ //濉厖骞舵坊鍔犲瓙琛ㄨ褰曚俊鎭�
+ Pay_SingleBalBillController.Pay_SingleBalBillSub oSub = new Pay_SingleBalBillController.Pay_SingleBalBillSub();
+ oSub.HMaterID = data.Rows[i]["HMaterID"] == null ? 0 : (int)data.Rows[i]["HMaterID"];
+ oSub.HProcID = data.Rows[i]["HProcID"] == null ? 0 : (int)data.Rows[i]["HProcID"];
+ oSub.HEmpID = data.Rows[i]["HEmpID"] == null ? 0 : (int)data.Rows[i]["HEmpID"];
+ oSub.HTimes = data.Rows[i]["HTimes"] == null ? 0 : double.Parse(data.Rows[i]["HTimes"].ToString());
+ oSub.HQty = data.Rows[i]["HQty"] == null ? 0 : double.Parse(data.Rows[i]["HQty"].ToString());
+ oSub.HPrice = data.Rows[i]["HPrice"] == null ? 0 : double.Parse(data.Rows[i]["HPrice"].ToString());
+ oSub.HPriceRate = 1;
+ oSub.HSubsidyQty = 0;
+ oSub.HSubsidyMoney = 0;
+ oSub.HSubsidyTotal = 0;
+ oSub.HDeuctTotal = 0;
+ oSub.HPackQty = 0;
+ oSub.HPackPrice = 0;
+ oSub.HPackMoney = 0;
+ oSub.HPackMaterID = 0;
+ oSub.HMoney = data.Rows[i]["HMoney"] == null ? 0 : double.Parse(data.Rows[i]["HMoney"].ToString());
+ oSub.HRemark = "";
+ oSub.HICMOInterID = data.Rows[i]["HICMOInterID"] == null ? 0 : (int)data.Rows[i]["HICMOInterID"];
+ oSub.HICMOBillNo = data.Rows[i]["HICMOBillNo"] == null ? "" : data.Rows[i]["HICMOBillNo"].ToString();
+ oSub.HProcReportInterID = 0;
+ oSub.HProcReportEntryID = 0;
+ oSub.HProcReportBillNo = "";
+ oSub.HProcPlanInterID = data.Rows[i]["HProcPlanInterID"] == null ? 0 : (int)data.Rows[i]["HProcPlanInterID"];
+ oSub.HProcPlanEntryID = data.Rows[i]["HProcPlanEntryID"] == null ? 0 : (int)data.Rows[i]["HProcPlanEntryID"];
+ oSub.HProcPlanBillNo = data.Rows[i]["HProcPlanBillNo"] == null ? "" : data.Rows[i]["HProcPlanBillNo"].ToString();
+ oSub.HSourceInterID = 0; //data.Rows[i]["HSourceInterID"] == null ? 0 : (int)data.Rows[i]["HSourceInterID"];
+ oSub.HSourceEntryID = 0; //data.Rows[i]["HSourceEntryID "] == null ? 0 : (int)data.Rows[i]["HSourceEntryID "];
+ oSub.HSourceBillNo = ""; //data.Rows[i]["HSourceBillNo"] == null ? "" : data.Rows[i]["HSourceBillNo"].ToString();
+ oSub.HSourceBillType = "";
+ oSub.HRelationQty = 0;
+ oSub.HRelationMoney = 0;
+ oSub.HCloseMan = "";
+ oSub.HEntryCloseDate = "";
+ subTable.Add(oSub);
+ }
+ //鐢熸垚鏈�鍚庝竴鏉¤褰曪細鏈�鍚庝竴鏉¤褰曞洜涓烘棤娉曞啀涓巇ata.Rows[data.Rows.Count]["HEmpID"]姣旇緝锛屾墍浠ヤ笉浼氭坊鍔狅紝闇�瑕佹渶鍚庡彟澶栨坊鍔�
+ objJsonResult = AddBillMain_Pay_SingleBalBillMain(mainTable, user, subTable);
+ 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 = "Sucess锛�";
+ 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 = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+ #region 宸ヨ祫璁$畻-宸ヨ祫缁撶畻鍗�(涓汉) 涓昏〃
+ public json AddBillMain_Pay_SingleBalBillMain(Pay_SingleBalBillMain oMain,string user,List<Pay_SingleBalBillController.Pay_SingleBalBillSub> subTable)
+ {
+ int OperationType = 1;//鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗
+ string HComputerName = SystemInformation.ComputerName; //璁惧鍚嶇О
+ try
+ {
+ List<Pay_SingleBalBillMain> mainList = new List<Pay_SingleBalBillMain>();
+ mainList.Add(oMain);
+
+ 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;
+
+ ds = oCN.RunProcReturn("select * from Pay_SingleBalBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_SingleBalBillMain");
+
+ if (OperationType == 1 && 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,HAutoCreate) " +
+ "values(" +
+ "" + HYear +
+ "," + HPeriod +
+ ",'" + HBillType +
+ "','" + HBillSubType +
+ "'," + HInterID +
+ ",'" + HDate +
+ "','" + HBillNo +
+ "'," + HBillStatus +
+ "," + HGroupID +
+ "," + HDeptID +
+ "," + HEmpID +
+ "," + HPayType +
+ ",'" + HExplanation +
+ "','" + HInnerBillNo +
+ "','" + HRemark +
+ "','" + HMaker +
+ "','" + HMakerDate +
+ "'," + HMainSourceInterID +
+ ",'" + HMainSourceBillNo +
+ "','" + HMainSourceBillType +
+ "'," + 1 +
+ ")";
+
+ //涓昏〃
+ 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);
+ }
+
+ //淇濆瓨瀛愯〃
+ objJsonResult = AddBillSub_Pay_SingleBalBillMain(subTable, 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(List<Pay_SingleBalBillController.Pay_SingleBalBillSub> DetailColl, long HInterID, string HBillNo, int OperationType)
+ {
+ try
+ {
+ int i = 0; //浣滀负瀛愯〃鍐呯爜
+ foreach (Pay_SingleBalBillController.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;
+ }catch(Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+
+ }
+ #endregion
+ #endregion
+
+ #region 宸ヨ祫璁$畻-闆嗕綋宸ヨ祫缁撶畻鍗�
+ #region 宸ヨ祫璁$畻-鎵归噺璁$畻-闆嗕綋宸ヨ祫缁撶畻鍗�
+ public json getSalaryCalculateData_GroupBalBill(string HBeginDate, string HEndDate, int HOperatorType, string HBillType, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夌紪杈戞潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Pay_GroupBalBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳柊澧炴潈闄�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ ds = oCN.RunProcReturn("select * from Pay_GroupBalBillMain where HAutoCreate = 1 and CONVERT(varchar(100),HDate, 23) >= '" + HBeginDate + "' and CONVERT(varchar(100),HDate, 23) <= '" + HEndDate + "'", "Pay_GroupBalBillMain");
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
+ {
+ int HInterID = int.Parse(ds.Tables[0].Rows[i]["HInterID"].ToString());
+ oCN.RunProc("delete from Pay_GroupBalBillMain where HInterID = " + HInterID);
+ oCN.RunProc("delete from Pay_GroupBalBillSub where HInterID = " + HInterID);
+ oCN.RunProc("delete from Pay_GroupBalBillEmp where HInterID = " + HInterID);
+ }
+ }
+
+
+
+ //鑾峰彇宸ュ簭鍑虹珯姹囨姤鍗曟暟鎹�
+ string sql = "exec h_p_Pay_SalaryCalculate_getData " + HOperatorType + ",'" + HBeginDate + "','" + HEndDate + "'";
+ ds = oCN.RunProcReturn(sql, "h_p_Pay_SalaryCalculate_getData");
+ DataTable data = ds.Tables[0];
+ //鏌ヨ瀛愯〃2鎵�闇�鍙橀噺
+ DataSet ds1;
+ string sql1;
+ //鏁寸悊宸ュ簭鍑虹珯姹囨姤鍗曟暟鎹紝骞跺垎鍒敓鎴愪釜浜哄伐璧勭粨绠楀崟
+ if (data.Rows.Count > 0)
+ {
+ int HDeptIDBar = -100;
+ int HGroupIDBar = -100;
+
+ Pay_GroupBalBillMain mainTable = new Pay_GroupBalBillMain();
+ List<Pay_GroupBalBillController.Pay_GroupBalBillSub> subTable = new List<Pay_GroupBalBillController.Pay_GroupBalBillSub>();
+ List<Pay_GroupBalBillController.Pay_GroupBalBillEmp> subEmpTable = new List<Pay_GroupBalBillController.Pay_GroupBalBillEmp>();
+ for (int i = 0; i < data.Rows.Count; i++)
+ {
+ int HDeptID = data.Rows[i]["HDeptID"] == null ? 0 : (int)data.Rows[i]["HDeptID"];
+ int HGroupID = data.Rows[i]["HGroupID"] == null ? 0 : (int)data.Rows[i]["HGroupID"];
+ if (HDeptIDBar != HDeptID || HGroupIDBar != HGroupID)
+ {
+ if (subTable.Count > 0)
+ {
+ //鑾峰彇瀛愯〃2鏁版嵁
+ sql1 = "select * from h_v_Gy_Employee_ForWeb where HDeptID ='" + HDeptIDBar + "' and HGroupID = '" + HGroupIDBar + "'";
+ ds1 = oCN.RunProcReturn(sql1, "h_v_Gy_Employee_ForWeb");
+ if (ds1.Tables[0].Rows.Count > 0)
+ {
+ for(int j = 0; j < ds1.Tables[0].Rows.Count; j++)
+ {
+ Pay_GroupBalBillController.Pay_GroupBalBillEmp oSubEmp = new Pay_GroupBalBillController.Pay_GroupBalBillEmp();
+ oSubEmp.HEmpID = ds1.Tables[0].Rows[j]["HItemID"] == null ? 0 : int.Parse(ds1.Tables[0].Rows[j]["HItemID"].ToString());
+ oSubEmp.HEmpRate = ds1.Tables[0].Rows[j]["HEmpRate"] == null ? 0 : double.Parse(ds1.Tables[0].Rows[j]["HEmpRate"].ToString());
+ oSubEmp.HBaseTimes = 0;
+ oSubEmp.HMoney = 0;
+ oSubEmp.HOtherSubsidy = 0;
+ oSubEmp.HOtherDeduct = 0;
+ oSubEmp.HYF = 0;
+ oSubEmp.HIsPay = false;
+ oSubEmp.HAvgFlag = false;
+ oSubEmp.HRemark = "";
+ subEmpTable.Add(oSubEmp);
+ }
+ }
+
+ //鏂板鍗曟嵁
+ objJsonResult = AddBillMain_Pay_GroupBalBill(mainTable, user, subTable, subEmpTable);
+ if (objJsonResult.code == "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = objJsonResult.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //娓呯┖琛ㄥご淇℃伅鍜屽瓙琛ㄤ俊鎭紝鍔犺浇鏂板崟鎹殑鏁版嵁
+ mainTable = new Pay_GroupBalBillMain();
+ subTable.Clear();
+ subEmpTable.Clear();
+ }
+ //鐢熸垚鍗曟嵁鍚庯紝鏇存柊褰撳墠闆嗕綋宸ヨ祫缁撶畻鍗�-閮ㄩ棬ID锛岀彮缁処D
+ HDeptIDBar = HDeptID;
+ HGroupIDBar = HGroupID;
+
+ //濉厖琛ㄥご淇℃伅
+ mainTable.HInterID = (int)DBUtility.ClsPub.CreateBillID(HBillType, ref DBUtility.ClsPub.sExeReturnInfo);
+ mainTable.HBillNo = DBUtility.ClsPub.CreateBillCode(HBillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
+ mainTable.HDate = DateTime.Now.ToString("yyyy-MM-dd");
+ mainTable.HInnerBillNo = mainTable.HBillNo;
+ mainTable.HDeptID = data.Rows[i]["HDeptID"] == null ? 0 : (int)data.Rows[i]["HDeptID"];
+ mainTable.HGroupID = data.Rows[i]["HGroupID"] == null ? 0 : (int)data.Rows[i]["HGroupID"];
+ mainTable.HSumMoney = 0;
+ mainTable.HOtherSubsidy = 0;
+ mainTable.HPayMoney = 0;
+ mainTable.HOtherDeduct = 0;
+ mainTable.HSourceBillID = 0;
+ mainTable.HSourceBillNo = "";
+ mainTable.HSourceBillType = "";
+ mainTable.HExplanation = "";
+ mainTable.HRemark = "";
+ mainTable.HMaker = user;
+ mainTable.HMakerDate = DateTime.Now.ToString("yyyy-MM-dd");
+ }
+
+ //濉厖骞舵坊鍔犲瓙琛ㄨ褰曚俊鎭�
+ Pay_GroupBalBillController.Pay_GroupBalBillSub oSub = new Pay_GroupBalBillController.Pay_GroupBalBillSub();
+
+ oSub.HMaterID = data.Rows[i]["HMaterID"] == null ? 0 : (int)data.Rows[i]["HMaterID"];
+ oSub.HUnitID = data.Rows[i]["HUnitID"] == null ? 0 : (int)data.Rows[i]["HUnitID"];
+ oSub.HProcID = data.Rows[i]["HProcID"] == null ? 0 : (int)data.Rows[i]["HProcID"];
+ oSub.HSourceID = data.Rows[i]["HSourceID"] == null ? 0 : (int)data.Rows[i]["HSourceID"];
+ oSub.HTimes = data.Rows[i]["HTimes"] == null ? 0 : double.Parse(data.Rows[i]["HTimes"].ToString());
+ oSub.HQty = data.Rows[i]["HQty"] == null ? 0 : double.Parse(data.Rows[i]["HQty"].ToString());
+ oSub.HPrice = data.Rows[i]["HPrice"] == null ? 0 : double.Parse(data.Rows[i]["HPrice"].ToString());
+ oSub.HMoney = data.Rows[i]["HMoney"] == null ? 0 : double.Parse(data.Rows[i]["HMoney"].ToString());
+ oSub.HRemark = "";
+ oSub.HICMOInterID = 0; // data.Rows[i]["HICMOInterID"] == null ? 0 : (int)data.Rows[i]["HICMOInterID"];
+ oSub.HICMOBillNo = ""; // data.Rows[i]["HICMOBillNo"] == null ? "" : data.Rows[i]["HICMOBillNo"].ToString();
+ oSub.HProcReportInterID = 0;
+ oSub.HProcReportEntryID = 0;
+ oSub.HProcReportBillNo = "";
+ oSub.HProcPlanInterID = 0; // data.Rows[i]["HProcPlanInterID"] == null ? 0 : (int)data.Rows[i]["HProcPlanInterID"];
+ oSub.HProcPlanEntryID = 0; // data.Rows[i]["HProcPlanEntryID"] == null ? 0 : (int)data.Rows[i]["HProcPlanEntryID"];
+ oSub.HProcPlanBillNo = ""; // data.Rows[i]["HProcPlanBillNo"] == null ? "" : data.Rows[i]["HProcPlanBillNo"].ToString();
+ oSub.HSourceInterID = data.Rows[i]["HSourceInterID"] == null ? 0 : (int)data.Rows[i]["HSourceInterID"];
+ oSub.HSourceEntryID = data.Rows[i]["HSourceEntryID"] == null ? 0 : (int)data.Rows[i]["HSourceEntryID"];
+ oSub.HSourceBillNo = data.Rows[i]["HSourceBillNo"] == null ? "" : data.Rows[i]["HSourceBillNo"].ToString();
+ oSub.HSourceBillType = data.Rows[i]["HSourceBillType"] == null ? "" : data.Rows[i]["HSourceBillType"].ToString();
+ oSub.HRelationQty = data.Rows[i]["HQty"] == null ? 0 : double.Parse(data.Rows[i]["HQty"].ToString());
+ oSub.HRelationMoney = data.Rows[i]["HMoney"] == null ? 0 : double.Parse(data.Rows[i]["HMoney"].ToString());
+ subTable.Add(oSub);
+ }
+
+ //鐢熸垚鏈�鍚庝竴鏉¤褰曪細鏈�鍚庝竴鏉¤褰曞洜涓烘棤娉曞啀涓巇ata.Rows[data.Rows.Count]["HEmpID"]姣旇緝锛屾墍浠ヤ笉浼氭坊鍔狅紝闇�瑕佹渶鍚庡彟澶栨坊鍔�
+ sql1 = "select * from h_v_Gy_Employee_ForWeb where HDeptID ='" + HDeptIDBar + "' and HGroupID = '" + HGroupIDBar + "'";
+ ds1 = oCN.RunProcReturn(sql1, "h_v_Gy_Employee_ForWeb");
+ if (ds1.Tables[0].Rows.Count > 0)
+ {
+ for (int j = 0; j < ds1.Tables[0].Rows.Count; j++)
+ {
+ Pay_GroupBalBillController.Pay_GroupBalBillEmp oSubEmp = new Pay_GroupBalBillController.Pay_GroupBalBillEmp();
+ oSubEmp.HEmpID = ds1.Tables[0].Rows[j]["HItemID"] == null ? 0 : int.Parse(ds1.Tables[0].Rows[j]["HItemID"].ToString());
+ oSubEmp.HEmpRate = ds1.Tables[0].Rows[j]["HEmpRate"] == null ? 0 : double.Parse(ds1.Tables[0].Rows[j]["HEmpRate"].ToString());
+ oSubEmp.HBaseTimes = 0;
+ oSubEmp.HMoney = 0;
+ oSubEmp.HOtherSubsidy = 0;
+ oSubEmp.HOtherDeduct = 0;
+ oSubEmp.HYF = 0;
+ oSubEmp.HIsPay = false;
+ oSubEmp.HAvgFlag = false;
+ oSubEmp.HRemark = "";
+ subEmpTable.Add(oSubEmp);
+ }
+ }
+
+ objJsonResult = AddBillMain_Pay_GroupBalBill(mainTable, user, subTable,subEmpTable);
+ 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 = "Sucess锛�";
+ 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 = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+ #region 宸ヨ祫璁$畻-宸ヨ祫缁撶畻鍗�(闆嗕綋) 涓昏〃
+ public json AddBillMain_Pay_GroupBalBill(Pay_GroupBalBillMain oMain, string user, List<Pay_GroupBalBillController.Pay_GroupBalBillSub> subTable, List<Pay_GroupBalBillController.Pay_GroupBalBillEmp> subEmpTable)
+ {
+ int OperationType = 1;//鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗
+
+ string HComputerName = SystemInformation.ComputerName; //璁惧鍚嶇О
+
+ try
+ {
+ List<Pay_GroupBalBillMain> mainList = new List<Pay_GroupBalBillMain>();
+ mainList.Add(oMain);
+
+
+ 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;
+ string HMakerDate = mainList[0].HMakerDate;
+ string HUpdater = mainList[0].HUpdater;
+ string HUpdaterDate = mainList[0].HUpdaterDate;
+ 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;
+
+ 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);
+ }
+
+
+ //淇濆瓨瀛愯〃
+ objJsonResult = AddBillSub1_Pay_GroupBalBill(subTable, HInterID, HBillNo, OperationType);
+ objJsonResult = AddBillSub2_Pay_GroupBalBill(subEmpTable, 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 娣诲姞 宸ヨ祫缁撶畻鍗�(闆嗕綋) 瀛愯〃1
+ public json AddBillSub1_Pay_GroupBalBill(List<Pay_GroupBalBillController.Pay_GroupBalBillSub> DetailColl, long HInterID, string HBillNo, int OperationType)
+ {
+ try
+ {
+ int i = 0; //浣滀负瀛愯〃鍐呯爜
+ foreach (Pay_GroupBalBillController.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;
+ }catch(Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ }
+ #endregion
+ #region 娣诲姞 宸ヨ祫缁撶畻鍗�(闆嗕綋) 瀛愯〃2
+ public json AddBillSub2_Pay_GroupBalBill(List<Pay_GroupBalBillController.Pay_GroupBalBillEmp> DetailColl, long HInterID, string HBillNo, int OperationType)
+ {
+ try
+ {
+ 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;
+ }catch(Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+ #endregion
+ }
+}
\ No newline at end of file
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 413dab1..a16f817 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"
@@ -818,6 +818,33 @@
return objJsonResult;
}
#endregion
+
+ #region 鏍规嵁鐗╂枡ID銆佸伐搴廔D銆佽祫婧怚D鑾峰彇宸ヤ环
+ [Route("Pay_SingleBalBill/get_HPrice_BaseMaterHProcHSource")]
+ [HttpGet]
+ public object get_HPrice_BaseMaterHProcHSource(Int64 HMaterID, Int64 HProcID, Int64 HSourceID)
+ {
+ try
+ {
+ DAL.ClsGy_ProcPrice_Ctl oProcPrice = new DAL.ClsGy_ProcPrice_Ctl();
+ double HPrice = oProcPrice.LoadProcPrice(HMaterID, HProcID, HSourceID, true);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = HPrice;
+ return objJsonResult;
+ }
+ catch(Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
#endregion
#region 宸ヨ祫缁撶畻鍗�(涓汉)-鏌ヨ
diff --git "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_WorkTimesBillController.cs" "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_WorkTimesBillController.cs"
index a1f74c1..175fa43 100644
--- "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_WorkTimesBillController.cs"
+++ "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_WorkTimesBillController.cs"
@@ -1,4 +1,5 @@
-锘縰sing Newtonsoft.Json.Linq;
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections;
@@ -396,5 +397,52 @@
return objJsonResult;
}
}
+
+
+ #region 鑰冨嫟姹囨�绘暟鎹鐞嗚〃鏌ヨ
+ [Route("Pay_WorkTimesSumQueryBill/list")]
+ [HttpGet]
+ public object getWorkTimesSumQueryBillList(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ if (!DBUtility.ClsPub.Security_Log("Pay_WorkTimesSumQueryBillList", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+
+ ds = oCN.RunProcReturn("exec h_p_Pay_WorkTimesSumQueryBillList " + sWhere, "Pay_WorkTimesSumQueryBillList");
+
+ //娣诲姞鍒楀悕
+ 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
diff --git a/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml b/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml
index 4e00e52..9250916 100644
--- a/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml
+++ b/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml
@@ -10,7 +10,7 @@
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>x86</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
- <PublishUrl>E:\缃戠珯鍙戝竷\API</PublishUrl>
+ <PublishUrl>D:\缃戠珯鍙戝竷\鏅轰簯MESWMS\API</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<SiteUrlToLaunchAfterPublish />
</PropertyGroup>
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index a53743c..9fad71c 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -463,6 +463,7 @@
<Compile Include="Controllers\Sc_ProcessReportController.cs" />
<Compile Include="Controllers\浜轰簨绠$悊\鍏ヨ亴鐢宠\HR_EmpEngageRequestBillController.cs" />
<Compile Include="Controllers\浜轰簨绠$悊\绂昏亴鐢宠\HR_EmpDimissionBillController.cs" />
+ <Compile Include="Controllers\浜轰簨绠$悊\鑱屽憳寮傚姩鍗昞HR_EmpChangeBillController.cs" />
<Compile Include="Controllers\浠撳瓨绠$悊\濮斿鐢ㄦ枡\WW_PPBomBillController.cs" />
<Compile Include="Controllers\浠撳瓨绠$悊\鎵爜寮傚父璁板綍\KF_PonderationBillController.cs" />
<Compile Include="Controllers\浠撳瓨绠$悊\鏉$爜鍑哄叆搴撹褰昞Kf_ICStockInOutBillController.cs" />
@@ -504,6 +505,13 @@
<Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Xt_CheckFlowBillController.cs" />
<Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Xt_CheckItemBillController.cs" />
<Compile Include="Controllers\鍩虹璧勬枡\宸ヨ祫鍩虹璧勬枡\Gy_ProcCommPriceController.cs" />
+ <Compile Include="Controllers\宸ヨ祫绠$悊\Pay_OutApplyBillController.cs" />
+ <Compile Include="Controllers\宸ヨ祫绠$悊\Pay_OverApplyBillController.cs" />
+ <Compile Include="Controllers\宸ヨ祫绠$悊\Pay_PayMentBillController.cs" />
+ <Compile Include="Controllers\宸ヨ祫绠$悊\Pay_SalaryCalculateController.cs" />
+ <Compile Include="Controllers\宸ヨ祫绠$悊\Pay_DuSubsidyItemBillController.cs" />
+ <Compile Include="Controllers\宸ヨ祫绠$悊\Pay_ErrWorkTimesRequestBillController.cs" />
+ <Compile Include="Controllers\宸ヨ祫绠$悊\Pay_ProcPriceRequestBillController.cs" />
<Compile Include="Controllers\宸ヨ祫绠$悊\Pay_MonthlySalaryReportController.cs" />
<Compile Include="Controllers\宸ヨ祫绠$悊\Pay_PieceRateWageReportController.cs" />
<Compile Include="Controllers\宸ヨ祫绠$悊\Gy_ClassTimePrjBillController.cs" />
--
Gitblit v1.9.1