From 558dae4a18d393ac38daa43a354e8bc9a22e4e26 Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期四, 02 十一月 2023 16:52:59 +0800 Subject: [PATCH] 班次安排座位 --- zhengcaioa/Services/OrderBanciOrderService.cs | 31 + zhengcaioa/IServices/IOrderBanciService.cs | 5 zhengcaioa/zhengcaioa/Controllers/BusinessOrder/OrderBanciController.cs | 301 +++++++++++++++++ zhengcaioa/zhengcaioa/Views/OrderBanci/Edit.cshtml | 39 ++ zhengcaioa/zhengcaioa/Views/OrderBanci/Index.cshtml | 10 zhengcaioa/Model/OrderBanci.cs | 2 zhengcaioa/Services/OrderBanciService.cs | 125 +++++++ zhengcaioa/Model/zhengcaioaContext.cs | 70 ++++ zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs | 3 zhengcaioa/Model/OrderBanciOrder.cs | 2 zhengcaioa/DTO/OrderBanciOrderDTO.cs | 2 zhengcaioa/zhengcaioa/Views/OrderBanciOrder/Indexzhuanjia.cshtml | 1 zhengcaioa/DTO/OrderBanciDTO.cs | 19 + zhengcaioa/Model/OrderBanciZuowei.cs | 23 + zhengcaioa/DTO/OrderBanciZuoweiDTO.cs | 22 + zhengcaioa/zhengcaioa/appsettings.Development.json | 7 zhengcaioa/zhengcaioa/Views/OrderBanci/Liuzuo.cshtml | 330 +++++++++++++++++++ zhengcaioa/zhengcaioa/appsettings.json | 3 18 files changed, 984 insertions(+), 11 deletions(-) diff --git a/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs b/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs index 6a4cfdd..cd7bfce 100644 --- a/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs +++ b/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs @@ -348,6 +348,9 @@ CreateMap<FrameworkUser, FrameworkUserDTO>(); CreateMap<FrameworkUserDTO, FrameworkUser>(); + + CreateMap<OrderBanciZuowei, OrderBanciZuoweiDTO>(); + CreateMap<OrderBanciZuoweiDTO, OrderBanciZuowei>(); } } } diff --git a/zhengcaioa/DTO/OrderBanciDTO.cs b/zhengcaioa/DTO/OrderBanciDTO.cs index 7f5a364..c436c8a 100644 --- a/zhengcaioa/DTO/OrderBanciDTO.cs +++ b/zhengcaioa/DTO/OrderBanciDTO.cs @@ -19,9 +19,13 @@ public string Modifier { get; set; } public DateTime Modifytime { get; set; } public List<OrderBanciDtlDTO> orderBanciDtlDTOs{ get; set; } + + public List<List<OrderBanciZuoweiDTO>> orderBanciZuoweiDTOs { get; set; } public string Mingcheng { get; set; } public int? Renshu { get; set; } + public int? Hang { get; set; } + public int? Lie { get; set; } public string Shangxiawu { get; set; } public string ShangxiawuName { get; set; } @@ -45,6 +49,7 @@ public string id { get; set; } + public string[] SeatID { get; set; } } public class OrderBanciDTOSearch : SearchEntity @@ -57,4 +62,18 @@ public string Createtime { get; set; } } + + + + + public class LockUser + { + public string ID { get; set; } + + public string Name { get; set; } + + public string LockSeatsUserID { get; set; } + + public string ClassID { get; set; } + } } diff --git a/zhengcaioa/DTO/OrderBanciOrderDTO.cs b/zhengcaioa/DTO/OrderBanciOrderDTO.cs index 568178c..e0d72ea 100644 --- a/zhengcaioa/DTO/OrderBanciOrderDTO.cs +++ b/zhengcaioa/DTO/OrderBanciOrderDTO.cs @@ -30,6 +30,8 @@ public string OrderId { get; set; } public decimal? Jifen { get; set; } public string JifenName { get; set; } + public string SeatID { get; set; } + public string SeatName { get; set; } } public class OrderBanciOrderDTOSearch : SearchEntity diff --git a/zhengcaioa/DTO/OrderBanciZuoweiDTO.cs b/zhengcaioa/DTO/OrderBanciZuoweiDTO.cs new file mode 100644 index 0000000..7bbe873 --- /dev/null +++ b/zhengcaioa/DTO/OrderBanciZuoweiDTO.cs @@ -0,0 +1,22 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace DTO +{ + public class OrderBanciZuoweiDTO + { + public string Id { get; set; } + public string BanciId { get; set; } + public string ZuoweiId { get; set; } + public string SeatNo { get; set; } + public string Status { get; set; } + public int? RowNo { get; set; } + public int? ColNo { 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; } + } +} diff --git a/zhengcaioa/IServices/IOrderBanciService.cs b/zhengcaioa/IServices/IOrderBanciService.cs index 0e3eb60..d84946c 100644 --- a/zhengcaioa/IServices/IOrderBanciService.cs +++ b/zhengcaioa/IServices/IOrderBanciService.cs @@ -23,5 +23,10 @@ List<OrderBanciDTO> GetJifenBanciList(); + + ResultEntity saveZuowei(OrderBanciZuoweiDTO dto); + + + List<OrderBanciZuoweiDTO> GetOrderBanciZuoweiList(string banciId); } } diff --git a/zhengcaioa/Model/OrderBanci.cs b/zhengcaioa/Model/OrderBanci.cs index 58b827a..6d212c5 100644 --- a/zhengcaioa/Model/OrderBanci.cs +++ b/zhengcaioa/Model/OrderBanci.cs @@ -19,5 +19,7 @@ public DateTime Modifytime { get; set; } public string Mingcheng { get; set; } public int? Renshu { get; set; } + public int? Hang { get; set; } + public int? Lie { get; set; } } } diff --git a/zhengcaioa/Model/OrderBanciOrder.cs b/zhengcaioa/Model/OrderBanciOrder.cs index 7abdb93..9f67d80 100644 --- a/zhengcaioa/Model/OrderBanciOrder.cs +++ b/zhengcaioa/Model/OrderBanciOrder.cs @@ -27,5 +27,7 @@ public string Shenfenzheng { get; set; } public string OrderId { get; set; } public decimal? Jifen { get; set; } + public string SeatID { get; set; } + public string SeatName { get; set; } } } diff --git a/zhengcaioa/Model/OrderBanciZuowei.cs b/zhengcaioa/Model/OrderBanciZuowei.cs new file mode 100644 index 0000000..eacaf65 --- /dev/null +++ b/zhengcaioa/Model/OrderBanciZuowei.cs @@ -0,0 +1,23 @@ +锘縰sing System; +using System.Collections.Generic; + +#nullable disable + +namespace zhengcaioa.Models +{ + public partial class OrderBanciZuowei + { + public string Id { get; set; } + public string BanciId { get; set; } + public string ZuoweiId { get; set; } + public string SeatNo { get; set; } + public string Status { get; set; } + public int? RowNo { get; set; } + public int? ColNo { 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; } + } +} diff --git a/zhengcaioa/Model/zhengcaioaContext.cs b/zhengcaioa/Model/zhengcaioaContext.cs index ac5a519..3327256 100644 --- a/zhengcaioa/Model/zhengcaioaContext.cs +++ b/zhengcaioa/Model/zhengcaioaContext.cs @@ -97,6 +97,7 @@ public virtual DbSet<OrderBanci> OrderBancis { get; set; } public virtual DbSet<OrderBanciDtl> OrderBanciDtls { get; set; } public virtual DbSet<OrderBanciOrder> OrderBanciOrders { get; set; } + public virtual DbSet<OrderBanciZuowei> OrderBanciZuoweis { get; set; } public virtual DbSet<PltAuth> PltAuths { get; set; } public virtual DbSet<PltPage> PltPages { get; set; } public virtual DbSet<PltRole> PltRoles { get; set; } @@ -4833,6 +4834,12 @@ entity.Property(e => e.Renshu) .HasColumnName("renshu"); + entity.Property(e => e.Hang) + .HasColumnName("hang"); + + entity.Property(e => e.Lie) + .HasColumnName("lie"); + entity.Property(e => e.Shijian) .HasColumnType("datetime") .HasColumnName("shijian"); @@ -4944,6 +4951,14 @@ .HasColumnType("money") .HasColumnName("jifen"); + entity.Property(e => e.SeatID) + .HasMaxLength(50) + .HasColumnName("SeatID"); + + entity.Property(e => e.SeatName) + .HasMaxLength(50) + .HasColumnName("SeatName"); + entity.Property(e => e.Kechengleixing) .HasMaxLength(100) .HasColumnName("kechengleixing"); @@ -4998,6 +5013,61 @@ .HasColumnName("xuefei"); }); + modelBuilder.Entity<OrderBanciZuowei>(entity => + { + entity.ToTable("order_banci_zuowei"); + + entity.Property(e => e.Id).HasMaxLength(50); + + entity.Property(e => e.BanciId) + .HasMaxLength(50) + .HasColumnName("banciId"); + + entity.Property(e => e.ColNo).HasColumnName("colNo"); + + entity.Property(e => e.Creater) + .IsRequired() + .HasMaxLength(50) + .HasColumnName("creater") + .HasDefaultValueSql("('1')"); + + 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.RowNo).HasColumnName("rowNo"); + + entity.Property(e => e.SeatNo) + .HasMaxLength(50) + .HasColumnName("seatNo"); + + entity.Property(e => e.Status) + .HasMaxLength(1) + .HasColumnName("status"); + + entity.Property(e => e.ZuoweiId) + .HasMaxLength(50) + .HasColumnName("zuoweiId"); + }); + modelBuilder.Entity<PltAuth>(entity => { entity.ToTable("plt_auth"); diff --git a/zhengcaioa/Services/OrderBanciOrderService.cs b/zhengcaioa/Services/OrderBanciOrderService.cs index debcdd8..4c9970d 100644 --- a/zhengcaioa/Services/OrderBanciOrderService.cs +++ b/zhengcaioa/Services/OrderBanciOrderService.cs @@ -41,6 +41,18 @@ entity.OrderId = dto.Id; } _context.OrderBanciOrders.Add(entity); + + if (!string.IsNullOrEmpty(dto.SeatID)) + { + var orderBanciZuowei = _context.OrderBanciZuoweis.Where(x => x.RecStatus == "A" && x.BanciId == dto.BanciId && x.ZuoweiId == dto.SeatID).FirstOrDefault(); + if (orderBanciZuowei != null) + { + orderBanciZuowei.Status = "1"; + orderBanciZuowei.Modifier = dto.Creater; + orderBanciZuowei.Modifytime = dto.Createtime; + } + } + } else { @@ -65,6 +77,8 @@ updateproject.Shenfenzheng = entity.Shenfenzheng; updateproject.Jifen = entity.Jifen; updateproject.OrderId = entity.OrderId; + updateproject.SeatID = entity.SeatID; + updateproject.SeatName = entity.SeatName; } _context.SaveChanges(); @@ -179,7 +193,8 @@ Baomingrenshu = a.Baomingrenshu??0, Jine = a.Jine??0, Jifen = a.Jifen ?? 0, - + SeatID = a.SeatID, + SeatName = a.SeatName, Creater = a.Creater, Createtime = a.Createtime, @@ -280,6 +295,20 @@ model.RecStatus = "D"; model.Modifier = "1"; model.Modifytime = DateTime.Now; + + if (!string.IsNullOrEmpty(model.SeatID)) + { + var orderBanciZuowei = _context.OrderBanciZuoweis.Where(x => x.RecStatus == "A" && x.BanciId == model.BanciId && x.ZuoweiId == model.SeatID).FirstOrDefault(); + if (orderBanciZuowei != null) + { + orderBanciZuowei.Status = "0"; + orderBanciZuowei.Modifier = model.Modifier; + orderBanciZuowei.Modifytime = model.Modifytime; + } + } + + + _context.SaveChanges(); } diff --git a/zhengcaioa/Services/OrderBanciService.cs b/zhengcaioa/Services/OrderBanciService.cs index 5125b06..c108375 100644 --- a/zhengcaioa/Services/OrderBanciService.cs +++ b/zhengcaioa/Services/OrderBanciService.cs @@ -52,8 +52,66 @@ updateproject.Modifier = entity.Modifier; updateproject.Modifytime = entity.Modifytime; updateproject.Mingcheng = entity.Mingcheng; - updateproject.Renshu = entity.Renshu; + updateproject.Renshu = entity.Renshu; + updateproject.Hang = entity.Hang; + updateproject.Lie = entity.Lie; } + if(entity.Hang.HasValue && entity.Lie.HasValue) + { + var orderBanciZuoweis = _context.OrderBanciZuoweis.Where(x =>x.RecStatus == "A" && x.BanciId == entity.Id).ToList(); + + + + for(int i=0;i< entity.Hang.Value; i++) + { + for (int j = 0; j < entity.Lie.Value; j++) + { + var orderBanciZuowei = orderBanciZuoweis.Where(x => x.RowNo == (i + 1) && x.ColNo == (j + 1)).FirstOrDefault(); + if(orderBanciZuowei == null) + { + var orderBanciZuoweisss = new OrderBanciZuowei(); + orderBanciZuoweisss.Id = Guid.NewGuid().ToString(); + orderBanciZuoweisss.BanciId = entity.Id; + orderBanciZuoweisss.ZuoweiId = (i + 1)+"-"+ (j + 1); + orderBanciZuoweisss.SeatNo = (i + 1) + "-" + (j + 1) + "搴�"; + orderBanciZuoweisss.Status = "0"; + orderBanciZuoweisss.RowNo = (i+1); + orderBanciZuoweisss.ColNo = (j+1); + orderBanciZuoweisss.RecStatus = "A"; + orderBanciZuoweisss.Creater = string.IsNullOrEmpty(entity.Creater)? entity.Modifier : entity.Creater; + orderBanciZuoweisss.Createtime = DateTime.Now; + orderBanciZuoweisss.Modifier = orderBanciZuoweisss.Creater; + orderBanciZuoweisss.Modifytime = orderBanciZuoweisss.Createtime; + _context.OrderBanciZuoweis.Add(orderBanciZuoweisss); + } + } + } + + //鍒犻櫎澶氫綑鐨勫骇浣� + var orderBanciZuoweisdel = orderBanciZuoweis.Where(x => x.RowNo > entity.Hang.Value || x.ColNo > entity.Lie.Value).ToList(); + if (orderBanciZuoweisdel != null && orderBanciZuoweisdel.Count > 0) + { + foreach (var orderBanciZuowei in orderBanciZuoweisdel) + { + orderBanciZuowei.RecStatus = "D"; + } + } + + + } + else + { + //濡傛灉娌℃湁搴т綅灏卞垹闄ゆ墍鏈夊骇浣� + var orderBanciZuoweis = _context.OrderBanciZuoweis.Where(x => x.RecStatus == "A" && x.BanciId == entity.Id).ToList(); + if(orderBanciZuoweis!=null && orderBanciZuoweis.Count > 0) + { + foreach ( var orderBanciZuowei in orderBanciZuoweis) + { + orderBanciZuowei.RecStatus = "D"; + } + } + } + _context.SaveChanges(); resultEntity.ReturnID = entity.Id; @@ -166,6 +224,10 @@ Mingcheng = a.Mingcheng, Renshu = a.Renshu??0, + + Hang = a.Hang ?? 0, + + Lie = a.Lie ?? 0, Creater = a.Creater, @@ -300,7 +362,8 @@ Didian = a.Didian, Renshu = a.Renshu ?? 0, - + Hang = a.Hang ?? 0, + Lie = a.Lie ?? 0, Creater = a.Creater, Createtime = a.Createtime, @@ -330,5 +393,63 @@ return query; } + + public ResultEntity saveZuowei(OrderBanciZuoweiDTO dto) + { + ResultEntity resultEntity = new ResultEntity(); + try + { + + + var entity = _mapper.Map<OrderBanciZuowei>(dto); + + + if (String.IsNullOrEmpty(entity.Id)) + { + entity.Id = Guid.NewGuid().ToString(); + dto.Id = entity.Id; + _context.OrderBanciZuoweis.Add(entity); + } + else + { + var updateproject = _context.OrderBanciZuoweis.Find(entity.Id); + + updateproject.BanciId = entity.BanciId; + updateproject.ZuoweiId = entity.ZuoweiId; + + updateproject.SeatNo = entity.SeatNo; + updateproject.Status = entity.Status; + + updateproject.RowNo = entity.RowNo; + updateproject.ColNo = entity.ColNo; + + updateproject.RecStatus = entity.RecStatus; + updateproject.Modifier = entity.Modifier; + updateproject.Modifytime = entity.Modifytime; + + } + + _context.SaveChanges(); + resultEntity.ReturnID = entity.Id; + resultEntity.Result = true; + } + catch (Exception ex) + { + resultEntity.Result = false; + resultEntity.Message = "淇濆瓨澶辫触锛岃鑱旂郴绠$悊鍛�"; + + } + return resultEntity; + } + + public List<OrderBanciZuoweiDTO> GetOrderBanciZuoweiList(string banciId) + { + var listRole = _context.OrderBanciZuoweis.Where(r => r.RecStatus == "A" && r.BanciId == banciId).OrderBy(x=>x.RowNo).ThenBy(x=>x.ColNo).ToList(); + + + var list = _mapper.Map<List<OrderBanciZuoweiDTO>>(listRole); + + return list; + } } } diff --git a/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/OrderBanciController.cs b/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/OrderBanciController.cs index f8849fc..3161d05 100644 --- a/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/OrderBanciController.cs +++ b/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/OrderBanciController.cs @@ -17,6 +17,8 @@ using zhengcaioa.IService; using CommonToolsCore; using Services; +using Microsoft.Extensions.Configuration; +using Newtonsoft.Json.Linq; namespace zhengcaioa.Controllers.BusinessOrder { @@ -28,15 +30,21 @@ private readonly IOrderBanciService _orderBanciService; private readonly IOrderBanciDtlService _orderBanciDtlService; private readonly IPltPageService _pltPageService; + private readonly IConfiguration _configuration; + private readonly IHttpClientFactory _clientFactory; public OrderBanciController(ILogger<OrderBanciController> logger, ILiaotianService liaotianService, IOrderBanciService orderBanciService, IOrderBanciDtlService orderBanciDtlService - , IPltPageService pltPageService) + , IPltPageService pltPageService + , IConfiguration configuration + , IHttpClientFactory clientFactory) { _logger = logger; _liaotianService = liaotianService; _orderBanciService = orderBanciService; _orderBanciDtlService = orderBanciDtlService; _pltPageService = pltPageService; + _configuration = configuration; + _clientFactory = clientFactory; } [CheckLogin] @@ -131,6 +139,221 @@ ViewData.Model = dto; return View(); + } + + + + //鍚庡彴鐣欏骇 + [CheckLogin] + public async Task<IActionResult> LiuzuoAsync(string id = null) + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + //var pageEntities = _pltPageService.GetUserPage(curentuser.Id, "/OrderBanci/Index/"); + //var pageEntities2 = pageEntities.Where(x => x.PageMethod == "02").ToList(); + //ViewData["ActionInfo2"] = pageEntities2; + + var orderBanciDTO = _orderBanciService.Get(id); + + + if (orderBanciDTO.Hang.HasValue && orderBanciDTO.Lie.HasValue) + { + //鏌ヨ搴т綅淇℃伅 + var orderBanciZuoweiDTOs = _orderBanciService.GetOrderBanciZuoweiList(orderBanciDTO.Id); + + try + { + string huiyuanurl = _configuration.GetSection("huiyuanurl").Value; + string GetTrainingCoursesLockIDSeatId = _configuration.GetSection("GetTrainingCoursesLockIDSeatId").Value; + string url = huiyuanurl + GetTrainingCoursesLockIDSeatId + "?ClassID=" + orderBanciDTO.id; + Uri postUrl2 = new Uri(url); + + string result2 = string.Empty; + + + + var httpClient2 = _clientFactory.CreateClient(); + httpClient2.Timeout = new TimeSpan(0, 0, 10); + var Result2 = await httpClient2.GetAsync(postUrl2); + result2 = Result2.Content.ReadAsStringAsync().Result; + + + _logger.LogInformation("result2:" + result2); + JObject jobjectresult = (JObject)JsonConvert.DeserializeObject(result2); + + if (jobjectresult["code"] != null && jobjectresult["code"].ToString() == "1") + { + List<LockUser> lockUsers = JsonConvert.DeserializeObject<List<LockUser>>(jobjectresult["data"].ToString()); + + + foreach (var orderBanciZuoweiDTO in orderBanciZuoweiDTOs) + { + foreach (var lockUser in lockUsers) + { + if (orderBanciZuoweiDTO.ZuoweiId == lockUser.ID) + { + orderBanciZuoweiDTO.Status = "1"; + break; + } + } + } + + } + } + catch (Exception ex) + { + + } + + var orderBanciZuoweiDTOsret = new List<List<OrderBanciZuoweiDTO>>(); + for (int i = 0; i < orderBanciDTO.Hang; i++) + { + var orderBanciZuoweiDTOs1 = orderBanciZuoweiDTOs.Where(x => x.RowNo == (i + 1)).ToList(); + orderBanciZuoweiDTOsret.Add(orderBanciZuoweiDTOs1); + } + + + //鏌ヨ琚敤鎴烽攣瀹氱殑搴т綅 + orderBanciDTO.orderBanciZuoweiDTOs = orderBanciZuoweiDTOsret; + } + + ViewData.Model = orderBanciDTO; + return View(); + } + + + /// <summary> + /// 淇濆瓨鐣欎綔淇℃伅 + /// </summary> + /// <param name="data">宀椾綅瀹炰綋绫诲璞�</param> + /// <returns></returns> + /// + [CheckLogin] + [HttpPost] + public async Task<IActionResult> SaveLiuzuoAsync(OrderBanciDTO data) + { + + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + ResultEntity resultEntity = new ResultEntity(); + resultEntity.Result = true; + var orderBanciZuoweiDTOs = _orderBanciService.GetOrderBanciZuoweiList(data.Id); + + + + + if (data.SeatID!=null&& data.SeatID.Length > 0) + { + //鏌ヨ琚敤鎴烽攣瀹氱殑搴т綅 + try + { + string huiyuanurl = _configuration.GetSection("huiyuanurl").Value; + string GetTrainingCoursesLockIDSeatId = _configuration.GetSection("GetTrainingCoursesLockIDSeatId").Value; + string url = huiyuanurl + GetTrainingCoursesLockIDSeatId + "?ClassID=" + data.Id; + Uri postUrl2 = new Uri(url); + + string result2 = string.Empty; + + + + var httpClient2 = _clientFactory.CreateClient(); + httpClient2.Timeout = new TimeSpan(0, 0, 10); + var Result2 = await httpClient2.GetAsync(postUrl2); + result2 = Result2.Content.ReadAsStringAsync().Result; + + + _logger.LogInformation("result2:" + result2); + JObject jobjectresult = (JObject)JsonConvert.DeserializeObject(result2); + + if (jobjectresult["code"] != null && jobjectresult["code"].ToString() == "1") + { + List<LockUser> lockUsers = JsonConvert.DeserializeObject<List<LockUser>>(jobjectresult["data"].ToString()); + + + foreach (var SeatID in data.SeatID) + { + foreach (var lockUser in lockUsers) + { + if (SeatID == lockUser.ID) + { + resultEntity = new ResultEntity(); + resultEntity.Result = false; + resultEntity.Message = lockUser.Name + "搴т綅宸茬粡琚鎴烽�変腑锛佹棤娉曢鐣�"; + return new JsonResult(resultEntity); + } + } + } + + } + } + catch (Exception ex) + { + + } + + foreach (var seat in data.SeatID) + { + var orderBanciZuoweiDTO = orderBanciZuoweiDTOs.Where(x => x.ZuoweiId == seat).FirstOrDefault(); + if(orderBanciZuoweiDTO.Status == "1") + { + resultEntity = new ResultEntity(); + resultEntity.Result = false; + resultEntity.Message = orderBanciZuoweiDTO.SeatNo +"搴т綅宸茬粡琚鎴烽�変腑锛佹棤娉曢鐣�"; + return new JsonResult(resultEntity); + } + else if (orderBanciZuoweiDTO.Status == "0") + { + orderBanciZuoweiDTO.Status = "2"; + orderBanciZuoweiDTO.Modifier = curentuser.Id; + orderBanciZuoweiDTO.Modifytime = DateTime.Now; + resultEntity = _orderBanciService.saveZuowei(orderBanciZuoweiDTO); + } + } + + var delete = orderBanciZuoweiDTOs.Where(x => !data.SeatID.Contains(x.ZuoweiId)).ToList(); + if (delete != null && delete.Count > 0) + { + foreach (var orderBanciZuoweiDTO in delete) + { + if (orderBanciZuoweiDTO.Status == "2") + { + orderBanciZuoweiDTO.Status = "0"; + orderBanciZuoweiDTO.Modifier = curentuser.Id; + orderBanciZuoweiDTO.Modifytime = DateTime.Now; + resultEntity = _orderBanciService.saveZuowei(orderBanciZuoweiDTO); + } + } + } + + + + } + else + { + foreach (var orderBanciZuoweiDTO in orderBanciZuoweiDTOs) + { + if (orderBanciZuoweiDTO.Status == "2") + { + orderBanciZuoweiDTO.Status = "0"; + orderBanciZuoweiDTO.Modifier = curentuser.Id; + orderBanciZuoweiDTO.Modifytime = DateTime.Now; + resultEntity = _orderBanciService.saveZuowei(orderBanciZuoweiDTO); + } + + } + } + + + + + + + + + + + + return new JsonResult(resultEntity); } @@ -341,7 +564,7 @@ } - public IActionResult GetBanciAll(string id) + public async Task<IActionResult> GetBanciAllAsync(string id) { ReturnMsg<OrderBanciDTO> returnMsg = new ReturnMsg<OrderBanciDTO>(); returnMsg.code = 2; @@ -361,9 +584,83 @@ searchEntity.rows = 1000; searchEntity.OrderBanciId = id; orderBanciDTO.orderBanciDtlDTOs = _orderBanciDtlService.SearchByPaging(searchEntity).DataList; + if(orderBanciDTO.Hang.HasValue && orderBanciDTO.Lie.HasValue) + { + //鏌ヨ搴т綅淇℃伅 + var orderBanciZuoweiDTOs = _orderBanciService.GetOrderBanciZuoweiList(orderBanciDTO.id); + //鏌ヨ琚敤鎴烽攣瀹氱殑搴т綅 + try + { + string huiyuanurl = _configuration.GetSection("huiyuanurl").Value; + string GetTrainingCoursesLockIDSeatId = _configuration.GetSection("GetTrainingCoursesLockIDSeatId").Value; + string url = huiyuanurl + GetTrainingCoursesLockIDSeatId + "?ClassID=" + orderBanciDTO.id; + Uri postUrl2 = new Uri(url); + + string result2 = string.Empty; + + + + var httpClient2 = _clientFactory.CreateClient(); + httpClient2.Timeout = new TimeSpan(0, 0, 10); + var Result2 = await httpClient2.GetAsync(postUrl2); + result2 = Result2.Content.ReadAsStringAsync().Result; + + + _logger.LogInformation("result2:" + result2); + JObject jobjectresult = (JObject)JsonConvert.DeserializeObject(result2); + + if (jobjectresult["code"] != null && jobjectresult["code"].ToString() == "1") + { + List<LockUser> lockUsers = JsonConvert.DeserializeObject<List<LockUser>>(jobjectresult["data"].ToString()); + + + foreach (var orderBanciZuoweiDTO in orderBanciZuoweiDTOs) + { + foreach(var lockUser in lockUsers) + { + if(orderBanciZuoweiDTO.ZuoweiId == lockUser.ID) + { + orderBanciZuoweiDTO.Status = "1"; + break; + } + } + } + + } + } + catch (Exception ex) + { + + } + + + + + + var orderBanciZuoweiDTOsret = new List<List<OrderBanciZuoweiDTO>>(); + for (int i = 0; i < orderBanciDTO.Hang; i++) + { + var orderBanciZuoweiDTOs1 = orderBanciZuoweiDTOs.Where(x => x.RowNo == (i + 1)).ToList(); + orderBanciZuoweiDTOsret.Add(orderBanciZuoweiDTOs1); + } + + + + + + + orderBanciDTO.orderBanciZuoweiDTOs = orderBanciZuoweiDTOsret; + } + + + + + returnMsg.code = 1; returnMsg.count = 1; returnMsg.returnObj = orderBanciDTO; + + } } diff --git a/zhengcaioa/zhengcaioa/Views/OrderBanci/Edit.cshtml b/zhengcaioa/zhengcaioa/Views/OrderBanci/Edit.cshtml index f003ea8..ee2ebab 100644 --- a/zhengcaioa/zhengcaioa/Views/OrderBanci/Edit.cshtml +++ b/zhengcaioa/zhengcaioa/Views/OrderBanci/Edit.cshtml @@ -166,9 +166,44 @@ <label grouptype="Vdata" class="text-right col-sm-1 col-md-1 control-label">浜烘暟<i class="red">*</i></label> <div class="col-sm-2 col-md-2" grouptype="Vdata"> - <input class="form-control" label="浜烘暟" name="Renshu" id="Renshu" labtype="txt" addvisible="true" maxlength="100" editvisible="true" reg="" ismust="true" type="text" value="@Model.Renshu" oninput="if(value.length>8)value=value.slice(0,10)" onkeyup = "value=value.replace(/[^\d]/g,'')" > + <input class="form-control" label="浜烘暟" name="Renshu" id="Renshu" labtype="txt" addvisible="true" maxlength="100" editvisible="true" reg="" ismust="true" type="text" value="@Model.Renshu" oninput="if(value.length>8)value=value.slice(0,10)" onkeyup="value=value.replace(/[^\d]/g,'')"> - + + + </div> + + + + </div> + + + <div class="clearfix layer-area" style="padding-bottom:15px;"> + + + + + <label grouptype="Vdata" class="text-right col-sm-1 col-md-1 control-label">搴т綅琛屾暟</label> + <div class="col-sm-2 col-md-2" grouptype="Vdata"> + <input class="form-control" label="浜烘暟" name="Hang" id="Hang" labtype="txt" addvisible="true" maxlength="100" editvisible="true" reg="" ismust="true" type="text" value="@Model.Hang" oninput="if(value.length>8)value=value.slice(0,10)" onkeyup="value=value.replace(/[^\d]/g,'')"> + + + + </div> + + + + </div> + + <div class="clearfix layer-area" style="padding-bottom:15px;"> + + + + + <label grouptype="Vdata" class="text-right col-sm-1 col-md-1 control-label">搴т綅鍒楁暟</label> + <div class="col-sm-2 col-md-2" grouptype="Vdata"> + <input class="form-control" label="浜烘暟" name="Lie" id="Lie" labtype="txt" addvisible="true" maxlength="100" editvisible="true" reg="" ismust="true" type="text" value="@Model.Lie" oninput="if(value.length>8)value=value.slice(0,10)" onkeyup="value=value.replace(/[^\d]/g,'')"> + + </div> diff --git a/zhengcaioa/zhengcaioa/Views/OrderBanci/Index.cshtml b/zhengcaioa/zhengcaioa/Views/OrderBanci/Index.cshtml index 15a0877..8673c1f 100644 --- a/zhengcaioa/zhengcaioa/Views/OrderBanci/Index.cshtml +++ b/zhengcaioa/zhengcaioa/Views/OrderBanci/Index.cshtml @@ -22,6 +22,8 @@ { label: '缁撴潫鏃堕棿', name: 'ShijianendName', labtype: 'txt', hidden: false, width: 200 }, { label: '鍦扮偣', name: 'Didian', labtype: 'txt', hidden: false, width: 400 }, { label: '浜烘暟', name: 'Renshu', labtype: 'txt', hidden: false, width: 200 }, + { label: '搴т綅琛屾暟', name: 'Hang', labtype: 'txt', hidden: false, width: 200 }, + { label: '搴т綅鍒楁暟', name: 'Lie', labtype: 'txt', hidden: false, width: 200 }, { label: '璇剧▼浠锋牸', name: 'Creater', labtype: 'txt', hidden: false, width: 100, formatter: function (cellvalue, options, rowObject) { @@ -29,6 +31,14 @@ } }, + { + label: '鐣欏骇', name: 'Liuzuo', labtype: 'txt', hidden: false, width: 100, + formatter: function (cellvalue, options, rowObject) { + return "<a onclick=\"OpenWindow('" + rowObject.Banci.replace(/'/g, '') + "','98%','100%', '/OrderBanci/Liuzuo?id=" + rowObject.Id + "')\" >鐣欏骇</a>"; + // return "<a class='Jiage' style='display: none;' onclick=\"OpenWindow('" + rowObject.Banci.replace(/'/g, '') + "','98%','100%', '/OrderBanci/IndexDtl?OrderBanciId=" + rowObject.Id + "')\" >鐣欏骇</a>"; + } + }, + ]; dataUrl = "/OrderBanci/GetList"; diff --git a/zhengcaioa/zhengcaioa/Views/OrderBanci/Liuzuo.cshtml b/zhengcaioa/zhengcaioa/Views/OrderBanci/Liuzuo.cshtml new file mode 100644 index 0000000..81a2369 --- /dev/null +++ b/zhengcaioa/zhengcaioa/Views/OrderBanci/Liuzuo.cshtml @@ -0,0 +1,330 @@ +锘緻model DTO.OrderBanciDTO +@using DTO; +@using zhengcaioa.Models; +@{ + + + + +} +@{ + Layout = null; +} + +<!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"> + <title>@(SiteConfig.SiteName)</title> + <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/plugins/iCheck/custom.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/plugins/datapicker/datepicker3.css" rel="stylesheet">*@ + <link href="~/css/style.min.css" rel="stylesheet"> + <link href="~/css/plugins/toastr/toastr.min.css" rel="stylesheet" /> + <link href="~/css/plugins/webuploader/webuploader.css" rel="stylesheet" /> + + <style type="text/css"> + .webuploader-pick { + position: relative; + display: inline-block; + cursor: pointer; + background: #00b7ee; + padding: 8px 14px 7px 14px; + color: #fff; + text-align: center; + border-radius: 3px; + overflow: hidden; + } + + div.clearfix > label { + padding-top: 8px; + } + + .chosen-container { + border-radius: 1px; + border: 1px solid #e5e6e7; + } + + .col-md-1.control-label { + padding-right: 0px; + font-weight: 400; + } + + + + .row { + display: flex; + padding-left: 20px; + } + + .seat { + /* display: inline-block; */ + width: 60px; + height: 45px; + text-align: center; + line-height: 45px; + border: 1px solid #ccc; + } + + .available { + background-color: #eee; + } + + .selected { + background-color: #00ff00; + } + + .booked { + background-color: #ff0000; + } + + #seat-map { + width: 100%; + } + </style> + + <!-- jqgrid--> + @*<link href="~/css/plugins/jqgrid/ui.jqgrid.css" rel="stylesheet">*@ + <script language="javascript" src="~/js/jquery.min.js" type="text/javascript"></script> + <script src="~/js/bootstrap.min.js"></script> + @*<script src="~/js/plugins/bootstro/bootstro.js"></script>*@ + + <!--瀹瑰櫒--> + @*<script language="javascript" src="~/js/datehelper.js" type="text/javascript"></script>*@ + @*<script language="javascript" src="~/js/plugins/query/jquery.query-object.js" type="text/javascript"></script>*@ + @*<script language="javascript" src="~/js/plugins/iCheck/icheck.min.js" type="text/javascript"></script>*@ + <script language="javascript" src="~/js/plugins/chosen/chosen.jquery.js" type="text/javascript"></script> + @*<script language="javascript" src="~/js/plugins/datapicker/bootstrap-datepicker.js" type="text/javascript"></script>*@ + <script language="javascript" src="~/js/plugins/layer/layer.js" type="text/javascript"></script> + @*<script src="~/js/plugins/jqgrid/jquery.jqGrid.min.js" type="text/javascript"></script>*@ + @*<script src="~/js/plugins/jqgrid/i18n/grid.locale-cn.js" type="text/javascript"></script>*@ + <script src="~/js/plugins/toastr/toastr.min.js" type="text/javascript"></script> + <script src="~/js/plugins/webuploader/webuploader.min.js"></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/plugins/iTexbox/itextbox.js" type="text/javascript"></script>*@ + @*<script src="~/js/plugins/iuploader/iuploader.js"></script>*@ + <script src="~/js/TUJS.js"></script> +</head> +<body class="gray-bg" style="overflow:auto"> + <form id="formtest"> + <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 class="ibox-title"> + <h5> <i class="fa fa-list"></i> 棰勭暀搴т綅</h5> + </div> + <div id="div_content" class="ibox-content" style="background-color:white;"> + <div class="row"> + <input type="hidden" id="Id" name="Id" value="@Model.Id" /> + <div id="seat-map"> + <!-- 鍦ㄨ繖閲岀敓鎴愬骇浣嶅浘 --> + </div> + + + + + + + + + </div> + </div> + </div> + </div> + </div> + </div> + <div class="wrapper wrapper-content" style="margin-top:0px"></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" data-bootstro-content="鍔熻兘鎸夐挳锛氣�滀繚瀛樷�濓紝鈥滃垹闄も��"> + + + <a class="btn btn-success Update" href="javascript:void(0)" onclick="savePosition();" style="margin-left: 4px; border-radius: 4px;"> + <i class="glyphicon glyphicon-ok"></i> <span class="bold">鎻愪氦</span> + </a> + </div> + </div> + + </form> + <script type="text/javascript"> + var hh = document.body.clientHeight - $('.ibox-title').height() - $("#top").height() * 2 - 95; + $("#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" + }; + + + var id = '@Model.Id'; + + + + + // 淇濆瓨宀椾綅淇℃伅 + var savePosition = function () { + + + var selectedSeats = $(".selected"); + var selectedSeatNumbers = []; + selectedSeats.each(function () { + selectedSeatNumbers.push($(this).attr("id")); + }); + console.log("閫変腑鐨勫骇浣嶏細" + selectedSeatNumbers.join(", ")); + + + + //if ($("#Shijian").val() == '') { + // toastr.warning("寮�濮嬫椂闂翠笉鑳戒负绌�"); + // return; + //} + + //if ($("#Shijianend").val() == '') { + // toastr.warning("缁撴潫鏃堕棿涓嶈兘涓虹┖"); + // return; + //} + + //if ($.trim($("#Banci").val()) == '') { + // toastr.warning("鐝涓嶈兘涓虹┖"); + // return; + //} + //if ($.trim($("#Mingcheng").val()) == '') { + // toastr.warning("鍚嶇О涓嶈兘涓虹┖"); + // return; + //} + //if ($.trim($("#Renshu").val()) == '') { + // toastr.warning("浜烘暟涓嶈兘涓虹┖"); + // return; + //} + + //if ($.trim($("#Didian").val()) == '') { + // toastr.warning("鍦扮偣涓嶈兘涓虹┖"); + // return; + //} + + + + + + + + var data = { Id: id, SeatID: selectedSeatNumbers }; + $.ajax({ + type: "POST", + url: "/OrderBanci/SaveLiuzuo", + dataType: "json", + global: false, + data: data, + success: function (data) { + + + + if (data.Result) { + // parent._afterSave(true); + parent.layer.msg('鎴愬姛淇濆瓨', { icon: 6 }); + //window.location = "/Project/add?id=" + data.ReturnID; + + + try { + _pageAutoClose();//鑷姩鍏抽棴椤甸潰鏂规硶 + } + catch (err) { + parent._CloseTab1("/OrderBanci/Liuzuo/"); + } + + } + else { + // toastr.error("澶辫触"); + 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; + } + var seatData = JSON.parse( '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.orderBanciZuoweiDTOs))'); + + + // 鐢熸垚搴т綅鍥剧殑閫昏緫 + function generateSeatMap() { + var seatMap = $("#seat-map"); + for (var row = 0; row < seatData.length; row++) { + var rowElement = $("<div class='row'></div>"); + for (var seat = 0; seat < seatData[row].length; seat++) { + console.log(seatData[row]) + var elrow = seatData[row][seat]; + console.log(elrow) + + var seatElement = $("<div class='seat' id='" + elrow.ZuoweiId+"' ></div>"); + seatElement.text(elrow.SeatNo); + if (elrow.Status == 0) {//寰呭敭 + seatElement.addClass("available"); + seatElement.click(function () { + $(this).toggleClass("selected"); + }); + + } + else if (elrow.Status == 2) {//棰勫畾 + seatElement.addClass("available"); + seatElement.addClass("selected"); + seatElement.click(function () { + $(this).toggleClass("selected"); + }); + + } + else { + seatElement.addClass("booked"); + } + rowElement.append(seatElement); + } + seatMap.append(rowElement); + } + } + + + // 鍒濆鍖� + generateSeatMap(); + + </script> +</body> +</html> \ No newline at end of file diff --git a/zhengcaioa/zhengcaioa/Views/OrderBanciOrder/Indexzhuanjia.cshtml b/zhengcaioa/zhengcaioa/Views/OrderBanciOrder/Indexzhuanjia.cshtml index a09f697..f3390e1 100644 --- a/zhengcaioa/zhengcaioa/Views/OrderBanciOrder/Indexzhuanjia.cshtml +++ b/zhengcaioa/zhengcaioa/Views/OrderBanciOrder/Indexzhuanjia.cshtml @@ -30,6 +30,7 @@ { label: '瀛﹁垂', name: 'Xuefei', labtype: 'txt', hidden: false, width: 70 }, { label: '鎶ュ悕浜烘暟', name: 'Baomingrenshu', labtype: 'txt', hidden: false, width: 50 }, { label: '绉垎', name: 'Jifen', labtype: 'txt', hidden: false, width: 50 }, + { label: '搴т綅', name: 'SeatName', labtype: 'txt', hidden: false, width: 50 }, //{ label: '閲戦', name: 'Jine', labtype: 'txt', hidden: false, width: 100 }, { label: '鎵撳嵃鍚堝悓', name: 'dayin', labtype: 'txt', hidden: false, width: 70 diff --git a/zhengcaioa/zhengcaioa/appsettings.Development.json b/zhengcaioa/zhengcaioa/appsettings.Development.json index ea087af..8521e89 100644 --- a/zhengcaioa/zhengcaioa/appsettings.Development.json +++ b/zhengcaioa/zhengcaioa/appsettings.Development.json @@ -1,6 +1,6 @@ { "ConnectionStrings": { - "DefaultConnection": "server=localhost;database=zhengcaioa44;uid=sa;pwd=123456;", + "DefaultConnection": "server=localhost;database=zhengcaioa55;uid=sa;pwd=123456;", "zcwebConnection": "server=localhost;database=zcweb;uid=sa;pwd=123456;", "zcUserInfoNConnection": "server=localhost;database=zcUserInfoN_db;uid=sa;pwd=123456;", "WebCrawlerConnection": "server=localhost;database=WebCrawler;uid=sa;pwd=123456;", @@ -14,7 +14,7 @@ } }, "AllowedHosts": "*", - "Elasticsearchurl": "http://192.168.0.15:9200", + "Elasticsearchurl": "http://192.168.0.11:9200", "SecurityKey": "superSecretKey@345", "Shuchengurl": "http://192.168.0.21:8085", "GetShopUsers": "/actionapi/Shop/GetShopUsers", @@ -28,6 +28,7 @@ "PassPoints": "/api/UserPoints/PassPoints", "OaWriteTrainClassOder": "/api/ZCBackgRound/OaWriteTrainClassOder", "OAWriteChangeAsync": "/api/ZCBackgRound/OAWriteChangeAsync", - "OASetOtherBusiness": "/api/ZCBackgRound/OASetOtherBusiness" + "OASetOtherBusiness": "/api/ZCBackgRound/OASetOtherBusiness", + "GetTrainingCoursesLockIDSeatId": "/api/ZCBackgRound/GetTrainingCoursesLockIDSeatId" } diff --git a/zhengcaioa/zhengcaioa/appsettings.json b/zhengcaioa/zhengcaioa/appsettings.json index 744879f..6d044eb 100644 --- a/zhengcaioa/zhengcaioa/appsettings.json +++ b/zhengcaioa/zhengcaioa/appsettings.json @@ -28,5 +28,6 @@ "PassPoints": "/api/UserPoints/PassPoints", "OaWriteTrainClassOder": "/api/ZCBackgRound/OaWriteTrainClassOder", "OAWriteChangeAsync": "/api/ZCBackgRound/OAWriteChangeAsync", - "OASetOtherBusiness": "/api/ZCBackgRound/OASetOtherBusiness" + "OASetOtherBusiness": "/api/ZCBackgRound/OASetOtherBusiness", + "GetTrainingCoursesLockIDSeatId": "/api/ZCBackgRound/GetTrainingCoursesLockIDSeatId" } -- Gitblit v1.9.1