# /api/open/getdevinfo

- 设备类型转换
This commit is contained in:
李鹏鹏 2025-02-11 15:42:05 +08:00
parent ae0310a514
commit 4c03b94808
1 changed files with 11 additions and 2 deletions

View File

@ -446,6 +446,15 @@ namespace Waste.Application.ThirdApiInfo
else if (type == "其他垃圾") return 4;
else return 0;
}
private string TrashTypeTitle(string type)
{
if (!int.TryParse(type, out var num)) return type;
if (num == 1) return "厨余垃圾";
else if (num == 2) return "可回收物";
else if (num == 3) return "有害垃圾";
else if (num == 4) return "其他垃圾";
else return "0";
}
private int GetTimestamp(DateTime time)
{
@ -585,7 +594,7 @@ namespace Waste.Application.ThirdApiInfo
ResultId = returndata.ResultId,
Tare = device.Tare,
trash = returndata.trash,
wastetype = type,
wastetype = TrashTypeTitle(type),
weight = weight
});
@ -596,7 +605,7 @@ namespace Waste.Application.ThirdApiInfo
WasteSType = "",
Time = DateTime.Now,
TrashCode = returndata.trash,
WasteType = type,
WasteType = TrashTypeTitle(type),
Weight = weight.ToDecimal(),
faccode = device.FacEcode,
ecode = device.Ecode,