コード例 #1
0
ファイル: ProjectController.cs プロジェクト: ChainSong/WMS
        public ActionResult CustomerOrShipperSegmentAllocate(int id)
        {
            var customerOrShippers = new ProjectService().GetProjectCustomersOrShippers(new GetProjectCustomersOrShippersRequest()
            {
                ProjectID = base.UserInfo.ProjectID, Target = id
            }).Result.Where(cs => cs.State);
            var customers = ApplicationConfigHelper.GetProjectUserCustomers(base.UserInfo.ProjectID, base.UserInfo.ID);
            var segments  = new SegmentService().GetSegmentsByCondition(new GetSegmentsByConditionRequest()
            {
                Name = "", State = true
            }).Result;

            if (customerOrShippers == null || !customerOrShippers.Any())
            {
                return(Error("请先设置项目" + (id == 0 ? "客户" : "承运商")));
            }

            if (segments == null || !segments.Any())
            {
                return(Error("请先配置段位"));
            }

            if (id == 1 && (customers == null || !customers.Any()))
            {
                return(Error("请先分配项目客户"));
            }

            CustomerOrShipperSegmentViewModel vm = new CustomerOrShipperSegmentViewModel()
            {
                Target    = id,
                ProjectID = base.UserInfo.ProjectID,
                CustomerOrShippersCollection = customerOrShippers.Select(s => new SelectListItem()
                {
                    Value = s.CustomerOrShipperID.ToString(), Text = s.CustomerOrShipperName
                }),
                Segments = segments.Select(s => new SelectListItem()
                {
                    Value = s.ID.ToString(), Text = s.Name
                }),
                Customers = customers.Select(c => new SelectListItem()
                {
                    Value = c.CustomerID.ToString(), Text = c.CustomerName
                })
            };

            return(View(vm));
        }
コード例 #2
0
ファイル: ShipperController.cs プロジェクト: ChainSong/WMS
        public ActionResult ShiperSegment(int id, string message)
        {
            var customerOrShippers = new ProjectService().GetProjectCustomersOrShippers(new GetProjectCustomersOrShippersRequest()
            {
                ProjectID = base.UserInfo.ProjectID, Target = 1
            }).Result.Where(cs => cs.CustomerOrShipperID == id);
            var customers = ApplicationConfigHelper.GetProjectUserCustomers(base.UserInfo.ProjectID, base.UserInfo.ID);
            var segments  = new SegmentService().GetSegmentsByCondition(new GetSegmentsByConditionRequest()
            {
                Name = "", State = true
            }).Result;
            var projectShipperSegments = ApplicationConfigHelper.GetProjectCustomerOrShiperSegment().Where(p => p.Target == 1 && p.CustomerOrShipperID == id && p.ProjectID == base.UserInfo.ProjectID);


            CustomerOrShipperSegmentViewModel vm = new CustomerOrShipperSegmentViewModel()
            {
                Target = 1,
                SelectedCustomerOrShipperID = id.ToString(),
                ProjectID = base.UserInfo.ProjectID,
                ProjectCustomerOrShipperSegments = projectShipperSegments,
                ShipperName = customerOrShippers.Where(c => c.CustomerOrShipperID == id).FirstOrDefault().CustomerOrShipperName,
                CustomerOrShippersCollection = customerOrShippers.Select(s => new SelectListItem()
                {
                    Value = s.CustomerOrShipperID.ToString(), Text = s.CustomerOrShipperName
                }),
                Segments = segments.Select(s => new SelectListItem()
                {
                    Value = s.ID.ToString(), Text = s.Name + "------>>详情>>" + s.Description
                }),
                Customers = customers.Select(c => new SelectListItem()
                {
                    Value = c.CustomerID.ToString(), Text = c.CustomerName
                })
            };

            return(View(vm));
        }