コード例 #1
0
        internal void UpdateReplenishAdd(FCCSrv2.CashType[] Cash)
        {
            if ((Cash == null) || (Cash[0] == null))
            {
                return;
            }


            if (Cash != null)
            {
                FCCSrv2.CashType MyCash = Cash.Where(a => a.type == "4").FirstOrDefault();
                if ((MyCash != null) && (MyCash.Denomination[0] != null))
                {
                    if (MyCash.Denomination[0].devid == "1")
                    {
                        AddSummBill = GetSumm(MyCash);
                    }
                    else
                    {
                        AddSummCoin = GetSumm(MyCash);
                    }
                    AddSumm = AddSummBill + AddSummCoin;
                }
            }
        }
コード例 #2
0
        private int GetSumm(FCCSrv2.CashType MyCash)
        {
            int TmmAddSumm = 0;

            if (MyCash != null)
            {
                foreach (FCCSrv2.DenominationType Dt in MyCash.Denomination)
                {
                    if (Dt == null)
                    {
                        continue;
                    }
                    TmmAddSumm += int.Parse(Dt.fv) * int.Parse(Dt.Piece);
                }
            }
            return(TmmAddSumm);
        }
コード例 #3
0
        internal void UpdateReplenishAdd(FCCSrv2.CashType[] Cash)
        {
            if ((Cash == null) || (Cash[0] == null))
            {
                return;
            }

            this.Dispatcher.Invoke((Action)(() =>
            {
                if (Cash != null)
                {
                    int BillSumm = 0;
                    int CoinSumm = 0;

                    int BillBarabansSumm = 0;
                    int CoinBarabansSumm = 0;
                    //Барабаны
                    FCCSrv2.CashType MyCash = Cash.Where(a => a.type == "4").FirstOrDefault();
                    if (MyCash != null)
                    {
                        int CassetaAdd = 0;
                        int MonetaAdd = 0;

                        //MyCash
                        foreach (FCCSrv2.DenominationType Dt in MyCash.Denomination)
                        {
                            if (Dt == null)
                            {
                                continue;
                            }
                            if (Dt.devid == "1")
                            {
                                //if (Dt.)
                                Barabans.SetBillAdd(int.Parse(Dt.fv), int.Parse(Dt.Piece), int.Parse(Dt.Status));
                                BillBarabansSumm += int.Parse(Dt.fv) * int.Parse(Dt.Piece);
                            }
                            else if (Dt.devid == "2")
                            {
                                Barabans.SetCoinAdd(int.Parse(Dt.fv), int.Parse(Dt.Piece), int.Parse(Dt.Status));
                                CoinBarabansSumm += int.Parse(Dt.fv) * int.Parse(Dt.Piece);
                            }
                        }


                        if (BillBarabansSumm == 0)
                        {
                            BillBarabansSumm = AddBillCurentSumm;
                        }
                        else
                        {
                            Barabans.SetBillAdd(0, BillBarabansSumm, 0);
                            AddBillCurentSumm = BillBarabansSumm;
                        }

                        if (CoinBarabansSumm == 0)
                        {
                            CoinBarabansSumm = AddCointCurentSumm;
                        }
                        else
                        {
                            AddCointCurentSumm = CoinBarabansSumm;
                        }
                    }
                    ReplTotal.SetMoney(BillBarabansSumm + CoinBarabansSumm);
                }
            }));
        }
