From 00446e5e764fd57ea0f28b30921f4a5daa60c890 Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期五, 23 七月 2021 14:10:31 +0800 Subject: [PATCH] 流程 费用申请,物品申领 --- zhengcaioa/IServices/IAskService.cs | 20 zhengcaioa/Model/AdmAskGood.cs | 23 zhengcaioa/Services/WfNeeddeelService.cs | 2 zhengcaioa/Model/AdmAskcost.cs | 22 zhengcaioa/zhengcaioa/Views/WorkFlowTask/IndexYiBan.cshtml | 1 zhengcaioa/Services/WfHistoryService.cs | 2 zhengcaioa/Services/WfRunProcessService.cs | 877 +++++++++++++++++++++ zhengcaioa/zhengcaioa/Startup.cs | 2 zhengcaioa/IServices/IWfRunProcessService.cs | 4 zhengcaioa/Model/zhengcaioaContext.cs | 114 ++ zhengcaioa/zhengcaioa/Controllers/HR/SalaryCheckController.cs | 8 表修改.sql | 197 ++++ zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs | 6 zhengcaioa/zhengcaioa/Views/WorkFlowTask/Index.cshtml | 2 zhengcaioa/Services/AskService.cs | 138 +++ zhengcaioa/zhengcaioa/Views/AdmAsk/Askcost.cshtml | 289 +++++++ zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs | 276 ++++++ zhengcaioa/zhengcaioa/Views/AdmAsk/AskGood.cshtml | 318 +++++++ zhengcaioa/DTO/AdmAskGoodDTO.cs | 26 zhengcaioa/DTO/AdmAskcostDTO.cs | 25 20 files changed, 2,348 insertions(+), 4 deletions(-) diff --git a/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs b/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs index dd00adf..d3a0fc2 100644 --- a/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs +++ b/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs @@ -228,6 +228,12 @@ CreateMap<AdmEvaluate, AdmEvaluateDTO>(); CreateMap<AdmEvaluateDTO, AdmEvaluate>(); + CreateMap<AdmAskcost, AdmAskcostDTO>(); + CreateMap<AdmAskcostDTO, AdmAskcost>(); + + CreateMap<AdmAskGood, AdmAskGoodDTO>(); + CreateMap<AdmAskGoodDTO, AdmAskGood>(); + } } } diff --git a/zhengcaioa/DTO/AdmAskGoodDTO.cs b/zhengcaioa/DTO/AdmAskGoodDTO.cs new file mode 100644 index 0000000..d23477c --- /dev/null +++ b/zhengcaioa/DTO/AdmAskGoodDTO.cs @@ -0,0 +1,26 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace DTO +{ + public class AdmAskGoodDTO + { + public string Id { get; set; } + public string GoodsId { get; set; } + public decimal? Shuliang { get; set; } + public string ShuliangName { get; set; } + public string Remark { get; set; } + public string ShenpiStatus { get; set; } + public string RecStatus { get; set; } + public string Creater { get; set; } + public DateTime Createtime { get; set; } + public string Modifier { get; set; } + public DateTime Modifytime { get; set; } + public string CreaterName { get; set; } + public string Tittle { get; set; } + public string Content { get; set; } + public string Tongguojujue { get; set; } + public string Step { get; set; } + } +} diff --git a/zhengcaioa/DTO/AdmAskcostDTO.cs b/zhengcaioa/DTO/AdmAskcostDTO.cs new file mode 100644 index 0000000..1e79785 --- /dev/null +++ b/zhengcaioa/DTO/AdmAskcostDTO.cs @@ -0,0 +1,25 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace DTO +{ + public class AdmAskcostDTO + { + public string Id { get; set; } + public decimal? Cost { get; set; } + public string CostName { get; set; } + public string Remark { get; set; } + public string ShenpiStatus { get; set; } + public string RecStatus { get; set; } + public string Creater { get; set; } + public DateTime Createtime { get; set; } + public string Modifier { get; set; } + public DateTime Modifytime { get; set; } + public string CreaterName { get; set; } + public string Tittle { get; set; } + public string Content { get; set; } + public string Tongguojujue { get; set; } + public string Step { get; set; } + } +} diff --git a/zhengcaioa/IServices/IAskService.cs b/zhengcaioa/IServices/IAskService.cs new file mode 100644 index 0000000..7204b92 --- /dev/null +++ b/zhengcaioa/IServices/IAskService.cs @@ -0,0 +1,20 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using DTO; + +namespace IServices +{ + public interface IAskService + { + + //璐圭敤鐢宠 + ResultEntity SaveAskcost(AdmAskcostDTO admAsk); + AdmAskcostDTO GetAskcost(string Id); + + + //鐗╁搧鐢抽 + ResultEntity SaveAskGood(AdmAskGoodDTO admAsk); + AdmAskGoodDTO GetAskGood(string Id); + } +} diff --git a/zhengcaioa/IServices/IWfRunProcessService.cs b/zhengcaioa/IServices/IWfRunProcessService.cs index f0e91df..e024d6e 100644 --- a/zhengcaioa/IServices/IWfRunProcessService.cs +++ b/zhengcaioa/IServices/IWfRunProcessService.cs @@ -22,5 +22,9 @@ ResultEntity WfAskLeaveOff(string DanjuId, string step, string tongguojujue, string Userid, string Content, string title, string version); ResultEntity WfSalaryAppeal(string DanjuId, string step, string tongguojujue, string Userid, string Content, string title, string version); + + ResultEntity WfAskcost(string DanjuId, string step, string tongguojujue, string Userid, string Content, string title, string version); + + ResultEntity WfAskGood(string DanjuId, string step, string tongguojujue, string Userid, string Content, string title, string version); } } diff --git a/zhengcaioa/Model/AdmAskGood.cs b/zhengcaioa/Model/AdmAskGood.cs new file mode 100644 index 0000000..275f46c --- /dev/null +++ b/zhengcaioa/Model/AdmAskGood.cs @@ -0,0 +1,23 @@ +锘縰sing System; +using System.Collections.Generic; + +#nullable disable + +namespace zhengcaioa.Models +{ + public partial class AdmAskGood + { + public string Id { get; set; } + public string GoodsId { get; set; } + public decimal? Shuliang { get; set; } + public string Remark { get; set; } + public string ShenpiStatus { get; set; } + public string RecStatus { get; set; } + public string Creater { get; set; } + public DateTime Createtime { get; set; } + public string Modifier { get; set; } + public DateTime Modifytime { get; set; } + public string CreaterName { get; set; } + public string Tittle { get; set; } + } +} diff --git a/zhengcaioa/Model/AdmAskcost.cs b/zhengcaioa/Model/AdmAskcost.cs new file mode 100644 index 0000000..0ef4cc0 --- /dev/null +++ b/zhengcaioa/Model/AdmAskcost.cs @@ -0,0 +1,22 @@ +锘縰sing System; +using System.Collections.Generic; + +#nullable disable + +namespace zhengcaioa.Models +{ + public partial class AdmAskcost + { + public string Id { get; set; } + public decimal? Cost { get; set; } + public string Remark { get; set; } + public string ShenpiStatus { get; set; } + public string RecStatus { get; set; } + public string Creater { get; set; } + public DateTime Createtime { get; set; } + public string Modifier { get; set; } + public DateTime Modifytime { get; set; } + public string CreaterName { get; set; } + public string Tittle { get; set; } + } +} diff --git a/zhengcaioa/Model/zhengcaioaContext.cs b/zhengcaioa/Model/zhengcaioaContext.cs index 3a4f12a..7414199 100644 --- a/zhengcaioa/Model/zhengcaioaContext.cs +++ b/zhengcaioa/Model/zhengcaioaContext.cs @@ -24,7 +24,8 @@ public virtual DbSet<HrSalaryAppeal> HrSalaryAppeal { get; set; } public virtual DbSet<SimCostYearView> SimCostYearView { get; set; } - + public virtual DbSet<AdmAskcost> AdmAskcosts { get; set; } + public virtual DbSet<AdmAskGood> AdmAskGoods { get; set; } public virtual DbSet<AdmAskLeave> AdmAskLeaves { get; set; } public virtual DbSet<AdmAskLeaveOff> AdmAskLeaveOffs { get; set; } public virtual DbSet<AdmAttendance> AdmAttendances { get; set; } @@ -118,6 +119,117 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.HasAnnotation("Relational:Collation", "Chinese_PRC_CI_AS"); + + modelBuilder.Entity<AdmAskcost>(entity => + { + entity.ToTable("ADM_Askcost"); + + entity.Property(e => e.Id).HasMaxLength(50); + + entity.Property(e => e.Cost) + .HasColumnType("money") + .HasDefaultValueSql("((0))"); + + entity.Property(e => e.Creater) + .IsRequired() + .HasMaxLength(50) + .HasColumnName("creater") + .HasDefaultValueSql("('1')"); + + entity.Property(e => e.CreaterName) + .HasMaxLength(50) + .HasColumnName("createrName"); + + entity.Property(e => e.Createtime) + .HasColumnType("datetime") + .HasColumnName("createtime") + .HasDefaultValueSql("(getdate())"); + + entity.Property(e => e.Modifier) + .IsRequired() + .HasMaxLength(50) + .HasColumnName("modifier") + .HasDefaultValueSql("('1')"); + + entity.Property(e => e.Modifytime) + .HasColumnType("datetime") + .HasColumnName("modifytime") + .HasDefaultValueSql("(getdate())"); + + entity.Property(e => e.RecStatus) + .IsRequired() + .HasMaxLength(1) + .HasColumnName("rec_status") + .HasDefaultValueSql("('A')"); + + entity.Property(e => e.Remark).HasMaxLength(500); + + entity.Property(e => e.ShenpiStatus) + .HasMaxLength(1) + .HasColumnName("shenpi_status") + .HasDefaultValueSql("('D')"); + + entity.Property(e => e.Tittle) + .HasMaxLength(50) + .HasColumnName("tittle"); + }); + + modelBuilder.Entity<AdmAskGood>(entity => + { + entity.ToTable("ADM_AskGoods"); + + entity.Property(e => e.Id).HasMaxLength(50); + + entity.Property(e => e.Creater) + .IsRequired() + .HasMaxLength(50) + .HasColumnName("creater") + .HasDefaultValueSql("('1')"); + + entity.Property(e => e.CreaterName) + .HasMaxLength(50) + .HasColumnName("createrName"); + + entity.Property(e => e.Createtime) + .HasColumnType("datetime") + .HasColumnName("createtime") + .HasDefaultValueSql("(getdate())"); + + entity.Property(e => e.GoodsId).HasMaxLength(50); + + entity.Property(e => e.Modifier) + .IsRequired() + .HasMaxLength(50) + .HasColumnName("modifier") + .HasDefaultValueSql("('1')"); + + entity.Property(e => e.Modifytime) + .HasColumnType("datetime") + .HasColumnName("modifytime") + .HasDefaultValueSql("(getdate())"); + + entity.Property(e => e.RecStatus) + .IsRequired() + .HasMaxLength(1) + .HasColumnName("rec_status") + .HasDefaultValueSql("('A')"); + + entity.Property(e => e.Remark).HasMaxLength(500); + + entity.Property(e => e.ShenpiStatus) + .HasMaxLength(1) + .HasColumnName("shenpi_status") + .HasDefaultValueSql("('D')"); + + entity.Property(e => e.Shuliang) + .HasColumnType("money") + .HasDefaultValueSql("((0))"); + + entity.Property(e => e.Tittle) + .HasMaxLength(50) + .HasColumnName("tittle"); + }); + modelBuilder.Entity<AdmAskLeave>(entity => { entity.ToTable("ADM_AskLeave"); diff --git a/zhengcaioa/Services/AskService.cs b/zhengcaioa/Services/AskService.cs new file mode 100644 index 0000000..42f3bda --- /dev/null +++ b/zhengcaioa/Services/AskService.cs @@ -0,0 +1,138 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using zhengcaioa.Models; +using IServices; +using AutoMapper; +using DTO; +using System.Linq; + +namespace Services +{ + public class AskService: IAskService + { + private readonly zhengcaioaContext _context; + private readonly IMapper _mapper; + public AskService(zhengcaioaContext context, IMapper mapper) + { + _context = context; + _mapper = mapper; + } + + #region 璐圭敤鐢宠 + public ResultEntity SaveAskcost(AdmAskcostDTO admAsk) + { + ResultEntity resultEntity = new ResultEntity(); + try + { + AdmAskcost ask = _mapper.Map<AdmAskcost>(admAsk); + if (string.IsNullOrEmpty(admAsk.Id)) + { + ask.Id = Guid.NewGuid().ToString(); + admAsk.Id = ask.Id; + _context.AdmAskcosts.Add(ask); + } + else + { + var entity = _context.AdmAskcosts.Find(admAsk.Id); + + entity.Cost = admAsk.Cost; + entity.Remark = admAsk.Remark; + + + entity.ShenpiStatus = admAsk.ShenpiStatus; + entity.CreaterName = admAsk.CreaterName; + entity.Tittle = admAsk.Tittle; + + + + entity.Modifier = admAsk.Modifier; + entity.Modifytime = DateTime.Now; + } + _context.SaveChanges(); + resultEntity.ReturnID = ask.Id; + resultEntity.Result = true; + } + catch (Exception ex) + { + resultEntity.Result = false; + resultEntity.Message = "淇濆瓨澶辫触锛岃鑱旂郴绠$悊鍛�"; + ex.Message.ToString(); + } + + return resultEntity; + } + + public AdmAskcostDTO GetAskcost(string Id) + { + var entity = _context.AdmAskcosts.Where(e => e.RecStatus == "A" && e.Id == Id).FirstOrDefault(); + if (entity == null) + { + entity = new AdmAskcost(); + } + var leaveDTO = _mapper.Map<AdmAskcostDTO>(entity); + return leaveDTO; + + } + #endregion + + + #region 鐗╁搧鐢抽 + public ResultEntity SaveAskGood(AdmAskGoodDTO admAsk) + { + ResultEntity resultEntity = new ResultEntity(); + try + { + AdmAskGood ask = _mapper.Map<AdmAskGood>(admAsk); + if (string.IsNullOrEmpty(admAsk.Id)) + { + ask.Id = Guid.NewGuid().ToString(); + admAsk.Id = ask.Id; + _context.AdmAskGoods.Add(ask); + } + else + { + var entity = _context.AdmAskGoods.Find(admAsk.Id); + + entity.Shuliang = admAsk.Shuliang; + entity.GoodsId = admAsk.GoodsId; + entity.Remark = admAsk.Remark; + + + entity.ShenpiStatus = admAsk.ShenpiStatus; + entity.CreaterName = admAsk.CreaterName; + entity.Tittle = admAsk.Tittle; + + + + entity.Modifier = admAsk.Modifier; + entity.Modifytime = DateTime.Now; + } + _context.SaveChanges(); + resultEntity.ReturnID = ask.Id; + resultEntity.Result = true; + } + catch (Exception ex) + { + resultEntity.Result = false; + resultEntity.Message = "淇濆瓨澶辫触锛岃鑱旂郴绠$悊鍛�"; + ex.Message.ToString(); + } + + return resultEntity; + } + + public AdmAskGoodDTO GetAskGood(string Id) + { + var entity = _context.AdmAskGoods.Where(e => e.RecStatus == "A" && e.Id == Id).FirstOrDefault(); + if (entity == null) + { + entity = new AdmAskGood(); + } + var leaveDTO = _mapper.Map<AdmAskGoodDTO>(entity); + return leaveDTO; + + } + #endregion + } +} diff --git a/zhengcaioa/Services/WfHistoryService.cs b/zhengcaioa/Services/WfHistoryService.cs index f40bb05..c3c607a 100644 --- a/zhengcaioa/Services/WfHistoryService.cs +++ b/zhengcaioa/Services/WfHistoryService.cs @@ -200,7 +200,7 @@ Modifytime = a.Modifytime, } - ).OrderBy(x => x.Sort).ThenByDescending(x=>x.Resivetime).ToList(); + ).OrderByDescending(x=>x.Applyno).ThenBy(x => x.Sort).ThenByDescending(x=>x.Resivetime).ToList(); diff --git a/zhengcaioa/Services/WfNeeddeelService.cs b/zhengcaioa/Services/WfNeeddeelService.cs index 7e51ce9..a481d95 100644 --- a/zhengcaioa/Services/WfNeeddeelService.cs +++ b/zhengcaioa/Services/WfNeeddeelService.cs @@ -202,7 +202,7 @@ Modifytime = a.Modifytime, } - ).OrderBy(x => x.Sort).ThenByDescending(x => x.Resivetime).ToList(); + ).OrderByDescending(x=>x.Applyno).ThenBy(x => x.Sort).ThenByDescending(x => x.Resivetime).ToList(); diff --git a/zhengcaioa/Services/WfRunProcessService.cs b/zhengcaioa/Services/WfRunProcessService.cs index fd21e38..97da843 100644 --- a/zhengcaioa/Services/WfRunProcessService.cs +++ b/zhengcaioa/Services/WfRunProcessService.cs @@ -1812,5 +1812,882 @@ return result; } + + public ResultEntity WfAskcost(string DanjuId, string step, string tongguojujue, string Userid, string Content, string title, string version) + { + + ResultEntity result = new ResultEntity(); + result.Result = true; + + + WfRunProcessDTO wfRunProcessDTO = this.GetList(DanjuId, "04").FirstOrDefault(); + if (wfRunProcessDTO != null) + { + version = wfRunProcessDTO.Version; + } + + + if (version == "v1") + { + if (step == "鎻愪氦") + { + //鏇存柊娴佺▼瀹炰緥 + // WfRunProcessDTO wfRunProcessDTO = this.GetList(DanjuId, "04").FirstOrDefault(); + if (wfRunProcessDTO == null) + { + //鎻掑叆娴佺▼瀹炰緥 + wfRunProcessDTO = new WfRunProcessDTO(); + //wfRunProcessDTO.Applyno = + wfRunProcessDTO.Applytime = DateTime.Now; + wfRunProcessDTO.Applytiye = "04"; + wfRunProcessDTO.DanjuId = DanjuId; + wfRunProcessDTO.Content = title; + wfRunProcessDTO.Step = "璐㈠姟瀹℃壒"; + wfRunProcessDTO.ShenpiStatus = "D"; + wfRunProcessDTO.Version = version; + wfRunProcessDTO.RecStatus = "A"; + wfRunProcessDTO.Creater = Userid; + wfRunProcessDTO.Createtime = DateTime.Now; + wfRunProcessDTO.Modifier = Userid; + wfRunProcessDTO.Modifytime = DateTime.Now; + wfRunProcessDTO.Deelurl = "/AdmAsk/Askcost?id=" + DanjuId; + result = this.save(wfRunProcessDTO); + if (result.Result == false) + { + return result; + } + //鏌ヨ澶勭悊浜� + var hrPositions = _context.PltRoles.Where(x => x.RecStatus == "A" && x.RoleName == "璐㈠姟").FirstOrDefault(); + if (hrPositions == null) + { + result.Result = false; + result.Message = "鏈壘鍒拌亴浣�"; + return result; + } + var pltUsers = (from a in _context.PltUsers.Where(x => x.RecStatus == "A" && x.Zhiwustatus == "A") + join b in _context.PltUserRoles.Where(x => x.RecStatus == "A" && x.RoleId == hrPositions.Id) on a.Id equals b.UserId + select a + ).ToList(); + + if (pltUsers == null || pltUsers.Count == 0) + { + result.Result = false; + result.Message = "鏈壘鍒板鐞嗕汉"; + return result; + } + foreach (var pltUser in pltUsers) + { + //鎻掑叆寰呭姙 + WfNeeddeelDTO wfNeeddeelDTO = new WfNeeddeelDTO(); + wfNeeddeelDTO.RunProcessId = wfRunProcessDTO.Id; + wfNeeddeelDTO.SendUserId = Userid; + wfNeeddeelDTO.DeelUserId = pltUser.Id; + wfNeeddeelDTO.Sendtime = DateTime.Now; + wfNeeddeelDTO.Resivetime = DateTime.Now; + wfNeeddeelDTO.Step = "璐㈠姟瀹℃壒"; + wfNeeddeelDTO.NeeddeelType = "1"; + wfNeeddeelDTO.ChuliStatus = "0"; + wfNeeddeelDTO.Deelurl = "/AdmAsk/Askcost?id=" + DanjuId; + wfNeeddeelDTO.Content = ""; + wfNeeddeelDTO.Sort = 1; + wfNeeddeelDTO.RecStatus = "A"; + wfNeeddeelDTO.Creater = Userid; + wfNeeddeelDTO.Createtime = DateTime.Now; + wfNeeddeelDTO.Modifier = Userid; + wfNeeddeelDTO.Modifytime = wfNeeddeelDTO.Createtime; + result = _wfNeeddeelService.save(wfNeeddeelDTO); + if (result.Result == false) + { + return result; + } + } + + //鎻掑叆鏂扮殑宸插姙 + WfHistory wfHistoryDTO1 = new WfHistory(); + wfHistoryDTO1.Id = Guid.NewGuid().ToString(); + wfHistoryDTO1.RunProcessId = wfRunProcessDTO.Id; + wfHistoryDTO1.SendUserId = Userid; + wfHistoryDTO1.DeelUserId = wfRunProcessDTO.Creater; + wfHistoryDTO1.Sendtime = DateTime.Now; + wfHistoryDTO1.Resivetime = DateTime.Now; + wfHistoryDTO1.Step = "鎻愪氦"; + wfHistoryDTO1.NeeddeelType = "1"; + wfHistoryDTO1.ChuliStatus = "2"; + wfHistoryDTO1.Deelurl = "/SalaryCheck/Appeal?id=" + DanjuId; + wfHistoryDTO1.Content = ""; + wfHistoryDTO1.Sort = 1; + wfHistoryDTO1.RecStatus = "A"; + wfHistoryDTO1.Creater = Userid; + wfHistoryDTO1.Createtime = DateTime.Now; + wfHistoryDTO1.Modifier = Userid; + wfHistoryDTO1.Modifytime = wfHistoryDTO1.Createtime; + _context.WfHistories.Add(wfHistoryDTO1); + _context.SaveChanges(); + } + else + { + wfRunProcessDTO.Step = "璐㈠姟瀹℃壒"; + wfRunProcessDTO.Modifier = Userid; + wfRunProcessDTO.Modifytime = DateTime.Now; + result = this.save(wfRunProcessDTO); + if (result.Result == false) + { + return result; + } + + //鏇存柊寰呭姙 + List<WfNeeddeelDTO> wfNeeddeelDTOs = _wfNeeddeelService.GetList(wfRunProcessDTO.Id, "鎻愪氦"); + var wfHistoryDTOs = _mapper.Map<List<WfHistoryDTO>>(wfNeeddeelDTOs); + + var wfHistoryDTO = wfHistoryDTOs.Where(x => x.DeelUserId == Userid).FirstOrDefault(); + if (wfHistoryDTO == null) + { + result.Result = false; + result.Message = "鏈壘鍒颁唬鍔�"; + return result; + } + wfHistoryDTO.Content = Content; + wfHistoryDTO.ChuliStatus = "2"; + wfHistoryDTO.Modifier = Userid; + wfHistoryDTO.Modifytime = DateTime.Now; + var wfHistories = _mapper.Map<List<WfHistory>>(wfHistoryDTOs); + foreach (var wfHistory in wfHistories) + { + _context.WfHistories.Add(wfHistory); + } + var wfNeeddeels = _mapper.Map<List<WfNeeddeel>>(wfNeeddeelDTOs); + foreach (var wfNeeddeel in wfNeeddeels) + { + //_wfNeeddeelService.ModifyStatus(wfNeeddeel.Id, Userid); + _context.WfNeeddeels.Remove(wfNeeddeel); + } + _context.SaveChanges(); + + //鏌ヨ澶勭悊浜� + var hrPositions = _context.PltRoles.Where(x => x.RecStatus == "A" && x.RoleName == "璐㈠姟").FirstOrDefault(); + if (hrPositions == null) + { + result.Result = false; + result.Message = "鏈壘鍒拌亴浣�"; + return result; + } + var pltUsers = (from a in _context.PltUsers.Where(x => x.RecStatus == "A" && x.Zhiwustatus == "A") + join b in _context.PltUserRoles.Where(x => x.RecStatus == "A" && x.RoleId == hrPositions.Id) on a.Id equals b.UserId + select a + ).ToList(); + + if (pltUsers == null || pltUsers.Count == 0) + { + result.Result = false; + result.Message = "鏈壘鍒板鐞嗕汉"; + return result; + } + + foreach (var pltUser in pltUsers) + { + //鎻掑叆鏂扮殑寰呭姙 + WfNeeddeelDTO wfNeeddeelDTO = new WfNeeddeelDTO(); + wfNeeddeelDTO.RunProcessId = wfRunProcessDTO.Id; + wfNeeddeelDTO.SendUserId = Userid; + wfNeeddeelDTO.DeelUserId = pltUser.Id; + wfNeeddeelDTO.Sendtime = DateTime.Now; + wfNeeddeelDTO.Resivetime = DateTime.Now; + wfNeeddeelDTO.Step = "璐㈠姟瀹℃壒"; + wfNeeddeelDTO.NeeddeelType = "1"; + wfNeeddeelDTO.ChuliStatus = "0"; + wfNeeddeelDTO.Deelurl = "/AdmAsk/Askcost?id=" + DanjuId; + wfNeeddeelDTO.Content = ""; + wfNeeddeelDTO.Sort = 2; + wfNeeddeelDTO.RecStatus = "A"; + wfNeeddeelDTO.Creater = Userid; + wfNeeddeelDTO.Createtime = DateTime.Now; + wfNeeddeelDTO.Modifier = Userid; + wfNeeddeelDTO.Modifytime = wfNeeddeelDTO.Createtime; + result = _wfNeeddeelService.save(wfNeeddeelDTO); + if (result.Result == false) + { + return result; + } + } + } + + + + + } + if (step == "璐㈠姟瀹℃壒") + { + //鏇存柊娴佺▼瀹炰緥 + //WfRunProcessDTO wfRunProcessDTO = this.GetList(DanjuId, "04").FirstOrDefault(); + if (wfRunProcessDTO == null) + { + result.Result = false; + result.Message = "鏈壘鍒版祦绋嬪疄渚�"; + return result; + } + if (wfRunProcessDTO.Step != "璐㈠姟瀹℃壒") + { + result.Result = false; + result.Message = "褰撳墠姝ラ宸茬粡澶勭悊"; + return result; + } + + if (tongguojujue == "A") + { + wfRunProcessDTO.Step = "鎬荤粡鐞嗗鎵�"; + wfRunProcessDTO.Modifier = Userid; + wfRunProcessDTO.Modifytime = DateTime.Now; + result = this.save(wfRunProcessDTO); + if (result.Result == false) + { + return result; + } + + //鏇存柊寰呭姙 + List<WfNeeddeelDTO> wfNeeddeelDTOs = _wfNeeddeelService.GetList(wfRunProcessDTO.Id, "璐㈠姟瀹℃壒"); + + + + var wfHistoryDTOs = _mapper.Map<List<WfHistoryDTO>>(wfNeeddeelDTOs); + + var wfHistoryDTO = wfHistoryDTOs.Where(x => x.DeelUserId == Userid).FirstOrDefault(); + if (wfHistoryDTO == null) + { + result.Result = false; + result.Message = "鏈壘鍒颁唬鍔�"; + return result; + } + + wfHistoryDTO.Content = Content; + wfHistoryDTO.ChuliStatus = "2"; + wfHistoryDTO.Modifier = Userid; + wfHistoryDTO.Modifytime = DateTime.Now; + + + var wfHistories = _mapper.Map<List<WfHistory>>(wfHistoryDTOs); + foreach (var wfHistory in wfHistories) + { + _context.WfHistories.Add(wfHistory); + } + var wfNeeddeels = _mapper.Map<List<WfNeeddeel>>(wfNeeddeelDTOs); + foreach (var wfNeeddeel in wfNeeddeels) + { + //_wfNeeddeelService.ModifyStatus(wfNeeddeel.Id, Userid); + _context.WfNeeddeels.Remove(wfNeeddeel); + } + _context.SaveChanges(); + + //鏌ヨ澶勭悊浜� + var hrPositions = _context.PltRoles.Where(x => x.RecStatus == "A" && x.RoleName == "鎬荤粡鐞�").FirstOrDefault(); + if (hrPositions == null) + { + result.Result = false; + result.Message = "鏈壘鍒拌亴浣�"; + return result; + } + var pltUsers = (from a in _context.PltUsers.Where(x => x.RecStatus == "A" && x.Zhiwustatus == "A") + join b in _context.PltUserRoles.Where(x => x.RecStatus == "A" && x.RoleId == hrPositions.Id) on a.Id equals b.UserId + select a + ).ToList(); + + if (pltUsers == null || pltUsers.Count == 0) + { + result.Result = false; + result.Message = "鏈壘鍒板鐞嗕汉"; + return result; + } + + foreach (var pltUser in pltUsers) + { + //鎻掑叆鏂扮殑寰呭姙 + WfNeeddeelDTO wfNeeddeelDTO = new WfNeeddeelDTO(); + wfNeeddeelDTO.RunProcessId = wfRunProcessDTO.Id; + wfNeeddeelDTO.SendUserId = Userid; + wfNeeddeelDTO.DeelUserId = pltUser.Id; + wfNeeddeelDTO.Sendtime = DateTime.Now; + wfNeeddeelDTO.Resivetime = DateTime.Now; + wfNeeddeelDTO.Step = "鎬荤粡鐞嗗鎵�"; + wfNeeddeelDTO.NeeddeelType = "1"; + wfNeeddeelDTO.ChuliStatus = "0"; + wfNeeddeelDTO.Deelurl = "/AdmAsk/Askcost?id=" + DanjuId; + wfNeeddeelDTO.Content = ""; + wfNeeddeelDTO.Sort = 3; + wfNeeddeelDTO.RecStatus = "A"; + wfNeeddeelDTO.Creater = Userid; + wfNeeddeelDTO.Createtime = DateTime.Now; + wfNeeddeelDTO.Modifier = Userid; + wfNeeddeelDTO.Modifytime = wfNeeddeelDTO.Createtime; + result = _wfNeeddeelService.save(wfNeeddeelDTO); + if (result.Result == false) + { + return result; + } + } + } + else + { + wfRunProcessDTO.Step = "鎻愪氦"; + wfRunProcessDTO.Modifier = Userid; + wfRunProcessDTO.Modifytime = DateTime.Now; + result = this.save(wfRunProcessDTO); + if (result.Result == false) + { + return result; + } + + //鏇存柊寰呭姙 + List<WfNeeddeelDTO> wfNeeddeelDTOs = _wfNeeddeelService.GetList(wfRunProcessDTO.Id, "璐㈠姟瀹℃壒"); + var wfHistoryDTOs = _mapper.Map<List<WfHistoryDTO>>(wfNeeddeelDTOs); + + var wfHistoryDTO = wfHistoryDTOs.Where(x => x.DeelUserId == Userid).FirstOrDefault(); + if (wfHistoryDTO == null) + { + result.Result = false; + result.Message = "鏈壘鍒颁唬鍔�"; + return result; + } + wfHistoryDTO.Content = Content; + wfHistoryDTO.ChuliStatus = "1"; + wfHistoryDTO.Modifier = Userid; + wfHistoryDTO.Modifytime = DateTime.Now; + var wfHistories = _mapper.Map<List<WfHistory>>(wfHistoryDTOs); + foreach (var wfHistory in wfHistories) + { + _context.WfHistories.Add(wfHistory); + } + var wfNeeddeels = _mapper.Map<List<WfNeeddeel>>(wfNeeddeelDTOs); + foreach (var wfNeeddeel in wfNeeddeels) + { + //_wfNeeddeelService.ModifyStatus(wfNeeddeel.Id, Userid); + _context.WfNeeddeels.Remove(wfNeeddeel); + } + _context.SaveChanges(); + + + //鎻掑叆鏂扮殑寰呭姙 + WfNeeddeelDTO wfNeeddeelDTO = new WfNeeddeelDTO(); + wfNeeddeelDTO.RunProcessId = wfRunProcessDTO.Id; + wfNeeddeelDTO.SendUserId = Userid; + wfNeeddeelDTO.DeelUserId = wfRunProcessDTO.Creater; + wfNeeddeelDTO.Sendtime = DateTime.Now; + wfNeeddeelDTO.Resivetime = DateTime.Now; + wfNeeddeelDTO.Step = "鎻愪氦"; + wfNeeddeelDTO.NeeddeelType = "1"; + wfNeeddeelDTO.ChuliStatus = "0"; + wfNeeddeelDTO.Deelurl = "/AdmAsk/Askcost?id=" + DanjuId; + wfNeeddeelDTO.Content = ""; + wfNeeddeelDTO.Sort = 1; + wfNeeddeelDTO.RecStatus = "A"; + wfNeeddeelDTO.Creater = Userid; + wfNeeddeelDTO.Createtime = DateTime.Now; + wfNeeddeelDTO.Modifier = Userid; + wfNeeddeelDTO.Modifytime = wfNeeddeelDTO.Createtime; + result = _wfNeeddeelService.save(wfNeeddeelDTO); + if (result.Result == false) + { + return result; + } + + } + + + + + + } + + if (step == "鎬荤粡鐞嗗鎵�") + { + //鏇存柊娴佺▼瀹炰緥 + //WfRunProcessDTO wfRunProcessDTO = this.GetList(DanjuId, "04").FirstOrDefault(); + if (wfRunProcessDTO == null) + { + result.Result = false; + result.Message = "鏈壘鍒版祦绋嬪疄渚�"; + return result; + } + if (wfRunProcessDTO.Step != "鎬荤粡鐞嗗鎵�") + { + result.Result = false; + result.Message = "褰撳墠姝ラ宸茬粡澶勭悊"; + return result; + } + if (tongguojujue == "A") + { + + wfRunProcessDTO.Step = "瀹岀粨"; + wfRunProcessDTO.ShenpiStatus = "A"; + wfRunProcessDTO.Modifier = Userid; + wfRunProcessDTO.Modifytime = DateTime.Now; + result = this.save(wfRunProcessDTO); + if (result.Result == false) + { + return result; + } + //鏇存柊鍗曟嵁 + var admAskcost = _context.AdmAskcosts.Find(DanjuId); + if (wfRunProcessDTO == null) + { + result.Result = false; + result.Message = "鏈壘鍒板崟鎹�"; + return result; + } + admAskcost.ShenpiStatus = "A"; + _context.SaveChanges(); + + List<WfNeeddeelDTO> wfNeeddeelDTOs = _wfNeeddeelService.GetList(wfRunProcessDTO.Id, "鎬荤粡鐞嗗鎵�"); + + var wfHistoryDTOs = _mapper.Map<List<WfHistoryDTO>>(wfNeeddeelDTOs); + + var wfHistoryDTO = wfHistoryDTOs.Where(x => x.DeelUserId == Userid).FirstOrDefault(); + if (wfHistoryDTO == null) + { + result.Result = false; + result.Message = "鏈壘鍒颁唬鍔�"; + return result; + } + wfHistoryDTO.Content = Content; + wfHistoryDTO.ChuliStatus = "2"; + wfHistoryDTO.Modifier = Userid; + wfHistoryDTO.Modifytime = DateTime.Now; + var wfHistories = _mapper.Map<List<WfHistory>>(wfHistoryDTOs); + foreach (var wfHistory in wfHistories) + { + _context.WfHistories.Add(wfHistory); + } + var wfNeeddeels = _mapper.Map<List<WfNeeddeel>>(wfNeeddeelDTOs); + foreach (var wfNeeddeel in wfNeeddeels) + { + // _wfNeeddeelService.ModifyStatus(wfNeeddeel.Id, Userid); + _context.WfNeeddeels.Remove(wfNeeddeel); + } + _context.SaveChanges(); + } + else + { + wfRunProcessDTO.Step = "鎻愪氦"; + wfRunProcessDTO.Modifier = Userid; + wfRunProcessDTO.Modifytime = DateTime.Now; + result = this.save(wfRunProcessDTO); + if (result.Result == false) + { + return result; + } + + //鏇存柊寰呭姙 + List<WfNeeddeelDTO> wfNeeddeelDTOs = _wfNeeddeelService.GetList(wfRunProcessDTO.Id, "鎬荤粡鐞嗗鎵�"); + var wfHistoryDTOs = _mapper.Map<List<WfHistoryDTO>>(wfNeeddeelDTOs); + + var wfHistoryDTO = wfHistoryDTOs.Where(x => x.DeelUserId == Userid).FirstOrDefault(); + if (wfHistoryDTO == null) + { + result.Result = false; + result.Message = "鏈壘鍒颁唬鍔�"; + return result; + } + wfHistoryDTO.Content = Content; + wfHistoryDTO.ChuliStatus = "1"; + wfHistoryDTO.Modifier = Userid; + wfHistoryDTO.Modifytime = DateTime.Now; + var wfHistories = _mapper.Map<List<WfHistory>>(wfHistoryDTOs); + foreach (var wfHistory in wfHistories) + { + _context.WfHistories.Add(wfHistory); + } + var wfNeeddeels = _mapper.Map<List<WfNeeddeel>>(wfNeeddeelDTOs); + foreach (var wfNeeddeel in wfNeeddeels) + { + //_wfNeeddeelService.ModifyStatus(wfNeeddeel.Id, Userid); + _context.WfNeeddeels.Remove(wfNeeddeel); + } + _context.SaveChanges(); + + + //鎻掑叆鏂扮殑寰呭姙 + WfNeeddeelDTO wfNeeddeelDTO = new WfNeeddeelDTO(); + wfNeeddeelDTO.RunProcessId = wfRunProcessDTO.Id; + wfNeeddeelDTO.SendUserId = Userid; + wfNeeddeelDTO.DeelUserId = wfRunProcessDTO.Creater; + wfNeeddeelDTO.Sendtime = DateTime.Now; + wfNeeddeelDTO.Resivetime = DateTime.Now; + wfNeeddeelDTO.Step = "鎻愪氦"; + wfNeeddeelDTO.NeeddeelType = "1"; + wfNeeddeelDTO.ChuliStatus = "0"; + wfNeeddeelDTO.Deelurl = "/AdmAsk/Askcost?id=" + DanjuId; + wfNeeddeelDTO.Content = ""; + wfNeeddeelDTO.Sort = 1; + wfNeeddeelDTO.RecStatus = "A"; + wfNeeddeelDTO.Creater = Userid; + wfNeeddeelDTO.Createtime = DateTime.Now; + wfNeeddeelDTO.Modifier = Userid; + wfNeeddeelDTO.Modifytime = wfNeeddeelDTO.Createtime; + result = _wfNeeddeelService.save(wfNeeddeelDTO); + if (result.Result == false) + { + return result; + } + + } + + + + } + + + } + + + + return result; + } + + public ResultEntity WfAskGood(string DanjuId, string step, string tongguojujue, string Userid, string Content, string title, string version) + { + + ResultEntity result = new ResultEntity(); + result.Result = true; + + + WfRunProcessDTO wfRunProcessDTO = this.GetList(DanjuId, "05").FirstOrDefault(); + if (wfRunProcessDTO != null) + { + version = wfRunProcessDTO.Version; + } + + + if (version == "v1") + { + if (step == "鎻愪氦") + { + //鏇存柊娴佺▼瀹炰緥 + // WfRunProcessDTO wfRunProcessDTO = this.GetList(DanjuId, "05").FirstOrDefault(); + if (wfRunProcessDTO == null) + { + //鎻掑叆娴佺▼瀹炰緥 + wfRunProcessDTO = new WfRunProcessDTO(); + //wfRunProcessDTO.Applyno = + wfRunProcessDTO.Applytime = DateTime.Now; + wfRunProcessDTO.Applytiye = "05"; + wfRunProcessDTO.DanjuId = DanjuId; + wfRunProcessDTO.Content = title; + wfRunProcessDTO.Step = "琛屾斂瀹℃壒"; + wfRunProcessDTO.ShenpiStatus = "D"; + wfRunProcessDTO.Version = version; + wfRunProcessDTO.RecStatus = "A"; + wfRunProcessDTO.Creater = Userid; + wfRunProcessDTO.Createtime = DateTime.Now; + wfRunProcessDTO.Modifier = Userid; + wfRunProcessDTO.Modifytime = DateTime.Now; + wfRunProcessDTO.Deelurl = "/AdmAsk/AskGood?id=" + DanjuId; + result = this.save(wfRunProcessDTO); + if (result.Result == false) + { + return result; + } + //鏌ヨ澶勭悊浜� + var hrPositions = _context.PltRoles.Where(x => x.RecStatus == "A" && x.RoleName == "琛屾斂").FirstOrDefault(); + if (hrPositions == null) + { + result.Result = false; + result.Message = "鏈壘鍒拌亴浣�"; + return result; + } + var pltUsers = (from a in _context.PltUsers.Where(x => x.RecStatus == "A" && x.Zhiwustatus == "A") + join b in _context.PltUserRoles.Where(x => x.RecStatus == "A" && x.RoleId == hrPositions.Id) on a.Id equals b.UserId + select a + ).ToList(); + + if (pltUsers == null || pltUsers.Count == 0) + { + result.Result = false; + result.Message = "鏈壘鍒板鐞嗕汉"; + return result; + } + foreach (var pltUser in pltUsers) + { + //鎻掑叆寰呭姙 + WfNeeddeelDTO wfNeeddeelDTO = new WfNeeddeelDTO(); + wfNeeddeelDTO.RunProcessId = wfRunProcessDTO.Id; + wfNeeddeelDTO.SendUserId = Userid; + wfNeeddeelDTO.DeelUserId = pltUser.Id; + wfNeeddeelDTO.Sendtime = DateTime.Now; + wfNeeddeelDTO.Resivetime = DateTime.Now; + wfNeeddeelDTO.Step = "琛屾斂瀹℃壒"; + wfNeeddeelDTO.NeeddeelType = "1"; + wfNeeddeelDTO.ChuliStatus = "0"; + wfNeeddeelDTO.Deelurl = "/AdmAsk/AskGood?id=" + DanjuId; + wfNeeddeelDTO.Content = ""; + wfNeeddeelDTO.Sort = 1; + wfNeeddeelDTO.RecStatus = "A"; + wfNeeddeelDTO.Creater = Userid; + wfNeeddeelDTO.Createtime = DateTime.Now; + wfNeeddeelDTO.Modifier = Userid; + wfNeeddeelDTO.Modifytime = wfNeeddeelDTO.Createtime; + result = _wfNeeddeelService.save(wfNeeddeelDTO); + if (result.Result == false) + { + return result; + } + } + + //鎻掑叆鏂扮殑宸插姙 + WfHistory wfHistoryDTO1 = new WfHistory(); + wfHistoryDTO1.Id = Guid.NewGuid().ToString(); + wfHistoryDTO1.RunProcessId = wfRunProcessDTO.Id; + wfHistoryDTO1.SendUserId = Userid; + wfHistoryDTO1.DeelUserId = wfRunProcessDTO.Creater; + wfHistoryDTO1.Sendtime = DateTime.Now; + wfHistoryDTO1.Resivetime = DateTime.Now; + wfHistoryDTO1.Step = "鎻愪氦"; + wfHistoryDTO1.NeeddeelType = "1"; + wfHistoryDTO1.ChuliStatus = "2"; + wfHistoryDTO1.Deelurl = "/SalaryCheck/Appeal?id=" + DanjuId; + wfHistoryDTO1.Content = ""; + wfHistoryDTO1.Sort = 1; + wfHistoryDTO1.RecStatus = "A"; + wfHistoryDTO1.Creater = Userid; + wfHistoryDTO1.Createtime = DateTime.Now; + wfHistoryDTO1.Modifier = Userid; + wfHistoryDTO1.Modifytime = wfHistoryDTO1.Createtime; + _context.WfHistories.Add(wfHistoryDTO1); + _context.SaveChanges(); + } + else + { + wfRunProcessDTO.Step = "琛屾斂瀹℃壒"; + wfRunProcessDTO.Modifier = Userid; + wfRunProcessDTO.Modifytime = DateTime.Now; + result = this.save(wfRunProcessDTO); + if (result.Result == false) + { + return result; + } + + //鏇存柊寰呭姙 + List<WfNeeddeelDTO> wfNeeddeelDTOs = _wfNeeddeelService.GetList(wfRunProcessDTO.Id, "鎻愪氦"); + var wfHistoryDTOs = _mapper.Map<List<WfHistoryDTO>>(wfNeeddeelDTOs); + + var wfHistoryDTO = wfHistoryDTOs.Where(x => x.DeelUserId == Userid).FirstOrDefault(); + if (wfHistoryDTO == null) + { + result.Result = false; + result.Message = "鏈壘鍒颁唬鍔�"; + return result; + } + wfHistoryDTO.Content = Content; + wfHistoryDTO.ChuliStatus = "2"; + wfHistoryDTO.Modifier = Userid; + wfHistoryDTO.Modifytime = DateTime.Now; + var wfHistories = _mapper.Map<List<WfHistory>>(wfHistoryDTOs); + foreach (var wfHistory in wfHistories) + { + _context.WfHistories.Add(wfHistory); + } + var wfNeeddeels = _mapper.Map<List<WfNeeddeel>>(wfNeeddeelDTOs); + foreach (var wfNeeddeel in wfNeeddeels) + { + //_wfNeeddeelService.ModifyStatus(wfNeeddeel.Id, Userid); + _context.WfNeeddeels.Remove(wfNeeddeel); + } + _context.SaveChanges(); + + //鏌ヨ澶勭悊浜� + var hrPositions = _context.PltRoles.Where(x => x.RecStatus == "A" && x.RoleName == "琛屾斂").FirstOrDefault(); + if (hrPositions == null) + { + result.Result = false; + result.Message = "鏈壘鍒拌亴浣�"; + return result; + } + var pltUsers = (from a in _context.PltUsers.Where(x => x.RecStatus == "A" && x.Zhiwustatus == "A") + join b in _context.PltUserRoles.Where(x => x.RecStatus == "A" && x.RoleId == hrPositions.Id) on a.Id equals b.UserId + select a + ).ToList(); + + if (pltUsers == null || pltUsers.Count == 0) + { + result.Result = false; + result.Message = "鏈壘鍒板鐞嗕汉"; + return result; + } + + foreach (var pltUser in pltUsers) + { + //鎻掑叆鏂扮殑寰呭姙 + WfNeeddeelDTO wfNeeddeelDTO = new WfNeeddeelDTO(); + wfNeeddeelDTO.RunProcessId = wfRunProcessDTO.Id; + wfNeeddeelDTO.SendUserId = Userid; + wfNeeddeelDTO.DeelUserId = pltUser.Id; + wfNeeddeelDTO.Sendtime = DateTime.Now; + wfNeeddeelDTO.Resivetime = DateTime.Now; + wfNeeddeelDTO.Step = "琛屾斂瀹℃壒"; + wfNeeddeelDTO.NeeddeelType = "1"; + wfNeeddeelDTO.ChuliStatus = "0"; + wfNeeddeelDTO.Deelurl = "/AdmAsk/AskGood?id=" + DanjuId; + wfNeeddeelDTO.Content = ""; + wfNeeddeelDTO.Sort = 2; + wfNeeddeelDTO.RecStatus = "A"; + wfNeeddeelDTO.Creater = Userid; + wfNeeddeelDTO.Createtime = DateTime.Now; + wfNeeddeelDTO.Modifier = Userid; + wfNeeddeelDTO.Modifytime = wfNeeddeelDTO.Createtime; + result = _wfNeeddeelService.save(wfNeeddeelDTO); + if (result.Result == false) + { + return result; + } + } + } + + + + + } + + + if (step == "琛屾斂瀹℃壒") + { + //鏇存柊娴佺▼瀹炰緥 + //WfRunProcessDTO wfRunProcessDTO = this.GetList(DanjuId, "05").FirstOrDefault(); + if (wfRunProcessDTO == null) + { + result.Result = false; + result.Message = "鏈壘鍒版祦绋嬪疄渚�"; + return result; + } + if (wfRunProcessDTO.Step != "琛屾斂瀹℃壒") + { + result.Result = false; + result.Message = "褰撳墠姝ラ宸茬粡澶勭悊"; + return result; + } + if (tongguojujue == "A") + { + + wfRunProcessDTO.Step = "瀹岀粨"; + wfRunProcessDTO.ShenpiStatus = "A"; + wfRunProcessDTO.Modifier = Userid; + wfRunProcessDTO.Modifytime = DateTime.Now; + result = this.save(wfRunProcessDTO); + if (result.Result == false) + { + return result; + } + //鏇存柊鍗曟嵁 + var admAskGood = _context.AdmAskGoods.Find(DanjuId); + if (wfRunProcessDTO == null) + { + result.Result = false; + result.Message = "鏈壘鍒板崟鎹�"; + return result; + } + admAskGood.ShenpiStatus = "A"; + _context.SaveChanges(); + + List<WfNeeddeelDTO> wfNeeddeelDTOs = _wfNeeddeelService.GetList(wfRunProcessDTO.Id, "琛屾斂瀹℃壒"); + + var wfHistoryDTOs = _mapper.Map<List<WfHistoryDTO>>(wfNeeddeelDTOs); + + var wfHistoryDTO = wfHistoryDTOs.Where(x => x.DeelUserId == Userid).FirstOrDefault(); + if (wfHistoryDTO == null) + { + result.Result = false; + result.Message = "鏈壘鍒颁唬鍔�"; + return result; + } + wfHistoryDTO.Content = Content; + wfHistoryDTO.ChuliStatus = "2"; + wfHistoryDTO.Modifier = Userid; + wfHistoryDTO.Modifytime = DateTime.Now; + var wfHistories = _mapper.Map<List<WfHistory>>(wfHistoryDTOs); + foreach (var wfHistory in wfHistories) + { + _context.WfHistories.Add(wfHistory); + } + var wfNeeddeels = _mapper.Map<List<WfNeeddeel>>(wfNeeddeelDTOs); + foreach (var wfNeeddeel in wfNeeddeels) + { + // _wfNeeddeelService.ModifyStatus(wfNeeddeel.Id, Userid); + _context.WfNeeddeels.Remove(wfNeeddeel); + } + _context.SaveChanges(); + } + else + { + wfRunProcessDTO.Step = "鎻愪氦"; + wfRunProcessDTO.Modifier = Userid; + wfRunProcessDTO.Modifytime = DateTime.Now; + result = this.save(wfRunProcessDTO); + if (result.Result == false) + { + return result; + } + + //鏇存柊寰呭姙 + List<WfNeeddeelDTO> wfNeeddeelDTOs = _wfNeeddeelService.GetList(wfRunProcessDTO.Id, "琛屾斂瀹℃壒"); + var wfHistoryDTOs = _mapper.Map<List<WfHistoryDTO>>(wfNeeddeelDTOs); + + var wfHistoryDTO = wfHistoryDTOs.Where(x => x.DeelUserId == Userid).FirstOrDefault(); + if (wfHistoryDTO == null) + { + result.Result = false; + result.Message = "鏈壘鍒颁唬鍔�"; + return result; + } + wfHistoryDTO.Content = Content; + wfHistoryDTO.ChuliStatus = "1"; + wfHistoryDTO.Modifier = Userid; + wfHistoryDTO.Modifytime = DateTime.Now; + var wfHistories = _mapper.Map<List<WfHistory>>(wfHistoryDTOs); + foreach (var wfHistory in wfHistories) + { + _context.WfHistories.Add(wfHistory); + } + var wfNeeddeels = _mapper.Map<List<WfNeeddeel>>(wfNeeddeelDTOs); + foreach (var wfNeeddeel in wfNeeddeels) + { + //_wfNeeddeelService.ModifyStatus(wfNeeddeel.Id, Userid); + _context.WfNeeddeels.Remove(wfNeeddeel); + } + _context.SaveChanges(); + + + //鎻掑叆鏂扮殑寰呭姙 + WfNeeddeelDTO wfNeeddeelDTO = new WfNeeddeelDTO(); + wfNeeddeelDTO.RunProcessId = wfRunProcessDTO.Id; + wfNeeddeelDTO.SendUserId = Userid; + wfNeeddeelDTO.DeelUserId = wfRunProcessDTO.Creater; + wfNeeddeelDTO.Sendtime = DateTime.Now; + wfNeeddeelDTO.Resivetime = DateTime.Now; + wfNeeddeelDTO.Step = "鎻愪氦"; + wfNeeddeelDTO.NeeddeelType = "1"; + wfNeeddeelDTO.ChuliStatus = "0"; + wfNeeddeelDTO.Deelurl = "/AdmAsk/AskGood?id=" + DanjuId; + wfNeeddeelDTO.Content = ""; + wfNeeddeelDTO.Sort = 1; + wfNeeddeelDTO.RecStatus = "A"; + wfNeeddeelDTO.Creater = Userid; + wfNeeddeelDTO.Createtime = DateTime.Now; + wfNeeddeelDTO.Modifier = Userid; + wfNeeddeelDTO.Modifytime = wfNeeddeelDTO.Createtime; + result = _wfNeeddeelService.save(wfNeeddeelDTO); + if (result.Result == false) + { + return result; + } + + } + + + + } + + + } + + + + return result; + } } } diff --git a/zhengcaioa/zhengcaioa/Controllers/HR/SalaryCheckController.cs b/zhengcaioa/zhengcaioa/Controllers/HR/SalaryCheckController.cs index 12c1eea..cdbb115 100644 --- a/zhengcaioa/zhengcaioa/Controllers/HR/SalaryCheckController.cs +++ b/zhengcaioa/zhengcaioa/Controllers/HR/SalaryCheckController.cs @@ -240,12 +240,20 @@ data.shenpi_status = "D"; data.status = "A"; resultEntity = _hrSalaryService.CheckAppea(data); + if (!resultEntity.Result) + { + return new JsonResult(resultEntity); + } } //鍙戣捣娴佺▼鐩稿叧 resultEntity = _wfRunProcessService.WfSalaryAppeal(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); diff --git a/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs b/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs new file mode 100644 index 0000000..347ea6c --- /dev/null +++ b/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs @@ -0,0 +1,276 @@ +锘縰sing 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.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; + + public AdmAskController(ILogger<AdmAskController> logger, IAskService askService, IHrDeptService hrDeptService, IWfRunProcessService wfRunProcessService + , IWfHistoryService wfHistoryService, IWfNeeddeelService wfNeeddeelService + , IAdmGoodsManageService admGoodsManageService) + { + _logger = logger; + _hrDeptService = hrDeptService; + _askService = askService; + _wfRunProcessService = wfRunProcessService; + _wfHistoryService = wfHistoryService; + _wfNeeddeelService = wfNeeddeelService; + _admGoodsManageService = admGoodsManageService; + } + + 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); + } + } +} diff --git a/zhengcaioa/zhengcaioa/Startup.cs b/zhengcaioa/zhengcaioa/Startup.cs index b14aef3..5ead34a 100644 --- a/zhengcaioa/zhengcaioa/Startup.cs +++ b/zhengcaioa/zhengcaioa/Startup.cs @@ -145,6 +145,8 @@ services.AddScoped(typeof(IOrderBanciService), typeof(OrderBanciService)); services.AddScoped(typeof(IOrderBanciOrderService), typeof(OrderBanciOrderService)); + services.AddScoped(typeof(IAskService), typeof(AskService)); + //zcweb services.AddScoped(typeof(IDtChannelArticleNewsService), typeof(DtChannelArticleNewsService)); diff --git a/zhengcaioa/zhengcaioa/Views/AdmAsk/AskGood.cshtml b/zhengcaioa/zhengcaioa/Views/AdmAsk/AskGood.cshtml new file mode 100644 index 0000000..14e599b --- /dev/null +++ b/zhengcaioa/zhengcaioa/Views/AdmAsk/AskGood.cshtml @@ -0,0 +1,318 @@ +锘緻model AdmAskGoodDTO; +@using DTO; +@using zhengcaioa.Models; +@{ + Layout = null; + + //娴佺▼鐩稿叧 + string shifoubiaoji = ViewBag.shifoubiaoji as string; + string sifoudangqian = ViewBag.sifoudangqian as string; + string dangqianbuzhou = ViewBag.dangqianbuzhou as string; + + List<WfHistoryDTO> lishiyijian = ViewData["lishiyijian"] as List<WfHistoryDTO>; //鍘嗗彶鎰忚 + + List<AdmGoodsManageDTO> Goods = ViewData["Goods"] as List<AdmGoodsManageDTO>; //鍘嗗彶鎰忚 +} + +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> + <meta name="description" content=""> + <meta name="author" content="ThemeBucket"> + <link href="~/css/bootstrap.min.css" rel="stylesheet"> + <link href="~/css/font-awesome.min.css" rel="stylesheet"> + <link href="~/css/animate.min.css" rel="stylesheet"> + <link href="~/css/style.min.css" rel="stylesheet"> + <link href="~/css/plugins/chosen/chosen.css" rel="stylesheet"> + <link href="~/js/plugins/layer/skin/layer.css" rel="stylesheet"> + <link href="~/css/style.min.css" rel="stylesheet"> + <link href="~/css/plugins/toastr/toastr.min.css" rel="stylesheet" /> + + <!-- jqgrid--> + <script language="javascript" src="~/js/jquery.min.js" type="text/javascript"></script> + <script src="~/js/bootstrap.min.js"></script> + + <!--瀹瑰櫒--> + <script language="javascript" src="~/js/plugins/chosen/chosen.jquery.js" type="text/javascript"></script> + <script language="javascript" src="~/js/plugins/layer/layer.js" type="text/javascript"></script> + <script src="~/js/plugins/toastr/toastr.min.js" type="text/javascript"></script> + <script language="javascript" src="~/js/common-layout.js" type="text/javascript"></script> + <script src="~/js/plugins/layer/laydate/laydate.js" type="text/javascript"></script> + <script src="~/js/TUJS.js"></script> + + <style type="text/css"> + + div.clearfix > label { + padding-top: 8px; + } + + .col-md-1.control-label { + padding-right: 0px; + font-weight: 400; + } + </style> + + +</head> + +<body class="gray-bg" style="overflow:auto"> + <form id="fm" method="post"> + <div class="wrapper wrapper-content" id="ibox-content" style="padding:15px;"> + <div class="row"> + <div class="col-sm-12"> + <div class="ibox float-e-margins"> + <div id="div_content" class="ibox-content" style="background-color:white;"> + <div class="row"> + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label class="text-right col-sm-1 col-md-1 control-label">鍗曟嵁鍚嶇О<i class="red">*</i></label> + <div class="col-sm-2 col-md-2"> + <input type="text" class="form-control" value="@Model.Tittle" name="tittle" id="tittle" validate="RequiredField" autocomplete="off" readonly="readonly"> + + </div> + </div> + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label class="text-right col-sm-1 col-md-1 control-label">鐢宠浜�<i class="red">*</i></label> + <div class="col-sm-2 col-md-2"> + <input type="text" class="form-control" value="@Model.CreaterName" name="createrName" id="createrName" validate="RequiredField" autocomplete="off" readonly="readonly"> + + </div> + </div> + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label class="text-right col-sm-1 col-md-1 control-label">鐗╁搧鍚嶇О<i class="red">*</i></label> + <div class="col-sm-2 col-md-2"> + <select id="GoodsId" class="form-control" name="GoodsId" data-placeholder="閫夋嫨 搴忓垪 ..."> + <option value="" hassubinfo="true">璇烽�夋嫨</option> + @foreach (var item in Goods) + { + @if (!item.Id.Equals(Model.GoodsId)) + { + <option value="@item.Id" hassubinfo="true"> + @item.GoodsName + </option> + } + else + { + <option value="@item.Id" hassubinfo="true" selected="selected"> + @item.GoodsName + </option> + } + + } + + + </select> + </div> + </div> + + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label class="text-right col-sm-1 col-md-1 control-label">鐢宠鏁伴噺<i class="red">*</i></label> + <div class="col-sm-2 col-md-2"> + <input class="form-control" id="Shuliang" name="Shuliang" type="text" value="@Model.ShuliangName" oninput="if(value.length>10)value=value.slice(0,10)" onkeyup="value=value.toString().match(/^\d+(?:\.\d{0,2})?/)"> + </div> + </div> + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label class="text-right col-sm-1 col-md-1 control-label">鐢宠璇存槑</label> + <div class="col-sm-6 col-md-6"> + <textarea class="form-control bt" id="Remark" name="Remark" maxlength="4000" length="long" style="resize:none;overflow-y:hidden; height:80px;">@Model.Remark</textarea> + </div> + </div> + + + <div class="clearfix layer-area" style="padding-bottom:15px;" id="shenpiyijian"> + <label class="text-right col-sm-1 col-md-1 control-label">瀹℃壒鎰忚</label> + <div class="col-sm-6 col-md-6"> + <textarea class="form-control data" id="Content" name="Content" style="resize:none;overflow-y:hidden; height:80px;" maxlength="500"></textarea> + </div> + </div> + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label class="text-right col-sm-1 col-md-1 control-label">鍘嗗彶鎰忚</label> + <div class="col-sm-6 col-md-6"> + <table> + @if (lishiyijian.Count > 0) + { + <tr> + <td style="border:1px solid #ccc;width:150px;">姝ラ </td> + <td style="border:1px solid #ccc;width:150px;"> 鎵瑰鐘舵��</td> + <td style="border:1px solid #ccc;width:150px;">鎵瑰鏃堕棿</td> + <td style="border:1px solid #ccc;width:300px;"> 瀹℃壒鎰忚</td> + <td style="border:1px solid #ccc;width:100px;"> 鎵瑰浜�</td> + </tr> + } + + @foreach (var wfHistory in lishiyijian) + { + <tr> + <td style="border:1px solid #ccc;width:150px;">@wfHistory.Step</td> + <td style="border:1px solid #ccc;width:150px;">@wfHistory.ChuliStatusName</td> + <td style="border:1px solid #ccc;width:150px;">@wfHistory.ModifytimeName</td> + <td style="border:1px solid #ccc;width:300px;">@wfHistory.Content</td> + <td style="border:1px solid #ccc;width:100px;">@wfHistory.DeelUserIdName</td> + </tr> + } + </table> + </div> + </div> + <div class="clearfix layer-area" style="padding-bottom:60px;"> + + </div> + </div> + </div> + </div> + </div> + </div> + </div> + <div class="ibox-content" id="top" style="z-index:100; position:fixed; height:50px; width:100%;bottom:0; text-align: right; padding-top:8px "> + <div class="" style="float:right;" data-bootstro-width="500px"> + <a class="btn btn-success" href="javascript:void(0)" onclick="_pageAutoClose();" style="margin-left:4px; border-radius:4px;"> + <i class="glyphicon glyphicon-remove"></i> <span class="bold">鍙栨秷</span> + </a> + <a class="btn btn-success" id="tijiao" href="javascript:void(0)" onclick="saveSimCost('');" style="margin-left:4px; border-radius:4px;"> + <i class="glyphicon glyphicon-ok"></i> <span class="bold">鎻愪氦</span> + </a> + + <a class="btn btn-success" id="tongyi" href="javascript:void(0)" onclick="saveSimCost('A');" style="margin-left:4px; border-radius:4px;"> + <span class="bold">鍚屾剰</span> + </a> + + <a class="btn btn-success" id="jujue" href="javascript:void(0)" onclick="saveSimCost('D');" style="margin-left:4px; border-radius:4px;"> + <span class="bold">鎷掔粷</span> + </a> + <input type="hidden" id="id" name="id" value="@Model.Id" /> + <input type="hidden" id="Tongguojujue" name="Tongguojujue" value="" /> + <input type="hidden" id="Step" name="Step" value="@dangqianbuzhou" /> + </div> + </div> + + </form> + + <script type="text/javascript"> + + var hh = document.body.clientHeight - $("#top").height() * 2 - 50; + $("#div_content").height(hh); + + toastr.options = { + "closeButton": true, + "debug": false, + "progressBar": true, + "positionClass": "toast-bottom-right", + "onclick": null, + "showDuration": "300", + "hideDuration": "600", + "timeOut": "4500", + "extendedTimeOut": "600", + "showEasing": "swing", + "hideEasing": "linear", + "showMethod": "fadeIn", + "hideMethod": "fadeOut" + }; + + + $(function () { + + + + + + if ("@shifoubiaoji" != "A") { + $("input").attr('readonly', true); + $("textarea").attr('readonly', true); + $(':radio').attr('disabled', true); + $(':checkbox').attr('disabled', true); + $(':button').attr('disabled', true); + //$('a').removeAttr('onclick'); + $('select').attr('disabled', true); + $("#fileUp").attr('disabled', true); + + $('.fujianshanchu').removeAttr('onclick'); + + + if ("@sifoudangqian" == "A") { + $("#Content").attr('readonly', false); + $('#tijiao').hide(); + } else { + $('#tongyi').hide(); + $('#jujue').hide(); + $('#tijiao').hide(); + $('#shenpiyijian').hide(); + } + + } else { + + + //瀹℃壒鐩稿叧 + $('#shenpiyijian').hide(); + if ("@sifoudangqian" == "A") { + $('#tongyi').hide(); + $('#jujue').hide(); + $('#GoodsId').chosen(); + } else { + $('#tongyi').hide(); + $('#jujue').hide(); + $('#tijiao').hide(); + } + + + } + + }) + + + // 淇濆瓨 + function saveSimCost(tongyi) { + + + if ($.trim($("#GoodsId").val()) == '') { + toastr.warning("鐗╁搧鍚嶇О涓嶈兘涓虹┖"); + return; + } + if ($.trim($("#Shuliang").val()) == '') { + toastr.warning("鐢宠鏁伴噺涓嶈兘涓虹┖"); + return; + } + + $("#Tongguojujue").val(tongyi); + + $.ajax({ + type: "POST", + url: "/AdmAsk/SaveAskGood", + dataType: "json", + global: false, + data: $('#fm').serialize(), + success: function (data) { + + if (data.Result) { + parent.layer.msg('鎻愪氦鎴愬姛', { icon: 6 }); + try { + _pageAutoClose();//鑷姩鍏抽棴椤甸潰鏂规硶 + } + catch (err) { + var pathname = window.location.pathname; + var search = window.location.search; + parent._CloseTab1(pathname + search); + } + } + else { + parent.layer.msg(data.Message, { icon: 5 }); + } + + }, + error: function () { + parent.layer.msg('澶辫触', { icon: 5 }); + } + }); + } + + + function _pageAutoClose() { + parent.window._reloadPageData(); + var index = parent.layer.getFrameIndex(window.name); + parent.layer.isRefresh = true; + parent.layer.closeAll('loading'); + parent.layer.close(index); + return false; + } + </script> +</body> +</html> \ No newline at end of file diff --git a/zhengcaioa/zhengcaioa/Views/AdmAsk/Askcost.cshtml b/zhengcaioa/zhengcaioa/Views/AdmAsk/Askcost.cshtml new file mode 100644 index 0000000..a26d2e3 --- /dev/null +++ b/zhengcaioa/zhengcaioa/Views/AdmAsk/Askcost.cshtml @@ -0,0 +1,289 @@ +锘緻model AdmAskcostDTO; +@using DTO; +@using zhengcaioa.Models; +@{ + Layout = null; + + //娴佺▼鐩稿叧 + string shifoubiaoji = ViewBag.shifoubiaoji as string; + string sifoudangqian = ViewBag.sifoudangqian as string; + string dangqianbuzhou = ViewBag.dangqianbuzhou as string; + + List<WfHistoryDTO> lishiyijian = ViewData["lishiyijian"] as List<WfHistoryDTO>; //鍘嗗彶鎰忚 +} + +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> + <meta name="description" content=""> + <meta name="author" content="ThemeBucket"> + <link href="~/css/bootstrap.min.css" rel="stylesheet"> + <link href="~/css/font-awesome.min.css" rel="stylesheet"> + <link href="~/css/animate.min.css" rel="stylesheet"> + <link href="~/css/style.min.css" rel="stylesheet"> + <link href="~/css/plugins/chosen/chosen.css" rel="stylesheet"> + <link href="~/js/plugins/layer/skin/layer.css" rel="stylesheet"> + <link href="~/css/style.min.css" rel="stylesheet"> + <link href="~/css/plugins/toastr/toastr.min.css" rel="stylesheet" /> + + <!-- jqgrid--> + <script language="javascript" src="~/js/jquery.min.js" type="text/javascript"></script> + <script src="~/js/bootstrap.min.js"></script> + + <!--瀹瑰櫒--> + <script language="javascript" src="~/js/plugins/chosen/chosen.jquery.js" type="text/javascript"></script> + <script language="javascript" src="~/js/plugins/layer/layer.js" type="text/javascript"></script> + <script src="~/js/plugins/toastr/toastr.min.js" type="text/javascript"></script> + <script language="javascript" src="~/js/common-layout.js" type="text/javascript"></script> + <script src="~/js/plugins/layer/laydate/laydate.js" type="text/javascript"></script> + <script src="~/js/TUJS.js"></script> + + <style type="text/css"> + + div.clearfix > label { + padding-top: 8px; + } + + .col-md-1.control-label { + padding-right: 0px; + font-weight: 400; + } + </style> + + +</head> + +<body class="gray-bg" style="overflow:auto"> + <form id="fm" method="post"> + <div class="wrapper wrapper-content" id="ibox-content" style="padding:15px;"> + <div class="row"> + <div class="col-sm-12"> + <div class="ibox float-e-margins"> + <div id="div_content" class="ibox-content" style="background-color:white;"> + <div class="row"> + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label class="text-right col-sm-1 col-md-1 control-label">鍗曟嵁鍚嶇О<i class="red">*</i></label> + <div class="col-sm-2 col-md-2"> + <input type="text" class="form-control" value="@Model.Tittle" name="tittle" id="tittle" validate="RequiredField" autocomplete="off" readonly="readonly"> + + </div> + </div> + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label class="text-right col-sm-1 col-md-1 control-label">鐢宠浜�<i class="red">*</i></label> + <div class="col-sm-2 col-md-2"> + <input type="text" class="form-control" value="@Model.CreaterName" name="createrName" id="createrName" validate="RequiredField" autocomplete="off" readonly="readonly"> + + </div> + </div> + + + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label class="text-right col-sm-1 col-md-1 control-label">浜嬬敱<i class="red">*</i></label> + <div class="col-sm-6 col-md-6"> + <textarea class="form-control bt" id="Remark" name="Remark" maxlength="4000" length="long" style="resize:none;overflow-y:hidden; height:80px;">@Model.Remark</textarea> + </div> + </div> + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label class="text-right col-sm-1 col-md-1 control-label">鐢宠璐圭敤<i class="red">*</i></label> + <div class="col-sm-2 col-md-2"> + <input class="form-control" id="Cost" name="Cost" type="text" value="@Model.CostName" oninput="if(value.length>10)value=value.slice(0,10)" onkeyup="value=value.toString().match(/^\d+(?:\.\d{0,2})?/)"> + </div> + </div> + + <div class="clearfix layer-area" style="padding-bottom:15px;" id="shenpiyijian"> + <label class="text-right col-sm-1 col-md-1 control-label">瀹℃壒鎰忚</label> + <div class="col-sm-6 col-md-6"> + <textarea class="form-control data" id="Content" name="Content" style="resize:none;overflow-y:hidden; height:80px;" maxlength="500"></textarea> + </div> + </div> + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label class="text-right col-sm-1 col-md-1 control-label">鍘嗗彶鎰忚</label> + <div class="col-sm-6 col-md-6"> + <table> + @if (lishiyijian.Count > 0) + { + <tr> + <td style="border:1px solid #ccc;width:150px;">姝ラ </td> + <td style="border:1px solid #ccc;width:150px;"> 鎵瑰鐘舵��</td> + <td style="border:1px solid #ccc;width:150px;">鎵瑰鏃堕棿</td> + <td style="border:1px solid #ccc;width:300px;"> 瀹℃壒鎰忚</td> + <td style="border:1px solid #ccc;width:100px;"> 鎵瑰浜�</td> + </tr> + } + + @foreach (var wfHistory in lishiyijian) + { + <tr> + <td style="border:1px solid #ccc;width:150px;">@wfHistory.Step</td> + <td style="border:1px solid #ccc;width:150px;">@wfHistory.ChuliStatusName</td> + <td style="border:1px solid #ccc;width:150px;">@wfHistory.ModifytimeName</td> + <td style="border:1px solid #ccc;width:300px;">@wfHistory.Content</td> + <td style="border:1px solid #ccc;width:100px;">@wfHistory.DeelUserIdName</td> + </tr> + } + </table> + </div> + </div> + <div class="clearfix layer-area" style="padding-bottom:60px;"> + + </div> + </div> + </div> + </div> + </div> + </div> + </div> + <div class="ibox-content" id="top" style="z-index:100; position:fixed; height:50px; width:100%;bottom:0; text-align: right; padding-top:8px "> + <div class="" style="float:right;" data-bootstro-width="500px"> + <a class="btn btn-success" href="javascript:void(0)" onclick="_pageAutoClose();" style="margin-left:4px; border-radius:4px;"> + <i class="glyphicon glyphicon-remove"></i> <span class="bold">鍙栨秷</span> + </a> + <a class="btn btn-success" id="tijiao" href="javascript:void(0)" onclick="saveSimCost('');" style="margin-left:4px; border-radius:4px;"> + <i class="glyphicon glyphicon-ok"></i> <span class="bold">鎻愪氦</span> + </a> + + <a class="btn btn-success" id="tongyi" href="javascript:void(0)" onclick="saveSimCost('A');" style="margin-left:4px; border-radius:4px;"> + <span class="bold">鍚屾剰</span> + </a> + + <a class="btn btn-success" id="jujue" href="javascript:void(0)" onclick="saveSimCost('D');" style="margin-left:4px; border-radius:4px;"> + <span class="bold">鎷掔粷</span> + </a> + <input type="hidden" id="id" name="id" value="@Model.Id" /> + <input type="hidden" id="Tongguojujue" name="Tongguojujue" value="" /> + <input type="hidden" id="Step" name="Step" value="@dangqianbuzhou" /> + </div> + </div> + + </form> + + <script type="text/javascript"> + + var hh = document.body.clientHeight - $("#top").height() * 2 - 50; + $("#div_content").height(hh); + + toastr.options = { + "closeButton": true, + "debug": false, + "progressBar": true, + "positionClass": "toast-bottom-right", + "onclick": null, + "showDuration": "300", + "hideDuration": "600", + "timeOut": "4500", + "extendedTimeOut": "600", + "showEasing": "swing", + "hideEasing": "linear", + "showMethod": "fadeIn", + "hideMethod": "fadeOut" + }; + + + $(function () { + + + + + + if ("@shifoubiaoji" != "A") { + $("input").attr('readonly', true); + $("textarea").attr('readonly', true); + $(':radio').attr('disabled', true); + $(':checkbox').attr('disabled', true); + $(':button').attr('disabled', true); + //$('a').removeAttr('onclick'); + $('select').attr('disabled', true); + $("#fileUp").attr('disabled', true); + + $('.fujianshanchu').removeAttr('onclick'); + + + if ("@sifoudangqian" == "A") { + $("#Content").attr('readonly', false); + $('#tijiao').hide(); + } else { + $('#tongyi').hide(); + $('#jujue').hide(); + $('#tijiao').hide(); + $('#shenpiyijian').hide(); + } + + } else { + + + //瀹℃壒鐩稿叧 + $('#shenpiyijian').hide(); + if ("@sifoudangqian" == "A") { + $('#tongyi').hide(); + $('#jujue').hide(); + } else { + $('#tongyi').hide(); + $('#jujue').hide(); + $('#tijiao').hide(); + } + + + } + + }) + + + // 淇濆瓨 + function saveSimCost(tongyi) { + + + if ($.trim($("#Remark").val()) == '') { + toastr.warning("浜嬬敱涓嶈兘涓虹┖"); + return; + } + if ($.trim($("#Cost").val()) == '') { + toastr.warning("鐢宠璐圭敤涓嶈兘涓虹┖"); + return; + } + + $("#Tongguojujue").val(tongyi); + + $.ajax({ + type: "POST", + url: "/AdmAsk/SaveAskcost", + dataType: "json", + global: false, + data: $('#fm').serialize(), + success: function (data) { + + if (data.Result) { + parent.layer.msg('鎻愪氦鎴愬姛', { icon: 6 }); + try { + _pageAutoClose();//鑷姩鍏抽棴椤甸潰鏂规硶 + } + catch (err) { + var pathname = window.location.pathname; + var search = window.location.search; + parent._CloseTab1(pathname + search); + } + } + else { + parent.layer.msg(data.Message, { icon: 5 }); + } + + }, + error: function () { + parent.layer.msg('澶辫触', { icon: 5 }); + } + }); + } + + + function _pageAutoClose() { + parent.window._reloadPageData(); + var index = parent.layer.getFrameIndex(window.name); + parent.layer.isRefresh = true; + parent.layer.closeAll('loading'); + parent.layer.close(index); + return false; + } + </script> +</body> +</html> \ No newline at end of file diff --git a/zhengcaioa/zhengcaioa/Views/WorkFlowTask/Index.cshtml b/zhengcaioa/zhengcaioa/Views/WorkFlowTask/Index.cshtml index 92e23f4..9404444 100644 --- a/zhengcaioa/zhengcaioa/Views/WorkFlowTask/Index.cshtml +++ b/zhengcaioa/zhengcaioa/Views/WorkFlowTask/Index.cshtml @@ -20,7 +20,7 @@ { label: '鐢宠浜�', name: 'CreaterName', labtype: 'txt', hidden: false, width: 100 }, { label: '璇风ず鍚嶇О', name: 'Content', labtype: 'txt', hidden: false, width: 100 }, { label: '姝ラ', name: 'Step', labtype: 'txt', hidden: false, width: 100 }, - + //{ label: '鎵瑰鐘舵��', name: 'ShenpiStatusName', labtype: 'txt', hidden: false, width: 100 }, { label: '瀹℃壒', name: 'Remark', labtype: 'txt', hidden: false, width: 100, formatter: function (cellvalue, options, rowObject) { diff --git a/zhengcaioa/zhengcaioa/Views/WorkFlowTask/IndexYiBan.cshtml b/zhengcaioa/zhengcaioa/Views/WorkFlowTask/IndexYiBan.cshtml index cdb716e..790fd83 100644 --- a/zhengcaioa/zhengcaioa/Views/WorkFlowTask/IndexYiBan.cshtml +++ b/zhengcaioa/zhengcaioa/Views/WorkFlowTask/IndexYiBan.cshtml @@ -20,6 +20,7 @@ { label: '鐢宠浜�', name: 'CreaterName', labtype: 'txt', hidden: false, width: 100 }, { label: '璇风ず鍚嶇О', name: 'Content', labtype: 'txt', hidden: false, width: 100 }, { label: '姝ラ', name: 'Step', labtype: 'txt', hidden: false, width: 100 }, + { label: '鎵瑰鐘舵��', name: 'ShenpiStatusName', labtype: 'txt', hidden: false, width: 100 }, { label: '鏌ョ湅', name: 'Remark', labtype: 'txt', hidden: false, width: 100, formatter: function (cellvalue, options, rowObject) { diff --git "a/\350\241\250\344\277\256\346\224\271.sql" "b/\350\241\250\344\277\256\346\224\271.sql" index 7d13546..9b994bc 100644 --- "a/\350\241\250\344\277\256\346\224\271.sql" +++ "b/\350\241\250\344\277\256\346\224\271.sql" @@ -1,5 +1,202 @@ USE [zhengcaioa] GO + +/****** Object: Table [dbo].[ADM_AskGoods] Script Date: 2021/7/23 8:54:23 ******/ +SET ANSI_NULLS ON +GO + +SET QUOTED_IDENTIFIER ON +GO + +CREATE TABLE [dbo].[ADM_AskGoods]( + [Id] [nvarchar](50) NOT NULL, + [GoodsId] [nvarchar](50) NULL, + [Shuliang] [money] NULL, + + [Remark] [nvarchar](500) NULL, + [shenpi_status] [nvarchar](1) NULL, + [rec_status] [nvarchar](1) NOT NULL, + [creater] [nvarchar](50) NOT NULL, + [createtime] [datetime] NOT NULL, + [modifier] [nvarchar](50) NOT NULL, + [modifytime] [datetime] NOT NULL, + [createrName] [nvarchar](50) NULL, + [tittle] [nvarchar](50) NULL, + CONSTRAINT [PK__AskGoods__3214EC077AC5FA48] PRIMARY KEY CLUSTERED +( + [Id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY] +) ON [PRIMARY] +GO + + + +ALTER TABLE [dbo].[ADM_AskGoods] ADD DEFAULT ((0)) FOR [Shuliang] +GO +ALTER TABLE [dbo].[ADM_AskGoods] ADD DEFAULT ('D') FOR [shenpi_status] +GO + +ALTER TABLE [dbo].[ADM_AskGoods] ADD DEFAULT ('A') FOR [rec_status] +GO + +ALTER TABLE [dbo].[ADM_AskGoods] ADD DEFAULT ('1') FOR [creater] +GO + +ALTER TABLE [dbo].[ADM_AskGoods] ADD DEFAULT (getdate()) FOR [createtime] +GO + +ALTER TABLE [dbo].[ADM_AskGoods] ADD DEFAULT ('1') FOR [modifier] +GO + +ALTER TABLE [dbo].[ADM_AskGoods] ADD DEFAULT (getdate()) FOR [modifytime] +GO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +USE [zhengcaioa] +GO + +/****** Object: Table [dbo].[ADM_Askcost] Script Date: 2021/7/23 8:54:23 ******/ +SET ANSI_NULLS ON +GO + +SET QUOTED_IDENTIFIER ON +GO + +CREATE TABLE [dbo].[ADM_Askcost]( + [Id] [nvarchar](50) NOT NULL, + + [Cost] [money] NULL, + + [Remark] [nvarchar](500) NULL, + [shenpi_status] [nvarchar](1) NULL, + [rec_status] [nvarchar](1) NOT NULL, + [creater] [nvarchar](50) NOT NULL, + [createtime] [datetime] NOT NULL, + [modifier] [nvarchar](50) NOT NULL, + [modifytime] [datetime] NOT NULL, + [createrName] [nvarchar](50) NULL, + [tittle] [nvarchar](50) NULL, + CONSTRAINT [PK__Askcost__3214EC077AC5FA48] PRIMARY KEY CLUSTERED +( + [Id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY] +) ON [PRIMARY] +GO + + + +ALTER TABLE [dbo].[ADM_Askcost] ADD DEFAULT ((0)) FOR [Cost] +GO +ALTER TABLE [dbo].[ADM_Askcost] ADD DEFAULT ('D') FOR [shenpi_status] +GO + +ALTER TABLE [dbo].[ADM_Askcost] ADD DEFAULT ('A') FOR [rec_status] +GO + +ALTER TABLE [dbo].[ADM_Askcost] ADD DEFAULT ('1') FOR [creater] +GO + +ALTER TABLE [dbo].[ADM_Askcost] ADD DEFAULT (getdate()) FOR [createtime] +GO + +ALTER TABLE [dbo].[ADM_Askcost] ADD DEFAULT ('1') FOR [modifier] +GO + +ALTER TABLE [dbo].[ADM_Askcost] ADD DEFAULT (getdate()) FOR [modifytime] +GO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +USE [zhengcaioa] +GO ALTER TABLE [dbo].[plt_user] ADD [yaoqingma] [nvarchar](50) NULL GO -- Gitblit v1.9.1