Ejemplo n.º 1
0
        /// <summary>
        /// 单击选择全部或反选
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnSelectAllPump(object sender, RoutedEventArgs e)
        {
            SinglePump pump = null;

            for (int i = 0; i < pumplistGrid.Children.Count; i++)
            {
                if (pumplistGrid.Children[i] is SinglePump)
                {
                    pump = pumplistGrid.Children[i] as SinglePump;
                    pump.chNo.IsChecked = this.chNo.IsChecked;
                    if (this.chNo.IsChecked == true)
                    {
                        if (!m_CheckedPumpLocationList.Contains(pump.PumpLocation))
                        {
                            m_CheckedPumpLocationList.Add(pump.PumpLocation);
                        }
                    }
                    else
                    {
                        if (m_CheckedPumpLocationList.Contains(pump.PumpLocation))
                        {
                            m_CheckedPumpLocationList.Remove(pump.PumpLocation);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            SinglePump pump = null;
            List <Tuple <int, int, int> > pumpLocationList = new List <Tuple <int, int, int> >();

            for (int i = 0; i < pumplistGrid.Children.Count; i++)
            {
                if (pumplistGrid.Children[i] is SinglePump)
                {
                    pump = pumplistGrid.Children[i] as SinglePump;
                    if (pump.chNo.IsChecked.HasValue && pump.chNo.IsChecked == true)
                    {
                        pumpLocationList.Add(new Tuple <int, int, int>((int)pump.Tag, pump.RowNo, pump.ColNo));
                    }
                }
            }
            Hashtable hashPumps = new Hashtable();

            hashPumps.Add(m_DockNo, pumpLocationList);
            if (OnSelectedPumps != null)
            {
                OnSelectedPumps(this, new SelectedPumpsArgs(hashPumps));
            }
            GC.Collect();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 哪些泵已经选中
        /// </summary>
        private void InitSelectedPumps()
        {
            //进入此界面时需要将m_CheckedPumpLocationList清空
            m_CheckedPumpLocationList.Clear();
            if (DockWindow.m_DockPumpList.ContainsKey(m_DockNo))
            {
                List <Tuple <int, int, int, string> > pumpLocation = DockWindow.m_DockPumpList[m_DockNo] as List <Tuple <int, int, int, string> >;

                SinglePump pump = null;
                for (int i = 0; i < pumplistGrid.Children.Count; i++)
                {
                    if (pumplistGrid.Children[i] is SinglePump)
                    {
                        pump = pumplistGrid.Children[i] as SinglePump;
                        if (pump.Tag != null)
                        {
                            Tuple <int, int, int, string> location = pumpLocation.Find((x) => { return(x.Item1 == (int)pump.Tag); });
                            if (location != null)
                            {
                                pump.chNo.IsChecked = true;
                                pump.SerialNo       = location.Item4;
                                if (!m_CheckedPumpLocationList.Contains(pump.PumpLocation))
                                {
                                    m_CheckedPumpLocationList.Add(pump.PumpLocation);
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            SinglePump pump = null;

            for (int i = 0; i < pumplistGrid.Children.Count; i++)
            {
                if (pumplistGrid.Children[i] is SinglePump)
                {
                    pump = pumplistGrid.Children[i] as SinglePump;
                    pump.lbPumpType.Content = ((ComboBoxItem)(cmPumpType.SelectedItem)).Content.ToString();
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 单击选择全部或反选
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnSelectAllPump(object sender, RoutedEventArgs e)
        {
            SinglePump pump = null;

            for (int i = 0; i < pumplistGrid.Children.Count; i++)
            {
                if (pumplistGrid.Children[i] is SinglePump)
                {
                    pump = pumplistGrid.Children[i] as SinglePump;
                    pump.chNo.IsChecked = this.chNo.IsChecked;
                }
            }
        }
Ejemplo n.º 6
0
        private void LoadPumpList()
        {
            int pumpCount       = DockInfoManager.Instance().Get(m_DockNo);
            int pumpCountPerRow = pumpCount / 5;    //每行有几个机位

            if (pumpCount <= 0)
            {
                Logger.Instance().Info("泵数量小于等于0,请重新设置。");
                return;
            }
            int rowCount = pumpCount / 2;

            if (pumpCount % 2 > 0)
            {
                rowCount += 1;
            }
            for (int i = 0; i < rowCount; i++)
            {
                RowDefinition row = new RowDefinition();
                row.Height = GridLength.Auto;
                pumplistGrid.RowDefinitions.Add(row);
            }
            int iRow = 0, iCol = 0;

            for (int i = 0, rowIndex = 1; i < pumpCount; i++)
            {
                //AgingSystem:SinglePump  Grid.Row="1"  Grid.Column="1" Margin="1" Cursor="Hand" Background="Blue"/>
                iRow = i / pumpCountPerRow + 1;
                iCol = (i + 1) % pumpCountPerRow;
                if (iCol == 0)
                {
                    iCol = pumpCountPerRow;
                }
                SinglePump pump = new SinglePump(m_DockNo, i + 1, iRow, iCol);
                pump.Name   = "pump" + (i + 1).ToString();
                pump.Tag    = i + 1;
                pump.Margin = new Thickness(1, 1, 1, 1);
                pump.Cursor = Cursors.Hand;
                pump.SetPump(i + 1, "", "");
                pump.OnClickCheckBox  += OnSinglePumpClickCheckBox;
                pump.OnSerialNoTypeIn += OnSerialNoInputComplete;
                pumplistGrid.Children.Add(pump);
                Grid.SetRow(pump, rowIndex);
                if (i % 2 == 1)
                {
                    ++rowIndex;
                }
                Grid.SetColumn(pump, i % 2);
                pump.Background = new SolidColorBrush(m_PumpBackgroundColor[i / pumpCountPerRow]);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 选择泵类型,下拉列表框
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            SinglePump      pump        = null;
            string          strPumpType = string.Empty;
            int             index       = 0;
            CustomProductID cid         = CustomProductID.Unknow;

            for (int i = 0; i < pumplistGrid.Children.Count; i++)
            {
                if (pumplistGrid.Children[i] is SinglePump)
                {
                    pump        = pumplistGrid.Children[i] as SinglePump;
                    strPumpType = cmPumpType.Items[cmPumpType.SelectedIndex].ToString();
                    cid         = ProductIDConvertor.Name2CustomProductID(strPumpType);
                    InitPressureLevel(cid);
                    if (cid == CustomProductID.GrasebyF6_Double || cid == CustomProductID.WZS50F6_Double)
                    {
                        if (pump.Tag != null && !string.IsNullOrEmpty(pump.Tag.ToString()))
                        {
                            if (int.TryParse(pump.Tag.ToString(), out index))
                            {
                                if (index % 2 == 1)
                                {
                                    pump.lbPumpType.Content = strPumpType + " 1道";
                                }
                                else
                                {
                                    pump.lbPumpType.Content = strPumpType + " 2道";
                                }
                            }
                        }
                        pump.EnableCheckBoxClick = true;
                    }
                    else
                    {
                        pump.EnableCheckBoxClick = false;
                        pump.lbPumpType.Content  = strPumpType;
                    }
                }
            }
        }
Ejemplo n.º 8
0
        private void InitSelectedPumps()
        {
            if (DockWindow.m_DockPumpList.ContainsKey(m_DockNo))
            {
                List <Tuple <int, int, int> > pumpLocation = DockWindow.m_DockPumpList[m_DockNo] as List <Tuple <int, int, int> >;

                SinglePump pump = null;
                for (int i = 0; i < pumplistGrid.Children.Count; i++)
                {
                    if (pumplistGrid.Children[i] is SinglePump)
                    {
                        pump = pumplistGrid.Children[i] as SinglePump;
                        if (pump.Tag != null &&
                            pumpLocation.FindIndex((x) => { return(x.Item1 == (int)pump.Tag); }) >= 0)
                        {
                            pump.chNo.IsChecked = true;
                        }
                    }
                }
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 每个泵都有一个编号,从1开始,按照位置一定能找到
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        private SinglePump FindPumpByLocation(int location)
        {
            SinglePump pump = null;

            for (int i = 0; i < pumplistGrid.Children.Count; i++)
            {
                if (pumplistGrid.Children[i] is SinglePump)
                {
                    pump = pumplistGrid.Children[i] as SinglePump;
                    if (pump.PumpLocation == location)
                    {
                        break;
                    }
                    else
                    {
                        continue;
                    }
                }
            }
            return(pump);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 当条码枪完成一次扫码,光标自动跳到下一条
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnSerialNoInputComplete(object sender, SerialNoInputArgs e)
        {
            if (m_CheckedPumpLocationList.Count <= 0)
            {
                return;
            }
            if (cmPumpType.SelectedIndex < 0)
            {
                return;
            }
            string          strPumpType = cmPumpType.Items[cmPumpType.SelectedIndex].ToString();
            CustomProductID cid         = ProductIDConvertor.Name2CustomProductID(strPumpType);
            int             index       = m_CheckedPumpLocationList.FindIndex((x) => { return(e.PumpLocation == x); });

            if (index >= 0 && index + 1 < m_CheckedPumpLocationList.Count)
            {
                if (cid == CustomProductID.GrasebyF6_Double || cid == CustomProductID.WZS50F6_Double)
                {
                    #region
                    SinglePump pump = null;
                    //第一道泵序列号与第二道 一样
                    if (index % 2 == 0)
                    {
                        if (m_CheckedPumpLocationList.Count > index + 1)
                        {
                            pump = FindPumpByLocation(m_CheckedPumpLocationList[index + 1]);
                            if (pump != null)
                            {
                                pump.SetSerialNo(e.SerialNo);
                            }
                        }
                        if (m_CheckedPumpLocationList.Count > index + 2)
                        {
                            //光标跳到下一个泵
                            pump = FindPumpByLocation(m_CheckedPumpLocationList[index + 2]);
                            if (pump != null)
                            {
                                pump.SetCursor();
                            }
                        }
                    }
                    else
                    {
                        if (m_CheckedPumpLocationList.Count > index - 1)
                        {
                            pump = FindPumpByLocation(m_CheckedPumpLocationList[index - 1]);
                            if (pump != null)
                            {
                                pump.SetSerialNo(e.SerialNo);
                            }
                        }
                        //光标跳到下一个泵
                        if (m_CheckedPumpLocationList.Count > index + 1)
                        {
                            pump = FindPumpByLocation(m_CheckedPumpLocationList[index + 1]);
                            if (pump != null)
                            {
                                pump.SetCursor();
                            }
                        }
                    }
                    #endregion
                }
                else
                {
                    SinglePump pump = FindPumpByLocation(m_CheckedPumpLocationList[index + 1]);
                    if (pump != null)
                    {
                        pump.SetCursor();
                    }
                }
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 双道F6 WZ50F6都不用点击第二道,当点击第一道时,第二道自动勾选
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnSinglePumpClickCheckBox(object sender, SinglePumpArgs e)
        {
            SinglePump self = sender as SinglePump;
            SinglePump pump = null;

            if (e != null)
            {
                //如果是双道泵
                if (e.EnableCheckBoxClick)
                {
                    //点击奇数位泵偶数位也要相应点击,反之亦然
                    if (e.PumpLocation % 2 == 0 && e.PumpLocation > 0)
                    {
                        pump = FindPumpByLocation(e.PumpLocation - 1);
                        if (pump != null)
                        {
                            pump.chNo.IsChecked = self.chNo.IsChecked;
                        }
                    }
                    else if (e.PumpLocation % 2 == 1)
                    {
                        pump = FindPumpByLocation(e.PumpLocation + 1);
                        if (pump != null)
                        {
                            pump.chNo.IsChecked = self.chNo.IsChecked;
                        }
                    }

                    if (pump != null && pump.chNo.IsChecked == true)
                    {
                        if (!m_CheckedPumpLocationList.Contains(pump.PumpLocation))
                        {
                            m_CheckedPumpLocationList.Add(pump.PumpLocation);
                        }
                    }
                    else
                    {
                        if (m_CheckedPumpLocationList.Contains(pump.PumpLocation))
                        {
                            m_CheckedPumpLocationList.Remove(pump.PumpLocation);
                        }
                    }
                }

                if (self.chNo.IsChecked == true)
                {
                    if (!m_CheckedPumpLocationList.Contains(e.PumpLocation))
                    {
                        m_CheckedPumpLocationList.Add(e.PumpLocation);
                    }
                }
                else
                {
                    if (m_CheckedPumpLocationList.Contains(e.PumpLocation))
                    {
                        m_CheckedPumpLocationList.Remove(e.PumpLocation);
                    }
                }
                m_CheckedPumpLocationList.Sort();//默认是从小到大排序
            }
        }