zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs
@@ -348,6 +348,9 @@ CreateMap<FrameworkUser, FrameworkUserDTO>(); CreateMap<FrameworkUserDTO, FrameworkUser>(); CreateMap<OrderBanciZuowei, OrderBanciZuoweiDTO>(); CreateMap<OrderBanciZuoweiDTO, OrderBanciZuowei>(); } } } 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; } } } 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 zhengcaioa/DTO/OrderBanciZuoweiDTO.cs
New file @@ -0,0 +1,22 @@ using 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; } } } zhengcaioa/IServices/IOrderBanciService.cs
@@ -23,5 +23,10 @@ List<OrderBanciDTO> GetJifenBanciList(); ResultEntity saveZuowei(OrderBanciZuoweiDTO dto); List<OrderBanciZuoweiDTO> GetOrderBanciZuoweiList(string banciId); } } 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; } } } 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; } } } zhengcaioa/Model/OrderBanciZuowei.cs
New file @@ -0,0 +1,23 @@ using 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; } } } 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"); 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(); } zhengcaioa/Services/OrderBanciService.cs
@@ -53,7 +53,65 @@ updateproject.Modifytime = entity.Modifytime; updateproject.Mingcheng = entity.Mingcheng; 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; } } } 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; } } zhengcaioa/zhengcaioa/Views/OrderBanci/Edit.cshtml
@@ -169,6 +169,41 @@ <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> 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"; zhengcaioa/zhengcaioa/Views/OrderBanci/Liuzuo.cshtml
New file @@ -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> 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 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" } 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" }