1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using Library;
- using LitJson;
- namespace MySystem
- {
- public class ReceiveTaskService
- {
- public readonly static ReceiveTaskService Instance = new ReceiveTaskService();
- private ReceiveTaskService()
- { }
- public void Start(JobMqMsg jobInfo)
- {
- string content = "";
- try
- {
- string OrderString = jobInfo.OrderString;
- string Msg = "";
- if (OrderString.StartsWith("Ap:") && OrderString.EndsWith(":Sycn"))
- {
- string Table = OrderString.Split(':')[1];
- switch (Table)
- {
- case "MsgPersonal":
- Msg = MsgPersonalHelper.Instance.Start();
- break;
- case "MsgPlacardRead":
- Msg = MsgPlacardReadHelper.Instance.Start();
- break;
- }
- }
- if (!string.IsNullOrEmpty(Msg))
- {
- jobInfo.Status = Msg == "success" ? 1 : 0;
- jobInfo.Msg = Msg == "success" ? "执行完成" : Msg;
- RabbitMQClient.Instance.SendMsg(Newtonsoft.Json.JsonConvert.SerializeObject(jobInfo), "PublicBack");
- }
- else
- {
- RedisDbconn.Instance.AddList("BsPopWaitList", Newtonsoft.Json.JsonConvert.SerializeObject(jobInfo));
- }
- }
- catch (Exception ex)
- {
- if (!string.IsNullOrEmpty(content))
- {
- Dictionary<string, string> data = new Dictionary<string, string>();
- data.Add("ErrTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
- data.Add("ErrMsg", ex.ToString());
- function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(data), "public_err");
- }
- else
- {
- function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "public_service");
- }
- }
- }
- }
- }
|