private void OperMainTrd()
        {
            this.tbTitle.Dispatcher.Invoke(new Action(() =>
            {
                btnCancel.IsEnabled = false;
                ControlButton(false);
            }));

            int    intErrCode   = 0;
            string strNewStatus = string.Empty;

            switch (m_OperType)
            {
            case "0":    // 开启纸币接收
                strNewStatus = "1";
                intErrCode   = PubHelper.p_BusinOper.ControlBillType(m_CurrentItem.CurrentItem.CashValue, "1", m_CurrentItem.CurrentItem.Channel.ToString());
                break;

            case "1":    // 关闭纸币接收
                strNewStatus = "0";
                intErrCode   = PubHelper.p_BusinOper.ControlBillType(m_CurrentItem.CurrentItem.CashValue, "0", m_CurrentItem.CurrentItem.Channel.ToString());
                break;

            case "2":    // 刷新纸币接收
                intErrCode = PubHelper.p_BusinOper.QueryBillType(m_CurrentItem.CurrentItem.CashValue, m_CurrentItem.CurrentItem.Channel.ToString(), out strNewStatus);
                break;
            }

            this.tbTitle.Dispatcher.Invoke(new Action(() =>
            {
                if (intErrCode == 0)
                {
                    PubHelper.ShowMsgInfo(PubHelper.p_LangOper.GetStringBundle("Pub_OperSuc"), PubHelper.MsgType.Ok);
                    // 刷新显示区域
                    m_CurrentItem.CurrentItem.Status = strNewStatus;
                    string strStatusText             = string.Empty;
                    switch (strNewStatus)
                    {
                    case "0":    // 关闭接收
                        strStatusText = m_Text_Stop;
                        break;

                    case "1":    // 开启接收
                        strStatusText = m_Text_Run;
                        break;
                    }
                    m_CurrentItem.SetSecondText(strStatusText);
                }
                else
                {
                    PubHelper.ShowMsgInfo(PubHelper.p_LangOper.GetStringBundle("Pub_OperFail"), PubHelper.MsgType.Ok);
                }
                btnCancel.IsEnabled = true;
                ControlButton(true);
            }));
        }
        /// <summary>
        /// 创建内容控件
        /// </summary>
        private void CreateProduct()
        {
            panelItem.Children.Clear();

            int index = 0;

            string strStatusText = string.Empty;

            for (int i = 0; i < m_MaxRowNum; i++)
            {
                for (int j = 0; j < m_EachRowNum; j++)
                {
                    if (index < m_CurrentItemList.Count)
                    {
                        CashControl productControl = new CashControl()
                        {
                            HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                            VerticalAlignment   = System.Windows.VerticalAlignment.Stretch,
                            Margin = new Thickness(5)
                        };

                        Grid.SetRow(productControl, i);
                        Grid.SetColumn(productControl, j);
                        panelItem.Children.Add(productControl);

                        productControl.MouseLeftButtonUp += (ItemWayChecked);

                        productControl.SetCurrentItem(m_CurrentItemList[index]);

                        productControl.SetOneText(PubHelper.p_BusinOper.MoneyIntToString(m_CurrentItemList[index].CashValue.ToString()));
                        switch (m_CurrentItemList[index].Status)
                        {
                        case "0":    // 关闭接收
                            strStatusText = m_Text_Stop;
                            break;

                        case "1":    // 开启接收
                            strStatusText = m_Text_Run;
                            break;
                        }
                        productControl.SetSecondText(strStatusText);
                    }
                    index++;
                }
            }

            ControlButton(false);
        }
        /// <summary>
        /// 创建内容控件
        /// </summary>
        private void CreateProduct()
        {
            panelItem.Children.Clear();

            int index = 0;

            string strStatusText = string.Empty;

            for (int i = 0; i < m_MaxRowNum; i++)
            {
                for (int j = 0; j < m_EachRowNum; j++)
                {
                    if (index < m_CurrentItemList.Count)
                    {
                        CashControl productControl = new CashControl()
                        {
                            HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                            VerticalAlignment   = System.Windows.VerticalAlignment.Stretch,
                            Margin = new Thickness(5)
                        };

                        Grid.SetRow(productControl, i);
                        Grid.SetColumn(productControl, j);
                        panelItem.Children.Add(productControl);

                        productControl.SetCurrentItem(m_CurrentItemList[index]);
                        productControl.Tag = m_CurrentItemList[index].CashValue.ToString();
                        productControl.SetOneText(PubHelper.p_BusinOper.MoneyIntToString(m_CurrentItemList[index].CashValue.ToString()));
                        strStatusText = m_CurrentItemList[index].StockNum.ToString() + "【" + m_CurrentItemList[index].BoxStockNum.ToString() + "】";

                        productControl.SetSecondText(strStatusText);
                    }
                    index++;
                }
            }
        }
