private void GetInspectionDetail(InspectionTrack oldInfo, Action <InspectionTrack> onDataRecieve = null)
 {
     if (oldInfo.Route != null)
     {
         onDataRecieve(oldInfo);
     }
     else
     {
         CommunicationObject service = CommunicationObject.Instance;
         if (service)
         {
             InspectionTrack trackNew = null;
             ThreadManager.Run(() =>
             {
                 trackNew = service.GetInspectionTrackById(oldInfo);
             }, () =>
             {
                 if (onDataRecieve != null)
                 {
                     onDataRecieve(trackNew);
                 }
             }, "");
         }
         else
         {
             if (onDataRecieve != null)
             {
                 onDataRecieve(null);
             }
         }
     }
 }
        /// <summary>
        /// 获取巡检轨迹列表
        /// </summary>
        /// <param name="lBegin"></param>
        /// <param name="lEnd"></param>
        /// <param name="bFlag"></param>
        //public void Getinspectionlist(long lBegin, long lEnd, bool bFlag)
        //{
        //    var client = GetClient();
        //    var recv = client.Getinspectionlist(lBegin, lEnd, bFlag);
        //    if (recv == null)
        //    {
        //        return;
        //    }

        //    return;
        //}

        //根据巡检Id,获取详细巡检信息
        public InspectionTrack GetInspectionTrackById(InspectionTrack trackId)
        {
            try
            {
                List <DbModel.Location.Work.InspectionTrack> lst = dbEx.InspectionTracks.ToList();
                if (lst == null)
                {
                    return(null);
                }
                DbModel.Location.Work.InspectionTrack trackDBModel = lst.Find(i => i.Id == trackId.Id);
                if (trackDBModel != null)
                {
                    InspectionTrack inspectTemp = trackDBModel.ToTModel(false);
                    return(inspectTemp);
                }
                else
                {
                    return(null);
                }
            }
            catch (System.Exception ex)
            {
                Log.Error(LogTags.BaseData, "GetInspectionTrackById", ex.ToString());
                return(null);
            }
        }
    /// <summary>
    /// 初始化数据
    /// </summary>
    /// <param name="numberStr"></param>
    /// <param name="personStr"></param>
    public void Init(InspectionTrack infoT)
    {
        InspectionTrackInfo = infoT;
        string code = string.Format("{0}({1})", InspectionTrackInfo.Code, InspectionTrackInfo.State);

        UpdateData(code, InspectionTrackInfo.Name);
        NumText.text = MobileInspectionUI_N.Instance.mobileInspectionNum.ToString();
    }
Esempio n. 4
0
 public ActionResult Edit(InspectionTrack InspectionTrack)
 {
     if (ModelState.IsValid)
     {
         bll.InspectionTracks.Edit(InspectionTrack);
     }
     //return View(InspectionTrack);
     return(RedirectToAction("Index"));
 }
Esempio n. 5
0
 public void Show(InspectionTrack infoT)
 {
     patrolPointList.Clear();
     info = infoT;
     patrolPointList.AddRange(info.Route);
     patrolPointList.Sort((a, b) => a.DeviceId.CompareTo(b.DeviceId)); //巡检点列表根据巡检编号DeviceCode排序
     UpdateData();                                                     //刷新巡检轨迹详情数据
     CreateMeasuresItems();
     SetWindowActive(true);
 }
