/// <summary> /// 修改窗体 /// </summary> /// <param name="year"></param> /// <param name="month"></param> /// <param name="day"></param> /// <param name="locationname"></param> /// <param name="shiftname"></param> /// <returns></returns> public async Task <ActionResult> Modify(string year, string month, string day, string locationname, string shiftname) { MethodReturnResult <PlanAttendance> result = new MethodReturnResult <PlanAttendance>(); try { PlanAttendanceViewModel viewModel = new PlanAttendanceViewModel(); using (PlanAttendanceServiceClient client = new PlanAttendanceServiceClient()) { PlanAttendanceKey key = new PlanAttendanceKey() { Year = year, Month = month, Day = day, LocationName = locationname == null ? "" : locationname, ShiftName = shiftname }; result = await client.GetAsync(key); if (result.Code == 0) { viewModel.Year = result.Data.Key.Year; viewModel.Month = result.Data.Key.Month; viewModel.Day = result.Data.Key.Day; viewModel.LocationName = result.Data.Key.LocationName; viewModel.ShiftName = result.Data.Key.ShiftName; viewModel.PlanQty = (int)float.Parse(result.Data.PlanQty); viewModel.TargetDebrisRate = result.Data.TargetDebrisRate; viewModel.PerCapitaEfficiency = result.Data.PerCapitaEfficiency; viewModel.BeforePressQRate = result.Data.BeforePressQRate; viewModel.HProductARate = result.Data.HProductARate; viewModel.ProductARate = result.Data.ProductARate; viewModel.CreateTime = result.Data.CreateTime; viewModel.Creator = result.Data.Creator; viewModel.Editor = result.Data.Editor; viewModel.EditTime = result.Data.EditTime; return(PartialView("_ModifyPartial", viewModel)); } else { //数据错误 result.Code = result.Code; //错误代码 result.Message = result.Message; //错误信息 result.Detail = result.Message; //错误明细 return(Json(result)); } } } catch (Exception e) { result.Code = 1002; result.Message = e.Message; result.Detail = e.ToString(); return(Json(result)); } }
public async Task <ActionResult> Delete(string year, string month, string day, string locationname, string shiftname) { MethodReturnResult result = new MethodReturnResult(); try { using (PlanAttendanceServiceClient client = new PlanAttendanceServiceClient()) { PlanAttendanceKey key = new PlanAttendanceKey() { Year = year, Month = month, Day = day, LocationName = locationname == null ? "" : locationname, ShiftName = shiftname }; result = await client.DeleteAsync(key); if (result.Code == 0) { result.Message = string.Format(PPMResources.StringResource.PlanAttendance_Delete_Success, key); } else { //数据错误 result.Code = result.Code; //错误代码 result.Message = result.Message; //错误信息 result.Detail = result.Message; //错误明细 return(Json(result)); } return(Json(result)); } } catch (Exception e) { result.Code = 1002; result.Message = e.Message; result.Detail = e.ToString(); return(Json(result)); } }