Example #4
0
        private void OperMainTrd()
        {
            this.tbTitle.Dispatcher.Invoke(new Action(() =>
            {
                tbProgress.Visibility = System.Windows.Visibility.Visible;
                btnCancel.IsEnabled   = false;
                ControlButton(false);
            }));

            int    intErrCode   = 0;
            string strNewStatus = string.Empty;
            bool   result       = false;
            string strStock     = string.Empty;
            int    intStockNum  = 0;

            switch (m_OperType)
            {
            case "0":    // 开启接收
            case "1":    // 关闭纸币接收
                if (m_OperType == "0")
                {
                    strNewStatus = "1";
                }
                else
                {
                    strNewStatus = "0";
                }
                strStock = m_CurrentItem.CurrentItem.StockNum.ToString();
                result   = PubHelper.p_BusinOper.CashInfoOper.UpdateCashStatus_All(m_CurrentItem.CurrentItem.CashValue, "0", strNewStatus);
                if (!result)
                {
                    intErrCode = 9;
                }
                break;

            case "2":    // 刷新库存
                strNewStatus = m_CurrentItem.CurrentItem.Status;

                intErrCode = PubHelper.p_BusinOper.QueryDenomChangeNum(m_CurrentItem.CurrentItem.CashType, m_CurrentItem.CurrentItem.CashValue, "00", false, out intStockNum);
                if (intErrCode == 0)
                {
                    strStock = intStockNum.ToString();
                }
                break;

            case "3":    // 清点货币
                strNewStatus = m_CurrentItem.CurrentItem.Status;
                intErrCode   = PubHelper.p_BusinOper.QingDianCashStock(m_CurrentItem.CurrentItem.CashType, m_CurrentItem.CurrentItem.CashValue, out intStockNum);
                if (intErrCode == 0)
                {
                    strStock = intStockNum.ToString();
                }
                break;
            }

            this.tbTitle.Dispatcher.Invoke(new Action(() =>
            {
                tbProgress.Visibility = System.Windows.Visibility.Hidden;
                if (intErrCode == 0)
                {
                    PubHelper.ShowMsgInfo(PubHelper.p_LangOper.GetStringBundle("Pub_OperSuc"), PubHelper.MsgType.Ok);
                    // 刷新显示区域
                    m_CurrentItem.CurrentItem.Status   = strNewStatus;
                    m_CurrentItem.CurrentItem.StockNum = Convert.ToInt32(strStock);
                    string strStatusText = ConvertSecText(strNewStatus, strStock);
                    m_CurrentItem.SetSecondText(strStatusText);
                }
                else
                {
                    PubHelper.ShowMsgInfo(PubHelper.p_LangOper.GetStringBundle("Pub_OperFail_Code").Replace("{N}", intErrCode.ToString()), PubHelper.MsgType.Ok);
                }
                btnCancel.IsEnabled = true;
                ControlButton(true);
            }));
        }
        private void OperMainTrd()
        {
            this.tbTitle.Dispatcher.Invoke(new Action(() =>
            {
                tbProgress.Visibility = System.Windows.Visibility.Visible;
                btnCancel.IsEnabled   = false;
                ControlButton(false);
            }));

            int    intErrCode    = 0;
            string _value        = string.Empty;
            string strValue      = string.Empty;
            int    money         = 0;
            string strStatusText = string.Empty;

            // 使能硬币器
            intErrCode = PubHelper.p_BusinOper.ControlCoin("1", true);
            // 禁能纸币器
            intErrCode = PubHelper.p_BusinOper.ControlCash("0", true);

            while (!m_StopRefill)
            {
                Thread.Sleep(200);

                #region 查询当前投入金额,如果有可以找零面值的纸币投入到找零箱,则记录

                intErrCode = PubHelper.p_BusinOper.QueryMoney_AddBill(out strValue);
                if (intErrCode == 0)
                {
                    #region 如果查询成功,解析数据
                    // 纸币器状态|硬币器状态|可接收货币标识|货币类型|金额
                    string[] hexValue = strValue.Split('|');
                    if (hexValue.Length > 4)
                    {
                        // 检测是否存在找零纸币投入
                        if (hexValue[1] == "03")
                        {
                            #region 硬件退币按钮被触发

                            #endregion
                        }
                        else
                        {
                            #region 存在金额投入

                            if (hexValue[3] != "FF")
                            {
                                money = Convert.ToInt32(hexValue[4]);
                                if (money > 0)
                                {
                                    // 投币类型
                                    // 00:硬币(进硬币币筒或进Hopper找零箱)
                                    // 01:纸币(进纸币钞箱)
                                    // 02:纸币(进纸币找零箱)
                                    // 03:硬币(进溢币盒,只针对普通硬币器)
                                    string strMoneyTypeCode = hexValue[3];

                                    if ((strMoneyTypeCode == "00") || (strMoneyTypeCode == "03"))
                                    {
                                        if (strMoneyTypeCode == "00")
                                        {
                                            strMoneyTypeCode = "1";
                                        }
                                        else
                                        {
                                            strMoneyTypeCode = "2";
                                        }

                                        PubHelper.p_BusinOper.CashInfoOper.UpdateCashStockNum(money, 1, "0", strMoneyTypeCode, "0");

                                        this.tbTitle.Dispatcher.Invoke(new Action(() =>
                                        {
                                            // 实时刷新界面上相应硬币库存量
                                            int intCount = panelItem.Children.Count;
                                            for (int index = 0; index < intCount; index++)
                                            {
                                                CashControl productControl = (CashControl)panelItem.Children[index];
                                                if ((productControl != null) && (productControl.Tag.ToString() == money.ToString()))
                                                {
                                                    strStatusText = PubHelper.p_BusinOper.CashInfoOper.GetCashStockNum(money, "0", "0").ToString() +
                                                                    "【" + PubHelper.p_BusinOper.CashInfoOper.GetCashStockNum(money, "0", "1").ToString() + "】";

                                                    productControl.SetSecondText(strStatusText);
                                                }
                                            }
                                        }));
                                    }
                                }
                            }

                            #endregion
                        }
                    }

                    #endregion
                }
                #endregion
            }

            // 清除当前控制主板显示金额
            intErrCode = PubHelper.p_BusinOper.ClearUsableMoney(true);

            // 禁能硬币器
            intErrCode = PubHelper.p_BusinOper.ControlCoin("0", true);

            this.tbTitle.Dispatcher.Invoke(new Action(() =>
            {
                tbProgress.Visibility = System.Windows.Visibility.Hidden;
                btnCancel.IsEnabled   = true;
                ControlButton(true);
            }));
        }