/// <summary>
 /// 查看详细老化信息,一定要传入这些参数
 /// </summary>
 /// <param name="dockNo"></param>
 /// <param name="parameter"></param>
 /// <param name="pumpLocationList"></param>
 /// <param name="AgingPumpList"></param>
 public DetailList(int dockNo, AgingParameter parameter, List <Tuple <int, int, int> > pumpLocationList, List <AgingPump> AgingPumpList)
 {
     InitializeComponent();
     m_DockNo           = dockNo;
     m_Parameter        = parameter;
     m_PumpLocationList = pumpLocationList;
     m_AgingPumpList    = AgingPumpList;
 }
Exemple #2
0
 /// <summary>
 /// 当已经配置完成后,重新再进入配置界面时,要将之前的参数赋值
 /// </summary>
 private void InitParameter()
 {
     if (DockWindow.m_DockParameter.ContainsKey(m_DockNo))
     {
         AgingParameter para  = DockWindow.m_DockParameter[m_DockNo] as AgingParameter;
         int            index = -1;
         for (int i = 0; i < cmPumpType.Items.Count; i++)
         {
             if (string.Compare(cmPumpType.Items[i].ToString(), para.PumpType, true) == 0)
             {
                 index = i;
                 break;
             }
         }
         if (index >= 0)
         {
             cmPumpType.SelectedIndex = index;
             CustomProductID cid = ProductIDConvertor.Name2CustomProductID(para.PumpType);
             for (int i = 0; i < cmOcclusionLevel.Items.Count; i++)
             {
                 if (cid == CustomProductID.GrasebyC9)
                 {
                     if (string.Compare(cmOcclusionLevel.Items[i].ToString(), para.C9OclusionLevel.ToString(), true) == 0)
                     {
                         index = i;
                         break;
                     }
                 }
                 else
                 {
                     if (string.Compare(cmOcclusionLevel.Items[i].ToString(), para.OclusionLevel.ToString(), true) == 0)
                     {
                         index = i;
                         break;
                     }
                 }
             }
             if (index >= 0)
             {
                 cmOcclusionLevel.SelectedIndex = index;
             }
         }
         tbRate.Text     = para.Rate.ToString();
         tbVolume.Text   = para.Volume.ToString();
         tbCharge.Text   = para.ChargeTime.ToString();
         tbRecharge.Text = para.RechargeTime.ToString();
     }
 }
Exemple #3
0
 private void InitParameter()
 {
     if (DockWindow.m_DockParameter.ContainsKey(m_DockNo))
     {
         AgingParameter para  = DockWindow.m_DockParameter[m_DockNo] as AgingParameter;
         int            index = -1;
         ComboBoxItem   item  = null;
         for (int i = 0; i < cmPumpType.Items.Count; i++)
         {
             item = cmPumpType.Items[i] as ComboBoxItem;
             //cmPumpType.Items[9]
             if (string.Compare(item.Content.ToString(), para.PumpType, true) == 0)
             {
                 index = i;
                 break;
             }
         }
         if (index >= 0)
         {
             cmPumpType.SelectedIndex = index;
         }
         for (int i = 0; i < cmOcclusionLevel.Items.Count; i++)
         {
             item = cmOcclusionLevel.Items[i] as ComboBoxItem;
             //cmPumpType.Items[9]
             if (string.Compare(item.Content.ToString(), para.OclusionLevel.ToString(), true) == 0)
             {
                 index = i;
                 break;
             }
         }
         if (index >= 0)
         {
             cmOcclusionLevel.SelectedIndex = index;
         }
         tbRate.Text   = para.Rate.ToString();
         tbVolume.Text = para.Volume.ToString();
         tbCharge.Text = para.ChargeTime.ToString();
         //tbDischarge.Text = para.DischargeTime.ToString();
         tbRecharge.Text = para.RechargeTime.ToString();
     }
 }
        /// <summary>
        /// 当客户端连入时要发送泵类型信息,
        /// 如果用户尚未配置,则不用发,留到点开始的时候发
        /// </summary>
        /// <param name="e"></param>
        private void SendPumpType2Wifi(SocketConnectArgs e)
        {
            Controller controller = ControllerManager.Instance().Get(e.ConnectedSocket);

            if (controller == null)
            {
                return;
            }
            int       dockNo = controller.DockNo;
            AgingDock dock   = m_DockList.Find((x) => { return(x.DockNo == dockNo); });

            if (dock == null || dock.ChannelHashRowNo == null || !dock.ChannelHashRowNo.ContainsKey(controller.RowNo))
            {
                return;
            }
            AgingParameter para = m_DockParameter[dockNo] as AgingParameter;

            if (para != null)
            {
                if (Enum.IsDefined(typeof(ProductID), para.PumpType))
                {
                    ProductID     pid        = (ProductID)Enum.Parse(typeof(ProductID), para.PumpType);
                    CommandManage cmdManager = new CommandManage();
                    int           iChannel   = (int)dock.ChannelHashRowNo[controller.RowNo];
                    byte          channel    = (byte)(iChannel & 0x000000FF);
                    //一旦收到连接,立即发送泵信息,必须要延迟10秒
                    cmdManager.SendPumpType(pid, (ushort)m_QueryInterval, e.ConnectedSocket, null, channel);
                }
                else
                {
                    Logger.Instance().ErrorFormat("SendPumpType2Wifi()->para.PumpType is not defined! para.PumpType={0}", para.PumpType);
                }
            }
            else
            {
                Logger.Instance().Debug("SendPumpType2Wifi()->DefaultParameter is null");
            }
        }
