Ejemplo n.º 1
0
        public void UpdateMsgToDB(StepNode curr_node, bool bEnd = false)
        {
            //保存数据库
            Clean_RecordList record = new Clean_RecordList();

            record.CleanCard = CardNo;
            record.CleanIp   = ClientIP;
            record.CleanPort = curr_node.GetPort();
            record.MaxNum    = curr_node.GetTotalStepNum();
            record.StartTime = StartTime;
            record.StepTime  = StepTime;
            record.StepNum   = curr_node.GetStepNum();
            record.WorkCard  = WorkCard;
            record.StepName  = curr_node.GetStepName();
            record.EndTime   = StartTime;
            record.Sequence  = id;
            if (bEnd)
            {
                record.EndTime = DateTime.Now;
            }
            DBmanager.Instance.AddQueue(record);
        }
Ejemplo n.º 2
0
        //洗消步骤切换
        public bool Step(string ClientIP, string card, ref string sRet)
        {
            sRet = "";
            bool bFinish = false;
            bool bstart  = false;
            //bool bConvert = false;
            DateTime currenttime = DateTime.Now;
            //获取内镜卡上次的刷卡信息
            State mState = CardList[card];

            if (mState == null)
            {
                sRet = "";
                return(false);
            }
            else
            {
                //获取当前刷卡器的步骤信息
                StepNode curr_node = null;
                if (YesterdayCard.Contains(card))
                {
                    curr_node = GetIpStep_yes(ClientIP, mState.StepNum);
                }
                else
                {
                    curr_node = GetIpStep(ClientIP, mState.StepNum);
                }

                //StepNode curr_node = GetIpStep(ClientIP, mState.StepNum);

                if (curr_node == null)
                {
                    sRet = "刷卡步骤不对";
                }
                else
                {
                    StepNode last_node = curr_node.GetLast();

                    if (last_node == null)
                    {
                        string temp = "结束";
                        if (curr_node.GetNext() != null)
                        {
                            temp = curr_node.GetNext().GetStepName();
                        }
                        sRet = "下一步:" + temp;
                    }
                    //不能机洗跳手工
                    else if (last_node.IsMachineWash() && !curr_node.IsMachineWash())
                    {
                        sRet = "不能机洗跳手工";
                    }
                    else
                    {
                        //int stepTime = last_node.GetDur();

                        //  lock (locker)
                        {
                            //当前步骤的上一个刷卡器地址是否相同,即洗消顺序相同
                            if (last_node.StepIp().Equals(mState.ClientIP))
                            {
                                if (curr_node.GetStepNum() == curr_node.GetTotalStepNum())
                                {
                                    mState.UpdateMsgToDB(curr_node, true);

                                    bFinish = true;

                                    sRet = "洗消步骤全部结束";
                                }
                                else if (mState.IsTimeFinish())
                                {
                                    mState.Convert(ClientIP);
                                    mState.StepTime = curr_node.GetDur();
                                    mState.UpdateMsgToDB(curr_node);
                                    bstart = true;
                                    string temp = "结束";
                                    if (curr_node.GetNext() != null)
                                    {
                                        temp = curr_node.GetNext().GetStepName();
                                    }
                                    sRet = "下一步:" + temp;
                                }
                                else
                                {
                                    sRet = "洗消时间未到";
                                }
                            }
                            //else if (curr_node.StepIp().Equals(mState.ClientIP))//结束当前步骤
                            //{


                            //    if (curr_node.GetStepNum() == curr_node.GetTotalStepNum())
                            //    {
                            //        mState.UpdateMsgToDB(curr_node, true);

                            //        bFinish = true;

                            //        sRet = "洗消步骤全部结束";
                            //    }

                            //}
                            else
                            {
                                string temp = "结束";
                                if (curr_node.GetNext() != null)
                                {
                                    temp = curr_node.GetNext().GetStepName();
                                }
                                sRet = "下一步:" + temp;
                            }
                        }
                    }
                }

                TaskInfo info = new TaskInfo(ClientIP, card, mState.WorkCard, curr_node.GetDur(), curr_node.GetStepNum(), curr_node.GetCleanGroup(), sRet, bstart);
                if (bFinish)
                {
                    TaskCallBack(info);
                }
                else
                {
                    UpdateUIDelegate(info);
                }

                return(bFinish);
            }
        }