新增洗车机推送接口,查询洗车机列表,查询历史记录列表,地磅推送列表,清洁运输展示列表
This commit is contained in:
parent
db7444c365
commit
2dd3a1b18c
|
|
@ -14,10 +14,12 @@ namespace langguanApi.Controllers
|
|||
{
|
||||
private TransportService _transportService;
|
||||
private WasherService _washerService;
|
||||
public TransportController(TransportService transportService, WasherService washerService)
|
||||
private TruckScalesService _truckScalesService;
|
||||
public TransportController(TransportService transportService, WasherService washerService, TruckScalesService truckScalesService)
|
||||
{
|
||||
_transportService = transportService;
|
||||
_washerService = washerService;
|
||||
_truckScalesService = truckScalesService;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取清洁运输列表
|
||||
|
|
@ -53,33 +55,68 @@ namespace langguanApi.Controllers
|
|||
}
|
||||
|
||||
#region 洗车机
|
||||
|
||||
/// <summary>
|
||||
/// 新增洗车机
|
||||
/// 推送洗车机列表(洗车机列表和洗车机记录组合在一起)
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("addwasher")]
|
||||
public async Task<IActionResult> AddWasher(AddWasher input)
|
||||
[HttpPost("addwasherlist")]
|
||||
public async Task<IActionResult> AddWasherList(List<AddWasher> input)
|
||||
{
|
||||
await _washerService.addWasher(input);
|
||||
return Ok(new ApiResult() { code = 0 });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增洗车机历史记录
|
||||
/// 获取洗车机列表
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("addwasherhistory")]
|
||||
public async Task<IActionResult> AddWasherHistory(AddWasherHistory input)
|
||||
[HttpGet("washerList")]
|
||||
public async Task<IActionResult> WasherList()
|
||||
{
|
||||
await _washerService.AddWasherHistory(input);
|
||||
return Ok(new ApiResult() { code = 0 });
|
||||
var result = await _washerService.getWasherList();
|
||||
return Ok(result);
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取洗车机历史记录(起始时间和结束时间非空,根据起始时间和结束时间筛选数据,如果为空,默认获取30条数据)
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("washerhistorylist")]
|
||||
public async Task<IActionResult> WasherHistoryList([FromQuery] transportReqPage input)
|
||||
{
|
||||
var result = await _washerService.WasherHistoryList(input);
|
||||
return Ok(result);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 地磅
|
||||
/// <summary>
|
||||
/// 推送地磅列表
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("addruckscaleslist")]
|
||||
public async Task<IActionResult> AddRuckScalesList(List<AddTruckScalesDto> input)
|
||||
{
|
||||
await _truckScalesService.AddTruckScalesList(input);
|
||||
return Ok(new ApiResult() { code = 0 });
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 清洁运输
|
||||
/// <summary>
|
||||
/// 获取清洁运输(门禁和地磅组合,地磅获取总重量,后期会用地磅重量-车辆车辆)
|
||||
/// </summary>
|
||||
/// <param name="reqPage"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("gettransport")]
|
||||
public async Task<IActionResult> GetTransport([FromQuery] transportReqPage reqPage)
|
||||
{
|
||||
var result = await _transportService.GetTransport(reqPage);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
namespace langguanApi.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// 清洁运输展示信息
|
||||
/// </summary>
|
||||
public class CleanTransportationDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 车牌号
|
||||
/// </summary>
|
||||
public string CarNumber { get; set; }
|
||||
/// <summary>
|
||||
/// 车牌颜色
|
||||
/// </summary>
|
||||
public string CarColor { get; set; }
|
||||
/// <summary>
|
||||
/// 运输量
|
||||
/// </summary>
|
||||
public double Weight { get; set; }
|
||||
/// <summary>
|
||||
/// 通过时间
|
||||
/// </summary>
|
||||
public string Time { get; set; }
|
||||
/// <summary>
|
||||
/// 车牌类型
|
||||
/// </summary>
|
||||
public string CarType { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -9,4 +9,12 @@
|
|||
{
|
||||
public string key { get; set; } = "";
|
||||
}
|
||||
|
||||
public class transportReqPage : ReqPaing
|
||||
{
|
||||
//开始时间
|
||||
public string startTime { get; set; } = "";
|
||||
//结束时间
|
||||
public string endTime { get; set; } = "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,10 @@
|
|||
/// 有效期限
|
||||
/// </summary>
|
||||
public string ValidityPeriod { get; set; }
|
||||
/// <summary>
|
||||
/// 出入场时间
|
||||
/// </summary>
|
||||
public DateTime Time { get; set; }
|
||||
|
||||
}
|
||||
public class AddTransport
|
||||
|
|
@ -120,4 +124,18 @@
|
|||
/// </summary>
|
||||
public string ValidityPeriod { get; set; }
|
||||
}
|
||||
|
||||
public class TransportDto : Transport
|
||||
{
|
||||
public string CarColorString { get; set; }
|
||||
}
|
||||
public enum CarColor
|
||||
{
|
||||
蓝色 = 1,
|
||||
绿色 = 2,
|
||||
黄色 = 3,
|
||||
白色 = 4,
|
||||
黑色 = 5,
|
||||
黄绿 = 6
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
namespace langguanApi.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// 地磅
|
||||
/// </summary>
|
||||
public class TruckScales :BaseModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 重量
|
||||
/// </summary>
|
||||
public double Weight { get; set; }
|
||||
/// <summary>
|
||||
/// 货物类型
|
||||
/// </summary>
|
||||
public string GoodsType { get; set; }
|
||||
/// <summary>
|
||||
/// 车牌
|
||||
/// </summary>
|
||||
public string CarNumber { get; set; }
|
||||
/// <summary>
|
||||
/// 时间
|
||||
/// </summary>
|
||||
public string DTime { get; set; }
|
||||
|
||||
}
|
||||
public class AddTruckScalesDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 重量
|
||||
/// </summary>
|
||||
public string Weight { get; set; }
|
||||
/// <summary>
|
||||
/// 货物类型
|
||||
/// </summary>
|
||||
public string GoodsType { get; set; }
|
||||
/// <summary>
|
||||
/// 车牌
|
||||
/// </summary>
|
||||
public string CarNumber { get; set; }
|
||||
/// <summary>
|
||||
/// 时间
|
||||
/// </summary>
|
||||
public string DTime { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -70,11 +70,13 @@
|
|||
public int Time { get; set; }
|
||||
//设备状态(State 0表示异常,1表示正常)
|
||||
public int State { get; set; }
|
||||
/// <summary>
|
||||
/// 洗车机编码
|
||||
/// </summary>
|
||||
public string EquipmentId { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加洗车机
|
||||
/// </summary>
|
||||
|
||||
public class AddWasher
|
||||
{
|
||||
/// <summary>
|
||||
|
|
@ -131,13 +133,98 @@
|
|||
/// </summary>
|
||||
public double WaterPressure { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 运行时间(RunTime)
|
||||
/// </summary>
|
||||
public string RunTime { get; set; }
|
||||
/// <summary>
|
||||
/// 清洗记录时间(RecodeTime)
|
||||
/// </summary>
|
||||
public string RecodeTime { get; set; }
|
||||
//车牌号(CarNumber)
|
||||
public string CarNumber { get; set; }
|
||||
//清洗时间(Time 单位s)
|
||||
public int Time { get; set; }
|
||||
//设备状态(State 0表示异常,1表示正常)
|
||||
public int State { get; set; }
|
||||
/// <summary>
|
||||
/// 洗车机编码
|
||||
/// </summary>
|
||||
public string EquipmentId { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加洗车机
|
||||
/// </summary>
|
||||
public class GetWasherDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 洗车机名称(Name)
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// 设备状态(EquipmentStatus,0表示异常,1表示正常)
|
||||
/// </summary>
|
||||
public string EquipmentStatusString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 运行状态(RunStatus,0表示异常,1表示正常)
|
||||
/// </summary>
|
||||
public string RunStatusString { get; set; }
|
||||
/// <summary>
|
||||
/// 水压报警(WPAlarm 0表示异常,1表示正常)
|
||||
/// </summary>
|
||||
public string WPAlarmString { get; set; }
|
||||
/// <summary>
|
||||
/// 相序报警(PSAlarm0表示异常,1表示正常)
|
||||
/// </summary>
|
||||
public string PSAlarmString { get; set; }
|
||||
/// <summary>
|
||||
/// 故障报警(FaultAlarm 0表示异常,1表示正常)
|
||||
/// </summary>
|
||||
public string FaultAlarmString { get; set; }
|
||||
/// <summary>
|
||||
/// 冲洗压力
|
||||
/// </summary>
|
||||
public double RinsePressure { get; set; }
|
||||
/// <summary>
|
||||
/// 冲洗电流
|
||||
/// </summary>
|
||||
public double RinseCurrent { get; set; }
|
||||
/// <summary>
|
||||
/// 冲洗电压(RinseVoltage 单位V)
|
||||
/// </summary>
|
||||
public double RinseVoltage { get; set; }
|
||||
/// <summary>
|
||||
/// 水流量(Discharge 单位T)
|
||||
/// </summary>
|
||||
public double Discharge { get; set; }
|
||||
/// <summary>
|
||||
/// 电量(Electricity KW/H)
|
||||
/// </summary>
|
||||
public double Electricity { get; set; }
|
||||
/// <summary>
|
||||
/// 电流(Current A)
|
||||
/// </summary>
|
||||
public double Current { get; set; }
|
||||
/// <summary>
|
||||
/// 水压(WaterPressure MPa)
|
||||
/// </summary>
|
||||
public double WaterPressure { get; set; }
|
||||
/// <summary>
|
||||
/// 洗车机编码
|
||||
/// </summary>
|
||||
public string EquipmentId { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 添加洗车机历史
|
||||
/// </summary>
|
||||
public class AddWasherHistory
|
||||
public class WasherHistoryDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 洗车机编码
|
||||
/// </summary>
|
||||
public string EquipmentId { get; set; }
|
||||
/// <summary>
|
||||
/// 运行时间(RunTime)
|
||||
/// </summary>
|
||||
|
|
@ -155,8 +242,7 @@
|
|||
public string Name { get; set; }
|
||||
|
||||
//设备状态(State 0表示异常,1表示正常)
|
||||
public int State { get; set; }
|
||||
|
||||
public string StateString { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,10 @@ namespace langguanApi.Service
|
|||
[ServiceInjection(InjectionType.Transient)]
|
||||
public class TransportService : BaseService<Transport>
|
||||
{
|
||||
public TransportService(IConfiguration config) : base(config, nameof(Transport))
|
||||
private TruckScalesService _truckScalesService;
|
||||
public TransportService(IConfiguration config, TruckScalesService truckScalesService) : base(config, nameof(Transport))
|
||||
{
|
||||
_truckScalesService = truckScalesService;
|
||||
}
|
||||
/// <summary>
|
||||
/// 新增运输
|
||||
|
|
@ -44,11 +46,18 @@ namespace langguanApi.Service
|
|||
public async Task<object> GetPage(reqpage input)
|
||||
{
|
||||
Expression<Func<Transport, bool>> exp = filter => filter.CarNumber.Contains(input.key) && filter.IsDelete == false;
|
||||
return await base.GetPager(new ReqPaing()
|
||||
var list = await base.GetListWithExp(exp);
|
||||
var result = new List<TransportDto>();
|
||||
if (list.Any())
|
||||
{
|
||||
pageSize = input.pageSize,
|
||||
current = input.current
|
||||
}, exp);
|
||||
foreach (var item in list)
|
||||
{
|
||||
var entity = item.Adapt<TransportDto>();
|
||||
entity.CarColorString = GetColorString(item.CarColor);
|
||||
result.Add(entity);
|
||||
}
|
||||
}
|
||||
return result.Skip(input.current - 1).Take(input.pageSize);
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取清洁运输统计数字
|
||||
|
|
@ -72,5 +81,71 @@ namespace langguanApi.Service
|
|||
}
|
||||
};
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取清洁运输列表(门禁和地磅组合)
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> GetTransport(transportReqPage input)
|
||||
{
|
||||
var result = new List<CleanTransportationDto>();
|
||||
//获取门禁数据
|
||||
Expression<Func<Transport, bool>> exp = filter => filter.TransportType == 1 && filter.IsDelete == false;
|
||||
var list = (await base.GetListWithExp(exp)).ToList();
|
||||
//获取地磅数据
|
||||
var TruckScaleslist = _truckScalesService.GetTruckScalesList().Result;
|
||||
//合并数据
|
||||
foreach (var item in TruckScaleslist)
|
||||
{
|
||||
var transport = list.FirstOrDefault(p => p.CarNumber == item.CarNumber);
|
||||
if (transport != null)
|
||||
{
|
||||
result.Add(new CleanTransportationDto()
|
||||
{
|
||||
CarColor = GetColorString(transport.CarColor),
|
||||
CarNumber = transport.CarNumber,
|
||||
CarType = transport.CarType,
|
||||
Time = transport.Time.ToString(),
|
||||
Weight = item.Weight
|
||||
});
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(input.startTime))
|
||||
{
|
||||
result.Where(p => Convert.ToDateTime(p.Time) >= Convert.ToDateTime(input.startTime)).ToList();
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(input.endTime))
|
||||
{
|
||||
result.Where(p => Convert.ToDateTime(p.Time) <=Convert.ToDateTime(input.endTime)).ToList();
|
||||
}
|
||||
result = result.Skip(input.current - 1).Take(input.pageSize).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取车辆颜色
|
||||
/// </summary>
|
||||
/// <param name="color"></param>
|
||||
/// <returns></returns>
|
||||
public string GetColorString(int color)
|
||||
{
|
||||
switch (color)
|
||||
{
|
||||
case 1:
|
||||
return CarColor.蓝色.ToString();
|
||||
case 2:
|
||||
return CarColor.绿色.ToString();
|
||||
case 3:
|
||||
return CarColor.黄色.ToString();
|
||||
case 4:
|
||||
return CarColor.白色.ToString();
|
||||
case 5:
|
||||
return CarColor.黑色.ToString();
|
||||
case 6:
|
||||
return CarColor.黄绿.ToString();
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
using langguanApi.Extensions.AutoDI;
|
||||
using langguanApi.Model;
|
||||
using Mapster;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace langguanApi.Service
|
||||
{
|
||||
[ServiceInjection(InjectionType.Transient)]
|
||||
public class TruckScalesService : BaseService<TruckScales>
|
||||
{
|
||||
public TruckScalesService(IConfiguration config) : base(config, nameof(TruckScales))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新加
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task AddTruckScalesList(List<AddTruckScalesDto> input)
|
||||
{
|
||||
var list = new List<TruckScales>();
|
||||
foreach (var item in input)
|
||||
{
|
||||
list.Add(item.Adapt<TruckScales>());
|
||||
}
|
||||
if (list.Any())
|
||||
{
|
||||
await base.CreateManyAsync(list);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取地磅集合
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<TruckScales>> GetTruckScalesList()
|
||||
{
|
||||
Expression<Func<TruckScales, bool>> exp = filter => filter.IsDelete == false;
|
||||
var list = (await base.GetListWithExp(exp)).ToList();
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
using langguanApi.Extensions.AutoDI;
|
||||
using langguanApi.Extensions;
|
||||
using langguanApi.Extensions.AutoDI;
|
||||
using langguanApi.Model;
|
||||
using langguanApi.Model.Entity;
|
||||
using Mapster;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace langguanApi.Service
|
||||
{
|
||||
|
|
@ -16,20 +18,55 @@ namespace langguanApi.Service
|
|||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Washer> addWasher(AddWasher input)
|
||||
public async Task addWasher(List<AddWasher> input)
|
||||
{
|
||||
var entity = input.Adapt<Washer>();
|
||||
return await base.CreateAsync(entity);
|
||||
List<Washer> result = new List<Washer>();
|
||||
foreach (var item in input)
|
||||
{
|
||||
var entity = input.Adapt<Washer>();
|
||||
result.Add(entity);
|
||||
}
|
||||
|
||||
await base.CreateManyAsync(result);
|
||||
}
|
||||
/// <summary>
|
||||
/// 新增洗车机历史记录
|
||||
/// 获取洗车机列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<GetWasherDto>> getWasherList()
|
||||
{
|
||||
Expression<Func<Washer, bool>> exp = filter => filter.IsDelete == false;
|
||||
var result = (await base.GetListWithExp(exp)).ToList();
|
||||
var washerResult = new List<GetWasherDto>();//转化成需要的数据
|
||||
foreach (var item in result)
|
||||
{
|
||||
var entity = item.Adapt<GetWasherDto>();
|
||||
entity.EquipmentStatusString = item.EquipmentStatus == 0 ? "异常" : "正常";
|
||||
entity.FaultAlarmString = item.FaultAlarm == 0 ? "异常" : "正常";
|
||||
entity.PSAlarmString=item.PSAlarm==0?"异常":"正常";
|
||||
entity.RunStatusString=item.RunStatus==0?"停止":"运行";
|
||||
entity.WPAlarmString=item.WPAlarm==0?"异常":"正常";
|
||||
washerResult.Add(entity);
|
||||
}
|
||||
return washerResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取洗车机历史记录
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Washer> AddWasherHistory(AddWasherHistory input)
|
||||
public async Task<object> WasherHistoryList(transportReqPage input)
|
||||
{
|
||||
var entity = input.Adapt<Washer>();
|
||||
return await base.CreateAsync(entity);
|
||||
Expression<Func<Washer, bool>> exp = filter => filter.IsDelete == false;
|
||||
var result = (await base.GetListWithExp(exp)).ToList();
|
||||
var washerHistroyResult = new List<WasherHistoryDto>();//转化成需要的数据
|
||||
foreach (var item in result)
|
||||
{
|
||||
var entity = item.Adapt<WasherHistoryDto>();
|
||||
entity.StateString=item.State==0?"停止":"运行";
|
||||
washerHistroyResult.Add(entity);
|
||||
}
|
||||
return washerHistroyResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue