Example #1
0
    /// <summary>
    /// 标记订单状态
    /// </summary>
    /// <param name="eventDto"></param>
    /// <param name="tracker"></param>
    /// <returns></returns>
    public async Task MarkCreatedStatusAsync(WarehouseQtyBlockedEvent eventDto, IMessageTracker tracker)
    {
        var order = await _orderRepo.GetAsync(eventDto.Data.OrderId);

        order.MarkCreatedStatus(eventDto.Data.IsSuccess, eventDto.Data.Remark);

        await _orderRepo.UpdateAsync(order);

        await tracker?.MarkAsProcessedAsync(eventDto);
    }
Example #2
0
        /// <summary>
        /// 标记订单创建状态
        /// </summary>
        /// <param name="id"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task MarkCreatedStatusAsync(long id, OrderMarkCreatedStatusDto input)
        {
            var order = await _orderRepo.GetAsync(id);

            Checker.NotNull(order, nameof(order));

            //需要发布领域事件,仓储中心订阅该事件
            order.MarkCreatedStatus(input.IsSuccess, input.Remark);

            await _orderRepo.UpdateAsync(order);
        }
Example #3
0
    /// <summary>
    /// 修改商品
    /// </summary>
    /// <param name="id"></param>
    /// <param name="input"></param>
    /// <returns></returns>
    public async Task <ProductDto> UpdateAsync(long id, ProductUpdationDto input)
    {
        var product = await _productRepo.GetAsync(id);

        product.Describe = input.Describe;
        product.SetUnit(input.Unit);
        product.SetPrice(input.Price);

        await _productMgr.ChangeSkuAsync(product, input.Sku);

        await _productMgr.ChangeNameAsync(product, input.Name);

        await _productRepo.UpdateAsync(product);

        return(Mapper.Map <ProductDto>(product));
    }
Example #4
0
        /// <summary>
        /// 分配仓储给商品
        /// </summary>
        /// <param name="warehouseId"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <WarehouseDto> AllocateShelfToProductAsync(long warehouseId, WarehouseAllocateToProductDto input)
        {
            var warehouse = await _warehouseRepo.GetAsync(warehouseId);

            var product = await _productRepo.GetAsync(input.ProductId.ToLong().Value);

            await _warehouseManager.AllocateShelfToProductAsync(warehouse, product);

            await _warehouseRepo.UpdateAsync(warehouse);

            return(_mapper.Map <WarehouseDto>(warehouse));
        }