Пример #1
0
        public ActionResult QueryOrOperatePod(QueryOrOperatePodViewModel vm, int?PageIndex, string SettledPodIDs)
        {
            vm.SearchCondition.FeeStr5  = ToStrCarModels(vm.SearchCondition.IntCarModels);
            vm.SearchCondition.IsPaging = vm.IsForQuery;
            if (vm.IsDaoChu)
            {
                vm.SearchCondition.podID    = vm.SelectedIDs;
                vm.SearchCondition.IsExport = true;
                var podAll = new DistributionService().DbToExcels(new DistributionPodRequest()
                {
                    SearchCondition = vm.SearchCondition,
                }).Result.PodExcel;
                return(this.ExportDfcjPodsToExcel(podAll));
            }
            var result = new DistributionService().QueryOrOperatePod(new DistributionPodRequest()
            {
                PageSize = UtilConstants.PAGESIZE, PageIndex = PageIndex ?? 0, SearchCondition = vm.SearchCondition, ProjectID = 1
            }).Result;

            vm.PodCollection = result.PodCollections;
            vm.PageIndex     = result.PageIndex;
            vm.PageCount     = result.PageCount;
            if (!string.IsNullOrEmpty(vm.SearchCondition.CustomerOrderNumber))
            {
                IEnumerable <string> customerOrderNumbers = Enumerable.Empty <string>();
                if (vm.SearchCondition.CustomerOrderNumber.IndexOf("\n") > 0)
                {
                    customerOrderNumbers = vm.SearchCondition.CustomerOrderNumber.Split('\n').Select(s => { return(s.Trim()); });
                }

                if (vm.SearchCondition.CustomerOrderNumber.IndexOf(',') > 0)
                {
                    customerOrderNumbers = vm.SearchCondition.CustomerOrderNumber.Split(',').Select(s => { return(s.Trim()); });
                }

                if (customerOrderNumbers == null || !customerOrderNumbers.Any())
                {
                    customerOrderNumbers = new string[] { vm.SearchCondition.CustomerOrderNumber };
                }

                var notContainsCustomerOrderNumbers = customerOrderNumbers.Where(c => !string.IsNullOrEmpty(c) &&
                                                                                 !vm.PodCollection.Any(p => string.Equals(p.CustomerOrderNumber, c.Trim(), StringComparison.OrdinalIgnoreCase))
                                                                                 );

                if (notContainsCustomerOrderNumbers != null && notContainsCustomerOrderNumbers.Any())
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append("您输入的客户运单号:");
                    notContainsCustomerOrderNumbers.Each((i, c) => { sb.Append(c).Append(","); });
                    sb.Remove(sb.Length - 1, 1);
                    sb.Append("在本页结果中没有出现,系统中不存在此客户运单号或者此运单号在其他页或者请变更其他查询条件.");
                    vm.ReturnClientMessage = sb.ToString();
                }
            }

            return(View(vm));
        }
Пример #2
0
        public ActionResult QueryOrOperatePod(bool?isForQuery)
        {
            QueryOrOperatePodViewModel vm = new QueryOrOperatePodViewModel();

            vm.SearchCondition = new PodDistribution();
            vm.PageIndex       = 0;
            vm.PageCount       = 0;
            vm.IsForQuery      = isForQuery ?? true;
            vm.SearchCondition.ActualDeliveryDate    = DateTime.Now.AddDays(-7);
            vm.SearchCondition.EndActualDeliveryDate = DateTime.Now;

            return(View(vm));
        }