现场测试提交

master
lxw 6 months ago
parent 8e0a780252
commit 7f7a9ad088

@ -237,38 +237,42 @@ public class CloudClient : IMqttClientConnectedHandler, IMqttApplicationMessageR
public void Publish<T>(T data) where T : ICmd
{
Model<T> model = new Model<T>
if (MqttClient.IsConnected)
{
Header = new Header()
Model<T> model = new Model<T>
{
cmd = data.GetCmd(),
cipherFlag = Encrypt,
id = GetIncrementId(),
sid = StationNo,
timeStamp = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000
},
body = data
};
Header = new Header()
{
cmd = data.GetCmd(),
cipherFlag = Encrypt,
id = GetIncrementId(),
sid = StationNo,
timeStamp = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000
},
body = data
};
model.dataSign = "";//SignData(model);
model.dataSign = "";//SignData(model);
var settings = new JsonSerializerSettings()
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
DateFormatString = "yyyy-MM-dd HH:mm:ss",
NullValueHandling = NullValueHandling.Ignore
};
Log.Info(JsonConvert.SerializeObject(model, settings));
var appMsg = new MqttApplicationMessage
{
Topic = PubTopic,
Payload = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(model, settings)),
QualityOfServiceLevel = MqttQualityOfServiceLevel.AtLeastOnce,
Retain = false
};
var settings = new JsonSerializerSettings()
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
DateFormatString = "yyyy-MM-dd HH:mm:ss",
NullValueHandling = NullValueHandling.Ignore
};
Log.Info(JsonConvert.SerializeObject(model, settings));
var appMsg = new MqttApplicationMessage
{
Topic = PubTopic,
Payload = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(model, settings)),
QualityOfServiceLevel = MqttQualityOfServiceLevel.AtLeastOnce,
Retain = false
};
MqttClient.PublishAsync(appMsg);
MqttClient.PublishAsync(appMsg);
MqttClient.PublishAsync(appMsg);
MqttClient.PublishAsync(appMsg);
}
}
private string SignData<T>(Model<T> model) where T : ICmd

@ -57,7 +57,7 @@ public abstract class CloudApi
UploadSwapOrder uploadSwapOrder = new()
{
sn=StaticStationInfo.StationNo,
son = swapOrder.CloudSn,
son = swapOrder.Sn,
cn = swapOrder.VehicleNo,
so = seq,
ct = swapOrder.VehicleEnterTime,

@ -91,7 +91,12 @@ public class TBoxApi
{
Thread.Sleep(100);
var unLockCar = await UnLockCar(carNo);
bools.Add(unLockCar);
if (unLockCar)
{
bools.Add(unLockCar);
}
}
return bools.Select(i => i).Count() > _successTimes;
@ -105,7 +110,11 @@ public class TBoxApi
{
Thread.Sleep(100);
var unLockCar = await LockCar(carNo);
bools.Add(unLockCar);
if (unLockCar)
{
bools.Add(unLockCar);
}
}
return bools.Select(i => i).Count() > _successTimes;

Loading…
Cancel
Save