diff --git a/Waste.Application/ThirdApiInfo/OpenService.cs b/Waste.Application/ThirdApiInfo/OpenService.cs index 61601f3..4a3e8f7 100644 --- a/Waste.Application/ThirdApiInfo/OpenService.cs +++ b/Waste.Application/ThirdApiInfo/OpenService.cs @@ -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,