Esempio n. 6
0
 /// <summary>
 /// 筛选根据巡检人名称
 /// </summary>
 public bool WorkTicketContainsPerson(InspectionTrack personnelMobileInspectionT)
 {
     if (personnelMobileInspectionT.Name.ToLower().Contains(searchInput.text.ToLower()))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 7
0
 public ActionResult Create(InspectionTrack InspectionTrack)
 {
     if (ModelState.IsValid)
     {
         InspectionTrack.dtCreateTime = DateTime.Now;
         bll.InspectionTracks.Add(InspectionTrack);
     }
     InspectionTrack.Route = new List <PatrolPoint>();
     //return View(InspectionTrack);
     return(RedirectToAction("Index"));
 }
Esempio n. 8
0
 /// <summary>
 /// 巡检路线筛选条件
 /// </summary>
 public bool WorkTicketContains(InspectionTrack personnelMobileInspectionT)
 {
     if (WorkTicketContainsNO(personnelMobileInspectionT))
     {
         return(true);
     }
     if (WorkTicketContainsPerson(personnelMobileInspectionT))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 9
0
    /// <summary>
    /// 获取巡检轨迹数据
    /// </summary>
    public void OnInspectionRecieved(InspectionTrackList info)
    {
        //Debug.Log("OnInspectionRecieved");
        InspectionTrack[] AddTrack    = info.AddTrack;    //添加巡检轨迹
        InspectionTrack[] ReviseTrack = info.ReviseTrack; //修改
        InspectionTrack[] DeleteTrack = info.DeleteTrack; //删除
        for (int i = 0; i < AddTrack.Length; i++)
        {
            InspectionTrack item = AddTrack[i];
            InspectionTrack it   = InspectionTrackList.Find(p => p.Id == item.Id);
            if (it == null)
            {
                InspectionTrackList.Add(item);
            }
            else
            {
                Debug.LogError("OnInspectionRecieved AddTrack it != null");
            }
        }

        for (int i = 0; i < ReviseTrack.Length; i++)
        {
            InspectionTrack item = ReviseTrack[i];
            InspectionTrack it   = InspectionTrackList.Find(p => p.Id == item.Id);
            if (it != null)
            {
                int id = InspectionTrackList.IndexOf(it);
                InspectionTrackList [id] = item;
            }
            else
            {
                Debug.LogError("OnInspectionRecieved ReviseTrack it == null");
            }
        }

        for (int i = 0; i < DeleteTrack.Length; i++)
        {
            InspectionTrack item = DeleteTrack[i];
            InspectionTrack it   = InspectionTrackList.Find(p => p.Id == item.Id);
            if (it != null)
            {
                InspectionTrackList.Remove(it);
            }
            else
            {
                Debug.LogError("OnInspectionRecieved DeleteTrack it == null");
            }
        }
        //Debug.Log(InspectionTrackList.Count);
        DisplayInspectionTrackList();
    }
Esempio n. 10
0
        public InspectionTrack GetInspectionTrackById(InspectionTrack trackId)
        {
            var trackDBModel = dbEx.InspectionTracks.Find(i => i.Id == trackId.Id);

            if (trackDBModel != null)
            {
                InspectionTrack inspectTemp = trackDBModel.ToTModel(false);
                return(inspectTemp);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 11
0
        //GET: InspectionTrack/Edit
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            InspectionTrack InspectionTrack = bll.InspectionTracks.Find(id);

            if (InspectionTrack == null)
            {
                return(HttpNotFound());
            }
            return(View(InspectionTrack));
        }
Esempio n. 12
0
        //GET: InspectionTrack/DeletePoint
        public ActionResult DeletePoint(int?id, int ParentId)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            bll.PatrolPoints.DeleteById(id);
            InspectionTrack InspectionTrack = bll.InspectionTracks.Find(ParentId);

            if (InspectionTrack == null)
            {
                return(HttpNotFound());
            }
            return(RedirectToAction("Edit", InspectionTrack));
        }
Esempio n. 13
0
        public ActionResult CreatePoint(PatrolPoint PatrolPoint)
        {
            int Id = PatrolPoint.ParentId;

            if (ModelState.IsValid)
            {
                bll.PatrolPoints.Add(PatrolPoint);
            }

            InspectionTrack InspectionTrack = bll.InspectionTracks.Find(Id);

            if (InspectionTrack == null)
            {
                return(HttpNotFound());
            }

            return(RedirectToAction("Edit", InspectionTrack));
        }
Esempio n. 14
0
        public ActionResult EditPoint(PatrolPoint PatrolPoint)
        {
            int Id = PatrolPoint.ParentId;

            if (ModelState.IsValid)
            {
                bll.PatrolPoints.Edit(PatrolPoint);
            }

            InspectionTrack InspectionTrack = bll.InspectionTracks.Find(Id);

            if (InspectionTrack == null)
            {
                return(HttpNotFound());
            }
            PatrolPoint.Checks = new List <PatrolPointItem>();
            return(RedirectToAction("Edit", InspectionTrack));
        }
    /// <summary>
    /// Item按钮触发
    /// </summary>
    public void ItemToggle_OnValueChanged(bool ison)
    {
        if (ison)
        {
            //print("ItemBtn_OnClick!");
            GetInspectionDetail(InspectionTrackInfo, infoDetail =>
            {
                //FunctionSwitchBarManage.Instance.SetTransparentToggle(true);//暂时先不透明
                changeTextColor.ClickTextColor();
                MobileInspectionInfoManage.Instance.CloseWindow();            //关闭巡检点详情窗口
                MobileInspectionHistoryDetailsUI.Instance.CloseBtn_OnClick(); //关闭巡检项窗口
                if (infoDetail == null || infoDetail.Route == null)
                {
                    if (UGUIMessageBox.Instance)
                    {
                        UGUIMessageBox.Instance.ShowMessage("该巡检路线,详情为空!");
                    }
                    return;
                }
                InspectionTrackInfo = infoDetail;
                MobileInspectionDetailsUI.Instance.Show(InspectionTrackInfo);
                MobileInspectionInfoFollow.Instance.DateUpdate(InspectionTrackInfo);
                //ToggleGroup toggleGroup = MobileInspectionUI_N.Instance.toggleGroup;
                //FunctionSwitchBarManage.Instance.SetTransparentToggle(true);
                //changeTextColor.ClickTextColor();
            });
        }
        else
        {
            changeTextColor.NormalTextColor();

            MobileInspectionInfoFollow.Instance.Hide();
            //FunctionSwitchBarManage.Instance.SetTransparentToggle(false);
            MobileInspectionDetailsUI.Instance.SetWindowActive(false);
            MobileInspectionInfoManage.Instance.CloseWindow();            //关闭巡检点详情窗口
            MobileInspectionHistoryDetailsUI.Instance.CloseBtn_OnClick(); //关闭巡检项窗口
        }
    }
Esempio n. 16
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"));
        }
 public void DateUpdate(InspectionTrack rote)
 {
     PatrolPointList.AddRange(rote.Route);
     //CreatRouteFollowUI();
 }
Esempio n. 18
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;
        }
Esempio n. 19
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);
        }
Esempio n. 20
0
 public InspectionTrack GetInspectionTrackById(InspectionTrack trackId)
 {
     //throw new NotImplementedException();
     return(service.GetInspectionTrackById(trackId));
 }
Esempio n. 21
0
        //GET: InspectionTrack/Create
        public ActionResult Create()
        {
            InspectionTrack InspectionTrack = new InspectionTrack();

            return(View(InspectionTrack));
        }