Exemple #5
0
        /// <summary>
        /// 当客户端连入时要发送泵类型信息,
        /// 如果用户尚未配置,则不用发,留到点开始的时候发
        /// </summary>
        /// <param name="e"></param>
        private void SendPumpType2Wifi(SocketConnectArgs e)
        {
            Controller controller = ControllerManager.Instance().Get(e.ConnectedSocket);

            if (controller == null)
            {
                return;
            }
            int       dockNo = controller.DockNo;
            AgingDock dock   = m_DockList.Find((x) => { return(x.DockNo == dockNo); });

            if (dock == null || dock.ChannelHashRowNo == null || !dock.ChannelHashRowNo.ContainsKey(controller.RowNo))
            {
                return;
            }
            AgingParameter para = m_DockParameter[dockNo] as AgingParameter;

            if (para != null)
            {
                CustomProductID cid        = ProductIDConvertor.Name2CustomProductID(para.PumpType);
                ProductID       pid        = ProductIDConvertor.Custom2ProductID(cid);
                CommandManage   cmdManager = new CommandManage();
                int             iChannel   = (int)dock.ChannelHashRowNo[controller.RowNo];
                byte            channel    = (byte)(iChannel & 0x000000FF);
                //一旦收到连接,立即发送泵信息,必须要延迟10秒
                if (pid == ProductID.Graseby1200En)//英文版的ID和中文的一样
                {
                    pid = ProductID.Graseby1200;
                }
                cmdManager.SendPumpType(pid, (ushort)m_QueryInterval, e.ConnectedSocket, null, channel);
            }
            else
            {
                Logger.Instance().Debug("SendPumpType2Wifi()->DefaultParameter is null");
            }
        }
Exemple #6
0
        private void OnSave(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(tbRate.Text.Trim()) ||
                string.IsNullOrEmpty(tbVolume.Text.Trim()) ||
                string.IsNullOrEmpty(tbCharge.Text.Trim()) ||
                string.IsNullOrEmpty(tbRecharge.Text.Trim()) ||
                cmPumpType.SelectedIndex < 0 ||
                cmOcclusionLevel.SelectedIndex < 0
                )
            {
                MessageBox.Show("请将参数填写完整");
                return;
            }
            ComboBoxItem item      = cmPumpType.SelectedItem as ComboBoxItem;
            ComboBoxItem itemLevel = cmOcclusionLevel.SelectedItem as ComboBoxItem;
            decimal      rate      = Convert.ToDecimal(float.Parse(tbRate.Text).ToString("F1"));
            decimal      volume    = Convert.ToDecimal(float.Parse(tbVolume.Text).ToString("F1"));
            decimal      charge    = Convert.ToDecimal(tbCharge.Text);

            OcclusionLevel level = OcclusionLevel.H;

            if (Enum.IsDefined(typeof(OcclusionLevel), itemLevel.Content.ToString()))
            {
                level = (OcclusionLevel)Enum.Parse(typeof(OcclusionLevel), itemLevel.Content.ToString());
            }
            else
            {
                Logger.Instance().ErrorFormat("Configuration::OnSave()->压力转换出错,OcclusionLevel={0}", itemLevel.Content.ToString());
            }
            decimal discharge = 0;
            decimal recharge  = Convert.ToDecimal(tbRecharge.Text);

            Hashtable      dockParameter = new Hashtable();
            AgingParameter para          = new AgingParameter(item.Content.ToString(),
                                                              rate,
                                                              volume,
                                                              charge,
                                                              discharge,
                                                              recharge,
                                                              level);

            for (int i = 0; i < otherDockCheckBoxGrid.Children.Count; i++)
            {
                if (otherDockCheckBoxGrid.Children[i] is CheckBox)
                {
                    CheckBox box = otherDockCheckBoxGrid.Children[i] as CheckBox;
                    if (box.IsChecked.HasValue)
                    {
                        if (box.IsChecked == true)
                        {
                            dockParameter.Add((int)box.Tag, new AgingParameter(para));   //这里需要拷贝一份新的参数
                        }
                    }
                }
            }
            if (OnSaveConfigration != null)
            {
                OnSaveConfigration(this, new ConfigrationArgs(dockParameter));
            }
            this.DialogResult = true;
        }
Exemple #7
0
        private void OnSave(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(tbRate.Text.Trim()) ||
                string.IsNullOrEmpty(tbVolume.Text.Trim()) ||
                string.IsNullOrEmpty(tbCharge.Text.Trim()) ||
                string.IsNullOrEmpty(tbRecharge.Text.Trim()) ||
                cmPumpType.SelectedIndex < 0 ||
                cmOcclusionLevel.SelectedIndex < 0
                )
            {
                MessageBox.Show("请将参数填写完整");
                return;
            }
            string  szCustomPid     = cmPumpType.Items[cmPumpType.SelectedIndex].ToString();
            string  szPressureLevel = cmOcclusionLevel.Items[cmOcclusionLevel.SelectedIndex].ToString();
            decimal rate            = Convert.ToDecimal(float.Parse(tbRate.Text).ToString("F1"));
            decimal volume          = Convert.ToDecimal(float.Parse(tbVolume.Text).ToString("F1"));
            decimal charge          = Convert.ToDecimal(tbCharge.Text);

            CustomProductID  cid     = ProductIDConvertor.Name2CustomProductID(szCustomPid);
            OcclusionLevel   level   = OcclusionLevel.H;
            C9OcclusionLevel c9Level = C9OcclusionLevel.Level3;

            if (cid == CustomProductID.GrasebyC9)
            {
                if (Enum.IsDefined(typeof(C9OcclusionLevel), szPressureLevel))
                {
                    c9Level = (C9OcclusionLevel)Enum.Parse(typeof(C9OcclusionLevel), szPressureLevel);
                }
                else
                {
                    Logger.Instance().ErrorFormat("Configuration::OnSave()->压力转换出错,C9OcclusionLevel={0}", szPressureLevel);
                }
            }
            else
            {
                if (Enum.IsDefined(typeof(OcclusionLevel), szPressureLevel))
                {
                    level = (OcclusionLevel)Enum.Parse(typeof(OcclusionLevel), szPressureLevel);
                }
                else
                {
                    Logger.Instance().ErrorFormat("Configuration::OnSave()->压力转换出错,OcclusionLevel={0}", szPressureLevel);
                }
            }

            decimal        discharge     = 0;
            decimal        recharge      = Convert.ToDecimal(tbRecharge.Text);
            Hashtable      dockParameter = new Hashtable();
            AgingParameter para          = new AgingParameter(szCustomPid,
                                                              rate,
                                                              volume,
                                                              charge,
                                                              discharge,
                                                              recharge,
                                                              level,
                                                              c9Level);

            for (int i = 0; i < otherDockCheckBoxGrid.Children.Count; i++)
            {
                if (otherDockCheckBoxGrid.Children[i] is CheckBox)
                {
                    CheckBox box = otherDockCheckBoxGrid.Children[i] as CheckBox;
                    if (box.IsChecked.HasValue)
                    {
                        if (box.IsChecked == true)
                        {
                            dockParameter.Add((int)box.Tag, new AgingParameter(para));   //这里需要拷贝一份新的参数
                        }
                    }
                }
            }
            if (OnSaveConfigration != null)
            {
                OnSaveConfigration(this, new ConfigrationArgs(dockParameter));
            }
            this.DialogResult = true;
        }