Merge remote-tracking branch 'origin/guadan0905'

This commit is contained in:
2025-09-17 23:23:01 +08:00
27 changed files with 870 additions and 625 deletions

3
.gitignore vendored
View File

@@ -4,4 +4,5 @@
packages packages
obj/ obj/
*.user *.user
*.log *.log
**website.publishproj

Binary file not shown.

Binary file not shown.

View File

@@ -74,9 +74,11 @@ public class ShuWenController : ApiController
{ {
shuwen.ShuWenList = ProcessDesserts2(_db.pro_order_detail.Where(a => a.pro_order.activity_num == activitynum.Value).ToList()); shuwen.ShuWenList = ProcessDesserts2(_db.pro_order_detail.Where(a => a.pro_order.activity_num == activitynum.Value).ToList());
} }
catch catch (Exception ex)
{ {
shuwen.IsGenerating = false;
_db.SaveChanges();
return BadRequest("生成舒文失败:" + ex.Message);
} }
shuwen.IsGenerating = false; shuwen.IsGenerating = false;
shuwen.UpdateTime = DateTime.Now; shuwen.UpdateTime = DateTime.Now;
@@ -222,34 +224,42 @@ public class ShuWenController : ApiController
[Route("api/shuwen/download")] [Route("api/shuwen/download")]
public HttpResponseMessage DownloadShuWenWord(int? activitynum) public HttpResponseMessage DownloadShuWenWord(int? activitynum)
{ {
var data = _db.ShuWen.Where(a => a.ActivityNum == activitynum).FirstOrDefault(); try
if (data == null)
{ {
//return; var data = _db.ShuWen.Where(a => a.ActivityNum == activitynum).FirstOrDefault();
} if (data == null)
string json = data.ShuWenList;
string ActivityName = _db.activities.Where(a => a.num == data.ActivityNum).FirstOrDefault().subject;
if (json == null)
{
//return;
}
string fileName = $"疏文名單_{DateTime.Now:yyyyMMddHHmmss}.docx";
var stream = new MemoryStream();
GenerateShuWenWord_OpenXml(json, stream, ActivityName);
stream.Position = 0;
var response = new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StreamContent(stream)
};
response.Content.Headers.ContentType =
new System.Net.Http.Headers.MediaTypeHeaderValue("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
response.Content.Headers.ContentDisposition =
new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment")
{ {
FileName = fileName return Request.CreateErrorResponse(HttpStatusCode.BadRequest, "活動編號不能為空");
}
string json = data.ShuWenList;
string ActivityName = _db.activities.Where(a => a.num == data.ActivityNum).FirstOrDefault().subject;
if (json == null)
{
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, "疏文列表为空,无法生成 Word");
}
string fileName = $"疏文名單_{DateTime.Now:yyyyMMddHHmmss}.docx";
var stream = new MemoryStream();
GenerateShuWenWord_OpenXml(json, stream, ActivityName);
stream.Position = 0;
var response = new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StreamContent(stream)
}; };
return response; response.Content.Headers.ContentType =
new System.Net.Http.Headers.MediaTypeHeaderValue("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
response.Content.Headers.ContentDisposition =
new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment")
{
FileName = fileName
};
return response;
}
catch (Exception ex)
{
return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message);
}
} }
public void GenerateShuWenWord_OpenXml(string json, Stream outputStream, string ActivityName ="") public void GenerateShuWenWord_OpenXml(string json, Stream outputStream, string ActivityName ="")

View File

@@ -0,0 +1,139 @@
using Model;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
/// <summary>
/// guadanGuestQueryController 的摘要描述
/// </summary>
public class guadanGuestQueryController: ApiController
{
private Model.ezEntities _db = new Model.ezEntities();
public guadanGuestQueryController()
{
//
// TODO: 在這裡新增建構函式邏輯
//
}
[HttpPost]
[Route("api/guadan/guest/query/list")]
public async Task<IHttpActionResult> GetList([FromBody] SearchGuestModel search)
{
var query = _db.GuaDanOrderGuest
.Where(guest => guest.StatusCode != "404");
if(search.SearchName != null)
{
query = query.Where(guest => guest.followers.u_name.Contains(search.SearchName));
}
if(search.searchCheckInDate != null)
{
query = query.Where(guest => guest.CheckInAt == search.searchCheckInDate);
}
if(search.searchCheckOutDate != null)
{
query = query.Where(guest => guest.CheckOutAt == search.searchCheckOutDate);
}
if(search.searchCheckInDateStart != null)
{
query = query.Where(guest => guest.CheckInAt >= search.searchCheckInDateStart);
}
if (search.searchCheckInDateEnd != null)
{
query = query.Where(guest => guest.CheckInAt <= search.searchCheckInDateEnd);
}
if (search.searchCheckOutDateStart != null)
{
query = query.Where(guest => guest.CheckOutAt >= search.searchCheckOutDateStart);
}
if (search.searchCheckOutDateEnd != null)
{
query = query.Where(guest => guest.CheckOutAt <= search.searchCheckOutDateEnd);
}
var totalCount = await query.CountAsync();
var pagedData = await query
.OrderByDescending(a => a.CheckInAt) // 可根据需要排序
.Skip((search.Page - 1) * search.PageSize)
.Take(search.PageSize)
.ToListAsync();
var data1 = pagedData.Select(a => new
{
name = a.followers != null ? a.followers.u_name : null,
checkindate = a.CheckInAt,
checkoutdate = a.CheckOutAt,
guadanorderno = a.GuaDanOrderNo,
roomName = GetRoomAndBedString(a.RegionRoomBed),
}).ToList();
return Ok(new
{
items = data1,
total = totalCount,
});
}
[HttpGet]
[Route("api/guadan/guest/checkin/list")]
public async Task<IHttpActionResult> GetCheckInGuest([FromUri] DateTime date)
{
var today = DateTime.Now.Date;
var data = await _db.GuaDanOrderGuest
.Where(guest => guest.StatusCode == "402")
.Where(guest => guest.RegionAndRoomAndBedSchedule
.Any(s => s.ScheduleDate == date.Date && s.ScheduleDate == today) == true)
.Select(guest => new
{
name = guest.followers.u_name,
gender = guest.followers.sex,
})
.ToListAsync();
return Ok(data);
}
[HttpGet]
[Route("api/guadan/guest/booking/list")]
public async Task<IHttpActionResult> GetBookingGuest([FromUri] DateTime date)
{
var data = await _db.GuaDanOrderGuest
.Where(guest => guest.StatusCode == "402" || guest.StatusCode == "401")
.Where(guest => guest.RegionAndRoomAndBedSchedule.Any(s => s.ScheduleDate == date.Date) == true)
.Select(guest => new
{
name = guest.followers.u_name,
gender = guest.followers.sex,
})
.ToListAsync();
return Ok(data);
}
public string GetRoomAndBedString(RegionRoomBed bed)
{
if (bed == null || bed.Room == null) return "";
var room = bed.Room;
var region = room.Region;
var name = room.Name + "/" + bed.Name;
if(region != null)
{
name = region.Name + "/" + name;
}
var parentRegion = region.Region2;
while (parentRegion != null)
{
name = parentRegion.Name + "/" + name;
parentRegion = parentRegion.Region2;
}
return name;
}
public class SearchGuestModel
{
public string SearchName = null;
public int Page = 1;
public int PageSize = 10;
public DateTime? searchCheckInDateStart = null;//入住日期的开始
public DateTime? searchCheckInDateEnd = null;//入住日期的结束
public DateTime? searchCheckOutDateStart = null;//退房日期的开始
public DateTime? searchCheckOutDateEnd = null;//退房日期的结束
public DateTime? searchCheckInDate = null;
public DateTime? searchCheckOutDate = null;
}
}

View File

@@ -1,4 +1,5 @@
using Model; using Model;
using PagedList;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data.Entity; using System.Data.Entity;
@@ -15,12 +16,36 @@ using static regionController;
public class guadanOrderController : ApiController public class guadanOrderController : ApiController
{ {
private Model.ezEntities _db = new Model.ezEntities(); private Model.ezEntities _db = new Model.ezEntities();
[HttpGet] [HttpPost]
[Route("api/guadan/list")] [Route("api/guadan/list")]
public async Task<IHttpActionResult> getGuadanList() public async Task<IHttpActionResult> getGuadanList([FromBody] guadan_order_search_dto search)
{ {
var data = await _db.GuaDanOrder
var query = _db.GuaDanOrder
.Where(a => a.IsCancel == false) .Where(a => a.IsCancel == false)
.Where(a => a.IsDeleted == false);
if(search.guadanUser != null)
{
query = query.Where(order => order.BookerName == search.guadanUser);
}
if (search.startDate != null && search.endDate != null)
{
query = query.Where(order => order.StartDate >= search.startDate)
.Where(order => order.EndDate <= search.endDate);
}
else
{
if (search.startDate != null)
{
query = query.Where(order => order.StartDate == search.startDate);
}
else if (search.endDate != null)
{
query = query.Where(order => order.EndDate == search.endDate);
}
}
var total = query.Count();
var data = await query
.OrderByDescending(b => b.CreatedAt) .OrderByDescending(b => b.CreatedAt)
.Select(a => new .Select(a => new
{ {
@@ -36,8 +61,15 @@ public class guadanOrderController : ApiController
.Where(c => c.GuaDanOrderNo == a.GuaDanOrderNo && c.IsDeleted == false) .Where(c => c.GuaDanOrderNo == a.GuaDanOrderNo && c.IsDeleted == false)
.Where(c => c.RegionRoomBedStatus.Code != GuaDanOrderGuest.STATUS_CANCELLED) .Where(c => c.RegionRoomBedStatus.Code != GuaDanOrderGuest.STATUS_CANCELLED)
.Count(), .Count(),
}).ToListAsync(); })
return Ok(data); .Skip((search.page - 1) * search.pageSize)
.Take(search.pageSize)
.ToListAsync();
return Ok(new
{
total,
data
});
} }
[HttpGet] [HttpGet]
[Route("api/guadan/getorderbyid")] [Route("api/guadan/getorderbyid")]
@@ -221,4 +253,13 @@ public class guadanOrderController : ApiController
public RegionRoomBed bed { get; set; } = null; public RegionRoomBed bed { get; set; } = null;
} }
public class guadan_order_search_dto
{
public DateTime? startDate { get; set; }
public DateTime? endDate { get; set; }
public string guadanUser { get; set; }
public int page { get; set; } = 1;
public int pageSize { get; set; } = 10;
}
} }

View File

