Beispiel #1
0
        protected PackingLog NewPackingLog(LatticeSetting lattice, UserInfo userInfo, int operationType, List <LatticeOrdersCache> logList, decimal boxWeight)
        {
            var pkgLog = new PackingLog()
            {
                ID            = Guid.NewGuid().ToString(),
                PackNumber    = API_Helper.GetFlytPackageLabelID(),
                CabinetId     = "",
                LatticeId     = "",
                OrderIds      = string.Join(",", logList.Select(l => l.OrderId)),
                OrderQty      = logList.Count,
                Weight        = boxWeight + logList.Sum(o => o.Weight),
                OperationType = operationType,
                OperationTime = DateTime.Now,
                UserId        = userInfo.UserId,
                UserName      = userInfo.UserName
            };

            if (lattice != null)
            {
                pkgLog.CabinetId = lattice.CabinetId.ToString();
                pkgLog.LatticeId = lattice.LatticeId;
            }
            pkgLog.PostTypeIds = string.Join(",", logList.Select(l => l.PostId).Distinct());
            var postTypeNames = logList.Select(l => l.PostName).Distinct();

            pkgLog.PostTypeNames = postTypeNames.Count() > 2 ? "MIX" : string.Join(",", postTypeNames);
            pkgLog.CountryIds    = string.Join(",", logList.Select(s => s.CountryId).Distinct());
            var countryNames = logList.Select(s => s.CountryName).Distinct();

            pkgLog.CountryNames = countryNames.Count() > 2 ? "MIX" : string.Join(",", countryNames);
            return(pkgLog);
        }