huanghongfeng
5 小时以前 6ba24a49c009cca01d9c02b9dae692a53b8be116
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob.DTO;
using WIDESEAWCS_QuartzJob;
using WIDESEA_Common.Log;
using System.Xml.Linq;
 
namespace WIDESEAWCS_Tasks.StackerCraneJob
{
 
 
    public class GetDeviceAddress
    {
        /// <summary>
        /// 传入设备,获取当前位置位置
        /// </summary>
        /// <param name="ChildPosiDeviceCode">设备</param>
        /// <returns></returns>
        public static int GetEquipmentlocation(string ChildPosiDeviceCode)
        {
            IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == ChildPosiDeviceCode);
            CommonStackerCrane Commonstacker = (CommonStackerCrane)device;
            DeviceProDTO? deviceProDTO = GetDeviceProDTO(Commonstacker, ChildPosiDeviceCode, "RGVCurrentlocation");
            int HCJGStatus = GetLine(Commonstacker, deviceProDTO.DeviceProAddress);
            return HCJGStatus;
        }
 
 
        /// <summary>
        /// 查询具体地址
        /// </summary>
        /// <param name="Commonstacker"></param>
        /// <param name="SCAddress"></param>
        /// <param name="Interactivet"></param>
        /// <returns></returns>
        public static DeviceProDTO? GetDeviceProDTO(CommonStackerCrane Commonstacker, string SCAddress, string Interactivet)
        {
            return Commonstacker.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == SCAddress && x.DeviceProParamName == Interactivet && x.DeviceProParamType == "ReadDeviceCommand");
        }
 
 
        /// <summary>
        /// 读取设备信息
        /// </summary>
        /// <param name="conveyorLine"></param>
        /// <param name="DeviceProDataBlock"></param>
        /// <returns></returns>
        public static int GetLine(CommonStackerCrane Commonstacker, string DeviceProDataBlock)
        {
            return Commonstacker.Communicator.Read<short>(DeviceProDataBlock);
        }
 
 
        /// <summary>
        /// 日志记录
        /// </summary>
        /// <param name="SCLLinStack">设备名称</param>
        /// <param name="Filename">文件名称</param>
        /// <param name="Logtype">日志类型</param>
        /// <param name="Magessadd">内容</param>
        public void wcsWriteLog(string SCLLinStack,string Filename, string Logtype, string Magessadd)
        {
            WriteLog.Write_Log(SCLLinStack, Filename, Logtype, new { 信息 = Magessadd });
        }
    }
}