Exemplo n.º 1
0
        public async Task <ResultEntity> CreateSortingList(EnumChannel channel, List <int> letterIds, int userId)
        {
            var result  = new ResultEntity();
            var letters = await _letterRepository.GetQueryable().Where(a => letterIds.Contains(a.Id)).ToListAsync();

            var sortings = _sortingRepository.GetQueryable().Where(a => letters.Any(b => b.BarcodeNo == a.BarcodeNo));

            foreach (var sorting in sortings)
            {
                sorting.Sorted = true;
            }

            var serialNumber = await _serialNumberManager.GetSerialNumber(0, EnumSerialNumberType.分拣);

            var sortingList = new SortingList
            {
                Channel    = channel,
                ListNo     = DateTime.Now.Year + serialNumber.ToString("00000000"),
                CreateBy   = userId,
                CreateTime = DateTime.Now
            };
            await _sortingListRepository.AddAsync(sortingList);

            foreach (var letterId in letterIds)
            {
                var listDetail = new SortingListDetail
                {
                    LetterId    = letterId,
                    SortingList = sortingList
                };
                await _sortingListDetailRepository.AddAsync(listDetail);

                //将事务提交上移,应对保存顺序不规则,最好是添加序号字段,暂时这么改
                await _unitOfWork.CommitAsync();
            }

            result.Success = true;
            result.Data    = sortingList.Id;

            return(result);
        }
Exemplo n.º 2
0
    public void Contains_Empty()
    {
        var list = new SortingList <int>();

        Assert.DoesNotContain(4, list);
    }
Exemplo n.º 3
0
    public void Empty()
    {
        var list = new SortingList <WrappedInt>();

        Assert.Empty(list);
    }
Exemplo n.º 4
0
    public void IndexOf_Empty()
    {
        var list = new SortingList <int>();

        Assert.Equal(-1, list.IndexOf(4));
    }
Exemplo n.º 5
0
 public SortingList <WrappedInt> Typical()
 {
     return(SortingList <WrappedInt> .FactoryWrapAssumeSorted(TypicalBareList()));
 }