150 lines
5.9 KiB
C#
150 lines
5.9 KiB
C#
using CRM.Core.DTO;
|
|
using CRM.Core.DTO.Hg;
|
|
using Newtonsoft.Json;
|
|
using Ninject;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
using WX.CRM.BLL.Util;
|
|
using WX.CRM.Common;
|
|
using WX.CRM.Common.Layui;
|
|
using WX.CRM.Common.StockHelper;
|
|
using WX.CRM.Model.Enum;
|
|
using WX.CRM.WebHelper;
|
|
using WX.CRM.WebHelper.DoItems;
|
|
|
|
namespace WX.CRM.WEB.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 合规控制器
|
|
/// </summary>
|
|
public class HgController : BaseController
|
|
{
|
|
[Inject]
|
|
public CACHE_BL cache_BL { get; set; }
|
|
|
|
/// <summary>
|
|
/// 我的违规处罚单
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[AuthorizeRedirect(Roles = InitRights.CONST_违规通知单)]
|
|
|
|
public ActionResult MyCheckNoticeIndex()
|
|
{
|
|
return View();
|
|
}
|
|
[AuthorizeRedirect(Roles = InitRights.CONST_违规通知单)]
|
|
public JsonResult CheckNoticeManageList(Laypage pager, HgCheckQualitySearchDto dto)
|
|
{
|
|
|
|
string roleCode = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId);
|
|
if (!roleCode.Contains("[ZXFZR]"))//中心责任人看全部,如果不是,那么就只能看到自己或者主管责任人的
|
|
{
|
|
dto.eid = Convert.ToInt32(Eid);
|
|
}
|
|
dto.PageSize = pager.limit;
|
|
dto.PageIndex = pager.page;
|
|
var webapi = cache_BL.GetValue_Parameter(Parameter.Hg_Core_WebApi);
|
|
var url = $"{webapi}/order/GetCheckQualityNotice";
|
|
var result = Utility.PostAjaxData(url, dto.ToJson(), Encoding.UTF8);
|
|
var data = JsonConvert.DeserializeObject<ApiResult<Common.StockHelper.PageResult<Hg_CheckQuality_Notice>>>(result);
|
|
var model = new LayuiData<Hg_CheckQuality_Notice>()
|
|
{
|
|
msg = "数据加载成功!",
|
|
count = data.Data.Total,
|
|
code = 0,
|
|
data = (List<Hg_CheckQuality_Notice>)data.Data.Data
|
|
};
|
|
|
|
PopupMessageFactory.hgPunishNoticeMessage.SetView(UserId);
|
|
|
|
return Json(model, JsonRequestBehavior.AllowGet);
|
|
}
|
|
/// <summary>
|
|
/// 通知单查看
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[AuthorizeRedirect(Roles = InitRights.CONST_违规通知单)]
|
|
[HttpGet]
|
|
public ActionResult ShowTZD(int id)
|
|
{
|
|
var webapi = cache_BL.GetValue_Parameter(Parameter.Hg_Core_WebApi);
|
|
var url = $"{webapi}/order/GetCheckQualityInfo";
|
|
var result = Utility.GetData(url, "id=" + id, Encoding.UTF8);
|
|
//var data = JsonConvert.DeserializeObject<PageResult<List<Hg_CheckQuality_Notice>>>(result);
|
|
var data = JsonConvert.DeserializeObject<ApiResult<Hg_CheckQuality_Notice>>(result);
|
|
return View(data.Data);
|
|
}
|
|
/// <summary>
|
|
/// 处罚单查看
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[AuthorizeRedirect(Roles = InitRights.CONST_违规通知单)]
|
|
[HttpGet]
|
|
public ActionResult ShowCFD(int id)
|
|
{
|
|
var webapi = cache_BL.GetValue_Parameter(Parameter.Hg_Core_WebApi);
|
|
var url = $"{webapi}/order/GetCheckQualityInfo";
|
|
var result = Utility.GetData(url, "id=" + id, Encoding.UTF8);
|
|
//var data = JsonConvert.DeserializeObject<PageResult<List<Hg_CheckQuality_Notice>>>(result);
|
|
var data = JsonConvert.DeserializeObject<ApiResult<Hg_CheckQuality_Notice>>(result);
|
|
return View(data.Data);
|
|
}
|
|
[AuthorizeRedirect(Roles = InitRights.CONST_违规通知单)]
|
|
[HttpGet]
|
|
public ActionResult LookNoticeShow(int id)
|
|
{
|
|
string roleCode = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId);
|
|
ViewBag.isCenterManger = roleCode.Contains("[ZXFZR]");//是不是中心负责人
|
|
|
|
var webapi = cache_BL.GetValue_Parameter(Parameter.Hg_Core_WebApi);
|
|
var url = $"{webapi}/order/GetCheckQualityInfo";
|
|
var result = Utility.GetData(url, "id=" + id, Encoding.UTF8);
|
|
var data = JsonConvert.DeserializeObject<ApiResult<Hg_CheckQuality_Notice>>(result);
|
|
if (data.Code == 0)
|
|
{
|
|
ViewBag.isSale = data.Data.ToEid == Eid.ToString();//是不是责任人
|
|
ViewBag.isManage = data.Data.Hg_CheckQuality_NoticeSigns.Where(m => m.NoticeLevel == "manage" && m.eid == Eid).Count() > 0;//是不是责任人主管
|
|
}
|
|
return View(data.Data);
|
|
}
|
|
[AuthorizeRedirect(Roles = InitRights.CONST_违规通知单)]
|
|
[HttpPost]
|
|
public JsonResult AddNoticeOption(int id, string opinion, string NoticeLevel)
|
|
{
|
|
var ret = new retMsg { result = true, retcode = 200 };
|
|
try
|
|
{
|
|
var webapi = cache_BL.GetValue_Parameter(Parameter.Hg_Core_WebApi);
|
|
var url = $"{webapi}/Order/AddQualityNoticeOption";
|
|
QualityNoticeOption dto = new QualityNoticeOption()
|
|
{
|
|
eid = Convert.ToInt32(Eid),
|
|
id = id,
|
|
NoticeLevel = NoticeLevel,
|
|
opinion = opinion
|
|
};
|
|
var result = Utility.PostAjaxData(url, JsonConvert.SerializeObject(dto), Encoding.UTF8);
|
|
var data = JsonConvert.DeserializeObject<HGApiResult<bool>>(result);
|
|
if (data.code == 0)
|
|
{
|
|
}
|
|
else
|
|
{
|
|
throw new Exception(data.message);
|
|
}
|
|
return Json(ret, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ret = new retMsg { result = false, retcode = 200, retmsg = ex.Message };
|
|
return Json(ret, JsonRequestBehavior.AllowGet);
|
|
}
|
|
}
|
|
}
|
|
}
|