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

            int index = 0;

            string strStatusText  = string.Empty;
            string strTmpModel    = string.Empty;
            string strTmpNowValue = string.Empty; // 当前温度
            string strTmpTarValue = string.Empty; // 目标温度

            string strTmpNowTitle = PubHelper.p_LangOper.GetStringBundle("Pub_Device_Tmp");
            string strTmpTarTitle = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_RefCfg_TargetTmp");

            for (int i = 0; i < m_MaxRowNum; i++)
            {
                for (int j = 0; j < m_EachRowNum; j++)
                {
                    if (index < m_CurrentItemList.Count)
                    {
                        VendBoxControl productControl = new VendBoxControl()
                        {
                            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]);

                        strTmpModel    = DictionaryHelper.Dictionary_TmpType(index);
                        strTmpNowValue = DictionaryHelper.Dictionary_NowTmp(index, true);
                        productControl.SetOneText(DictionaryHelper.Dictionary_VendBoxName(m_CurrentItemList[index].VendBoxCode) +
                                                  "【" + strTmpModel + "】" +
                                                  "\r\n" +
                                                  strTmpNowTitle + "【" + strTmpNowValue + "】" + "\r\n" +
                                                  strTmpTarTitle + "【" + m_CurrentItemList[index].TargetTmp + PubHelper.TMP_UNIT + "】");

                        ////productControl.SetSecondText(strStatusText);
                    }
                    index++;
                }
            }
        }
