yangle
2025-04-09 37da233a7ed8212982acdad3d6dbd09338678b4b
WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs
@@ -14,6 +14,7 @@
using System.Web.Http;
using WebAPI.Models;
using System.Threading;
using SyntacticSugar.constant;
namespace WebAPI.Controllers.SCGL
{
@@ -249,14 +250,7 @@
        }
        #endregion
        #region [报工台异常反馈单审核、反审核]
        /// <summary>
        ///
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        #region [报工台异常反馈单审核、反审核]
        [Route("Sc_MESTransFerWorkBill/AuditTransFerReportList")]
        [HttpGet]
        public object AuditTransFerReportList(int HInterID, int IsAudit, string CurUserName)
@@ -337,8 +331,31 @@
                }
                if (IsAudit == 0) //审核提交
                {
                    //审核前控制=========================================
                    string sql1 = "exec h_p_OA_ErrMsgBackBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackBill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    //审核提交
                    if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    if (oBill.CheckBill(lngBillKey, oBill.omodel.HBillNo, "h_p_OA_ErrMsgBackBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
@@ -357,8 +374,30 @@
                }
                if (IsAudit == 1) //反审核提交
                {
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_OA_ErrMsgBackBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackBill_BeforeUnCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //===========================================================
                    //反审核提交AbandonCheck
                    if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    if (oBill.AbandonCheck(lngBillKey, oBill.omodel.HBillNo, "h_p_OA_ErrMsgBackBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
@@ -382,6 +421,188 @@
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 异常反馈单 关闭/反关闭功能
        [Route("Sc_MESTransFerWorkBill/CloseOA_ErrMsgBackBill")]
        [HttpGet]
        public object CloseOA_ErrMsgBackBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackBill_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;
                }
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);
                ClsPub.CurUserName = user;
                DLL.ClsOA_ErrMsgBackBill oBill = new DLL.ClsOA_ErrMsgBackBill();          //实例化单据操作类,用于进行相关操作
                //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作
                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //根据HInterID获取该单据的数据
                {
                    if (oBill.omodel.HDeleteMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已作废!不能进行关闭!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HChecker.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据未审核!不能进行关闭!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (Type == 1)  //关闭判断
                    {
                        if (oBill.omodel.HCloseMan.Trim() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已关闭!不能再次关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (Type == 2) //反关闭判断
                    {
                        if (oBill.omodel.HCloseMan.Trim() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未关闭!不需要反关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //进行需要进行的关闭/反关闭操作
                if (Type == 1) //关闭提交
                {
                    //关闭前控制=========================================
                    string sql1 = "exec h_p_OA_ErrMsgBackBill_BeforeCloseCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackBill_BeforeCloseCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:关闭前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    //关闭提交
                    if (oBill.CloseBill(lngBillKey, oBill.omodel.HBillNo, "h_p_OA_ErrMsgBackBill_AfterCloseCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                if (Type == 2) //反关闭提交
                {
                    //反关闭前控制=========================================
                    string sql1 = "exec h_p_OA_ErrMsgBackBill_BeforeUnCloseCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackBill_BeforeUnCloseCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:反关闭前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    //反关闭提交
                    if (oBill.CancelClose(lngBillKey, oBill.omodel.HBillNo, "h_p_OA_ErrMsgBackBill_AfterUnCloseCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -447,8 +668,7 @@
        public static DataSet Get_TransFerBillList(string sWhere)
        {
            //var sql = "select A.HInterID,b.HEntryID,A.HBillNo,A.HContext,A.HDeptID,D.HName HDeptName, A.HSendMan, B.HReceiveMan,A.HLevel,A.HDescription,case when B.HReadFlag=0 then '未阅' when B.HReadFlag=1 then '已阅' end HReadFlag, A.HMaker,A.HMakeDate,A.HUpDater,A.HUpDateDate" +
            //   " from OA_InformBillMain A inner join  OA_InformBillSub B on A.HInterID=B.HInterID left join Gy_Department D on A.HDeptID=D.HItemID where 1=1 " + sWhere;
            var sql = string.Format(@"select A.HInterID,b.HEntryID,A.HBillStatus,A.HBillNo,A.HDate,A.HContext,A.HDescription,A.HRemark,A.HQty,case when A.HSendType=0 then '公共' when B.HReadFlag=1 then '个人' end HSendType,
                                      A.HDeptID,D.HName HDeptName, A.HSendMan, 
                                      A.HReceiveMan,B.HReceiveMan HCopyMan,A.HHasten, case when A.HLevel=0 then '普通' when B.HReadFlag=1 then '紧急' end HLevel,A.HMaterName,A.HMaterModel,
@@ -460,6 +680,61 @@
            return new SQLHelper.ClsCN().RunProcReturn(sql, "OA_ErrMsgBackBillMain");
        }
        #endregion
        #region 异常反馈单 分页列表
        [Route("Sc_MESTransFerWorkBill/Get_TransFerBillListPage")]
        [HttpGet]
        public json Get_TransFerBillListPage(string sWhere, string user, int page, int size)
        {
            DataSet ds;
            json res = new json();
            try
            {
                List<object> columnNameList = new List<object>();
                //判断权限
                if (!DBUtility.ClsPub.Security_Log("Sc_WorkBeginDotCheckBillMain_Check", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限查询!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                sWhere = sWhere.Replace("'", "''");
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("exec h_p_OA_ErrMsgBackBillList " + page + "," + size + ",''", "h_p_OA_ErrMsgBackBillList");
                }
                else
                {
                    ds = oCN.RunProcReturn("exec h_p_OA_ErrMsgBackBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_OA_ErrMsgBackBillList");
                }
                //添加列名
                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));//获取到DataColumn列对象的列名
                }
                res.code = CodeConstant.SUCCEED;
                res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                res.Message = "Sucess!";
                res.list = columnNameList;
                res.data = ds.Tables[0];
                return res;
            }
            catch (Exception e)
            {
                res.code = CodeConstant.FAIL;
                res.count = CountConstant.FAIL;
                res.Message = "Exception!" + e.ToString();
                res.data = null;
                return res;
            }
        }
        #endregion
        #region 异常反馈列表PDA
@@ -527,20 +802,7 @@
            if (string.IsNullOrEmpty(HID))
                return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" };
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            string sql =string.Format(@"select A.HInterID,b.HEntryID,A.HBillStatus,A.HBillNo,A.HDate,A.HContext,A.HDescription,A.HRemark,
                                        A.HQty,A.HSendType,
                                        A.HDeptID,D.HName HDeptName, A.HSendMan,
                                        A.HReceiveMan,A.HCopyMan,A.HHasten,
                                        A.HLevel,A.HMaterNumber,A.HMaterName,A.HMaterModel,
                                        B.HReadFlag, A.HMaker,A.HMakeDate,A.HUpDater,A.HUpDateDate,A.HChecker,A.HCheckDate,A.HCloseMan,A.HCloseDate,A.HDeleteMan,A.HDeleteDate,
                                        A.HSourceInterID,A.HSourceEntryID,A.HSourceBillNo,A.HSourceBillType,
                              A.HHandleEmpID,f.HName HHandleEmpName,A.HErrMsgBackTypeID,g.HName HErrMsgBackTypeName
                                        from OA_ErrMsgBackBillMain A
                                        inner join  OA_ErrMsgBackBillSub2 B on A.HInterID=B.HInterID
                                        left join Gy_Department D on A.HDeptID=D.HItemID
                              left join Gy_Employee f on A.HHandleEmpID=f.HItemID
                                        left join Gy_ErrMsgBackType g on A.HErrMsgBackTypeID=g.HItemID
                                        where A.HInterID='" + HID + "' and b.HEntryID='" + HEntryID + "'");
            string sql =string.Format(@"select * from h_v_OA_ErrMsgBackBillEdit  where HInterID='" + HID + "' and HEntryID='" + HEntryID + "'");
            var dataSet = oCN.RunProcReturn(sql, "OA_ErrMsgBackBillMain");
            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
                return new ApiResult<DataSet> { code = -1, msg = "不存在单号" };
@@ -565,11 +827,8 @@
        }
        #endregion
        #region [模具改制申请单删除功能]
        /// <summary>
        /// 模具改制申请单删除功能
        /// </summary>
        /// <returns></returns>
        #region [异常反馈单删除功能]
        [Route("Sc_MESTransFerWorkBill/Get_DeleteTransFerBill")]
        [HttpGet]
        public object Get_DeleteTransFerBill(string HInterID,string HEntryID, string user)
@@ -623,7 +882,30 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    bool IsDete = oBill.DeleteBill(lngBillKey, HEntryID, ref DBUtility.ClsPub.sExeReturnInfo);
                    //删除前控制=========================================
                    string sql1 = "exec h_p_OA_ErrMsgBackBill_BeforeDelCtrl  " + BillOld1.omodel.HInterID + ",'" + BillOld1.omodel.HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackBill_BeforeDelCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    bool IsDete = oBill.DeleteBill(lngBillKey, HEntryID, "h_p_OA_ErrMsgBackBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo);
                    if (IsDete)
                    {
                        objJsonResult.code = "1";
@@ -1076,8 +1358,8 @@
            {
                List<object> columnNameList = new List<object>();
                string sql = "select * from h_v_OA_ErrMsgBackReceiveBillMainList where hmainid='"+HID+"'";
                ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillMainList");
                string sql = "select * from h_v_OA_ErrMsgBackReceiveBillMainEdit where hmainid='" + HID+"'";
                ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillMainEdit");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
@@ -1159,6 +1441,61 @@
                objJsonResult.Message = "查询数据异常,请与管理员联系!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 异常反馈接收单列表 分页列表
        [Route("Sc_MESTransFerWorkBill/Get_OA_ErrMsgBackReceiveBillListPage")]
        [HttpGet]
        public json Get_OA_ErrMsgBackReceiveBillListPage(string sWhere, string user, int page, int size)
        {
            DataSet ds;
            json res = new json();
            try
            {
                List<object> columnNameList = new List<object>();
                //判断权限
                if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackReceiveBillMain_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限查询!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                sWhere = sWhere.Replace("'", "''");
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("exec h_p_OA_ErrMsgBackReceiveBillList " + page + "," + size + ",''", "h_p_OA_ErrMsgBackReceiveBillList");
                }
                else
                {
                    ds = oCN.RunProcReturn("exec h_p_OA_ErrMsgBackReceiveBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_OA_ErrMsgBackReceiveBillList");
                }
                //添加列名
                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));//获取到DataColumn列对象的列名
                }
                res.code = CodeConstant.SUCCEED;
                res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                res.Message = "Sucess!";
                res.list = columnNameList;
                res.data = ds.Tables[0];
                return res;
            }
            catch (Exception e)
            {
                res.code = CodeConstant.FAIL;
                res.count = CountConstant.FAIL;
                res.Message = "Exception!" + e.ToString();
                res.data = null;
                return res;
            }
        }
        #endregion
@@ -1642,8 +1979,30 @@
                //进行需要进行的关闭/反关闭操作
                if (IsAudit == 0) //关闭提交
                {
                    //关闭前控制=========================================
                    string sql1 = "exec h_p_OA_ErrMsgBackReceiveBill_BeforeCloseCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackReceiveBill_BeforeCloseCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:关闭前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    //关闭提交
                    if (oBill.CloseBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    if (oBill.CloseBill(lngBillKey, oBill.omodel.HBillNo, "h_p_OA_ErrMsgBackReceiveBill_AfterCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
@@ -1662,8 +2021,31 @@
                }
                if (IsAudit == 1) //反关闭提交
                {
                    //反关闭前控制=========================================
                    string sql1 = "exec h_p_OA_ErrMsgBackReceiveBill_BeforeUnCloseCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackReceiveBill_BeforeUnCloseCtrl    ");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:反关闭前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    //反关闭提交
                    if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    if (oBill.CancelClose(lngBillKey, oBill.omodel.HBillNo, "h_p_OA_ErrMsgBackReceiveBill_AfterUnCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
@@ -1834,7 +2216,7 @@
        [Route("OA_ErrMsgBackSignBill_BrushCard/ErrMsgBackReceive")]
        [HttpGet]
        public object ErrMsgBackReceive(string sWhere, string user)
        public object ErrMsgBackReceive(string sWhere,string num, string user)
        {
            try
            {
@@ -1849,18 +2231,38 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (sWhere == null || sWhere.Equals(""))
                if (num=="2")       //报工台获取刷卡签到数据
                {
                    string sql = "select * from h_v_OA_ErrMsgBackReceiveBillList_BrushCard order by 单据号 desc";
                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillList_BrushCard");
                    if (sWhere == null || sWhere.Equals(""))
                    {
                        string sql = "select * from h_v_SingOA_ErrMsgBackList_BrushCard order by 单据号 desc";
                        ds = oCN.RunProcReturn(sql, "h_v_SingOA_ErrMsgBackList_BrushCard");
                    }
                    else
                    {
                        string sql1 = "select * from h_v_SingOA_ErrMsgBackList_BrushCard where 1 = 1 ";
                        string sql = sql1 + sWhere + " order by 单据号 desc";
                        ds = oCN.RunProcReturn(sql, "h_v_SingOA_ErrMsgBackList_BrushCard");
                    }
                }
                else
                else   //原有的刷卡签到获取数据
                {
                    string sql1 = "select * from h_v_OA_ErrMsgBackReceiveBillList_BrushCard where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by 单据号 desc";
                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillList_BrushCard");
                    {
                        if (sWhere == null || sWhere.Equals(""))
                        {
                            string sql = "select * from h_v_OA_ErrMsgBackReceiveBillList_BrushCard order by 单据号 desc";
                            ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillList_BrushCard");
                        }
                        else
                        {
                            string sql1 = "select * from h_v_OA_ErrMsgBackReceiveBillList_BrushCard where 1 = 1 ";
                            string sql = sql1 + sWhere + " order by 单据号 desc";
                            ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillList_BrushCard");
                        }
                    }
                }
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
@@ -2015,6 +2417,31 @@
                }
                if (bResult)
                {
                    //自动审核设置
                    if (refSav == "Add")
                    {
                        objJsonResult.HInterID = oBill.omodel.HInterID.ToString(); //返回主ID
                        //系统参数  自动审核
                        string sReturn = "";
                        if (oSystemParameter.ShowBill(ref sReturn) == true)
                        {
                            if (oSystemParameter.omodel.OA_ErrMsgBackSignBill_AutoCheck == "Y") //系统参数  自动审核
                            {
                                objJsonResult.Verify = "Y";
                            }
                            else
                            {
                                objJsonResult.Verify = "N";
                            }
                        }
                    }
                    else
                    if (refSav == "Update")
                    {
                        objJsonResult.HInterID = oBill.omodel.HInterID.ToString(); //返回主ID
                        objJsonResult.Verify = "N";
                    }
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
@@ -2051,8 +2478,8 @@
            {
                List<object> columnNameList = new List<object>();
                string sql = "select * from h_v_OA_ErrMsgBackSignBillMainList where hmainid='" + HID + "'";
                ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackSignBillMainList");
                string sql = "select * from h_v_OA_ErrMsgBackSignBillMainEdit where hmainid='" + HID + "'";
                ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackSignBillMainEdit");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
@@ -2134,6 +2561,61 @@
                objJsonResult.Message = "查询数据异常,请与管理员联系!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 异常反馈签到单列表 分页列表
        [Route("Sc_MESTransFerWorkBill/Get_OA_ErrMsgBackSignBillListPage")]
        [HttpGet]
        public json Get_OA_ErrMsgBackSignBillListPage(string sWhere, string user, int page, int size)
        {
            DataSet ds;
            json res = new json();
            try
            {
                List<object> columnNameList = new List<object>();
                //判断权限
                if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackSignBillMain_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限查询!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                sWhere = sWhere.Replace("'", "''");
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("exec h_p_OA_ErrMsgBackSignBillList " + page + "," + size + ",''", "h_p_OA_ErrMsgBackSignBillList");
                }
                else
                {
                    ds = oCN.RunProcReturn("exec h_p_OA_ErrMsgBackSignBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_OA_ErrMsgBackSignBillList");
                }
                //添加列名
                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));//获取到DataColumn列对象的列名
                }
                res.code = CodeConstant.SUCCEED;
                res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                res.Message = "Sucess!";
                res.list = columnNameList;
                res.data = ds.Tables[0];
                return res;
            }
            catch (Exception e)
            {
                res.code = CodeConstant.FAIL;
                res.count = CountConstant.FAIL;
                res.Message = "Exception!" + e.ToString();
                res.data = null;
                return res;
            }
        }
        #endregion
@@ -2617,8 +3099,31 @@
                //进行需要进行的关闭/反关闭操作
                if (IsAudit == 0) //关闭提交
                {
                    //关闭前控制=========================================
                    string sql1 = "exec h_p_OA_ErrMsgBackSignBill_BeforeCloseCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackSignBill_BeforeCloseCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:关闭前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    //关闭提交
                    if (oBill.CloseBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    if (oBill.CloseBill(lngBillKey, oBill.omodel.HBillNo, "h_p_OA_ErrMsgBackSignBill_AfterCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
@@ -2637,8 +3142,32 @@
                }
                if (IsAudit == 1) //反关闭提交
                {
                    //反关闭前控制=========================================
                    string sql1 = "exec h_p_OA_ErrMsgBackSignBill_BeforeUnCloseCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackSignBill_BeforeUnCloseCtrl    ");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:反关闭前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    //反关闭提交
                    if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    if (oBill.CancelClose(lngBillKey, oBill.omodel.HBillNo, "h_p_OA_ErrMsgBackSignBill_AfterUnCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
@@ -2920,7 +3449,7 @@
                {
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    _ = SendDingDingAsync(oBill.omodel.HSendMan, 1, oBill.omodel.HDescription, oBill.omodel.HReceiveMan);
                    _ = SendDingDingAsync(oBill.omodel.HSendMan, 2, oBill.omodel.HDescription, oBill.omodel.HReceiveMan);
                }
                else if (refSav == "Update")
                {
@@ -2932,6 +3461,32 @@
                }
                if (bResult)
                {
                    //自动审核设置
                    if (refSav == "Add")
                    {
                        objJsonResult.HInterID = oBill.omodel.HInterID.ToString(); //返回主ID
                        //系统参数  自动审核
                        string sReturn = "";
                        if (oSystemParameter.ShowBill(ref sReturn) == true)
                        {
                            if (oSystemParameter.omodel.OA_ErrMsgBackHandleBill_AutoCheck == "Y") //系统参数  自动审核
                            {
                                objJsonResult.Verify = "Y";
                            }
                            else
                            {
                                objJsonResult.Verify = "N";
                            }
                        }
                    }
                    else
                    if (refSav == "Update")
                    {
                        objJsonResult.HInterID = oBill.omodel.HInterID.ToString(); //返回主ID
                        objJsonResult.Verify = "N";
                    }
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
@@ -2968,8 +3523,8 @@
            {
                List<object> columnNameList = new List<object>();
                string sql = "select * from h_v_OA_ErrMsgBackHandleBillMainList where hmainid='" + HID + "'";
                ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackHandleBillMainList");
                string sql = "select * from h_v_OA_ErrMsgBackHandleBillMainEdit where hmainid='" + HID + "'";
                ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackHandleBillMainEdit");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
@@ -3054,6 +3609,63 @@
            }
        }
        #endregion
        #region 异常反馈处理单 分页列表
        [Route("Sc_MESTransFerWorkBill/Get_OA_ErrMsgBackHandleBillListPage")]
        [HttpGet]
        public json Get_OA_ErrMsgBackHandleBillListPage(string sWhere, string user, int page, int size)
        {
            DataSet ds;
            json res = new json();
            try
            {
                List<object> columnNameList = new List<object>();
                //判断权限
                if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackHandleBillMain_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限查询!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                sWhere = sWhere.Replace("'", "''");
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("exec h_p_OA_ErrMsgBackHandleBillList " + page + "," + size + ",''", "h_p_OA_ErrMsgBackHandleBillList");
                }
                else
                {
                    ds = oCN.RunProcReturn("exec h_p_OA_ErrMsgBackHandleBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_OA_ErrMsgBackHandleBillList");
                }
                //添加列名
                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));//获取到DataColumn列对象的列名
                }
                res.code = CodeConstant.SUCCEED;
                res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                res.Message = "Sucess!";
                res.list = columnNameList;
                res.data = ds.Tables[0];
                return res;
            }
            catch (Exception e)
            {
                res.code = CodeConstant.FAIL;
                res.count = CountConstant.FAIL;
                res.Message = "Exception!" + e.ToString();
                res.data = null;
                return res;
            }
        }
        #endregion
        #region 异常反馈处理单列表PDA
        [Route("Sc_MESTransFerWorkBill/Get_OA_ErrMsgBackHandleBillList_PDA")]
@@ -3531,8 +4143,31 @@
                //进行需要进行的关闭/反关闭操作
                if (IsAudit == 0) //关闭提交
                {
                    //关闭前控制=========================================
                    string sql1 = "exec h_p_OA_ErrMsgBackHandleBill_BeforeCloseCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackHandleBill_BeforeCloseCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:关闭前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    //关闭提交
                    if (oBill.CloseBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    if (oBill.CloseBill(lngBillKey, oBill.omodel.HBillNo, "h_p_OA_ErrMsgBackHandleBill_AfterCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
@@ -3551,8 +4186,31 @@
                }
                if (IsAudit == 1) //反关闭提交
                {
                    //反关闭前控制=========================================
                    string sql1 = "exec h_p_OA_ErrMsgBackHandleBill_BeforeUnCloseCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackHandleBill_BeforeUnCloseCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:反关闭前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    //反关闭提交
                    if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    if (oBill.CancelClose(lngBillKey, oBill.omodel.HBillNo, "h_p_OA_ErrMsgBackHandleBill_AfterUnCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
@@ -3846,6 +4504,32 @@
                }
                if (bResult)
                {
                    //自动审核设置
                    if (refSav == "Add")
                    {
                        objJsonResult.HInterID = oBill.omodel.HInterID.ToString(); //返回主ID
                        //系统参数  自动审核
                        string sReturn = "";
                        if (oSystemParameter.ShowBill(ref sReturn) == true)
                        {
                            if (oSystemParameter.omodel.OA_ErrMsgBackCheckBill_AutoCheck == "Y") //系统参数  自动审核
                            {
                                objJsonResult.Verify = "Y";
                            }
                            else
                            {
                                objJsonResult.Verify = "N";
                            }
                        }
                    }
                    else
                    if (refSav == "Update")
                    {
                        objJsonResult.HInterID = oBill.omodel.HInterID.ToString(); //返回主ID
                        objJsonResult.Verify = "N";
                    }
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
@@ -3882,8 +4566,8 @@
            {
                List<object> columnNameList = new List<object>();
                string sql = "select * from h_v_OA_ErrMsgBackCheckBillMainList where hmainid='" + HID + "'";
                ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackCheckBillMainList");
                string sql = "select * from h_v_OA_ErrMsgBackCheckBillMainEdit where hmainid='" + HID + "'";
                ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackCheckBillMainEdit");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
@@ -3965,6 +4649,61 @@
                objJsonResult.Message = "查询数据异常,请与管理员联系!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 异常反馈验收单 分页列表
        [Route("Sc_MESTransFerWorkBill/Get_OA_ErrMsgBackCheckBillListPage")]
        [HttpGet]
        public json Get_OA_ErrMsgBackCheckBillListPage(string sWhere, string user, int page, int size)
        {
            DataSet ds;
            json res = new json();
            try
            {
                List<object> columnNameList = new List<object>();
                //判断权限
                if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackCheckBillMain_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限查询!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                sWhere = sWhere.Replace("'", "''");
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("exec h_p_OA_ErrMsgBackCheckBillList " + page + "," + size + ",''", "h_p_OA_ErrMsgBackCheckBillList");
                }
                else
                {
                    ds = oCN.RunProcReturn("exec h_p_OA_ErrMsgBackCheckBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_OA_ErrMsgBackCheckBillList");
                }
                //添加列名
                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));//获取到DataColumn列对象的列名
                }
                res.code = CodeConstant.SUCCEED;
                res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                res.Message = "Sucess!";
                res.list = columnNameList;
                res.data = ds.Tables[0];
                return res;
            }
            catch (Exception e)
            {
                res.code = CodeConstant.FAIL;
                res.count = CountConstant.FAIL;
                res.Message = "Exception!" + e.ToString();
                res.data = null;
                return res;
            }
        }
        #endregion
@@ -4445,8 +5184,30 @@
                //进行需要进行的关闭/反关闭操作
                if (IsAudit == 0) //关闭提交
                {
                    //关闭前控制=========================================
                    string sql1 = "exec h_p_OA_ErrMsgBackCheckBill_BeforeCloseCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackCheckBill_BeforeCloseCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:关闭前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    //关闭提交
                    if (oBill.CloseBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    if (oBill.CloseBill(lngBillKey, oBill.omodel.HBillNo, "h_p_OA_ErrMsgBackCheckBill_AfterCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
@@ -4465,8 +5226,32 @@
                }
                if (IsAudit == 1) //反关闭提交
                {
                    //反关闭前控制=========================================
                    string sql1 = "exec h_p_OA_ErrMsgBackCheckBill_BeforeUnCloseCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackCheckBill_BeforeUnCloseCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:反关闭前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    //反关闭提交
                    if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    if (oBill.CancelClose(lngBillKey, oBill.omodel.HBillNo, "h_p_OA_ErrMsgBackCheckBill_AfterUnCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
@@ -5459,8 +6244,32 @@
                //进行需要进行的作废/反作废操作
                if (IsAudit == 0) //作废提交
                {
                    //作废提交
                    if (oBill.Cancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    //审核前控制=========================================
                    string sql1 = "exec h_p_OA_AndengFlowRuleBill_BeforeDropCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_OA_AndengFlowRuleBill_BeforeDropCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    //审核提交
                    if (oBill.Cancelltion(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_OA_AndengFlowRuleBill_AfterDropCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
@@ -5477,10 +6286,32 @@
                        return objJsonResult;
                    }
                }
                if (IsAudit == 1) //反关闭提交
                if (IsAudit == 1) //反作废提交
                {
                    //反关闭提交
                    if (oBill.AbandonCancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_OA_AndengFlowRuleBill_BeforeUnDropCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_OA_AndengFlowRuleBill_BeforeUnDropCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //===========================================================
                    //反作废提交
                    if (oBill.AbandonCancelltion(lngBillKey, oBill.omodel.HBillNo, "h_p_Sc_MouldMaintainRuleBill_AfterUnDropCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
@@ -6648,7 +7479,7 @@
            }
            if (HHandleEmpID==0) //异常反馈验收单保存  将消息 发送给 接收人,指派处理人,全部抄送人
            if (HHandleEmpID==0) //
            {
                string HReceiveMan = HSendMan;
                string[] names = HCopyMan.Split(',');
@@ -6669,13 +7500,14 @@
                }
                concatenatedNames = string.Join(",", HNames);
                HDescription = HDescription + "--已验收";
            }
            else if (HHandleEmpID==1)//异常反馈签到单,异常反馈处理单  将消息 发送给 发送人,接收人
            else if (HHandleEmpID==1)//异常反馈处理单  将消息 发送给 发送人,接收人
            {
                //获取发送人  接收人
                string HReceiveMan = HCopyMan;
                string sql1 = "select HDingDingUserID 钉钉id from Gy_Czygl where Czymc in ('" + HSendMan + "','" + HReceiveMan + "')";
                ds = oCN.RunProcReturn(sql1, "Gy_Czygl");
                ds = oCN.RunProcReturn(sql1, "Gy_Czygl");
                List<string> HNames = new List<string>();
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
@@ -6684,16 +7516,13 @@
                }
                concatenatedNames = string.Join(",", HNames);
                HDescription = HDescription + "--已签到";
            }
            else
            else if (HHandleEmpID == 2)//异常反馈处理单  将消息 发送给 发送人,接收人
            {
                //查询指派处理人
                string sql = "select HName from Gy_Employee where HItemID='" + HHandleEmpID + "'";
                ds = oCN.RunProcReturn(sql, "Gy_Employee");
                string HHandleEmpName = ds.Tables[0].Rows[0]["HName"].ToString();
                //获取指派处理人,发送人的钉钉id
                string sql1 = "select HDingDingUserID 钉钉id from Gy_Czygl where Czymc in ('" + HSendMan + "','" + HHandleEmpName + "')";
                LogService.CustomWriteLog("10参数" + sql1, "异常罚款");
                //获取发送人  接收人
                string HReceiveMan = HCopyMan;
                string sql1 = "select HDingDingUserID 钉钉id from Gy_Czygl where Czymc in ('" + HSendMan + "','" + HReceiveMan + "')";
                ds = oCN.RunProcReturn(sql1, "Gy_Czygl");
                List<string> HNames = new List<string>();
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
@@ -6703,7 +7532,26 @@
                }
                concatenatedNames = string.Join(",", HNames);
                LogService.CustomWriteLog("9参数" + concatenatedNames, "异常罚款");
                HDescription = HDescription + "--已处理";
            }
            else
            {
                //查询指派处理人
                string sql = "select HName from Gy_Employee where HItemID='" + HHandleEmpID + "'";
                ds = oCN.RunProcReturn(sql, "Gy_Employee");
                string HHandleEmpName = ds.Tables[0].Rows[0]["HName"].ToString();
                //获取指派处理人,发送人的钉钉id
                string sql1 = "select HDingDingUserID 钉钉id from Gy_Czygl where Czymc in ('" + HSendMan + "','" + HHandleEmpName + "')";
                ds = oCN.RunProcReturn(sql1, "Gy_Czygl");
                List<string> HNames = new List<string>();
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    string HName = ds.Tables[0].Rows[i]["钉钉id"].ToString();
                    HNames.Add(HName);
                }
                concatenatedNames = string.Join(",", HNames);
                HDescription = HDescription + "--已接收";
            }
          
            //获取企业的access_token的值
@@ -6728,13 +7576,21 @@
        [Route("Sc_MESTransFerWorkBill/GetSc_MESTransFerWorkBillQuery")]
        [HttpGet]
        public object GetSc_MESTransFerWorkBillQuery(string user)
        public object GetSc_MESTransFerWorkBillQuery(string sWhere, string user)
        {
            try
            {
                Dictionary<object, object> dic = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<object, object>>(sWhere);
                string HStatus = dic["HStatus"].ToString();//时间状态
                string HBeginDate = dic["HBeginDate"].ToString();//开始日期
                string HEndDate = dic["HEndDate"].ToString();//结束日期
                string HSourceID = dic["HSourceID"].ToString();//生产资源
                List<object> columnNameList = new List<object>();
                ds = oCN.RunProcReturn("exec h_p_OA_ErrMsgBackSelfQuery " + user, "h_p_OA_ErrMsgBackSelfQuery");
                ds = oCN.RunProcReturn("exec h_p_OA_ErrMsgBackSelfQuery  '" + HStatus + "','" + HBeginDate + "','" + HEndDate + "','" + HSourceID + "','" + user + "'"  , "h_p_OA_ErrMsgBackSelfQuery");
                if (ds.Tables[0].Rows.Count != 0 || ds != null)
                {
@@ -6783,7 +7639,8 @@
            {
                List<object> columnNameList = new List<object>();
                string sql = "select a.HSourceBillNo 流转卡号,a.HSourceBillType 流转卡类型,a.HSourceInterID 流转卡主内码,a.HSourceEntryID 流转卡子内码,b.HNumber 物料代码,b.HName 物料名称,b.HModel 规格型号,a.HPlanQty 计划数量 from Sc_ICMOBillStatus_Tmp a left join Gy_Material b on a.HMaterID=b.HItemID where HSourceBillNo='" + HSourceBill + "'";
                string sql = "select a.HSourceBillNo 流转卡号,a.HSourceBillType 流转卡类型,a.HSourceInterID 流转卡主内码,a.HSourceEntryID 流转卡子内码,b.HNumber 物料代码,b.HName 物料名称,b.HModel 规格型号,a.HDatePlanQty 计划数量,a.HSourceID,c.HName 生产资源 from Sc_ICMOBillStatus_Tmp a " +
                    "left join Gy_Material b on a.HMaterID=b.HItemID  left join Gy_Source c on a.HSourceID=c.HItemID where HSourceBillNo='" + HSourceBill + "' and a.HICMOStatus=1";
                ds = oCN.RunProcReturn(sql, "Sc_ICMOBillStatus_Tmp");
                //添加列名
@@ -6865,19 +7722,13 @@
                string sql = "select a.Czymc 用户名称,c.GroupName 职务 from Gy_Czygl a left join System_UserGroupInfo b on a.Czybm = b.UserId left join System_UserGroup c on b.GroupId = c.GroupID  where a.Czymc = '"+HName+"'";
                ds = oCN.RunProcReturn(sql, "Gy_ErrMsgBackType");
                string Job = ds.Tables[0].Rows[0]["职务"].ToString();
                if (Job=="注塑班组长" || Job=="后处理班组长")
                {
                    //根据职务找到他的下级,给发送人默认为班组长之下
                    string sql1 = "select * from Gy_Duty where HParentID =(select HItemID from Gy_Duty group by HItemID, HName having HName = '"+Job+"' and count(*) = 1)";
                    ds = oCN.RunProcReturn(sql1, "Gy_Duty");
                }
                else
                {
                    //根据职务找到他的上级
                    string sql2 = "select * from Gy_Duty where HItemID =(select HParentID from Gy_Duty group by HParentID, HName having HName = '" + Job + "' and count(*) = 1)";
                    ds = oCN.RunProcReturn(sql2, "Gy_Duty");
                }
                //根据职务找到他的上级,给发送人默认为当前登录人
                string sql1 = "select * from Gy_Duty where HItemID =(select HParentID from Gy_Duty group by HParentID, HName having HName = '" + Job + "' and count(*) = 1))";
                ds = oCN.RunProcReturn(sql1, "Gy_Duty");
                string Job1= ds.Tables[0].Rows[0]["HName"].ToString(); 
                //用职务找到用户
                string sql3 = "select a.Czymc 用户名称,c.GroupName 职务  from Gy_Czygl a left join System_UserGroupInfo b on a.Czybm = b.UserId left join System_UserGroup c on b.GroupId = c.GroupID  where c.GroupName = '" + Job1+"'";
                ds = oCN.RunProcReturn(sql3, "Gy_Czygl");
@@ -6907,6 +7758,45 @@
        }
        #endregion
        #region 报工台跳转异常反馈单 弹窗获取 设备编码
        [Route("Sc_MESTransFerWorkBill/set_EquipFile")]
        [HttpGet]
        public object set_EquipFile(string HSourceName)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                string sql = "select a.HEquipFileNumber 设备编码 ,a.HName 设备名称 from Gy_EquipFileBillMain a left join Gy_Source b on a.HSourceID = b.HItemID where b.HName ='" + HSourceName   + "'";
                ds = oCN.RunProcReturn(sql, "Gy_ErrMsgBackType");
                //添加列名
                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));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "查询数据异常,请与管理员联系!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 异常反馈单 跟踪查询
        [Route("Sc_MESTransFerWorkBill/GetErrMsgBackResumeList")]
        [HttpGet]