@@ -116,7 +116,7 @@ public class guadanOrderGuestController : ApiController
return BadRequest("床位在該時間段內已被占用"); return BadRequest("床位在該時間段內已被占用");
if (model.followerNum.HasValue) if (model.followerNum.HasValue)
{ {
if (_db.GuaDanOrderGuest.Any(a => a.FollowerNum == model.followerNum if (_db.GuaDanOrderGuest.Any(a => a.FollowerNum == model.followerNum
&& a.GuaDanOrderNo == model.orderNo && a.GuaDanOrderNo == model.orderNo
&& a.StatusCode != "404" && a.StatusCode != "404"
)) ))
@@ -330,31 +330,31 @@ public class guadanOrderGuestController : ApiController
[Route("api/guadanorderguest/xuzhu")] [Route("api/guadanorderguest/xuzhu")]
public async Task<IHttpActionResult> ExtendStay([FromBody] XuZhuModel model) public async Task<IHttpActionResult> ExtendStay([FromBody] XuZhuModel model)
{ {
//住方法 //住方法
if (model == null) if (model == null)
return BadRequest("请求数据为空"); return BadRequest("請求數據為空");
if (model.GuestUuid == Guid.Empty || model.GuestBedUuid == Guid.Empty) if (model.GuestUuid == Guid.Empty || model.GuestBedUuid == Guid.Empty)
return BadRequest("GuestUuid 或 GuestBedUuid 效"); return BadRequest("GuestUuid 或 GuestBedUuid 效");
var guest= await _db.GuaDanOrderGuest.FindAsync(model.GuestUuid); var guest = await _db.GuaDanOrderGuest.FindAsync(model.GuestUuid);
if (guest == null) if (guest == null)
{ {
return BadRequest("挂单不存在"); return BadRequest("掛單不存在");
} }
if(guest.BedUuid != model.GuestBedUuid) if (guest.BedUuid != model.GuestBedUuid)
{ {
return BadRequest("床位不正"); return BadRequest("床位不正");
} }
var bedIsCanUse = await RegionAndRoomAndBedSchedule.IsBedAvailableAsync(_db,model.GuestBedUuid, model.CurrentCheckoutDate, model.NewCheckoutDate); var bedIsCanUse = await RegionAndRoomAndBedSchedule.IsBedAvailableAsync(_db, model.GuestBedUuid, model.CurrentCheckoutDate, model.NewCheckoutDate);
if(!bedIsCanUse) if (!bedIsCanUse)
{ {
return BadRequest("床位在续住时间段内被预定,无法续住"); return BadRequest("床位在續住時間段內被預定,無法續住");
} }
var newStartDate = model.CurrentCheckoutDate.Date; var newStartDate = model.CurrentCheckoutDate.Date;
var newEndDate = model.NewCheckoutDate.Date.AddDays(-1); var newEndDate = model.NewCheckoutDate.Date.AddDays(-1);
if (newEndDate < newStartDate) if (newEndDate < newStartDate)
return BadRequest("住日期区间无效"); return BadRequest("住日期區間無效");
for (var date = newStartDate; date <= newEndDate; date = date.AddDays(1)) for (var date = newStartDate; date <= newEndDate; date = date.AddDays(1))
{ {
var newSchedule = new RegionAndRoomAndBedSchedule var newSchedule = new RegionAndRoomAndBedSchedule
@@ -364,8 +364,8 @@ public class guadanOrderGuestController : ApiController
TargetUuid = model.GuestBedUuid, TargetUuid = model.GuestBedUuid,
GuaDanOrderGuestUuid = model.GuestUuid, GuaDanOrderGuestUuid = model.GuestUuid,
ScheduleDate = date, ScheduleDate = date,
Title = "续住挂单", // 一天一条,开始和束是同一天 Title = "續住掛單", // 一天一條,開始和束是同一天
Description = "续住挂单", Description = "續住掛單",
UseType = 30, UseType = 30,
CreatedAt = DateTime.UtcNow CreatedAt = DateTime.UtcNow
}; };
@@ -373,8 +373,8 @@ public class guadanOrderGuestController : ApiController
_db.RegionAndRoomAndBedSchedule.Add(newSchedule); _db.RegionAndRoomAndBedSchedule.Add(newSchedule);
} }
guest.CheckOutAt = model.NewCheckoutDate.Date; guest.CheckOutAt = model.NewCheckoutDate.Date;
await _db.SaveChangesAsync(); // 保存数据库操作 await _db.SaveChangesAsync(); // 保存資料庫操作
return Ok(new { message = "住成功" }); return Ok(new { message = "住成功" });
} }
[HttpPost] [HttpPost]
[Route("api/guadanorderguest/cancel")] [Route("api/guadanorderguest/cancel")]
@@ -495,13 +495,13 @@ public class guadanOrderGuestController : ApiController
//更新未來排程為取消 //更新未來排程為取消
var latestCheckoutStr = _db.GuadanTimeSetting var latestCheckoutStr = _db.GuadanTimeSetting
.Select(a => a.LatestCheckOut) // 字串 "HH:mm" .Select(a => a.LatestCheckOut) // 字串 "HH:mm"
.FirstOrDefault(); .FirstOrDefault();
TimeSpan? latestCheckoutTime = null; TimeSpan? latestCheckoutTime = null;
if (!string.IsNullOrEmpty(latestCheckoutStr)) if (!string.IsNullOrEmpty(latestCheckoutStr))
{ {
// 尝试解析字 // 嘗試解析字串
if (TimeSpan.TryParse(latestCheckoutStr, out var ts)) if (TimeSpan.TryParse(latestCheckoutStr, out var ts))
{ {
latestCheckoutTime = ts; latestCheckoutTime = ts;
@@ -588,7 +588,7 @@ public class guadanOrderGuestController : ApiController
if (guest.BedUuid != null) if (guest.BedUuid != null)
{ {
var bed = _db.RegionRoomBed.FirstOrDefault(b => b.Uuid == guest.BedUuid); var bed = _db.RegionRoomBed.FirstOrDefault(b => b.Uuid == guest.BedUuid);
if(bed == null) if (bed == null)
{ {
return BadRequest("入住床位不存在"); return BadRequest("入住床位不存在");
} }
@@ -598,10 +598,10 @@ public class guadanOrderGuestController : ApiController
} }
else else
{ {
return BadRequest($"前床位状态{bed.RegionRoomBedStatus.Name} 不能入住"); return BadRequest($"前床位狀態{bed.RegionRoomBedStatus.Name} 不能入住");
} }
} }
else if(guest.BedUuid == null) else if (guest.BedUuid == null)
{ {
return BadRequest("入住床位不存在"); return BadRequest("入住床位不存在");
} }
@@ -653,10 +653,10 @@ public class guadanOrderGuestController : ApiController
} }
public class XuZhuModel public class XuZhuModel
{ {
public Guid GuestUuid { get; set; } // 不可 public Guid GuestUuid { get; set; } // 不可
public Guid GuestBedUuid { get; set; } // 不可 public Guid GuestBedUuid { get; set; } // 不可
public DateTime CurrentCheckoutDate { get; set; } // 前退房时间 public DateTime CurrentCheckoutDate { get; set; } // 前退房時間
public DateTime NewCheckoutDate { get; set; } // 新退房时间 public DateTime NewCheckoutDate { get; set; } // 新退房時間
} }
} }

View File

