Exemplo n.º 1
0
        /// <summary>
        /// 执法记录仪移除
        /// </summary>
        /// <param name="deviceCode"></param>
        public static void DevieItemRemove(string deviceCode)
        {
            DeviveInfo deviveInfo = GatherViewModel.DeviveInfoList.Find(p => p.DeviceCode.Equals(deviceCode));

            if (deviveInfo != null)
            {
                GatherViewModel.DeviveInfoList.Remove(deviveInfo);

                MatchWindow matchWindow = WindowsHelper.GetWindow <MatchWindow>();
                if (matchWindow != null && matchWindow.DeviveInfo.DeviceCode.Equals(deviceCode))
                {
                    matchWindow.Close();
                }

                DeviceRegisterWindow registerWindow = WindowsHelper.GetWindow <DeviceRegisterWindow>();
                if (registerWindow != null && registerWindow.DeviveInfo.DeviceCode.Equals(deviceCode))
                {
                    registerWindow.Close();
                }

                HandCollectWindow handCollectWindow = WindowsHelper.GetWindow <HandCollectWindow>();
                if (handCollectWindow != null && handCollectWindow.DeviveInfo.DeviceCode.Equals(deviceCode))
                {
                    handCollectWindow.Close();
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 配对
        /// </summary>
        private void MatchDevice()
        {
            LoginWindow loginWindow = WindowsHelper.ShowDialogWindow <LoginWindow>(parentWindow, PermissionConfig.DeviceMatch, "1");

            if (loginWindow.MessageBoxResult == MessageBoxResult.OK)
            {
                // 防止执法记录仪在验证过程中拔掉
                DeviveInfo selectDevice = GatherViewModel.DeviveInfoList.Find(p => p.DeviceCode.Equals(deviveInfo.DeviceCode));
                if (selectDevice == null)
                {
                    NewMessageBox.Show(string.Format(TryFindResource("GatherDeviceRemove").ToString(), deviveInfo.DeviceCode), parentWindow);
                    return;
                }

                if (AppConfigInfos.LimitsUserInfos.UserType == "1")
                {
                    // 调度员可以帮其他人配对
                    WindowsHelper.ShowDialogWindow <MatchWindow>(parentWindow, deviveInfo);
                }
                else
                {
                    MatchDeviceByNormalPolice();
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 移除面板中的信息
        /// </summary>
        private void RemoveDeviceInfo(IList items)
        {
            foreach (var item in items)
            {
                DeviveInfo deviveInfo = item as DeviveInfo;

                PortIsDevice portIsDevice = AppConfigInfos.PortDeviceList.PortevList.Find(p => p.PortName.Equals(deviveInfo.PortCode));
                if (portIsDevice != null)
                {
                    portIsDevice.IsDeviceInfo = false;
                }

                // 寻找在面板的位置编号
                PortPairInfo portInfo = AppConfigInfos.PortPairInfos.Find(p => p.PortCode.Equals(deviveInfo.PortCode));

                if (portInfo == null)
                {
                    return;
                }

                DeviceInfoItem deviceInfoItem = deviceControls.Find(p => p.Index.ToString().Equals(portInfo.Index));

                if (deviceInfoItem != null)
                {
                    deviceInfoItem.ClearData();
                }
            }
        }
Exemplo n.º 4
0
        private void btnSure_Click(object sender, RoutedEventArgs e)
        {
            tbMsg.Text = string.Empty;

            if (object.Equals(cbTypes.SelectedValue, null))
            {
                tbMsg.Text = TryFindResource("GatherInputDeviceType").ToString();
                return;
            }

            if (string.IsNullOrWhiteSpace(tbPassword.Password))
            {
                tbMsg.Text = TryFindResource("GatherInputPasswrod").ToString();
                return;
            }

            DeviveInfo selectDevice = GatherViewModel.DeviveInfoList.Find(p => p.DeviceCode.Equals(DeviveInfo.DeviceCode));

            if (selectDevice == null)
            {
                NewMessageBox.Show(string.Format(TryFindResource("GatherDeviceRemove").ToString(), DeviveInfo.DeviceCode));
                return;
            }

            Conditions con = new Conditions();

            con.AddItem("UserID", AppConfigInfos.CurrentUserInfos.UserID);
            con.AddItem("DeviceID", DeviveInfo.DeviceCode);
            con.AddItem("DevicePassword", tbPassword.Password);
            con.AddItem("TypeID", cbTypes.SelectedValue.ToString());

            // 发送注册消息
            ResultWindow     resultWindow = WindowsHelper.ShowDialogWindow <ResultWindow>(this, MsgType.DeviceRegister, MsgType.DeviceRegisterResult, con, TryFindResource("GatherRegistering").ToString());
            MessageBoxResult msgBoxResult = resultWindow.MessageBoxResult;

            if (msgBoxResult == MessageBoxResult.Cancel)
            {
                tbMsg.Text = TryFindResource("GatherRegisterOvertime").ToString();
            }
            else if (msgBoxResult == MessageBoxResult.Yes)
            {
                ModelResponsible.Instance.SendOperationLog("CollectDeviceRegister");
                this.Close();
                //NewMessageBox.Show(TryFindResource("GatherRegisterSuccess").ToString(), ModelResponsible.Instance.ParentWindow);
            }
            else if (msgBoxResult == MessageBoxResult.No)
            {
                DeviceRegisterInfo deviceRegisterInfo = resultWindow.ResultValue as DeviceRegisterInfo;
                if (deviceRegisterInfo != null)
                {
                    string msg = (TryFindResource("GatherDeviceRegisterError_" + deviceRegisterInfo.ResultCode) ?? string.Empty).ToString();

                    tbMsg.Text = msg;
                }
                else
                {
                    tbMsg.Text = TryFindResource("GatherRegisterFailed").ToString();
                }
            }
        }
Exemplo n.º 5
0
        public HandCollectWindow(DeviveInfo deviveInfo)
            : this()
        {
            this.DeviveInfo = deviveInfo;

            tbCode.Text          = deviveInfo.DeviceCode;
            autoCmb.TextChanged += autoCmb_TextChanged;
        }
Exemplo n.º 6
0
        public MatchWindow(DeviveInfo deviveInfo)
            : this()
        {
            this.DeviveInfo = deviveInfo;

            tbCode.Text          = deviveInfo.DeviceCode;
            autoCmb.TextChanged += autoCmb_TextChanged;
            isPair = DeviveInfo.IsMatchOrRegist == IsMatchOrRegist.Registered;
        }
Exemplo n.º 7
0
        /// <summary>
        /// 更新执法记录仪采集状态
        /// </summary>
        /// <param name="devID"></param>
        /// <param name="deviceState"></param>
        public static void DeviceCollectInfo(string devID, DeviceState deviceState)
        {
            DeviveInfo deviveInfo = GatherViewModel.DeviveInfoList.Find(p => p.DeviceCode.Equals(devID));

            if (deviveInfo != null)
            {
                deviveInfo.DeviceState = deviceState;
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// 修改执法记录仪注册信息
        /// </summary>
        /// <param name="deviceRegisterInfo"></param>
        public static void DeviceRegisterInfo(DeviceRegisterInfo deviceRegisterInfo)
        {
            DeviveInfo deviveInfo = GatherViewModel.DeviveInfoList.Find(p => p.DeviceCode.Equals(deviceRegisterInfo.DeviceCode ?? String.Empty));

            if (deviveInfo != null)
            {
                deviveInfo.IsMatchOrRegist = IsMatchOrRegist.Registered;
                deviveInfo.DeviceID        = (deviceRegisterInfo.DeviceID ?? string.Empty).ToString();
            }
        }
Exemplo n.º 9
0
 /// <summary>
 /// 执法记录仪更新记录仪电量、采集进度、采集状态更新
 /// </summary>
 /// <param name="deviceInfos"></param>
 public static void DeviceInfoUpdate(UpdateDeviceInfos deviceInfos)
 {
     foreach (var item in deviceInfos.DeviveInfoList)
     {
         DeviveInfo deviveInfo = GatherViewModel.DeviveInfoList.Find(p => p.DeviceCode.Equals(item.DeviceCode));
         if (deviveInfo != null)
         {
             // 更新
             item.ValueCloneToObjectExceptNull(deviveInfo);
         }
     }
 }
Exemplo n.º 10
0
        /// <summary>
        /// 取消执法记录仪配对
        /// </summary>
        /// <param name="deviceCode"></param>
        public static void DeviceCancelPair(string deviceCode)
        {
            DeviveInfo deviveInfo = GatherViewModel.DeviveInfoList.Find(p => p.DeviceCode.Equals(deviceCode));

            if (deviveInfo != null)
            {
                deviveInfo.MatchUserID     = string.Empty;
                deviveInfo.MatchUserName   = string.Empty;
                deviveInfo.OrgID           = string.Empty;
                deviveInfo.MatchUserCode   = string.Empty;
                deviveInfo.MatchOrgName    = string.Empty;
                deviveInfo.MatchTime       = string.Empty;
                deviveInfo.IsMatchOrRegist = IsMatchOrRegist.Registered;
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// 绑定UI信息
 /// </summary>
 /// <param name="deviveInfo"></param>
 public void BingData(DeviveInfo deviveInfo, Window parentWindow)
 {
     this.parentWindow = parentWindow;
     this.deviveInfo   = deviveInfo;
     this.DataContext  = deviveInfo;
     this.SetBinding(DeviceInfoItem.DeviceStateProperty, new Binding("DeviceState")
     {
         Source = deviveInfo
     });
     this.SetBinding(DeviceInfoItem.IsMatchOrRegistProperty, new Binding("IsMatchOrRegist")
     {
         Source = deviveInfo
     });
     HasDevice = true;
 }
Exemplo n.º 12
0
        /// <summary>
        /// 更新配对信息
        /// </summary>
        /// <param name="devicePairInfo"></param>
        public static void DevicePairInfo(DevicePairInfo devicePairInfo)
        {
            DeviveInfo deviveInfo = GatherViewModel.DeviveInfoList.Find(p => p.DeviceCode.Equals(devicePairInfo.DeviceID));

            if (deviveInfo != null)
            {
                deviveInfo.MatchUserID     = devicePairInfo.UserID;
                deviveInfo.MatchUserName   = devicePairInfo.UserName;
                deviveInfo.OrgID           = devicePairInfo.OrgID;
                deviveInfo.MatchUserCode   = devicePairInfo.UserCode;
                deviveInfo.MatchOrgName    = devicePairInfo.OrgName;
                deviveInfo.MatchTime       = devicePairInfo.MatchTime;
                deviveInfo.IsMatchOrRegist = IsMatchOrRegist.Matched;
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// 注册
        /// </summary>
        private void RgisterDevice()
        {
            LoginWindow loginWindow = WindowsHelper.ShowDialogWindow <LoginWindow>(parentWindow, PermissionConfig.DeviceRegister, "0");

            if (loginWindow.MessageBoxResult == MessageBoxResult.OK)
            {
                DeviveInfo selectDevice = GatherViewModel.DeviveInfoList.Find(p => p.DeviceCode.Equals(deviveInfo.DeviceCode));
                if (selectDevice == null)
                {
                    NewMessageBox.Show(string.Format(TryFindResource("GatherDeviceRemove").ToString(), deviveInfo.DeviceCode));
                    return;
                }

                WindowsHelper.ShowDialogWindow <DeviceRegisterWindow>(parentWindow, deviveInfo);
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// 开始采集
        /// </summary>
        private void CollectOpertion(string permissionID, string disContent, string overTimeMsg, MsgType sendMsgType, MsgType receiveMsgType, string failedMsg)
        {
            LoginWindow loginWindow = WindowsHelper.ShowDialogWindow <LoginWindow>(parentWindow, permissionID, "1");

            if (loginWindow.MessageBoxResult != MessageBoxResult.OK)
            {
                return;
            }

            // 防止执法记录仪在验证过程中拔掉
            DeviveInfo selectDevice = GatherViewModel.DeviveInfoList.Find(p => p.DeviceCode.Equals(deviveInfo.DeviceCode));

            if (selectDevice == null)
            {
                NewMessageBox.Show(string.Format(TryFindResource("GatherDeviceRemove").ToString(), deviveInfo.DeviceCode), parentWindow);
                return;
            }

            if (AppConfigInfos.LimitsUserInfos.UserType == "1")
            {
                WindowsHelper.ShowDialogWindow <HandCollectWindow>(parentWindow, deviveInfo);
            }
            else
            {
                Conditions con = new Conditions();
                con.AddItem("DeviceID", deviveInfo.DeviceCode);
                con.AddItem("UserID", AppConfigInfos.LimitsUserInfos.UserID);

                ResultWindow     resultWindow = WindowsHelper.ShowDialogWindow <ResultWindow>(parentWindow, sendMsgType, receiveMsgType, con, disContent);
                MessageBoxResult msgBoxResult = resultWindow.MessageBoxResult;
                if (msgBoxResult == MessageBoxResult.Cancel)
                {
                    NewMessageBox.Show(overTimeMsg, parentWindow);
                }
                else if (msgBoxResult == MessageBoxResult.No)
                {
                    NewMessageBox.Show(failedMsg, parentWindow);
                }
                else
                {
                    // 操作日志
                    string code = "CollectHandGather";

                    ModelResponsible.Instance.SendOperationLog(code);
                }
            }
        }
Exemplo n.º 15
0
 /// <summary>
 /// 执法记录仪信息更新或者添加
 /// </summary>
 /// <param name="deviceInfos"></param>
 public static void DeviceInfoAddOrUpdate(DeviceInfos deviceInfos)
 {
     foreach (var item in deviceInfos.DeviveInfoList)
     {
         DeviveInfo deviveInfo = GatherViewModel.DeviveInfoList.Find(p => p.DeviceCode.Equals(item.DeviceCode));
         if (deviveInfo == null)
         {
             // 添加
             GatherViewModel.DeviveInfoList.AddItem(item);
         }
         else
         {
             // 更新
             item.ValueCloneToObject(deviveInfo);
         }
     }
 }
Exemplo n.º 16
0
 public DeviceRegisterWindow(DeviveInfo deviveInfo)
 {
     InitializeComponent();
     this.DeviveInfo = deviveInfo;
 }
Exemplo n.º 17
0
        /// <summary>
        /// 配对
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnMatch_Click(object sender, RoutedEventArgs e)
        {
            tbMsg.Text = string.Empty;
            btnCanelMatch.Visibility = Visibility.Hidden;

            if ((DeviveInfo.IsMatchOrRegist == IsMatchOrRegist.Registered &&
                 string.IsNullOrEmpty(autoCmb.SelectValue)) ||
                (DeviveInfo.IsMatchOrRegist == IsMatchOrRegist.Matched &&
                 !string.IsNullOrEmpty(autoCmb.Text) &&
                 string.IsNullOrEmpty(autoCmb.SelectValue)))
            {
                tbMsg.Text = TryFindResource("GatherPairInfoError").ToString();
                return;
            }

            DeviveInfo selectDevice = GatherViewModel.DeviveInfoList.Find(p => p.DeviceCode.Equals(DeviveInfo.DeviceCode));

            if (selectDevice == null)
            {
                NewMessageBox.Show(string.Format(TryFindResource("GatherDeviceRemove").ToString(), DeviveInfo.DeviceCode));
                return;
            }

            if (DeviveInfo.IsMatchOrRegist == IsMatchOrRegist.Matched && DeviveInfo.MatchUserID.Equals(autoCmb.SelectValue))
            {
                NewMessageBox.Show(TryFindResource("GatherPairInfoNoChange").ToString());
                // 编辑配对如果用户没有选择其他用户点击配置,则直接结束
                this.Close();
                return;
            }

            Conditions con = new Conditions();

            if (!string.IsNullOrEmpty(autoCmb.SelectValue))
            {
                // 配对
                UserInfos matchUserInfo = AppConfigInfos.LimitsUserInfos.Users.UserList.Find(p => p.UserID.Equals(autoCmb.SelectValue));

                con.AddItem("UserID", autoCmb.SelectValue);
                con.AddItem("DeviceID", DeviveInfo.DeviceCode);
                con.AddItem("UserName", matchUserInfo == null ? string.Empty : matchUserInfo.UserName);
                con.AddItem("UserCode", matchUserInfo == null ? string.Empty : matchUserInfo.UserCode);
                con.AddItem("OrgID", matchUserInfo == null ? string.Empty : matchUserInfo.OrgID);
                con.AddItem("OrgName", matchUserInfo == null ? string.Empty : matchUserInfo.OrgName);
                con.AddItem("ForceMatch", "0"); // 调度员没有取消后再配对协议
            }
            else
            {
                // 选择为空的则为取消配对
                CancelMatch(DeviveInfo.DeviceCode, (DeviveInfo.DeviceID ?? string.Empty).ToString());
                this.Close();
                return;
            }

            // 发送配对消息
            ResultWindow     resultWindow = WindowsHelper.ShowDialogWindow <ResultWindow>(this, MsgType.DevicePair, MsgType.DevicePairResult, con, TryFindResource("GatherPairing").ToString());
            MessageBoxResult msgBoxResult = resultWindow.MessageBoxResult;

            if (msgBoxResult == MessageBoxResult.Cancel)
            {
                tbMsg.Text = TryFindResource("GatherPairOverTime").ToString();
            }
            else if (msgBoxResult == MessageBoxResult.Yes)
            {
                if (isPair)
                {
                    ModelResponsible.Instance.SendOperationLog("CollectDevicePair");
                }
                else
                {
                    ModelResponsible.Instance.SendOperationLog("CollectDeviceEditor");
                }

                this.Close();
            }
            else if (msgBoxResult == MessageBoxResult.No)
            {
                DevicePairInfo devicePairInfo = resultWindow.ResultValue as DevicePairInfo;
                if (devicePairInfo.ResultCode == 2)
                {
                    // 已配对
                    tbMsg.Text = string.Format(TryFindResource("GatherPairMarkStart").ToString(), devicePairInfo.ResultMsg);
                    btnCanelMatch.Visibility = Visibility.Visible;
                    btnCanelMatch.Tag        = devicePairInfo.ResultMsg + "," + devicePairInfo.DeviceID; // 记录已配对DeviceCode
                }
                else
                {
                    string msg = (TryFindResource("GatherPairCode_" + devicePairInfo.ResultCode) ?? string.Empty).ToString();
                    msg        = string.IsNullOrEmpty(msg) ? TryFindResource("GatherPairCode_-1").ToString() : msg;
                    tbMsg.Text = msg;
                }
            }
        }
Exemplo n.º 18
0
 /// <summary>
 /// 清除信息
 /// </summary>
 public void ClearData()
 {
     HasDevice        = false;
     deviveInfo       = null;
     this.DataContext = null;
 }