/// <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
        /// <summary>
        /// 创建货柜
        /// </summary>
        private void CreateBox()
        {
            int intBoxCount = PubHelper.p_BusinOper.AsileOper.VendBoxList_Lifter.Count;

            for (int i = 1; i <= intBoxCount; i++)
            {
                panelBox.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(1, GridUnitType.Star)
                });

                var palletButton = new RadioButton()
                {
                    Focusable = false,

                    HorizontalAlignment = System.Windows.HorizontalAlignment.Center,

                    VerticalAlignment = System.Windows.VerticalAlignment.Center,

                    Style = App.Current.Resources["VendBoxButtonStyle"] as Style,

                    Foreground = new SolidColorBrush(Colors.White),

                    Padding = new Thickness(20, 4, 20, 8),

                    FontSize = PubHelper.FONTSIZE_BOX,

                    Tag = PubHelper.p_BusinOper.AsileOper.VendBoxList_Lifter[i - 1].VendBoxCode
                };

                Grid.SetColumn(palletButton, i - 1);

                palletButton.Checked += (VendBoxButtonChecked);

                palletButton.Content = DictionaryHelper.Dictionary_VendBoxName(PubHelper.p_BusinOper.AsileOper.VendBoxList_Lifter[i - 1].VendBoxCode);

                panelBox.Children.Add(palletButton);

                if (i == 1)
                {
                    palletButton.IsChecked = true;
                }
            }
        }
        /// <summary>
        /// 创建货柜
        /// </summary>
        private void CreateBox()
        {
            var map = new Dictionary <int, string>();

            for (int i = 1; i < 10; i++)
            {
                map.Add(i, DictionaryHelper.Dictionary_VendBoxName(i.ToString()));
            }

            int  intBoxCount = PubHelper.p_BusinOper.AsileOper.VendBoxList.Count;
            bool blnIsOneBox = PubHelper.p_BusinOper.AsileOper.QueryIsOneBox();

            if (intBoxCount > 1)
            {
                if (!blnIsOneBox)
                {
                    intBoxCount++;
                }
                #region  多个柜子
                for (int i = 1; i <= intBoxCount; i++)
                {
                    panelBox.ColumnDefinitions.Add(new ColumnDefinition()
                    {
                        Width = new GridLength(1, GridUnitType.Star)
                    });

                    var palletButton = new RadioButton()
                    {
                        Focusable = false,

                        HorizontalAlignment = System.Windows.HorizontalAlignment.Center,

                        VerticalAlignment = System.Windows.VerticalAlignment.Center,

                        Style = App.Current.Resources["VendBoxButtonStyle"] as Style,

                        Foreground = new SolidColorBrush(Colors.White),

                        Padding = new Thickness(20, 4, 20, 8),

                        FontSize = PubHelper.FONTSIZE_BOX,

                        Tag = i
                    };

                    Grid.SetColumn(palletButton, i - 1);

                    palletButton.Checked += (VendBoxButtonChecked);

                    palletButton.Content = map[i];

                    panelBox.Children.Add(palletButton);

                    if (i == 1)
                    {
                        palletButton.IsChecked = true;
                    }
                }
                #endregion
            }
            else
            {
                // 只有一个柜子
                CreateTray();
            }
        }
        private void InitForm()
        {
            #region 初始化界面资源

            tbTitle.Text      = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_UpDown_Title");
            btnSave.Content   = PubHelper.p_LangOper.GetStringBundle("Pub_Btn_Save");
            btnCancel.Content = PubHelper.p_LangOper.GetStringBundle("Pub_Btn_Cancel");

            tbSellGoodsType.Text = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_UpDown_Cfg_SellType");
            tbVendBoxCode.Text   = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_UpDown_Cfg_VendBox");
            tbShippPort.Text     = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_UpDown_Cfg_ShippPort");

            tbUpDownSellModel.Text            = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_UpDown_Cfg_SellModel");// 出货指令
            rdbUpDownSellModel_ZhiJie.Content = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_UpDown_Cfg_SellModel_ZJ");
            rdbUpDownSellModel_Pra.Content    = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_UpDown_Cfg_SellModel_Pra");

            tbUpDownIsQueryElectStatus.Text         = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_UpDown_Cfg_GuangDian");
            rdbUpDownIsQueryElectStatus_Yes.Content = PubHelper.p_LangOper.GetStringBundle("Pub_Device_Run");
            rdbUpDownIsQueryElectStatus_No.Content  = PubHelper.p_LangOper.GetStringBundle("Pub_Device_Close");

            tbLeftSpace_Title.Text   = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_UpDown_Cfg_LeftSpace");
            tbMiddleSpace_Title.Text = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_UpDown_Cfg_MiddleSpace");
            tbRightSpace_Title.Text  = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AdvanCfg_UpDown_Cfg_RightSpace");

            for (int i = 1; i < 11; i++)
            {
                cmbShippPort.Items.Add("COM" + i.ToString());
            }

            #endregion

            #region 加载数据

            int intVendBoxIndex = PubHelper.p_BusinOper.AsileOper.GetVendBoxIndex(PubHelper.p_VendBoxCode);

            // 柜号
            tbVendCode_Value.Text = DictionaryHelper.Dictionary_VendBoxName(PubHelper.p_VendBoxCode);

            // 出货方式
            tbSellGoodsType_Value.Text = DictionaryHelper.Dictionary_SellGoodsType(PubHelper.p_VendBoxCode);

            // 驱动板串口
            cmbShippPort.Text = "COM" + PubHelper.p_BusinOper.AsileOper.VendBoxList[intVendBoxIndex].ShippPort;

            // 出货指令
            if (PubHelper.p_BusinOper.AsileOper.VendBoxList[intVendBoxIndex].UpDownSellModel == "0")
            {
                // 直接升降
                rdbUpDownSellModel_ZhiJie.IsChecked = true;
            }
            else
            {
                rdbUpDownSellModel_Pra.IsChecked = true;
            }

            // 光电检测
            if (PubHelper.p_BusinOper.AsileOper.VendBoxList[intVendBoxIndex].UpDownIsQueryElectStatus == Business.Enum.BusinessEnum.ControlSwitch.Run)
            {
                // 开启光电检测
                rdbUpDownIsQueryElectStatus_Yes.IsChecked = true;
            }
            else
            {
                rdbUpDownIsQueryElectStatus_No.IsChecked = true;
            }

            tbLeftSpace_Value.Text   = PubHelper.p_BusinOper.ConfigInfo.UpDownLeftRightNum_Left.ToString();
            tbMiddleSpace_Value.Text = PubHelper.p_BusinOper.ConfigInfo.UpDownLeftRightNum_Center.ToString();
            tbRightSpace_Value.Text  = PubHelper.p_BusinOper.ConfigInfo.UpDownLeftRightNum_Right.ToString();

            #endregion
        }