This commit is contained in:
2024-09-11 17:46:33 +08:00
parent a7831e1f79
commit 25636c4b75
4 changed files with 17 additions and 8 deletions

View File

@@ -96,7 +96,7 @@ namespace Tnb.ProductionMgr
// })
// }).FirstAsync();
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(station_id, DictConst.RegionCategoryWorklineCode);
//OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(station_id, DictConst.RegionCategoryWorklineCode);
// PrdMoTask prdMoTask = await db.Queryable<PrdMoTask>().Where(x => x.workline_id == workline.Id && x.worker_id == _userManager.UserId && x.mo_task_status==DictConst.InProgressEnCode)
// .FirstAsync();
@@ -115,6 +115,8 @@ namespace Tnb.ProductionMgr
string nightBeforeEtime = dayNightWorkTime["夜班前"].Split("-")[1];
string nightAfterStime = dayNightWorkTime["夜班后"].Split("-")[0];
string nightAfterEtime = dayNightWorkTime["夜班后"].Split("-")[1];
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(_userManager.User.OrganizeId,DictConst.RegionCategoryWorklineCode);
string userWorklineId = workline?.Id ?? "";
bool twoDayFlag = string.Compare(nowTime, dayStime) >= 0 && string.Compare(nowTime, dayEtime) <= 0;
bool twoNightFlag = string.Compare(nowTime,nightStime)>=0 && string.Compare(nowTime,nightEtime)<=0;
@@ -125,8 +127,10 @@ namespace Tnb.ProductionMgr
string userId = _userManager.UserId;
PrdMoTask prdMoTask = await db.Queryable<PrdMoTask>().
Where(x => x.workline_id == workline.Id && x.mo_task_status==DictConst.InProgressEnCode)
.Where(x=>(x.scheduling_class_type=="1" && twoDayFlag && x.dayshift_worker_id==userId)
LeftJoin<PrdMo>((x,y)=>x.mo_id==y.id)
.Where(x => x.mo_task_status==DictConst.InProgressEnCode)
.Where((x,y)=>(x.scheduling_class_type=="1" && twoDayFlag && x.dayshift_worker_id==userId)
|| (y.mo_type==DictConst.PrdMoTypeBZ && !SqlFunc.IsNullOrEmpty(userWorklineId) && x.workline_id==userWorklineId)
|| (x.scheduling_class_type=="1" && twoNightFlag && x.nightshift_worker_id==userId)
|| (x.scheduling_class_type=="2" && fourDayBeforeFlag && x.dayshift_worker_id==userId)
|| (x.scheduling_class_type=="2" && fourDayAfterFlag && x.dayshiftafter_worker_id==userId)