Example #1
0
        public void Correct(StocktakingModel model)
        {
            var entity = model.MapTo <Stocktaking>();

            entity.Status          = StocktakingStatus.WaitAuditing;
            entity.StocktakingType = StocktakingType.StocktakingCorect;
            entity.Items           = JsonConvert.DeserializeObject <List <StocktakingItem> >(model.ItemsJson);
            entity.Code            = _billService.GenerateNewCode(BillIdentity.StoreStocktaking);
            _db.Insert(entity);
            _db.SaveChange();
        }
Example #2
0
        public void Create(StocktakingModel model)
        {
            var entity = model.MapTo <Stocktaking>();

            entity.Status          = StocktakingStatus.Audited;
            entity.StocktakingType = StocktakingType.Stocktaking;
            entity.Items           = JsonConvert.DeserializeObject <List <StocktakingItem> >(model.ItemsJson);
            if (entity.Items.Sum(n => n.CountQuantity) == 0)
            {
                throw new Exception("盘点数不能都为0");
            }
            entity.Code = _billService.GenerateNewCode(BillIdentity.StoreStocktaking);
            _db.Insert(entity);
            _db.SaveChange();
        }