/// <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> /// <param name="sender"></param> /// <param name="e"></param> private void ItemWayChecked(object sender, MouseButtonEventArgs e) { var itemWay = (sender as CashControl); if (itemWay == m_CurrentItem) { return; } if (itemWay != null) { if (m_CurrentItem != null) { m_CurrentItem.ToNormal(); } itemWay.ToCheck(); m_CurrentItem = itemWay; ControlButton(true); } else { 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++; } } }
internal static void setPanelSelectedCash(CashControl pvCashControl) { cvPanelSelected.Controls.Clear(); cvPanelSelected.Controls.Add(pvCashControl); }
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); })); }