Beispiel #1
0
        public ActionResult Index()
        {
            string orderLevel = "0";
            string taskLevel  = "0";

            if (Session["ClientManager"] == null)
            {
                return(Redirect("/Home/Login"));
            }
            else
            {
                var currentUser = (IntFactoryEntity.Users)Session["ClientManager"];

                if (currentUser.Client.GuideStep != 0)
                {
                    return(Redirect("/Default/Index"));
                }

                var client = ClientBusiness.GetClientDetail(currentUser.ClientID);
                ViewBag.RemainDay  = Math.Ceiling((client.EndTime - DateTime.Now).TotalDays);
                ViewBag.RemainDate = client.EndTime.Date.ToString("yyyy-MM-dd");

                ViewBag.BuyPeople = client.UserQuantity;
                ViewBag.UsePeople = OrganizationBusiness.GetUsers(client.ClientID).FindAll(m => m.Status != 9).Count;

                if (currentUser.Role != null)
                {
                    //所有订单
                    if (ExpandClass.IsExistMenu("102010300"))
                    {
                        orderLevel = "-1";
                    }
                    else if (ExpandClass.IsExistMenu("102010601") || ExpandClass.IsExistMenu("102010701") || ExpandClass.IsExistMenu("102010801"))
                    {
                        orderLevel = "-1";
                    }
                    else if (ExpandClass.IsExistMenu("102010600") || ExpandClass.IsExistMenu("102010700") || ExpandClass.IsExistMenu("102010800"))
                    {
                        orderLevel = "1";
                    }

                    //所有任务
                    if (ExpandClass.IsExistMenu("109010200"))
                    {
                        taskLevel = "-1";
                    }
                    else
                    {
                        taskLevel = "1";
                    }
                }
                ViewBag.OrderMarks = SystemBusiness.BaseBusiness.GetLableColor(currentUser.ClientID, EnumMarkType.Orders);
                ViewBag.TaskMarks  = SystemBusiness.BaseBusiness.GetLableColor(currentUser.ClientID, EnumMarkType.Tasks);
                ViewBag.UserID     = currentUser.UserID;
                ViewBag.orderLevel = orderLevel;
                ViewBag.taskLevel  = taskLevel;
            }

            return(View());
        }
Beispiel #2
0
 public ActionResult Orders(string id)
 {
     if (ExpandClass.IsExistMenu("102010801"))
     {
         ViewBag.Title = "所有大货单";
         ViewBag.Type  = (int)EnumSearchType.All;
     }
     else
     {
         ViewBag.Title = "我的大货单";
         ViewBag.Type  = (int)EnumSearchType.Myself;
     }
     ViewBag.SearchType = (int)EnumOrderSearchType.DH;
     ViewBag.list       = SystemBusiness.BaseBusiness.GetLableColor(CurrentUser.ClientID, EnumMarkType.Orders).ToList();
     return(View("Orders"));
 }
Beispiel #3
0
 public ActionResult MyOrder()
 {
     if (ExpandClass.IsExistMenu("102010600"))
     {
         return(Redirect("/Orders/DemandOrders"));
     }
     else if (ExpandClass.IsExistMenu("102010700"))
     {
         return(Redirect("/Orders/GoodsOrders"));
     }
     else if (ExpandClass.IsExistMenu("102010800"))
     {
         return(Redirect("/Orders/Orders"));
     }
     return(Redirect("/Error/NoRoot"));
 }
Beispiel #4
0
        public bool IsSeeRoot(TaskEntity task, IntFactoryEntity.OrderEntity order)
        {
            if (task.OwnerID.Equals(CurrentUser.UserID, StringComparison.OrdinalIgnoreCase))
            {
                return(true);
            }
            else if (task.TaskMembers.Find(m => m.MemberID.ToLower() == CurrentUser.UserID.ToLower()) != null)
            {
                return(true);
            }
            else if (order.OwnerID.Equals(CurrentUser.UserID, StringComparison.OrdinalIgnoreCase))
            {
                return(true);
            }
            else if (string.IsNullOrEmpty(ExpandClass.IsLimits("109010200")))
            {
                return(true);
            }

            return(false);
        }
