Beispiel #1
0
        public bool BindingCard(string ClientIP, string card, ref string sResult)
        {
            bool bConvert = false;

            //获取当前刷卡器的步骤信息

            StepNode curr_node = null;

            if (YesterdayCard.Contains(card))
            {
                curr_node = GetIpStep_yes(ClientIP, 1);
            }
            else
            {
                curr_node = GetIpStep(ClientIP, 1);
            }
            if (curr_node != null)
            {
                //lock (locker)
                {
                    //绑卡过程,内镜卡不在洗消步骤中
                    if (CardList[card] == null)
                    {
                        State mstate = PendingList[ClientIP];
                        mstate.StepTime = curr_node.GetDur();
                        mstate.Binding(card);
                        mstate.UpdateMsgToDB(curr_node);
                        CardList[card] = mstate;
                        bConvert       = true;
                        sResult        = "绑卡成功," + "下一步:" + curr_node.GetNext().GetStepName();;
                    }
                    else
                    {
                        sResult = "内镜卡正在洗消";
                    }
                }
            }


            if (bConvert)
            {
                //更新界面
                TaskInfo info = new TaskInfo(ClientIP, card, PendingList[ClientIP].WorkCard, curr_node.GetDur(), 1, curr_node.GetCleanGroup(), "", bConvert);
                UpdateUIDelegate(info);
            }
            return(bConvert);
        }
Beispiel #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);
            }
        }