Merge branch 'master' into wxw
| | |
| | | public long PlcId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 交互类型 |
| | | /// </summary> |
| | | [Required] |
| | | [SugarColumn(ColumnName = "DeviceType", ColumnDescription = "交互类型")] |
| | | public DeviceTypeEnum DeviceType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 设备级别 |
| | | /// </summary> |
| | | [Required] |
| | |
| | | [SugarColumn(ColumnName = "PosType", ColumnDescription = "流程字类型")] |
| | | public PLCDataTypeEnum PosType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 字符串长度 |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "StringLength", ColumnDescription = "字符串长度")] |
| | | public int? StringLength { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 显示屏ip地址 |
| | | /// </summary> |
| | |
| | | [Description("String")] |
| | | String = 11, |
| | | } |
| | | /// <summary> |
| | | /// 交互类型 |
| | | /// </summary> |
| | | [Description("交互类型")] |
| | | public enum DeviceTypeEnum |
| | | { |
| | | /// <summary> |
| | | /// 业务 |
| | | /// </summary> |
| | | [Description("业务")] |
| | | Business = 1, |
| | | /// <summary> |
| | | /// 页面展示 |
| | | /// </summary> |
| | | [Description("页面展示")] |
| | | Show = 2, |
| | | } |
| | |
| | | /// <param name="context"></param> |
| | | /// <returns></returns> |
| | | Task PublicAlarm(WcsAlarmInfoOutput context); |
| | | /// <summary> |
| | | /// 修改服务状态 |
| | | /// </summary> |
| | | /// <param name="context"></param> |
| | | Task UpdateService(PLCServiceModel context); |
| | | } |
| | | } |
| | |
| | | namespace WCS.Application; |
| | | |
| | | /// <summary> |
| | | /// PLC集线器 |
| | | /// 任务日志集线器 |
| | | /// </summary> |
| | | [MapHub("/hubs/Plc")] |
| | | public class PlcHub : Hub<IPlcHub> |
| | |
| | | /// </summary> |
| | | /// <param name="context"></param> |
| | | /// <returns></returns> |
| | | //public async Task PublicPlcConn(WcsPlc context) |
| | | //{ |
| | | // await _plcHubContext.Clients.All.PublicPlcConn(context); |
| | | //} |
| | | public async Task PublicPlcConn(WcsPlc context) |
| | | { |
| | | await _plcHubContext.Clients.All.PublicPlcConn(context); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 下发工位状态 |
| | |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// 下发报警信息 |
| | | /// 下发服务状态 |
| | | /// </summary> |
| | | /// <param name="context"></param> |
| | | /// <returns></returns> |
| | | //public async Task PublicAlarm(WcsAlarmInfoOutput context) |
| | | //{ |
| | | // await _plcHubContext.Clients.All.PublicAlarm(context); |
| | | //} |
| | | public async Task UpdateService(PLCServiceModel context) |
| | | { |
| | | //运行状态 |
| | | if (context.BoRunningState.HasValue) |
| | | PLCTaskAction.boRunningState = context.BoRunningState.Value; |
| | | //脱机模式 |
| | | if (context.BoOffline.HasValue) |
| | | PLCTaskAction.boOffline = context.BoOffline.Value; |
| | | //自刷新 |
| | | if (context.BoRefresh.HasValue) |
| | | PLCTaskAction.boRefresh = context.BoRefresh.Value; |
| | | await _plcHubContext.Clients.All.UpdateService(context); |
| | | } |
| | | } |
| | | public class PLCServiceModel |
| | | { |
| | | public bool? BoRunningState { get; set; } |
| | | |
| | | |
| | | public bool? BoOffline { get; set; } |
| | | |
| | | |
| | | public bool? BoRefresh { get; set; } |
| | | } |
| | |
| | | _taskLogHubContext = taskLogHubContext; |
| | | } |
| | | |
| | | ///// <summary> |
| | | ///// 连接 |
| | | ///// </summary> |
| | | ///// <returns></returns> |
| | | //public override async Task OnConnectedAsync() |
| | | //{ |
| | | // await base.OnConnectedAsync(); |
| | | //} |
| | | /// <summary> |
| | | /// 连接 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public override async Task OnConnectedAsync() |
| | | { |
| | | await base.OnConnectedAsync(); |
| | | } |
| | | |
| | | ///// <summary> |
| | | ///// 断开 |
| | | ///// </summary> |
| | | ///// <param name="exception"></param> |
| | | ///// <returns></returns> |
| | | //public override async Task OnDisconnectedAsync(Exception exception) |
| | | //{ |
| | | // await base.OnDisconnectedAsync(exception); |
| | | //} |
| | | /// <summary> |
| | | /// 断开 |
| | | /// </summary> |
| | | /// <param name="exception"></param> |
| | | /// <returns></returns> |
| | | public override async Task OnDisconnectedAsync(Exception exception) |
| | | { |
| | | await base.OnDisconnectedAsync(exception); |
| | | } |
| | | |
| | | ///// <summary> |
| | | ///// 下发任务 |
| | | ///// </summary> |
| | | ///// <returns></returns> |
| | | //public async Task PublicTask(WcsTaskOutput context) |
| | | //{ |
| | | // await _taskLogHubContext.Clients.All.PublicTask(context); |
| | | //} |
| | | /// <summary> |
| | | /// 下发任务 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public async Task PublicTask(WcsTaskOutput context) |
| | | { |
| | | await _taskLogHubContext.Clients.All.PublicTask(context); |
| | | } |
| | | |
| | | ///// <summary> |
| | | ///// 下发任务明细 |
| | | ///// </summary> |
| | | ///// <returns></returns> |
| | | //public async Task PublicTaskMonitor(WcsTaskMonitorOutput context) |
| | | //{ |
| | | // await _taskLogHubContext.Clients.All.PublicTaskMonitor(context); |
| | | //} |
| | | /// <summary> |
| | | /// 下发任务明细 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public async Task PublicTaskMonitor(WcsTaskMonitorOutput context) |
| | | { |
| | | await _taskLogHubContext.Clients.All.PublicTaskMonitor(context); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | private static List<PLCUtil> listPlcUtil = new List<PLCUtil>(); |
| | | private static CancellationTokenSource cts;//取消线程标识 |
| | | |
| | | //对外公布连接状态 |
| | | public static List<PLCUtil> listPlcConn |
| | | { |
| | | get { return listPlcUtil; } |
| | | } |
| | | public static event EventHandler DeviceValueChangeEvent; |
| | | static PLCTaskAction() |
| | | { |
| | |
| | | } |
| | | 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); |
| | |
| | | using Microsoft.AspNetCore.SignalR; |
| | | |
| | | namespace WCS.Application; |
| | | namespace WCS.Application; |
| | | |
| | | /// <summary> |
| | | /// 报警信息表服务 |
| | |
| | | public class WcsAlarmInfoService : IDynamicApiController, ITransient |
| | | { |
| | | private readonly SqlSugarRepository<WcsAlarmInfo> _wcsAlarmInfoRep; |
| | | private readonly IHubContext<PlcHub, IPlcHub> _plcHubContext; |
| | | |
| | | public WcsAlarmInfoService(SqlSugarRepository<WcsAlarmInfo> wcsAlarmInfoRep, IHubContext<PlcHub, IPlcHub> plcHubContext) |
| | | public WcsAlarmInfoService(SqlSugarRepository<WcsAlarmInfo> wcsAlarmInfoRep) |
| | | { |
| | | _wcsAlarmInfoRep = wcsAlarmInfoRep; |
| | | _plcHubContext = plcHubContext; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | [DisplayName("复位报警")] |
| | | public async Task Reset() |
| | | { |
| | | //测试推数据用的 |
| | | await _plcHubContext.Clients.All.PublicAlarm(new WcsAlarmInfoOutput() { Id = new Random().Next(), StationNum = "205", AlarmCode = "MB102", AlarmName = "有物品遮挡", AlarmTime = DateTime.Now }); |
| | | //throw Oops.Bah("开发中"); |
| | | |
| | | throw Oops.Bah("开发中"); |
| | | } |
| | | |
| | | |
| | |
| | | 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; } |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | using Admin.NET.Core.Service; |
| | | |
| | | namespace WCS.Application; |
| | | |
| | | /// <summary> |
| | |
| | | public class WcsDeviceService : IDynamicApiController, ITransient |
| | | { |
| | | private readonly SqlSugarRepository<WcsDevice> _wcsDeviceRep; |
| | | public WcsDeviceService(SqlSugarRepository<WcsDevice> wcsDeviceRep) |
| | | private readonly SysCacheService _sysCacheService; |
| | | public WcsDeviceService(SqlSugarRepository<WcsDevice> wcsDeviceRep, SysCacheService sysCacheService) |
| | | { |
| | | _wcsDeviceRep = wcsDeviceRep; |
| | | _sysCacheService = sysCacheService; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | 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(); |
| | | //获取跺机的状态 |
| | | foreach (var modDevice in list) |
| | | { |
| | | if (_sysCacheService.ExistKey("PlcConn" + modDevice.PlcId)) |
| | | { |
| | | var cachePlc = _sysCacheService.Get<WcsPlc>("PlcConn" + modDevice.PlcId); |
| | | modDevice.Status = cachePlc.IsConn; |
| | | } |
| | | else |
| | | { |
| | | modDevice.Status = false; |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | } |
| | |
| | | public PLCDataTypeEnum? PosType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 字符串长度 |
| | | /// </summary> |
| | | public int? StringLength { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 显示屏ip地址 |
| | | /// </summary> |
| | | public string? LedIP { 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', |
| | | } |
| | | |
| | | // 增加设备信息 |
| | |
| | | data: params |
| | | }); |
| | | |
| | | export const listWcsDevice = () => |
| | | request({ |
| | | url: Api.ListWcsDevice, |
| | | method: 'get' |
| | | }); |
| | |
| | | <el-row style="display: flex;text-align: center;justify-content: center;height: 40px;"> |
| | | <el-button type="warning" style="width: 95%;height: 30px;" @click="reset">报警复位</el-button> |
| | | </el-row> |
| | | <el-table :data="paginatedData" border style="width: 100%" v-loading="loading" |
| | | <el-table :data="tableData" border style="width: 100%" v-loading="loading" |
| | | :default-sort="{ prop: 'date', order: 'descending' }"> |
| | | <el-table-column prop="alarmCode" label="变量" align="center"></el-table-column> |
| | | <el-table-column prop="alarmName" label="描述" align="center"></el-table-column> |
| | | <el-table-column prop="stationNum" label="位置" align="center"></el-table-column> |
| | | <el-table-column prop="alarmTime" label="时间" align="center"></el-table-column> |
| | | </el-table> |
| | | <el-pagination v-model:currentPage="tableParams.page" v-model:page-size="tableParams.pageSize" |
| | | :total="tableParams.total" :page-sizes="[10, 20, 50, 100, 200, 500]" size="small" background="" |
| | | @size-change="handleSizeChange" @current-change="handleCurrentChange" layout="prev, pager, next" /> |
| | | </el-col> |
| | | <el-col :span="19"> |
| | | <div class="card-page"> |
| | |
| | | </template> |
| | | |
| | | <script lang="ts" setup> |
| | | import { ref, reactive, onMounted, computed } from 'vue'; |
| | | import { ref, reactive,onMounted } from 'vue'; |
| | | import { Splitpanes, Pane } from 'splitpanes'; |
| | | import 'splitpanes/dist/splitpanes.css'; |
| | | import { Vue2 } from 'vue-demi'; |
| | | import { listWcsAlarmInfo, resetWcsAlarmInfo } from '/@/api/wcs/wcsAlarmInfo'; |
| | | import { signalR } from './signalR'; |
| | | |
| | | //连接signalR 监听变更 |
| | | onMounted(async () => { |
| | | signalR.off('PublicAlarm'); |
| | | signalR.on('PublicAlarm', (data: any) => { |
| | | console.log(data) |
| | | var listAlarm = tableData.value.filter(t => t.id == data.id); |
| | | if (listAlarm.length == 0) { |
| | | tableData.value.unshift(data) |
| | | tableParams.value.total = tableData.value.length; |
| | | } |
| | | else { |
| | | //如果已经存在就更新数据 |
| | | const index = tableData.value.findIndex(t => t.id == data.id); |
| | | tableData.value.splice(index, 1, data); |
| | | } |
| | | }); |
| | | }); |
| | | //堆垛机数据 |
| | | const cellsDataLine = [ |
| | | { Id: 1, Code: '001', LineCode: '', EndLocat: '', IsShow: 1, IsUse: 0, BoxHeight: 10 }, |
| | |
| | | //复位报警 |
| | | const reset = async () => { |
| | | await resetWcsAlarmInfo(); |
| | | await handleQuery(); |
| | | } |
| | | //连接signalR 监听变更 |
| | | onMounted(async () => { |
| | | signalR.off('PublicAlarm'); |
| | | signalR.on('PublicAlarm', (data: any) => { |
| | | console.log(data) |
| | | var listAlarm = tableData.value.filter(t => t.id == data.id); |
| | | if (listAlarm.length == 0) { |
| | | tableData.value.unshift(data) |
| | | tableParams.value.total = tableData.value.length; |
| | | } |
| | | else { |
| | | //如果已经存在就更新数据 |
| | | const index = tableData.value.findIndex(t => t.id == data.id); |
| | | tableData.value.splice(index, 1, data); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | // 改变页面容量 |
| | | const handleSizeChange = (val: number) => { |
| | | tableParams.value.pageSize = val; |
| | | }; |
| | | |
| | | // 改变页码序号 |
| | | const handleCurrentChange = (val: number) => { |
| | | tableParams.value.page = val; |
| | | }; |
| | | //表格显示数据 |
| | | const paginatedData = computed(() => { |
| | | const start = (tableParams.value.page - 1) * tableParams.value.pageSize |
| | | const end = start + tableParams.value.pageSize |
| | | return tableData.value.slice(start, end) |
| | | }) |
| | | |
| | | |
| | | |
| | | const isPlain1 = ref(false);//一层 |
| | |
| | | <el-collapse v-model="activeName"> |
| | | <el-collapse-item title="设备控制" name="1"> |
| | | <el-card class="box-card" shadow="hover"> |
| | | <el-switch v-model="state.boRunningState" active-text="" inactive-text="程序服务"></el-switch> |
| | | <el-switch v-model="state.boRunningState" active-text="" inactive-text="程序服务" |
| | | @change="handleSwitchChange('boRunningState', $event)"></el-switch> |
| | | </el-card> |
| | | <el-card class="box-card" shadow="hover" style="margin-top: 3px;"> |
| | | <el-switch v-model="state.boOffline" active-text="" inactive-text="脱机模式"></el-switch> |
| | | <el-switch v-model="state.boOffline" active-text="" inactive-text="脱机模式" |
| | | @change="handleSwitchChange('boOffline', $event)"></el-switch> |
| | | </el-card> |
| | | <el-card class="box-card" shadow="hover" style="margin-top: 3px;"> |
| | | <el-switch v-model="state.boRefresh" active-text="" inactive-text="自刷新"></el-switch> |
| | | <el-switch v-model="state.boRefresh" active-text="" inactive-text="自刷新" |
| | | @change="handleSwitchChange('boRefresh', $event)"></el-switch> |
| | | </el-card> |
| | | </el-collapse-item> |
| | | |
| | | <el-collapse-item title="堆垛机" name="2"> |
| | | <div style="overflow-x: auto;white-space: nowrap;"> |
| | | <el-card v-for="(stacker, index) in stackers" :key="index" class="box-card" shadow="hover"> |
| | | <el-switch disabled v-model="stacker.isConn" :inactive-text="`${stacker.text}`"></el-switch> |
| | | <el-switch v-model="stacker.isConn" :inactive-text="`${stacker.text}`" |
| | | disabled></el-switch> |
| | | </el-card> |
| | | </div> |
| | | </el-collapse-item> |
| | | |
| | | <el-collapse-item title="输送线" name="3"> |
| | | <el-card v-for="(conveyor, index) in conveyors" :key="index" class="box-card" shadow="hover"> |
| | | <el-switch disabled v-model="conveyor.isConn" :inactive-text="`${conveyor.text}`"></el-switch> |
| | | <el-switch v-model="conveyor.isConn" :inactive-text="`${conveyor.text}`" |
| | | disabled></el-switch> |
| | | </el-card> |
| | | </el-collapse-item> |
| | | </el-collapse> |
| | |
| | | import { listStatus } from '/@/api/wcs/wcsPlc'; |
| | | import { signalR } from './signalR'; |
| | | |
| | | |
| | | const state = ref<any>({}); |
| | | const stackers = ref<any>({}); |
| | | const conveyors = ref<any>({}); |
| | |
| | | } |
| | | console.log(stackers.value[0].isConn) |
| | | }); |
| | | signalR.off('UpdateService'); |
| | | signalR.on('UpdateService', (data: any) => { |
| | | state.value = data; |
| | | }); |
| | | }); |
| | | const handleSwitchChange = (field: string, value: boolean) => { |
| | | signalR.invoke('UpdateService',state.value); |
| | | }; |
| | | |
| | | |
| | | const activeName = ['1', '2', '3']; |
| | | const value1 = ref(false); |
| | |
| | | |
| | | |
| | | //输送线数据 |
| | | let cellsData = ref(cellsDataOne);; |
| | | let cellsData = ref(cellsDataOne); |
| | | |
| | | const isPlain1 = ref(false);//一层 |
| | | const isPlain2 = ref(true);//二层 |
| | |
| | | .active2>div { |
| | | display: none; |
| | | } |
| | | |
| | | .active3 { |
| | | background-color: #fff; |
| | | border:1px solid red; |
| | | } |
| | | |
| | | .active3>div { |
| | | display: none; |
| | | } |
| | |
| | | <div class="choosefix"> |
| | | <el-select v-model="lineValue" placeholder="请选择"> |
| | | <el-option v-for="item in lineOptions" :key="item.value" :label="item.label" |
| | | :value="item.value"> |
| | | </el-option> |
| | | :value="item.value"></el-option> |
| | | </el-select> |
| | | <el-select v-model="stationValue" placeholder="请选择" style="margin-top: 10px;"> |
| | | <el-option v-for="item in stationOptions" :key="item.value" :label="item.label" |
| | | :value="item.value"> |
| | | </el-option> |
| | | <el-option v-for="item in stations" :key="item.id" :label="item.stationNum" |
| | | :value="item.id"></el-option> |
| | | </el-select> |
| | | </div> |
| | | <div class="lineValuefix"> |
| | | <el-form label-position="left" label-width="60px"> |
| | | <el-form label-position="left" label-width="80px"> |
| | | <el-form-item label="任务号"> |
| | | <el-input></el-input> |
| | | </el-form-item> |
| | |
| | | <el-form-item label="托盘码"> |
| | | <el-input></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="PLC"> |
| | | <el-input></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="WCS"> |
| | | <el-input></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="状态"> |
| | | <el-input></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="lineButtonfix"> |
| | | <el-form label-position="left" label-width="60px"> |
| | | <el-form label-position="left" label-width="80px"> |
| | | <el-form-item> |
| | | <el-button>写入</el-button> |
| | | <el-button>设置</el-button> |
| | |
| | | </el-aside> |
| | | <el-main style="padding: 0 0 0 5px;"> |
| | | <div class="card-container"> |
| | | <el-card class="other-box-card" v-for="deviceInfo in deviceList" :key="deviceInfo.id"> |
| | | <el-card class="other-box-card" v-for="deviceInfo in listStackingMachineData" :key="deviceInfo.id"> |
| | | <div slot="header" class="linefix"> |
| | | <span>{{ deviceInfo.name }}</span> |
| | | <span>{{ deviceInfo.text }}</span> |
| | | <div |
| | | :class="['lineStatus', { 'device-status-0': deviceInfo.status === 0 }, { 'device-status-1': deviceInfo.status === 1 }]"> |
| | | :class="['lineStatus', { 'device-status-0': deviceInfo.status === true }, { 'device-status-1': deviceInfo.status === false }]"> |
| | | </div> |
| | | </div> |
| | | <div class="otherValuefix"> |
| | | <el-form label-position="left" label-width="60px"> |
| | | <el-form label-position="left" label-width="80px"> |
| | | <el-form-item label="任务号"> |
| | | <el-input v-model="deviceInfo.taskNumber"></el-input> |
| | | <el-input v-model="deviceInfo.taskNo"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="任务类型"> |
| | | <el-input></el-input> |
| | | <el-select clearable="" v-model="deviceInfo.taskType" placeholder="请选择状态"> |
| | | <el-option v-for="(item, index) in dl('TaskTypeEnum')" :key="index" |
| | | :value="Number(item.value)" :label="`${item.name} (${item.code}) [${item.value}] `" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="PLC"> |
| | | <el-input></el-input> |
| | | <el-input v-model="deviceInfo.plc"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="WCS"> |
| | | <el-input></el-input> |
| | | <el-input v-model="deviceInfo.wcs"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="状态"> |
| | | <el-input></el-input> |
| | | <el-input :value="deviceInfo.status ? '在线' : '离线'" readonly></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | |
| | | |
| | | <script lang="ts" setup> |
| | | import { ref, reactive } from 'vue'; |
| | | import { listWcsDevice } from '/@/api/wcs/wcsDevice'; |
| | | import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils'; |
| | | import { getDictLabelByVal as dv } from '/@/utils/dict-utils'; |
| | | |
| | | const lineOptions = [{ |
| | | value: '001', |
| | | label: '一楼输送线' |
| | | }, { |
| | | value: '002', |
| | | label: '二楼输送线' |
| | | }, { |
| | | value: '003', |
| | | label: '三楼输送线' |
| | | }]; |
| | | const lineValue = '001'; |
| | | const stations = ref<any>([]); |
| | | const listStackingMachineData = ref<any>([]); |
| | | |
| | | const stationOptions = [{ |
| | | value: '200', |
| | | label: '200' |
| | | }, { |
| | | value: '202', |
| | | label: '202' |
| | | }, { |
| | | value: '300', |
| | | label: '300' |
| | | }]; |
| | | const stationValue = '200'; |
| | | const lineValue = ref('1'); |
| | | const stationValue = ref(); |
| | | |
| | | |
| | | const deviceList = [ |
| | | { |
| | | id: 1, |
| | | name: '1号码垛机器人', |
| | | taskNumber: 'T000001', |
| | | taskType: '', |
| | | plc: '', |
| | | wcs: '', |
| | | status: 0 |
| | | }, |
| | | { |
| | | id: 2, |
| | | name: '2号码垛机器人', |
| | | taskNumber: '', |
| | | taskType: '', |
| | | plc: '', |
| | | wcs: '', |
| | | status: 1 |
| | | }, |
| | | { |
| | | id: 3, |
| | | name: '3号码垛机器人', |
| | | taskNumber: '', |
| | | taskType: '', |
| | | plc: '', |
| | | wcs: '', |
| | | status: 0 |
| | | }, { |
| | | id: 4, |
| | | name: '4号码垛机器人', |
| | | taskNumber: '', |
| | | taskType: '', |
| | | plc: '', |
| | | wcs: '', |
| | | status: 1 |
| | | }, { |
| | | id: 5, |
| | | name: '5号码垛机器人', |
| | | taskNumber: '', |
| | | taskType: '', |
| | | plc: '', |
| | | wcs: '', |
| | | status: 0 |
| | | }, { |
| | | id: 6, |
| | | name: '6号码垛机器人', |
| | | taskNumber: '', |
| | | taskType: '', |
| | | plc: '', |
| | | wcs: '', |
| | | status: 0 |
| | | }, { |
| | | id: 7, |
| | | name: '7号码垛机器人', |
| | | taskNumber: '', |
| | | taskType: '', |
| | | plc: '', |
| | | wcs: '', |
| | | status: '' |
| | | }, { |
| | | id: 8, |
| | | name: '8号码垛机器人', |
| | | taskNumber: '', |
| | | taskType: '', |
| | | plc: '', |
| | | wcs: '', |
| | | status: 0 |
| | | // 查询操作 |
| | | const handleQuery = async () => { |
| | | var res = await listWcsDevice(); |
| | | listStackingMachineData.value = res.data.result.filter(s => s.type == 0); |
| | | const listConveyorLineData = res.data.result.filter(s => s.type == 1 || s.type == 4); |
| | | stations.value = { |
| | | '1': listConveyorLineData.filter(s => s.text = '1层托盘输送线'), |
| | | '2': listConveyorLineData.filter(s => s.text = '2层托盘输送线'), |
| | | '3': listConveyorLineData.filter(s => s.text = '3层托盘输送线') |
| | | } |
| | | ] |
| | | if (stations.value.length > 0) |
| | | stationValue.value = stations.value[0][0].id; |
| | | debugger; |
| | | }; |
| | | handleQuery(); |
| | | |
| | | |
| | | const lineOptions = [ |
| | | { value: '1', label: '一楼输送线' }, |
| | | { value: '2', label: '二楼输送线' }, |
| | | { value: '3', label: '三楼输送线' } |
| | | ]; |
| | | |
| | | const deviceList = reactive([ |
| | | { id: 1, name: '1号码垛机器人', taskNumber: 'T000001', taskType: '', plc: '', wcs: '', status: 0 }, |
| | | { id: 2, name: '2号码垛机器人', taskNumber: '', taskType: '', plc: '', wcs: '', status: 1 }, |
| | | { id: 3, name: '3号码垛机器人', taskNumber: '', taskType: '', plc: '', wcs: '', status: 0 }, |
| | | { id: 4, name: '4号码垛机器人', taskNumber: '', taskType: '', plc: '', wcs: '', status: 1 }, |
| | | { id: 5, name: '5号码垛机器人', taskNumber: '', taskType: '', plc: '', wcs: '', status: 0 }, |
| | | { id: 6, name: '6号码垛机器人', taskNumber: '', taskType: '', plc: '', wcs: '', status: 0 }, |
| | | { id: 7, name: '7号码垛机器人', taskNumber: '', taskType: '', plc: '', wcs: '', status: '' }, |
| | | { id: 8, name: '8号码垛机器人', taskNumber: '', taskType: '', plc: '', wcs: '', status: 0 } |
| | | ]); |
| | | |
| | | const deviceTypeText = (taskType: number) => { |
| | | switch (taskType) { |
| | | case 0: |
| | | return '入库任务' |
| | | case 1: |
| | | return '出库任务' |
| | | case 2: |
| | | return '移库任务' |
| | | case 3: |
| | | return 'PLC申请入库' |
| | | } |
| | | return '' |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | |
| | | border-bottom: 1px solid rgb(197, 195, 195); |
| | | display: flex; |
| | | align-items: center; |
| | | height: 40px; |
| | | height: 30px; |
| | | position: relative; |
| | | } |
| | | |
| | | .lineStatus { |
| | | position: absolute; |
| | | right: 0; |
| | | float: right; |
| | | height: 20px; |
| | | width: 20px; |
| | | border-radius: 20px; |
| | | border-radius: 50%; |
| | | background-color: #67C23A; |
| | | } |
| | | |
| | | .choosefix { |
| | | width: 100%; |
| | | height: auto; |
| | | padding: 10px; |
| | | border-bottom: 1px solid rgb(197, 195, 195); |
| | | } |
| | | |
| | | .box-card { |
| | | width: 280px; |
| | | width: 100%; |
| | | max-width: 280px; |
| | | background: linear-gradient(135deg, #66ccff, #3399ff); |
| | | border-radius: 10px; |
| | | box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); |
| | | color: #fff; |
| | | } |
| | | |
| | | .lineValuefix { |
| | | width: 100%; |
| | | height: 500px; |
| | | padding: 10px; |
| | | border-bottom: 1px solid rgb(197, 195, 195); |
| | | } |
| | | |
| | | .lineButtonfix { |
| | | width: 100%; |
| | | height: 50px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | padding: 10px; |
| | | } |
| | | |
| | | .otherValuefix { |
| | | width: 100%; |
| | | height: 220px; |
| | | padding: 10px; |
| | | border-bottom: 1px solid rgb(197, 195, 195); |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 10px; |
| | | /* Optional, for spacing between form items */ |
| | | } |
| | | |
| | | .card-container { |
| | | display: grid; |
| | | grid-template-columns: repeat(4, 1fr); |
| | | grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); |
| | | gap: 10px; |
| | | } |
| | | |
| | | .other-box-card { |
| | | box-sizing: border-box; |
| | | background: linear-gradient(135deg, #66ccff, #3399ff); |
| | | border-radius: 10px; |
| | | box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); |
| | | color: #fff; |
| | | display: flex; |
| | | flex-direction: column; |
| | | height: auto; |
| | | /* Ensure card height adjusts based on content */ |
| | | } |
| | | |
| | | .otherButtonfix { |
| | | width: 100%; |
| | | height: 50px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | padding: 0; |
| | | padding: 10px; |
| | | } |
| | | |
| | | .device-status-0 { |
| | |
| | | |
| | | .device-status-1 { |
| | | background-color: red; |
| | | } |
| | | |
| | | .box-card, |
| | | .other-box-card { |
| | | background: linear-gradient(135deg, #66ccff, #3399ff); |
| | | border-radius: 10px; |
| | | box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); |
| | | color: #fff; |
| | | } |
| | | |
| | | .linefix span { |
| | |
| | | |
| | | </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> |
| | |
| | | console.log('重连成功task'); |
| | | }); |
| | | |
| | | // connection.on('PublicTask', () => {}); |
| | | connection.on('PublicTask', () => {}); |
| | | |
| | | export { connection as signalR }; |