public JsonResult Edit(EditStorePurchaseOrder model) { model.CreatedBy = _context.CurrentAccount.AccountId; model.CreatedByName = _context.CurrentAccount.NickName; _storePurchaseOrderFacade.Edit(model); return(Json(new { success = true })); }
public static List <StorePurchaseOrderItem> ConvertJsonToItem(this EditStorePurchaseOrder source) { if (string.IsNullOrEmpty(source.Items)) { throw new Exception("商品明细为空"); } var productPriceList = JsonConvert.DeserializeObject <List <StorePurchaseOrderItem> >(source.Items); return(productPriceList); }
public void Edit(EditStorePurchaseOrder model) { var entity = _db.Table.Find <StorePurchaseOrder>(model.Id); entity = model.MapTo <StorePurchaseOrder>(entity); entity.AddItems(model.ConvertJsonToItem()); _service.UpdateWithItem(entity); var reason = "修改采购单"; var billIdentity = BillIdentity.StorePurchaseOrder; if (entity.OrderType == OrderType.Refund) { reason = "修改采购退单"; billIdentity = BillIdentity.StorePurchaseRefundOrder; } _processHistoryService.Track(model.CreatedBy, model.CreatedByName, (int)entity.Status, entity.Id, billIdentity.ToString(), reason); _db.SaveChange(); }