using DTO;
|
using IServices;
|
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.Extensions.Logging;
|
using Newtonsoft.Json;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Threading.Tasks;
|
using System.Transactions;
|
using zhengcaioa.IService;
|
using zhengcaioa.Models;
|
|
namespace zhengcaioa.Controllers.admin
|
{
|
[CheckLogin]
|
public class AdmAskController : Controller
|
{
|
private readonly IHrDeptService _hrDeptService;
|
private readonly ILogger<AdmAskController> _logger;
|
private readonly IAskService _askService;
|
private readonly IWfRunProcessService _wfRunProcessService;
|
private readonly IWfHistoryService _wfHistoryService;
|
private readonly IWfNeeddeelService _wfNeeddeelService;
|
private readonly IAdmGoodsManageService _admGoodsManageService;
|
private readonly ILiaotianService _liaotianService;
|
private readonly IUserService _userService;
|
private readonly IAdmBreakPrecedentService _aAdmBreakPrecedentService;
|
private readonly ICooperatecustomCustomerService _cooperatecustomCustomerService;
|
private readonly IIntentionCustomerService _intentionCustomerService;
|
|
public AdmAskController(ILogger<AdmAskController> logger, IAskService askService, IHrDeptService hrDeptService, IWfRunProcessService wfRunProcessService
|
, IWfHistoryService wfHistoryService, IWfNeeddeelService wfNeeddeelService
|
, IAdmGoodsManageService admGoodsManageService
|
, ILiaotianService liaotianService
|
, IUserService userService
|
, IAdmBreakPrecedentService aAdmBreakPrecedentService
|
, ICooperatecustomCustomerService cooperatecustomCustomerService
|
, IIntentionCustomerService intentionCustomerService)
|
{
|
_logger = logger;
|
_hrDeptService = hrDeptService;
|
_askService = askService;
|
_wfRunProcessService = wfRunProcessService;
|
_wfHistoryService = wfHistoryService;
|
_wfNeeddeelService = wfNeeddeelService;
|
_admGoodsManageService = admGoodsManageService;
|
_liaotianService = liaotianService;
|
_userService = userService;
|
_aAdmBreakPrecedentService = aAdmBreakPrecedentService;
|
_cooperatecustomCustomerService = cooperatecustomCustomerService;
|
_intentionCustomerService = intentionCustomerService;
|
}
|
|
public IActionResult Askcost(string id = "")
|
{
|
AdmAskcostDTO dto = new AdmAskcostDTO();
|
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
|
|
|
//流程相关
|
string shifoubiaoji = "A";
|
string sifoudangqian = "A";
|
string dangqianbuzhou = "提交";
|
var lishiyijian = new List<WfHistoryDTO>();
|
|
if (string.IsNullOrEmpty(id))
|
{
|
dto.CreaterName = curentuser.UserName;
|
dto.Tittle = "费用申请(" + curentuser.UserName + ")";
|
}
|
else if (dto != null)
|
{
|
dto = _askService.GetAskcost(id);
|
dto.CostName = dto.Cost.Value.ToString("F2");
|
|
var wfRunProcessDTO = _wfRunProcessService.GetList(dto.Id, "04").FirstOrDefault();
|
if (wfRunProcessDTO == null)
|
{
|
shifoubiaoji = "D";
|
sifoudangqian = "D";
|
}
|
else
|
{
|
dangqianbuzhou = wfRunProcessDTO.Step;
|
//查询审批进度
|
lishiyijian = _wfHistoryService.GetListshenpi(wfRunProcessDTO.Id);
|
if (wfRunProcessDTO.Step != "提交")
|
{
|
shifoubiaoji = "D";
|
}
|
|
//查询待办
|
var chaxundaiban = _wfNeeddeelService.GetListTracking(wfRunProcessDTO.Id, wfRunProcessDTO.Step).Where(x => x.DeelUserId == curentuser.Id).ToList();
|
if (chaxundaiban != null && chaxundaiban.Count > 0)
|
{
|
sifoudangqian = "A";
|
}
|
else
|
{
|
sifoudangqian = "D";
|
}
|
|
}
|
|
|
|
|
}
|
|
ViewBag.shifoubiaoji = shifoubiaoji;
|
ViewBag.sifoudangqian = sifoudangqian;
|
ViewBag.lishiyijian = lishiyijian;
|
ViewBag.dangqianbuzhou = dangqianbuzhou;
|
|
ViewData.Model = dto;
|
return View();
|
}
|
|
|
/// <summary>
|
/// 保存费用申请
|
/// </summary>
|
/// <param name="data"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult SaveAskcost(AdmAskcostDTO data)
|
{
|
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
|
ResultEntity resultEntity = new ResultEntity();
|
using (TransactionScope scope = new TransactionScope())
|
{
|
if (data.Step == "提交")
|
{
|
|
data.ShenpiStatus = "D";
|
data.RecStatus = "A";
|
data.Creater = curentuser.Id;
|
data.Createtime = DateTime.Now;
|
data.Modifier = data.Creater;
|
data.Modifytime = data.Createtime;
|
|
resultEntity = _askService.SaveAskcost(data);
|
if (!resultEntity.Result)
|
{
|
return new JsonResult(resultEntity);
|
}
|
}
|
|
|
//发起流程相关
|
|
resultEntity = _wfRunProcessService.WfAskcost(data.Id, data.Step, data.Tongguojujue, curentuser.Id, data.Content, data.Tittle, "v1");
|
if (!resultEntity.Result)
|
{
|
return new JsonResult(resultEntity);
|
}
|
scope.Complete();
|
}
|
return new JsonResult(resultEntity);
|
}
|
|
|
public IActionResult AskGood(string id = "")
|
{
|
AdmAskGoodDTO dto = new AdmAskGoodDTO();
|
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
|
|
|
//流程相关
|
string shifoubiaoji = "A";
|
string sifoudangqian = "A";
|
string dangqianbuzhou = "提交";
|
var lishiyijian = new List<WfHistoryDTO>();
|
|
if (string.IsNullOrEmpty(id))
|
{
|
dto.CreaterName = curentuser.UserName;
|
dto.Tittle = "物品申领(" + curentuser.UserName + ")";
|
}
|
else if (dto != null)
|
{
|
dto = _askService.GetAskGood(id);
|
dto.ShuliangName = dto.Shuliang.Value.ToString("F2");
|
|
var wfRunProcessDTO = _wfRunProcessService.GetList(dto.Id, "05").FirstOrDefault();
|
if (wfRunProcessDTO == null)
|
{
|
shifoubiaoji = "D";
|
sifoudangqian = "D";
|
}
|
else
|
{
|
dangqianbuzhou = wfRunProcessDTO.Step;
|
//查询审批进度
|
lishiyijian = _wfHistoryService.GetListshenpi(wfRunProcessDTO.Id);
|
if (wfRunProcessDTO.Step != "提交")
|
{
|
shifoubiaoji = "D";
|
}
|
|
//查询待办
|
var chaxundaiban = _wfNeeddeelService.GetListTracking(wfRunProcessDTO.Id, wfRunProcessDTO.Step).Where(x => x.DeelUserId == curentuser.Id).ToList();
|
if (chaxundaiban != null && chaxundaiban.Count > 0)
|
{
|
sifoudangqian = "A";
|
}
|
else
|
{
|
sifoudangqian = "D";
|
}
|
|
}
|
|
|
|
|
}
|
|
ViewBag.shifoubiaoji = shifoubiaoji;
|
ViewBag.sifoudangqian = sifoudangqian;
|
ViewBag.lishiyijian = lishiyijian;
|
ViewBag.dangqianbuzhou = dangqianbuzhou;
|
|
ViewBag.Goods = _admGoodsManageService.GetList().Where(x=>x.GoodsStatus == "A").ToList();
|
|
ViewData.Model = dto;
|
return View();
|
}
|
|
|
/// <summary>
|
/// 保存物品申领
|
/// </summary>
|
/// <param name="data"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult SaveAskGood(AdmAskGoodDTO data)
|
{
|
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
|
ResultEntity resultEntity = new ResultEntity();
|
using (TransactionScope scope = new TransactionScope())
|
{
|
if (data.Step == "提交")
|
{
|
|
data.ShenpiStatus = "D";
|
data.RecStatus = "A";
|
data.Creater = curentuser.Id;
|
data.Createtime = DateTime.Now;
|
data.Modifier = data.Creater;
|
data.Modifytime = data.Createtime;
|
|
resultEntity = _askService.SaveAskGood(data);
|
if (!resultEntity.Result)
|
{
|
return new JsonResult(resultEntity);
|
}
|
}
|
else if (data.Step == "行政审批" && data.Tongguojujue == "A")
|
{
|
//判断物品数量书否够,够就削减物品数量
|
var admAskGoodDTO = _askService.GetAskGood(data.Id);
|
var admGoodsManageDTO = _admGoodsManageService.Get(admAskGoodDTO.GoodsId);
|
if(admGoodsManageDTO.GoodsLeft.HasValue && admGoodsManageDTO.GoodsLeft.Value>= admAskGoodDTO.Shuliang.Value)
|
{
|
admGoodsManageDTO.GoodsLeft = admGoodsManageDTO.GoodsLeft.Value - admAskGoodDTO.Shuliang.Value;
|
_admGoodsManageService.save(admGoodsManageDTO);
|
}
|
else
|
{
|
resultEntity.Result = false;
|
resultEntity.Message = "物品剩余数量不足";
|
return new JsonResult(resultEntity);
|
}
|
}
|
|
|
//发起流程相关
|
|
resultEntity = _wfRunProcessService.WfAskGood(data.Id, data.Step, data.Tongguojujue, curentuser.Id, data.Content, data.Tittle, "v1");
|
if (!resultEntity.Result)
|
{
|
return new JsonResult(resultEntity);
|
}
|
scope.Complete();
|
}
|
return new JsonResult(resultEntity);
|
}
|
|
|
|
public IActionResult Askovertime(string id = "")
|
{
|
AdmAskovertimeDTO dto = new AdmAskovertimeDTO();
|
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
|
|
|
//流程相关
|
string shifoubiaoji = "A";
|
string sifoudangqian = "A";
|
string dangqianbuzhou = "提交";
|
var lishiyijian = new List<WfHistoryDTO>();
|
|
if (string.IsNullOrEmpty(id))
|
{
|
dto.CreaterName = curentuser.UserName;
|
dto.Tittle = "加班申请(" + curentuser.UserName + ")";
|
}
|
else if (dto != null)
|
{
|
dto = _askService.GetAskovertime(id);
|
dto.OvertimeName = dto.Overtime.Value.ToString("0.##");
|
dto.JiabantimeName = dto.Jiabantime.Value.ToString("yyyy-MM-dd");
|
|
var wfRunProcessDTO = _wfRunProcessService.GetList(dto.Id, "10").FirstOrDefault();
|
if (wfRunProcessDTO == null)
|
{
|
shifoubiaoji = "D";
|
sifoudangqian = "D";
|
}
|
else
|
{
|
dangqianbuzhou = wfRunProcessDTO.Step;
|
//查询审批进度
|
lishiyijian = _wfHistoryService.GetListshenpi(wfRunProcessDTO.Id);
|
if (wfRunProcessDTO.Step != "提交")
|
{
|
shifoubiaoji = "D";
|
}
|
|
//查询待办
|
var chaxundaiban = _wfNeeddeelService.GetListTracking(wfRunProcessDTO.Id, wfRunProcessDTO.Step).Where(x => x.DeelUserId == curentuser.Id).ToList();
|
if (chaxundaiban != null && chaxundaiban.Count > 0)
|
{
|
sifoudangqian = "A";
|
}
|
else
|
{
|
sifoudangqian = "D";
|
}
|
|
}
|
|
|
|
|
}
|
|
ViewBag.shifoubiaoji = shifoubiaoji;
|
ViewBag.sifoudangqian = sifoudangqian;
|
ViewBag.lishiyijian = lishiyijian;
|
ViewBag.dangqianbuzhou = dangqianbuzhou;
|
|
ViewData.Model = dto;
|
return View();
|
}
|
|
|
/// <summary>
|
/// 保存费用申请
|
/// </summary>
|
/// <param name="data"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult Askovertime(AdmAskovertimeDTO data)
|
{
|
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
|
ResultEntity resultEntity = new ResultEntity();
|
using (TransactionScope scope = new TransactionScope())
|
{
|
if (data.Step == "提交")
|
{
|
|
data.ShenpiStatus = "D";
|
data.RecStatus = "A";
|
data.Creater = curentuser.Id;
|
data.Createtime = DateTime.Now;
|
data.Modifier = data.Creater;
|
data.Modifytime = data.Createtime;
|
|
resultEntity = _askService.SaveAskovertime(data);
|
if (!resultEntity.Result)
|
{
|
return new JsonResult(resultEntity);
|
}
|
}
|
|
|
//发起流程相关
|
|
resultEntity = _wfRunProcessService.WfAskovertime(data.Id, data.Step, data.Tongguojujue, curentuser.Id, data.Content, data.Tittle, "v1");
|
if (!resultEntity.Result)
|
{
|
return new JsonResult(resultEntity);
|
}
|
scope.Complete();
|
}
|
return new JsonResult(resultEntity);
|
}
|
|
public IActionResult AskCar(string id = "")
|
{
|
AdmAskCarDTO dto = new AdmAskCarDTO();
|
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
|
|
|
//流程相关
|
string shifoubiaoji = "A";
|
string sifoudangqian = "A";
|
string dangqianbuzhou = "提交";
|
var lishiyijian = new List<WfHistoryDTO>();
|
|
if (string.IsNullOrEmpty(id))
|
{
|
dto.CreaterName = curentuser.UserName;
|
dto.Tittle = "用车申请(" + curentuser.UserName + ")";
|
}
|
else if (dto != null)
|
{
|
dto = _askService.GetAskCar(id);
|
dto.FeiyongName = dto.Feiyong.Value.ToString("F2");
|
|
var wfRunProcessDTO = _wfRunProcessService.GetList(dto.Id, "06").FirstOrDefault();
|
if (wfRunProcessDTO == null)
|
{
|
shifoubiaoji = "D";
|
sifoudangqian = "D";
|
}
|
else
|
{
|
dangqianbuzhou = wfRunProcessDTO.Step;
|
//查询审批进度
|
lishiyijian = _wfHistoryService.GetListshenpi(wfRunProcessDTO.Id);
|
if (wfRunProcessDTO.Step != "提交")
|
{
|
shifoubiaoji = "D";
|
}
|
|
//查询待办
|
var chaxundaiban = _wfNeeddeelService.GetListTracking(wfRunProcessDTO.Id, wfRunProcessDTO.Step).Where(x => x.DeelUserId == curentuser.Id).ToList();
|
if (chaxundaiban != null && chaxundaiban.Count > 0)
|
{
|
sifoudangqian = "A";
|
}
|
else
|
{
|
sifoudangqian = "D";
|
}
|
|
}
|
|
|
|
|
}
|
|
ViewBag.shifoubiaoji = shifoubiaoji;
|
ViewBag.sifoudangqian = sifoudangqian;
|
ViewBag.lishiyijian = lishiyijian;
|
ViewBag.dangqianbuzhou = dangqianbuzhou;
|
|
ViewBag.CarLaiyuan = _liaotianService.GetSYScode("ADM_AskCar", "CarLaiyuan"); ;
|
|
ViewData.Model = dto;
|
return View();
|
}
|
|
|
/// <summary>
|
/// 保存用车申请
|
/// </summary>
|
/// <param name="data"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult SaveAskCar(AdmAskCarDTO data)
|
{
|
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
|
ResultEntity resultEntity = new ResultEntity();
|
using (TransactionScope scope = new TransactionScope())
|
{
|
if (data.Step == "提交")
|
{
|
|
data.ShenpiStatus = "D";
|
data.RecStatus = "A";
|
data.Creater = curentuser.Id;
|
data.Createtime = DateTime.Now;
|
data.Modifier = data.Creater;
|
data.Modifytime = data.Createtime;
|
|
resultEntity = _askService.SaveAskCar(data);
|
if (!resultEntity.Result)
|
{
|
return new JsonResult(resultEntity);
|
}
|
}
|
|
|
|
//发起流程相关
|
|
resultEntity = _wfRunProcessService.WfAskCar(data.Id, data.Step, data.Tongguojujue, curentuser.Id, data.Content, data.Tittle, "v1");
|
if (!resultEntity.Result)
|
{
|
return new JsonResult(resultEntity);
|
}
|
scope.Complete();
|
}
|
return new JsonResult(resultEntity);
|
}
|
|
public IActionResult AskMarketingCost(string id = "")
|
{
|
AdmAskMarketingCostDTO dto = new AdmAskMarketingCostDTO();
|
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
|
|
|
//流程相关
|
string shifoubiaoji = "A";
|
string sifoudangqian = "A";
|
string dangqianbuzhou = "提交";
|
var lishiyijian = new List<WfHistoryDTO>();
|
|
if (string.IsNullOrEmpty(id))
|
{
|
dto.CreaterName = curentuser.UserName;
|
dto.Tittle = "销售费用申请(" + curentuser.UserName + ")";
|
}
|
else if (dto != null)
|
{
|
dto = _askService.GetAskMarketingCost(id);
|
dto.FeiyongName = dto.Feiyong.Value.ToString("F2");
|
|
var wfRunProcessDTO = _wfRunProcessService.GetList(dto.Id, "07").FirstOrDefault();
|
if (wfRunProcessDTO == null)
|
{
|
shifoubiaoji = "D";
|
sifoudangqian = "D";
|
}
|
else
|
{
|
dangqianbuzhou = wfRunProcessDTO.Step;
|
//查询审批进度
|
lishiyijian = _wfHistoryService.GetListshenpi(wfRunProcessDTO.Id);
|
if (wfRunProcessDTO.Step != "提交")
|
{
|
shifoubiaoji = "D";
|
}
|
|
//查询待办
|
var chaxundaiban = _wfNeeddeelService.GetListTracking(wfRunProcessDTO.Id, wfRunProcessDTO.Step).Where(x => x.DeelUserId == curentuser.Id).ToList();
|
if (chaxundaiban != null && chaxundaiban.Count > 0)
|
{
|
sifoudangqian = "A";
|
}
|
else
|
{
|
sifoudangqian = "D";
|
}
|
|
}
|
|
|
|
|
}
|
|
ViewBag.shifoubiaoji = shifoubiaoji;
|
ViewBag.sifoudangqian = sifoudangqian;
|
ViewBag.lishiyijian = lishiyijian;
|
ViewBag.dangqianbuzhou = dangqianbuzhou;
|
|
|
|
ViewData.Model = dto;
|
return View();
|
}
|
|
|
/// <summary>
|
/// 保存销售费用申请
|
/// </summary>
|
/// <param name="data"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult SaveAskMarketingCost(AdmAskMarketingCostDTO data)
|
{
|
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
|
ResultEntity resultEntity = new ResultEntity();
|
using (TransactionScope scope = new TransactionScope())
|
{
|
if (data.Step == "提交")
|
{
|
|
data.ShenpiStatus = "D";
|
data.RecStatus = "A";
|
data.Creater = curentuser.Id;
|
data.Createtime = DateTime.Now;
|
data.Modifier = data.Creater;
|
data.Modifytime = data.Createtime;
|
|
resultEntity = _askService.SaveAskMarketingCost(data);
|
if (!resultEntity.Result)
|
{
|
return new JsonResult(resultEntity);
|
}
|
}
|
|
|
|
//发起流程相关
|
|
resultEntity = _wfRunProcessService.WfAskMarketingCost(data.Id, data.Step, data.Tongguojujue, curentuser.Id, data.Content, data.Tittle, "v1");
|
if (!resultEntity.Result)
|
{
|
return new JsonResult(resultEntity);
|
}
|
scope.Complete();
|
}
|
return new JsonResult(resultEntity);
|
}
|
|
public IActionResult AskSuggestion(string id = "")
|
{
|
AdmAskMarketingCostDTO dto = new AdmAskMarketingCostDTO();
|
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
|
|
|
//流程相关
|
string shifoubiaoji = "A";
|
string sifoudangqian = "A";
|
string dangqianbuzhou = "提交";
|
var lishiyijian = new List<WfHistoryDTO>();
|
|
if (string.IsNullOrEmpty(id))
|
{
|
dto.CreaterName = curentuser.UserName;
|
dto.Tittle = "工作建议(" + curentuser.UserName + ")";
|
}
|
else if (dto != null)
|
{
|
dto = _askService.GetAskMarketingCost(id);
|
//dto.FeiyongName = dto.Feiyong.Value.ToString("F2");
|
|
var wfRunProcessDTO = _wfRunProcessService.GetList(dto.Id, "08").FirstOrDefault();
|
if (wfRunProcessDTO == null)
|
{
|
shifoubiaoji = "D";
|
sifoudangqian = "D";
|
}
|
else
|
{
|
dangqianbuzhou = wfRunProcessDTO.Step;
|
//查询审批进度
|
lishiyijian = _wfHistoryService.GetListshenpi(wfRunProcessDTO.Id);
|
if (wfRunProcessDTO.Step != "提交")
|
{
|
shifoubiaoji = "D";
|
}
|
|
//查询待办
|
var chaxundaiban = _wfNeeddeelService.GetListTracking(wfRunProcessDTO.Id, wfRunProcessDTO.Step).Where(x => x.DeelUserId == curentuser.Id).ToList();
|
if (chaxundaiban != null && chaxundaiban.Count > 0)
|
{
|
sifoudangqian = "A";
|
}
|
else
|
{
|
sifoudangqian = "D";
|
}
|
|
}
|
|
|
|
|
}
|
|
ViewBag.shifoubiaoji = shifoubiaoji;
|
ViewBag.sifoudangqian = sifoudangqian;
|
ViewBag.lishiyijian = lishiyijian;
|
ViewBag.dangqianbuzhou = dangqianbuzhou;
|
if (string.IsNullOrEmpty(id))
|
{
|
ViewBag.Users = _userService.GetList().Where(x => x.Id != curentuser.Id).ToList();
|
}
|
else
|
{
|
ViewBag.Users = _userService.GetList();
|
}
|
|
|
ViewData.Model = dto;
|
return View();
|
}
|
|
|
/// <summary>
|
/// 保存工作建议
|
/// </summary>
|
/// <param name="data"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult SaveAskSuggestion(AdmAskMarketingCostDTO data)
|
{
|
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
|
ResultEntity resultEntity = new ResultEntity();
|
using (TransactionScope scope = new TransactionScope())
|
{
|
if (data.Step == "提交")
|
{
|
|
data.ShenpiStatus = "D";
|
data.RecStatus = "A";
|
data.Creater = curentuser.Id;
|
data.Createtime = DateTime.Now;
|
data.Modifier = data.Creater;
|
data.Modifytime = data.Createtime;
|
|
resultEntity = _askService.SaveAskMarketingCost(data);
|
if (!resultEntity.Result)
|
{
|
return new JsonResult(resultEntity);
|
}
|
}
|
|
|
|
//发起流程相关
|
|
resultEntity = _wfRunProcessService.WfAskSuggestion(data.Id, data.Step, data.Tongguojujue, curentuser.Id, data.Content, data.Tittle, "v1");
|
if (!resultEntity.Result)
|
{
|
return new JsonResult(resultEntity);
|
}
|
scope.Complete();
|
}
|
return new JsonResult(resultEntity);
|
}
|
|
|
public IActionResult AskOther(string id = "")
|
{
|
AdmAskMarketingCostDTO dto = new AdmAskMarketingCostDTO();
|
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
|
|
|
//流程相关
|
string shifoubiaoji = "A";
|
string sifoudangqian = "A";
|
string dangqianbuzhou = "提交";
|
var lishiyijian = new List<WfHistoryDTO>();
|
|
if (string.IsNullOrEmpty(id))
|
{
|
dto.CreaterName = curentuser.UserName;
|
dto.Tittle = "其他请示申请(" + curentuser.UserName + ")";
|
}
|
else if (dto != null)
|
{
|
dto = _askService.GetAskMarketingCost(id);
|
dto.FeiyongName = dto.Feiyong.Value.ToString("F2");
|
|
var wfRunProcessDTO = _wfRunProcessService.GetList(dto.Id, "11").FirstOrDefault();
|
if (wfRunProcessDTO == null)
|
{
|
shifoubiaoji = "D";
|
sifoudangqian = "D";
|
}
|
else
|
{
|
dangqianbuzhou = wfRunProcessDTO.Step;
|
//查询审批进度
|
lishiyijian = _wfHistoryService.GetListshenpi(wfRunProcessDTO.Id);
|
if (wfRunProcessDTO.Step != "提交")
|
{
|
shifoubiaoji = "D";
|
}
|
|
//查询待办
|
var chaxundaiban = _wfNeeddeelService.GetListTracking(wfRunProcessDTO.Id, wfRunProcessDTO.Step).Where(x => x.DeelUserId == curentuser.Id).ToList();
|
if (chaxundaiban != null && chaxundaiban.Count > 0)
|
{
|
sifoudangqian = "A";
|
}
|
else
|
{
|
sifoudangqian = "D";
|
}
|
|
}
|
|
|
|
|
}
|
|
ViewBag.shifoubiaoji = shifoubiaoji;
|
ViewBag.sifoudangqian = sifoudangqian;
|
ViewBag.lishiyijian = lishiyijian;
|
ViewBag.dangqianbuzhou = dangqianbuzhou;
|
|
|
|
ViewData.Model = dto;
|
return View();
|
}
|
|
|
/// <summary>
|
/// 保存其他请示
|
/// </summary>
|
/// <param name="data"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult SaveOther(AdmAskMarketingCostDTO data)
|
{
|
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
|
ResultEntity resultEntity = new ResultEntity();
|
using (TransactionScope scope = new TransactionScope())
|
{
|
if (data.Step == "提交")
|
{
|
|
data.ShenpiStatus = "D";
|
data.RecStatus = "A";
|
data.Creater = curentuser.Id;
|
data.Createtime = DateTime.Now;
|
data.Modifier = data.Creater;
|
data.Modifytime = data.Createtime;
|
|
resultEntity = _askService.SaveAskMarketingCost(data);
|
if (!resultEntity.Result)
|
{
|
return new JsonResult(resultEntity);
|
}
|
}
|
|
|
|
//发起流程相关
|
|
resultEntity = _wfRunProcessService.WfAskMarketingCost(data.Id, data.Step, data.Tongguojujue, curentuser.Id, data.Content, data.Tittle, "v1");
|
if (!resultEntity.Result)
|
{
|
return new JsonResult(resultEntity);
|
}
|
scope.Complete();
|
}
|
return new JsonResult(resultEntity);
|
}
|
|
|
public IActionResult AskPunishAppeal(string id = "")
|
{
|
AdmAskMarketingCostDTO dto = new AdmAskMarketingCostDTO();
|
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
|
|
|
//流程相关
|
string shifoubiaoji = "A";
|
string sifoudangqian = "A";
|
string dangqianbuzhou = "提交";
|
var lishiyijian = new List<WfHistoryDTO>();
|
|
if (string.IsNullOrEmpty(id))
|
{
|
dto.CreaterName = curentuser.UserName;
|
dto.Tittle = "处罚申诉(" + curentuser.UserName + ")";
|
}
|
else if (dto != null)
|
{
|
dto = _askService.GetAskMarketingCost(id);
|
//dto.FeiyongName = dto.Feiyong.Value.ToString("F2");
|
|
var wfRunProcessDTO = _wfRunProcessService.GetList(dto.Id, "09").FirstOrDefault();
|
if (wfRunProcessDTO == null)
|
{
|
shifoubiaoji = "D";
|
sifoudangqian = "D";
|
}
|
else
|
{
|
dangqianbuzhou = wfRunProcessDTO.Step;
|
//查询审批进度
|
lishiyijian = _wfHistoryService.GetListshenpi(wfRunProcessDTO.Id);
|
if (wfRunProcessDTO.Step != "提交")
|
{
|
shifoubiaoji = "D";
|
}
|
|
//查询待办
|
var chaxundaiban = _wfNeeddeelService.GetListTracking(wfRunProcessDTO.Id, wfRunProcessDTO.Step).Where(x => x.DeelUserId == curentuser.Id).ToList();
|
if (chaxundaiban != null && chaxundaiban.Count > 0)
|
{
|
sifoudangqian = "A";
|
}
|
else
|
{
|
sifoudangqian = "D";
|
}
|
|
}
|
|
|
|
|
}
|
|
ViewBag.shifoubiaoji = shifoubiaoji;
|
ViewBag.sifoudangqian = sifoudangqian;
|
ViewBag.lishiyijian = lishiyijian;
|
ViewBag.dangqianbuzhou = dangqianbuzhou;
|
if (string.IsNullOrEmpty(id))
|
{
|
ViewBag.AdmBreakPrecedentDTOs = _aAdmBreakPrecedentService.GetList(curentuser.Id, DateTime.Now.Date.AddMonths(-2), DateTime.Now.Date.AddDays(1)).ToList();
|
}
|
else
|
{
|
ViewBag.AdmBreakPrecedentDTOs = _aAdmBreakPrecedentService.GetList(dto.Creater, DateTime.Now.Date.AddMonths(-2), DateTime.Now.Date.AddDays(1)).ToList();
|
}
|
|
|
|
|
ViewData.Model = dto;
|
return View();
|
}
|
|
|
/// <summary>
|
/// 保存处罚申诉
|
/// </summary>
|
/// <param name="data"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult SaveAskPunishAppeal(AdmAskMarketingCostDTO data)
|
{
|
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
|
ResultEntity resultEntity = new ResultEntity();
|
using (TransactionScope scope = new TransactionScope())
|
{
|
if (data.Step == "提交")
|
{
|
|
data.ShenpiStatus = "D";
|
data.RecStatus = "A";
|
data.Creater = curentuser.Id;
|
data.Createtime = DateTime.Now;
|
data.Modifier = data.Creater;
|
data.Modifytime = data.Createtime;
|
|
resultEntity = _askService.SaveAskMarketingCost(data);
|
if (!resultEntity.Result)
|
{
|
return new JsonResult(resultEntity);
|
}
|
}
|
|
|
|
//发起流程相关
|
|
resultEntity = _wfRunProcessService.WfAskPunishAppeal(data.Id, data.Step, data.Tongguojujue, curentuser.Id, data.Content, data.Tittle, "v1");
|
if (!resultEntity.Result)
|
{
|
return new JsonResult(resultEntity);
|
}
|
scope.Complete();
|
}
|
return new JsonResult(resultEntity);
|
}
|
|
|
public IActionResult AskYouHui(string id = "")
|
{
|
AdmAskYouHuiDTO dto = new AdmAskYouHuiDTO();
|
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
|
|
|
//流程相关
|
string shifoubiaoji = "A";
|
string sifoudangqian = "A";
|
string dangqianbuzhou = "提交";
|
var lishiyijian = new List<WfHistoryDTO>();
|
|
if (string.IsNullOrEmpty(id))
|
{
|
dto.CreaterName = curentuser.UserName;
|
dto.Tittle = "优惠申请(" + curentuser.UserName + ")";
|
}
|
else if (dto != null)
|
{
|
dto = _askService.GetAskYouHui(id);
|
dto.YouHuiName = dto.YouHui.Value.ToString("F2");
|
|
var wfRunProcessDTO = _wfRunProcessService.GetList(dto.Id, "12").FirstOrDefault();
|
if (wfRunProcessDTO == null)
|
{
|
shifoubiaoji = "D";
|
sifoudangqian = "D";
|
}
|
else
|
{
|
dangqianbuzhou = wfRunProcessDTO.Step;
|
//查询审批进度
|
lishiyijian = _wfHistoryService.GetListshenpi(wfRunProcessDTO.Id);
|
if (wfRunProcessDTO.Step != "提交")
|
{
|
shifoubiaoji = "D";
|
}
|
|
//查询待办
|
var chaxundaiban = _wfNeeddeelService.GetListTracking(wfRunProcessDTO.Id, wfRunProcessDTO.Step).Where(x => x.DeelUserId == curentuser.Id).ToList();
|
if (chaxundaiban != null && chaxundaiban.Count > 0)
|
{
|
sifoudangqian = "A";
|
}
|
else
|
{
|
sifoudangqian = "D";
|
}
|
|
}
|
|
|
|
|
}
|
|
ViewBag.shifoubiaoji = shifoubiaoji;
|
ViewBag.sifoudangqian = sifoudangqian;
|
ViewBag.lishiyijian = lishiyijian;
|
ViewBag.dangqianbuzhou = dangqianbuzhou;
|
|
ViewBag.jtype = _liaotianService.GetSYScode("CooperVisit", "jtype");
|
ViewBag.standard = _liaotianService.GetSYScode("fi_piecerate", "standard");
|
|
ViewBag.CooperatecustomCustomerDTOs = _cooperatecustomCustomerService.GetList();
|
|
ViewData.Model = dto;
|
return View();
|
}
|
|
|
/// <summary>
|
/// 保存销售费用申请
|
/// </summary>
|
/// <param name="data"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult SaveYouHui(AdmAskYouHuiDTO data)
|
{
|
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
|
ResultEntity resultEntity = new ResultEntity();
|
using (TransactionScope scope = new TransactionScope())
|
{
|
if (data.Step == "提交")
|
{
|
|
data.ShenpiStatus = "D";
|
data.RecStatus = "A";
|
data.Creater = curentuser.Id;
|
data.Createtime = DateTime.Now;
|
data.Modifier = data.Creater;
|
data.Modifytime = data.Createtime;
|
|
resultEntity = _askService.SaveAskYouHui(data);
|
if (!resultEntity.Result)
|
{
|
return new JsonResult(resultEntity);
|
}
|
}
|
|
|
|
//发起流程相关
|
|
resultEntity = _wfRunProcessService.WfAskYouHui(data.Id, data.Step, data.Tongguojujue, curentuser.Id, data.Content, data.Tittle, "v1");
|
if (!resultEntity.Result)
|
{
|
return new JsonResult(resultEntity);
|
}
|
scope.Complete();
|
}
|
return new JsonResult(resultEntity);
|
}
|
|
public IActionResult AskBaiFang(string id = "")
|
{
|
AdmAskBaiFangDTO dto = new AdmAskBaiFangDTO();
|
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
|
|
|
//流程相关
|
string shifoubiaoji = "A";
|
string sifoudangqian = "A";
|
string dangqianbuzhou = "提交";
|
var lishiyijian = new List<WfHistoryDTO>();
|
|
if (string.IsNullOrEmpty(id))
|
{
|
dto.CreaterName = curentuser.UserName;
|
dto.Tittle = "访问请示(" + curentuser.UserName + ")";
|
}
|
else if (dto != null)
|
{
|
dto = _askService.GetAskBaiFang(id);
|
dto.BaiFangtimeName = dto.BaiFangtime.Value.ToString("yyyy-MM-dd");
|
|
var wfRunProcessDTO = _wfRunProcessService.GetList(dto.Id, "13").FirstOrDefault();
|
if (wfRunProcessDTO == null)
|
{
|
shifoubiaoji = "D";
|
sifoudangqian = "D";
|
}
|
else
|
{
|
dangqianbuzhou = wfRunProcessDTO.Step;
|
//查询审批进度
|
lishiyijian = _wfHistoryService.GetListshenpi(wfRunProcessDTO.Id);
|
if (wfRunProcessDTO.Step != "提交")
|
{
|
shifoubiaoji = "D";
|
}
|
|
//查询待办
|
var chaxundaiban = _wfNeeddeelService.GetListTracking(wfRunProcessDTO.Id, wfRunProcessDTO.Step).Where(x => x.DeelUserId == curentuser.Id).ToList();
|
if (chaxundaiban != null && chaxundaiban.Count > 0)
|
{
|
sifoudangqian = "A";
|
}
|
else
|
{
|
sifoudangqian = "D";
|
}
|
|
}
|
|
|
|
|
}
|
|
ViewBag.shifoubiaoji = shifoubiaoji;
|
ViewBag.sifoudangqian = sifoudangqian;
|
ViewBag.lishiyijian = lishiyijian;
|
ViewBag.dangqianbuzhou = dangqianbuzhou;
|
|
ViewBag.jtype = _liaotianService.GetSYScode("CooperVisit", "jtype");
|
ViewBag.visType = _liaotianService.GetSYScode("CooperVisit", "visType");
|
//var cooperatecustomCustomerDTOs = _cooperatecustomCustomerService.GetList();
|
//var intentionCustomerDTOs = _intentionCustomerService.GetList();
|
|
//ViewBag.CooperatecustomCustomerDTOs =
|
|
ViewData.Model = dto;
|
return View();
|
}
|
|
|
/// <summary>
|
/// 保存销售费用申请
|
/// </summary>
|
/// <param name="data"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult SaveBaiFang(AdmAskBaiFangDTO data)
|
{
|
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
|
ResultEntity resultEntity = new ResultEntity();
|
using (TransactionScope scope = new TransactionScope())
|
{
|
if (data.Step == "提交")
|
{
|
|
data.ShenpiStatus = "D";
|
data.RecStatus = "A";
|
data.Creater = curentuser.Id;
|
data.Createtime = DateTime.Now;
|
data.Modifier = data.Creater;
|
data.Modifytime = data.Createtime;
|
|
resultEntity = _askService.SaveAskBaiFang(data);
|
if (!resultEntity.Result)
|
{
|
return new JsonResult(resultEntity);
|
}
|
}
|
|
|
|
//发起流程相关
|
|
resultEntity = _wfRunProcessService.WfAskBaiFang(data.Id, data.Step, data.Tongguojujue, curentuser.Id, data.Content, data.Tittle, "v1");
|
if (!resultEntity.Result)
|
{
|
return new JsonResult(resultEntity);
|
}
|
scope.Complete();
|
}
|
return new JsonResult(resultEntity);
|
}
|
}
|
}
|