Beispiel #1
0
        /// <summary>
        /// 汽车衡终端关注维护后坐席主页面的处理
        /// </summary>
        /// <param name="wcau"></param>
        private void OperateCarMeasure(WeightClientAttentionUpholdView wcau)
        {
            RemoteCarMeasureViewModel rcmvm = this.DataContext as RemoteCarMeasureViewModel;
            var notCheckedAttionsIds        = (from r in wcau.Attentions where r.IsChecked == false select r.equcode).ToList();
            var checkedAttentions           = (from r in wcau.Attentions where r.IsChecked == true select r).ToList();
            var removeClients = (from r in rcmvm.CarWeighterClientInfos where notCheckedAttionsIds.Contains(r.ClientId) select r).ToList();

            foreach (var item in removeClients)
            {
                rcmvm.CarWeighterClientInfos.Remove(item); //在已有的称点信息中删除未选中的称点
            }
            foreach (var item in checkedAttentions)        //将新添加的称点添加到集合里
            {
                var list = (from r in rcmvm.CarWeighterClientInfos where r.ClientId == item.equcode select r).ToList();
                if (list == null || list.Count == 0)
                {
                    rcmvm.CarWeighterClientInfos.Add(new WeighterClientModel()
                    {
                        ClientId = item.equcode, LeftLightState = LeftLightStates.None, RightLightState = RightLightStates.None, ClientState = WeighterStates.None, ClientName = item.equname, Weight = 0, LeftLine = Visibility.Hidden, RightLine = Visibility.Hidden, ClientConfigName = item.equcode + "_" + item.equname + ".xml"
                    });
                }
            }
            rcmvm.CarWeighterClientInfos = rcmvm.CarWeighterClientInfos.OrderBy(r => Int32.Parse(r.ClientId.Substring(1))).ToList();
            //任务服务器断开然后重新连接
            SocketCls.Emit(ClientSendCmdEnum.logout, ""); //断开与任务服务器的连接
            rcmvm.LoginOut();                             //与任务服务器断开连接后的相关业务处理
            rcmvm.relogin();                              //重新登录时,会将称点关注改变后的称点ID集合发送给任务服务器。
            ConfigSynchronous(checkedAttentions);
        }
Beispiel #2
0
        /// <summary>
        /// 称点关注按钮事件
        /// </summary>
        private void AttentionsButton_Click(object sender, RoutedEventArgs e)
        {
            //if (!checkRemoteP.CheckIsAllowUse(CheckRemotePower.ButtonMemuEnum.gzzd))
            //{
            //    ShowMessage("无关注秤点权限");
            //    return;
            //}
            AttentionTypes at = AttentionTypes.CarMeasure;

            if (weightTabControl.SelectedIndex == 1)
            {
                at = AttentionTypes.TrainMeasure;
            }
            else if (weightTabControl.SelectedIndex == 2)
            {
                at = AttentionTypes.MoltenIron;
            }
            bool isOpen = formHClass.SetForeWindow("智能化远程集中计量管理系统(关注秤点)");

            if (!isOpen)
            {
                if (weightClientAttentionUpholdView == null)
                {
                    weightClientAttentionUpholdView         = new WeightClientAttentionUpholdView(at);
                    weightClientAttentionUpholdView.Closed += (s1, e1) => { weightClientAttentionUpholdView = null; };
                    weightClientAttentionUpholdView.ShowDialog();
                }
                else
                {
                    weightClientAttentionUpholdView.Activate();
                    weightClientAttentionUpholdView.ShowDialog();
                }

                if (weightClientAttentionUpholdView != null && weightClientAttentionUpholdView.FormState == 1)
                {
                    if (at == AttentionTypes.CarMeasure)
                    {
                        OperateCarMeasure(weightClientAttentionUpholdView);
                    }
                    else if (at == AttentionTypes.MoltenIron)
                    {
                    }
                }
            }
        }