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 { /// /// 传入设备,获取当前位置位置 /// /// 设备 /// 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; } /// /// 查询具体地址 /// /// /// /// /// public static DeviceProDTO? GetDeviceProDTO(CommonStackerCrane Commonstacker, string SCAddress, string Interactivet) { return Commonstacker.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == SCAddress && x.DeviceProParamName == Interactivet && x.DeviceProParamType == "ReadDeviceCommand"); } /// /// 读取设备信息 /// /// /// /// public static int GetLine(CommonStackerCrane Commonstacker, string DeviceProDataBlock) { return Commonstacker.Communicator.Read(DeviceProDataBlock); } /// /// 日志记录 /// /// 设备名称 /// 文件名称 /// 日志类型 /// 内容 public void wcsWriteLog(string SCLLinStack,string Filename, string Logtype, string Magessadd) { WriteLog.Write_Log(SCLLinStack, Filename, Logtype, new { 信息 = Magessadd }); } } }