Ejemplo n.º 1
0
        /// <summary>
        /// 입출고재고현황기록을 데이터베이스에 저장하고 재고현황수량에서 가감하여 재고현황을 반영한다.
        /// </summary>
        /// <param name="date"></param>
        /// <param name="spec"></param>
        /// <param name="count"></param>
        /// <param name="seller"></param>
        /// <param name="eep"></param>
        /// <param name="warehouse"></param>
        /// <param name="remark"></param>
        public InOutStock Save(StockType type, DateTime date, Specification spec, int count, Seller seller, Employee eep, Warehouse warehouse, string remark)
        {
            _InOutStock.StockType = type;
            _InOutStock.SpecificationUUID = spec.UUID;
            _InOutStock.Date = date;
            _InOutStock.ItemCount = count;
            _InOutStock.EnterpriseUUID = seller.UUID;
            _InOutStock.EmployeeUUID = eep.UUID;
            _InOutStock.WarehouseUUID = warehouse.UUID;
            _InOutStock.Remark = remark;

            IIndexQuery<Inventory, string> queryResult = null;
            using (var db = DatabaseDirector.GetDbInstance())
            {
                queryResult = db.Table<Inventory>().IndexQueryByKey("SpecificationUUID", spec.UUID);
            }
            Inventory stockItem = queryResult.Count() == 0 ? 
                new Inventory() { SpecificationUUID = spec.UUID, WarehouseUUID = warehouse.UUID } : queryResult.ToList().First();
            switch (_InOutStock.StockType)
            {
                case StockType.IN: stockItem.ItemCount += count; break;
                case StockType.OUT: stockItem.ItemCount -= count; break;
            }
            stockItem.Save<Inventory>();
            return _InOutStock.Save<InOutStock>();
        }
Ejemplo n.º 2
0
 public Inventory Save(Specification istd, Warehouse warehouse, int itemCount, string remark)
 {
     _stockItem.SpecificationUUID = istd.UUID;
     _stockItem.WarehouseUUID = warehouse.UUID;
     _stockItem.ItemCount = itemCount;
     _stockItem.Remark = remark;
     return _stockItem.Save<Inventory>();
 }