Beispiel #5
0
        public JsonResult GetOrdersOrTasksReportData(int orderType, int filterTimeType, int moduleType, int taskType, string userID)
        {
            Dictionary <string, Object> resultObj = new Dictionary <string, object>();
            int result = 0;

            if (Session["ClientManager"] != null)
            {
                var    currentUser = (IntFactoryEntity.Users)Session["ClientManager"];
                var    nowDate     = DateTime.Now;
                string beginTime   = "";
                string endTime     = "";
                if (filterTimeType == 0)
                {
                    beginTime = nowDate.Date.AddDays(-15).ToString();
                    endTime   = nowDate.Date.AddDays(-1).ToString();
                    nowDate   = nowDate.Date.AddDays(-15);
                }
                else if (filterTimeType == 1)
                {
                    beginTime = nowDate.Date.ToString();
                    endTime   = nowDate.Date.AddDays(14).ToString();
                }
                else if (filterTimeType == 2)
                {
                    beginTime = nowDate.Date.AddDays(15).ToString();
                    endTime   = nowDate.Date.AddDays(29).ToString();
                    nowDate   = nowDate.Date.AddDays(15);
                }

                List <OrderEntity> orderItems = new List <OrderEntity>();
                List <IntFactoryEntity.Task.TaskEntity> taskItems = new List <IntFactoryEntity.Task.TaskEntity>();

                int getTotalCount = 0;
                int pageCount     = 0;

                if (moduleType == 1)
                {
                    bool   isDYAll    = ExpandClass.IsExistMenu("102010701");
                    bool   isDHAll    = ExpandClass.IsExistMenu("102010801");
                    string orderWhere = "";

                    //所有订单
                    if (ExpandClass.IsExistMenu("102010300"))
                    {
                    }
                    else if (!isDYAll && isDHAll)
                    {
                        orderWhere = " and (o.OrderType=2 or ((o.OwnerID='" + currentUser.UserID + "' or o.CreateUserID='" + currentUser.UserID + "'))) ";
                    }
                    else if (isDYAll && !isDHAll)
                    {
                        orderWhere = " and (o.OrderType=1 or ((OwnerID='" + currentUser.UserID + "' or o.CreateUserID='" + currentUser.UserID + "'))) ";
                    }
                    else
                    {
                        userID = currentUser.UserID;
                    }

                    orderItems = IntFactoryBusiness.OrdersBusiness.BaseBusiness.GetOrdersByPlanTime(beginTime, endTime, orderType, -1, -1,
                                                                                                    userID, currentUser.ClientID, orderWhere, int.MaxValue, 1, ref getTotalCount, ref pageCount);
                }
                else
                {
                    //所有任务
                    if (!ExpandClass.IsExistMenu("109010200"))
                    {
                        userID = currentUser.UserID;
                    }

                    taskItems = IntFactoryBusiness.TaskBusiness.GetTasksByEndTime(beginTime, endTime,
                                                                                  orderType, -1, -1, -1, taskType,
                                                                                  userID, currentUser.ClientID, int.MaxValue, 1, ref getTotalCount, ref pageCount);
                }

                var totalExceedCount = 0;
                var totalWarnCount   = 0;
                var totalWorkCount   = 0;
                var totalFinishCount = 0;
                var totalSumCount    = 0;
                var reportArr        = new  List <Dictionary <string, Object> >();
                for (var i = 0; i < 15; i++)
                {
                    var report   = new Dictionary <string, Object>();
                    var nextDate = nowDate.AddDays(i);

                    var exceedCount = 0;
                    var warnCount   = 0;
                    var workCount   = 0;
                    var finishCount = 0;
                    var totalCount  = 0;

                    //订单操作
                    if (moduleType == 1)
                    {
                        var orderList = orderItems.FindAll(m => m.PlanTime.Date == nextDate.Date);
                        exceedCount = orderList.FindAll(m => m.PlanTime < DateTime.Now && m.OrderStatus == 1).Count;
                        for (var j = 0; j < orderList.Count; j++)
                        {
                            var order = orderList[j];
                            if (order.PlanTime > DateTime.Now && order.OrderStatus == 1)
                            {
                                if ((order.PlanTime - DateTime.Now).TotalHours * 3 < (order.PlanTime - order.OrderTime).TotalHours)
                                {
                                    warnCount++;
                                }
                                else
                                {
                                    workCount++;
                                }
                            }
                        }
                        finishCount = orderList.FindAll(m => m.OrderStatus == 2).Count;
                    }
                    //任务操作
                    else
                    {
                        var taskList = taskItems.FindAll(m => m.EndTime.Date == nextDate.Date);
                        exceedCount = taskList.FindAll(m => m.EndTime < DateTime.Now && m.FinishStatus == 1).Count;
                        for (var j = 0; j < taskList.Count; j++)
                        {
                            var task = taskList[j];
                            if (task.EndTime > DateTime.Now && task.FinishStatus == 1)
                            {
                                if ((task.EndTime - DateTime.Now).TotalHours * 3 < (task.EndTime - task.AcceptTime).TotalHours)
                                {
                                    warnCount++;
                                }
                                else
                                {
                                    workCount++;
                                }
                            }
                        }
                        finishCount = taskList.FindAll(m => m.FinishStatus == 2).Count;
                    }
                    report.Add("dateTime", nextDate.Date.ToString("yyyy.MM.dd"));
                    report.Add("date", nextDate.Date.ToString("MM.dd"));
                    report.Add("warnCount", warnCount);
                    report.Add("finishCount", finishCount);
                    report.Add("workCount", workCount);
                    report.Add("exceedCount", exceedCount);
                    totalCount = warnCount + finishCount + workCount + exceedCount;
                    report.Add("totalCount", totalCount);

                    totalExceedCount += exceedCount;
                    totalFinishCount += finishCount;
                    totalWarnCount   += warnCount;
                    totalWorkCount   += workCount;
                    totalSumCount    += totalCount;
                    reportArr.Add(report);
                }

                result = 1;
                resultObj.Add("items", reportArr);
                resultObj.Add("totalExceedCount", totalExceedCount);
                resultObj.Add("totalFinishCount", totalFinishCount);
                resultObj.Add("totalWarnCount", totalWarnCount);
                resultObj.Add("totalWorkCount", totalWorkCount);
                resultObj.Add("totalSumCount", totalSumCount);
            }
            resultObj.Add("result", result);

            return(new JsonResult()
            {
                Data = resultObj,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #6
0
        public JsonResult GetTaskOrOrderEcceedCount(int moduleType, int orderType, string userID)
        {
            Dictionary <string, object> JsonDictionary = new Dictionary <string, object>();
            var currentUser = (IntFactoryEntity.Users)Session["ClientManager"];
            var total       = 0;

            if (moduleType == 1)
            {
                bool   isDYAll    = ExpandClass.IsExistMenu("102010701");
                bool   isDHAll    = ExpandClass.IsExistMenu("102010801");
                string orderWhere = "";
                //订单权限控制
                if (orderType == -1)
                {
                    //所有订单
                    if (ExpandClass.IsExistMenu("102010300"))
                    {
                        orderWhere = "-1";
                    }
                    else if (isDYAll && isDHAll) //所有大货单和打样单
                    {
                        orderWhere = "-1";
                    }
                    else if (!isDYAll && isDHAll)
                    {
                        orderWhere = " and (OrderType=2 or ((OwnerID='" + currentUser.UserID + "' or CreateUserID='" + currentUser.UserID + "'))) ";
                    }
                    else if (isDYAll && !isDHAll)
                    {
                        orderWhere = " and (OrderType=1 or ((OwnerID='" + currentUser.UserID + "' or CreateUserID='" + currentUser.UserID + "'))) ";
                    }
                    else
                    {
                        userID = currentUser.UserID;
                    }
                }
                else if (orderType == 1)
                {
                    if (!isDYAll)
                    {
                        userID = currentUser.UserID;
                    }
                    orderWhere = " and OrderType=1 ";
                }
                else if (orderType == 2)
                {
                    if (!isDHAll)
                    {
                        userID = currentUser.UserID;
                    }
                    orderWhere = " and OrderType=2 ";
                }

                total = IntFactoryBusiness.OrdersBusiness.BaseBusiness.GetExceedOrderCount(userID, orderWhere, currentUser.ClientID);
            }
            else
            {
                //任务权限控制
                if (!ExpandClass.IsExistMenu("109010200"))
                {
                    userID = currentUser.UserID;
                }

                total = IntFactoryBusiness.TaskBusiness.GetExceedTaskCount(userID, orderType, currentUser.ClientID);
            }

            JsonDictionary.Add("result", total);

            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #7
0
        public JsonResult GetOrdersOrTasksDataList(int filterType, string filterTime,
                                                   int moduleType, int orderType, int taskType, string userID,
                                                   int pageSize, int pageIndex, int preFinishStatus)
        {
            Dictionary <string, object> JsonDictionary = new Dictionary <string, object>();
            var currentUser = (IntFactoryEntity.Users)Session["ClientManager"];

            string startTime    = string.Empty;
            int    orderStatus  = 0;
            int    finishStatus = 0;

            if (!string.IsNullOrEmpty(filterTime))
            {
                startTime    = filterTime;
                orderStatus  = -1;
                finishStatus = -1;
            }
            else
            {
                if (filterType != -1)
                {
                    orderStatus  = -1;
                    finishStatus = -1;
                }
            }

            int getTotalCount = 0;
            int pageCount     = 0;

            if (moduleType == 1)
            {
                string orderWhere = "";
                //所有订单
                if (!ExpandClass.IsExistMenu("102010300"))
                {
                    if (orderStatus == 0)
                    {
                        if (!ExpandClass.IsExistMenu("102010601"))
                        {
                            userID = currentUser.UserID;
                        }
                    }
                    else
                    {
                        bool isDYAll = ExpandClass.IsExistMenu("102010701");
                        bool isDHAll = ExpandClass.IsExistMenu("102010801");

                        if (!isDYAll && isDHAll)
                        {
                            orderWhere = " and (o.OrderType=2 or ((o.OwnerID='" + currentUser.UserID + "' or o.CreateUserID='" + currentUser.UserID + "'))) ";
                        }
                        else if (isDYAll && !isDHAll)
                        {
                            orderWhere = " and (o.OrderType=1 or ((OwnerID='" + currentUser.UserID + "' or o.CreateUserID='" + currentUser.UserID + "'))) ";
                        }
                        else
                        {
                            userID = currentUser.UserID;
                        }
                    }
                }

                var list = IntFactoryBusiness.OrdersBusiness.BaseBusiness.GetOrdersByPlanTime(startTime, startTime, orderType, filterType, orderStatus,
                                                                                              userID, currentUser.ClientID, orderWhere, pageSize, pageIndex, ref getTotalCount, ref pageCount);
                JsonDictionary.Add("items", list);
            }
            else
            {
                //所有任务
                if (!ExpandClass.IsExistMenu("109010200"))
                {
                    userID = currentUser.UserID;
                }

                var list = IntFactoryBusiness.TaskBusiness.GetTasksByEndTime(startTime, startTime,
                                                                             orderType, filterType, finishStatus, preFinishStatus, taskType,
                                                                             userID, currentUser.ClientID, pageSize, pageIndex, ref getTotalCount, ref pageCount);
                JsonDictionary.Add("items", list);
            }

            JsonDictionary.Add("getNeedTotalCount", getTotalCount);
            JsonDictionary.Add("pageCount", pageCount);
            if (!string.IsNullOrEmpty(filterTime))
            {
                JsonDictionary.Add("showTime", filterTime.Replace(".", "-") + "/" + YXERP.Common.Common.Week("周", (int)Convert.ToDateTime(filterTime).DayOfWeek));
            }

            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }