Пример #1
0
        private static void AdjustInventory(GoodsEntity goods, string serialId, int count, int packageCount, string userId,
                                            Database db, DbTransaction trans)
        {
            var inventroy = new GoodsInventoryEntity
            {
                SerialId      = serialId,
                BatchNo       = goods.BatchNo,
                ProductId     = goods.ProductId,
                StoreroomId   = goods.StoreroomId,
                ExpiredDate   = goods.ExpiredDate,
                HospitalId    = goods.HospitalId,
                VendorId      = goods.VendorId,
                OriginalCount = count,
                SplitCount    = 0,
                UsableCount   = count,
                ApplyCount    = packageCount * count,
                GrantedCount  = 0,
                CreatedId     = userId,
                CreatedTime   = DateTime.Now
            };

            GoodsInventoryRepository.Create(inventroy, db, trans);

            Reduce(goods.Barcode, 1, goods.HospitalId, db, trans);
            GoodsInventoryRepository.Reduce(goods.SerialId, goods.HospitalId, 1, db, trans);

            if (goods.PackageCount == goods.GrantedCount + 1)
            {
                Complete(goods.Id, db, trans);
            }
        }
Пример #2
0
        private static void CreateInventory(IncomingFormEntity form, Database db, DbTransaction trans)
        {
            var goodsSerial = GoodsSerialRepository.Get(form.SerialId, db, trans);
            var barcodes    = GoodsSerialRepository.GetBarcodes(form.SerialId, db, trans);
            var product     = ProductRepository.Get(goodsSerial.ProductId);

            var inventory = new GoodsInventoryEntity
            {
                SerialId      = goodsSerial.Id,
                BatchNo       = goodsSerial.BatchNo,
                ProductId     = goodsSerial.ProductId,
                StoreroomId   = form.StoreroomId,
                ExpiredDate   = goodsSerial.ExpiredDate.Value,
                HospitalId    = goodsSerial.HospitalId,
                VendorId      = goodsSerial.VendorId,
                OriginalCount = form.IncomingCount,
                SplitCount    = 0,
                UsableCount   = form.IncomingCount, //goodsSerial.NeedSplit ? 0 : form.IncomingCount,
                GrantedCount  = 0,
                CreatedId     = form.ConfirmedId,
                CreatedTime   = form.ConfirmedTime
            };

            inventory.ApplyCount = inventory.UsableCount * product.MiniPackageCount;
            GoodsInventoryRepository.Create(inventory, db, trans);

            AllocateBarcodes(barcodes, inventory, product, db, trans);
        }
Пример #3
0
        public static void Create(string incomingId, GoodsEntity goods, GoodsExtraEntity goodsExtra, int goodsCount, string userId, Database db, DbTransaction trans)
        {
            goods.SerialId = GoodsExtraRepsitory.Create(goodsExtra, db, trans);
            Create(incomingId, goods, userId, db, trans);

            GoodsInventoryRepository.AddOriginalCount(goods.ProductId, goods.HospitalId, goodsCount, db, trans);
            if (!goodsExtra.NeedSplit)
            {
                GoodsInventoryRepository.AddUsableCount(goods.ProductId, goods.HospitalId, goodsCount, db, trans);
            }
        }