1
pulg
2025-05-14 5a640911f7e7ef3a003775993f077e1a0e9ac130
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
using HH.WCS.Hexafluo.api;
using HH.WCS.Hexafluo.device;
using HH.WCS.Hexafluo.dispatch;
using HH.WCS.Hexafluo.util;
using HH.WCS.Hexafluo.wms;
using HH.WCS.SJML.api;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
 
namespace HH.WCS.Hexafluo.process
{
    /// <summary>
    /// 设备信号处理
    /// </summary>
    internal class DeviceProcess
    {
        static DeviceProcess() {
            Settings.GetCameraInfoList().ForEach(a => {
                cameraStates.Add(a.site, new CameraState { site = a.site, state = -1 });
            });
        }
     //   private static Dictionary<string, CameraState> RainStates = new Dictionary<string, CameraState>();
      /// <summary>
      /// 雨量传感器
      /// </summary>
      /// <param name="data"></param>
      /// <param name="ip"></param>
        internal static void Analysis(string data, string ip) {
            if (data != null) 
            {
 
            }
            else
            {
 
            }
        }
 
        private static Dictionary<string, CameraState> cameraStates = new Dictionary<string, CameraState>();
        internal static void SetCameraInfo(List<LocationState> models) {
            var Open = Settings.CameraOpenKeyList;
            if (Open=="Y")
            {
                models.ForEach(a => {
                    var info = Settings.GetCameraInfoList().Where(b => b.site == a.site).FirstOrDefault();
                    if (info != null)
                    {
                        if (cameraStates.Keys.Contains(a.site))
                        {
                            if (a.state == 0)
                            {
                                cameraStates[a.site].state = a.state;
                                //更新数据库,变空(改当前数量为0)
                                LocationHelper.BindLoc(info.location,0);
                                //LocationHelper
                            }
                            else
                            {
                                if (cameraStates[a.site].state > 0)
                                {
                                    cameraStates[a.site].state++;
                                    if (cameraStates[a.site].state > 2)
                                    {
                                        //更新数据库(连续两次收到满的信号,才当作是满的),变满(改当前数量为1)
                                        LocationHelper.BindLoc(info.location,1);
                                    }
                                }
                                else
                                {
                                    cameraStates[a.site].state = a.state;
                                }
                            }
                            cameraStates[a.site].modify = DateTime.Now;
                        }
                    }
                });
            }
        }
        //internal static void CheckCameraTask() {
 
        //    Settings.GetCameraInfoList().ForEach(a => {
        //        var startList = a.Where(b => b.locType == 1).ToList();
        //        var endList = a.Where(b => b.locType >= 2).OrderBy(b => b.order).ToList();
        //        //获取一个起点是满的货位
        //        string startBit = null;
        //        for (int i = 0; i < startList.Count; i++) {
        //            if (cameraStates[startList[i].site].state >= 2) {
        //                startBit = startList[i].location;
        //                break;
        //            }
        //        }
        //        //判断起点没有任务
        //        if (startBit != null && LocationHelper.CheckLocFree(startBit)) {
        //            //调wms获取终点,终点在endList里面,找到之后生成任务
        //            Console.WriteLine($"相机起点{startBit}有货,查找找到对应终点");
 
        //        }
 
 
        //    });
 
 
        //}
        internal static void Traffic(string forkliftNo, string lockNo, bool v) {
            throw new NotImplementedException();
        }
    }
}