From cbff3bc3a629c74a3d72f5986721ed0b2716ac13 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期一, 18 十月 2021 13:51:36 +0800
Subject: [PATCH] 提交
---
zhengcaioa/zhengcaioa/Controllers/Expert/ExpertController.cs | 197 +++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 189 insertions(+), 8 deletions(-)
diff --git a/zhengcaioa/zhengcaioa/Controllers/Expert/ExpertController.cs b/zhengcaioa/zhengcaioa/Controllers/Expert/ExpertController.cs
index e587055..aa5ae0e 100644
--- a/zhengcaioa/zhengcaioa/Controllers/Expert/ExpertController.cs
+++ b/zhengcaioa/zhengcaioa/Controllers/Expert/ExpertController.cs
@@ -11,10 +11,11 @@
using zhengcaioa.IService;
using System.IO;
using Microsoft.Extensions.Configuration;
+using System.Transactions;
namespace zhengcaioa.Controllers.Expert
{
- [CheckLogin]
+
public class ExpertController : Controller
{
private readonly ILogger<ExpertController> _logger;
@@ -22,14 +23,24 @@
private readonly ILiaotianService _liaotianService;
private readonly IProjectService _projectService;
private readonly IUserService _userService;
- public ExpertController(ILogger<ExpertController> logger, IExpertService expertService, IProjectService projectService, ILiaotianService liaotianService, IUserService userService)
+ private readonly IFiSubjectService _ifiSubjectService;
+ private readonly ICooperOrderService _cooperOrderService;
+ private readonly IFiAccountService _fiAccountService;
+ private readonly IFiAccountRecordService _iFiAccountRecordService;
+ public ExpertController(ILogger<ExpertController> logger, IExpertService expertService, IProjectService projectService, ILiaotianService liaotianService, IUserService userService
+ , IFiSubjectService ifiSubjectService, ICooperOrderService cooperOrderService, IFiAccountService fiAccountService, IFiAccountRecordService iFiAccountRecordService)
{
_logger = logger;
_expertService = expertService;
_projectService = projectService;
_liaotianService = liaotianService;
_userService = userService;
+ _ifiSubjectService = ifiSubjectService;
+ _cooperOrderService = cooperOrderService;
+ _fiAccountService = fiAccountService;
+ _iFiAccountRecordService = iFiAccountRecordService;
}
+ [CheckLogin]
public IActionResult Index()
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -72,7 +83,7 @@
#region 缂栬緫
-
+ [CheckLogin]
public ActionResult Edit(string id = null)
{
@@ -176,7 +187,7 @@
/// <param name="data">宀椾綅瀹炰綋绫诲璞�</param>
/// <returns></returns>
[HttpPost]
-
+ [CheckLogin]
public string Save(ExpertDTO data)
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -209,7 +220,7 @@
/// <param name="info">瀹炰綋</param>
/// <returns></returns>
///
-
+ [CheckLogin]
public string Nullify(string Id = "")
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -272,6 +283,7 @@
/// <param name="data">淇濆瓨鎺ㄥ箍璁板綍</param>
/// <returns></returns>
[HttpPost]
+ [CheckLogin]
public string SavePromte(ExpertPromoteDTO data)
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -292,6 +304,7 @@
#endregion
#region 涓撳娲惧伐
+ [CheckLogin]
public IActionResult ExpertOrderDispatch()
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -314,14 +327,15 @@
ViewBag.HuifangStatus = _liaotianService.GetSYScode("CooperOrder", "huifang_status").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
ViewBag.PingjiaStatus = _liaotianService.GetSYScode("CooperOrder", "pingjia_status").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
-
+ ViewBag.Expert = _expertService.GetList().Select(x => new { code = x.Id, label = x.Name }).ToList();
return View();
}
-
+ [CheckLogin]
public string GetOrderList(ExpertOrderDipatchDTOSearch search)
{
return JsonConvert.SerializeObject(_expertService.SearchOrderDispatch(search));
}
+ [CheckLogin]
public IActionResult Dispatch(string orderid)
{
@@ -330,6 +344,7 @@
ViewBag.OrderId = orderid;
return View();
}
+ [CheckLogin]
public string SaveDispatch(ExpertOrderDipatchDTO data)
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -339,6 +354,7 @@
{
data.Creater = curentuser.Id;
data.Createtime = DateTime.Now;
+ data.sort = "D";
}
data.Modifier = curentuser.Id;
data.Modifytime = DateTime.Now;
@@ -351,9 +367,174 @@
+ #region 涓撳璐圭敤缁撶畻
+ [CheckLogin]
+ public IActionResult ExpertFeiyong()
+ {
+ var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+ ViewData["curentuser"] = curentuser;
+ List<ActionEntity> actionlist = new List<ActionEntity>();
+ ActionEntity actionEntity = new ActionEntity();
+ actionEntity.OpenType = 0;
+ actionEntity.ActionUrl = "";
+ actionEntity.ActionFun = "Search";
+ actionEntity.PageIco = "fa fa-search";
+ actionEntity.ActionName = "鏌ヨ";
+ actionlist.Add(actionEntity);
-
+ ActionEntity actionEntity1 = new ActionEntity();
+ actionEntity1.OpenType = 0;
+ actionEntity1.ActionUrl = "";
+ actionEntity1.ActionFun = "Jiesuan";
+ actionEntity1.PageIco = "fa fa-plus-square";
+ actionEntity1.ActionName = "缁撶畻";
+ actionlist.Add(actionEntity1);
+ ViewData["ActionInfo"] = actionlist;
+
+
+ ViewBag.Expert = _expertService.GetList().Select(x => new { code = x.Id, label = x.Name }).ToList();
+ ViewBag.shifou = _liaotianService.GetSYScode("system", "shifou").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
+ return View();
+ }
+
+ [CheckLogin]
+ public string GetJiesuanList(ExpertOrderDipatchDTOSearch search)
+ {
+ return JsonConvert.SerializeObject(_expertService.SearchJiesuan(search));
+ }
+
+
+ public IActionResult EditJiesuan(string id)
+ {
+ var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+ ViewData["curentuser"] = curentuser;
+ decimal Money = 0;
+ FiOrderrecievemoneyDTO dto = new FiOrderrecievemoneyDTO();
+ if (!String.IsNullOrEmpty(id))
+ {
+ string[] ids = id.Split(',');
+ foreach(var iddd in ids)
+ {
+ var expertOrderDipatchDTO = _expertService.GetDispatch(iddd);
+ if(expertOrderDipatchDTO.sort != "A")
+ {
+ Money += expertOrderDipatchDTO.Money.Value;
+ }
+
+
+ }
+ }
+ dto.PayTime = DateTime.Now;
+ dto.Id = id;
+
+ dto.Money = Money;
+
+
+ ViewData.Model = dto;
+
+ ViewBag.PayType = _liaotianService.GetSYScode("fi_account", "accounttype");
+ ViewBag.accounttype = _liaotianService.GetSYScode("fi_account", "accounttype");
+ ViewBag.FiSubject = _ifiSubjectService.GetList().Where(x => x.Subjecttype == "02").ToList();
+
+
+
+
+
+ ViewData.Model = dto;
+ return View();
+ }
+
+
+ /// <summary>
+ /// 淇濆瓨
+ /// </summary>
+ /// <param name="data">宀椾綅瀹炰綋绫诲璞�</param>
+ /// <returns></returns>
+ ///
+ [HttpPost]
+ public IActionResult SaveJiesuan(FiOrderrecievemoneyDTO data)
+ {
+ ResultEntity resultEntity = new ResultEntity();
+ var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+ ViewData["curentuser"] = curentuser;
+ using (TransactionScope scope = new TransactionScope())
+ {
+ string[] ids = data.Id.Split(',');
+ foreach (var iddd in ids)
+ {
+ var expertOrderDipatchDTO = _expertService.GetDispatch(iddd);
+ if(expertOrderDipatchDTO.sort == "A")
+ {
+ resultEntity.Result = false;
+ resultEntity.Message = "瀛樺湪宸茬粡缁撶畻鐨勮鍗�";
+ return new JsonResult(resultEntity);
+ }
+
+ expertOrderDipatchDTO.sort = "A";
+ expertOrderDipatchDTO.Modifier = curentuser.Id;
+ expertOrderDipatchDTO.Modifytime = DateTime.Now;
+ resultEntity = _expertService.SaveDispatch(expertOrderDipatchDTO);
+ if (!resultEntity.Result)
+ {
+ return new JsonResult(resultEntity);
+ }
+ var expertDTO = _expertService.Get(expertOrderDipatchDTO.ExpertId);
+ var orderDTO = _cooperOrderService.Get(expertOrderDipatchDTO.OrderId);
+ //鎻掑叆鏀嚭璁板綍
+ FiAccountRecordDTO data1 = new FiAccountRecordDTO();
+ data1.RecStatus = "A";
+ data1.Creater = curentuser.Id;
+ data1.Createtime = data.PayTime;
+ data1.Modifier = curentuser.Id;
+ data1.Modifytime = data.PayTime;
+ data1.SubjectId = data.SubjectId;
+ data1.AccountId = data.AccountId;
+ data1.Money = expertOrderDipatchDTO.Money;
+ data1.PaymentUnit = expertDTO.Name;
+ data1.OperationalMatters = expertDTO.Name +" " +orderDTO.OrderNo+ "缁撶畻璐圭敤" ;
+
+
+
+ FiAccountDTO firmAccount = _fiAccountService.Get(data1.AccountId);
+
+
+ data1.RecordTypeId = "2";//鏀跺叆
+ data1.Department = "";
+
+
+ firmAccount.AllExpenses = (firmAccount.AllExpenses ?? 0) + data1.Money;
+ firmAccount.Balance = (firmAccount.Balance ?? 0) - data1.Money;
+
+
+
+ data1.AccountMoney = firmAccount.Balance;
+ resultEntity = _iFiAccountRecordService.save(data1);
+ if (!resultEntity.Result)
+ {
+ return new JsonResult(resultEntity);
+ }
+
+
+ resultEntity = _fiAccountService.save(firmAccount);
+ if (!resultEntity.Result)
+ {
+ return new JsonResult(resultEntity);
+ }
+
+ }
+ scope.Complete();
+ }
+
+ return new JsonResult(resultEntity);
+ }
+
+
+
+
+
+ #endregion
+
}
}
--
Gitblit v1.9.1