From 7749b7bf2719ba2206d09ab9fa1938aa503e35c0 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期三, 26 七月 2023 10:11:37 +0800
Subject: [PATCH] 职员异动单 及列表

---
 WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user |   34 +-
 WebAPI/WebAPI.csproj                                        |    1 
 WebAPI/Controllers/人事管理/职员异动单/HR_EmpChangeBillController.cs |  810 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 828 insertions(+), 17 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/Properties/PublishProfiles/FolderProfile.pubxml.user b/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user
index bf04eb6..2472a83 100644
--- a/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user
+++ b/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user
@@ -20,12 +20,12 @@
     <File Include="bin/BLL.dll">
       <publishTime>11/09/2022 16:02:08</publishTime>
       <publishTime>11/02/2022 22:03:01</publishTime>
-      <publishTime>07/25/2023 15:19:12</publishTime>
+      <publishTime>07/26/2023 10:06:21</publishTime>
     </File>
     <File Include="bin/BLL.pdb">
       <publishTime>11/09/2022 16:02:08</publishTime>
       <publishTime>11/02/2022 22:03:01</publishTime>
-      <publishTime>07/25/2023 15:19:12</publishTime>
+      <publishTime>07/26/2023 10:06:21</publishTime>
     </File>
     <File Include="bin/BouncyCastle.Crypto.dll">
       <publishTime>12/18/2020 05:32:28</publishTime>
@@ -33,12 +33,12 @@
     <File Include="bin/DAL.dll">
       <publishTime>11/09/2022 16:02:06</publishTime>
       <publishTime>11/02/2022 22:02:58</publishTime>
-      <publishTime>07/25/2023 15:19:10</publishTime>
+      <publishTime>07/26/2023 10:06:20</publishTime>
     </File>
     <File Include="bin/DAL.pdb">
       <publishTime>11/09/2022 16:02:06</publishTime>
       <publishTime>11/02/2022 22:02:58</publishTime>
-      <publishTime>07/25/2023 15:19:10</publishTime>
+      <publishTime>07/26/2023 10:06:20</publishTime>
     </File>
     <File Include="bin/Dapper.dll">
       <publishTime>07/22/2016 22:52:40</publishTime>
@@ -46,12 +46,12 @@
     <File Include="bin/DBUtility.dll">
       <publishTime>11/02/2022 22:02:56</publishTime>
       <publishTime>11/15/2022 13:55:23</publishTime>
-      <publishTime>07/25/2023 15:19:08</publishTime>
+      <publishTime>07/26/2023 10:06:17</publishTime>
     </File>
     <File Include="bin/DBUtility.pdb">
       <publishTime>11/09/2022 16:01:58</publishTime>
       <publishTime>11/02/2022 22:02:56</publishTime>
-      <publishTime>07/25/2023 15:19:08</publishTime>
+      <publishTime>07/26/2023 10:06:17</publishTime>
     </File>
     <File Include="bin/Grpc.Core.Api.dll">
       <publishTime>03/22/2022 13:17:26</publishTime>
@@ -107,12 +107,12 @@
     <File Include="bin/Model.dll">
       <publishTime>11/09/2022 16:02:01</publishTime>
       <publishTime>11/02/2022 22:02:56</publishTime>
-      <publishTime>07/25/2023 15:19:08</publishTime>
+      <publishTime>07/26/2023 10:06:17</publishTime>
     </File>
     <File Include="bin/Model.pdb">
       <publishTime>11/09/2022 16:02:01</publishTime>
       <publishTime>11/02/2022 22:02:56</publishTime>
-      <publishTime>07/25/2023 15:19:08</publishTime>
+      <publishTime>07/26/2023 10:06:17</publishTime>
     </File>
     <File Include="bin/Models/ClsSc_MouldScrapOutBillMain.cs">
       <publishTime>04/06/2023 15:57:02</publishTime>
@@ -147,33 +147,33 @@
     <File Include="bin/Pub_Class.dll">
       <publishTime>11/09/2022 16:01:56</publishTime>
       <publishTime>11/02/2022 22:02:54</publishTime>
-      <publishTime>07/25/2023 15:19:07</publishTime>
+      <publishTime>07/26/2023 10:06:16</publishTime>
     </File>
     <File Include="bin/Pub_Class.pdb">
       <publishTime>11/09/2022 16:01:56</publishTime>
       <publishTime>11/02/2022 22:02:54</publishTime>
-      <publishTime>07/25/2023 15:19:07</publishTime>
+      <publishTime>07/26/2023 10:06:16</publishTime>
     </File>
     <File Include="bin/Pub_Control.dll">
       <publishTime>11/09/2022 16:01:57</publishTime>
       <publishTime>11/02/2022 22:02:55</publishTime>
-      <publishTime>07/25/2023 15:19:07</publishTime>
+      <publishTime>07/26/2023 10:06:16</publishTime>
     </File>
     <File Include="bin/Pub_Control.pdb">
       <publishTime>11/09/2022 16:01:57</publishTime>
       <publishTime>11/02/2022 22:02:55</publishTime>
-      <publishTime>07/25/2023 15:19:07</publishTime>
+      <publishTime>07/26/2023 10:06:16</publishTime>
     </File>
     <File Include="bin/RestSharp.dll">
       <publishTime>08/31/2012 06:22:50</publishTime>
     </File>
     <File Include="bin/SQLHelper.dll">
-      <publishTime>07/25/2023 15:19:07</publishTime>
+      <publishTime>07/26/2023 10:06:16</publishTime>
     </File>
     <File Include="bin/SQLHelper.pdb">
       <publishTime>11/09/2022 16:01:57</publishTime>
       <publishTime>11/02/2022 22:02:55</publishTime>
-      <publishTime>07/25/2023 15:19:07</publishTime>
+      <publishTime>07/26/2023 10:06:16</publishTime>
     </File>
     <File Include="bin/stdole.dll">
       <publishTime>05/09/2021 13:35:37</publishTime>
@@ -286,7 +286,7 @@
     <File Include="bin/WebAPI.dll">
       <publishTime>11/14/2022 11:23:59</publishTime>
       <publishTime>11/02/2022 22:03:04</publishTime>
-      <publishTime>07/25/2023 15:19:15</publishTime>
+      <publishTime>07/26/2023 10:06:26</publishTime>
     </File>
     <File Include="bin/WebAPI.dll.config">
       <publishTime>12/15/2021 17:59:43</publishTime>
@@ -294,7 +294,7 @@
     <File Include="bin/WebAPI.pdb">
       <publishTime>11/14/2022 11:23:59</publishTime>
       <publishTime>11/02/2022 22:03:04</publishTime>
-      <publishTime>07/25/2023 15:19:15</publishTime>
+      <publishTime>07/26/2023 10:06:26</publishTime>
     </File>
     <File Include="bin/WebGrease.dll">
       <publishTime>07/18/2013 01:03:52</publishTime>
@@ -503,7 +503,7 @@
     <File Include="Web.config">
       <publishTime>11/14/2022 11:24:08</publishTime>
       <publishTime>11/02/2022 22:03:20</publishTime>
-      <publishTime>07/25/2023 15:19:21</publishTime>
+      <publishTime>07/26/2023 10:06:31</publishTime>
     </File>
   </ItemGroup>
 </Project>
\ No newline at end of file
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index b0b44f1..5062bc6 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -460,6 +460,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" />

--
Gitblit v1.9.1