@@ -21,39 +21,49 @@ public class guadanStatisticsController: ApiController
//挂单统计:房间,床位,挂单笔数,挂单人数的统计 //挂单统计:房间,床位,挂单笔数,挂单人数的统计
var now = DateTime.Now; var now = DateTime.Now;
var roomCount = await _db.Room.Where(a => a.IsDeleted == false).CountAsync(); var guadanTotalCount = await _db.GuaDanOrder
var rooms = await _db.Room.Include(r => r.RegionRoomBed).ToListAsync(); .Where(a => a.IsDeleted == false)
.Where(a => a.IsCancel == false)
var emptyRoomCount = rooms .CountAsync();
.Where(r => r.RegionRoomBed.All(b => b.IsAvailableDuring(now, now, _db))) // 這裡就能用方法 var guadanCurrentCount = await _db.GuaDanOrderGuest
.Count(); .Where(guest => guest.StatusCode != "403")
var bedCount = await _db.RegionRoomBed.Where(a => a.IsDeleted == false).CountAsync(); .Where(guest => guest.StatusCode != "404")
var maleBedCount = await _db.RegionRoomBed.Where(a => a.IsDeleted == false && a.Gender == true).CountAsync(); .Select(guest => guest.GuaDanOrderNo)
var femaleBedCount = await _db.RegionRoomBed.Where(a => a.IsDeleted == false && a.Gender == false).CountAsync(); .Distinct()
.CountAsync();
var guadanTotalCount = await _db.GuaDanOrder.Where(a => a.IsDeleted == false).CountAsync(); var guadanPeopleTotal = await _db.GuaDanOrderGuest
var guadanPeopleTotal = await _db.GuaDanOrderGuest.Where(a => a.IsDeleted == false).CountAsync(); .Where(a => a.IsDeleted == false)
var guadanPeopleMale = await _db.GuaDanOrderGuest.Where(a => a.IsDeleted == false && a.followers.sex == "男眾").CountAsync(); .Where(guest => guest.StatusCode != "404")
var guadanPeopleFemale = await _db.GuaDanOrderGuest.Where(a => a.IsDeleted == false && a.followers.sex == "女眾").CountAsync(); .CountAsync();
dynamic bedCounts = await RegionAndRoomAndBedSchedule.GetAvailableBedCountsAsync(_db, DateTime.Now, DateTime.Now); var guadanPeopleMale = await _db.GuaDanOrderGuest
var guadanCurrentCount = await _db.GuaDanOrder.Where(a => now < a.EndDate).CountAsync(); .Where(guest => guest.StatusCode != "404")
var guadanPeopleCurrent = await _db.GuaDanOrderGuest.Where( a => a.CheckOutAt > now).CountAsync(); .Where(a => a.IsDeleted == false && a.followers.sex == "男眾")
var guadanPeopleCurrentMale = await _db.GuaDanOrderGuest.Where(a => a.CheckOutAt > now && a.followers.sex == "男眾").CountAsync(); .CountAsync();
var guadanPeopleCurrentFemale = await _db.GuaDanOrderGuest.Where(a => a.CheckOutAt > now && a.followers.sex == "女眾").CountAsync(); var guadanPeopleFemale = await _db.GuaDanOrderGuest
.Where(guest => guest.StatusCode != "404")
.Where(a => a.IsDeleted == false && a.followers.sex == "女眾")
.CountAsync();
var guadanPeopleCurrent = await _db.GuaDanOrderGuest
.Where(a => a.IsDeleted == false)
.Where(guest => guest.StatusCode != "404")
.Where(guest => guest.StatusCode != "403")
.Where( a => a.CheckOutAt >= now.Date)
.CountAsync();
var guadanPeopleCurrentMale = await _db.GuaDanOrderGuest
.Where(a => a.IsDeleted == false)
.Where(guest => guest.StatusCode != "404")
.Where(guest => guest.StatusCode != "403")
.Where(a => a.CheckOutAt >= now.Date && a.followers.sex == "男眾")
.CountAsync();
var guadanPeopleCurrentFemale = await _db.GuaDanOrderGuest
.Where(a => a.IsDeleted == false)
.Where(guest => guest.StatusCode != "404")
.Where(guest => guest.StatusCode != "403")
.Where(a => a.CheckOutAt >= now.Date && a.followers.sex == "女眾")
.CountAsync();
var result = new var result = new
{ {
roomStatistics = new
{
roomCount = roomCount,
emptyRoomCount = emptyRoomCount,
bedCount = bedCount,
maleBedCount = maleBedCount,
femaleBedCount = femaleBedCount,
emptyBedCount = bedCounts.male + bedCounts.female,
emptyMaleBedCount = bedCounts.male,
emptyFemaleBedCount = bedCounts.female
},
guadanStatistics = new guadanStatistics = new
{ {
guadanTotalCount = guadanTotalCount, // 总挂单次数 guadanTotalCount = guadanTotalCount, // 总挂单次数
@@ -61,7 +71,7 @@ public class guadanStatisticsController: ApiController
guadanPeopleTotal = guadanPeopleTotal, // 总挂单人数 guadanPeopleTotal = guadanPeopleTotal, // 总挂单人数
guadanPeopleMale = guadanPeopleMale, guadanPeopleMale = guadanPeopleMale,
guadanPeopleFemale = guadanPeopleFemale, guadanPeopleFemale = guadanPeopleFemale,
guadanPeopleCurrent = guadanPeopleCurrent, // 当前挂单人数 guadanPeopleCurrent = guadanPeopleCurrent, // 已預約掛單人數
guadanPeopleCurrentMale = guadanPeopleCurrentMale, guadanPeopleCurrentMale = guadanPeopleCurrentMale,
guadanPeopleCurrentFemale = guadanPeopleCurrentFemale guadanPeopleCurrentFemale = guadanPeopleCurrentFemale
} }

View File

@@ -59,20 +59,22 @@ public class guadanStatisticsTableController: ApiController
? g.Count(x => x.GuaDanOrderGuest.RegionRoomBedStatus.Code == "402" ? g.Count(x => x.GuaDanOrderGuest.RegionRoomBedStatus.Code == "402"
|| x.GuaDanOrderGuest.RegionRoomBedStatus.Code == "403") || x.GuaDanOrderGuest.RegionRoomBedStatus.Code == "403")
: 0, : 0,
checkinfemale = g.Key <= DateTime.Today
? g.Count(x => (x.GuaDanOrderGuest.RegionRoomBedStatus.Code == "402"
|| x.GuaDanOrderGuest.RegionRoomBedStatus.Code == "403")
&& x.GuaDanOrderGuest.followers.sex == "女眾")
: 0,
checkinmale = g.Key <= DateTime.Today
? g.Count(x => (x.GuaDanOrderGuest.RegionRoomBedStatus.Code == "402"
|| x.GuaDanOrderGuest.RegionRoomBedStatus.Code == "403")
&& x.GuaDanOrderGuest.followers.sex == "男眾")
: 0,
bookfemale = g.Count(x => x.GuaDanOrderGuest.followers.sex == "女眾"),
bookmale = g.Count(x => x.GuaDanOrderGuest.followers.sex == "男眾")
}) })
.OrderBy(x => x.date) .OrderBy(x => x.date)
.ToList(); .ToList();
var todayDate = DateTime.Today; var todayDate = DateTime.Today;
dynamic today = statistics.FirstOrDefault(x => x.date == todayDate);
if (today == null)
{
var todayCount = _db.RegionAndRoomAndBedSchedule
.Where(s => s.ScheduleDate == todayDate && !s.IsCancel)
.Count();
today = new { date = todayDate, todaytotalbookers = todayCount };
}
var bedcount = _db.RegionRoomBed var bedcount = _db.RegionRoomBed
.Where(a => a.IsDeleted == false) .Where(a => a.IsDeleted == false)
@@ -83,11 +85,6 @@ public class guadanStatisticsTableController: ApiController
bedcount, bedcount,
roomcount, roomcount,
statistics, statistics,
today,
totalbookers = _db.RegionAndRoomAndBedSchedule
.Where(s => s.IsCancel == false)
.Where(s => s.ScheduleDate >= DateTime.Today)
.Count(),
}; };
return Ok(result); return Ok(result);

View File

@@ -22,94 +22,14 @@ public class orderdetailController:ApiController
public IHttpActionResult GetList([FromBody] Model.ViewModel.pro_order q, int page, int pageSize = 10, string sortBy = "", bool sortDesc = false) public IHttpActionResult GetList([FromBody] Model.ViewModel.pro_order q, int page, int pageSize = 10, string sortBy = "", bool sortDesc = false)
{ {
int activity_num = Convert.ToInt32(q.activity_num); int activity_num = Convert.ToInt32(q.activity_num);
//現在的牌位預覽只會出現功德主,修改為所有人都會出現
//var aIDt = _db.actItems.AsEnumerable().Where(f => f.subject.Contains(q.actItemTxt.Trim())).Select(f => f.num);//品項 //var aIDt = _db.actItems.AsEnumerable().Where(f => f.subject.Contains(q.actItemTxt.Trim())).Select(f => f.num);//品項
var OrderList = _db.pro_order.Where(u => u.activity_num == activity_num).Select(j => j.order_no).ToList(); //var OrderList = _db.pro_order.Where(u => u.activity_num == activity_num).Select(j => j.order_no).ToList();
var gdzOrderList = _db.pro_order_detail.Where(o => OrderList.Contains(o.order_no) && o.print_id.Contains("主")).Select(o => o.order_no).Distinct().ToList(); //var gdzOrderList = _db.pro_order_detail.Where(o => OrderList.Contains(o.order_no) && o.print_id.Contains("主")).Select(o => o.order_no).Distinct().ToList();
var qry = _db.pro_order.Where(u => gdzOrderList.Contains(u.order_no)).AsEnumerable(); //var qry = _db.pro_order.Where(u => gdzOrderList.Contains(u.order_no)).AsEnumerable();
if (!string.IsNullOrEmpty(q.order_no)) var qry = _db.pro_order.Where( u => u.activity_num == activity_num).AsEnumerable();
qry = qry.Where(o => o.order_no.Contains(q.order_no.Trim()));
if (!string.IsNullOrEmpty(q.keyin1)) qry = qry.OrderByDescending(o => o.reg_time);
qry = qry.Where(o => o.keyin1.Contains(q.keyin1));
if (q.f_num.HasValue && q.f_num > 0)
qry = qry.Where(o => o.f_num == q.f_num);
if (q.activity_num.HasValue && q.activity_num > 0)
qry = qry.Where(o => o.activity_num == q.activity_num);
if (q.up_time1.HasValue)
qry = qry.Where(o => o.up_time >= q.up_time1.Value);
if (q.up_time2.HasValue)
qry = qry.Where(o => o.up_time < Convert.ToDateTime(q.up_time2.Value).AddDays(1));
if (!string.IsNullOrEmpty(q.address))
qry = qry.Where(o => o.address.Contains(q.address.Trim()));
if (!string.IsNullOrEmpty(q.subject))
qry = qry.Where(o => o.activity_num.HasValue && o.activity.subject.Contains(q.subject?.Trim()));
if (!string.IsNullOrEmpty(q.u_name))
qry = qry.Where(o => o.f_num.HasValue && o.follower.u_name.Contains(q.u_name?.Trim()));
if (!string.IsNullOrEmpty(q.introducerTxt))
qry = qry.Where(o => o.introducer.HasValue && o.follower1.u_name.Contains(q.introducerTxt?.Trim()));
if (!string.IsNullOrEmpty(q.actItemTxt))
{
//qry = qry.Where(o => o.pro_order_detail.Where(f2 => f2.order_no == o.order_no && aIDt.ToArray().Contains(f2.actItem_num?.ToString())).Count() > 0);
// qry = qry.Where(o => o.pro_order_detail.Where(f2 => f2.order_no == o.order_no && aIDt.Any(x => x == f2.actItem_num)).Count() > 0);
qry = qry.Where(o => o.pro_order_detail.Where(f2 => f2.actItem_num.HasValue && f2.actItem.subject.Contains(q.actItemTxt?.Trim())).Count() > 0);
}
if (!string.IsNullOrEmpty(q.country))
qry = qry.Where(o => o.f_num != null && o.follower?.country == q.country);
if (!string.IsNullOrEmpty(q.country2))
{
if (q.country2 == "1")
{
qry = qry.Where(o => o.f_num != null && o.follower?.country == "158");
}
else if (q.country2 == "2")
{
qry = qry.Where(o => o.f_num != null && o.follower?.country != "158");
}
}
if (sortBy.Equals("order_no"))
{
if (sortDesc)
qry = qry.OrderByDescending(o => o.order_no);
else
qry = qry.OrderBy(o => o.order_no);
}
else if (sortBy.Equals("keyin1_txt"))
{
if (sortDesc)
qry = qry.OrderByDescending(o => o.keyin1);
else
qry = qry.OrderBy(o => o.keyin1);
}
else if (sortBy.Equals("up_time"))
{
if (sortDesc)
qry = qry.OrderByDescending(o => o.up_time);
else
qry = qry.OrderBy(o => o.up_time);
}
else if (sortBy.Equals("u_name"))
{
if (sortDesc)
qry = qry.OrderByDescending(o => o.follower?.u_name);
else
qry = qry.OrderBy(o => o.follower?.u_name);
}
else if (sortBy.Equals("subject"))
{
if (sortDesc)
qry = qry.OrderByDescending(o => o.activity?.subject);
else
qry = qry.OrderBy(o => o.activity?.subject);
}
else
qry = qry.OrderByDescending(o => o.reg_time);
var count = qry.Count(); //pageSize = count;//一次取回?? var count = qry.Count(); //pageSize = count;//一次取回??
var ret = new var ret = new
@@ -125,7 +45,11 @@ public class orderdetailController:ApiController
up_time = x.up_time, up_time = x.up_time,
keyin1_txt = Model.pro_order.keyin1_value_to_text(x.keyin1), keyin1_txt = Model.pro_order.keyin1_value_to_text(x.keyin1),
//detail = x.pro_order_detail.Where(u => u.printed_files != null) //detail = x.pro_order_detail.Where(u => u.printed_files != null)
detail = new { count = x.pro_order_detail.Where(u => u.actItem.act_bom.Count() == 0).Count(), detail = new { count = x.pro_order_detail
.Where(u => (u.parent_num != null)
|| u.actItem.subject.Contains("牌")
|| !string.IsNullOrEmpty(u.f_num_tablet))
.Count(),
actItem = x.pro_order_detail.Where(u => u.printed_files != null).FirstOrDefault()?.print_id } actItem = x.pro_order_detail.Where(u => u.printed_files != null).FirstOrDefault()?.print_id }
}), }),
count = count count = count

