|
@@ -0,0 +1,66 @@
|
|
|
+using AutoMapper;
|
|
|
+using CSRedis;
|
|
|
+using Microsoft.AspNetCore.Mvc;
|
|
|
+using Wms.Screen.Service.IService;
|
|
|
+using Wms.Screen.SqlSugar.ZhongTian.KLHC;
|
|
|
+
|
|
|
+namespace zt.screen.api.Controllers
|
|
|
+{
|
|
|
+ /// <summary>
|
|
|
+ /// 中天空轮缓存看板
|
|
|
+ /// </summary>
|
|
|
+ [Route("api/[controller]/[action]")]
|
|
|
+ [ApiController]
|
|
|
+ public class ZhongTianKlhcController : ControllerBase
|
|
|
+ {
|
|
|
+ private IZhongTianKlhcService _zhongTianKlhcService;
|
|
|
+ private IMapper _mapper;
|
|
|
+ private readonly CSRedisClient _CSRedisClient;
|
|
|
+ private readonly FreeRedis.RedisClient _freeRedisClient;
|
|
|
+
|
|
|
+ public ZhongTianKlhcController(IZhongTianKlhcService zhongTianKlhcService, IMapper mapper, CSRedisClient cSRedisClient, FreeRedis.RedisClient freeRedisClient)
|
|
|
+ {
|
|
|
+ _zhongTianKlhcService = zhongTianKlhcService;
|
|
|
+ _mapper = mapper;
|
|
|
+ _CSRedisClient = cSRedisClient;
|
|
|
+
|
|
|
+ _freeRedisClient = freeRedisClient;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取缓存信息
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public List<BaseRBCI> GetRbci()
|
|
|
+ {
|
|
|
+ return _zhongTianKlhcService.GetBaseRrciList();
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取库存信息
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public List<KlhcInvInfoResult> GetKlhcInvInfo()
|
|
|
+ {
|
|
|
+ var InvInfo = _zhongTianKlhcService.GetKlhcInvInfo();
|
|
|
+ var info = InvInfo.First(x => x.WheelType == "总计");
|
|
|
+ var InvInfos = InvInfo.Select(x => new KlhcInvInfoResult
|
|
|
+ {
|
|
|
+ WheelType = x.WheelType,
|
|
|
+ Number = x.Number,
|
|
|
+ Ratio = Math.Round(((x.Number / info.Number) * 100), 2),
|
|
|
+ }).ToList();
|
|
|
+ return InvInfos;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 定义明确的返回类型
|
|
|
+ public class KlhcInvInfoResult
|
|
|
+ {
|
|
|
+ public string WheelType { get; set; }
|
|
|
+ public decimal Number { get; set; }
|
|
|
+ public decimal Ratio { get; set; }
|
|
|
+ }
|
|
|
+}
|