private TOut ProcessBuild <TOut>() where TOut : ITabsViewModel, new()
        {
            var viewModel = new TOut();

            viewModel.TabId  = tabId;
            viewModel.TabKey = tabKey;


            viewModel = LoadPage(viewModel);
            viewModel = LoadInTabFilters(viewModel);

            viewModel = LoadJewelryCollection(viewModel);

            //defaults

            viewModel.Page         = page;
            viewModel.ItemsPerPage = itemsPerPage;

            viewModel.MetalFilter  = JewelMediaTypeFilter.Value;
            viewModel.OrderByPrice = OrderByPriceFilter.Value;

            viewModel.MetalFilterItems  = MetalFilter.GetKeyValue();
            viewModel.OrderByPriceItems = OrderByPriceFilter.GetKeyValue();



            return(viewModel);
        }
Esempio n. 2
0
        public TOut ToBusinessObject <TOut>() where TOut : BaseBo, new()
        {
            var boResult = new TOut();

            SimplePropertyMapper.Map(this, boResult);
            return(boResult);
        }
Esempio n. 3
0
        private Tuple <bool, string> CreateOutbound(TOutDn dn, string store, List <TOutDnD> list)
        {
            var outbound = new TOut
            {
                Code         = dn.Code.Replace("DN", "SHP"),
                BatchNo      = dn.BatchNo,
                AsnId        = dn.AsnId,
                WhId         = dn.WhId,
                CustId       = dn.CustId,
                BrandId      = dn.BrandId,
                DnId         = dn.Id,
                DnCode       = dn.Code,
                RefNo        = dn.RefNo,
                BizCode      = dn.BizCode,
                GoodsType    = dn.GoodsType,
                ReceiverCode = dn.ReceiverCode,
                ShipperCode  = dn.ShipperCode,
                TypeCode     = Enum.GetName(typeof(EnumOrderType), EnumOrderType.SHP),
                TransCode    = "Outbound",
                SrcCode      = dn.SrcCode,
                Store        = store,
                IsPriority   = false,
                Status       = Enum.GetName(typeof(EnumStatus), EnumStatus.None),
                IsDeleted    = false,
                OrderPayment = dn.OrderPayment,
                Payment      = dn.Payment,
                CreatedBy    = DefaultUser.UserName,
                CreatedTime  = DateTime.UtcNow
            };


            var detailList = new List <TOutD>();

            foreach (TOutDnD detail in list)
            {
                var prodSku = skuService.GetSkuByBarcode(detail.Barcode);

                detailList.Add(new TOutD
                {
                    Qty         = detail.Qty,
                    Carton      = detail.Carton,
                    Barcode     = detail.Barcode,
                    Sku         = detail.Sku,
                    SkuId       = prodSku.Id,
                    RetailPrice = detail.RetailPrice,
                    ActualPrice = detail.ActualPrice,
                    Discount    = detail.Discount,
                    CreatedBy   = DefaultUser.UserName,
                    CreatedTime = DateTime.UtcNow
                });
            }

            outbound.DetailList = detailList;

            wmsoutbound.TOuts.Add(outbound);

            var r = wmsoutbound.SaveChanges() > 0;

            return(new Tuple <bool, string>(r, ""));
        }
Esempio n. 4
0
            public bool MoveNext()
            {
                TOut        onStack = default;
                Span <TOut> span    = MemoryMarshal.CreateSpan(ref onStack, 1);

                if (_enum.ConsumeInto(span).Length == 0)
                {
                    return(false);
                }

                Current = onStack;
                return(true);
            }
