Ejemplo n.º 1
0
        //判断洗消时间是否完成
        public bool IsTimeFinish()
        {
            bool bFinish = false;

            if (!Config_func.GetInstance().StrictTime)
            {
                bFinish = true;
            }
            else
            {
                DateTime NewTime = DateTime.Now;
                TimeSpan ts      = NewTime - StartTime;
                int      dur     = (int)Math.Round(ts.TotalMinutes, 0);
                if (dur >= StepTime)
                {
                    StartTime = NewTime;
                    bFinish   = true;
                }
                else
                {
                    bFinish = false;
                }
            }
            return(bFinish);
        }
Ejemplo n.º 2
0
        public void InitProcedure()
        {
            try
            {
                using (CleanProcedureEntities db = new CleanProcedureEntities())
                {
                    //刷卡器
                    var list = db.Clean_CardDevice.Select(p => p.DevType).Distinct();
                    foreach (var item in list)
                    {
                        var      machinlist = db.Clean_CardDevice.Where(p => p.DevType == item && p.Stopped == false).OrderBy(p => p.StepNumber);
                        StepNode sn         = null;
                        StepNode snLast     = null;

                        foreach (var m in machinlist)
                        {
                            snLast = sn;
                            sn     = new StepNode(m.ClientIP, m);


                            sn.SetLast(snLast);
                            if (snLast != null)
                            {
                                snLast.SetNext(sn);
                            }
                            if (m.DevType.Equals("消毒监控"))
                            {
                                IPlist.Add(m.ClientIP, sn);
                            }
                            if (m.DevType.Equals("隔夜消毒"))
                            {
                                IPlist_yes.Add(m.ClientIP, sn);
                            }
                        }
                    }
                    //人员卡
                    var wlist = from a in db.Clean_Card where a.DevType == "人员" select a.CardNo;
                    Worker.AddRange(wlist.AsEnumerable());

                    //内镜卡
                    var nlist = from c in db.Clean_Card where c.DevType == "镜子" select c;
                    foreach (var item in nlist)
                    {
                        CardList.Add(item.CardNo, null);
                    }
                    State.id = db.Clean_RecordList.Max(p => p.Sequence) + 1;
                    //如果隔夜消毒的内镜不作废,查询昨天消毒未用的内镜卡
                    if (Config_func.GetInstance().LastNight)
                    {
                        //获取昨天使用记录
                        var        uselist = db.CleanCard_UserList.GroupBy(p => p.CleanCard);
                        List <int> seqlist = new List <int>();
                        foreach (var item in uselist)
                        {
                            string             cardname = item.Key;
                            CleanCard_UserList it       = item.OrderBy(p => p.Sequence).LastOrDefault();
                            //昨天 最后的使用记录
                            DateTime time = (DateTime)it.ZuofeiTime;
                            if (time.Date.Equals(DateTime.Today.AddDays(-1)) /*|| it.StartTime.Date.Equals(DateTime.Today)*/)
                            {
                                seqlist.Add(it.Sequence);
                            }
                        }



                        var reclist = db.Clean_RecordList.GroupBy(p => p.CleanCard);

                        foreach (var item in reclist)
                        {
                            string           cardname = item.Key;
                            Clean_RecordList it       = item.OrderBy(p => p.StartTime).LastOrDefault();
                            //昨天的消毒记录
                            if (it.StartTime.Date.Equals(DateTime.Today.AddDays(-1)) && !seqlist.Contains(it.Sequence) /*|| it.StartTime.Date.Equals(DateTime.Today)*/)
                            {
                                //if (it.StepNum < it.MaxNum)//消毒未完成记录
                                //{
                                //    State mState = new State(it.WorkCard,it.CleanIp,it.StepTime);
                                //    mState.Binding(cardname);


                                //    CardList[cardname] = mState;

                                //}
                                YesterdayCard.Add(it.CleanCard);
                            }
                        }
                    }
                }
                DBmanager.Instance.Start();
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(typeof(Exception), ex);
            }
        }