View File

@@ -39,8 +39,9 @@ public class regionController : ApiController
var startDate = filter.StartDate.Date; var startDate = filter.StartDate.Date;
var endDate = filter.EndDate.Date; var endDate = filter.EndDate.Date;
var query = _db.Region var query = _db.Region//区域状态是否启用这里只设置了过滤了有客房的区域,是否要过滤所有
.Where(r => !r.IsDeleted) .Where(r => !r.IsDeleted)
.Where(r => r.IsActive)
.Where(r => r.Room.Any()); .Where(r => r.Room.Any());
if (filter.Gender != null) if (filter.Gender != null)
@@ -105,8 +106,9 @@ public class regionController : ApiController
.Where(s => s.TargetUuid == bed.Uuid .Where(s => s.TargetUuid == bed.Uuid
&& s.IsDeleted == false && s.IsDeleted == false
&& (s.ScheduleDate == null && (s.ScheduleDate == null
|| (s.ScheduleDate >= startDate && s.ScheduleDate <= endDate))) || (s.ScheduleDate >= startDate)))
.Where(s => s.GuaDanOrderGuest.StatusCode != "403" && s.GuaDanOrderGuest.StatusCode != "404") .Where(s => s.GuaDanOrderGuest.StatusCode != "403" && s.GuaDanOrderGuest.StatusCode != "404")
.OrderBy(a => a.ScheduleDate)
.Select(s => new .Select(s => new
{ {
s.Uuid, s.Uuid,
@@ -372,6 +374,10 @@ public class regionController : ApiController
var region = _db.Region.FirstOrDefault(r => r.Uuid == dto.Uuid); var region = _db.Region.FirstOrDefault(r => r.Uuid == dto.Uuid);
if (region == null) if (region == null)
return NotFound(); return NotFound();
if(dto.RoomCount < region.Room.Count())
{
return BadRequest("客房數量小於已存在的客房數量");
}
region.Name = dto.Name; region.Name = dto.Name;
region.Description = dto.Description; region.Description = dto.Description;
region.SortOrder = dto.SortOrder; region.SortOrder = dto.SortOrder;

View File

@@ -379,13 +379,14 @@ public class regionRoomBedController : ApiController
RoomUuid = roomUuid, RoomUuid = roomUuid,
CheckInAt = allocationStart, CheckInAt = allocationStart,
CheckOutAt = allocationEnd, CheckOutAt = allocationEnd,
StatusCode = "401",
}; };
_db.GuaDanOrderGuest.Add(guest); _db.GuaDanOrderGuest.Add(guest);
// 新增每日排程 // 新增每日排程
if (allocationEnd.HasValue) if (allocationEnd.HasValue)
{ {
for (var date = allocationStart; date <= allocationEnd.Value; date = date.AddDays(1)) for (var date = allocationStart; date < allocationEnd.Value; date = date.AddDays(1))
{ {
var newSchedule = new RegionAndRoomAndBedSchedule var newSchedule = new RegionAndRoomAndBedSchedule
{ {
@@ -396,7 +397,9 @@ public class regionRoomBedController : ApiController
IsDeleted = false, IsDeleted = false,
CreatedBy = "系统自动分配", CreatedBy = "系统自动分配",
CreatedAt = DateTime.Now, CreatedAt = DateTime.Now,
GuaDanOrderNo = guest.GuaDanOrderNo GuaDanOrderNo = guest.GuaDanOrderNo,
Title = "掛單",
GuaDanOrderGuestUuid = guest.Uuid,
}; };
_db.RegionAndRoomAndBedSchedule.Add(newSchedule); _db.RegionAndRoomAndBedSchedule.Add(newSchedule);
} }
@@ -413,7 +416,9 @@ public class regionRoomBedController : ApiController
IsDeleted = false, IsDeleted = false,
CreatedBy = "系统自动分配", CreatedBy = "系统自动分配",
CreatedAt = DateTime.Now, CreatedAt = DateTime.Now,
GuaDanOrderNo = guest.GuaDanOrderNo GuaDanOrderNo = guest.GuaDanOrderNo,
Title = "掛單",
GuaDanOrderGuestUuid = guest.Uuid,
}; };
_db.RegionAndRoomAndBedSchedule.Add(newSchedule); _db.RegionAndRoomAndBedSchedule.Add(newSchedule);
} }

View File

@@ -38,6 +38,15 @@ public class regionRoomController : ApiController
{ {
return BadRequest("請輸入床位數量"); return BadRequest("請輸入床位數量");
} }
var region = _db.Region.Find(room.RegionUuid);
if(region == null)
{
return BadRequest("未找到客房所屬的區域");
}
if(region.Room.Count() >= region.RoomCount)
{
return BadRequest("當前區域客房數量已經達到上限");
}
var newRoom = new Room(); var newRoom = new Room();
newRoom.Name = room.Name; newRoom.Name = room.Name;
newRoom.RegionUuid = room.RegionUuid; newRoom.RegionUuid = room.RegionUuid;
@@ -103,15 +112,43 @@ public class regionRoomController : ApiController
[Route("api/region/room/delete")] [Route("api/region/room/delete")]
public async Task<IHttpActionResult> deleteRoom([FromBody] Room rm) public async Task<IHttpActionResult> deleteRoom([FromBody] Room rm)
{ {
var room = await _db.Room.FindAsync(rm.Uuid); using (var transaction = _db.Database.BeginTransaction())
if (room == null) return BadRequest("房間不存在"); {
try
{
var room = await _db.Room.FindAsync(rm.Uuid);
if (room == null) return BadRequest("房間不存在");
var beds = _db.RegionRoomBed.Where(b => b.RoomUuid == room.Uuid); var beds = _db.RegionRoomBed.Where(b => b.RoomUuid == room.Uuid);
_db.RegionRoomBed.RemoveRange(beds); _db.RegionRoomBed.RemoveRange(beds);
_db.Room.Remove(room); _db.Room.Remove(room);
await _db.SaveChangesAsync();
return Ok(new { message = "刪除成功" }); await _db.SaveChangesAsync();
transaction.Commit();
return Ok(new { message = "刪除成功" });
}
catch (System.Data.Entity.Infrastructure.DbUpdateException ex)
{
transaction.Rollback();
// 判断是否为外键约束错误
if (ex.InnerException?.InnerException is System.Data.SqlClient.SqlException sqlEx &&
sqlEx.Number == 547) // 547 = 外键冲突
{
return BadRequest("房間或床位正在被使用,不能刪除");
}
return InternalServerError(ex);
}
catch (Exception ex)
{
transaction.Rollback();
return InternalServerError(ex);
}
}
} }
} }

View File

@@ -1,70 +0,0 @@
using Model;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
/// <summary>
/// guadanGuestQueryController 的摘要描述
/// </summary>
public class guadanGuestQueryController: ApiController
{
private Model.ezEntities _db = new Model.ezEntities();
public guadanGuestQueryController()
{
//
// TODO: 在這裡新增建構函式邏輯
//
}
[HttpPost]
[Route("api/guadan/guest/query/list")]
public async Task<IHttpActionResult> GetList([FromBody] SearchGuestModel search)
{
var query = _db.GuaDanOrderGuest
.Where(guest => guest.StatusCode != "404");
if(search.SearchName != null)
{
query = query.Where(guest => guest.followers.u_name.Contains(search.SearchName));
}
var data = await query.ToListAsync();
var data1 = data.Select(a => new
{
name = a.followers != null ? a.followers.u_name : null,
checkindate = a.CheckInAt,
checkoutdate = a.CheckOutAt,
guadanorderno = a.GuaDanOrderNo,
roomName = GetRoomAndBedString(a.RegionRoomBed),
}).ToList();
return Ok(new
{
items = data1,
total = data1.Count(),
});
}
public string GetRoomAndBedString(RegionRoomBed bed)
{
if (bed == null || bed.Room == null) return "";
var room = bed.Room;
var region = room.Region;
var name = room.Name + "/" + bed.Name;
if(region != null)
{
name = region.Name + "/" + name;
}
var parentRegion = region.Region2;
while (parentRegion != null)
{
name = parentRegion.Name + "/" + name;
parentRegion = parentRegion.Region2;
}
return name;
}
public class SearchGuestModel
{
public string SearchName = null;
}
}

View File

@@ -1146,6 +1146,10 @@
.then(res => { .then(res => {
this.resetAutomaticBedAllocation(); this.resetAutomaticBedAllocation();
this.getGuadanOrderGuestByOrderNo(); this.getGuadanOrderGuestByOrderNo();
}).catch((error) => {
this.$refs.messageModal.open({
message: (error.response?.data?.message || error.message)
});
}); });
}, },

View File