Esempio n. 5
0
        ///这里不对TOut的状态做任何校验
        public bool CreatePick(TOut tOut, long waveId = 0)
        {
            TOutPick tOutPick = new TOutPick
            {
                Code         = tOut.Code.Replace("SHP", "PCK"),
                WhId         = tOut.WhId,
                WaveId       = waveId,
                OutboundId   = tOut.Id,
                OutboundCode = tOut.Code,
                Store        = tOut.Store,
                Status       = Enum.GetName(typeof(EnumOperateStatus), EnumOperateStatus.Init),
                CreatedBy    = DefaultUser.UserName,
                CreatedTime  = DateTime.UtcNow,
            };

            tOut.DetailList = wmsoutbound.TOutDs.Where(x => x.HId == tOut.Id).ToList();

            var allotDetailList = (from detail in wmsoutbound.TOutAllotDs
                                   join allot in wmsoutbound.TOutAllots on detail.HId equals allot.Id
                                   where allot.OutboundId == tOut.Id
                                   select detail)
                                  .ToList();

            var detaiList = tOut.DetailList;

            foreach (var detail in allotDetailList)
            {
                for (int i = 0; i < detail.MatchingQty; i++)
                {
                    var       outDetail = detaiList.Where(x => x.SkuId == detail.SkuId).FirstOrDefault();
                    TOutPickD tOutPickD = new TOutPickD
                    {
                        SkuId       = detail.SkuId,
                        Sku         = outDetail.Sku,
                        Barcode     = detail.Barcode,
                        ZoneId      = detail.ZoneId,
                        ZoneCode    = detail.ZoneCode,
                        BinId       = detail.BinId,
                        BinCode     = detail.BinCode,
                        Qty         = 1,
                        CreatedBy   = DefaultUser.UserName,
                        CreatedTime = DateTime.UtcNow
                    };

                    tOutPick.DetailList.Add(tOutPickD);
                }
            }

            wmsoutbound.TOutPicks.Add(tOutPick);
            return(wmsoutbound.SaveChanges() > 0);
        }
Esempio n. 6
0
        private Tuple <bool, long, string> Pick(TOut outbound)
        {
            var detailList = wmsoutbound.TOutDs.Where(x => x.HId == outbound.Id).ToList();

            if (!detailList.Any())
            {
                throw new Exception("detail-list is null.");
            }

            outbound.DetailList = detailList;

            var result = pickService.CreatePick(outbound);

            outbound.PickStatus = Enum.GetName(typeof(EnumOperateStatus), EnumOperateStatus.Init);
            var r1 = wmsoutbound.SaveChanges() > 0;

            return(new Tuple <bool, long, string>(r1, outbound.Id, ""));
        }
Esempio n. 7
0
        private Tuple <bool, long, string> Allot(TOut outbound)
        {
            var detailList = wmsoutbound.TOutDs.Where(x => x.HId == outbound.Id).ToArray();

            // 获取分配结果,更新库存记录
            // 支持二次分配, 剩余未分配数 = 期望出库数 - 已分配数
            var allotList = inventoryService.Allot(outbound.WhId, detailList);

            // 生成分配记录
            var r = allotService.Create(outbound.WhId, outbound.Id, outbound.Code, detailList, allotList);

            wmsoutbound.TOutAllots.Add(r);

            //更新出库明细
            //支持二次分配,分配数量进行累加
            foreach (var detail in detailList)
            {
                detail.MatchingQty += allotList.Where(x => x.SkuId == detail.SkuId).Sum(X => X.AllotQty);
            }

            //更新单据状态
            var allMatchingQty = detailList.Sum(x => x.MatchingQty);
            var allQty         = detailList.Sum(x => x.Qty);

            if (allMatchingQty == 0)
            {
                outbound.AllotStatus = -1;
            }
            else if (allQty > allMatchingQty)
            {
                outbound.AllotStatus = 1;
            }
            else
            {
                outbound.AllotStatus = 2;
            }

            outbound.Status = Enum.GetName(typeof(EnumStatus), EnumStatus.Audit);

            //保存
            var r1 = wmsoutbound.SaveChanges() > 0;

            return(new Tuple <bool, long, string>(r1, outbound.Id, ""));
        }
Esempio n. 8
0
        public TOut CastTo <TOut>() where TOut : IIntegral
        {
            TOut result = default(TOut);

            byte[] value = new byte[result.Length];
            byte[] bin   = ToBinary();

            for (int i = 0; i < result.Length; i++)
            {
                if (i < bin.Length)
                {
                    value[i] = bin[i];
                }
                else
                {
                    value[i] = 0;
                }
            }

            result.FromBinary(value);
            return(result);
        }
 /// <summary>
 /// Produce the output value given the index. This overload utilizes the <c>CopyOut</c>
 /// helper function.
 /// </summary>
 public override void CopyOut(int index, ref TOut value)
 {
     Contracts.Assert(0 <= index & index < _values.Length);
     CopyOut(in _values[index], ref value);
 }
