Exemple #1
0
        public void Submit(int id, int editBy, string editByName)
        {
            var entity = _db.Table.Find <OutInOrder>(id);

            if (entity == null)
            {
                throw new Exception("单据不存在");
            }
            entity.Items = _db.Table.FindAll <OutInOrderItem>(n => n.OutInOrderId == id).ToList();
            // 修改单据状态
            entity.Submit(editBy, editByName);
            _db.Update(entity);
            var reason    = "提交单据";
            var orderType = _db.Table.Find <OutInOrderType>(entity.OutInOrderTypeId);

            if (orderType == null)
            {
                throw new FriendlyException("业务类别为空");
            }
            var billIdentity = BillIdentity.OtherInOrder;

            if (orderType.OutInInventory == OutInInventoryType.Out)
            {
                billIdentity = BillIdentity.OtherOutOrder;
            }
            _processHistoryService.Track(editBy, editByName, (int)entity.Status, entity.Id, billIdentity.ToString(), reason);
            // 如果调入库存商品不存在,创建商品信息
            var notExistsProduct = _inventoryService.CheckNotExistsProduct(entity);

            if (notExistsProduct.Count() > 0)
            {
                _db.Insert(notExistsProduct.ToArray());
            }
            _db.SaveChange();
        }
Exemple #2
0
        public void Submit(int id, int editBy, string editByName)
        {
            var entity = _db.Table.Find <TransferOrder>(id);

            if (entity == null)
            {
                throw new Exception("单据不存在");
            }
            entity.Items = _db.Table.FindAll <TransferOrderItem>(n => n.TransferOrderId == id).ToList();
            // 修改单据状态
            entity.Submit(editBy, editByName);
            _db.Update(entity);
            var reason = "提交调拨单";

            _processHistoryService.Track(editBy, editByName, (int)entity.Status, entity.Id, BillIdentity.TransferOrder.ToString(), reason);

            // 如果调入库存商品不存在,创建商品信息
            var notExistsProduct = _inventoryService.CheckNotExistsProduct(entity);

            if (notExistsProduct.Count() > 0)
            {
                _db.Insert(notExistsProduct.ToArray());
            }
            _db.SaveChange();
        }