public async Task <ActionResult> Delete(string year, string month, string day, string locationname, string shiftname, string linecode, string routestepname, string equipmentcode, string reasoncodename) { MethodReturnResult result = new MethodReturnResult(); try { using (EquipmentConsumingServiceClient client = new EquipmentConsumingServiceClient()) { EquipmentConsumingKey key = new EquipmentConsumingKey() { Year = year, Month = month, Day = day, ShiftName = shiftname, LocationName = locationname == null ? "" : locationname, LineCode = linecode, //RouteStepName=routestepname, EquipmentCode = equipmentcode, ReasonCodeName = reasoncodename }; result = await client.DeleteAsync(key); if (result.Code == 0) { result.Message = string.Format(FMMResources.StringResource.EquipmentConsuming_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)); } }
/// <summary> /// 浏览信息 /// </summary> /// <param name="year">年</param> /// <param name="month">月</param> /// <param name="day">日</param> /// <param name="locationname">车间</param> /// <param name="shiftname">班别</param> /// <param name="linecode">线别</param> /// <param name="routestepname">工序</param> /// <param name="equipmentcode">设备代码</param> /// <param name="reasoncodename">原因代码</param> /// <returns></returns> public async Task <ActionResult> Detail(string year, string month, string day, string locationname, string shiftname, string linecode, string routestepname, string equipmentcode, string reasoncodename) { MethodReturnResult <EquipmentConsuming> result = new MethodReturnResult <EquipmentConsuming>(); try { EquipmentConsumingViewModel viewModel = new EquipmentConsumingViewModel(); using (EquipmentConsumingServiceClient client = new EquipmentConsumingServiceClient()) { EquipmentConsumingKey key = new EquipmentConsumingKey() { Year = year, Month = month, Day = day, ShiftName = shiftname, LocationName = locationname == null ? "" : locationname, LineCode = linecode, RouteStepName = routestepname, EquipmentCode = equipmentcode, ReasonCodeName = reasoncodename }; //取得数据 result = await client.GetAsync(key); if (result.Code == 0) { viewModel = new EquipmentConsumingViewModel() { Year = result.Data.Key.Year, Month = result.Data.Key.Month, Day = result.Data.Key.Day, LocationName = result.Data.Key.LocationName, ShiftName = result.Data.Key.ShiftName, LineCode = result.Data.Key.LineCode, EquipmentCode = result.Data.Key.EquipmentCode, RouteStepName = result.Data.Key.RouteStepName, ReasonCodeName = result.Data.Key.ReasonCodeName, Consuming = result.Data.Consuming, CreateTime = result.Data.CreateTime, Creator = result.Data.Creator, Editor = result.Data.Editor, EditTime = result.Data.EditTime }; return(PartialView("_InfoPartial", 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)); } }