コード例 #1
0
 private static IList <T> OrderByShippingThenLocation <T>(IList <T> orders) where T : ISortableEntity
 {
     //К3, К2, К1 (sorting order – isle, section, shelf, alphabetically product name).
     //alphabetically нужно так как могут быть несколько стайлов на одной полке
     return(orders.OrderByDescending(o => ShippingUtils.GetShippingMethodIndex(o.ShippingMethodId))
            .ThenBy(o => o.SortIsle)
            .ThenBy(o => o.SortSection)
            .ThenBy(o => o.SortShelf)
            .ThenBy(o => o.SortStyleString)
            .ThenBy(o => SizeHelper.GetSizeIndex(o.SortSize))
            .ThenBy(o => o.SortSize)
            .ThenBy(o => o.SortColor)
            .ThenBy(o => o.FirstItemName)
            .ThenBy(o => o.SortOrderId).ToList());
 }
コード例 #2
0
        public void LockBatch(IUnitOfWork db,
                              long batchId,
                              DateTime?when)
        {
            _log.Info("Lock batch, batchId=" + batchId);

            var orderIds = db.OrderBatches.GetOrderIdsForBatch(
                batchId,
                OrderStatusEnumEx.AllUnshippedWithShipped);

            var shippingList = db.OrderShippingInfos
                               .GetOrderInfoWithItems(_weightService,
                                                      orderIds.ToList(),
                                                      SortMode.ByLocation,
                                                      unmaskReferenceStyle: false,
                                                      includeSourceItems: false)
                               .ToList();

            shippingList = SortHelper.Sort(shippingList, SortMode.ByShippingMethodThenLocation).ToList();

            for (int i = 0; i < shippingList.Count; i++)
            {
                var mapping = new OrderToBatch()
                {
                    BatchId        = batchId,
                    ShippingInfoId = shippingList[i].Id,
                    SortIndex1     = ShippingUtils.GetShippingMethodIndex(shippingList[i].ShippingMethodId),
                    SortIndex2     = LocationHelper.GetLocationIndex(shippingList[i].SortIsle, shippingList[i].SortSection, shippingList[i].SortShelf),
                    SortIndex3     = SortHelper.GetStringIndex(shippingList[i].SortStyleString),
                    SortIndex4     = (decimal)SizeHelper.GetSizeIndex(shippingList[i].SortSize),
                    SortIndex5     = SortHelper.GetStringIndex(shippingList[i].SortColor),
                    //SortIndex6 = SortHelper.GetStringIndex(shippingList[i].FirstItemName),
                    CreateDate = when,
                };
                db.OrderToBatches.Add(mapping);
            }
            db.Commit();

            db.OrderBatches.LockBatch(batchId, when);
        }