예제 #1
0
        public JsonResult Index(LoadNodeListRequest req)
        {
            ResponseBase <PageInfoResponse <List <NodeDetailDto> > > tasklist = PostToServer <PageInfoResponse <List <NodeDetailDto> >, LoadNodeListRequest>(ClientProxy.LoadNodeList_Url, req);

            if (tasklist.Status != ResponesStatus.Success)
            {
                return(Json(new
                {
                    sEcho = 0,
                    iTotalRecords = 0,
                    iTotalDisplayRecords = 0,
                    aaData = new List <string>()
                }));
            }
            return(Json(tasklist.Data));
        }
예제 #2
0
 public ResponseBase <PageInfoResponse <List <NodeDetailDto> > > LoadNodeList(LoadNodeListRequest req)
 {
     try
     {
         DateTime starttime  = Convert.ToDateTime(req.NodeCreateTimeRange.Split('/')[0]);
         DateTime endtime    = Convert.ToDateTime(req.NodeCreateTimeRange.Split('/')[1]).AddDays(1);
         int      pageIndex  = (req.iDisplayStart / req.iDisplayLength) + 1;
         int      totalCount = 0;
         var      node       = noderepository.Find(out totalCount, pageIndex, req.iDisplayLength, x => x.id.ToString(), x =>
                                                   x.id == (req.NodeId <= 0 ? x.id : req.NodeId) &&
                                                   x.refreshcommandqueuestatus == (req.ListenCommandQueueStatus < 0 ? x.refreshcommandqueuestatus : req.ListenCommandQueueStatus) &&
                                                   x.nodestatus == (req.NodeRunStatus < 0 ? x.nodestatus : req.NodeRunStatus) &&
                                                   x.createtime >= starttime && x.createtime < endtime &&
                                                   x.createby == (req.CreateBy <= 0?x.createby:req.CreateBy) &&
                                                   x.alarmtype == (req.AlarmType < 0?x.alarmtype:req.AlarmType)
                                                   ).ToList();
         if (node == null || node.Count <= 0)
         {
             return(ResponseToClient <PageInfoResponse <List <NodeDetailDto> > >(ResponesStatus.Failed, "当前未查到任何节点"));
         }
         List <NodeDetailDto> nodelist = new List <NodeDetailDto>();
         //LoadNodeListResponse data = new LoadNodeListResponse() { NodeList=nodelist };
         node.ForEach(x =>
         {
             NodeDetailDto detail     = new NodeDetailDto();
             detail.TotalCommandCount = commandQueueRep.Find(m => m.nodeid == x.id).ToList().Count;  //命令总数量
             int waitExecute          = (int)ExecuteStatus.NoExecute;
             // int execute=(int)ExecuteStatus.NoExecute;
             detail.WaitCommandCount = commandQueueRep.Find(m => m.nodeid == x.id && m.commandstate == waitExecute).ToList().Count;  //命令总数量
             detail.TotalTaskCount   = taskversionRep.Find(m => m.nodeid == x.id).Select(m => m.taskid).Distinct().Count();
             nodelist.Add(detail);
             detail.NodeDetail = x;
             //detail.RunningTaskCount = tasklogRep.Find(m => m.nodeid == x.id && m.taskstatus ==).Select(m => m.taskid).Distinct().Count();
         });
         //data.NodeList = nodelist;
         return(ResponseToClient <PageInfoResponse <List <NodeDetailDto> > >(ResponesStatus.Success, "", new PageInfoResponse <List <NodeDetailDto> >()
         {
             aaData = nodelist, iTotalDisplayRecords = totalCount, iTotalRecords = totalCount, sEcho = req.sEcho
         }));
     }
     catch (Exception ex)
     {
         return(ResponseToClient <PageInfoResponse <List <NodeDetailDto> > >(ResponesStatus.Exception, ex.Message));
     }
 }