コード例 #4
0
        private void CheckRecvComand(string returndata, long nEventRecvCount)
        {
            try
            {
                System.Xml.XmlDocument dom = new System.Xml.XmlDocument();
                dom.LoadXml(returndata);

                System.Xml.XmlNodeList nodelist1 = dom.SelectNodes("/BbxEventRequest/*");
                foreach (System.Xml.XmlNode node in nodelist1)
                {
                    String strName = node.Name;

                    //judge the kind of event



                    if (strName == "StatusChangeEvent")
                    {
                        //Get node object of each element
                        System.Xml.XmlNode nodeStatus = node.SelectSingleNode("./Status");
                        System.Xml.XmlNode nodeAmount = node.SelectSingleNode("./Amount");
                        System.Xml.XmlNode nodeError  = node.SelectSingleNode("./Error");
                        System.Xml.XmlNode nodeUser   = node.SelectSingleNode("./User");
                        System.Xml.XmlNode nodeSeqNo  = node.SelectSingleNode("./SeqNo");

                        Utils.ToLog(String.Format("Event Name: {0},  nodeStatus: {1}", strName, nodeStatus.InnerText));

                        String convUser = "";

                        convUser = nodeUser.InnerText;


                        if (Int32.Parse(nodeStatus.InnerText) == 21)
                        {
                            LastFixedDispense = int.Parse(nodeAmount.InnerText);
                        }


                        if (OnSetStatus != null)
                        {
                            int Summ = int.Parse(nodeAmount.InnerText);
                            if (Int32.Parse(nodeStatus.InnerText) == 7) //Это для сдачи
                            {
                                Summ = LastFixedDispense;
                            }
                            OnSetStatus(this, true, Int32.Parse(nodeStatus.InnerText), Summ, "");
                        }


                        //Check if the fcc is under change operation
                        if ((Int32.Parse(nodeStatus.InnerText) == CFCCApi.STATUS_CODE_DEPOSIT_WAIT) ||
                            (Int32.Parse(nodeStatus.InnerText) == CFCCApi.STATUS_CODE_DEPOSIT_COUNTING) ||
                            (Int32.Parse(nodeStatus.InnerText) == CFCCApi.STATUS_CODE_CALCREPLENISH))
                        {
                            //  pFrm.SetStatus(Int32.Parse(nodeStatus.InnerText),nodeStatus.InnerText);
                            //if doing change operation, then the amount should store deposit amount.
                            int dblCashin = int.Parse(nodeAmount.InnerText);

                            if (OnSetDeposit != null)
                            {
                                OnSetDeposit(this, dblCashin);
                            }
                        }
                        else if (Int32.Parse(nodeStatus.InnerText) == CFCCApi.STATUS_CODE_DISPENSE)
                        {
                            //If doing dispensing, then the amount should be dispense amount.
                            //The dispense amount is not result value, it just a parameter of dispense command.
                            //Actual dispensed amount will be reported after dispense command has been done.
                        }


                        // In the case of a StartReplenishmentFromCassette
                        // If status becomes an idol after lock normalcy, start a ReplenishmentFromCassette
                        //if (MainClass.repFC_state)
                        {
                            if (Int32.Parse(nodeStatus.InnerText) == CFCCApi.STATUS_CODE_IDLE)
                            {
                                if (OnStartReplenishmentFromCassette != null)
                                {
                                    OnStartReplenishmentFromCassette(this);
                                }
                            }
                        }

                        // pFrm.SetGuidance(pFrm.GetStatusString(Int32.Parse(nodeStatus.InnerText)));
                    }
                    else if (strName.Equals("GlyCashierEvent"))
                    {
                        string strOutput = "";

                        //Device Event
                        String sDevID = node.Attributes["devid"].InnerText;
                        String sUser  = node.Attributes["user"].InnerText;

                        System.Xml.XmlNode nEventTypeNode = node.FirstChild;
                        String             strEventName   = nEventTypeNode.Name;
                        Utils.ToLog(String.Format("Event Name: {0},  strEventName: {1}, sDevID: {2}", strName, nEventTypeNode.Name, sDevID));

                        int Summ = 0;
                        FCCSrv2.CashType[] CTT = new FCCSrv2.CashType[1];

                        if ((strEventName.Equals("eventReplenishCountChange")) || (strEventName.Equals("eventCassetteInventoryOnRemoval")))
                        {
                            FCCSrv2.CashType CT = new FCCSrv2.CashType();



                            System.Xml.XmlNode CashNode = nEventTypeNode;
                            if (strEventName.Equals("eventCassetteInventoryOnRemoval"))
                            {
                                CashNode = GetNideByName(nEventTypeNode, "Cash");
                            }
                            CT.Denomination = new FCCSrv2.DenominationType[CashNode.ChildNodes.Count];
                            CT.type         = "4";
                            int i = 0;



                            foreach (System.Xml.XmlNode n in CashNode.ChildNodes)
                            {
                                if (n.Name == "Denomination")
                                {
                                    FCCSrv2.DenominationType Den = new FCCSrv2.DenominationType();
                                    try
                                    {
                                        Den.cc    = n.Attributes["cc"].Value;
                                        Den.fv    = n.Attributes["fv"].Value;
                                        Den.devid = n.Attributes["devid"].Value;
                                        foreach (System.Xml.XmlNode nn in n.ChildNodes)
                                        {
                                            try
                                            {
                                                if (nn.Name.Equals("Piece"))
                                                {
                                                    Den.Piece = nn.InnerText;
                                                }
                                                else if (nn.Name.Equals("Status"))
                                                {
                                                    Den.Status = nn.InnerText;
                                                }
                                            }
                                            catch
                                            { }
                                        }
                                        CT.Denomination[i] = Den;
                                        CTT[0]             = CT;
                                        i++;

                                        Summ += int.Parse(Den.Piece) * int.Parse(Den.fv);
                                    }
                                    catch
                                    { }
                                }
                            }
                        }
                        if (OnSetStatus != null)
                        {
                            /*
                             * if (strEventName.Equals("eventWaitForRemoving"))
                             * {
                             * }
                             */
                            OnSetStatus(this, false, Summ, int.Parse(sDevID), strEventName);
                        }


                        if (strEventName.Equals("eventWaitForRemoving"))
                        {
                            //Wait removeing notes from RBW
                            System.Xml.XmlNode nDevicePositionID = nEventTypeNode.FirstChild;
                            string             strIDName         = GetDevicePositionIDString(nDevicePositionID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "WaitForRemoving " + strIDName);
                        }
                        else if (strEventName.Equals("eventRemoved"))
                        {
                            //Note was removed from RBW
                            System.Xml.XmlNode nDevicePositionID = nEventTypeNode.FirstChild;
                            string             strIDName         = GetDevicePositionIDString(nDevicePositionID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "Removed " + strIDName);
                        }
                        else if (strEventName.Equals("eventStatusChange"))
                        {
                            //Status Change
                            System.Xml.XmlNode nDeviceStatusID = nEventTypeNode.FirstChild;
                            string             strIDName       = GetDeviceStatusIDString(nDeviceStatusID.InnerText);

                            Utils.ToLog(String.Format("--------------eventStatusChange: StatusId{0},  str: {1}", nDeviceStatusID.InnerText, strIDName));

                            pFrm.SetStatus(Int32.Parse(sDevID), "StatusChange " + strIDName);
                        }
                        else if (strEventName.Equals("eventEmpty"))
                        {
                            //Empty
                            System.Xml.XmlNode nDevicePositionID = nEventTypeNode.FirstChild;
                            string             strIDName         = GetDevicePositionIDString(nDevicePositionID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "Empty " + strIDName);
                        }
                        else if (strEventName.Equals("eventLow"))
                        {
                            //Near Empty
                            System.Xml.XmlNode nDevicePositionID = nEventTypeNode.FirstChild;
                            string             strIDName         = GetDevicePositionIDString(nDevicePositionID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "Near Empty " + strIDName);
                        }
                        else if (strEventName.Equals("eventExist"))
                        {
                            //Exist
                            System.Xml.XmlNode nDevicePositionID = nEventTypeNode.FirstChild;
                            string             strIDName         = GetDevicePositionIDString(nDevicePositionID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "Exist " + strIDName);
                        }
                        else if (strEventName.Equals("eventHigh"))
                        {
                            //Near Full
                            System.Xml.XmlNode nDevicePositionID = nEventTypeNode.FirstChild;
                            string             strIDName         = GetDevicePositionIDString(nDevicePositionID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "High " + strIDName);
                        }
                        else if (strEventName.Equals("eventFull"))
                        {
                            //Full
                            System.Xml.XmlNode nDevicePositionID = nEventTypeNode.FirstChild;
                            string             strIDName         = GetDevicePositionIDString(nDevicePositionID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "Full " + strIDName);
                        }
                        else if (strEventName.Equals("eventMissing"))
                        {
                            //Missing unit.
                            System.Xml.XmlNode nDevicePositionID = nEventTypeNode.FirstChild;
                            string             strIDName         = GetDevicePositionIDString(nDevicePositionID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "Missing " + strIDName);
                        }
                        else if (strEventName.Equals("eventDepositCountChange"))
                        {
                            //Depositing
                        }
                        else if (strEventName.Equals("eventReplenishCountChange"))
                        {
                            /*
                             * FCCSrv2.CashType[] CTT = new FCCSrv2.CashType[1];
                             *
                             * FCCSrv2.CashType CT = new FCCSrv2.CashType();
                             *
                             * CT.Denomination = new FCCSrv2.DenominationType[nEventTypeNode.ChildNodes.Count];
                             * CT.type="4";
                             * int i= 0;
                             * int Summ = 0;
                             * foreach (System.Xml.XmlNode n in nEventTypeNode.ChildNodes)
                             * {
                             *  FCCSrv2.DenominationType Den = new FCCSrv2.DenominationType();
                             *  Den.cc = n.Attributes["cc"].Value;
                             *  Den.fv = n.Attributes["fv"].Value;
                             *  Den.devid = n.Attributes["devid"].Value;
                             *  foreach (System.Xml.XmlNode nn in n.ChildNodes)
                             *  {
                             *      if (nn.Name.Equals("Piece"))
                             *      {
                             *          Den.Piece = nn.InnerText;
                             *      } else if (nn.Name.Equals("Status"))
                             *      {
                             *          Den.Status = nn.InnerText;
                             *      }
                             *  }
                             *  CT.Denomination[i] = Den;
                             *  CTT[0] = CT;
                             *  i++;
                             *
                             *  Summ += int.Parse(Den.Piece) * int.Parse(Den.fv);
                             *
                             *
                             *
                             * }
                             */
                            Utils.ToMoneyCountLog(MoneyChangeCommands.Replenish, Summ);


                            if (OnReplenishCountChange != null)
                            {
                                OnReplenishCountChange(this, CTT);
                            }

                            //Replenishing
                        }
                        else if (strEventName.Equals("eventError"))
                        {
                            //Error occurred
                            System.Xml.XmlNode nErrorCode = nEventTypeNode.FirstChild;
                            pFrm.SetStatus(Int32.Parse(sDevID), "Error " + nErrorCode.InnerText);
                            System.Xml.XmlNode nURL    = nErrorCode.NextSibling;
                            String             errCode = Int32.Parse(nErrorCode.InnerText).ToString("X");
                            int i;
                            for (i = 1; i <= 4 - errCode.Length; i++)
                            {
                                errCode = "0" + errCode;
                            }

                            if (!String.IsNullOrEmpty(nURL.InnerText))
                            {
                                if (OnSendError != null)
                                {
                                    OnSendError(this, errCode, nURL.InnerText);
                                }
                                pFrm.ShowRecoveryScreen(errCode, nURL.InnerText);
                            }
                        }
                        else if (strEventName.Equals("eventCassetteInserted"))
                        {
                            //Inserted cassette
                            System.Xml.XmlNode nCassetteID = nEventTypeNode.FirstChild;
                            pFrm.SetStatus(Int32.Parse(sDevID), "CassetteInserted " + nCassetteID.InnerText);
                        }
                        else if (strEventName.Equals("eventPowerOffOnRequest"))
                        {
                            //Power off/on request
                        }
                        else if (strEventName.Equals("eventDownloadProgress"))
                        {
                            //Download progress
                        }
                        else if (strEventName.Equals("eventLogreadProgress"))
                        {
                            //Log Read progress
                        }
                        else if (strEventName == "eventRequireVerifyDenomination")
                        {
                            //RequireVerify
                            int i = 0;
                            System.Xml.XmlNode nCash = nEventTypeNode.FirstChild;
                            //Initialize
                            pFrm.SetWarningLabel(3, sDevID, "");
                            for (i = 0; i <= nCash.ChildNodes.Count - 1; i++)
                            {
                                System.Xml.XmlElement denomi = null;
                                string fv = null;

                                denomi = (System.Xml.XmlElement)nCash.ChildNodes.Item(i);
                                fv     = denomi.GetAttribute("fv");
                                pFrm.SetWarningLabel(1, sDevID, fv);
                            }
                        }
                        else if (strEventName == "eventRequireVerifyCollectionContainer")
                        {
                            //RequireVerify IF Cassette
                            pFrm.SetWarningLabel(2, sDevID, "");
                        }
                        else if (strEventName == "eventRequireVerifyMixStacker")
                        {
                            //RequireVerify MIX Stacker
                            pFrm.SetWarningLabel(5, sDevID, "");
                        }
                        else if (strEventName == "eventExactDenomination")
                        {
                            //Exact
                            pFrm.SetWarningLabel(3, sDevID, "");
                        }
                        else if (strEventName == "eventExactCollectionContainer")
                        {
                            //Exact IF Cassette
                            pFrm.SetWarningLabel(4, sDevID, "");
                        }
                        else if (strEventName == "eventExactMixStacker")
                        {
                            //Exact MIX Stacker
                            pFrm.SetWarningLabel(6, sDevID, "");
                        }
                        else if (strEventName.Equals("eventWaitForOpening"))
                        {
                            //Wait For Opening
                            System.Xml.XmlNode nDoorID   = nEventTypeNode.FirstChild;
                            string             strIDName = GetDoorIDString(nDoorID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "WaitForOpening " + strIDName);
                        }
                        else if (strEventName.Equals("eventOpened"))
                        {
                            //Opened
                            System.Xml.XmlNode nDoorID   = nEventTypeNode.FirstChild;
                            string             strIDName = GetDoorIDString(nDoorID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "Opened " + strIDName);
                        }
                        else if (strEventName.Equals("eventClosed"))
                        {
                            //Closed
                            System.Xml.XmlNode nDoorID   = nEventTypeNode.FirstChild;
                            string             strIDName = GetDoorIDString(nDoorID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "Closed " + strIDName);
                        }
                        else if (strEventName.Equals("eventLocked"))
                        {
                            //Locked
                            System.Xml.XmlNode nDoorID   = nEventTypeNode.FirstChild;
                            string             strIDName = GetDoorIDString(nDoorID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "Locked " + strIDName);
                        }
                        else if (strEventName.Equals("eventWaitForInsertion"))
                        {
                            //Wait For Insertion
                            System.Xml.XmlNode nDevicePositionID = nEventTypeNode.FirstChild;
                            string             strIDName         = GetDevicePositionIDString(nDevicePositionID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "WaitForInsertion " + strIDName);
                        }
                        else
                        {
                            //Unknown
                            strOutput  = "";
                            strOutput += strEventName + "\n";
                        }
                    }
                    else if (strName == "InventoryResponse")
                    {
                        // SetInventory
                        pFrm.SetEventInventory(node);
                    }
                    else
                    {
                        String strOutput = "";

                        strOutput  = "";
                        strOutput += ("(" + nEventRecvCount.ToString() + ")" + "\n");
                        strOutput += ("SOAP Completed." + "\n");

                        strOutput += (" res name  : " + strName + "\n");
                        strOutput += ("------------------------------" + "\n");
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message.ToString());
                appTrace.TraceEvent(System.Diagnostics.TraceEventType.Critical, 0, ex.Message.ToString());
            }
        }