@@ -4,24 +4,40 @@
</asp:Content> </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="page_nav" Runat="Server"> <asp:Content ID="Content2" ContentPlaceHolderID="page_nav" Runat="Server">
<nav class="search-bar"> <nav class="search-bar">
<div class="form-item"> <div class="form-item">
<label>姓名:</label> <label>姓名:</label>
<input v-model="search.searchName" type="text" placeholder="请输入姓名"> <input v-model="search.searchName" type="text" placeholder="請輸入姓名">
</div> </div>
<div class="form-item"> <div class="form-item">
<label>入住日期:</label> <label>入住日期:</label>
<input v-model="search.date" type="date"> <input v-model="search.searchCheckInDate" type="date">
</div> </div>
<div class="form-item"> <div class="form-item">
<button @click="handleSearch" type="button">查询</button> <label>退房日期:</label>
<button type="button" @click="clearSearch">清除查询条件</button> <input type="date" v-model="search.searchCheckOutDate">
</div> </div>
</nav>
<div class="form-item">
<label>入住日期區間:</label>
<input type="date" v-model="search.searchCheckInDateStart"> -
<input type="date" v-model="search.searchCheckInDateEnd">
</div>
<div class="form-item">
<label>退房日期區間:</label>
<input type="date" v-model="search.searchCheckOutDateStart"> -
<input type="date" v-model="search.searchCheckOutDateEnd">
</div>
<div class="form-item buttons">
<button @click="handleSearch" type="button">查詢</button>
<button type="button" @click="clearSearch">清除查詢條件</button>
</div>
</nav>
</asp:Content> </asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div> <div>
<v-data-table <v-data-table
@@ -45,6 +61,9 @@
<template #item.checkoutdate ="{item}"> <template #item.checkoutdate ="{item}">
{{item.checkoutdate|timeString('YYYY-MM-DD')}} {{item.checkoutdate|timeString('YYYY-MM-DD')}}
</template> </template>
<template #item.guadanorderno="{item}">
{{item.guadanorderno}}<a :href="'/admin/guadan/create.aspx?orderId='+item.guadanorderno" class="btn btn-outline-primary">查看掛單</a>
</template>
</v-data-table> </v-data-table>
<v-container> <v-container>
<v-row class="align-baseline" wrap> <v-row class="align-baseline" wrap>
@@ -67,7 +86,7 @@
:max="pageCount" :max="pageCount"
@input="options.page = parseInt($event, 10)" @input="options.page = parseInt($event, 10)"
></v-text-field> ></v-text-field>
</v-col> </v-col>
</v-row> </v-row>
</v-container> </v-container>
</div> </div>
@@ -76,7 +95,7 @@
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" Runat="Server"> <asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" Runat="Server">
</asp:Content> </asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="footer_script" Runat="Server"> <asp:Content ID="Content5" ContentPlaceHolderID="footer_script" Runat="Server">
<style> <style>
.search-bar { .search-bar {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -123,23 +142,29 @@ button:hover {
loading: false, loading: false,
search: { search: {
searchName: null, searchName: null,
searchCheckInDateStart: null,//入住日期開始
searchCheckInDateEnd: null,//入住日期的結束
searchCheckOutDateStart: null,//退房日期的開始
searchCheckOutDateEnd: null,//退房日期的結束
searchCheckInDate: null,
searchCheckOutDate: null,
}, },
options: { options: {
page: 1, // 当前页 page: 1, // 當前頁
itemsPerPage: 1, // 每页条数 itemsPerPage: 10, // 每頁條數
sortBy: [], sortBy: [],
sortDesc: [] sortDesc: []
}, },
headers: [ headers: [
{ text: '姓名', value: 'name' }, { text: '姓名', value: 'name' },
{ text: '挂单单号', value: 'guadanorderno'}, { text: '掛單單號', value: 'guadanorderno' },
{ text: '入住日期', value: 'checkindate' }, { text: '入住日期', value: 'checkindate' },
{ text: '退房日期', value: 'checkoutdate'}, { text: '退房日期', value: 'checkoutdate' },
{ text: '房间号', value: 'roomName' }, { text: '房間號', value: 'roomName' },
], ],
guests: [], // 表格数据 guests: [], // 表格數據
total: 0, total: 0,
} }
}, },
@@ -157,9 +182,19 @@ button:hover {
}, },
clearSearch() { clearSearch() {
this.search.searchName = null; this.search.searchName = null;
this.search.searchCheckInDate = null;
this.search.searchCheckOutDate = null;
this.search.searchCheckInDateStart = null;
this.search.searchCheckInDateEnd = null;
this.search.searchCheckOutDateStart = null;
this.search.searchCheckOutDateEnd = null;
this.resetTableOptions(); this.resetTableOptions();
}, },
fetchGuests() { fetchGuests() {
if (this.search.searchName && this.search.searchName.includes(' ')) {
alert('搜索內容不能包含空格');
return; // 阻止繼續執行
}
if (this.loading) return; if (this.loading) return;
this.loading = true; this.loading = true;
axios.post('/api/guadan/guest/query/list', axios.post('/api/guadan/guest/query/list',
@@ -167,19 +202,25 @@ button:hover {
page: this.options.page, page: this.options.page,
pageSize: this.options.itemsPerPage, pageSize: this.options.itemsPerPage,
searchName: this.search.searchName, searchName: this.search.searchName,
date: this.search.date searchCheckInDate: this.search.searchCheckInDate,
searchCheckOutDate: this.search.searchCheckOutDate,
searchCheckInDateStart: this.search.searchCheckInDateStart,
searchCheckInDateEnd: this.search.searchCheckInDateEnd,
searchCheckOutDateStart: this.search.searchCheckOutDateStart,
searchCheckOutDateEnd: this.search.searchCheckOutDateEnd,
}).then(res => { }).then(res => {
this.guests = res.data.items; // 数据 this.guests = res.data.items; // 數據
this.total = res.data.total; // 总数 this.total = res.data.total; // 總數
}).finally(() => { }).finally(() => {
this.loading = false; this.loading = false;
}); });
} }
}, },
watch: { watch: {
options: { options: {
handler() { handler() {
this.fetchGuests(); // 监听分页、排序化,自动加载数据 this.fetchGuests(); // 監聽分頁、排序化,自動載入數據
}, },
deep: true, deep: true,
} }
@@ -194,5 +235,4 @@ button:hover {
} }
}) })
</script> </script>
</asp:Content> </asp:Content>

View File

@@ -6,13 +6,29 @@
<nav> <nav>
<a href="create.aspx" class="btn btn-primary" >新建掛單</a> <a href="create.aspx" class="btn btn-primary" >新建掛單</a>
</nav> </nav>
<div class="d-flex align-items-center gap-3">
<label class="mb-0">掛單登記人</label>
<input class="form-control w-auto" style="width:150px;" v-model="search.guadanUser" />
<label class="mb-0">開始時間</label>
<input class="form-control w-auto" style="width:150px;" type="date" v-model="search.startDate" />
<label class="mb-0">結束時間</label>
<input class="form-control w-auto" style="width:150px;" type="date" v-model="search.endDate" />
<button class="btn btn-primary" type="button" @click="handleSearch">查詢</button>
<button class="btn btn-outline-primary" type="button" @click="clearSearch">清除條件</button>
</div>
</asp:Content> </asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="mx-5"> <div class="mx-5">
<v-data-table <v-data-table
:items="items" :items="items"
:headers="headers"> :headers="headers"
hide-default-footer>
<template #item.actions="{item}"> <template #item.actions="{item}">
<a :href="'create.aspx?orderId='+item.guaDanOrderNo" class="btn btn-secondary">編輯</a> <a :href="'create.aspx?orderId='+item.guaDanOrderNo" class="btn btn-secondary">編輯</a>
<a class="btn btn-outline-danger" @click="deleteGuadanOrder(item)">取消</a> <a class="btn btn-outline-danger" @click="deleteGuadanOrder(item)">取消</a>
@@ -27,15 +43,50 @@
{{item.status}} {{item.status}}
</template> </template>
<template #item.start_date="{item}"> <template #item.start_date="{item}">
{{item.start_date | timeString('YYYY/MM/DD HH:mm')}} {{item.start_date | timeString('YYYY/MM/DD')}}
</template> </template>
<template #item.end_date="{item}"> <template #item.end_date="{item}">
{{item.end_date | timeString('YYYY/MM/DD HH:mm')}} {{item.end_date | timeString('YYYY/MM/DD')}}
</template> </template>
<template #item.created_at="{item}"> <template #item.created_at="{item}">
{{item.created_at | timeString('YYYY/MM/DD HH:mm')}} {{item.created_at | timeString('YYYY/MM/DD HH:mm')}}
</template> </template>
</v-data-table> </v-data-table>
<v-container>
<v-row class="align-baseline" wrap="false">
<v-col cols="12" md="8">
<v-pagination
v-model="options.page"
:length="pageCount">
</v-pagination>
</v-col>
<v-col class="text-truncate text-right" cols="12" md="2">
共 {{ total }} 筆, 頁數:
</v-col>
<v-col cols="6" md="1">
<v-text-field
v-model="options.page"
type="number"
hide-details
dense
min="1"
:max="pageCount"
@input="options.page = parseInt($event, 10)"
></v-text-field>
</v-col>
<!-- 每页条数选择 -->
<v-col cols="12" md="1">
<v-select
v-model="options.itemsPerPage"
:items="[5, 10, 20, 50]"
label="每頁條數"
dense
hide-details
style="width: 100px;"
></v-select>
</v-col>
</v-row>
</v-container>
</div> </div>
<!-- 更新修改確認彈出視窗 --> <!-- 更新修改確認彈出視窗 -->
<message-modal ref="messageModal"></message-modal> <message-modal ref="messageModal"></message-modal>
@@ -43,6 +94,7 @@
<confirm-modal ref="confirmModal"></confirm-modal> <confirm-modal ref="confirmModal"></confirm-modal>
</asp:Content> </asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" Runat="Server"> <asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" Runat="Server">
<div>test</div>
</asp:Content> </asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="footer_script" Runat="Server"> <asp:Content ID="Content5" ContentPlaceHolderID="footer_script" Runat="Server">
<script> <script>
@@ -65,17 +117,74 @@
{ text: '備註', value: 'notes', align: 'center' }, { text: '備註', value: 'notes', align: 'center' },
{ text: '操作', value: 'actions', align: 'center' } { text: '操作', value: 'actions', align: 'center' }
], ],
options: {
page: 1, // 當前頁
itemsPerPage: 10, // 每頁條數
sortBy: [],
sortDesc: []
},
search: {
startDate: null,
endDate: null,
guadanUser: null,
},
total: 0,
loading: false,
} }
}, },
methods: { methods: {
resetTableOptions() {
this.options = {
page: 1,
itemsPerPage: 10,
sortBy: [],
sortDesc: []
};
},
handleSearch() {
const val = this.search.guadanUser;
// 驗證是否包含空格
if (val && /\s/.test(val)) {
this.$refs.messageModal.open({
message: '掛單登記人不能包含空格'
});
return;
}
// 驗證長度
if (val && val.length > 10) {
this.$refs.messageModal.open({
message: '掛單登記人不能超過 10 個字'
});
return;
}
this.resetTableOptions();
},
clearSearch() {
this.search.startDate = null;
this.search.endDate = null;
this.search.guadanUser = null;
this.resetTableOptions();
},
getGuadanOrder() { getGuadanOrder() {
axios.get('/api/guadan/list') if (this.loading) return;
axios.post('/api/guadan/list', {
startDate: this.search.startDate,
endDate: this.search.endDate,
guadanUser: this.search.guadanUser,
page: this.options.page,
pageSize: this.options.itemsPerPage
})
.then((res) => { .then((res) => {
this.items = res.data; this.items = res.data.data;
this.total = res.data.total;
}).catch((err) => { }).catch((err) => {
console.log(err); console.log(err);
}) }).finally(() => {
this.loading = false;
});
}, },
deleteGuadanOrder(order) { deleteGuadanOrder(order) {
this.$refs.confirmModal.open({ this.$refs.confirmModal.open({
@@ -101,11 +210,21 @@
}, },
}, },
watch: { watch: {
options: {
handler() {
this.getGuadanOrder(); // 監聽分頁、排序變化,自動載入數據
},
deep: true,
}
}, },
mounted() { mounted() {
this.getGuadanOrder(); this.getGuadanOrder();
}, },
computed: {
pageCount() {
return Math.ceil(this.total / this.options.itemsPerPage)
},
}
}); });
</script> </script>
</asp:Content> </asp:Content>

