优化终端日历时钟解析

This commit is contained in:
zenghongyao 2025-05-08 17:20:07 +08:00
parent 75efbb3a36
commit 1a9d3924b0
4 changed files with 11 additions and 6 deletions

View File

@ -6,6 +6,8 @@ using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging;
using static System.Runtime.InteropServices.JavaScript.JSType;
using System.Diagnostics.Metrics;
namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
{
@ -71,7 +73,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
{
await _analysisStrategyContext.ExecuteAsync<List<string>>(nameof(Appendix_A1), arr, (value) =>
{
dto.DataValue = value;
var data = (Tuple<string, string>)value;
dto.DataValue = $"{data.Item1} {data.Item2}";
});
}
dto.DataType = dataType;

View File

@ -54,7 +54,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
dto.DataValue = value;
}
dto.DataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}_{DataType[i]}";
dto.FiledName = DataType[i].GetDataFieldByGatherDataType() ?? string.Empty;
dto.FiledName = dto.DataType.GetDataFieldByGatherDataType() ?? string.Empty;
dto.FiledDesc= remarks[i];
list.Add(dto);
}

View File

@ -21,10 +21,13 @@ namespace JiShe.CollectBus.Protocol.T37612012.Appendix
var day = data[3];
string binString = data[4].HexTo4BinZero();
var months = (binString.Substring(3, 1).BinToDec() * 10) + Convert.ToInt32(binString.Substring(4, 4).BinToHex());
var week = binString.Substring(0, 3).HexTo4BinZero();
var week = binString.Substring(0, 3).BinToHex();
var year = $"{DateTime.Now.ToString("yyyy").Substring(0, 2)}{data[5]}";
string date= $"{year}-{months.ToString().PadLeft(2, '0')}-{day} {hours}:{minutes}:{seconds}_{week}";
result?.Invoke(date);
string date= $"{year}-{months.ToString().PadLeft(2, '0')}-{day} {hours}:{minutes}:{seconds}";
string[] weekdays = {"", "星期一", "星期二", "星期三","星期四", "星期五", "星期六", "星期日"};
int.TryParse(week, out int weekday);
// Item1=日期Item2=星期几
result?.Invoke(Tuple.Create(date, weekdays[weekday]));
return await Task.FromResult(true);
}

View File

@ -16,7 +16,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="libs/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<title>后端服务</title>
</head>
<body>