|  |  | 
 |  |  | using DBUtility; | 
 |  |  | using Newtonsoft.Json; | 
 |  |  | using Newtonsoft.Json.Linq; | 
 |  |  | using System; | 
 |  |  | using System.Collections.Generic; | 
 |  |  | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 List<object> columnNameList = new List<object>(); | 
 |  |  |                 //编辑权限 | 
 |  |  |                 //if (!DBUtility.ClsPub.Security_Log_second("Sc_MouldRepairChangeBillList", 1, true, user)) | 
 |  |  |                 //if (!DBUtility.ClsPub.Security_Log_second("Sc_MouldRepairChangeBillList", 1, false, user)) | 
 |  |  |                 //{ | 
 |  |  |                 //    objJsonResult.code = "0"; | 
 |  |  |                 //    objJsonResult.count = 0; | 
 |  |  | 
 |  |  |                 //} | 
 |  |  |  | 
 |  |  |                 ds = Get_GG_NoticeBillList(sWhere); | 
 |  |  |                 if (ds == null) | 
 |  |  |  | 
 |  |  |                 //添加列名 | 
 |  |  |                 foreach (DataColumn col in ds.Tables[0].Columns) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "查询数据异常,请与管理员联系!"; | 
 |  |  |                     objJsonResult.data = ds.Tables[0]; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                     Type dataType = col.DataType; | 
 |  |  |                     string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; | 
 |  |  |                     columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "1"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = "返回记录成功!"; | 
 |  |  |                     objJsonResult.data = ds.Tables[0]; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //if (ds.Tables[0].Rows.Count != 0 || ds != null) | 
 |  |  |                 //{ | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "Sucess!"; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 objJsonResult.list = columnNameList; | 
 |  |  |                 return objJsonResult; | 
 |  |  |                 //} | 
 |  |  |                 //else | 
 |  |  |                 //{ | 
 |  |  |                 //objJsonResult.code = "0"; | 
 |  |  |                 //objJsonResult.count = 0; | 
 |  |  |                 //objJsonResult.Message = "无数据"; | 
 |  |  |                 //objJsonResult.data = null; | 
 |  |  |                 //return objJsonResult; | 
 |  |  |                 //} | 
 |  |  |             } | 
 |  |  |             catch (Exception ex) | 
 |  |  |             { | 
 |  |  | 
 |  |  |  | 
 |  |  |         public static DataSet Get_GG_NoticeBillList(string sWhere) | 
 |  |  |         { | 
 |  |  |             var sql = "select A.HInterID,b.HEntryID,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.HDate,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 = "select A.HInterID 主内码,b.HEntryID 子内码,A.HBillNo 单据号,A.HContext 主题,A.HDeptID,D.HName 发送部门, A.HSendMan 发送人, B.HReceiveMan 接收人,A.HLevel 紧急程度,A.HDescription 详细内容,case when B.HReadFlag=0 then '未阅' when B.HReadFlag=1 then '已阅' end 状态, 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+ "  order by 主内码 desc"; | 
 |  |  |             return new SQLHelper.ClsCN().RunProcReturn(sql, "OA_InformBillMain"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region 公告列表编辑获取数据 | 
 |  |  |         [Route("GG_Notice/GG_NoticeBillListCheckDetai")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public ApiResult<DataSet> GG_NoticeBillListCheckDetai(string HID,string HEntryID) | 
 |  |  |         { | 
 |  |  |             if (string.IsNullOrEmpty(HID)) | 
 |  |  |                 return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" }; | 
 |  |  |             SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |  | 
 |  |  |             var dataSet = oCN.RunProcReturn("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  A.HInterID='"+ HID + "' and b.HEntryID='"+HEntryID+"'", "OA_InformBillMain"); | 
 |  |  |             if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) | 
 |  |  |                 return new ApiResult<DataSet> { code = -1, msg = "不存在单号" }; | 
 |  |  |  | 
 |  |  |             return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet }; | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region 公告列表保存/编辑 | 
 |  |  | 
 |  |  |             string msg1 = _value.ToString(); | 
 |  |  |             string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); | 
 |  |  |             string msg2 = sArray[0].ToString(); | 
 |  |  |             string msg3 = sArray[1].ToString(); | 
 |  |  |             string refSav = sArray[2].ToString(); | 
 |  |  |             string msg4 = sArray[3].ToString(); | 
 |  |  |             string refSav = sArray[1].ToString(); | 
 |  |  |             string msg3 = sArray[2].ToString(); | 
 |  |  |             string s = ""; | 
 |  |  |             ListModels oListModels = new ListModels(); | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //编辑权限 | 
 |  |  |                 //if (!DBUtility.ClsPub.Security_Log_second("Sc_MouldProdInBill_Edit", 1, true, msg4)) | 
 |  |  |                 //if (!DBUtility.ClsPub.Security_Log_second("Sc_MouldProdInBill_Edit", 1, false, msg3)) | 
 |  |  |                 //{ | 
 |  |  |                 //    objJsonResult.code = "0"; | 
 |  |  |                 //    objJsonResult.count = 0; | 
 |  |  | 
 |  |  |                         objJsonResult.data = 1; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     oItem.HMaker = msg4;  //制单人 | 
 |  |  |                     oItem.HMaker = msg3;  //制单人 | 
 |  |  |                     oItem.HBillType = "4506"; | 
 |  |  |                     oItem.HBillSubType = "4506"; | 
 |  |  |                     oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); | 
 |  |  |                     oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); | 
 |  |  |                     oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); | 
 |  |  |                     lsmain.Add(oItem); | 
 |  |  |                     string[] arrStr = oItem.HReceiveMan.Split(','); | 
 |  |  |                     oBill.omodel = oItem; | 
 |  |  |                     //表体数据 | 
 |  |  |                     for (int i = 0; i < msg3.Length; i++) | 
 |  |  |                     for (int i = 1; i <=arrStr.Length; i++) | 
 |  |  |                     { | 
 |  |  |                         i++; | 
 |  |  |                         | 
 |  |  |                         Models.ClsOA_InformBillSub sb = new Models.ClsOA_InformBillSub(); | 
 |  |  |                         sb.HEntryID = i; | 
 |  |  |                         sb.HCloseMan = ""; | 
 |  |  | 
 |  |  |                         sb.HSourceBillType = ""; | 
 |  |  |                         sb.HRelationQty = 0; | 
 |  |  |                         sb.HRelationMoney = 0; | 
 |  |  |                         sb.HReceiveMan = ""; | 
 |  |  |                         lssub.Add(sb); | 
 |  |  |                         sb.HReceiveMan = arrStr[i-1]; | 
 |  |  |                         oBill.DetailColl.Add(sb); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                  | 
 |  |  | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region 公告列表删除 | 
 |  |  |         [Route("GG_Notice/Get_GG_Notice_DeleteBill")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object Get_GG_Notice_DeleteBill(string HInterID, string user) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //删除权限 | 
 |  |  |                 //if (!DBUtility.ClsPub.Security_Log_second("", 1, false, user)) | 
 |  |  |                 //{ | 
 |  |  |                 //    objJsonResult.code = "0"; | 
 |  |  |                 //    objJsonResult.count = 0; | 
 |  |  |                 //    objJsonResult.Message = "无删除权限!"; | 
 |  |  |                 //    objJsonResult.data = null; | 
 |  |  |                 //    return objJsonResult; | 
 |  |  |                 //} | 
 |  |  |  | 
 |  |  |                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |                 oCN.RunProc("delete from OA_InformBillSub where HInterID=" + HInterID); | 
 |  |  |                 oCN.RunProc("delete from OA_InformBillMain where HInterID=" + HInterID); | 
 |  |  |                 oCN.Commit();//提交事务 | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "公告数据删除成功!"; | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; ; | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "公告数据删除失败!" + e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 根据用户名获取公告列表 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="user"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("GG_Notice/notices")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object getNotices(string user) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 List<object> columnNameList = new List<object>(); | 
 |  |  |                 var sql = "select top(10) m.HMakeDate as 日期, m.HLevel as 状况, m.HContext as 主题 " + | 
 |  |  |                            ", m.HContext as 内容" + | 
 |  |  |                            ", m.HSendMan as 发送人, s.HReceiveMan as 接收人, d.HName as 发送部门 " + | 
 |  |  |                            " from OA_InformBillMain as m" + | 
 |  |  |                            " inner join OA_InformBillSub as s on m.HInterID = s.HInterID" + | 
 |  |  |                            " left join Gy_Department d on m.HDeptID = d.HItemID" + | 
 |  |  |                            " where 1 = 1 and" + " s.HReceiveMan =" + "'" + user + "'" + | 
 |  |  |                            " order by m.HMakeDate desc"; | 
 |  |  |  | 
 |  |  |                 ds = new SQLHelper.ClsCN().RunProcReturn(sql, "OA_InformBillMain"); | 
 |  |  |  | 
 |  |  |                 //添加列名 | 
 |  |  |                 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; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | } |