wxw
2024-09-02 54da8a22c438e1495b9c5fbae75ca9d4b5ca7335
Merge branch 'master' into wxw
24个文件已修改
614 ■■■■■ 已修改文件
Admin.NET/WCS.Application/Entity/WcsDevice.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Entity/WcsPosition.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Enum/PLCEnum.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Hub/IPlcHub.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Hub/PlcHub.cs 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Hub/TaskLogHub.cs 66 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/PLC/PLCTaskAction.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Service/WcsAlarmInfo/WcsAlarmInfoService.cs 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceDto.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceInput.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceOutput.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs 49 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Service/WcsPosition/Dto/WcsPositionDto.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Service/WcsPosition/Dto/WcsPositionInput.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Service/WcsPosition/Dto/WcsPositionOutput.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Web/src/api/wcs/wcsDevice.ts 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Web/src/views/device/alarmManage/index.vue 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Web/src/views/device/deviceInfo/index.vue 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Web/src/views/device/deviceMonitor/index.vue 228 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Web/src/views/wcs/wcsDevice/component/editDialog.vue 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Web/src/views/wcs/wcsDevice/index.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Web/src/views/wcs/wcsPosition/component/editDialog.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Web/src/views/wcs/wcsPosition/index.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Web/src/views/wcs/wcsTask/signalR.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Entity/WcsDevice.cs
@@ -15,6 +15,13 @@
    public long PlcId { get; set; }
    /// <summary>
    /// 交互类型
    /// </summary>
    [Required]
    [SugarColumn(ColumnName = "DeviceType", ColumnDescription = "交互类型")]
    public DeviceTypeEnum DeviceType { get; set; }
    /// <summary>
    /// 设备级别
    /// </summary>
    [Required]
Admin.NET/WCS.Application/Entity/WcsPosition.cs
@@ -35,6 +35,12 @@
    [SugarColumn(ColumnName = "PosType", ColumnDescription = "流程字类型")]
    public PLCDataTypeEnum PosType { get; set; }
    
    /// <summary>
    /// 字符串长度
    /// </summary>
    [SugarColumn(ColumnName = "StringLength", ColumnDescription = "字符串长度")]
    public int? StringLength { get; set; }
    /// <summary>
    /// 显示屏ip地址
    /// </summary>
Admin.NET/WCS.Application/Enum/PLCEnum.cs
@@ -139,3 +139,20 @@
    [Description("String")]
    String = 11,
}
/// <summary>
/// 交互类型
/// </summary>
[Description("交互类型")]
public enum DeviceTypeEnum
{
    /// <summary>
    /// 业务
    /// </summary>
    [Description("业务")]
    Business = 1,
    /// <summary>
    /// 页面展示
    /// </summary>
    [Description("页面展示")]
    Show = 2,
}
Admin.NET/WCS.Application/Hub/IPlcHub.cs
@@ -28,5 +28,10 @@
        /// <param name="context"></param>
        /// <returns></returns>
        Task PublicAlarm(WcsAlarmInfoOutput context);
        /// <summary>
        /// 修改服务状态
        /// </summary>
        /// <param name="context"></param>
        Task UpdateService(PLCServiceModel context);
    }
}
Admin.NET/WCS.Application/Hub/PlcHub.cs
@@ -4,7 +4,7 @@
namespace WCS.Application;
/// <summary>
/// PLC集线器
/// 任务日志集线器
/// </summary>
[MapHub("/hubs/Plc")]
public class PlcHub : Hub<IPlcHub>
@@ -20,10 +20,10 @@
    /// </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>
    /// 下发工位状态
@@ -36,12 +36,29 @@
    //}
    /// <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; }
}
Admin.NET/WCS.Application/Hub/TaskLogHub.cs
@@ -16,41 +16,41 @@
        _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);
    }
}
Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
@@ -22,7 +22,11 @@
    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()
    {
@@ -84,7 +88,7 @@
                    }
                    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);
Admin.NET/WCS.Application/Service/WcsAlarmInfo/WcsAlarmInfoService.cs
@@ -1,6 +1,4 @@
using Microsoft.AspNetCore.SignalR;
namespace WCS.Application;
namespace WCS.Application;
/// <summary>
/// 报警信息表服务
@@ -9,12 +7,9 @@
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>
@@ -123,10 +118,7 @@
    [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("开发中");
    }
Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceDto.cs
@@ -12,6 +12,11 @@
    public string PlcIdIP { get; set; }
    /// <summary>
    /// 交互类型
    /// </summary>
    public DeviceTypeEnum DeviceType { get; set; }
    /// <summary>
    /// 主键Id
    /// </summary>
    public long Id { get; set; }
Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceInput.cs
@@ -20,6 +20,11 @@
    public virtual long PlcId { get; set; }
    /// <summary>
    /// 交互类型
    /// </summary>
    public virtual DeviceTypeEnum DeviceType { get; set; }
    /// <summary>
    /// 设备级别
    /// </summary>
    public virtual DeviceLevelEnum Level { get; set; }
@@ -138,6 +143,11 @@
    /// </summary>
    [Required(ErrorMessage = "PlcId不能为空")]
    public override long PlcId { get; set; }
    /// <summary>
    /// 交互类型
    /// </summary>
    [Required(ErrorMessage = "交互类型不能为空")]
    public override DeviceTypeEnum DeviceType { get; set; }
    /// <summary>
    /// 设备级别
Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceOutput.cs
@@ -12,6 +12,11 @@
    public long Id { get; set; }
    /// <summary>
    /// 交互类型
    /// </summary>
    public DeviceTypeEnum DeviceType { get; set; }
    /// <summary>
    /// PlcId
    /// </summary>
    public long PlcId { get; set; }
