示例#1
0
        /// <summary>
        /// 获取用户权限菜单
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public IList <SysFunc> GetUserFuncs2(string userId)
        {
            PublicService ps = new PublicService();
            //获取用户角色关系
            IList <UserRole> urolelist = ps.GetGenericService <UserRole>().Query().Where(p => p.UserID == userId).ToList();
            ArrayList        arry      = new ArrayList();

            foreach (UserRole u in urolelist)
            {
                arry.Add(u.RoleID);
            }
            //获取角色列表
            IList <Role> rolelist = ps.GetGenericService <Role>().Query().Where(p => arry.Contains(p.ID)).ToList();
            ArrayList    arry2    = new ArrayList();

            foreach (Role u in rolelist)
            {
                arry2.Add(u.ID);
            }
            //获取菜单角色关系
            IList <FuncRole> froleList = ps.GetGenericService <FuncRole>().Query().Where(p => arry2.Contains(p.RoleID)).OrderBy(p => p.SysFuncId).ToList();
            ArrayList        arry3     = new ArrayList();

            foreach (FuncRole u in froleList)
            {
                if (!arry3.Contains(u.SysFuncId))
                {
                    arry3.Add(u.SysFuncId);
                }
            }
            IList <SysFunc> sysfuncList = ps.GetGenericService <SysFunc>().Query().Where(p => p.IsDisabled == false && arry3.Contains(p.ID)).OrderBy(p => p.OrderNum).ThenBy(p => p.ID).ToList();

            return(sysfuncList);
        }
        /// <summary>
        /// 获取运输单任务
        /// </summary>
        /// <param name="CarId"></param>
        /// <returns></returns>
        public IList <ShippingDocument> getShippingTask(string CarId)
        {
            IList <ShippingDocument> shippingDocumentList = new List <ShippingDocument>();
            IList <Car>   CarList = null;
            PublicService ps      = new PublicService();

            if (string.IsNullOrEmpty(CarId))
            {
                CarList = ps.GetGenericService <Car>().Query().Where(p => p.CarStatus == ZLERP.Model.Enums.CarStatus.ShippingCar && p.IsUsed).ToList();
            }
            else
            {
                CarList = ps.GetGenericService <Car>().Query().Where(p => p.CarStatus == ZLERP.Model.Enums.CarStatus.ShippingCar && p.ID == CarId && p.IsUsed).ToList();
            }
            foreach (Car car in CarList)
            {
                ShippingDocument shippingDocument = this.Query().OrderByDescending(p => p.BuildTime).FirstOrDefault(p => p.CarID == car.ID && p.IsEffective);
                if (shippingDocument != null)
                {
                    shippingDocumentList.Add(shippingDocument);
                }
            }

            return(shippingDocumentList);
        }
示例#3
0
        public void SavePath(string ProjectId, double?Distance, string LonLatStr)
        {
            using (var tx = this.m_UnitOfWork.BeginTransaction())
            {
                try
                {
                    ProjectRoute PR = new ProjectRoute();
                    PR.ProjectId = ProjectId;
                    PR.Source    = "E";
                    PR.IsPrimary = false;
                    PR           = this.Add(PR);


                    this.m_UnitOfWork.Flush();
                    RouteDetail RD = new RouteDetail();
                    RD.Distance = Distance;

                    RD.LonLatStr    = LonLatStr;
                    RD.RouteId      = PR.ID;
                    RD.ProjectID    = PR.ProjectId;
                    RD.ProjectRoute = PR;
                    PublicService ps = new PublicService();
                    ps.GetGenericService <RouteDetail>().Add(RD);
                    tx.Commit();
                }
                catch (Exception ex)
                {
                    tx.Rollback();
                    logger.Error(ex.Message, ex);
                    throw ex;
                }
            }
        }
示例#4
0
        public bool CancelAuditing(CustomerPlan plan)
        {
            // var plan = this.Get(id);
            if (plan != null)
            {
                ProduceTask task = new ProduceTask();
                task = this.m_UnitOfWork.GetRepositoryBase <ProduceTask>().Get(plan.TaskID);
                if (task.IsFormulaSend)
                {
                    throw new Exception("单据已下发配比,不能取消审核!");
                }
                else
                {
                    //更新CustomerPlan表记录
                    plan.AuditTime = null;
                    plan.Auditor   = string.Empty;
                    string TaskID = plan.TaskID;
                    plan.TaskID = null;
                    this.Update(plan, null);

                    PublicService ps = new PublicService();
                    if (TaskID != "")
                    {
                        //删除ProducePlan表记录
                        ProducePlan pplan = new ProducePlan();
                        pplan = this.m_UnitOfWork.GetRepositoryBase <ProducePlan>().Query().Where(p => p.TaskID.Contains(TaskID)).OrderByDescending(p => p.ID).FirstOrDefault();
                        if (pplan != null)
                        {
                            ps.GetGenericService <ProducePlan>().Delete(pplan);
                        }
                        //删除ProduceTask表记录
                        if (task != null)
                        {
                            ps.GetGenericService <ProduceTask>().Delete(task);
                        }
                    }

                    return(true);
                }
            }
            return(false);
        }