Esempio n. 10
0
 public ISelect <TIn, TOut> Default(TOut instance)
 => new Component <TOut>(instance.Start()).ToSelect(I.A <TIn>());
 public Message(TIn inpart, TOut outpart)
 {
     this.input  = inpart;
     this.output = outpart;
 }
Esempio n. 12
0
 public Task <TIn> Yield(TOut value)
 {
     return(parent.Yield(value));
 }
Esempio n. 13
0
        private TOut BuildProcess <TOut>() where TOut : PageViewModelBase, IJewelryItemViewModel, new()
        {
            var viewModel = new TOut();

            var jewel = jewelRepository.GetJewelByID(jewelryID);

            if (jewel == null)
            {
                throw new ArgumentNullException();
            }

            viewModel.Title = jewel.Title;

            viewModel.ID = jewel.ID.ToString();

            var prettyMediaFactory = new prettyPhotoMediaFactory();
            var formatter          = new JONFormatter();


            viewModel.MainJewelPicture = prettyMediaFactory.SinglePhoto(jewel.Media.PictureURLForWebDisplay,
                                                                        jewel.Media.HiResURLForWebDisplay, jewel.Title);

            viewModel.HiResJewelPicture = prettyMediaFactory.SinglePhotoUseLargeForBoth(jewel.Media.HiResURLForWebDisplay,
                                                                                        jewel.Title);



            var extraMedia = new List <prettyPhotoMedia>();

            if (fileSystem.File.Exists(jewel.Media.HiResDiskPathForWebDisplay))
            {
                extraMedia.Add(prettyMediaFactory.SinglePhotoUseLargeForBoth(jewel.Media.HiResURLForWebDisplay, jewel.Title));
            }

            if (fileSystem.File.Exists(jewel.Media.HandDiskPathForWebDisplay))
            {
                extraMedia.Add(prettyMediaFactory.SinglePhotoUseLargeForBoth(jewel.Media.HandURLForWebDisplay, jewel.Title));
            }

            if (fileSystem.File.Exists(jewel.Media.ReportDiskPathForWebDisplay))
            {
                extraMedia.Add(prettyMediaFactory.SinglePhotoUseLargeForBoth(jewel.Media.ReportURLForWebDisplay, "Report"));
            }

            if (fileSystem.File.Exists(jewel.Media.HiRes2DiskPathForWebDisplay))
            {
                extraMedia.Add(prettyMediaFactory.SinglePhotoUseLargeForBoth(jewel.Media.HiRes2URLForWebDisplay, "Report"));
            }

            viewModel.ExtraImages = extraMedia;

            if (fileSystem.File.Exists(jewel.Media.MovieDiskPathForWebDisplay))
            {
                viewModel.HasMovie = true;
                viewModel.Movie    = jewel.Media.MovieURLForWebDisplay;
            }

            var price = new Money(jewel.Price, Currency.Usd).Format("{1}{0:#,0}");

            viewModel.Price = price;

            viewModel.RegularPrice = new Money(jewel.RegularPrice, Currency.Usd).Format("{1}{0:#,0}");

            viewModel.YouSave = String.Format("{0:0.##}%", Math.Round(100 - (jewel.Price / jewel.RegularPrice) * 100));

            viewModel.isSpecial = jewel.IsSpecial;

            viewModel.ItemNumber = jewel.ItemNumber;

            viewModel.Metal = jewel.MetalFullName();

            viewModel.Weight = jewel.Weight > 0 ? formatter.ToGramWeight(jewel.Weight) : "N/A";

            viewModel.Width = jewel.Width > 0 ? formatter.ToMilimeter(jewel.Width) : "N/A";

            viewModel.IsBestOffer = jewel.IsBestOffer;

            var specs = new List <JewelComponentInfoPart>();

            var colors = new List <string>()
            {
                "D",
                "E",
                "F",
                "G",
                "H",
                "I",
                "J",
                "K",
                "L",
                "M",
                "N",
            };

            var clarities = new List <string>()
            {
                "FL",
                "IF",
                "VVS1",
                "VVS2",
                "VS1",
                "VS2",
                "SI1",
                "SI2",
                "SI3",
                "I1",
                "I2",
                "I3",
            };

            colors.Reverse();
            clarities.Reverse();

            if (jewel.JewelryExtra.CS.Count > 0)
            {
                specs.Add(new JewelComponentInfoPart("Stone", jewel.JewelryExtra.CS.Type, 1));
                specs.Add(new JewelComponentInfoPart("Minimum carat total weight:",
                                                     formatter.ToCaratWeight(jewel.JewelryExtra.CS.Weight), 1));
                specs.Add(new JewelComponentInfoPart("# of Stones", jewel.JewelryExtra.CS.Count.ToString(), 1));


                var wordsToSayHowTheQualityIs = "Minimum";
                if (jewel.JewelryExtra.CS.Count > 1)
                {
                    wordsToSayHowTheQualityIs = "Average";
                    specs.Add(new JewelComponentInfoPart(wordsToSayHowTheQualityIs + " Color",
                                                         CreateRangeStringFrom(colors, jewel.JewelryExtra.CS.Color, 1),
                                                         1));
                    specs.Add(new JewelComponentInfoPart(wordsToSayHowTheQualityIs + " Clarity",
                                                         CreateRangeStringFrom(clarities, jewel.JewelryExtra.CS.Clarity,
                                                                               1), 1));
                }
                else
                {
                    specs.Add(new JewelComponentInfoPart(wordsToSayHowTheQualityIs + " Color",
                                                         jewel.JewelryExtra.CS.Color, 1));
                    specs.Add(new JewelComponentInfoPart(wordsToSayHowTheQualityIs + " Clarity",
                                                         jewel.JewelryExtra.CS.Clarity, 1));
                }
            }


            if (jewel.JewelryExtra.SS.Count > 0)
            {
                specs.Add(new JewelComponentInfoPart("Stone", jewel.JewelryExtra.SS.Type, 2));
                specs.Add(new JewelComponentInfoPart("Minimum carat total weight:",
                                                     formatter.ToCaratWeight(jewel.JewelryExtra.SS.Weight), 2));
                specs.Add(new JewelComponentInfoPart("# of Stones", jewel.JewelryExtra.SS.Count.ToString(), 2));
                specs.Add(new JewelComponentInfoPart("Average Color", CreateRangeStringFrom(colors, jewel.JewelryExtra.SS.Color, 1), 2));
                specs.Add(new JewelComponentInfoPart("Average Clarity", CreateRangeStringFrom(clarities, jewel.JewelryExtra.SS.Clarity, 1), 2));

                viewModel.HasSideStones = true;
            }

            viewModel.SpecsPool = specs;

            var testimonailsFromDB = testimonialRepository.GetRandomTestimonails(3);

            viewModel.Testimonials = mapper.Map <List <Testimonial>, List <TestimonialViewModel> >(testimonailsFromDB);

            viewModel.PageTitle = viewModel.Title + " - " + viewModel.Price;

            viewModel.JewelType = jewel.Type;

            return(viewModel);
        }
Esempio n. 14
0
 public CoroutineYieldedImpl(TOut value, TaskCompletionSource <SendMessage> k)
 {
     this.value = value;
     this.k     = k;
     this.used  = false;
 }
Esempio n. 15
0
 public ISelect <TIn, TOut> Return(TOut result)
 => new CastOrDefault <TIn, TOut>(new FixedResult <TIn, TOut>(result).Get);
Esempio n. 16
0
 public BitwiseCaster(TIn input)
 {
     Output = default(TOut);
     // Must be initialized after output, otherwise memory is overwritten.
     Input = input;
 }
Esempio n. 17
0
 public Selector <TIn, TOut> Return(TOut result)
 => new CastOrDefault <TIn, TOut>(new FixedResult <TIn, TOut>(result).Get).Then();
Esempio n. 18
0
 public Enumerator(SpanEnumerable <TOut> e)
 {
     _enum   = e;
     Current = default;
 }