public async Task <ActionResult> SaveModify(BinRuleViewModel model) { using (BinRuleServiceClient client = new BinRuleServiceClient()) { MethodReturnResult <BinRule> result = await client.GetAsync(new BinRuleKey() { BinNo = model.BinNo, Color = model.Color, Grade = model.Grade, PackageLine = model.PackageLine, PsCode = model.PsCode, PsSubCode = model.PsSubCode, PsItemNo = model.PsItemNo, WorkOrderNumber = model.WorkOrderNumber }); if (result.Code == 0) { result.Data.LocationName = model.LocationName; result.Data.Editor = User.Identity.Name; result.Data.EditTime = DateTime.Now; MethodReturnResult rst = await client.ModifyAsync(result.Data); if (rst.Code == 0) { rst.Message = string.Format(FMMResources.StringResource.BinRule_SaveModify_Success , result.Data.Key); } return(Json(rst)); } return(Json(result)); } }
public async Task <ActionResult> Save(BinRuleViewModel model) { using (BinRuleServiceClient client = new BinRuleServiceClient()) { BinRule obj = new BinRule() { Key = new BinRuleKey() { BinNo = model.BinNo, Color = model.Color, Grade = model.Grade, PackageLine = model.PackageLine, PsCode = model.PsCode, PsSubCode = model.PsSubCode, PsItemNo = model.PsItemNo, WorkOrderNumber = model.WorkOrderNumber }, LocationName = model.LocationName, Creator = User.Identity.Name, CreateTime = DateTime.Now, Editor = User.Identity.Name, EditTime = DateTime.Now, }; MethodReturnResult rst = await client.AddAsync(obj); if (rst.Code == 0) { rst.Message = string.Format(FMMResources.StringResource.BinRule_Save_Success , obj.Key); } return(Json(rst)); } }
// // GET: /FMM/BinRule/Modify public async Task <ActionResult> Modify(string BinNo, string Color, string Grade, string PackageLine, string PsCode, string PsSubCode, int PsItemNo, string WorkOrderNumber) { BinRuleViewModel viewModel = new BinRuleViewModel(); using (BinRuleServiceClient client = new BinRuleServiceClient()) { MethodReturnResult <BinRule> result = await client.GetAsync(new BinRuleKey() { BinNo = BinNo, Color = Color, Grade = Grade, PackageLine = PackageLine, PsCode = PsCode, PsSubCode = PsSubCode, PsItemNo = PsItemNo, WorkOrderNumber = WorkOrderNumber }); if (result.Code == 0) { viewModel = new BinRuleViewModel() { BinNo = result.Data.Key.BinNo, Color = result.Data.Key.Color, Grade = result.Data.Key.Grade, PackageLine = result.Data.Key.PackageLine, PsCode = result.Data.Key.PsCode, PsSubCode = result.Data.Key.PsSubCode, PsItemNo = result.Data.Key.PsItemNo, WorkOrderNumber = result.Data.Key.WorkOrderNumber, LocationName = result.Data.LocationName, Creator = result.Data.Creator, CreateTime = result.Data.CreateTime, Editor = result.Data.Editor, EditTime = result.Data.EditTime }; return(PartialView("_ModifyPartial", viewModel)); } else { ModelState.AddModelError("", result.Message); } } return(PartialView("_ModifyPartial")); }