掛單
This commit is contained in:
1 parent
1cb2a7a35e
commit
8db6019ba3
10 files changed
+1120
-703
No files matched your search
@@ -7,6 +7,7 @@ using Org.BouncyCastle.Asn1.Ocsp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Entity;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
@@ -273,6 +274,42 @@ public class regionRoomBedController : ApiController
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("api/region/bed/getAvailableBeds")]
|
||||
public async Task<IHttpActionResult> GetAvailableBeds([FromBody] dynamic request)
|
||||
{
|
||||
var f = new System.Globalization.CultureInfo("zh-TW",true);
|
||||
//f. = "yyyy-MM-dd";
|
||||
var json = request;
|
||||
DateTime allocationStart = Convert.ToDateTime((string)json.startTime,f);
|
||||
DateTime? allocationEnd = Convert.ToDateTime( (string)json.endTime,f);
|
||||
//bool isAllallocation = true; //是否全部分配完毕
|
||||
// 获取可用床位列表
|
||||
var busyBedUuidsQuery = _db.RegionAndRoomAndBedSchedule
|
||||
.Where(s => s.IsDeleted == false && !s.IsCancel
|
||||
&& ( s.ScheduleDate >= allocationStart
|
||||
&& s.ScheduleDate <= allocationEnd));
|
||||
|
||||
var busyBedUuids = busyBedUuidsQuery
|
||||
.Select(s => s.TargetUuid)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
// 空閒床位 = 所有床位 - 忙碌床位
|
||||
var availableBeds = _db.RegionRoomBed.Select(b=>new {
|
||||
b.Name ,b.Uuid,b.StatusCode,b.IsActive,
|
||||
b.RoomUuid,
|
||||
Room=_db.Room.Where(r=>r.Uuid==b.RoomUuid).
|
||||
Select(r=>new { r.Name,r.RegionUuid,
|
||||
RegionName=_db.Region.Where(g=>g.Uuid==r.RegionUuid).Select(g=>g.Name).FirstOrDefault()}).FirstOrDefault(),
|
||||
})
|
||||
.Where(b => !busyBedUuids.Contains(b.Uuid))
|
||||
.ToList();
|
||||
|
||||
|
||||
return Ok(new { availableBeds });
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("api/region/bed/preallocation")]
|
||||
public async Task<IHttpActionResult> PreAutoAllocationBed([FromBody] ConfirmAllocationRequest request)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user