| | |
| | | public long PlcId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 交互类型 |
| | | /// </summary> |
| | | [Required] |
| | | [SugarColumn(ColumnName = "DeviceType", ColumnDescription = "交互类型")] |
| | | public DeviceTypeEnum DeviceType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 设备级别 |
| | | /// </summary> |
| | | [Required] |
| | |
| | | [Required] |
| | | [SugarColumn(ColumnName = "PosType", ColumnDescription = "流程字类型")] |
| | | public PLCDataTypeEnum PosType { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 字符串长度 |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "StringLength", ColumnDescription = "字符串长度")] |
| | | public int? StringLength { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 显示屏ip地址 |
| | | /// </summary> |
| | |
| | | //String |
| | | [Description("String")] |
| | | String = 11, |
| | | } |
| | | /// <summary> |
| | | /// 交互类型 |
| | | /// </summary> |
| | | [Description("交互类型")] |
| | | public enum DeviceTypeEnum |
| | | { |
| | | /// <summary> |
| | | /// 业务 |
| | | /// </summary> |
| | | [Description("业务")] |
| | | Business = 1, |
| | | /// <summary> |
| | | /// 页面展示 |
| | | /// </summary> |
| | | [Description("页面展示")] |
| | | Show = 2, |
| | | } |
| | |
| | | private static List<WcsPosition> listPlcStation; |
| | | |
| | | private static List<PLCUtil> listPlcUtil = new List<PLCUtil>(); |
| | | //对外公布连接状态 |
| | | public static List<PLCUtil> listPlcConn |
| | | { |
| | | get { return listPlcUtil; } |
| | | } |
| | | private static CancellationTokenSource cts;//取消线程标识 |
| | | |
| | | public static event EventHandler DeviceValueChangeEvent; |
| | |
| | | } |
| | | try |
| | | { |
| | | var modPlcUtil = listPlcUtil.FirstOrDefault(s => s.PlcId == modPlc.Id); |
| | | var modPlcUtil = listPlcUtil.FirstOrDefault(s => s != null && s.PlcId == modPlc.Id); |
| | | if (modPlcUtil == null) |
| | | { |
| | | modPlcUtil = new PLCUtil(modPlc); |
| | |
| | | public string PlcIdIP { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 交互类型 |
| | | /// </summary> |
| | | public DeviceTypeEnum DeviceType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 主键Id |
| | | /// </summary> |
| | | public long Id { get; set; } |
| | |
| | | public virtual long PlcId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 交互类型 |
| | | /// </summary> |
| | | public virtual DeviceTypeEnum DeviceType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 设备级别 |
| | | /// </summary> |
| | | public virtual DeviceLevelEnum Level { get; set; } |
| | |
| | | /// </summary> |
| | | [Required(ErrorMessage = "PlcId不能为空")] |
| | | public override long PlcId { get; set; } |
| | | /// <summary> |
| | | /// 交互类型 |
| | | /// </summary> |
| | | [Required(ErrorMessage = "交互类型不能为空")] |
| | | public override DeviceTypeEnum DeviceType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 设备级别 |
| | |
| | | public long Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 交互类型 |
| | | /// </summary> |
| | | public DeviceTypeEnum DeviceType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// PlcId |
| | | /// </summary> |
| | | public long PlcId { get; set; } |
| | |
| | | /// PlcId 描述 |
| | | /// </summary> |
| | | public string PlcIdIP { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 设备类型 |
| | | /// </summary> |
| | | public PLCTypeEnum Type { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 设备级别 |
| | |
| | | /// </summary> |
| | | public bool IsDelete { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 任务号 |
| | | /// </summary> |
| | | public string TaskNo { get; set; } |
| | | /// <summary> |
| | | /// 任务类型 |
| | | /// </summary> |
| | | public TaskTypeEnum TaskType { get; set; } |
| | | public string Plc { get; set; } |
| | | public string Wcs { get; set; } |
| | | /// <summary> |
| | | /// 连接状态 |
| | | /// </summary> |
| | | public bool Status { get; set; } |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | Id = u.Id, |
| | | PlcId = u.PlcId, |
| | | DeviceType = (DeviceTypeEnum)u.DeviceType, |
| | | PlcIdIP = plcid.IP, |
| | | Level = (DeviceLevelEnum)u.Level, |
| | | DbNumber = u.DbNumber, |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取设备信息列表 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ApiDescriptionSettings(Name = "List")] |
| | | [DisplayName("获取设备信息列表")] |
| | | public async Task<List<WcsDeviceOutput>> List([FromQuery] PageWcsDeviceInput input) |
| | | { |
| | | return await _wcsDeviceRep.AsQueryable().Select<WcsDeviceOutput>().ToListAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取PlcId列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | |
| | | await _wcsDeviceRep.Context.Insertable(listPosition).ExecuteCommandAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取设备信息列表 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ApiDescriptionSettings(Name = "List")] |
| | | [DisplayName("获取设备信息列表")] |
| | | public async Task<List<WcsDeviceOutput>> List([FromQuery] PageWcsDeviceInput input) |
| | | { |
| | | var list = await _wcsDeviceRep.AsQueryable() |
| | | .LeftJoin<WcsPlc>((a, b) => a.PlcId == b.Id) |
| | | .Select<WcsDeviceOutput>((a, b) => new WcsDeviceOutput() { Type = b.Type }, true) |
| | | .ToListAsync(); |
| | | //获取跺机的状态 |
| | | var listConn = PLCTaskAction.listPlcConn; |
| | | foreach (var modDevice in list) |
| | | { |
| | | var modUtil = listConn.FirstOrDefault(s => s != null && s.PlcId == modDevice.PlcId); |
| | | modDevice.Status = modUtil == null ? false : modUtil.Connected; |
| | | } |
| | | |
| | | |
| | | return list; |
| | | } |
| | | } |
| | |
| | | |
| | | namespace WCS.Application; |
| | | |
| | | /// <summary> |
| | | /// 设备工位输出参数 |
| | | /// </summary> |
| | | public class WcsPositionDto |
| | | { |
| | | /// <summary> |
| | | /// 设备工位输出参数 |
| | | /// 设备ID |
| | | /// </summary> |
| | | public class WcsPositionDto |
| | | { |
| | | /// <summary> |
| | | /// 设备ID |
| | | /// </summary> |
| | | public string? DeviceIdText { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 主键Id |
| | | /// </summary> |
| | | public long Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 设备ID |
| | | /// </summary> |
| | | public long DeviceId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 工位号 |
| | | /// </summary> |
| | | public string? StationNum { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 偏移量 |
| | | /// </summary> |
| | | public string? PlcPos { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 流程字类型 |
| | | /// </summary> |
| | | public PLCDataTypeEnum? PosType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 显示屏ip地址 |
| | | /// </summary> |
| | | public string? LedIP { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 描述 |
| | | /// </summary> |
| | | public string? Text { get; set; } |
| | | |
| | | } |
| | | public string? DeviceIdText { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 主键Id |
| | | /// </summary> |
| | | public long Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 设备ID |
| | | /// </summary> |
| | | public long DeviceId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 工位号 |
| | | /// </summary> |
| | | public string? StationNum { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 偏移量 |
| | | /// </summary> |
| | | public string? PlcPos { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 流程字类型 |
| | | /// </summary> |
| | | public PLCDataTypeEnum? PosType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 字符串长度 |
| | | /// </summary> |
| | | public int? StringLength { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 显示屏ip地址 |
| | | /// </summary> |
| | | public string? LedIP { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 描述 |
| | | /// </summary> |
| | | public string? Text { get; set; } |
| | | |
| | | } |
| | |
| | | public virtual PLCDataTypeEnum PosType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 字符串长度 |
| | | /// </summary> |
| | | public virtual int? StringLength { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 显示屏ip地址 |
| | | /// </summary> |
| | | public virtual string? LedIP { get; set; } |
| | |
| | | public PLCDataTypeEnum? PosType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 字符串长度 |
| | | /// </summary> |
| | | public int? StringLength { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 显示屏ip地址 |
| | | /// </summary> |
| | | public string? LedIP { get; set; } |
| | |
| | | DetailWcsDevice = '/api/wcsDevice/detail', |
| | | GetWcsPlcPlcIdDropdown = '/api/wcsDevice/WcsPlcPlcIdDropdown', |
| | | GeneratePos = '/api/wcsDevice/GeneratePos', |
| | | ListWcsDevice = '/api/wcsDevice/list', |
| | | } |
| | | |
| | | // 增加设备信息 |
| | |
| | | method: 'post', |
| | | data: params |
| | | }); |
| | | |
| | | |
| | | export const listWcsDevice = () => |
| | | request({ |
| | | url: Api.ListWcsDevice, |
| | | method: 'get' |
| | | }); |
| | |
| | | |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="交互类型" prop="deviceType"> |
| | | <el-select clearable v-model="ruleForm.deviceType" placeholder="请选择交互类型"> |
| | | <el-option v-for="(item, index) in dl('DeviceTypeEnum')" :key="index" |
| | | :value="Number(item.value)" |
| | | :label="`${item.name} (${item.code}) [${item.value}]`"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="设备级别" prop="level"> |
| | | <el-select clearable v-model="ruleForm.level" placeholder="请选择设备级别"> |
| | | <el-option v-for="(item, index) in dl('DeviceLevelEnum')" :key="index" |
| | |
| | | </template> |
| | | |
| | | </el-table-column> |
| | | <el-table-column prop="deviceType" label="交互类型" show-overflow-tooltip=""> |
| | | <template #default="scope"> |
| | | <el-tag :type="dv('DeviceTypeEnum', scope.row.deviceType)?.tagType"> {{ dv('DeviceTypeEnum', |
| | | scope.row.deviceType)?.name }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="level" label="设备级别" show-overflow-tooltip=""> |
| | | <template #default="scope"> |
| | | <el-tag :type="dv('DeviceLevelEnum', scope.row.level)?.tagType"> {{ dv('DeviceLevelEnum', |
| | |
| | | |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="字符串长度" prop="stringLength"> |
| | | <el-input v-model="ruleForm.stringLength" placeholder="请输入字符串长度量" maxlength="32" show-word-limit clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="显示屏ip地址" prop="ledIP"> |
| | | <el-input v-model="ruleForm.ledIP" placeholder="请输入显示屏ip地址" maxlength="50" show-word-limit clearable /> |
| | | |
| | |
| | | scope.row.posType)?.name}}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="stringLength" label="字符串长度" show-overflow-tooltip="" /> |
| | | <el-table-column prop="ledIP" label="显示屏ip地址" show-overflow-tooltip="" /> |
| | | <el-table-column prop="text" label="描述" show-overflow-tooltip="" /> |
| | | <el-table-column label="修改记录" width="80" align="center" show-overflow-tooltip> |