@@ -20,6 +25,11 @@
    /// PlcId 描述
    /// </summary>
    public string PlcIdIP { get; set; }
    /// <summary>
    /// 设备类型
    /// </summary>
    public PLCTypeEnum Type { get; set; }
    /// <summary>
    /// 设备级别
@@ -106,6 +116,20 @@
    /// </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; }
}
Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs
@@ -1,4 +1,6 @@

using Admin.NET.Core.Service;
namespace WCS.Application;
/// <summary>
@@ -8,9 +10,11 @@
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>
@@ -41,6 +45,7 @@
            {
                Id = u.Id,
                PlcId = u.PlcId,
                DeviceType = (DeviceTypeEnum)u.DeviceType,
                PlcIdIP = plcid.IP,
                Level = (DeviceLevelEnum)u.Level,
                DbNumber = u.DbNumber,
@@ -121,19 +126,6 @@
    }
    /// <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>
@@ -199,5 +191,34 @@
        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;
    }
}
Admin.NET/WCS.Application/Service/WcsPosition/Dto/WcsPositionDto.cs
@@ -37,6 +37,11 @@
        public PLCDataTypeEnum? PosType { get; set; }
        
        /// <summary>
    /// 字符串长度
    /// </summary>
    public int? StringLength { get; set; }
    /// <summary>
        /// 显示屏ip地址
        /// </summary>
        public string? LedIP { get; set; }
Admin.NET/WCS.Application/Service/WcsPosition/Dto/WcsPositionInput.cs
@@ -27,6 +27,11 @@
    public virtual PLCDataTypeEnum PosType { get; set; }
    /// <summary>
    /// 字符串长度
    /// </summary>
    public virtual int? StringLength { get; set; }
    /// <summary>
    /// 显示屏ip地址
    /// </summary>
    public virtual string? LedIP { get; set; }
Admin.NET/WCS.Application/Service/WcsPosition/Dto/WcsPositionOutput.cs
@@ -37,6 +37,11 @@
    public PLCDataTypeEnum? PosType { get; set; }
    /// <summary>
    /// 字符串长度
    /// </summary>
    public int? StringLength { get; set; }
    /// <summary>
    /// 显示屏ip地址
    /// </summary>
    public string? LedIP { get; set; }
Web/src/api/wcs/wcsDevice.ts
@@ -7,6 +7,7 @@
  DetailWcsDevice = '/api/wcsDevice/detail',
  GetWcsPlcPlcIdDropdown = '/api/wcsDevice/WcsPlcPlcIdDropdown',
  GeneratePos = '/api/wcsDevice/GeneratePos',
  ListWcsDevice = '/api/wcsDevice/list',
}
// 增加设备信息
@@ -62,3 +63,8 @@
    data: params
    });
    
export const listWcsDevice = () =>
    request({
    url: Api.ListWcsDevice,
    method: 'get'
    });
Web/src/views/device/alarmManage/index.vue
@@ -5,16 +5,13 @@
                <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">
@@ -52,11 +49,29 @@
</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 },
@@ -1905,41 +1920,8 @@
//复位报警
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);//一层
Web/src/views/device/deviceInfo/index.vue
@@ -5,27 +5,32 @@
                <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>
@@ -69,7 +74,6 @@
import { listStatus } from '/@/api/wcs/wcsPlc';
import { signalR } from './signalR';
const state = ref<any>({});
const stackers = ref<any>({});
const conveyors = ref<any>({});
@@ -102,7 +106,15 @@
        }
        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);
@@ -1910,7 +1922,7 @@
//输送线数据
let cellsData = ref(cellsDataOne);;
let cellsData = ref(cellsDataOne);
const isPlain1 = ref(false);//一层
const isPlain2 = ref(true);//二层
@@ -2077,10 +2089,12 @@
.active2>div {
    display: none;
}
.active3 {
    background-color: #fff;
    border:1px solid red;
}
.active3>div {
    display: none;
}
Web/src/views/device/deviceMonitor/index.vue
@@ -9,17 +9,15 @@
                <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>
@@ -35,13 +33,19 @@
                        <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>
@@ -52,29 +56,32 @@
        </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>
@@ -94,101 +101,63 @@
<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>
@@ -204,69 +173,80 @@
    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 {
@@ -275,14 +255,6 @@
.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 {
Web/src/views/wcs/wcsDevice/component/editDialog.vue
@@ -24,6 +24,15 @@
                    </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"
Web/src/views/wcs/wcsDevice/index.vue
@@ -55,6 +55,12 @@
          </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',
Web/src/views/wcs/wcsPosition/component/editDialog.vue
@@ -47,6 +47,11 @@
                        
                    </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 />
                            
Web/src/views/wcs/wcsPosition/index.vue
@@ -64,6 +64,7 @@
              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>
Web/src/views/wcs/wcsTask/signalR.ts
@@ -32,6 +32,6 @@
    console.log('重连成功task');
});
// connection.on('PublicTask', () => {});
connection.on('PublicTask', () => {});
export { connection as signalR };