diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite new file mode 100644 index 0000000..03a966c Binary files /dev/null and b/.vs/slnx.sqlite differ diff --git a/vol-net6/VOL.Data/IRepositories/data/IData_DeviceRepository.cs b/vol-net6/VOL.Data/IRepositories/config/IData_ConfigRepository.cs similarity index 73% rename from vol-net6/VOL.Data/IRepositories/data/IData_DeviceRepository.cs rename to vol-net6/VOL.Data/IRepositories/config/IData_ConfigRepository.cs index 51406a6..2b0faf5 100644 --- a/vol-net6/VOL.Data/IRepositories/data/IData_DeviceRepository.cs +++ b/vol-net6/VOL.Data/IRepositories/config/IData_ConfigRepository.cs @@ -1,6 +1,6 @@ /* *代码由框架生成,任何更改都可能导致被代码生成器覆盖 - *Repository提供数据库操作,如果要增加数据库操作请在当前目录下Partial文件夹IData_DeviceRepository编写接口 + *Repository提供数据库操作,如果要增加数据库操作请在当前目录下Partial文件夹IData_ConfigRepository编写接口 */ using System; using System.Collections.Generic; @@ -12,7 +12,7 @@ using VOL.Entity.DomainModels; using VOL.Core.Extensions.AutofacManager; namespace VOL.Data.IRepositories { - public partial interface IData_DeviceRepository : IDependency,IRepository + public partial interface IData_ConfigRepository : IDependency,IRepository { } } diff --git a/vol-net6/VOL.Data/IRepositories/machine/IData_MachineRepository.cs b/vol-net6/VOL.Data/IRepositories/machine/IData_MachineRepository.cs new file mode 100644 index 0000000..1319286 --- /dev/null +++ b/vol-net6/VOL.Data/IRepositories/machine/IData_MachineRepository.cs @@ -0,0 +1,18 @@ +/* + *代码由框架生成,任何更改都可能导致被代码生成器覆盖 + *Repository提供数据库操作,如果要增加数据库操作请在当前目录下Partial文件夹IData_MachineRepository编写接口 + */ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using VOL.Core.BaseProvider; +using VOL.Entity.DomainModels; +using VOL.Core.Extensions.AutofacManager; +namespace VOL.Data.IRepositories +{ + public partial interface IData_MachineRepository : IDependency,IRepository + { + } +} diff --git a/vol-net6/VOL.Data/IRepositories/data/IData_ProduceRepository.cs b/vol-net6/VOL.Data/IRepositories/produce/IData_ProduceRepository.cs similarity index 100% rename from vol-net6/VOL.Data/IRepositories/data/IData_ProduceRepository.cs rename to vol-net6/VOL.Data/IRepositories/produce/IData_ProduceRepository.cs diff --git a/vol-net6/VOL.Data/IServices/data/IData_DeviceService.cs b/vol-net6/VOL.Data/IServices/config/IData_ConfigService.cs similarity index 72% rename from vol-net6/VOL.Data/IServices/data/IData_DeviceService.cs rename to vol-net6/VOL.Data/IServices/config/IData_ConfigService.cs index 9b84bad..502df3e 100644 --- a/vol-net6/VOL.Data/IServices/data/IData_DeviceService.cs +++ b/vol-net6/VOL.Data/IServices/config/IData_ConfigService.cs @@ -6,7 +6,7 @@ using VOL.Entity.DomainModels; namespace VOL.Data.IServices { - public partial interface IData_DeviceService : IService + public partial interface IData_ConfigService : IService { } } diff --git a/vol-net6/VOL.Data/IServices/data/Partial/IData_DeviceService.cs b/vol-net6/VOL.Data/IServices/config/Partial/IData_ConfigService.cs similarity index 60% rename from vol-net6/VOL.Data/IServices/data/Partial/IData_DeviceService.cs rename to vol-net6/VOL.Data/IServices/config/Partial/IData_ConfigService.cs index 85d1fe6..4309979 100644 --- a/vol-net6/VOL.Data/IServices/data/Partial/IData_DeviceService.cs +++ b/vol-net6/VOL.Data/IServices/config/Partial/IData_ConfigService.cs @@ -1,5 +1,5 @@ /* -*所有关于Data_Device类的业务代码接口应在此处编写 +*所有关于Data_Config类的业务代码接口应在此处编写 */ using VOL.Core.BaseProvider; using VOL.Entity.DomainModels; @@ -7,7 +7,7 @@ using VOL.Core.Utilities; using System.Linq.Expressions; namespace VOL.Data.IServices { - public partial interface IData_DeviceService + public partial interface IData_ConfigService { } } diff --git a/vol-net6/VOL.Data/IServices/machine/IData_MachineService.cs b/vol-net6/VOL.Data/IServices/machine/IData_MachineService.cs new file mode 100644 index 0000000..2001ef7 --- /dev/null +++ b/vol-net6/VOL.Data/IServices/machine/IData_MachineService.cs @@ -0,0 +1,12 @@ +/* + *代码由框架生成,任何更改都可能导致被代码生成器覆盖 + */ +using VOL.Core.BaseProvider; +using VOL.Entity.DomainModels; + +namespace VOL.Data.IServices +{ + public partial interface IData_MachineService : IService + { + } +} diff --git a/vol-net6/VOL.Data/IServices/machine/Partial/IData_MachineService.cs b/vol-net6/VOL.Data/IServices/machine/Partial/IData_MachineService.cs new file mode 100644 index 0000000..0609559 --- /dev/null +++ b/vol-net6/VOL.Data/IServices/machine/Partial/IData_MachineService.cs @@ -0,0 +1,13 @@ +/* +*所有关于Data_Machine类的业务代码接口应在此处编写 +*/ +using VOL.Core.BaseProvider; +using VOL.Entity.DomainModels; +using VOL.Core.Utilities; +using System.Linq.Expressions; +namespace VOL.Data.IServices +{ + public partial interface IData_MachineService + { + } + } diff --git a/vol-net6/VOL.Data/IServices/modbus/IDataProcessing.cs b/vol-net6/VOL.Data/IServices/modbus/IDataProcessing.cs index 52047b2..4a3f381 100644 --- a/vol-net6/VOL.Data/IServices/modbus/IDataProcessing.cs +++ b/vol-net6/VOL.Data/IServices/modbus/IDataProcessing.cs @@ -1,6 +1,10 @@ -using System; +using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; +using System; +using System.Collections; using System.Collections.Generic; using System.Linq; +using System.Net; +using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; using VOL.Entity.DomainModels; @@ -9,8 +13,15 @@ namespace VOL.Data.IServices.modbus { public interface IDataProcessing { + // 读西门子数据 + Dictionary> readSiemensData(IModbusService modbus); + + // 读广数数据 + Dictionary> readGSKData(IModbusService modbus); + + // 写设备运行数据 - bool saveDeviceData(Data_Device device, out string message); + bool saveDeviceData(Data_Machine machine, out string message); // 写设备生产数据 diff --git a/vol-net6/VOL.Data/IServices/data/IData_ProduceService.cs b/vol-net6/VOL.Data/IServices/produce/IData_ProduceService.cs similarity index 100% rename from vol-net6/VOL.Data/IServices/data/IData_ProduceService.cs rename to vol-net6/VOL.Data/IServices/produce/IData_ProduceService.cs diff --git a/vol-net6/VOL.Data/IServices/data/Partial/IData_ProduceService.cs b/vol-net6/VOL.Data/IServices/produce/Partial/IData_ProduceService.cs similarity index 100% rename from vol-net6/VOL.Data/IServices/data/Partial/IData_ProduceService.cs rename to vol-net6/VOL.Data/IServices/produce/Partial/IData_ProduceService.cs diff --git a/vol-net6/VOL.Data/Repositories/data/Data_DeviceRepository.cs b/vol-net6/VOL.Data/Repositories/config/Data_ConfigRepository.cs similarity index 53% rename from vol-net6/VOL.Data/Repositories/data/Data_DeviceRepository.cs rename to vol-net6/VOL.Data/Repositories/config/Data_ConfigRepository.cs index 2f3ab54..5b56ac4 100644 --- a/vol-net6/VOL.Data/Repositories/data/Data_DeviceRepository.cs +++ b/vol-net6/VOL.Data/Repositories/config/Data_ConfigRepository.cs @@ -1,6 +1,6 @@ /* *代码由框架生成,任何更改都可能导致被代码生成器覆盖 - *Repository提供数据库操作,如果要增加数据库操作请在当前目录下Partial文件夹Data_DeviceRepository编写代码 + *Repository提供数据库操作,如果要增加数据库操作请在当前目录下Partial文件夹Data_ConfigRepository编写代码 */ using VOL.Data.IRepositories; using VOL.Core.BaseProvider; @@ -10,15 +10,15 @@ using VOL.Entity.DomainModels; namespace VOL.Data.Repositories { - public partial class Data_DeviceRepository : RepositoryBase , IData_DeviceRepository + public partial class Data_ConfigRepository : RepositoryBase , IData_ConfigRepository { - public Data_DeviceRepository(VOLContext dbContext) + public Data_ConfigRepository(VOLContext dbContext) : base(dbContext) { } - public static IData_DeviceRepository Instance + public static IData_ConfigRepository Instance { - get { return AutofacContainerModule.GetService(); } } + get { return AutofacContainerModule.GetService(); } } } } diff --git a/vol-net6/VOL.Data/Repositories/machine/Data_MachineRepository.cs b/vol-net6/VOL.Data/Repositories/machine/Data_MachineRepository.cs new file mode 100644 index 0000000..66b3cb1 --- /dev/null +++ b/vol-net6/VOL.Data/Repositories/machine/Data_MachineRepository.cs @@ -0,0 +1,24 @@ +/* + *代码由框架生成,任何更改都可能导致被代码生成器覆盖 + *Repository提供数据库操作,如果要增加数据库操作请在当前目录下Partial文件夹Data_MachineRepository编写代码 + */ +using VOL.Data.IRepositories; +using VOL.Core.BaseProvider; +using VOL.Core.EFDbContext; +using VOL.Core.Extensions.AutofacManager; +using VOL.Entity.DomainModels; + +namespace VOL.Data.Repositories +{ + public partial class Data_MachineRepository : RepositoryBase , IData_MachineRepository + { + public Data_MachineRepository(VOLContext dbContext) + : base(dbContext) + { + + } + public static IData_MachineRepository Instance + { + get { return AutofacContainerModule.GetService(); } } + } +} diff --git a/vol-net6/VOL.Data/Repositories/data/Data_ProduceRepository.cs b/vol-net6/VOL.Data/Repositories/produce/Data_ProduceRepository.cs similarity index 100% rename from vol-net6/VOL.Data/Repositories/data/Data_ProduceRepository.cs rename to vol-net6/VOL.Data/Repositories/produce/Data_ProduceRepository.cs diff --git a/vol-net6/VOL.Data/Services/config/Data_ConfigService.cs b/vol-net6/VOL.Data/Services/config/Data_ConfigService.cs new file mode 100644 index 0000000..ea08790 --- /dev/null +++ b/vol-net6/VOL.Data/Services/config/Data_ConfigService.cs @@ -0,0 +1,27 @@ +/* + *Author:jxx + *Contact:283591387@qq.com + *代码由框架生成,此处任何更改都可能导致被代码生成器覆盖 + *所有业务编写全部应在Partial文件夹下Data_ConfigService与IData_ConfigService中编写 + */ +using VOL.Data.IRepositories; +using VOL.Data.IServices; +using VOL.Core.BaseProvider; +using VOL.Core.Extensions.AutofacManager; +using VOL.Entity.DomainModels; + +namespace VOL.Data.Services +{ + public partial class Data_ConfigService : ServiceBase + , IData_ConfigService, IDependency + { + public Data_ConfigService(IData_ConfigRepository repository) + : base(repository) + { + Init(repository); + } + public static IData_ConfigService Instance + { + get { return AutofacContainerModule.GetService(); } } + } + } diff --git a/vol-net6/VOL.Data/Services/data/Partial/Data_DeviceService.cs b/vol-net6/VOL.Data/Services/config/Partial/Data_ConfigService.cs similarity index 58% rename from vol-net6/VOL.Data/Services/data/Partial/Data_DeviceService.cs rename to vol-net6/VOL.Data/Services/config/Partial/Data_ConfigService.cs index e6dc9ce..82eb28a 100644 --- a/vol-net6/VOL.Data/Services/data/Partial/Data_DeviceService.cs +++ b/vol-net6/VOL.Data/Services/config/Partial/Data_ConfigService.cs @@ -1,10 +1,10 @@ /* - *所有关于Data_Device类的业务代码应在此处编写 + *所有关于Data_Config类的业务代码应在此处编写 *可使用repository.调用常用方法,获取EF/Dapper等信息 *如果需要事务请使用repository.DbContextBeginTransaction *也可使用DBServerProvider.手动获取数据库相关信息 *用户信息、权限、角色等使用UserContext.Current操作 -*Data_DeviceService对增、删、改查、导入、导出、审核业务代码扩展参照ServiceFunFilter +*Data_ConfigService对增、删、改查、导入、导出、审核业务代码扩展参照ServiceFunFilter */ using VOL.Core.BaseProvider; using VOL.Core.Extensions.AutofacManager; @@ -20,14 +20,14 @@ using VOL.Data.IRepositories; namespace VOL.Data.Services { - public partial class Data_DeviceService + public partial class Data_ConfigService { private readonly IHttpContextAccessor _httpContextAccessor; - private readonly IData_DeviceRepository _repository;//访问数据库 + private readonly IData_ConfigRepository _repository;//访问数据库 [ActivatorUtilitiesConstructor] - public Data_DeviceService( - IData_DeviceRepository dbRepository, + public Data_ConfigService( + IData_ConfigRepository dbRepository, IHttpContextAccessor httpContextAccessor ) : base(dbRepository) @@ -35,15 +35,7 @@ namespace VOL.Data.Services _httpContextAccessor = httpContextAccessor; _repository = dbRepository; //多租户会用到这init代码,其他情况可以不用 - Init(dbRepository); + //base.Init(dbRepository); } - - //重写ServiceBase Init方法,设置IsMultiTenancy=true开启多租户功能 - protected override void Init(IRepository repository) - { - //开启多租户功能,开启后会对查询、导出、删除、编辑功能同时生效 - //如果只需要对某个功能生效,如编辑,则在重写编辑方法中设置 IsMultiTenancy = true; - IsMultiTenancy = true; - } - } + } } diff --git a/vol-net6/VOL.Data/Services/data/Data_DeviceService.cs b/vol-net6/VOL.Data/Services/data/Data_DeviceService.cs deleted file mode 100644 index 6642633..0000000 --- a/vol-net6/VOL.Data/Services/data/Data_DeviceService.cs +++ /dev/null @@ -1,27 +0,0 @@ -/* - *Author:jxx - *Contact:283591387@qq.com - *代码由框架生成,此处任何更改都可能导致被代码生成器覆盖 - *所有业务编写全部应在Partial文件夹下Data_DeviceService与IData_DeviceService中编写 - */ -using VOL.Data.IRepositories; -using VOL.Data.IServices; -using VOL.Core.BaseProvider; -using VOL.Core.Extensions.AutofacManager; -using VOL.Entity.DomainModels; - -namespace VOL.Data.Services -{ - public partial class Data_DeviceService : ServiceBase - , IData_DeviceService, IDependency - { - public Data_DeviceService(IData_DeviceRepository repository) - : base(repository) - { - Init(repository); - } - public static IData_DeviceService Instance - { - get { return AutofacContainerModule.GetService(); } } - } - } diff --git a/vol-net6/VOL.Data/Services/machine/Data_MachineService.cs b/vol-net6/VOL.Data/Services/machine/Data_MachineService.cs new file mode 100644 index 0000000..ebb507c --- /dev/null +++ b/vol-net6/VOL.Data/Services/machine/Data_MachineService.cs @@ -0,0 +1,27 @@ +/* + *Author:jxx + *Contact:283591387@qq.com + *代码由框架生成,此处任何更改都可能导致被代码生成器覆盖 + *所有业务编写全部应在Partial文件夹下Data_MachineService与IData_MachineService中编写 + */ +using VOL.Data.IRepositories; +using VOL.Data.IServices; +using VOL.Core.BaseProvider; +using VOL.Core.Extensions.AutofacManager; +using VOL.Entity.DomainModels; + +namespace VOL.Data.Services +{ + public partial class Data_MachineService : ServiceBase + , IData_MachineService, IDependency + { + public Data_MachineService(IData_MachineRepository repository) + : base(repository) + { + Init(repository); + } + public static IData_MachineService Instance + { + get { return AutofacContainerModule.GetService(); } } + } + } diff --git a/vol-net6/VOL.Data/Services/machine/Partial/Data_MachineService.cs b/vol-net6/VOL.Data/Services/machine/Partial/Data_MachineService.cs new file mode 100644 index 0000000..fbad578 --- /dev/null +++ b/vol-net6/VOL.Data/Services/machine/Partial/Data_MachineService.cs @@ -0,0 +1,41 @@ +/* + *所有关于Data_Machine类的业务代码应在此处编写 +*可使用repository.调用常用方法,获取EF/Dapper等信息 +*如果需要事务请使用repository.DbContextBeginTransaction +*也可使用DBServerProvider.手动获取数据库相关信息 +*用户信息、权限、角色等使用UserContext.Current操作 +*Data_MachineService对增、删、改查、导入、导出、审核业务代码扩展参照ServiceFunFilter +*/ +using VOL.Core.BaseProvider; +using VOL.Core.Extensions.AutofacManager; +using VOL.Entity.DomainModels; +using System.Linq; +using VOL.Core.Utilities; +using System.Linq.Expressions; +using VOL.Core.Extensions; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.AspNetCore.Http; +using VOL.Data.IRepositories; + +namespace VOL.Data.Services +{ + public partial class Data_MachineService + { + private readonly IHttpContextAccessor _httpContextAccessor; + private readonly IData_MachineRepository _repository;//访问数据库 + + [ActivatorUtilitiesConstructor] + public Data_MachineService( + IData_MachineRepository dbRepository, + IHttpContextAccessor httpContextAccessor + ) + : base(dbRepository) + { + _httpContextAccessor = httpContextAccessor; + _repository = dbRepository; + //多租户会用到这init代码,其他情况可以不用 + //base.Init(dbRepository); + } + } +} diff --git a/vol-net6/VOL.Data/Services/modbus/DataProcessing.cs b/vol-net6/VOL.Data/Services/modbus/DataProcessing.cs index a9d4f6c..76189dd 100644 --- a/vol-net6/VOL.Data/Services/modbus/DataProcessing.cs +++ b/vol-net6/VOL.Data/Services/modbus/DataProcessing.cs @@ -16,20 +16,114 @@ namespace VOL.Data.Services.modbus _httpContextAccessor = httpContextAccessor; } - // 写设备运行数据 - public bool saveDeviceData(Data_Device device, out string message) { + + // 读西门子数据 + public Dictionary> readSiemensData(IModbusService modbus) + { + // 生产数据 + Dictionary map1 = new Dictionary + { + { "com_status", modbus.readData(1, 6430, "int16") }, // 通讯状态 5:通讯正常 15:通讯断线 + { "run_time", modbus.readData(1, 6435, "int16") }, // 运行时长 分钟 + { "turnout_1", modbus.readData(1, 6436, "int16") }, // 工单1产量 件 + { "turnout_2", modbus.readData(1, 6437, "int16") }, // 工单2产量 件 + { "turnout_3", modbus.readData(1, 6438, "int16") }, // 工单3产量 件 + { "turnout_all", modbus.readData(1, 6439, "int16") }, // 当班产量 件 + { "status", modbus.readData(1, 6440, "int16") }, // 运行状态 0:待机 1:运行 2:故障 + { "schedule_1", modbus.readData(1, 1315, "single") }, // 工单1任务进度 % + { "schedule_2", modbus.readData(1, 1317, "single") }, // 工单2任务进度 % + { "schedule_3", modbus.readData(1, 1319, "single") }, // 工单3任务进度 % + { "yield_1", modbus.readData(1, 1321, "single") }, // 工单1良品率 % 真实值 *= 100 + { "yield_2", modbus.readData(1, 1323, "single") }, // 工单2良品率 % 真实值 *= 100 + { "yield_3", modbus.readData(1, 1325, "single") }, // 工单3良品率 % 真实值 *= 100 + { "oee", modbus.readData(1, 1339, "single") }, // 设备综合效率 % 真实值 *= 100 + }; + + // 机床数据 + Dictionary map2 = new Dictionary + { + // 操作模式 0:JOG 1:AUTO 2:AUTO + TEACHIN 3:JOG + REPOIN 4:JOG + REPOS + // 5:MDA 6:MDA + REPOS 7:MDA + REPOS + TEAHIN8:MDA + TEACHIN + { "com_status", modbus.readData(1, 6430, "int16") }, // 通讯状态 5:通讯正常 15:通讯断线 + { "smode", modbus.readData(1, 6099, "int16") }, + { "state", modbus.readData(1, 6429, "int16") }, // 运行状态 0:待机 1:故障 2:运行 3:暂停 + { "temperature", modbus.readData(1, 1201, "single")}, // 电机温度 ℃ + { "potential", modbus.readData(1, 1203, "single")}, // 母线电压 V + { "current", modbus.readData(1, 1205, "single")}, // 实际电流 A + { "quantity", modbus.readData(1, 1215, "single")}, // 加工数 次 + { "cut_rate", modbus.readData(1, 1225, "single")}, // 切削倍率 + { "main_rate", modbus.readData(1, 1231, "single")}, // 主轴倍率 + { "run_program_no", modbus.readData(1, 6689, "string", 26)}, // 加工程序号 length = 52 + }; + + // 组装Map返回 + Dictionary> map = new(); + map.Add("produce", map1); + map.Add("device", map2); + return map; + } + + // 读广数数据 + public Dictionary> readGSKData(IModbusService modbus) + { + // 生产数据 + Dictionary map1 = new Dictionary + { + { "program_no", modbus.readData(1, 6429, "int16") }, // 程序编号 + { "com_status", modbus.readData(1, 6430, "int16") }, // 通讯状态 5:通讯正常 15:通讯断线 + { "run_time", modbus.readData(1, 6435, "int16") }, // 运行时长 分钟 + { "turnout_1", modbus.readData(1, 6436, "int16") }, // 工单1产量 件 + { "turnout_2", modbus.readData(1, 6437, "int16") }, // 工单2产量 件 + { "turnout_3", modbus.readData(1, 6438, "int16") }, // 工单3产量 件 + { "turnout_all", modbus.readData(1, 6439, "int16") }, // 当班产量 件 + { "status", modbus.readData(1, 6435, "int16") }, // 运行状态 0:待机 1:运行 2:故障 + { "schedule_1", modbus.readData(1, 1315, "single") }, // 工单1任务进度 % + { "schedule_2", modbus.readData(1, 1317, "single") }, // 工单2任务进度 % + { "schedule_3", modbus.readData(1, 1319, "single") }, // 工单3任务进度 % + { "yield_1", modbus.readData(1, 1321, "single") }, // 工单1良品率 % 真实值 *= 100 + { "yield_2", modbus.readData(1, 1323, "single") }, // 工单2良品率 % 真实值 *= 100 + { "yield_3", modbus.readData(1, 1325, "single") }, // 工单3良品率 % 真实值 *= 100 + { "oee", modbus.readData(1, 1331, "single") }, // 设备综合效率 % 真实值 *= 100 + }; + + // 机床数据 + Dictionary map2 = new Dictionary + { + { "com_status", modbus.readData(1, 6430, "int16") }, // 通讯状态 5:通讯正常 15:通讯断线 + { "gmode", modbus.readData(1, 6099, "int16") }, // 工作方式 0:编辑 1:自动 2:MDI 3:DNC 4:手动 5:手轮 6:回参考点 + { "state", modbus.readData(1, 6099, "int16") }, // 运行状态 0:复位 1:停止 2:运行 3:暂停 + { "quantity", modbus.readData(1, 1199, "int32")}, // 加工数量 次 + { "on_time", modbus.readData(1, 1201, "int32")}, // 开机时间 秒 + { "run_time", modbus.readData(1, 1203, "int32")}, // 运行时间 秒 + { "feed_rate", modbus.readData(1, 1241, "single")}, // 进给倍率 + { "main_rate", modbus.readData(1, 1247, "single")}, // 主轴倍率 + { "run_program_no", modbus.readData(1, 6299, "string", 4)}, // 运行程序编号 length = 8 + { "run_time_total", modbus.readData(1, 4115, "int32")}, // 累计运行时长 分钟 + { "quantity_total", modbus.readData(1, 4117, "int32")} // 累计加工数 次 + }; + + // 组装Map返回 + Dictionary> map = new(); + map.Add("produce", map1); + map.Add("device", map2); + return map; + } + + + // 写机床数据 + public bool saveDeviceData(Data_Machine machine, out string message) { SaveModel model = new SaveModel(); Dictionary mapData = new() { - { "temperature", device.temperature ?? 68.0M }, - { "potential", device.potential ?? 220.0M }, - { "current", device.current ?? 24.0M }, - { "processno", device.processno ?? "10092768" }, - { "run_mode", device.run_mode ?? 1 } + //{ "temperature", device.temperature ?? 68.0M }, + //{ "potential", device.potential ?? 220.0M }, + //{ "current", device.current ?? 24.0M }, + //{ "processno", device.processno ?? "10092768" }, + //{ "run_mode", device.run_mode ?? 1 } }; model.MainData = mapData; try { - Core.Utilities.WebResponseContent result = Data_DeviceService.Instance.Add(model); + Core.Utilities.WebResponseContent result = Data_MachineService.Instance.Add(model); if (!result.Status) { message = result.Message; @@ -48,19 +142,19 @@ namespace VOL.Data.Services.modbus - // 写设备生产数据 + // 写生产数据 public bool saveProduceData(Data_Produce produce, out string message) { SaveModel model = new SaveModel(); Dictionary mapData = new() { - { "standby_time", produce.standby_time ?? 24 }, - { "run_time", produce.run_time ?? 20 }, - { "status", produce.status ?? 1 }, - { "turnout", produce.turnout ?? 1640 }, - { "turnout_one", produce.turnout_one ?? 450 }, - { "turnout_two", produce.turnout_two ?? 630 }, - { "turnout_three", produce.turnout_three ?? 560 } + //{ "standby_time", produce.standby_time ?? 24 }, + //{ "run_time", produce.run_time ?? 20 }, + //{ "status", produce.status ?? 1 }, + //{ "turnout", produce.turnout ?? 1640 }, + //{ "turnout_one", produce.turnout_one ?? 450 }, + //{ "turnout_two", produce.turnout_two ?? 630 }, + //{ "turnout_three", produce.turnout_three ?? 560 } }; model.MainData = mapData; try diff --git a/vol-net6/VOL.Data/Services/data/Data_ProduceService.cs b/vol-net6/VOL.Data/Services/produce/Data_ProduceService.cs similarity index 100% rename from vol-net6/VOL.Data/Services/data/Data_ProduceService.cs rename to vol-net6/VOL.Data/Services/produce/Data_ProduceService.cs diff --git a/vol-net6/VOL.Data/Services/data/Partial/Data_ProduceService.cs b/vol-net6/VOL.Data/Services/produce/Partial/Data_ProduceService.cs similarity index 100% rename from vol-net6/VOL.Data/Services/data/Partial/Data_ProduceService.cs rename to vol-net6/VOL.Data/Services/produce/Partial/Data_ProduceService.cs diff --git a/vol-net6/VOL.Entity/DomainModels/data/Data_Device.cs b/vol-net6/VOL.Entity/DomainModels/config/Data_Config.cs similarity index 66% rename from vol-net6/VOL.Entity/DomainModels/data/Data_Device.cs rename to vol-net6/VOL.Entity/DomainModels/config/Data_Config.cs index f103520..efcb8e3 100644 --- a/vol-net6/VOL.Entity/DomainModels/data/Data_Device.cs +++ b/vol-net6/VOL.Entity/DomainModels/config/Data_Config.cs @@ -13,62 +13,53 @@ using VOL.Entity.SystemModels; namespace VOL.Entity.DomainModels { - [Entity(TableCnName = "设备运行",TableName = "Data_Device")] - public partial class Data_Device:BaseEntity + [Entity(TableCnName = "设备配置",TableName = "Data_Config")] + public partial class Data_Config:BaseEntity { /// - ///ID + /// /// [Key] - [Display(Name ="ID")] + [Display(Name ="id")] [Column(TypeName="int")] [Editable(true)] [Required(AllowEmptyStrings=false)] public int id { get; set; } /// - ///电机温度 + ///设备名称 /// - [Display(Name ="电机温度")] - [DisplayFormat(DataFormatString="10,2")] - [Column(TypeName="decimal")] + [Display(Name ="设备名称")] + [MaxLength(255)] + [Column(TypeName="nvarchar(255)")] [Editable(true)] - public decimal? temperature { get; set; } + public string name { get; set; } /// - ///母线电压 + ///机床类型 /// - [Display(Name ="母线电压")] - [DisplayFormat(DataFormatString="10,2")] - [Column(TypeName="decimal")] + [Display(Name ="机床类型")] + [Column(TypeName="short")] [Editable(true)] - public decimal? potential { get; set; } + public short? type { get; set; } /// - ///实际电流 + ///设备IP /// - [Display(Name ="实际电流")] - [DisplayFormat(DataFormatString="10,2")] - [Column(TypeName="decimal")] + [Display(Name ="设备IP")] + [MaxLength(255)] + [Column(TypeName="nvarchar(255)")] [Editable(true)] - public decimal? current { get; set; } + public string device_ip { get; set; } /// - ///加工程序号 + ///通讯IP /// - [Display(Name ="加工程序号")] + [Display(Name ="通讯IP")] [MaxLength(60)] [Column(TypeName="nvarchar(60)")] [Editable(true)] - public string processno { get; set; } - - /// - ///运行模式 - /// - [Display(Name ="运行模式")] - [Column(TypeName="short")] - [Editable(true)] - public short? run_mode { get; set; } + public string com_ip { get; set; } /// /// @@ -88,9 +79,9 @@ namespace VOL.Entity.DomainModels public string Creator { get; set; } /// - ///记录时间 + ///创建时间 /// - [Display(Name ="记录时间")] + [Display(Name ="创建时间")] [Column(TypeName="datetime")] [Editable(true)] public DateTime? CreateDate { get; set; } diff --git a/vol-net6/VOL.Entity/DomainModels/data/partial/Data_Device.cs b/vol-net6/VOL.Entity/DomainModels/config/partial/Data_Config.cs similarity index 94% rename from vol-net6/VOL.Entity/DomainModels/data/partial/Data_Device.cs rename to vol-net6/VOL.Entity/DomainModels/config/partial/Data_Config.cs index 4e6fdba..74182b5 100644 --- a/vol-net6/VOL.Entity/DomainModels/data/partial/Data_Device.cs +++ b/vol-net6/VOL.Entity/DomainModels/config/partial/Data_Config.cs @@ -14,7 +14,7 @@ using VOL.Entity.SystemModels; namespace VOL.Entity.DomainModels { - public partial class Data_Device + public partial class Data_Config { //此处配置字段(字段配置见此model的另一个partial),如果表中没有此字段请加上 [NotMapped]属性,否则会异常 } diff --git a/vol-net6/VOL.Entity/DomainModels/machine/Data_Machine.cs b/vol-net6/VOL.Entity/DomainModels/machine/Data_Machine.cs new file mode 100644 index 0000000..e0290f5 --- /dev/null +++ b/vol-net6/VOL.Entity/DomainModels/machine/Data_Machine.cs @@ -0,0 +1,225 @@ +/* + *代码由框架生成,任何更改都可能导致被代码生成器覆盖 + *如果数据库字段发生变化,请在代码生器重新生成此Model + */ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using VOL.Entity.SystemModels; + +namespace VOL.Entity.DomainModels +{ + [Entity(TableCnName = "机床数据",TableName = "Data_Machine")] + public partial class Data_Machine:BaseEntity + { + /// + /// + /// + [Key] + [Display(Name ="id")] + [Column(TypeName="int")] + [Editable(true)] + [Required(AllowEmptyStrings=false)] + public int id { get; set; } + + /// + ///设备信息 + /// + [Display(Name ="设备信息")] + [Column(TypeName="int")] + [Editable(true)] + [Required(AllowEmptyStrings=false)] + public int config_id { get; set; } + + /// + ///通讯状态 + /// + [Display(Name ="通讯状态")] + [Column(TypeName="short")] + [Editable(true)] + public short? com_status { get; set; } + + /// + ///运行模式(西门子) + /// + [Display(Name ="运行模式(西门子)")] + [Column(TypeName="short")] + [Editable(true)] + public short? smode { get; set; } + + /// + ///运行模式(广数) + /// + [Display(Name ="运行模式(广数)")] + [Column(TypeName="short")] + [Editable(true)] + public short? gmode { get; set; } + + /// + ///加工程序号 + /// + [Display(Name ="加工程序号")] + [MaxLength(60)] + [Column(TypeName="nvarchar(60)")] + [Editable(true)] + public string run_program_no { get; set; } + + /// + ///运行状态 + /// + [Display(Name ="运行状态")] + [Column(TypeName="short")] + [Editable(true)] + public short? state { get; set; } + + /// + ///电机温度 + /// + [Display(Name ="电机温度")] + [DisplayFormat(DataFormatString="10,2")] + [Column(TypeName="decimal")] + [Editable(true)] + public decimal? temperature { get; set; } + + /// + ///母线电压 + /// + [Display(Name ="母线电压")] + [DisplayFormat(DataFormatString="10,2")] + [Column(TypeName="decimal")] + [Editable(true)] + public decimal? potential { get; set; } + + /// + ///实际电流 + /// + [Display(Name ="实际电流")] + [DisplayFormat(DataFormatString="10,2")] + [Column(TypeName="decimal")] + [Editable(true)] + public decimal? current { get; set; } + + /// + ///加工数 + /// + [Display(Name ="加工数")] + [Column(TypeName="bigint")] + [Editable(true)] + public long? quantity { get; set; } + + /// + ///主轴倍率 + /// + [Display(Name ="主轴倍率")] + [DisplayFormat(DataFormatString="10,2")] + [Column(TypeName="decimal")] + [Editable(true)] + public decimal? main_rate { get; set; } + + /// + ///进给倍率 + /// + [Display(Name ="进给倍率")] + [DisplayFormat(DataFormatString="10,2")] + [Column(TypeName="decimal")] + [Editable(true)] + public decimal? feed_rate { get; set; } + + /// + ///切削倍率 + /// + [Display(Name ="切削倍率")] + [DisplayFormat(DataFormatString="10,2")] + [Column(TypeName="decimal")] + [Editable(true)] + public decimal? cut_rate { get; set; } + + /// + ///开机时间 + /// + [Display(Name ="开机时间")] + [Column(TypeName="bigint")] + [Editable(true)] + public long? on_time { get; set; } + + /// + ///运行时间 + /// + [Display(Name ="运行时间")] + [Column(TypeName="bigint")] + [Editable(true)] + public long? run_time { get; set; } + + /// + ///累计运行时长 + /// + [Display(Name ="累计运行时长")] + [Column(TypeName="bigint")] + [Editable(true)] + public long? run_time_total { get; set; } + + /// + ///累计加工数 + /// + [Display(Name ="累计加工数")] + [Column(TypeName="bigint")] + [Editable(true)] + public long? quantity_total { get; set; } + + /// + /// + /// + [Display(Name ="CreateID")] + [Column(TypeName="int")] + [Editable(true)] + public int? CreateID { get; set; } + + /// + /// + /// + [Display(Name ="Creator")] + [MaxLength(255)] + [Column(TypeName="nvarchar(255)")] + [Editable(true)] + public string Creator { get; set; } + + /// + ///记录时间 + /// + [Display(Name ="记录时间")] + [Column(TypeName="datetime")] + [Editable(true)] + public DateTime? CreateDate { get; set; } + + /// + /// + /// + [Display(Name ="ModifyID")] + [Column(TypeName="int")] + [Editable(true)] + public int? ModifyID { get; set; } + + /// + /// + /// + [Display(Name ="Modifier")] + [MaxLength(255)] + [Column(TypeName="nvarchar(255)")] + [Editable(true)] + public string Modifier { get; set; } + + /// + ///更新时间 + /// + [Display(Name ="更新时间")] + [Column(TypeName="datetime")] + [Editable(true)] + public DateTime? ModifyDate { get; set; } + + + } +} \ No newline at end of file diff --git a/vol-net6/VOL.Entity/DomainModels/machine/partial/Data_Machine.cs b/vol-net6/VOL.Entity/DomainModels/machine/partial/Data_Machine.cs new file mode 100644 index 0000000..6f1267c --- /dev/null +++ b/vol-net6/VOL.Entity/DomainModels/machine/partial/Data_Machine.cs @@ -0,0 +1,21 @@ +/* + *代码由框架生成,任何更改都可能导致被代码生成器覆盖 + *如果数据库字段发生变化,请在代码生器重新生成此Model + */ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using VOL.Entity.SystemModels; + +namespace VOL.Entity.DomainModels +{ + + public partial class Data_Machine + { + //此处配置字段(字段配置见此model的另一个partial),如果表中没有此字段请加上 [NotMapped]属性,否则会异常 + } +} \ No newline at end of file diff --git a/vol-net6/VOL.Entity/DomainModels/data/Data_Produce.cs b/vol-net6/VOL.Entity/DomainModels/produce/Data_Produce.cs similarity index 54% rename from vol-net6/VOL.Entity/DomainModels/data/Data_Produce.cs rename to vol-net6/VOL.Entity/DomainModels/produce/Data_Produce.cs index 8d78f92..4f69768 100644 --- a/vol-net6/VOL.Entity/DomainModels/data/Data_Produce.cs +++ b/vol-net6/VOL.Entity/DomainModels/produce/Data_Produce.cs @@ -27,12 +27,29 @@ namespace VOL.Entity.DomainModels public int id { get; set; } /// - ///待机时长 + ///设备信息 /// - [Display(Name ="待机时长")] + [Display(Name ="设备信息")] [Column(TypeName="int")] [Editable(true)] - public int? standby_time { get; set; } + [Required(AllowEmptyStrings=false)] + public int config_id { get; set; } + + /// + ///程序编号 + /// + [Display(Name ="程序编号")] + [Column(TypeName="int")] + [Editable(true)] + public int? program_no { get; set; } + + /// + ///通讯状态 + /// + [Display(Name ="通讯状态")] + [Column(TypeName="int")] + [Editable(true)] + public int? com_status { get; set; } /// ///运行时长 @@ -56,7 +73,7 @@ namespace VOL.Entity.DomainModels [Display(Name ="当班产量")] [Column(TypeName="int")] [Editable(true)] - public int? turnout { get; set; } + public int? turnout_all { get; set; } /// ///工单 1 产量 @@ -64,7 +81,7 @@ namespace VOL.Entity.DomainModels [Display(Name ="工单 1 产量")] [Column(TypeName="int")] [Editable(true)] - public int? turnout_one { get; set; } + public int? turnout_1 { get; set; } /// ///工单 2 产量 @@ -72,7 +89,7 @@ namespace VOL.Entity.DomainModels [Display(Name ="工单 2 产量")] [Column(TypeName="int")] [Editable(true)] - public int? turnout_two { get; set; } + public int? turnout_2 { get; set; } /// ///工单 3 产量 @@ -80,7 +97,70 @@ namespace VOL.Entity.DomainModels [Display(Name ="工单 3 产量")] [Column(TypeName="int")] [Editable(true)] - public int? turnout_three { get; set; } + public int? turnout_3 { get; set; } + + /// + ///工单1任务进度 + /// + [Display(Name ="工单1任务进度")] + [DisplayFormat(DataFormatString="10,2")] + [Column(TypeName="decimal")] + [Editable(true)] + public decimal? schedule_1 { get; set; } + + /// + ///工单2任务进度 + /// + [Display(Name ="工单2任务进度")] + [DisplayFormat(DataFormatString="10,2")] + [Column(TypeName="decimal")] + [Editable(true)] + public decimal? schedule_2 { get; set; } + + /// + ///工单3任务进度 + /// + [Display(Name ="工单3任务进度")] + [DisplayFormat(DataFormatString="10,2")] + [Column(TypeName="decimal")] + [Editable(true)] + public decimal? schedule_3 { get; set; } + + /// + ///工单1良品率 + /// + [Display(Name ="工单1良品率")] + [DisplayFormat(DataFormatString="10,2")] + [Column(TypeName="decimal")] + [Editable(true)] + public decimal? yield_1 { get; set; } + + /// + ///工单2良品率 + /// + [Display(Name ="工单2良品率")] + [DisplayFormat(DataFormatString="10,2")] + [Column(TypeName="decimal")] + [Editable(true)] + public decimal? yield_2 { get; set; } + + /// + ///工单3良品率 + /// + [Display(Name ="工单3良品率")] + [DisplayFormat(DataFormatString="10,2")] + [Column(TypeName="decimal")] + [Editable(true)] + public decimal? yield_3 { get; set; } + + /// + ///设备综合效率 + /// + [Display(Name ="设备综合效率")] + [DisplayFormat(DataFormatString="10,2")] + [Column(TypeName="decimal")] + [Editable(true)] + public decimal? oee { get; set; } /// /// @@ -125,9 +205,9 @@ namespace VOL.Entity.DomainModels public string Modifier { get; set; } /// - /// + ///更新时间 /// - [Display(Name ="ModifyDate")] + [Display(Name ="更新时间")] [Column(TypeName="datetime")] [Editable(true)] public DateTime? ModifyDate { get; set; } diff --git a/vol-net6/VOL.Entity/DomainModels/data/partial/Data_Produce.cs b/vol-net6/VOL.Entity/DomainModels/produce/partial/Data_Produce.cs similarity index 100% rename from vol-net6/VOL.Entity/DomainModels/data/partial/Data_Produce.cs rename to vol-net6/VOL.Entity/DomainModels/produce/partial/Data_Produce.cs diff --git a/vol-net6/VOL.Entity/MappingConfiguration/data/Data_DeviceMapConfig.cs b/vol-net6/VOL.Entity/MappingConfiguration/config/Data_ConfigMapConfig.cs similarity index 66% rename from vol-net6/VOL.Entity/MappingConfiguration/data/Data_DeviceMapConfig.cs rename to vol-net6/VOL.Entity/MappingConfiguration/config/Data_ConfigMapConfig.cs index 43c5c72..c109456 100644 --- a/vol-net6/VOL.Entity/MappingConfiguration/data/Data_DeviceMapConfig.cs +++ b/vol-net6/VOL.Entity/MappingConfiguration/config/Data_ConfigMapConfig.cs @@ -4,9 +4,9 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace VOL.Entity.MappingConfiguration { - public class Data_DeviceMapConfig : EntityMappingConfiguration + public class Data_ConfigMapConfig : EntityMappingConfiguration { - public override void Map(EntityTypeBuilder + public override void Map(EntityTypeBuilder builderTable) { //b.Property(x => x.StorageName).HasMaxLength(45); diff --git a/vol-net6/VOL.Entity/MappingConfiguration/machine/Data_MachineMapConfig.cs b/vol-net6/VOL.Entity/MappingConfiguration/machine/Data_MachineMapConfig.cs new file mode 100644 index 0000000..05893a1 --- /dev/null +++ b/vol-net6/VOL.Entity/MappingConfiguration/machine/Data_MachineMapConfig.cs @@ -0,0 +1,16 @@ +using VOL.Entity.MappingConfiguration; +using VOL.Entity.DomainModels; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace VOL.Entity.MappingConfiguration +{ + public class Data_MachineMapConfig : EntityMappingConfiguration + { + public override void Map(EntityTypeBuilder + builderTable) + { + //b.Property(x => x.StorageName).HasMaxLength(45); + } + } +} + diff --git a/vol-net6/VOL.Entity/MappingConfiguration/data/Data_ProduceMapConfig.cs b/vol-net6/VOL.Entity/MappingConfiguration/produce/Data_ProduceMapConfig.cs similarity index 100% rename from vol-net6/VOL.Entity/MappingConfiguration/data/Data_ProduceMapConfig.cs rename to vol-net6/VOL.Entity/MappingConfiguration/produce/Data_ProduceMapConfig.cs diff --git a/vol-net6/VOL.WebApi/Controllers/Data/DataCaptureController.cs b/vol-net6/VOL.WebApi/Controllers/Data/DataCaptureController.cs index 788242b..140f109 100644 --- a/vol-net6/VOL.WebApi/Controllers/Data/DataCaptureController.cs +++ b/vol-net6/VOL.WebApi/Controllers/Data/DataCaptureController.cs @@ -60,22 +60,7 @@ namespace VOL.WebApi.Controllers.Data return Content("master modbus disconnect!"); } try { - // 读Int16 - ushort[] us1 = _service.ReadHoldingRegisters(1, 9, 1); - short v = DataConvertUtil.GetShort(us1, 0); - Console.WriteLine("Short Data:" + v); - // 读Float - ushort[] us2 = _service.ReadHoldingRegisters(1, 1, 2); - float f = DataConvertUtil.GetReal(us2, 0); - Console.WriteLine("Real Data:" + f); - // 读Bool - ushort[] us3 = _service.ReadHoldingRegisters(1, 11, 1); - bool[] bs = DataConvertUtil.GetBools(us3,0,1); - Console.WriteLine("Bools Data:" + String.Join(",",bs)); - // 读String - ushort[] target = _service.ReadHoldingRegisters(1, 30, 6); - string str = DataConvertUtil.GetString(target,0,6); - Console.WriteLine("String Data:" + str.ToString()); + } catch (Exception ex) { Console.WriteLine(ex.Message); return Content("read data error!"); diff --git a/vol-net6/VOL.WebApi/Controllers/Data/DataTestController.cs b/vol-net6/VOL.WebApi/Controllers/Data/DataTestController.cs index f414979..74b42a6 100644 --- a/vol-net6/VOL.WebApi/Controllers/Data/DataTestController.cs +++ b/vol-net6/VOL.WebApi/Controllers/Data/DataTestController.cs @@ -234,36 +234,43 @@ namespace VOL.WebApi.Controllers.Data [HttpGet, HttpPost, Route("unitTestSem")] public IActionResult Test02() { - Console.Write(5 / 2); - _service = new ModbusTcpService("192.168.0.99", 502); + _service = new ModbusTcpService("192.168.1.99", 502); if (_service.isConnected) { // 读取从0开始,文档上地址从1开始的,地址需要减1 Console.WriteLine("=========read4x========="); // 写数据 - _service.writeData(1, 6429, 1); + //_service.writeData(1, 6429, 1); - _service.writeData(1, 1173, 256); + //_service.writeData(1, 1173, 256); - _service.writeData(1, 1215, 6.28F); + //_service.writeData(1, 1215, 6.28F); - _service.writeData(1, 6691, "Hello World!!"); + //_service.writeData(1, 6691, "Hello World!!"); // 读数据 - short s = _service.readData(1, 6429, "int16"); - - int i = _service.readData(1, 1173, "int32"); - - float f = _service.readData(1, 1215, "single"); + //short s = _service.readData(1, 6429, "int16"); // 运行模式 + //float f = _service.readData(1, 1215, "single"); // 加工数 + //int i = _service.readData(1, 1173, "int32"); + //string str = _service.readData(1, 6690, "string", 52); + + //Console.WriteLine(s); + //Console.WriteLine(f); + //Console.WriteLine(i); + //Console.WriteLine(str); - string str = _service.readData(1, 6690, "string", 52); + //short s = _service.readData(1, 6429, "int16"); // 运行模式 + //float f1 = _service.readData(1, 1231, "single"); // 主轴倍率 + //float f2 = _service.readData(1, 1215, "single"); // 加工数 + //Console.WriteLine(s); + //Console.WriteLine(f1); + //Console.WriteLine(f2); + //Console.WriteLine(str); + short s = _service.readData(1, 6430, "int16"); // 通讯状态 Console.WriteLine(s); - Console.WriteLine(i); - Console.WriteLine(f); - Console.WriteLine(str); Console.WriteLine("=========read4x========="); @@ -281,35 +288,51 @@ namespace VOL.WebApi.Controllers.Data [HttpGet, HttpPost, Route("unitTestCnc")] public IActionResult Test03() { - _service = new ModbusTcpService("192.168.0.100", 502); + _service = new ModbusTcpService("192.168.1.100", 502); + //_service = new ModbusTcpService("192.168.1.99", 502); if (_service.isConnected) { // 读取从0开始,文档上地址从1开始的,地址需要减1 Console.WriteLine("=========read4x========="); // 写数据 - _service.writeData(1, 6424, 2); + //_service.writeData(1, 6424, 2); - _service.writeData(1, 1309, 65537); + //_service.writeData(1, 1309, 65537); - _service.writeData(1, 1307, 5.68F); + //_service.writeData(1, 1307, 5.68F); - _service.writeData(1, 6640, "hehe"); + //_service.writeData(1, 6640, "hehe"); // 读数据 - short s = _service.readData(1, 6424, "int16"); + //short s = _service.readData(1, 6424, "int16"); - int i = _service.readData(1, 1309, "int32"); + //int i = _service.readData(1, 1309, "int32"); - float f = _service.readData(1, 1307, "single"); + //float f = _service.readData(1, 1307, "single"); - string str = _service.readData(1, 6640, "string", 2); // 一个寄存器地址存放两个字符 + //string str = _service.readData(1, 6640, "string", 2); // 一个寄存器地址存放两个字符 + + //Console.WriteLine(s); + //Console.WriteLine(i); + //Console.WriteLine(f); + //Console.WriteLine(str); + //_service.writeData(1, 1307, 120F); + //_service.writeData(1, 1299, 19912F); + //_service.writeData(1, 6424, 2); + //_service.writeData(1, 6402, 25); + + //Console.WriteLine(_service.readData(1, 1307, "single")); // 加工数量 + //Console.WriteLine(_service.readData(1, 1299, "single")); // 切削时间 + //Console.WriteLine(_service.readData(1, 6424, "int16")); // 运行模式 + //Console.WriteLine(_service.readData(1, 6402, "int16")); // 快速倍率 + //Console.WriteLine(_service.readData(1, 6425, "int16")); // 轴状态 + + Console.WriteLine(_service.readData(1, 6429, "int16")); + Console.WriteLine(_service.readData(1, 6430, "int16")); + Console.WriteLine(_service.readData(1, 6431, "int16")); - Console.WriteLine(s); - Console.WriteLine(i); - Console.WriteLine(f); - Console.WriteLine(str); Console.WriteLine("=========read4x========="); diff --git a/vol-net6/VOL.WebApi/Controllers/Data/Data_ConfigController.cs b/vol-net6/VOL.WebApi/Controllers/Data/Data_ConfigController.cs new file mode 100644 index 0000000..63c63f8 --- /dev/null +++ b/vol-net6/VOL.WebApi/Controllers/Data/Data_ConfigController.cs @@ -0,0 +1,21 @@ +/* + *代码由框架生成,任何更改都可能导致被代码生成器覆盖 + *如果要增加方法请在当前目录下Partial文件夹Data_ConfigController编写 + */ +using Microsoft.AspNetCore.Mvc; +using VOL.Core.Controllers.Basic; +using VOL.Entity.AttributeManager; +using VOL.Data.IServices; +namespace VOL.Data.Controllers +{ + [Route("api/Data_Config")] + [PermissionTable(Name = "Data_Config")] + public partial class Data_ConfigController : ApiBaseController + { + public Data_ConfigController(IData_ConfigService service) + : base(service) + { + } + } +} + diff --git a/vol-net6/VOL.WebApi/Controllers/Data/Data_DeviceController.cs b/vol-net6/VOL.WebApi/Controllers/Data/Data_DeviceController.cs deleted file mode 100644 index 7f11ed8..0000000 --- a/vol-net6/VOL.WebApi/Controllers/Data/Data_DeviceController.cs +++ /dev/null @@ -1,24 +0,0 @@ -/* - *代码由框架生成,任何更改都可能导致被代码生成器覆盖 - *如果要增加方法请在当前目录下Partial文件夹Data_DeviceController编写 - */ -using Microsoft.AspNetCore.Mvc; -using VOL.Core.Controllers.Basic; -using VOL.Entity.AttributeManager; -using VOL.Data.IServices; -using System; - -namespace VOL.Data.Controllers -{ - [Route("api/Data_Device")] - [PermissionTable(Name = "Data_Device")] - public partial class Data_DeviceController : ApiBaseController - { - public Data_DeviceController(IData_DeviceService service) - : base(service) - { - // 类存在多个构造函数时,没有加ActivatorUtilitiesConstructor注解,不为指定的执行构造 - } - } -} - diff --git a/vol-net6/VOL.WebApi/Controllers/Data/Data_MachineController.cs b/vol-net6/VOL.WebApi/Controllers/Data/Data_MachineController.cs new file mode 100644 index 0000000..4057c71 --- /dev/null +++ b/vol-net6/VOL.WebApi/Controllers/Data/Data_MachineController.cs @@ -0,0 +1,21 @@ +/* + *代码由框架生成,任何更改都可能导致被代码生成器覆盖 + *如果要增加方法请在当前目录下Partial文件夹Data_MachineController编写 + */ +using Microsoft.AspNetCore.Mvc; +using VOL.Core.Controllers.Basic; +using VOL.Entity.AttributeManager; +using VOL.Data.IServices; +namespace VOL.Data.Controllers +{ + [Route("api/Data_Machine")] + [PermissionTable(Name = "Data_Machine")] + public partial class Data_MachineController : ApiBaseController + { + public Data_MachineController(IData_MachineService service) + : base(service) + { + } + } +} + diff --git a/vol-net6/VOL.WebApi/Controllers/Data/Partial/Data_DeviceController.cs b/vol-net6/VOL.WebApi/Controllers/Data/Partial/Data_ConfigController.cs similarity index 70% rename from vol-net6/VOL.WebApi/Controllers/Data/Partial/Data_DeviceController.cs rename to vol-net6/VOL.WebApi/Controllers/Data/Partial/Data_ConfigController.cs index 28fcbac..1a93351 100644 --- a/vol-net6/VOL.WebApi/Controllers/Data/Partial/Data_DeviceController.cs +++ b/vol-net6/VOL.WebApi/Controllers/Data/Partial/Data_ConfigController.cs @@ -1,7 +1,7 @@ /* *接口编写处... *如果接口需要做Action的权限验证,请在Action上使用属性 -*如: [ApiActionPermission("Data_Device",Enums.ActionPermissionOptions.Search)] +*如: [ApiActionPermission("Data_Config",Enums.ActionPermissionOptions.Search)] */ using Microsoft.AspNetCore.Mvc; using System; @@ -14,21 +14,20 @@ using VOL.Data.IServices; namespace VOL.Data.Controllers { - public partial class Data_DeviceController + public partial class Data_ConfigController { - private readonly IData_DeviceService _service;//访问业务代码 + private readonly IData_ConfigService _service;//访问业务代码 private readonly IHttpContextAccessor _httpContextAccessor; [ActivatorUtilitiesConstructor] - public Data_DeviceController( - IData_DeviceService service, + public Data_ConfigController( + IData_ConfigService service, IHttpContextAccessor httpContextAccessor ) : base(service) { _service = service; _httpContextAccessor = httpContextAccessor; - //Console.WriteLine("123456789"); } } } diff --git a/vol-net6/VOL.WebApi/Controllers/Data/Partial/Data_MachineController.cs b/vol-net6/VOL.WebApi/Controllers/Data/Partial/Data_MachineController.cs new file mode 100644 index 0000000..0969483 --- /dev/null +++ b/vol-net6/VOL.WebApi/Controllers/Data/Partial/Data_MachineController.cs @@ -0,0 +1,33 @@ +/* + *接口编写处... +*如果接口需要做Action的权限验证,请在Action上使用属性 +*如: [ApiActionPermission("Data_Machine",Enums.ActionPermissionOptions.Search)] + */ +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.AspNetCore.Http; +using VOL.Entity.DomainModels; +using VOL.Data.IServices; + +namespace VOL.Data.Controllers +{ + public partial class Data_MachineController + { + private readonly IData_MachineService _service;//访问业务代码 + private readonly IHttpContextAccessor _httpContextAccessor; + + [ActivatorUtilitiesConstructor] + public Data_MachineController( + IData_MachineService service, + IHttpContextAccessor httpContextAccessor + ) + : base(service) + { + _service = service; + _httpContextAccessor = httpContextAccessor; + } + } +} diff --git a/vol-vue3/src/components/basic/VolTable.vue b/vol-vue3/src/components/basic/VolTable.vue index 02db672..d75646f 100644 --- a/vol-vue3/src/components/basic/VolTable.vue +++ b/vol-vue3/src/components/basic/VolTable.vue @@ -1511,7 +1511,6 @@ export default defineComponent({ if (!column.bind || !column.bind.data) { return row[column.field]; } - if (column.edit && (column.edit.type == 'selectList'||column.edit.type=='treeSelect')) { if (!Array.isArray(val)) { row[column.field] = val.split(','); diff --git a/vol-vue3/src/extension/data/device/Data_Device.js b/vol-vue3/src/extension/data/config/Data_Config.js similarity index 100% rename from vol-vue3/src/extension/data/device/Data_Device.js rename to vol-vue3/src/extension/data/config/Data_Config.js diff --git a/vol-vue3/src/extension/data/machine/Data_Machine.js b/vol-vue3/src/extension/data/machine/Data_Machine.js new file mode 100644 index 0000000..0b28328 --- /dev/null +++ b/vol-vue3/src/extension/data/machine/Data_Machine.js @@ -0,0 +1,164 @@ +/***************************************************************************************** +** Author:jxx 2022 +** QQ:283591387 +**完整文档见:http://v2.volcore.xyz/document/api 【代码生成页面ViewGrid】 +**常用示例见:http://v2.volcore.xyz/document/vueDev +**后台操作见:http://v2.volcore.xyz/document/netCoreDev +*****************************************************************************************/ +//此js文件是用来自定义扩展业务代码,可以扩展一些自定义页面或者重新配置生成的代码 + +let extension = { + components: { + //查询界面扩展组件 + gridHeader: '', + gridBody: '', + gridFooter: '', + //新建、编辑弹出框扩展组件 + modelHeader: '', + modelBody: '', + modelFooter: '' + }, + tableAction: '', //指定某张表的权限(这里填写表名,默认不用填写) + buttons: { view: [], box: [], detail: [] }, //扩展的按钮 + methods: { + onInit() { //框架初始化配置前, + //设置排序字段 + this.pagination.sortName = "id"; + this.pagination.order = "desc"; + + //设置页面上显示的按钮个数 + this.maxBtnLength = 3; + + // 格式化数据 + this.dataFormatter(); + }, + onInited() { + //框架初始化配置后 + let fixeds = ['id','com_status','config_id']; + this.columns.forEach(x=>{ + //设置title列固定 + if (fixeds.includes(x.field)) { + x.fixed=true//也可以设置为right,固定到最右边 + } + }) + //如果要配置明细表,在此方法操作 + //this.detailOptions.columns.forEach(column=>{ }); + }, + searchBefore(param) { + //界面查询前,可以给param.wheres添加查询参数 + //返回false,则不会执行查询 + return true; + }, + searchAfter(result) { + //查询后,result返回的查询数据,可以在显示到表格前处理表格的值 + return true; + }, + addBefore(formData) { + //新建保存前formData为对象,包括明细表,可以给给表单设置值,自己输出看formData的值 + return true; + }, + updateBefore(formData) { + //编辑保存前formData为对象,包括明细表、删除行的Id + return true; + }, + rowClick({ row, column, event }) { + //查询界面点击行事件 + this.$refs.table.$refs.table.toggleRowSelection(row); //单击行时选中当前行; + }, + modelOpenAfter(row) { + //点击编辑、新建按钮弹出框后,可以在此处写逻辑,如,从后台获取数据 + //(1)判断是编辑还是新建操作: this.currentAction=='Add'; + //(2)给弹出框设置默认值 + //(3)this.editFormFields.字段='xxx'; + //如果需要给下拉框设置默认值,请遍历this.editFormOptions找到字段配置对应data属性的key值 + //看不懂就把输出看:console.log(this.editFormOptions) + }, + dataFormatter() { + this.columns.forEach(column => { + if (column.field == 'temperature') { + column.formatter = (row) => { + return row.temperature && '' + row.temperature + ' ℃ ' + } + } + if (column.field == 'potential') { + column.formatter = (row) => { + return row.potential && '' + row.potential + ' V ' + } + } + if (column.field == 'current') { + column.formatter = (row) => { + return row.current && '' + row.current + ' A ' + } + } + if (column.field == 'quantity') { + column.formatter = (row) => { + return row.quantity && '' + row.quantity + ' 次 ' + } + } + if (column.field == 'cut_rate') { + column.formatter = (row) => { + return row.cut_rate && '' + row.cut_rate + ' % ' + } + } + if (column.field == 'main_rate') { + column.formatter = (row) => { + return row.main_rate && '' + row.main_rate + ' % ' + } + } + if (column.field == 'feed_rate') { + column.formatter = (row) => { + return row.feed_rate && '' + row.feed_rate + ' % ' + } + } + if (column.field == 'on_time') { + column.formatter = (row) => { + return row.on_time && '' + row.on_time + ' 秒 ' + } + } + if (column.field == 'run_time') { + column.formatter = (row) => { + return row.run_time && '' + row.run_time + ' 秒 ' + } + } + if (column.field == 'run_time_total') { + column.formatter = (row) => { + return row.run_time_total && '' + row.run_time_total + ' 分 ' + } + } + if (column.field == 'quantity_total') { + column.formatter = (row) => { + return row.quantity_total && '' + row.quantity_total + ' 次 ' + } + } + + // 标签改色 + if (column.field == 'com_status') { + column.getColor = (row, column) => { + if (row.com_status == 15) { + return 'danger'; + } else if (row.com_status == 5){ + return 'success'; + } else { + return ''; + } + } + } + + if (column.field == 'state') { + column.getColor = (row, column) => { + if (row.state == 1) { + return 'danger'; + } else if (row.state == 2){ + return 'success'; + } else if (row.state == 3){ + return 'warning'; + } else { + return ''; + } + } + } + }) + } + } +}; +export default extension; diff --git a/vol-vue3/src/extension/data/produce/Data_Produce.js b/vol-vue3/src/extension/data/produce/Data_Produce.js index 8935403..3bad0d4 100644 --- a/vol-vue3/src/extension/data/produce/Data_Produce.js +++ b/vol-vue3/src/extension/data/produce/Data_Produce.js @@ -23,23 +23,24 @@ let extension = { methods: { //下面这些方法可以保留也可以删除 onInit() { //框架初始化配置前, - //示例:在按钮的最前面添加一个按钮 - // this.buttons.unshift({ //也可以用push或者splice方法来修改buttons数组 - // name: '按钮', //按钮名称 - // icon: 'el-icon-document', //按钮图标vue2版本见iview文档icon,vue3版本见element ui文档icon(注意不是element puls文档) - // type: 'primary', //按钮样式vue2版本见iview文档button,vue3版本见element ui文档button - // onClick: function () { - // this.$Message.success('点击了按钮'); - // } - // }); - - //示例:设置修改新建、编辑弹出框字段标签的长度 - // this.boxOptions.labelWidth = 150; + //设置排序字段 + this.pagination.sortName = "id"; + this.pagination.order = "desc"; + + //设置页面上显示的按钮个数 + this.maxBtnLength = 3; + + // 格式化数据 + this.dataFormatter(); }, onInited() { - //框架初始化配置后 - //如果要配置明细表,在此方法操作 - //this.detailOptions.columns.forEach(column=>{ }); + let fixeds = ['id','com_status','config_id']; + this.columns.forEach(x=>{ + //设置title列固定 + if (fixeds.includes(x.field)) { + x.fixed=true//也可以设置为right,固定到最右边 + } + }) }, searchBefore(param) { //界面查询前,可以给param.wheres添加查询参数 @@ -59,8 +60,8 @@ let extension = { return true; }, rowClick({ row, column, event }) { - //查询界面点击行事件 - // this.$refs.table.$refs.table.toggleRowSelection(row); //单击行时选中当前行; + //单击行时选中当前行 + this.$refs.table.$refs.table.toggleRowSelection(row); }, modelOpenAfter(row) { //点击编辑、新建按钮弹出框后,可以在此处写逻辑,如,从后台获取数据 @@ -69,6 +70,83 @@ let extension = { //(3)this.editFormFields.字段='xxx'; //如果需要给下拉框设置默认值,请遍历this.editFormOptions找到字段配置对应data属性的key值 //看不懂就把输出看:console.log(this.editFormOptions) + }, + dataFormatter() { + this.columns.forEach(column => { + if (column.field == 'run_time') { + column.formatter = (row) => { + return row.run_time && '' + row.run_time + ' 分 ' + } + } + if (column.field == 'turnout_1') { + column.formatter = (row) => { + return row.turnout_1 && '' + row.turnout_1 + ' 件 ' + } + } + if (column.field == 'turnout_2') { + column.formatter = (row) => { + return row.turnout_2 && '' + row.turnout_2 + ' 件 ' + } + } + if (column.field == 'turnout_3') { + column.formatter = (row) => { + return row.turnout_3 && '' + row.turnout_3 + ' 件 ' + } + } + if (column.field == 'turnout_all') { + column.formatter = (row) => { + return row.turnout_all && '' + row.turnout_all + ' 件 ' + } + } + if (column.field == 'schedule_1') { + column.formatter = (row) => { + return row.schedule_1 && '' + row.schedule_1 + ' % ' + } + } + if (column.field == 'schedule_2') { + column.formatter = (row) => { + return row.schedule_2 && '' + row.schedule_2 + ' % ' + } + } + if (column.field == 'schedule_3') { + column.formatter = (row) => { + return row.schedule_3 && '' + row.schedule_3 + ' % ' + } + } + if (column.field == 'yield_1') { + column.formatter = (row) => { + return row.yield_1 && '' + row.yield_1 * 100 + ' % ' + } + } + if (column.field == 'yield_2') { + column.formatter = (row) => { + return row.yield_2 && '' + row.yield_2 * 100 + ' % ' + } + } + if (column.field == 'yield_3') { + column.formatter = (row) => { + return row.yield_3 && '' + row.yield_3 * 100 + ' % ' + } + } + if (column.field == 'oee') { + column.formatter = (row) => { + return row.oee && '' + row.oee * 100 + ' % ' + } + } + + // 标签改色 + if (column.field == 'com_status') { + column.getColor = (row, column) => { + if (row.com_status == 15) { + return 'danger'; + } else if (row.com_status == 5){ + return 'success'; + } else { + return ''; + } + } + } + }) } } }; diff --git a/vol-vue3/src/router/viewGird.js b/vol-vue3/src/router/viewGird.js index 080bb0b..6c38105 100644 --- a/vol-vue3/src/router/viewGird.js +++ b/vol-vue3/src/router/viewGird.js @@ -144,15 +144,20 @@ let viewgird = [ name: 'Sys_Department', component: () => import('@/views/system/system/Sys_Department.vue') }, - { - path: '/Data_Device', - name: 'Data_Device', - component: () => import('@/views/data/device/Data_Device.vue') - }, { path: '/Data_Produce', name: 'Data_Produce', component: () => import('@/views/data/produce/Data_Produce.vue') + }, + { + path: '/Data_Config', + name: 'Data_Config', + component: () => import('@/views/data/config/Data_Config.vue') + }, + { + path: '/Data_Machine', + name: 'Data_Machine', + component: () => import('@/views/data/machine/Data_Machine.vue') } ] diff --git a/vol-vue3/src/views/data/config/Data_Config.vue b/vol-vue3/src/views/data/config/Data_Config.vue new file mode 100644 index 0000000..b19916c --- /dev/null +++ b/vol-vue3/src/views/data/config/Data_Config.vue @@ -0,0 +1,69 @@ + + + diff --git a/vol-vue3/src/views/data/device/Data_Device.vue b/vol-vue3/src/views/data/device/Data_Device.vue deleted file mode 100644 index c03622f..0000000 --- a/vol-vue3/src/views/data/device/Data_Device.vue +++ /dev/null @@ -1,71 +0,0 @@ - - - diff --git a/vol-vue3/src/views/data/machine/Data_Machine.vue b/vol-vue3/src/views/data/machine/Data_Machine.vue new file mode 100644 index 0000000..a89abb0 --- /dev/null +++ b/vol-vue3/src/views/data/machine/Data_Machine.vue @@ -0,0 +1,95 @@ + + + diff --git a/vol-vue3/src/views/data/produce/Data_Produce.vue b/vol-vue3/src/views/data/produce/Data_Produce.vue index 78fc830..b03b276 100644 --- a/vol-vue3/src/views/data/produce/Data_Produce.vue +++ b/vol-vue3/src/views/data/produce/Data_Produce.vue @@ -29,30 +29,48 @@ url: "/Data_Produce/", sortName: "id" }); - const editFormFields = ref({"standby_time":"","run_time":"","status":"","turnout":"","turnout_one":"","turnout_two":"","turnout_three":""}); - const editFormOptions = ref([[{"title":"待机时长","field":"standby_time","type":"number"}, - {"title":"运行时长","field":"run_time","type":"number"}, - {"dataKey":"produce_status","data":[],"title":"运行状态","field":"status","type":"select"}], - [{"title":"当班产量","field":"turnout","type":"number"}, - {"title":"工单 1 产量","field":"turnout_one","type":"number"}, - {"title":"工单 2 产量","field":"turnout_two","type":"number"}, - {"title":"工单 3 产量","field":"turnout_three","type":"number"}]]); - const searchFormFields = ref({"status":"","turnout":"","CreateDate":""}); - const searchFormOptions = ref([[{"dataKey":"produce_status","data":[],"title":"运行状态","field":"status","type":"select"},{"title":"当班产量","field":"turnout","type":"number"}],[{"title":"记录时间","field":"CreateDate","type":"datetime"}]]); - const columns = ref([{field:'id',title:'ID',type:'int',width:110,hidden:true,readonly:true,require:true,align:'left'}, - {field:'standby_time',title:'待机时长',type:'int',width:110,align:'left',sort:true}, + const editFormFields = ref({"config_id":"","program_no":"","com_status":"","run_time":"","status":"","turnout_all":"","turnout_1":"","turnout_2":"","turnout_3":"","schedule_1":"","schedule_2":"","schedule_3":"","yield_1":"","yield_2":"","yield_3":"","oee":""}); + const editFormOptions = ref([[{"dataKey":"device_name","data":[],"title":"设备信息","required":true,"field":"config_id","disabled":true,"type":"select"}, + {"title":"程序编号","field":"program_no","type":"number"}], + [{"dataKey":"produce_com_status","data":[],"title":"通讯状态","field":"com_status","type":"select"}, + {"title":"运行时长","field":"run_time","type":"number"}], + [{"dataKey":"produce_status","data":[],"title":"运行状态","field":"status","type":"select"}, + {"title":"当班产量","field":"turnout_all","type":"number"}], + [{"title":"工单 1 产量","field":"turnout_1","type":"number"}, + {"title":"工单 2 产量","field":"turnout_2","type":"number"}, + {"title":"工单 3 产量","field":"turnout_3","type":"number"}], + [{"title":"工单1任务进度","field":"schedule_1","type":"decimal"}, + {"title":"工单2任务进度","field":"schedule_2","type":"decimal"}, + {"title":"工单3任务进度","field":"schedule_3","type":"decimal"}], + [{"title":"工单1良品率","field":"yield_1","type":"decimal"}, + {"title":"工单2良品率","field":"yield_2","type":"decimal"}, + {"title":"工单3良品率","field":"yield_3","type":"decimal"}], + [{"title":"设备综合效率","field":"oee","type":"decimal"}]]); + const searchFormFields = ref({"config_id":"","program_no":"","com_status":"","status":"","turnout_all":[null,null],"CreateDate":""}); + const searchFormOptions = ref([[{"dataKey":"produce_status","data":[],"title":"运行状态","field":"status","type":"select"},{"title":"程序编号","field":"program_no","type":"number"},{"dataKey":"produce_com_status","data":[],"title":"通讯状态","field":"com_status","type":"number"}],[{"title":"记录时间","field":"CreateDate","type":"datetime"},{"dataKey":"device_name","data":[],"title":"设备信息","field":"config_id","type":"select"},{"title":"当班产量","field":"turnout_all","type":"range"}]]); + const columns = ref([{field:'id',title:'ID',type:'int',width:110,readonly:true,require:true,align:'left',sort:true}, + {field:'config_id',title:'设备信息',type:'int',bind:{ key:'device_name',data:[]},width:120,readonly:true,require:true,align:'left'}, + {field:'program_no',title:'程序编号',type:'int',width:150,align:'left'}, + {field:'com_status',title:'通讯状态',type:'int',bind:{ key:'produce_com_status',data:[]},width:120,align:'left'}, {field:'run_time',title:'运行时长',type:'int',width:110,align:'left'}, {field:'status',title:'运行状态',type:'sbyte',bind:{ key:'produce_status',data:[]},width:110,align:'left'}, - {field:'turnout',title:'当班产量',type:'int',width:110,align:'left'}, - {field:'turnout_one',title:'工单 1 产量',type:'int',width:110,align:'left'}, - {field:'turnout_two',title:'工单 2 产量',type:'int',width:110,align:'left'}, - {field:'turnout_three',title:'工单 3 产量',type:'int',width:110,align:'left'}, + {field:'turnout_all',title:'当班产量',type:'int',sort:true,width:120,align:'left'}, + {field:'turnout_1',title:'工单 1 产量',type:'int',width:120,align:'left'}, + {field:'turnout_2',title:'工单 2 产量',type:'int',width:120,align:'left'}, + {field:'turnout_3',title:'工单 3 产量',type:'int',width:120,align:'left'}, + {field:'schedule_1',title:'工单1任务进度',type:'decimal',width:120,align:'left'}, + {field:'schedule_2',title:'工单2任务进度',type:'decimal',width:120,align:'left'}, + {field:'schedule_3',title:'工单3任务进度',type:'decimal',width:120,align:'left'}, + {field:'yield_1',title:'工单1良品率',type:'decimal',width:120,align:'left'}, + {field:'yield_2',title:'工单2良品率',type:'decimal',width:120,align:'left'}, + {field:'yield_3',title:'工单3良品率',type:'decimal',width:120,align:'left'}, + {field:'oee',title:'设备综合效率',type:'decimal',sort:true,width:120,align:'left'}, {field:'CreateID',title:'CreateID',type:'int',width:100,hidden:true,readonly:true,align:'left'}, {field:'Creator',title:'Creator',type:'string',width:100,hidden:true,readonly:true,align:'left'}, {field:'CreateDate',title:'记录时间',type:'datetime',width:180,readonly:true,align:'left',sort:true}, {field:'ModifyID',title:'ModifyID',type:'int',width:100,hidden:true,readonly:true,align:'left'}, {field:'Modifier',title:'Modifier',type:'string',width:100,hidden:true,readonly:true,align:'left'}, - {field:'ModifyDate',title:'ModifyDate',type:'datetime',width:150,hidden:true,readonly:true,align:'left',sort:true}]); + {field:'ModifyDate',title:'更新时间',type:'datetime',width:180,readonly:true,align:'left',sort:true}]); const detail = ref({ cnName: "#detailCnName", table: "#detailTable",