heshaofeng
2025-12-29 266e4bf654c55ce2f7e9271048e4625f1b8b49f6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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<Dt_LocationInfo> _locationInfoRepository;
 
        public BigScreenController(IBigGreenService bigGreenService, HttpClientHelper httpClientHelper, IRepository<Dt_LocationInfo> 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<Dictionary<string, object>> result = _httpClientHelper.Post<Dictionary<string, object>>(url, "{\"locationCodes\":[],\"containerCode\":\"\",\"locationTypeCodes\":[\"LT_SHELF_STORAGE\"]}");
 
            if (result.Data.TryGetValue("data", out object? data))
            {
                if (JsonConvert.DeserializeObject<Dictionary<string, object>>(data.Serialize())?.TryGetValue("locations", out object? locations) ?? false)
                {
                    List<Dictionary<string, object>>? keyValuePairs = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(locations.Serialize());
                    if (keyValuePairs != null)
                    {
                        List<string> list = keyValuePairs.Select(x => x["locationCode"].ToString() ?? "").ToList();
 
                        List<string> locationCodes = _locationInfoRepository.QueryData().Select(x => x.LocationCode).ToList();
 
                        List<string> notContainLocations = list.Where(x => !locationCodes.Contains(x)).ToList();
 
                        return WebResponseContent.Instance.OK(data: notContainLocations);
                    }
                }
            }
            return WebResponseContent.Instance.OK();
 
        }
    }
}