Пример #1
0
 /// <summary>
 /// 接受到轴号卡
 /// </summary>
 /// <param name="json"></param>
 public void AxisRfidAccpet(string json)
 {
     try {
         MqAxisRfid mqRfid = JsonConvert.DeserializeObject <MqAxisRfid>(json);
         //机台校验
         if (!MachineConfig.HmiName.ToUpper().Contains(mqRfid.macCode.ToUpper()))
         {
             return;
         }
         DMesActions.RfidType type = DMesActions.RfidType.Unknown;
         if (mqRfid.msgType == MqRfidType.AxisStart)
         {
             type = DMesActions.RfidType.StartAxis;
         }
         else if (mqRfid.msgType == MqRfidType.AxisEnd)
         {
             type = DMesActions.RfidType.EndAxis;
         }
         App.Store.Dispatch(new DMesActions.RfidAccpet(mqRfid.macCode, mqRfid.rfids,
                                                       DMesActions.RfidWhere.FromMq, type, mqRfid));
     } catch (Exception e) {
         Logger.Error($"线盘卡Rfid反序列化异常,json数据为 : {json}", e);
         App.Store.Dispatch(new SysActions.ShowNotification(new SysNotificationMsg()
         {
             Title   = "系统错误",
             Content = "线盘Rfid 数据反序列化有误",
             Level   = NotifyLevel.Error
         }));
     }
 }
Пример #2
0
 /// <summary>
 /// 接受到rfid数据
 /// </summary>
 /// <param name="json"></param>
 public void EmpRfidAccept(string json)
 {
     try {
         MqEmpRfid mqRfid = JsonConvert.DeserializeObject <MqEmpRfid>(json);
         //机台校验
         if (!MachineConfig.HmiName.ToUpper().Contains(mqRfid.macCode))
         {
             return;
         }
         //设置打卡时间
         mqRfid.PrintTime = DateTime.Now;
         DMesActions.RfidType type = DMesActions.RfidType.Unknown;
         if (mqRfid.type == MqRfidType.EmpStartMachine)
         {
             type = DMesActions.RfidType.EmpStartMachine;
         }
         else if (mqRfid.type == MqRfidType.EmpEndMachine)
         {
             type = DMesActions.RfidType.EmpEndMachine;
         }
         else if (mqRfid.type == MqRfidType.EmpStartWork)
         {
             type = DMesActions.RfidType.EmpStartWork;
         }
         else if (mqRfid.type == MqRfidType.EmpEndWork)
         {
             type = DMesActions.RfidType.EmpEndWork;
         }
         App.Store.Dispatch(new DMesActions.RfidAccpet(mqRfid.macCode, mqRfid.employeeCode,
                                                       DMesActions.RfidWhere.FromMq, type, mqRfid));
     } catch (Exception e) {
         Logger.Error($"人员Rfid反序列化异常,json数据为 : {json}", e);
         App.Store.Dispatch(new SysActions.ShowNotification(new SysNotificationMsg()
         {
             Title   = "系统错误",
             Content = "人员Rfid 数据反序列化有误",
             Level   = NotifyLevel.Error
         }));
     }
 }