View File

@@ -1,143 +0,0 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" CodeFile="statistics.aspx.cs" Inherits="admin_guadan_statistics" %>
<asp:Content ID="Content1" ContentPlaceHolderID="page_header" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="page_nav" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="container my-4">
<!-- 客房统计 -->
<div class="row row-cols-2 row-cols-sm-3 row-cols-md-4 row-cols-lg-5 g-3">
<div class="col">
<div class="p-3 bg-light text-center rounded shadow" style="min-height: 180px;">
<div class="fs-2">🏠</div>
<div class="text-muted small mt-1">总房间数量</div>
<div class="fw-bold fs-5 mt-1">{{ roomStatistics.roomCount }}</div>
</div>
</div>
<div class="col">
<div class="p-3 bg-light text-center rounded shadow" style="min-height: 180px;">
<div class="fs-2">🚪</div>
<div class="text-muted small mt-1">空房间数量</div>
<div class="fw-bold fs-5 mt-1">{{ roomStatistics.emptyRoomCount }}</div>
</div>
</div>
<div class="col">
<div class="p-3 bg-light text-center rounded shadow" style="min-height: 180px;">
<div class="fs-2">🛏️</div>
<div class="text-muted small mt-1">总床位数量</div>
<div class="fw-bold fs-5 mt-1">
{{ roomStatistics.bedCount }} (男:{{ roomStatistics.maleBedCount }},女:{{ roomStatistics.femaleBedCount }}
</div>
</div>
</div>
<div class="col">
<div class="p-3 bg-light text-center rounded shadow" style="min-height: 180px;">
<div class="fs-2">🛌</div>
<div class="text-muted small mt-1">可用空床</div>
<div class="fw-bold fs-5 mt-1">
{{ roomStatistics.emptyBedCount }} (男:{{ roomStatistics.emptyMaleBedCount }},女:{{ roomStatistics.emptyFemaleBedCount }}
</div>
</div>
</div>
</div>
<!-- 挂单统计 -->
<div class="row row-cols-2 row-cols-sm-3 row-cols-md-4 row-cols-lg-5 g-3 mt-1">
<div class="col">
<div class="p-3 bg-light text-center rounded shadow" style="min-height: 180px;">
<div class="fs-2">📝</div>
<div class="text-muted small mt-1">总挂单次数</div>
<div class="fw-bold fs-5 mt-1">{{ guadanStatistics.guadanTotalCount }}</div>
</div>
</div>
<div class="col">
<div class="p-3 bg-light text-center rounded shadow" style="min-height: 180px;">
<div class="fs-2">📋</div>
<div class="text-muted small mt-1">当前挂单数量</div>
<div class="fw-bold fs-5 mt-1">{{ guadanStatistics.guadanCurrentCount }}</div>
</div>
</div>
<div class="col">
<div class="p-3 bg-light text-center rounded shadow" style="min-height: 180px;">
<div class="fs-2">👥</div>
<div class="text-muted small mt-1">总挂单人数</div>
<div class="fw-bold fs-5 mt-1">
{{ guadanStatistics.guadanPeopleTotal }} (男:{{ guadanStatistics.guadanPeopleMale }},女:{{ guadanStatistics.guadanPeopleFemale }}
</div>
</div>
</div>
<div class="col">
<div class="p-3 bg-light text-center rounded shadow" style="min-height: 180px;">
<div class="fs-2">👨👩</div>
<div class="text-muted small mt-1">当前挂单人数</div>
<div class="fw-bold fs-5 mt-1">
{{ guadanStatistics.guadanPeopleCurrent }} (男:{{ guadanStatistics.guadanPeopleCurrentMale }},女:{{ guadanStatistics.guadanPeopleCurrentFemale }}
</div>
</div>
</div>
</div>
</div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="footer_script" Runat="Server">
<script>
new Vue({
el: '#app',
vuetify: new Vuetify(vuetify_options),
data() {
return {
roomStatistics: {
roomCount: 0,
emptyRoomCount: 0,
bedCount: 0,
maleBedCount: 0,
femaleBedCount: 0,
emptyBedCount: 0,
emptyMaleBedCount: 0,
emptyFemaleBedCount: 0
},
guadanStatistics: {
guadanTotalCount: 0,
guadanCurrentCount: 0,
guadanPeopleTotal: 0,
guadanPeopleMale: 0,
guadanPeopleFemale: 0,
guadanPeopleCurrent: 0,
guadanPeopleCurrentMale: 0,
guadanPeopleCurrentFemale: 0
},
}
},
methods: {
GetGuadanStatistics() {
axios.get('/api/guadanStatistics/GetGuadanStatistics')
.then((res) => {
this.roomStatistics = res.data.roomStatistics;
this.guadanStatistics = res.data.guadanStatistics;
})
}
},
watch: {
},
mounted() {
this.GetGuadanStatistics();
// 每两分钟更新一次 (2 * 60 * 1000 毫秒)
setInterval(() => {
this.GetGuadanStatistics();
}, 1 * 60 * 1000);
},
})
</script>
</asp:Content>

View File

@@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class admin_guadan_statistics : MyWeb.config
{
protected void Page_Load(object sender, EventArgs e)
{
}
}

View File

@@ -9,41 +9,56 @@
<div class="section mb-6"> <div class="section mb-6">
<v-card outlined class="pa-1"> <v-card outlined class="pa-1">
<v-card-title class="headline grey--text text--darken-2"> <v-card-title class="headline grey--text text--darken-2">
今日使用情况 掛單統計
</v-card-title> </v-card-title>
<v-divider class="mb-4"></v-divider> <v-divider class="mb-4"></v-divider>
<v-card-text> <v-card-text>
<div class="d-flex flex-wrap justify-space-around"> <div class="row row-cols-2 row-cols-sm-3 row-cols-md-4 row-cols-lg-5 g-3 mt-1">
<v-card class="ma-2 pa-3 text-center" color="#e3f2fd" outlined> <div class="col">
<div class="subtitle-1 font-weight-bold">总预订人数</div> <div class="p-3 bg-light text-center rounded shadow" style="min-height: 180px;">
<div class="headline">{{totalbookers }}</div> <div class="fs-2">📝</div>
</v-card> <div class="text-muted small mt-1">总挂单次数</div>
<v-card class="ma-2 pa-3 text-center" color="#e3f2fd" outlined> <div class="fw-bold fs-5 mt-1">{{ guadanStatistics.guadanTotalCount }}</div>
<div class="subtitle-1 font-weight-bold">今日预订人数</div> </div>
<div class="headline">{{today.todaytotalbookers }}</div> </div>
</v-card>
<v-card class="ma-2 pa-3 text-center" color="#e3f2fd" outlined> <div class="col">
<div class="subtitle-1 font-weight-bold">今日已入住人数</div> <div class="p-3 bg-light text-center rounded shadow" style="min-height: 180px;">
<div class="headline">{{today.checkin }}</div> <div class="fs-2">📋</div>
</v-card> <div class="text-muted small mt-1">当前挂单数量</div>
<v-card class="ma-2 pa-3 text-center" color="#e3f2fd" outlined> <div class="fw-bold fs-5 mt-1">{{ guadanStatistics.guadanCurrentCount }}</div>
<div class="subtitle-1 font-weight-bold">今日待入住人数</div> </div>
<div class="headline">{{today.todaytotalbookers - today.checkin }}</div> </div>
</v-card>
<v-card class="ma-2 pa-3 text-center" color="#fce4ec" outlined> <div class="col">
<div class="subtitle-1 font-weight-bold">空床數</div> <div class="p-3 bg-light text-center rounded shadow" style="min-height: 180px;">
<div class="headline">{{ bedcount - today.todaytotalbookers}}</div> <div class="fs-2">👥</div>
</v-card> <div class="text-muted small mt-1">总挂单人数</div>
<div class="fw-bold fs-5 mt-1">
{{ guadanStatistics.guadanPeopleTotal }} (男:{{ guadanStatistics.guadanPeopleMale }},女:{{ guadanStatistics.guadanPeopleFemale }}
</div>
</div>
</div>
<div class="col">
<div class="p-3 bg-light text-center rounded shadow" style="min-height: 180px;">
<div class="fs-2">👨👩</div>
<div class="text-muted small mt-1">已預約掛單人數</div>
<div class="fw-bold fs-5 mt-1">
{{ guadanStatistics.guadanPeopleCurrent }} (男:{{ guadanStatistics.guadanPeopleCurrentMale }},女:{{ guadanStatistics.guadanPeopleCurrentFemale }}
</div> </div>
</div>
</div>
</div>
</v-card-text> </v-card-text>
</v-card> </v-card>
</div> </div>
<!-- 近期床位使用統計 --> <!-- 近期床位使用統計 -->
<div class="section container"> <div class="section container">
<!-- 日期筛选区 --> <!-- 日期筛选区 -->
<div class="d-flex align-center flex-wrap" style="gap: 12px;"> <div class="d-flex align-center flex-wrap" style="gap: 5px;">
<!-- 开始日期 --> <!-- 开始日期 -->
<v-menu <v-menu
ref="menu1" ref="menu1"
@@ -100,6 +115,12 @@
> >
查詢 查詢
</v-btn> </v-btn>
<v-btn
color="primary"
style="align-self: stretch;"
@click="exportStatisticsToExcel">
導出下面表格數據到Excel
</v-btn>
</div> </div>
</div> </div>
@@ -119,6 +140,18 @@
<template #item.date="{ item }"> <template #item.date="{ item }">
<span>{{ item.date | timeString('YYYY-MM-DD') }}</span> <span>{{ item.date | timeString('YYYY-MM-DD') }}</span>
</template> </template>
<template #item.todaytotalbookers="{item}">
<span>
{{item?.todaytotalbookers + '(男: ' + item.bookmale + ', 女:' + item.bookfemale + ')'}}
</span>
<button type="button" class="btn btn-outline-primary" @click="showBookDialog(item, '已預約','booking')">查看預約人</button>
</template>
<template #item.checkin="{item}">
<span>
{{item?.checkin + '(男: ' + item.checkinmale + ', 女:' + item.checkinfemale + ')'}}
</span>
<button type="button" class="btn btn-outline-primary" @click="showBookDialog(item, '已入住', 'checkin')">查看入住人</button>
</template>
<template #item.bedusagerate="{ item }"> <template #item.bedusagerate="{ item }">
{{ ((item.todaytotalbookers / bedcount) * 100).toFixed(2) + '%' }} {{ ((item.todaytotalbookers / bedcount) * 100).toFixed(2) + '%' }}
</template> </template>
@@ -130,6 +163,38 @@
</template> </template>
</v-data-table> </v-data-table>
</div> </div>
<div>
<v-dialog v-model="bookerDialog.show" max-width="500">
<v-card
style="width: 40vw; height: 50vh; display: flex; flex-direction: column;"
>
<!-- 标题 -->
<v-card-title class="text-h5" style="flex: 0 0 auto; background-color: #1976D2; color: white; padding: 16px;">
{{ bookerDialog.title }}
</v-card-title>
<!-- 内容撑满 -->
<v-card-text
style="flex: 1; overflow-y: auto;"
>
<v-data-table
:items="bookerDialog.items"
:headers="bookerDialog.headers">
</v-data-table>
</v-card-text>
<!-- 底部按钮 -->
<v-card-actions>
<v-spacer></v-spacer>
<v-btn text @click="closeBookDialog">關閉</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
</asp:Content> </asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" Runat="Server"> <asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" Runat="Server">
@@ -154,20 +219,76 @@
{ text: '可用床位', value: 'availableBeds' }, { text: '可用床位', value: 'availableBeds' },
{ text: '床位利用率', value: 'bedusagerate' } { text: '床位利用率', value: 'bedusagerate' }
], ],
today: {},
totalbookers: 0,
startDate: null, startDate: null,
endDate: null, endDate: null,
menu1: false, menu1: false,
menu2: false, menu2: false,
bedcount: 0, bedcount: 0,
roomcount: 0, roomcount: 0,
guadanStatistics: {
guadanTotalCount: 0,
guadanCurrentCount: 0,
guadanPeopleTotal: 0,
guadanPeopleMale: 0,
guadanPeopleFemale: 0,
guadanPeopleCurrent: 0,
guadanPeopleCurrentMale: 0,
guadanPeopleCurrentFemale: 0
},
bookerDialog: {
title: "",
show: false,
items: [],
headers: [
{ text: '姓名', value: 'name' },
{ text: "性别", value: 'gender'}
]
}
} }
}, },
methods: { methods: {
showBookDialog(item, title, type = null) {
this.bookerDialog.title = title;
this.bookerDialog.show = true;
if (type === 'booking') {
this.getBookerDialogBookingItems(item.date);
}
else if (type === 'checkin') {
this.getBookerDialogCheckInItems(item.date);
}
},
closeBookDialog() {
this.bookerDialog.show = false;
this.bookerDialog.title = "";
this.bookerDialog.items = [];
},
async getBookerDialogBookingItems(date) {
try {
const res = await axios.get(HTTP_HOST + 'api/guadan/guest/booking/list', {
params: {
date: date
}
});
this.bookerDialog.items = res.data;
} catch(error) {
}
},
async getBookerDialogCheckInItems(date) {
try {
const res = await axios.get(HTTP_HOST + 'api/guadan/guest/checkin/list', {
params: {
date: date
}
});
this.bookerDialog.items = res.data;
} catch (error) {
}
},
async getList() { async getList() {
try { try {
const res = await axios.get('/api/guadan/guadanstatisticstable/list', { const res = await axios.get(HTTP_HOST + 'api/guadan/guadanstatisticstable/list', {
params: { params: {
start: this.startDate || '', start: this.startDate || '',
end: this.endDate || '' end: this.endDate || ''
@@ -176,18 +297,52 @@
this.items = res.data.statistics; this.items = res.data.statistics;
this.roomcount = res.data.roomcount; this.roomcount = res.data.roomcount;
this.bedcount = res.data.bedcount; this.bedcount = res.data.bedcount;
this.today = res.data.today;
this.totalbookers = res.data.totalbookers;
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }
},
exportStatisticsToExcel() {
if (!this.items || !this.items.length) {
console.warn("没有数据可导出");
return;
}
// 1. 取 items 数组并格式化
const sheetData = this.items.map(item => ({
日期: item.date.split('T')[0], // 格式化成 YYYY-MM-DD
预订人数: item.todaytotalbookers,
入住人数: item.checkin
}));
// 2. 转换成 XLSX Sheet
const ws = XLSX.utils.json_to_sheet(sheetData);
// 3. 创建 Workbook 并添加 Sheet
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, "统计数据");
// 4. 写入 Excel 并下载
const wbout = XLSX.write(wb, { bookType: "xlsx", type: "array" });
saveAs(new Blob([wbout], { type: "application/octet-stream" }), "statistics.xlsx");
},
GetGuadanStatistics() {
axios.get('/api/guadanStatistics/GetGuadanStatistics')
.then((res) => {
this.guadanStatistics = res.data.guadanStatistics;
})
} }
}, },
mounted() { mounted() {
this.getList(); this.getList();
this.GetGuadanStatistics();
} }
}) })
</script> </script>
<!-- CDN 方式引入 XLSX 和 FileSaver -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js"></script>
</asp:Content> </asp:Content>

View File

@@ -19,53 +19,24 @@ public partial class admin_printpw_index : MyWeb.function
private string previousOrderno = ""; private string previousOrderno = "";
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
//Response.Write("item:"+Request["item"]+"<br>");
//Response.Write("file:"+Request["file"]+"<br>");
//Response.Write("list:"+Request["list"]+"<br>");
//if (!IsPostBack)
//{
this.Title = "預覽牌位"; this.Title = "預覽牌位";
if (Request.HttpMethod == "POST") if (Request.HttpMethod == "POST")
{ {
/*if (!String.IsNullOrEmpty(Request["item"]) &&
!String.IsNullOrEmpty(Request["file"]) &&
!String.IsNullOrEmpty(Request["list"])
)*/
if (!String.IsNullOrEmpty(Request["order_no"])) if (!String.IsNullOrEmpty(Request["order_no"]))
{ {
var order_no = Request["order_no"]; var order_no = Request["order_no"];
var oderList = _db.pro_order_detail var oderList = _db.pro_order_detail
.Where(u => u.order_no == order_no && u.printed_files != null) .Where(u => u.order_no == order_no)
.Where(u => (u.parent_num != null)
|| u.actItem.subject.Contains("牌")
|| !string.IsNullOrEmpty(u.f_num_tablet))
//因為目前在[pro_order_detail]表中,沒有辦法區分那些項目是牌位,
//只有根據某些欄位來做部分篩選,可能會篩選錯
//但是為什麼沒有欄位可以區分一個項目是不是牌位呢?
.Select(u => new { detail_num = u.num, actItem_num = u.actItem_num }).ToArray(); .Select(u => new { detail_num = u.num, actItem_num = u.actItem_num }).ToArray();
Repeater1.DataSource = oderList; Repeater1.DataSource = oderList;
Repeater1.DataBind(); Repeater1.DataBind();
} }
else if (!String.IsNullOrEmpty(Request["activity_num"]))
{
//var _details = Newtonsoft.Json.JsonConvert.DeserializeObject<int[]>(Request["list"]);
//string json = "";
//using (System.IO.StreamReader oSR = new System.IO.StreamReader(Request.InputStream))
// json = oSR.ReadToEnd();
int activity_num = Convert.ToInt32(Request["activity_num"]);
//Repeater1.DataSource = _details;
var orderList = _db.pro_order.Where(u => u.activity_num == activity_num).Select(u => u.order_no).ToList();
var gdzOrderList = _db.pro_order_detail.Where(u => orderList.Contains(u.order_no) && u.print_id.Contains("主") ).Select(u=>u.order_no).Distinct().ToArray();
var datalist = _db.pro_order_detail
.Where(u => gdzOrderList.Contains(u.order_no) && u.print_id.Contains("主") && u.parent_num != null && u.printed_files != null)
.OrderBy(o => o.order_no)
.ThenBy(o => o.actItem_num)
.ThenBy(o=>o.print_id)
.Select(u => new {detail_num=u.num ,actItem_num=u.actItem_num})
.ToArray();
//List<int> ints = new List<int>();
//ints.Add(12133);
Repeater1.DataSource = datalist;
Repeater1.DataBind();
if (!String.IsNullOrEmpty(Request["title"]))
{
this.Title += " - " + Request["title"];
}
}
else else
{ {
Response.Clear(); Response.Clear();
@@ -74,9 +45,6 @@ public partial class admin_printpw_index : MyWeb.function
} }
} }
//}
} }
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e) protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
@@ -248,8 +216,8 @@ public partial class admin_printpw_index : MyWeb.function
catch (Exception ex) catch (Exception ex)
{ {
var msg = ex.Message; var msg = ex.Message;
ret[0] = "??:" + msg; ret[0] = "";
ret[1] = "??"; ret[1] = "";
} }
return ret; return ret;
} }

