This commit is contained in:
2024-09-11 18:06:17 +08:00
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)

View File

@@ -907,6 +907,7 @@ namespace Tnb.ProductionMgr
moTask.estimated_end_date = input.estimated_end_date;
moTask.scheduled_qty = input.scheduled_qty;
PrdMo? mo = await _db.Queryable<PrdMo>().FirstAsync(it => it.id == input.mo_id);
moTask.unit_id = mo.unit_id;
if (mo.mo_status == DictConst.MoCloseId || mo.mo_status == DictConst.MoCompleteId)
throw Oops.Bah("状态错误");
// moTask.unit_id = mo.unit_id;
@@ -1062,7 +1063,8 @@ namespace Tnb.ProductionMgr
workstation_id = resultList?.FirstOrDefault() ?? "",
mo_task_status = DictConst.ToBeScheduledEncode,
workroute_id = item.route_id,
unit_id = item.unit_id,
// unit_id = item.unit_id,
unit_id = mo.unit_id,
workline_id = input.workline_id
};
subMoTask.material_id = item.material_id;