예제 #2
0
        private void LoadVendBoxTmpData()
        {
            // 获取当前货柜的索引
            m_VendBoxIndex = PubHelper.p_BusinOper.AsileOper.GetVendBoxIndex(m_VendBoxCode);

            #region 加载货柜温控相关数据

            tbTmpControlModel_Value.Text = DictionaryHelper.Dictionary_TmpType(m_VendBoxIndex);

            m_TargetTmp = PubHelper.p_BusinOper.AsileOper.VendBoxList[m_VendBoxIndex].TargetTmp;
            if (string.IsNullOrEmpty(m_TargetTmp))
            {
                m_TargetTmp = "3";
            }
            tbTargetTmp_Value.Text = m_TargetTmp + PubHelper.TMP_UNIT;

            m_WarnTmp = PubHelper.p_BusinOper.AsileOper.VendBoxList[m_VendBoxIndex].OutTmpWarnValue;
            if (string.IsNullOrEmpty(m_WarnTmp))
            {
                m_WarnTmp = "30";
            }
            tbWarnTmp_Value.Text = m_WarnTmp + PubHelper.TMP_UNIT;

            if (PubHelper.p_BusinOper.SysCfgOper.GetSysCfgValue("OutTmpWarnModel") == "1")
            {
                rdbOutTmp_Run.IsChecked = true;
            }
            else
            {
                rdbOutTmp_Run.IsChecked = false;
            }

            string strTmpRunModel = PubHelper.p_BusinOper.AsileOper.VendBoxList[m_VendBoxIndex].RefControl.ControlModel;
            bool   enable         = false;
            switch (strTmpRunModel)
            {
            case "0":    // 定时开启
                enable = true;
                rdbTmpModel_Time.IsChecked = true;
                string strBeginTime1 = PubHelper.p_BusinOper.AsileOper.VendBoxList[m_VendBoxIndex].RefControl.BeginTime1;
                string strEndTime1   = PubHelper.p_BusinOper.AsileOper.VendBoxList[m_VendBoxIndex].RefControl.EndTime1;
                string strBeginTime2 = PubHelper.p_BusinOper.AsileOper.VendBoxList[m_VendBoxIndex].RefControl.BeginTime2;
                string strEndTime2   = PubHelper.p_BusinOper.AsileOper.VendBoxList[m_VendBoxIndex].RefControl.EndTime2;

                if (strBeginTime1.Length == 4)
                {
                    cmbTime1_Begin_Hour.Text = strBeginTime1.Substring(0, 2);
                    cmbTime1_Begin_Min.Text  = strBeginTime1.Substring(2);
                }
                if (strEndTime1.Length == 4)
                {
                    cmbTime1_End_Hour.Text = strEndTime1.Substring(0, 2);
                    cmbTime1_End_Min.Text  = strEndTime1.Substring(2);
                }
                if (strBeginTime2.Length == 4)
                {
                    cmbTime2_Begin_Hour.Text = strBeginTime2.Substring(0, 2);
                    cmbTime2_Begin_Min.Text  = strBeginTime2.Substring(2);
                }
                if (strEndTime2.Length == 4)
                {
                    cmbTime2_End_Hour.Text = strEndTime2.Substring(0, 2);
                    cmbTime2_End_Min.Text  = strEndTime2.Substring(2);
                }
                break;

            case "1":    // 全时段开启
                rdbTmpModel_Run.IsChecked = true;
                break;

            case "2":    // 全时段关闭
                rdbTmpModel_Stop.IsChecked = true;
                break;
            }
            ControlCmb(enable);

            bool blnIsEnableCon = true;
            if (PubHelper.p_BusinOper.AsileOper.VendBoxList[m_VendBoxIndex].TmpControlModel == BusinessEnum.TmpControlModel.Normal)
            {
                blnIsEnableCon = false;
            }
            COntrolForm(blnIsEnableCon);
            m_IsInit = false;

            #endregion
        }
        private void LoadData()
        {
            try
            {
                AfreshMonOutTime();

                string strRunTitle  = PubHelper.p_LangOper.GetStringBundle("Pub_Run");
                string strStopTitle = PubHelper.p_LangOper.GetStringBundle("Pub_Stop");

                #region 正常及故障的颜色定义

                SolidColorBrush brush_Ok = new SolidColorBrush();
                brush_Ok.Color = Colors.White;
                SolidColorBrush brush_Err = new SolidColorBrush();
                brush_Err.Color = Colors.Red;

                #endregion

                #region 门及温度数据


                // 谷霖 2016-11-09 此处需要修改完善
                string strDoorStatus = PubHelper.p_BusinOper.GetDoorStatus();// PubHelper.p_BusinOper.AsileOper.VendBoxList[0].DoorStatus;
                tbDoor_Value.Text = DictionaryHelper.Dictionary_Door(0, strDoorStatus, true);
                if ((strDoorStatus != "00") && (strDoorStatus != "01"))
                {
                    tbDoor_Value.Foreground = brush_Err;// Brushes.Red;
                }
                else
                {
                    tbDoor_Value.Foreground = brush_Ok;
                }

                tbTmpType_Value.Text = DictionaryHelper.Dictionary_TmpType(0);
                tbNowTmp_Value.Text  = DictionaryHelper.Dictionary_NowTmp(0, true);
                if (PubHelper.p_BusinOper.AsileOper.VendBoxList[0].TmpStatus == "00")
                {
                    tbNowTmp_Value.Foreground = brush_Ok;
                }
                else
                {
                    tbNowTmp_Value.Foreground = brush_Err;
                }

                tbTarTmp_Value.Text = PubHelper.p_BusinOper.AsileOper.VendBoxList[0].TargetTmp + PubHelper.TMP_UNIT;//
                if (PubHelper.p_BusinOper.AsileOper.VendBoxList.Count > 1)
                {
                    btnTmp_More.Visibility = System.Windows.Visibility.Visible;
                }
                else
                {
                    btnTmp_More.Visibility = System.Windows.Visibility.Hidden;
                }
                //PubHelper.p_BusinOper.SysCfgOper.GetSysCfgValue("TargetTmp1") + PubHelper.TMP_UNIT;

                #endregion

                #region 网络

                PubHelper.p_BusinOper.GetNetStatus();
                tbNetKind_Value.Text = DictionaryHelper.Dictionary_NetStatus();
                if (PubHelper.p_BusinOper.DeviceInfo.NetStatus == Business.Enum.BusinessEnum.NetStatus.OnLine)
                {
                    // 联机
                    tbNetKind_Value.Foreground = brush_Ok;
                }
                else
                {
                    // 离线
                    tbNetKind_Value.Foreground = brush_Err;
                }
                tbNetNum_Value.Text = PubHelper.p_BusinOper.GetWaitNetDataNum().ToString();
                switch (PubHelper.p_BusinOper.SysCfgOper.GetSysCfgValue("NetSwitch"))
                {
                case "0":    // 关闭
                    tbNetSwitch_Value.Text = strStopTitle;
                    break;

                case "1":    // 开启
                    tbNetSwitch_Value.Text = strRunTitle;
                    break;
                }
                string strNetType = PubHelper.p_BusinOper.SysCfgOper.GetSysCfgValue("NetType");// 网络通信类型
                switch (strNetType)
                {
                case "0":    // DTU方式
                    tbNetType_Value.Text = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_Net_NetType_DTU");
                    break;

                default:
                    tbNetType_Value.Text = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_Net_NetType_Other");
                    break;
                }
                tbNetSoftName_Value.Text = PubHelper.p_BusinOper.DeviceInfo.NetSoftVer;

                #endregion

                #region 其它设备状态

                tbRef_Value.Text        = DictionaryHelper.Dictionary_DeviceStatus(PubHelper.p_BusinOper.AsileOper.VendBoxList[0].RefControl.ControlStatus.ToString());
                tbLight_Value.Text      = DictionaryHelper.Dictionary_DeviceStatus(PubHelper.p_BusinOper.AsileOper.VendBoxList[0].LightControl.ControlStatus.ToString());
                tbAdvertLamp_Value.Text = DictionaryHelper.Dictionary_DeviceStatus(PubHelper.p_BusinOper.AsileOper.VendBoxList[0].AdvertLightControl.ControlStatus.ToString());

                #endregion

                #region 货道状态

                int    intAsileCount  = PubHelper.p_BusinOper.AsileOper.AsileList.Count;
                int    intErrAsile    = 0;
                string strAsileCode   = string.Empty;
                string strAsileStatus = string.Empty;
                string strAsileInfo   = string.Empty;
                for (int i = 0; i < intAsileCount; i++)
                {
                    if (PubHelper.p_BusinOper.AsileOper.AsileList[i].PaStatus != "02")
                    {
                        // 货道状态异常
                        intErrAsile++;
                        strAsileCode   = PubHelper.p_BusinOper.AsileOper.AsileList[i].PaCode;
                        strAsileStatus = PubHelper.p_BusinOper.AsileOper.AsileList[i].PaStatus;
                        strAsileInfo   = DictionaryHelper.Dictionary_AsileStatus(strAsileStatus);
                        if (intErrAsile == 1)
                        {
                            tbAsileCode_Text_1.Visibility = tbAsileCode_Value_1.Visibility = System.Windows.Visibility.Visible;
                            tbAsileCode_Text_1.Text       = strAsileCode;
                            tbAsileCode_Value_1.Text      = strAsileStatus + "  " + strAsileInfo;
                            tbAsileCode_Text_1.Foreground = tbAsileCode_Value_1.Foreground = brush_Err;
                        }
                        if (intErrAsile == 2)
                        {
                            tbAsileCode_Text_2.Visibility = tbAsileCode_Value_2.Visibility = System.Windows.Visibility.Visible;
                            tbAsileCode_Text_2.Text       = strAsileCode;
                            tbAsileCode_Value_2.Text      = strAsileStatus + "  " + strAsileInfo;
                            tbAsileCode_Text_2.Foreground = tbAsileCode_Value_2.Foreground = brush_Err;
                        }
                        if (intErrAsile == 3)
                        {
                            tbAsileCode_Text_3.Visibility = tbAsileCode_Value_3.Visibility = System.Windows.Visibility.Visible;
                            tbAsileCode_Text_3.Text       = strAsileCode;
                            tbAsileCode_Value_3.Text      = strAsileStatus + "  " + strAsileInfo;
                            tbAsileCode_Text_3.Foreground = tbAsileCode_Value_3.Foreground = brush_Err;
                        }
                        if (intErrAsile == 3)
                        {
                            // 超过4个,显示更多
                            btnAsile_More.Visibility = System.Windows.Visibility.Visible;
                            break;
                        }
                    }
                }
                if (intErrAsile == 0)
                {
                    // 货道正常
                    tbAsileCode_Text_1.Visibility = System.Windows.Visibility.Visible;
                    tbAsileCode_Text_1.Text       = PubHelper.p_LangOper.GetStringBundle("Pub_Normal");
                    tbAsileCode_Text_1.Foreground = brush_Ok;
                }

                #endregion

                #region 支付方式

                tbCashControl_Text.Text      = tbCash_Text.Text = tbCoin_Text.Text =
                    tbCashControl_Value.Text = tbCash_Value.Text = tbCoin_Value.Text = string.Empty;

                // 获取当前支付方式数量
                int intEnablePayNum = PubHelper.p_BusinOper.PaymentOper.GetOpenPayNum();
                switch (intEnablePayNum)
                {
                case 0:    // 没有支付方式
                    btnPayment_More.Visibility         = System.Windows.Visibility.Hidden;
                    tbCashControl_Text.Visibility      = tbCash_Text.Visibility = tbCoin_Text.Visibility =
                        tbCashControl_Value.Visibility = tbCash_Value.Visibility = tbCoin_Value.Visibility =
                            System.Windows.Visibility.Hidden;
                    break;

                case 1:                                                            // 只有一种支付方式
                    btnPayment_More.Visibility = System.Windows.Visibility.Hidden; // 隐藏更多按钮
                    break;

                default:                                                            // 多种支付方式
                    btnPayment_More.Visibility = System.Windows.Visibility.Visible; // 显示更多按钮
                    break;
                }
                if (intEnablePayNum == 0)
                {
                    return;
                }

                #region 现金支付
                if (PubHelper.p_BusinOper.PaymentOper.CheckPaymentIsExist(Business.Enum.BusinessEnum.PayMent.Cash))
                {
                    // 如果现金支付方式开启,则界面上默认显示现金支付方式的相关信息
                    tbCashControl_Text.Text = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_Cash_Title");
                    tbCash_Text.Text        = PubHelper.p_LangOper.GetStringBundle("Pub_Device_Bill");
                    tbCoin_Text.Text        = PubHelper.p_LangOper.GetStringBundle("Pub_Device_Coin");

                    switch (PubHelper.p_BusinOper.PaymentOper.PaymentList.Cash.ControlSwitch)
                    {
                    case Business.Enum.BusinessEnum.ControlSwitch.Stop:    // 关闭
                        tbCashControl_Value.Text = strStopTitle;
                        break;

                    case Business.Enum.BusinessEnum.ControlSwitch.Run:    // 开启
                        tbCashControl_Value.Text = strRunTitle;
                        break;
                    }
                    tbCash_Value.Text = DictionaryHelper.Dictionary_CashStatus();
                    tbCoin_Value.Text = DictionaryHelper.Dictionary_CoinStatus();

                    return;
                }
                #endregion
                #region 储值卡支付
                if (PubHelper.p_BusinOper.PaymentOper.CheckPaymentIsExist(Business.Enum.BusinessEnum.PayMent.IcCard))
                {
                    // 如果储值卡支付方式开启,则界面上默认显示储值卡支付方式的相关信息
                    tbCashControl_Text.Text = PubHelper.ConvertIcCardPayName();                                       // PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_Card_Title");
                    tbCash_Text.Text        = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_Card_Soft"); // 组件版本
                    tbCoin_Text.Text        = PubHelper.p_LangOper.GetStringBundle("Pub_Device_Ic");                  // 设备状态

                    switch (PubHelper.p_BusinOper.PaymentOper.PaymentList.IC.ControlSwitch)
                    {
                    case Business.Enum.BusinessEnum.ControlSwitch.Stop:    // 关闭
                        tbCashControl_Value.Text = strStopTitle;
                        break;

                    case Business.Enum.BusinessEnum.ControlSwitch.Run:    // 开启
                        tbCashControl_Value.Text = strRunTitle;
                        break;
                    }
                    tbCash_Value.Text = PubHelper.p_BusinOper.DeviceInfo.ICSoftVer; // 组件版本值
                    tbCoin_Value.Text = DictionaryHelper.Dictionary_ICStatus();     // 设备状态值

                    return;
                }
                #endregion
                #region 在线会员实体卡
                if (PubHelper.p_BusinOper.PaymentOper.CheckPaymentIsExist(Business.Enum.BusinessEnum.PayMent.Online_EntityCard))
                {
                    // 如果支付方式开启,则界面上默认显示支付方式的相关信息
                    tbCashControl_Text.Text = PubHelper.p_LangOper.GetStringBundle("Pub_Payment_OnlineCard");
                    tbCash_Text.Text        = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_NoFeeCard_Soft"); // 组件版本
                    tbCoin_Text.Text        = PubHelper.p_LangOper.GetStringBundle("Pub_Device_NoFeeCard");                // 设备状态

                    switch (PubHelper.p_BusinOper.PaymentOper.PaymentList.Online_EntityCard.ControlSwitch)
                    {
                    case Business.Enum.BusinessEnum.ControlSwitch.Stop:    // 关闭
                        tbCashControl_Value.Text = strStopTitle;
                        break;

                    case Business.Enum.BusinessEnum.ControlSwitch.Run:    // 开启
                        tbCashControl_Value.Text = strRunTitle;
                        break;
                    }
                    tbCash_Value.Text = PubHelper.p_BusinOper.DeviceInfo.OnlineEntityCardSoftVer; // 组件版本值
                    tbCoin_Value.Text = DictionaryHelper.Dictionary_OnlineEntityCardStatus();     // 设备状态值

                    return;
                }
                #endregion
                #region 银联支付
                if (PubHelper.p_BusinOper.PaymentOper.CheckPaymentIsExist(Business.Enum.BusinessEnum.PayMent.QuickPass))
                {
                    // 如果支付方式开启,则界面上默认显示支付方式的相关信息
                    tbCashControl_Text.Text = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_UnionPay_Title");
                    tbCash_Text.Text        = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_UnionPay_Soft"); // 组件版本
                    tbCoin_Text.Text        = PubHelper.p_LangOper.GetStringBundle("Pub_Device_UnionPay");                // 设备状态

                    switch (PubHelper.p_BusinOper.PaymentOper.PaymentList.UnionPay.ControlSwitch)
                    {
                    case Business.Enum.BusinessEnum.ControlSwitch.Stop:    // 关闭
                        tbCashControl_Value.Text = strStopTitle;
                        break;

                    case Business.Enum.BusinessEnum.ControlSwitch.Run:    // 开启
                        tbCashControl_Value.Text = strRunTitle;
                        break;
                    }
                    tbCash_Value.Text = PubHelper.p_BusinOper.DeviceInfo.UnionPaySoftVer; // 组件版本值
                    tbCoin_Value.Text = DictionaryHelper.Dictionary_UnionPayStatus();     // 设备状态值

                    return;
                }
                #endregion
                #region 二维码支付
                if (PubHelper.p_BusinOper.PaymentOper.CheckPaymentIsExist(Business.Enum.BusinessEnum.PayMent.KimmaOnLineCard))
                {
                    // 如果支付方式开启,则界面上默认显示支付方式的相关信息
                    tbCashControl_Text.Text = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_QrCode_Title");
                    tbCash_Text.Text        = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_QrCode_Soft"); // 组件版本
                    tbCoin_Text.Text        = PubHelper.p_LangOper.GetStringBundle("Pub_Device_QRCode");                // 设备状态

                    switch (PubHelper.p_BusinOper.PaymentOper.PaymentList.KimmaOnLineCard.ControlSwitch)
                    {
                    case Business.Enum.BusinessEnum.ControlSwitch.Stop:    // 关闭
                        tbCashControl_Value.Text = strStopTitle;
                        break;

                    case Business.Enum.BusinessEnum.ControlSwitch.Run:    // 开启
                        tbCashControl_Value.Text = strRunTitle;
                        break;
                    }
                    tbCash_Value.Text = PubHelper.p_BusinOper.DeviceInfo.QrSoftVer; // 组件版本值
                    tbCoin_Value.Text = DictionaryHelper.Dictionary_QRCodeStatus(); // 设备状态值

                    return;
                }
                #endregion
                #region 微信扫码支付
                if (PubHelper.p_BusinOper.PaymentOper.CheckPaymentIsExist(Business.Enum.BusinessEnum.PayMent.WeChatCode))
                {
                    // 如果支付方式开启,则界面上默认显示支付方式的相关信息
                    tbCashControl_Text.Text = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_WeChatCode_Title");
                    tbCash_Text.Text        = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_WeChatCode_Soft"); // 组件版本
                    tbCoin_Text.Text        = PubHelper.p_LangOper.GetStringBundle("Pub_Device_QRCode");                    // 设备状态

                    switch (PubHelper.p_BusinOper.PaymentOper.PaymentList.WeChatCode.ControlSwitch)
                    {
                    case Business.Enum.BusinessEnum.ControlSwitch.Stop:    // 关闭
                        tbCashControl_Value.Text = strStopTitle;
                        break;

                    case Business.Enum.BusinessEnum.ControlSwitch.Run:    // 开启
                        tbCashControl_Value.Text = strRunTitle;
                        break;
                    }
                    tbCash_Value.Text      = PubHelper.p_BusinOper.DeviceInfo.AliPayWaveSoftVer;// 组件版本值
                    tbCoin_Text.Visibility = tbCoin_Value.Visibility = System.Windows.Visibility.Hidden;
                    ////tbCoin_Value.Text = DictionaryHelper.Dictionary_AliPayWaveStatus();// 设备状态值

                    return;
                }
                #endregion

                #region 支付宝扫码支付
                if (PubHelper.p_BusinOper.PaymentOper.CheckPaymentIsExist(Business.Enum.BusinessEnum.PayMent.AliPay_Code))
                {
                    // 如果支付方式开启,则界面上默认显示支付方式的相关信息
                    tbCashControl_Text.Text = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_AliPayCode_Title");
                    tbCash_Text.Text        = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_AliPayCode_Soft"); // 组件版本
                    tbCoin_Text.Text        = PubHelper.p_LangOper.GetStringBundle("Pub_Device_QRCode");                    // 设备状态

                    switch (PubHelper.p_BusinOper.PaymentOper.PaymentList.AliPay_Code.ControlSwitch)
                    {
                    case Business.Enum.BusinessEnum.ControlSwitch.Stop:    // 关闭
                        tbCashControl_Value.Text = strStopTitle;
                        break;

                    case Business.Enum.BusinessEnum.ControlSwitch.Run:    // 开启
                        tbCashControl_Value.Text = strRunTitle;
                        break;
                    }
                    tbCash_Value.Text = PubHelper.p_BusinOper.DeviceInfo.AliPayWaveSoftVer;// 组件版本值
                    ////tbCoin_Value.Text = DictionaryHelper.Dictionary_AliPayWaveStatus();// 设备状态值
                    tbCoin_Text.Visibility = tbCoin_Value.Visibility = System.Windows.Visibility.Hidden;

                    return;
                }
                #endregion

                #endregion
            }
            catch (Exception ex)
            {
                PubHelper.ShowMsgInfo(PubHelper.p_LangOper.GetStringBundle("Err_OtherErr").Replace("{N}", ex.Message), PubHelper.MsgType.Ok);
            }
        }