View File

@@ -24,6 +24,8 @@
@page a4l { @page a4l {
size: a4 landscape; size: a4 landscape;
margin: 0; margin: 0;
margin-top:6mm;
margin-left:6mm;
} }
@page a5 { @page a5 {
@@ -133,6 +135,22 @@ pre {
line-height: calc(var(--fs_w) * 1.0); line-height: calc(var(--fs_w) * 1.0);
} }
.text-block.fit-text.add-space {
letter-spacing: 0.5em;
}
.text-block.fit-text.mid_text.add-space {
padding-top: 0.5em;
}
.text-block.fit-text.mid_text.add-space.add-space-3 {
letter-spacing: 1.5em;
padding-top: 1.5em;
}
body.tblt-m .left_text {
--font-max: 30pt;
}
body.tblt-m .top_text_2 {
right: 8mm;
}
.vertical { .vertical {
writing-mode: vertical-rl; writing-mode: vertical-rl;
/*text-orientation: upright;*/ /*text-orientation: upright;*/
@@ -367,6 +385,10 @@ pre {
left: 2mm; left: 2mm;
} }
.top_text_3 {
display: none;
}
/*舊式紙張*/ /*舊式紙張*/
body.tablet-l { body.tablet-l {
--page-w: 274mm; --page-w: 274mm;
@@ -548,6 +570,9 @@ body.tblt-l.a3.l2b .mid_text {
--divh: 60mm; --divh: 60mm;
top: 40%; top: 40%;
} }
body.tblt-l.a3 .left_text {
--font-max: 36pt;
}
body.tblt-l.a3.l2b .mid_text_2 { body.tblt-l.a3.l2b .mid_text_2 {
--divh: 180mm; --divh: 180mm;
@@ -638,7 +663,8 @@ body.tblt-m.a4-mrg {
} }
body.tblt-m.a4-mrg .page { body.tblt-m.a4-mrg .page {
--page-w: 100mm; --page-w: 95mm;
margin-left:5mm;
float: left; float: left;
} }
@@ -763,9 +789,8 @@ body.tblt-xs {
} }
body.tblt-xs.a3-mrg .page { body.tblt-xs.a3-mrg .page {
/*--page-w: 57mm;*/ --page-w: 57mm;
--page-w: 59mm; --page-h: 98mm;
--page-h: 100mm;
page-break-after: auto; page-break-after: auto;
float: left; float: left;
} }
@@ -775,13 +800,11 @@ body.tblt-xs.a4l-mrg {
} }
body.tblt-xs.a4l-mrg .page { body.tblt-xs.a4l-mrg .page {
/* --page-w: 57mm; */ --page-w: 57mm;
--page-w: 59mm; --page-h: 98mm;
--page-h: 100mm;
page-break-after: auto; page-break-after: auto;
float: left; float: left;
} }
body.tblt-xs .top_text_1 { body.tblt-xs .top_text_1 {
font-size: 8pt; font-size: 8pt;
} }
@@ -800,9 +823,9 @@ body.tblt-xs .mid_text_2 {
} }
body.tblt-xs .right_text { body.tblt-xs .right_text {
--divw: 12mm; --divw: 10mm;
--divh: 60mm; --divh: 60mm;
right: 0mm; right: 2mm;
top: 25mm; top: 25mm;
} }
@@ -825,8 +848,7 @@ body.tblt-xs .top_text_2{
/*[標準X2B]隨喜牌位-佛力超薦-往生蓮位-A3(直)*/ /*[標準X2B]隨喜牌位-佛力超薦-往生蓮位-A3(直)*/
right: 2mm; right: 2mm;
right: 3.0mm; right: 3.0mm;
right: 3.5mm; right: 5mm;
/* right: 4.0mm; */
} }
body.tblt-xs .txt_up { body.tblt-xs .txt_up {
@@ -1075,35 +1097,4 @@ body.prayer-h pre {
/*[標準X1A]隨喜牌位-佛光注照-長生祿位-A4(橫) */ /*[標準X1A]隨喜牌位-佛光注照-長生祿位-A4(橫) */
* { * {
outline:0 none !important; outline:0 none !important;
} }
/*让自定义的分页生效在某个div后面产生class-page从而分页当牌位不是同一家人的时候就分页*/
@media print {
.page-break {
display: block !important;
width: 100%;
height: 1px;
visibility: hidden;
page-break-after: always;
}
.page {
page-break-inside: auto !important;
}
@page {
orphans: 1;
widows: 1;
}
.d-flex {
display: block !important;
}
.page-break::after {
content: "";
display: block;
height: 1px;
visibility: hidden;
}
}

View File

@@ -32,17 +32,25 @@ function init_print() {
//console.log(i, $(this).html(),$(this).text()); //console.log(i, $(this).html(),$(this).text());
//console.log(i, txt==htm); //console.log(i, txt==htm);
//console.log(i, txt_arr, line, line_len); //console.log(i, txt_arr, line, line_len);
line_len = Math.ceil(line_len / 5) * 5; line_len = Math.ceil(line_len / 3) * 3;
//if(line>1){ //if(line>1){
css = $(this).attr("style")||""; css = $(this).attr("style")||"";
if(css.length>0){ if(css.length>0){
css += ";"; css += ";";
} }
css += "--lines:" + line + ";--line_len:" + line_len + ";"; css += "--lines:" + line + ";--line_len:" + line_len + ";";
//debugger;
//字少時, 加空間
let allShort = txt_arr2.every(line => line.trim().length <= 7);
let addSpaceClass = allShort ? "add-space" : "";
allShort = txt_arr2.every(line => line.trim().length <= 3);
addSpaceClass += allShort ? " add-space-3" : "";
htm_lines = txt_arr2.join("<br>"); htm_lines = txt_arr2.join("<br>");
$(this).attr("style", css); $(this)
$(this).html(htm_lines); .attr("style", css)
.addClass(addSpaceClass)
.html(htm_lines);
//} //}
//console.log(i, line, line_len, css,txt); //console.log(i, line, line_len, css,txt);
}); });

