12
肖洋
2024-12-02 1f338f3f149735523101d55f9c782836f30c1ff1
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_BasicInfoRepository;
using WIDESEAWCS_Core;
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_Tasks.ConveyorLineJob;
 
namespace WIDESEAWCS_Tasks.ConveyorLineJob_GW
{
    public class GetStationService: IGetStationService
    {
        private readonly IDt_StationManagerRepository _stationManagerRepository;
        public GetStationService(IDt_StationManagerRepository stationManagerRepository) { _stationManagerRepository = stationManagerRepository; }
        public WebResponseContent GetStationHasPallet(List<string> stations)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                var x = 0;
                var stationManagers = _stationManagerRepository.QueryData(x => stations.Contains(x.stationChildCode));
                foreach (var item in stationManagers)
                {
                    if (Convert.ToInt32(item.stationPLC) > 1010)
                    {
                        CommonConveyorLine_GW commonConveyorLine_GW = Storage.Devices.FirstOrDefault(x => x.DeviceCode == item.stationPLC) as CommonConveyorLine_GW;
 
                        var isHasPallet = Convert.ToInt32(commonConveyorLine_GW.ReadValue(ConveyorLineDBName_After.HasPallet, item.stationPLC));
                        if (isHasPallet > 1) x++;
                    }
                }
                content.OK(data: x);
            }
            catch (Exception ex)
            {
                content.Error(ex.Message);
            }
            return content;
        }
    }
}