示例#1
0
    /// <summary>
    /// 详情按钮事件触发
    /// </summary>
    public void DetailBtn_OnClick()
    {
        InspectionTrackHistory infoDetail = CommunicationObject.Instance.GetInspectionDetailInfo(info);

        MobileInspectionHistoryDetailInfo.Instance.DateUpdate(infoDetail);
        //MobileInspectionHistory_N.Instance.CloseBtn_OnClick();//关闭巡检历史路线窗口
    }
示例#2
0
 /// <summary>
 /// 初始化数据
 /// </summary>
 public void Init(InspectionTrackHistory infoT, int currentIndex)
 {
     info         = infoT;
     NumText.text = currentIndex.ToString();
     NumberInspectionText.text = info.Code.ToString();
     RoutingNameText.text      = info.Name;
     if (info.dtStartTime != null)
     {
         DateTime timeN = (DateTime)info.dtStartTime;
         StartTimeText.text = timeN.ToString("yyyy年MM月dd日 HH:mm");
     }
     else
     {
         StartTimeText.text = "--";
     }
     if (info.dtEndTime != null)
     {
         DateTime timeN = (DateTime)info.dtEndTime;
         EndTimeText.text = timeN.ToString("yyyy年MM月dd日 HH:mm");
     }
     else
     {
         EndTimeText.text = "--";
     }
     StateText.text = info.State;
 }
 /// <summary>
 /// 筛选根据巡检编号
 /// </summary>
 public bool InspectionTrackHistoryContainsNO(InspectionTrackHistory inspectionTrackT)
 {
     if (inspectionTrackT.Id.ToString().ToLower().Contains(MobileInspectionHistory_N.Instance.searchInput.text.ToLower()))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
 /// <summary>
 /// 巡检历史路线筛选条件
 /// </summary>
 public bool WorkTicketContains(InspectionTrackHistory inspectionTrackT)
 {
     if (InspectionTrackHistoryContainsNO(inspectionTrackT))
     {
         return(true);
     }
     if (InspectionTrackHistoryContainsName(inspectionTrackT))
     {
         return(true);
     }
     return(false);
 }
    /// <summary>
    /// 创建人员列表项
    /// </summary>
    public MobileInspectionHistoryItem CreatePersonItem(InspectionTrackHistory w, int currentIndex)
    {
        titleHistory = w.Code + "-" + w.Name;
        MobileInspectionHistoryItem item = Instantiate(itemPrefab);

        item.Init(w, currentIndex);
        item.transform.SetParent(grid.transform);
        item.transform.localScale    = Vector3.one;
        item.transform.localPosition = Vector3.zero;
        //item.gameObject.SetActive(true);
        return(item);
    }
示例#6
0
    public void DateUpdate(InspectionTrackHistory list)
    {
        PatrolPointHistoryList.Clear();
        PatrolPointHistoryList.AddRange(list.Route);
        //CreatInspectionHistoyDetailInfo();
        TitleText.text = list.Code + "-" + list.Name;

        startPageNum = 0;
        pageNum      = 1;
        GetListPages();
        pageNumText.text = "1";
        TotalLine();
    }
示例#7
0
        private void DataGridPatrolList3_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            InspectionTrackHistory item = DataGridPatrolList3.SelectedItem as InspectionTrackHistory;

            if (item == null)
            {
                return;
            }
            Bll bll   = Bll.NewBllNoRelation();
            var route = bll.PatrolPointHistorys.FindAll(i => i.ParentId == item.Id);

            PatrolDetail3.SelectedObject   = item;
            DataGridRouteList3.ItemsSource = route;
            bll.Dispose();
        }
    /// <summary>
    /// 筛选根据路线名称
    /// </summary>
    public bool InspectionTrackHistoryContainsName(InspectionTrackHistory inspectionTrackT)
    {
        string nameT = "";

        if (inspectionTrackT.Code != null)
        {
            nameT = inspectionTrackT.Code;
        }
        if (nameT.ToLower().Contains(MobileInspectionHistory_N.Instance.searchInput.text.ToLower()))
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
示例#9
0
 public InspectionTrackHistory GetInspectionHistoryById(InspectionTrackHistory history)
 {
     try
     {
         var trackDBModel = dbEx.InspectionTrackHistorys.Find(i => i.Id == history.Id);
         if (trackDBModel != null)
         {
             InspectionTrackHistory inspectTemp = trackDBModel.ToTModel();
             return(inspectTemp);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception e)
     {
         string error = e.ToString();
         return(null);
     }
 }
示例#10
0
        public InspectionTrackHistory ToHistory()
        {
            InspectionTrackHistory history = new InspectionTrackHistory();

            history.Abutment_Id  = Abutment_Id;
            history.Code         = Code;
            history.Name         = Name;
            history.dtCreateTime = dtCreateTime;
            history.CreateTime   = CreateTime;
            history.State        = State;
            history.dtStartTime  = dtStartTime;
            history.StartTime    = StartTime;
            history.dtEndTime    = dtEndTime;
            history.EndTime      = EndTime;
            foreach (PatrolPoint item in Route)
            {
                PatrolPointHistory pph = item.ToHistory();
                history.Route.Add(pph);
            }

            return(history);
        }
示例#11
0
        public ActionResult Finish(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            InspectionTrack        ist  = bll.InspectionTracks.Find(id);
            InspectionTrackHistory isth = new InspectionTrackHistory();

            isth.Id           = ist.Id;
            isth.Code         = ist.Code;
            isth.Name         = ist.Name;
            isth.dtCreateTime = ist.dtCreateTime;
            isth.State        = ist.State;
            isth.dtStartTime  = ist.dtStartTime;
            isth.dtEndTime    = ist.dtEndTime;

            List <PatrolPointHistory> lst = new List <PatrolPointHistory>();

            foreach (PatrolPoint item in ist.Route)
            {
                PatrolPointHistory pph = new PatrolPointHistory();
                pph.Id        = item.Id;
                pph.ParentId  = item.ParentId;
                pph.StaffCode = item.StaffCode;
                pph.StaffName = item.StaffName;
                pph.KksCode   = item.KksCode;
                pph.DevName   = item.DevName;
            }
            isth.Route = lst;

            bll.InspectionTracks.DeleteById(id);
            bll.InspectionTrackHistorys.Add(isth);

            return(RedirectToAction("Index"));
        }
示例#12
0
        private void DealPatrolPointItem(Bll bll, List <InspectionTrack> All, List <InspectionTrackHistory> HAdd, List <PatrolPoint> PAll, List <PatrolPoint> PDelete, List <PatrolPointHistory> PHAdd, WebApiLib.Clients.BaseDataClient client)
        {
            try
            {
                List <PatrolPointItem>        ppiList  = bll.PatrolPointItems.ToList();
                List <PatrolPointItemHistory> ppiHList = bll.PatrolPointItemHistorys.ToList();
                if (ppiList == null)
                {
                    ppiList = new List <PatrolPointItem>();
                }

                if (ppiHList == null)
                {
                    ppiHList = new List <PatrolPointItemHistory>();
                }

                List <PatrolPointItem>        PIAll    = new List <PatrolPointItem>();
                List <PatrolPointItem>        PIAdd    = new List <PatrolPointItem>();
                List <PatrolPointItem>        PIEdit   = new List <PatrolPointItem>();
                List <PatrolPointItem>        PIDelete = new List <PatrolPointItem>();
                List <PatrolPointItemHistory> PIHAdd   = new List <PatrolPointItemHistory>();


                foreach (PatrolPoint item in PAll)
                {
                    int             Id       = item.Id;
                    string          deviceId = item.DeviceId;
                    int             ParentId = item.ParentId;
                    InspectionTrack it       = All.Find(p => p.Id == ParentId);
                    if (it == null)
                    {
                        continue;
                    }

                    int patrolId = (int)it.Abutment_Id;
                    CommunicationClass.SihuiThermalPowerPlant.Models.checkpoints recv = client.Getcheckresults(patrolId, deviceId);
                    if (recv == null || recv.checks.Count() <= 0)
                    {
                        continue;
                    }

                    foreach (CommunicationClass.SihuiThermalPowerPlant.Models.results item2 in recv.checks)
                    {
                        PatrolPointItem now = ppiList.Find(p => p.CheckId == item2.checkId && p.ParentId == Id);

                        if (now == null)
                        {
                            now             = new PatrolPointItem();
                            now.ParentId    = Id;
                            now.KksCode     = item2.kksCode;
                            now.CheckItem   = item2.checkItem;
                            now.StaffCode   = item2.staffCode;
                            now.CheckTime   = null;
                            now.dtCheckTime = null;
                            if (item2.checkTime != null)
                            {
                                now.CheckTime   = (item2.checkTime + nEightHourSecond) * 1000;
                                now.dtCheckTime = TimeConvert.TimeStampToDateTime((long)now.CheckTime);
                            }
                            now.CheckId     = item2.checkId;
                            now.CheckResult = item2.checkResult;
                            PIAdd.Add(now);
                        }
                        else
                        {
                            if (item2.checkTime != null)
                            {
                                now.CheckTime   = (item2.checkTime + nEightHourSecond) * 1000;
                                now.dtCheckTime = TimeConvert.TimeStampToDateTime((long)now.CheckTime);
                            }

                            now.CheckResult = item2.checkResult;
                            PIEdit.Add(now);
                        }
                    }
                }

                foreach (PatrolPoint item in PDelete)
                {
                    int Id = item.Id;
                    List <PatrolPointItem> lstDelete = ppiList.FindAll(p => p.ParentId == Id).ToList();
                    if (lstDelete != null && lstDelete.Count() > 0)
                    {
                        PIDelete.AddRange(lstDelete);
                    }
                }

                foreach (PatrolPointHistory item in PHAdd)
                {
                    int    Id                  = item.Id;
                    string deviceId            = item.DeviceId;
                    int    ParentId            = item.ParentId;
                    InspectionTrackHistory ith = HAdd.Find(p => p.Id == ParentId);
                    if (ith == null)
                    {
                        continue;
                    }

                    int patrolId = (int)ith.Abutment_Id;
                    CommunicationClass.SihuiThermalPowerPlant.Models.checkpoints recv = client.Getcheckresults(patrolId, deviceId);
                    if (recv == null || recv.checks.Count() <= 0)
                    {
                        continue;
                    }

                    foreach (CommunicationClass.SihuiThermalPowerPlant.Models.results item2 in recv.checks)
                    {
                        PatrolPointItemHistory history = bll.PatrolPointItemHistorys.Find(p => p.CheckId == item2.checkId && p.ParentId == Id);

                        if (history == null)
                        {
                            history             = new PatrolPointItemHistory();
                            history.ParentId    = Id;
                            history.KksCode     = item2.kksCode;
                            history.CheckItem   = item2.checkItem;
                            history.StaffCode   = item2.staffCode;
                            history.CheckTime   = null;
                            history.dtCheckTime = null;
                            if (item2.checkTime != null)
                            {
                                history.CheckTime   = (item2.checkTime + nEightHourSecond) * 1000;
                                history.dtCheckTime = TimeConvert.TimeStampToDateTime((long)history.CheckTime);
                            }
                            history.CheckId     = item2.checkId;
                            history.CheckResult = item2.checkResult;
                            PIHAdd.Add(history);
                        }
                    }
                }

                bll.PatrolPointItems.AddRange(PIAdd);
                bll.PatrolPointItems.EditRange(PIEdit);
                bll.PatrolPointItems.RemoveList(PIDelete);
                bll.PatrolPointItemHistorys.AddRange(PIHAdd);
            }
            catch (Exception ex)
            {
                string strMessage = ex.Message;
            }
            return;
        }
示例#13
0
        private bool DealInspectionTrack(BaseDataClient client, DateTime dtBegin, DateTime dtEnd, bool bFlag)
        {
            List <InspectionTrack>        All    = new List <InspectionTrack>();
            List <InspectionTrack>        Add    = new List <InspectionTrack>();
            List <InspectionTrack>        Edit   = new List <InspectionTrack>();
            List <InspectionTrack>        Delete = new List <InspectionTrack>();
            List <InspectionTrackHistory> HAdd   = new List <InspectionTrackHistory>();

            long lBegin = TimeConvert.DateTimeToTimeStamp(dtBegin) / 1000;
            long lEnd   = TimeConvert.DateTimeToTimeStamp(dtEnd) / 1000;
            var  recv   = client.Getinspectionlist(lBegin, lEnd, true);

            if (recv == null)
            {
                return(false);
            }

            Bll bll = new Bll(false, false, true, false);//第三参数要设置为true
            List <InspectionTrack> itList = bll.InspectionTracks.ToList();

            if (itList == null)
            {
                itList = new List <InspectionTrack>();
            }

            List <InspectionTrackHistory> itHList = bll.InspectionTrackHistorys.ToList();

            if (itHList == null)
            {
                itHList = new List <InspectionTrackHistory>(0);
            }

            foreach (patrols item in recv)
            {
                InspectionTrack        now     = itList.Find(p => p.Abutment_Id == item.id);
                InspectionTrackHistory history = itHList.Find(p => p.Abutment_Id == item.id);

                if (item.state == "新建" || item.state == "已下达" || item.state == "执行中")
                {
                    if (now == null)
                    {
                        now = new InspectionTrack();

                        now.Abutment_Id  = item.id;
                        now.Code         = item.code;
                        now.Name         = item.name;
                        now.CreateTime   = (item.createTime + nEightHourSecond) * 1000;
                        now.dtCreateTime = TimeConvert.TimeStampToDateTime(now.CreateTime);
                        now.State        = item.state;
                        now.StartTime    = (item.startTime + nEightHourSecond) * 1000;
                        now.dtStartTime  = TimeConvert.TimeStampToDateTime(now.StartTime);
                        now.EndTime      = (item.endTime + nEightHourSecond) * 1000;
                        now.dtEndTime    = TimeConvert.TimeStampToDateTime(now.EndTime);
                        Add.Add(now);
                    }
                    else
                    {
                        now.State = item.state;
                        Edit.Add(now);
                    }
                }
                else
                {
                    if (now != null)
                    {
                        Delete.Add(now);
                    }

                    if (history == null)
                    {
                        history = new InspectionTrackHistory();

                        history.Abutment_Id  = item.id;
                        history.Code         = item.code;
                        history.Name         = item.name;
                        history.CreateTime   = (item.createTime + nEightHourSecond) * 1000;
                        history.dtCreateTime = TimeConvert.TimeStampToDateTime(history.CreateTime);
                        history.State        = item.state;
                        history.StartTime    = (item.startTime + nEightHourSecond) * 1000;
                        history.dtStartTime  = TimeConvert.TimeStampToDateTime(history.StartTime);
                        history.EndTime      = (item.endTime + nEightHourSecond) * 1000;
                        history.dtEndTime    = TimeConvert.TimeStampToDateTime(history.EndTime);

                        HAdd.Add(history);
                    }
                }
            }

            bll.InspectionTracks.AddRange(Add);
            bll.InspectionTracks.EditRange(Edit);
            bll.InspectionTracks.RemoveList(Delete);
            bll.InspectionTrackHistorys.AddRange(HAdd);

            All.AddRange(Add);
            All.AddRange(Edit);
            DealPatrolPoint(bll, All, Delete, HAdd, client);

            return(true);
        }
示例#14
0
 public InspectionTrackHistory GetInspectionHistoryById(InspectionTrackHistory history)
 {
     return(service.GetInspectionHistoryById(history));
 }
        public InspectionTrackHistory GetInspectionHistoryById(InspectionTrackHistory history)
        {
            BaseDataService service = new BaseDataService();

            return(service.GetInspectionHistoryById(history));
        }