View File

@@ -153,6 +153,9 @@
<template #item.slot_type ="{item}"> <template #item.slot_type ="{item}">
{{item.detail.actItem?.substring(0,3)}} {{item.detail.actItem?.substring(0,3)}}
</template> </template>
<template #item.up_time ="{item}">
{{item.up_time|timeString('YYYY-MM-DD')}}
</template>
<template #item.print="{item}"> <template #item.print="{item}">
<v-icon color="blue" class="mr-2" @click="yulan_single(item);" > <v-icon color="blue" class="mr-2" @click="yulan_single(item);" >
mdi-printer mdi-printer

View File

@@ -171,43 +171,49 @@
</div> </div>
</div> </div>
</div> </div>
<div> <div>
<v-dialog v-model="bedSchedule.dialogVisible" max-width="900"> <v-dialog v-model="bedSchedule.dialogVisible" max-width="900px">
<v-card> <v-card
<v-card-title> style="min-height:50vh; max-height:80vh; display:flex; flex-direction:column;"
<span class="text-h6">床位排程明細 - {{ bedSchedule.selectedBed?.name }}</span> >
<v-spacer></v-spacer> <v-card-title>
<v-btn icon @click="closeBedSchedule"> <span class="text-h6">床位排程明細 - {{ bedSchedule.selectedBed?.name }}</span>
<v-icon>mdi-close</v-icon> <v-spacer></v-spacer>
</v-btn> <v-btn icon @click="closeBedSchedule"><v-icon>mdi-close</v-icon></v-btn>
</v-card-title> </v-card-title>
<v-card-text> <!-- 关键改动flex:1 1 auto; min-height:0; overflow-y:auto -->
<v-data-table <v-card-text style="flex:1 1 auto; min-height:0; overflow-y:auto;">
:headers="bedSchedule.scheduleHeaders" <div style="min-height:0;">
:items="bedSchedule.selectedBed?.schedules || []" <v-data-table
class="elevation-1" :headers="bedSchedule.scheduleHeaders"
dense :items="bedSchedule.selectedBed?.schedules || []"
hide-default-footer :items-per-page="9999"
:items-per-page="5" class="elevation-1"
> dense
<template #item.scheduleDate="{item}"> hide-default-footer
{{item.scheduledate|timeString('YYYY-MM-DD')}} >
</template> <template #item.scheduleDate="{item}">
<template #item.actions =" {item}"> {{ item.scheduledate | timeString('YYYY-MM-DD') }}
<a :href="'/admin/guadan/create.aspx?orderId='+item.guaDanOrderNo" class="btn btn-primary">查看掛單</a> </template>
</template> <template #item.actions="{item}">
</v-data-table> <a :href="'/admin/guadan/create.aspx?orderId='+item.guaDanOrderNo" class="btn btn-primary">
</v-card-text> 查看掛單
</a>
</template>
</v-data-table>
</div>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn text color="primary" @click="closeBedSchedule">關閉</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn text color="primary" @click="closeBedSchedule">關閉</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
</asp:Content> </asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" Runat="Server"> <asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" Runat="Server">
</asp:Content> </asp:Content>

View File

@@ -582,6 +582,7 @@
this.selectedType = 'region'; this.selectedType = 'region';
this.selectedRegionId = region.uuid; this.selectedRegionId = region.uuid;
this.currentSelectRegion = region; this.currentSelectRegion = region;
console.log(this.currentSelectRegion)
this.currentSelectRoom = null; this.currentSelectRoom = null;
this.resetRoomForm(); this.resetRoomForm();
this.form = { this.form = {
@@ -664,7 +665,7 @@
}); });
}, },
confirmDeleteRegion() { confirmDeleteRegion() {
axios.post('/api/region/delete', { statuscode: this.form.statuscode }) axios.post('/api/region/delete', { Uuid: this.form.uuid })
.then(() => { .then(() => {
this.showDeleteModal = false; this.showDeleteModal = false;
this.$refs.messageModal.open({ this.$refs.messageModal.open({
@@ -906,6 +907,10 @@
this.currentSelectRoom = null; this.currentSelectRoom = null;
this.room_bed.bed_items = []; this.room_bed.bed_items = [];
//清空 beds //清空 beds
}).catch((error) => {
this.$refs.messageModal.open({
message: (error.response?.data?.message || error.message)
});
}); });
}, },
confirmRoomDelete() { confirmRoomDelete() {

View File

@@ -24,7 +24,7 @@
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div v-if="currentActivityNum"> <div v-if="currentActivityNum">
<div><h2 style="text-align:center">消災疏文</h2></div> <div><h2 style="text-align:center">消災疏文</h2></div>
<div v-for="item in ShuWenJson.xiaozai" :key="Object.keys(item)[0]"> <div v-for="(item, index) in ShuWenJson?.xiaozai" :key="Object.keys(item)[0] + 'xz' + index">
<h4>報名信眾:{{ item[Object.keys(item)[0]].user.name }}</h4> <h4>報名信眾:{{ item[Object.keys(item)[0]].user.name }}</h4>
<ul> <ul>
<li>{{ item[Object.keys(item)[0]]['biaoti'].join(' ') }}</li> <li>{{ item[Object.keys(item)[0]]['biaoti'].join(' ') }}</li>
@@ -32,7 +32,7 @@
<hr /> <hr />
</div> </div>
<div><h2 style="text-align:center">超薦疏文</h2></div> <div><h2 style="text-align:center">超薦疏文</h2></div>
<div v-for="item in ShuWenJson.chaodu" :key="Object.keys(item)[0]"> <div v-for="(item, index) in ShuWenJson?.chaodu" :key="Object.keys(item)[0] + 'cj' + index">
<h4>報名信眾:{{ item[Object.keys(item)[0]].user.name }}</h4> <h4>報名信眾:{{ item[Object.keys(item)[0]].user.name }}</h4>
<ul> <ul>
<li> <li>
@@ -113,7 +113,10 @@
this.ShuWenJson = {} this.ShuWenJson = {}
return; return;
} }
this.ShuWenJson = JSON.parse(this.ShuWenItem.shuWenList) this.ShuWenJson = this.ShuWenItem?.shuWenList
? JSON.parse(this.ShuWenItem.shuWenList)
: { xiaozai: [], chaodu: [] }; // 默认空对象
}) })
.catch(err => { .catch(err => {
if (err.response && err.response.status === 400) { if (err.response && err.response.status === 400) {