| | |
| | | //search = search.Substring(3);//截取索引2后面的字符 |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select A.right_code,A.right_name,B.prefix,B.filingdate,B.incbit from TRight A |
| | | var sql = @"select A.right_code,A.right_name,B.prefix,B.filingdate,B.incbit,A.Type from TRight A |
| | | left join T_CodeRules B on A.right_code=B.rightcode |
| | | where A.Type='PC' and A.parent_id<>'0' " + search + ""; |
| | | where A.parent_id<>'0' and A.is_delete<>'1' " + search + ""; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region[车间公告列表] |
| | | public static ToMessage SystemAnnouncementSearch(string wkspcode, string ancetitle, string ancecont, string cancel, string level, int startNum, int endNum, string prop, string order) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | | try |
| | | { |
| | | if (wkspcode != "" && wkspcode != null) |
| | | { |
| | | search += "and A.wksp_code=@wkspcode "; |
| | | dynamicParams.Add("@wkspcode", wkspcode); |
| | | } |
| | | if (ancetitle != "" && ancetitle != null) |
| | | { |
| | | search += "and A.title like '%'+@ancetitle+'%' "; |
| | | dynamicParams.Add("@ancetitle", ancetitle); |
| | | } |
| | | if (ancecont != "" && ancecont != null) |
| | | { |
| | | search += "and A.contents like '%'+@ancecont+'%' "; |
| | | dynamicParams.Add("@ancecont", ancecont); |
| | | } |
| | | if (cancel != "" && cancel != null) |
| | | { |
| | | search += "and A.if_cancel=@cancel "; |
| | | dynamicParams.Add("@cancel", cancel); |
| | | } |
| | | if (level != "" && level != null) |
| | | { |
| | | search += "and A.priority=@level "; |
| | | dynamicParams.Add("@level", level); |
| | | } |
| | | if (search == "") |
| | | { |
| | | search = "and 1=1 "; |
| | | } |
| | | //search = search.Substring(3);//截取索引2后面的字符 |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select A.id,A.wksp_code,T.org_name as wksp_name,A.title,A.contents,U.username as lm_user,A.lm_date,A.if_cancel,A.cancel_date,A.priority |
| | | from TSystemAnnouncement A |
| | | left join TOrganization T on A.wksp_code=T.org_code |
| | | left join TUser U on A.lm_user=U.usercode |
| | | where T.description='W' and A.is_delete='0' " + search + ""; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | | mes.count = total; |
| | | mes.data = data.ToList(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[车间公告新增编辑提交] |
| | | public static ToMessage SystemAnnouncementAddUpdate(string id,DataTable dt, string ancetitle, string ancecont, string cancel, string level,string username, string opertype) |
| | | { |
| | | var sql = ""; |
| | | var dynamicParams = new DynamicParameters(); |
| | | List<object> list = new List<object>(); |
| | | string cancel_date = ""; |
| | | try |
| | | { |
| | | if (cancel == "Y") |
| | | { |
| | | cancel_date = DateTime.Now.ToString(); |
| | | } |
| | | if (opertype == "Add") |
| | | { |
| | | for (int i = 0; i < dt.Rows.Count; i++) |
| | | { |
| | | //写入工单表 |
| | | sql = @"insert into TSystemAnnouncement(wksp_code,title,contents,if_cancel,cancel_date,lm_user,lm_date,priority) |
| | | values(@wksp_code,@title,@contents,@if_cancel,@cancel_date,@lm_user,@lm_date,@priority)"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | wksp_code = dt.Rows[i]["WKSP_CODE"].ToString(), |
| | | title = ancetitle, |
| | | contents = ancecont, |
| | | if_cancel = cancel, |
| | | cancel_date = cancel_date, |
| | | lm_user = username, |
| | | lm_date = DateTime.Now.ToString(), |
| | | priority = level |
| | | } |
| | | }); |
| | | } |
| | | |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.Message = "操作成功!"; |
| | | mes.data = null; |
| | | } |
| | | else |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "操作失败!"; |
| | | mes.data = null; |
| | | } |
| | | } |
| | | if (opertype == "Update") |
| | | { |
| | | sql = @"update TSystemAnnouncement set wksp_code=@wksp_code,title=@title,contents=@contents,if_cancel=@if_cancel,cancel_date=@cancel_date,lm_user=@lm_user,lm_date=@lm_date,priority=@priority where id=@id"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | id=id, |
| | | wksp_code = dt.Rows[0]["WKSP_CODE"].ToString(), |
| | | title = ancetitle, |
| | | contents = ancecont, |
| | | if_cancel = cancel, |
| | | cancel_date = cancel_date, |
| | | lm_user = username, |
| | | lm_date = DateTime.Now.ToString(), |
| | | priority = level |
| | | } |
| | | }); |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.Message = "修改操作成功!"; |
| | | mes.data = null; |
| | | } |
| | | else |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "修改操作失败!"; |
| | | mes.data = null; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[车间公告删除] |
| | | public static ToMessage SystemAnnouncementDelete(string id) |
| | | { |
| | | var sql = ""; |
| | | List<object> list = new List<object>(); |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | list.Clear(); |
| | | sql = @"delete TSystemAnnouncement where id=@id"; |
| | | list.Add(new { str = sql, parm = new { id = id } }); |
| | | |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.Message = "操作成功!"; |
| | | mes.data = null; |
| | | } |
| | | else |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "操作失败!"; |
| | | mes.data = null; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | } |
| | | } |