/// <summary>
        /// 保存数据
        /// </summary>
        public virtual void SaveImportData(IEnumerable <Spl_EarlyWareingGoodModel> list)
        {
            try
            {
                using (DBContainer db = new DBContainer())
                {
                    foreach (var model in list)
                    {
                        Spl_EarlyWareingGood entity = new Spl_EarlyWareingGood();
                        entity.Id            = ResultHelper.NewId;
                        entity.WareDetailsId = model.WareDetailsId;
                        entity.LowNumber     = model.LowNumber;
                        entity.TotalNumber   = model.TotalNumber;
                        entity.ProductType   = model.ProductType;
                        entity.ProductPrice  = model.ProductPrice;
                        entity.PriceTotal    = model.PriceTotal;
                        entity.WarehouseId   = model.WarehouseId;
                        entity.CreateTime    = ResultHelper.NowTime;

                        db.Spl_EarlyWareingGood.Add(entity);
                    }
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public virtual bool Create(ref ValidationErrors errors, Spl_EarlyWareingGoodModel model)
        {
            try
            {
                Spl_EarlyWareingGood entity = m_Rep.GetById(model.Id);
                if (entity != null)
                {
                    errors.Add(Resource.PrimaryRepeat);
                    return(false);
                }
                entity               = new Spl_EarlyWareingGood();
                entity.Id            = model.Id;
                entity.WareDetailsId = model.WareDetailsId;
                entity.LowNumber     = model.LowNumber;
                entity.TotalNumber   = model.TotalNumber;
                entity.ProductType   = model.ProductType;
                entity.ProductPrice  = model.ProductPrice;
                entity.PriceTotal    = model.PriceTotal;
                entity.WarehouseId   = model.WarehouseId;
                entity.CreateTime    = model.CreateTime;


                if (m_Rep.Create(entity))
                {
                    return(true);
                }
                else
                {
                    errors.Add(Resource.InsertFail);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                errors.Add(ex.Message);
                ExceptionHander.WriteException(ex);
                return(false);
            }
        }
        public virtual Spl_EarlyWareingGoodModel GetById(object id)
        {
            if (IsExists(id))
            {
                Spl_EarlyWareingGood      entity = m_Rep.GetById(id);
                Spl_EarlyWareingGoodModel model  = new Spl_EarlyWareingGoodModel();
                model.Id            = entity.Id;
                model.WareDetailsId = entity.WareDetailsId;
                model.LowNumber     = entity.LowNumber;
                model.TotalNumber   = entity.TotalNumber;
                model.ProductType   = entity.ProductType;
                model.ProductPrice  = entity.ProductPrice;
                model.PriceTotal    = entity.PriceTotal;
                model.WarehouseId   = entity.WarehouseId;
                model.CreateTime    = entity.CreateTime;

                return(model);
            }
            else
            {
                return(null);
            }
        }