Commit aca713f3 authored by 黄奎's avatar 黄奎

页面修改

parent 9a308c62
......@@ -126,9 +126,10 @@ namespace Edu.Module.Duty
foreach (var subItem in item.PlanDetails)
{
subItem.WorkContentList = new List<RB_Duty_PlanWork_ViewModel>();
if (subItem.Status == DutyStatusEnum.DutyFinished)
var tempContentList = dutyContentList.Where(qitem => qitem.PlanType == 1 && qitem.PlanId == item.Id && qitem.PlanShift == subItem.Shift && qitem.CreateBy == subItem.DutyMan)?.ToList();
if (tempContentList != null && tempContentList.Count > 0)
{
foreach (var dItem in dutyContentList.Where(qitem => qitem.PlanType == 1 && qitem.PlanId == item.Id && qitem.PlanShift == subItem.Shift))
foreach (var dItem in tempContentList)
{
var dutyItem = dutyItemList?.Where(qitem => qitem.Shifts.Contains(subItem.Shift.ToString()) && qitem.Id == dItem.ItemId && qitem.ItemSchools.Contains(item.School_Id.ToString()))?.FirstOrDefault();
int isFinish = 0;
......@@ -159,7 +160,8 @@ namespace Edu.Module.Duty
foreach (var dutyItem in dutyItemList.Where(qitem => qitem.ItemSchools.Contains(item.School_Id.ToString()) && qitem.Shifts.Contains(subItem.Shift.ToString())))
{
int isFinish = 0;
var dItem = dutyContentList.Where(qitem => qitem.PlanType == 1 && qitem.PlanId == item.Id && qitem.PlanShift == subItem.Shift && qitem.ItemId == dutyItem.Id)?.FirstOrDefault();
var dItem = dutyContentList.Where(qitem => qitem.PlanType == 1 && qitem.PlanId == item.Id
&& qitem.PlanShift == subItem.Shift && qitem.ItemId == dutyItem.Id && qitem.CreateBy == subItem.DutyMan)?.FirstOrDefault();
if (dutyItem.ItemType == ItemTypeEnum.Choice)
{
isFinish = dItem?.WorkIsFinish ?? 0;
......@@ -474,31 +476,14 @@ namespace Edu.Module.Duty
}
//当前班次
var currentModel = new RB_Duty_PlanDetails_ViewModel();
//上一个班次
var previousModel = new RB_Duty_PlanDetails_ViewModel();
//下一个班次
var nextModel = new RB_Duty_PlanDetails_ViewModel();
if (model.PlanDetails != null && model.PlanDetails.Count > 0)
{
//查找当前人员索引
int currentIndex = CalcCurrentDutyManIndexModule_V2(model);
//上一个班次索引
int previousIndex = currentIndex - 1;
//下一个班次索引
int nextIndex = currentIndex + 1;
//当前班次
currentModel = model.PlanDetails[currentIndex];
//上一个班次
if (previousIndex >= 0)
{
previousModel = model.PlanDetails[previousIndex];
}
//下一个班次
if (nextIndex < model.PlanDetails.Count)
{
nextModel = model.PlanDetails[nextIndex];
}
}
if (!isQueryWork)
......@@ -556,10 +541,38 @@ namespace Edu.Module.Duty
}
}
List<object> pList = new List<object>();
var currentPlanContetList = contentList.Where(qitem => qitem.PlanShift == Shift && qitem.PlanType == 1)?.ToList();
var currentPlanContetList = contentList.Where(qitem => qitem.PlanShift == Shift && qitem.PlanType == 1 && qitem.CreateBy==userId)?.ToList();
if (currentPlanContetList == null || (currentPlanContetList != null && currentPlanContetList.Count == 0))
{
foreach (var dayItem in dutyItemList)
{
duty_ContentRepository.Insert(new Model.Entity.Duty.RB_Duty_Content()
{
CreateBy = userId,
CreateTime = DateTime.Now,
FileURL = "",
Group_Id = model.Group_Id,
Id = 0,
ItemId = dayItem.Id,
OtherContent = "",
OtherRemark = "",
PlanId = model.Id,
PlanShift = Shift,
PlanType = 1,
Status = DateStateEnum.Normal,
UpdateBy = userId,
UpdateTime = DateTime.Now,
WorkContent = "",
WorkIsFinish = 0
});
}
contentList = duty_ContentRepository.GetDutyContentListRepository(new RB_Duty_Content_ViewModel() { PlanId = model.Id });
currentPlanContetList = contentList.Where(qitem => qitem.PlanShift == Shift && qitem.PlanType == 1)?.ToList();
}
if (currentModel.Status == DutyStatusEnum.DutyFinished)
{
foreach (var item in currentPlanContetList)
foreach (var item in currentPlanContetList.Where(qitem=>qitem.CreateBy==userId))
{
var c_itemModel = dutyItemList?.Where(qitem => qitem.Id == item.ItemId)?.FirstOrDefault();
if (c_itemModel != null)
......@@ -595,7 +608,7 @@ namespace Edu.Module.Duty
{
foreach (var item in PlanList)
{
var c_workModel = currentPlanContetList?.Where(qitem => qitem.ItemId == item.Id)?.FirstOrDefault();
var c_workModel = currentPlanContetList?.Where(qitem => qitem.ItemId == item.Id&&qitem.CreateBy==userId)?.FirstOrDefault();
var itemType = item.ItemType;
int workIsFinish = 0;
if (itemType == ItemTypeEnum.FillIn)
......@@ -629,7 +642,7 @@ namespace Edu.Module.Duty
{
if (item.Id != currentModel.Id)
{
var tempEmergenciesList = contentList?.Where(qitem => qitem.PlanType == 3 && qitem.PlanId == item.PlanId && qitem.PlanShift == item.Shift)?.ToList() ?? new List<RB_Duty_Content_ViewModel>();
var tempEmergenciesList = contentList?.Where(qitem => qitem.PlanType == 3 && qitem.PlanId == item.PlanId && qitem.PlanShift == item.Shift && qitem.CreateBy != userId)?.ToList() ?? new List<RB_Duty_Content_ViewModel>();
if (tempEmergenciesList != null && tempEmergenciesList.Count > 0)
{
tempEmergenciesList.ForEach(item => item.IsOperate = 0);
......@@ -643,7 +656,7 @@ namespace Edu.Module.Duty
}
else
{
var tempEmergenciesList = contentList?.Where(qitem => qitem.PlanType == 3 && qitem.PlanId == item.PlanId && qitem.PlanShift == item.Shift)?.ToList() ?? new List<RB_Duty_Content_ViewModel>();
var tempEmergenciesList = contentList?.Where(qitem => qitem.PlanType == 3 && qitem.PlanId == item.PlanId && qitem.PlanShift == item.Shift && qitem.CreateBy == userId)?.ToList() ?? new List<RB_Duty_Content_ViewModel>();
if (tempEmergenciesList != null && tempEmergenciesList.Count > 0)
{
foreach (var subItem in tempEmergenciesList)
......@@ -665,7 +678,7 @@ namespace Edu.Module.Duty
{
if (item.Status == DutyStatusEnum.DutyFinished)
{
var tempHandOverList = contentList?.Where(qitem => qitem.PlanType == 2 && qitem.PlanId == item.PlanId && qitem.PlanShift == item.Shift)?.ToList() ?? new List<RB_Duty_Content_ViewModel>();
var tempHandOverList = contentList?.Where(qitem => qitem.PlanType == 2 && qitem.PlanId == item.PlanId && qitem.PlanShift == item.Shift && qitem.CreateBy != userId)?.ToList() ?? new List<RB_Duty_Content_ViewModel>();
if (tempHandOverList != null && tempHandOverList.Count > 0)
{
foreach (var subItem in tempHandOverList)
......@@ -679,7 +692,7 @@ namespace Edu.Module.Duty
}
else
{
var tempHandOverList = contentList?.Where(qitem => qitem.PlanType == 2 && qitem.PlanId == item.PlanId && qitem.PlanShift == item.Shift)?.ToList() ?? new List<RB_Duty_Content_ViewModel>();
var tempHandOverList = contentList?.Where(qitem => qitem.PlanType == 2 && qitem.PlanId == item.PlanId && qitem.PlanShift == item.Shift && qitem.CreateBy == userId)?.ToList() ?? new List<RB_Duty_Content_ViewModel>();
if (tempHandOverList != null && tempHandOverList.Count > 0)
{
foreach (var subItem in tempHandOverList)
......@@ -692,8 +705,6 @@ namespace Edu.Module.Duty
}
}
result.Add("HandoverList", HandoverList);
result.Add("ReciveMan", nextModel?.DutyManName ?? "");
result.Add("GiveMan", previousModel?.DutyManName ?? "");
}
return result;
}
......@@ -719,6 +730,42 @@ namespace Edu.Module.Duty
return currentIndex;
}
/// <summary>
/// 计算当前值班人员索引
/// </summary>
/// <param name="planDate">值班日期</param>
/// <param name="PlanDetails">值班班次列表</param>
/// <param name="dutyManId">值班人</param>
/// <returns></returns>
public Dictionary<string, List<RB_Duty_PlanDetails_ViewModel>> CalcCurrentDutyManIndexModule_V3(RB_Duty_Plan_ViewModel model)
{
Dictionary<string, List<RB_Duty_PlanDetails_ViewModel>> plans = new Dictionary<string, List<RB_Duty_PlanDetails_ViewModel>>()
{
{"previous",new List<RB_Duty_PlanDetails_ViewModel>() },
{"current",new List<RB_Duty_PlanDetails_ViewModel>() },
{"next",new List<RB_Duty_PlanDetails_ViewModel>() },
};
var shiftList= model.PlanDetails.GroupBy(qitem => new { qitem.Shift }).Select(qitem => new { Shift= qitem.Key.Shift }).ToList();
for (var i = 0; i < shiftList.Count(); i++)
{
var subList = model.PlanDetails.Where(qitem => qitem.Shift == shiftList[i].Shift)?.ToList();
if (subList != null && subList.Where(qitem => qitem.Id == model.DetailId).Count() > 0)
{
plans["current"] = subList.Where(qitem => qitem.Id == model.DetailId).ToList();
if (i - 1 >= 0)
{
plans["previous"] = model.PlanDetails.Where(qitem => qitem.Shift == shiftList[i - 1].Shift)?.ToList();
}
if (i + 1 < shiftList.Count())
{
plans["next"] = model.PlanDetails.Where(qitem => qitem.Shift == shiftList[i + 1].Shift)?.ToList();
}
}
}
return plans;
}
/// <summary>
/// 获取值班详情
/// </summary>
......
......@@ -127,43 +127,22 @@ namespace Edu.WebApi.Controllers.Duty
//当前班次
var currentModel = new RB_Duty_PlanDetails_ViewModel();
//上一个班次(交班)
var previousModel = new RB_Duty_PlanDetails_ViewModel();
var previousModel = new List<RB_Duty_PlanDetails_ViewModel>();
//下一个班次(接班)
var nextModel = new RB_Duty_PlanDetails_ViewModel();
//当前值班人员索引
int currentIndex = 0;
if (item.PlanDetails != null && item.PlanDetails.Count > 0)
{
currentIndex = dutyPlanModule.CalcCurrentDutyManIndexModule_V2(item);
//上一个班次索引
int previousIndex = currentIndex - 1;
//下一个班次索引
int nextIndex = currentIndex + 1;
//当前班次
currentModel = item.PlanDetails[currentIndex];
//上一个班次
if (previousIndex >= 0)
{
previousModel = item.PlanDetails[previousIndex];
}
//下一个班次
if (nextIndex < item.PlanDetails.Count)
{
nextModel = item.PlanDetails[nextIndex];
}
}
var nextModel = new List<RB_Duty_PlanDetails_ViewModel>();
var dic = dutyPlanModule.CalcCurrentDutyManIndexModule_V3(item);
//当前班次
currentModel = dic["current"].FirstOrDefault();
string jiaoBanMan = "";//交班人
string jieBanMan = "";//接班人
if (nextModel != null&&nextModel.Id>0)
if (dic["next"] != null&& dic["next"].Count>0)
{
jieBanMan = nextModel?.DutyManName ?? "";
jieBanMan = string.Join(",", dic["next"].Select(qitem => qitem.DutyManName));
}
if (previousModel!=null && previousModel.Id>0)
if (dic["previous"] != null && dic["previous"].Count>0)
{
jiaoBanMan = previousModel?.DutyManName ?? "";
jiaoBanMan = string.Join(",", dic["previous"].Select(qitem => qitem.DutyManName)); ;
}
if (currentModel.Status == Common.Enum.Duty.DutyStatusEnum.NoStart)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment