Exemplo n.º 1
0
 public JsonResult Edit(EditStorePurchaseOrder model)
 {
     model.CreatedBy     = _context.CurrentAccount.AccountId;
     model.CreatedByName = _context.CurrentAccount.NickName;
     _storePurchaseOrderFacade.Edit(model);
     return(Json(new { success = true }));
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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();
        }