|  |  | 
 |  |  | using System.Web.Http; | 
 |  |  | using WebAPI.Models; | 
 |  |  | using System.Threading; | 
 |  |  | using SyntacticSugar.constant; | 
 |  |  |  | 
 |  |  | namespace WebAPI.Controllers.SCGL | 
 |  |  | { | 
 |  |  | 
 |  |  |         } | 
 |  |  |         #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) | 
 |  |  | 
 |  |  |                 } | 
 |  |  |                 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; | 
 |  |  | 
 |  |  |                 } | 
 |  |  |                 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; | 
 |  |  | 
 |  |  |                 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; | 
 |  |  |             } | 
 |  |  | 
 |  |  |  | 
 |  |  |         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, | 
 |  |  | 
 |  |  |             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 | 
 |  |  | 
 |  |  |             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 = "不存在单号" }; | 
 |  |  | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region [模具改制申请单删除功能] | 
 |  |  |         /// <summary> | 
 |  |  |         /// 模具改制申请单删除功能 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         #region [异常反馈单删除功能] | 
 |  |  |        | 
 |  |  |         [Route("Sc_MESTransFerWorkBill/Get_DeleteTransFerBill")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object Get_DeleteTransFerBill(string HInterID,string HEntryID, string user) | 
 |  |  | 
 |  |  |                         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"; | 
 |  |  | 
 |  |  |             { | 
 |  |  |                 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) | 
 |  |  | 
 |  |  |                 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 | 
 |  |  | 
 |  |  |                 //进行需要进行的关闭/反关闭操作 | 
 |  |  |                 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; | 
 |  |  | 
 |  |  |                 } | 
 |  |  |                 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; | 
 |  |  | 
 |  |  |  | 
 |  |  |         [Route("OA_ErrMsgBackSignBill_BrushCard/ErrMsgBackReceive")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object ErrMsgBackReceive(string sWhere, string user) | 
 |  |  |         public object ErrMsgBackReceive(string sWhere,string num, string user) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  | 
 |  |  |                     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) | 
 |  |  | 
 |  |  |                 } | 
 |  |  |                 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 = "保存成功!"; | 
 |  |  | 
 |  |  |             { | 
 |  |  |                 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) | 
 |  |  | 
 |  |  |                 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 | 
 |  |  | 
 |  |  |                 //进行需要进行的关闭/反关闭操作 | 
 |  |  |                 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; | 
 |  |  | 
 |  |  |                 } | 
 |  |  |                 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; | 
 |  |  | 
 |  |  |                 { | 
 |  |  |  | 
 |  |  |                     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") | 
 |  |  |                 { | 
 |  |  | 
 |  |  |                 } | 
 |  |  |                 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 = "保存成功!"; | 
 |  |  | 
 |  |  |             { | 
 |  |  |                 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) | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #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")] | 
 |  |  | 
 |  |  |                 //进行需要进行的关闭/反关闭操作 | 
 |  |  |                 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; | 
 |  |  | 
 |  |  |                 } | 
 |  |  |                 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; | 
 |  |  | 
 |  |  |                 } | 
 |  |  |                 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 = "保存成功!"; | 
 |  |  | 
 |  |  |             { | 
 |  |  |                 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) | 
 |  |  | 
 |  |  |                 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 | 
 |  |  | 
 |  |  |                 //进行需要进行的关闭/反关闭操作 | 
 |  |  |                 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; | 
 |  |  | 
 |  |  |                 } | 
 |  |  |                 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; | 
 |  |  | 
 |  |  |                 //进行需要进行的作废/反作废操作 | 
 |  |  |                 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; | 
 |  |  | 
 |  |  |                         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; | 
 |  |  | 
 |  |  |             string appKey = ""; | 
 |  |  |             string appSecret = ""; | 
 |  |  |             string sReturn = ""; | 
 |  |  |             string agentIds = ""; | 
 |  |  |             Cls_DDMsg msg = new Cls_DDMsg(); | 
 |  |  |             if (oSystemParameter.ShowBill(ref sReturn) == true) | 
 |  |  |             { | 
 |  |  |                 //系统参数是否为私有云模式,N为本地,Y为斯莫尔 | 
 |  |  |                 //系统参数是否 N为本地,Y为斯莫尔 | 
 |  |  |                 if (oSystemParameter.omodel.OA_ErrMsgBackBill_SendDingDingMsg == "N") | 
 |  |  |                 { | 
 |  |  |                      appKey = "dingrsrzhdyn3mlaof95"; | 
 |  |  |                     appKey = "dingrsrzhdyn3mlaof95"; | 
 |  |  |                      appSecret = "RAqH6YtZnPLCpDbuqfaYQkKkVtVdS0wqfC8I26X6qiS-8eoCJCNrzx3fubGND4Sq"; | 
 |  |  |                     agentIds = "3118119317"; | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 else if (oSystemParameter.omodel.OA_ErrMsgBackBill_SendDingDingMsg == "Y") | 
 |  |  |                 { | 
 |  |  |                      appKey = "dingkdddbhdcssk7jduw"; | 
 |  |  |                      appSecret = "iv07c-GLfJPnzfJaNAAOfJDl3Z-eODvDAhlInMZCZhGorkle5Evbaxx3ImylvdjQ"; | 
 |  |  |                     appKey = "dingkdddbhdcssk7jduw"; | 
 |  |  |                     appSecret = "iv07c-GLfJPnzfJaNAAOfJDl3Z-eODvDAhlInMZCZhGorkle5Evbaxx3ImylvdjQ"; | 
 |  |  |                     agentIds = "3151454458"; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             if (HHandleEmpID==0) //异常反馈验收单保存  将消息 发送给 接收人,指派处理人,全部抄送人  | 
 |  |  |             if (HHandleEmpID==0) //  | 
 |  |  |             { | 
 |  |  |                 string HReceiveMan = HSendMan; | 
 |  |  |                 string[] names = HCopyMan.Split(','); | 
 |  |  | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  |                 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");                    | 
 |  |  |                 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 + "--已签到"; | 
 |  |  |             } | 
 |  |  |             else if (HHandleEmpID == 2)//异常反馈处理单  将消息 发送给 发送人,接收人 | 
 |  |  |             { | 
 |  |  |                 //获取发送人  接收人 | 
 |  |  |                 string HReceiveMan = HCopyMan; | 
 |  |  | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  |                 concatenatedNames = string.Join(",", HNames); | 
 |  |  |                 HDescription = HDescription + "--已处理"; | 
 |  |  |             } | 
 |  |  |             else if (HHandleEmpID == 4)//报工台 异常验收  驳回按钮  将消息 发送给 发送人,接收人 | 
 |  |  |             { | 
 |  |  |                 //获取发送人  接收人 | 
 |  |  |                 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++) | 
 |  |  |                 { | 
 |  |  |                     string HName = ds.Tables[0].Rows[i]["钉钉id"].ToString(); | 
 |  |  |                     HNames.Add(HName); | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  |                 concatenatedNames = string.Join(",", HNames); | 
 |  |  |                 HDescription = HDescription + "--'"+ HSendMan + "'已驳回本次处理,请'"+ HReceiveMan + "'重新处理"; | 
 |  |  |             } | 
 |  |  |             else | 
 |  |  |             { | 
 |  |  | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  |                 concatenatedNames = string.Join(",", HNames); | 
 |  |  |                 HDescription = HDescription + "--已接收"; | 
 |  |  |             } | 
 |  |  |            | 
 |  |  |             //获取企业的access_token的值 | 
 |  |  | 
 |  |  |             string accessToken = responseJson["accessToken"].ToString(); | 
 |  |  |  | 
 |  |  |             //调用方法发送消息            | 
 |  |  |             string agentId = "3118119317";//钉钉后台建立的小程序id | 
 |  |  |             string agentId = agentIds;//钉钉后台建立的小程序id | 
 |  |  |             string userIdList = concatenatedNames;//钉钉人员的id | 
 |  |  |             string deptIdList = "0"; // 空字符串表示不指定部门 | 
 |  |  |             string toAllUser = "false"; | 
 |  |  | 
 |  |  |  | 
 |  |  |         [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) | 
 |  |  |                 { | 
 |  |  | 
 |  |  |             { | 
 |  |  |                 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"); | 
 |  |  |  | 
 |  |  |                 if (ds.Tables[0].Rows.Count == 0) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "无对应正确状态工单信息"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 //添加列名 | 
 |  |  |                 foreach (DataColumn col in ds.Tables[0].Columns) | 
 |  |  |                 { | 
 |  |  | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 string sReturn = ""; | 
 |  |  |                 //string sReturn = ""; | 
 |  |  |                 List<object> columnNameList = new List<object>(); | 
 |  |  |                 //根据当前人获取职务 | 
 |  |  |                 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 (oSystemParameter.ShowBill(ref sReturn) == true) | 
 |  |  |                 { | 
 |  |  |                     //系统参数是否为私有云模式,N为本地,Y为斯莫尔 | 
 |  |  |                     if (oSystemParameter.omodel.OA_ErrMsgBackBill_SendDingDingMsg == "N") | 
 |  |  |                     { | 
 |  |  |                          Job = ds.Tables[0].Rows[0]["职务"].ToString(); | 
 |  |  |                     } | 
 |  |  |                     else | 
 |  |  |                     { | 
 |  |  |                         Job = "注塑班组长"; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                  | 
 |  |  |                 //根据职务找到他的上级 | 
 |  |  |                 string sql1 = "select *  from Gy_Duty where HParentID=(select HParentID 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 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 sql2 = "select a.Czymc 用户名称  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(sql2, "Gy_Czygl"); | 
 |  |  |  | 
 |  |  |                 //用职务找到用户 | 
 |  |  |                 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"); | 
 |  |  |                 //添加列名 | 
 |  |  |                 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/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) | 
 |  |  |                 { | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region 报工台 异常验收 驳回处理单功能 | 
 |  |  |         [Route("Sc_MESTransFerWorkBill/BHOA_ErrMsgBackHandleBillDismiss")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object BHOA_ErrMsgBackHandleBillDismiss(string HInterID, string user) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 string sql = "select HErrMsgBackInterID,HErrMsgBackEntryID,HSendMan,HDescription,HReceiveMan from OA_ErrMsgBackHandleBillMain where HInterID=" + HInterID; | 
 |  |  |                 //更新异常反馈处理单作废 | 
 |  |  |                 oCN.RunProc("update OA_ErrMsgBackHandleBillMain set HBillStatus=4, HDeleteDate=GETDATE(),HDeleteMan='" + user + "'  where HInterID="+ HInterID); | 
 |  |  |                 DataSet dt = oCN.RunProcReturn(sql, "OA_ErrMsgBackHandleBillMain"); | 
 |  |  |  | 
 |  |  |                 //反馈处理单保存后,更新异常反馈单的状态 | 
 |  |  |                 string sql1 = "update OA_ErrMsgBackBillMain set HBillStatus='9' where HInterID='" + dt.Tables[0].Rows[0]["HErrMsgBackInterID"].ToString() + "' "; | 
 |  |  |                 oCN.RunProc(sql1); | 
 |  |  |                 _ = SendDingDingAsync(dt.Tables[0].Rows[0]["HSendMan"].ToString(), 4, dt.Tables[0].Rows[0]["HDescription"].ToString(), dt.Tables[0].Rows[0]["HReceiveMan"].ToString()); | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "Sucess!";             | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "Exception!" + e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |     } | 
 |  |  | } |