|
|
@@ -0,0 +1,65 @@
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Data;
|
|
|
+using System.Linq;
|
|
|
+using System.Threading;
|
|
|
+using MySystem.PxcModels;
|
|
|
+using Library;
|
|
|
+using LitJson;
|
|
|
+
|
|
|
+namespace MySystem
|
|
|
+{
|
|
|
+ /// <summary>
|
|
|
+ /// 设置机具费率标记并推送消息
|
|
|
+ /// </summary>
|
|
|
+ public class SetLklFeeService
|
|
|
+ {
|
|
|
+ public readonly static SetLklFeeService Instance = new SetLklFeeService();
|
|
|
+ private SetLklFeeService()
|
|
|
+ { }
|
|
|
+
|
|
|
+ public void Start()
|
|
|
+ {
|
|
|
+ Thread th = new Thread(doSomething);
|
|
|
+ th.IsBackground = true;
|
|
|
+ th.Start();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void doSomething()
|
|
|
+ {
|
|
|
+ while (true)
|
|
|
+ {
|
|
|
+ string content = RedisDbconn.Instance.RPop<string>("SetLklFeeQueue");
|
|
|
+ if (!string.IsNullOrEmpty(content))
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ string[] arr = content.Split('|');
|
|
|
+ string MerNo = arr[0];
|
|
|
+ string Fee = arr[1];
|
|
|
+ string addRate = arr[2];
|
|
|
+ string back = PublicImportDataService.Instance.LkLSetFee(MerNo, decimal.Parse(Fee), int.Parse(addRate));
|
|
|
+ JsonData obj = JsonMapper.ToObject(back);
|
|
|
+ if (obj["message"].ToString() == "SUCCESS")
|
|
|
+ {
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ string msg = obj["message"].ToString();
|
|
|
+ }
|
|
|
+ Thread.Sleep(1000);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ Utils.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "单独设置拉卡拉费率异常");
|
|
|
+ Thread.Sleep(60000);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Thread.Sleep(60000);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|