using IBigBreenService; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using WIDESEA_Core; using WIDESEA_Core.BaseRepository; using WIDESEA_Core.Helper; using WIDESEA_Core.Util; using WIDESEA_Model.Models; namespace WIDESEA_WMSServer.Controllers.BigGreen { [Route("api/BigScreen")] [ApiController] public class BigScreenController : ControllerBase { private readonly IBigGreenService _bigGreenService; private readonly HttpClientHelper _httpClientHelper; private readonly IRepository _locationInfoRepository; public BigScreenController(IBigGreenService bigGreenService, HttpClientHelper httpClientHelper, IRepository locationInfoRepository) { _bigGreenService = bigGreenService; _httpClientHelper = httpClientHelper; _locationInfoRepository = locationInfoRepository; } [HttpGet, Route("GetBigGreenData"), AllowAnonymous] public WebResponseContent GetBigGreenData() { return _bigGreenService.GetBigGreenData(); } [HttpGet, Route("Test"), AllowAnonymous] public WebResponseContent Test() { string url = "http://172.21.98.57:9046/location/query"; HttpResponseResult> result = _httpClientHelper.Post>(url, "{\"locationCodes\":[],\"containerCode\":\"\",\"locationTypeCodes\":[\"LT_SHELF_STORAGE\"]}"); if (result.Data.TryGetValue("data", out object? data)) { if (JsonConvert.DeserializeObject>(data.Serialize())?.TryGetValue("locations", out object? locations) ?? false) { List>? keyValuePairs = JsonConvert.DeserializeObject>>(locations.Serialize()); if (keyValuePairs != null) { List list = keyValuePairs.Select(x => x["locationCode"].ToString() ?? "").ToList(); List locationCodes = _locationInfoRepository.QueryData().Select(x => x.LocationCode).ToList(); List notContainLocations = list.Where(x => !locationCodes.Contains(x)).ToList(); return WebResponseContent.Instance.OK(data: notContainLocations); } } } return WebResponseContent.Instance.OK(); } } }