From da16fed4dc0cc8cb923edc93b2c8799154014b1c Mon Sep 17 00:00:00 2001 From: gcw_MV9p2JJN Date: Wed, 28 Jan 2026 19:26:37 +0800 Subject: [PATCH] =?UTF-8?q?jingzhan3=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RIZO.Admin.WebApi/Program.cs | 5 +- .../PlcIntoStationService_OP70_01.cs} | 51 +--- .../Into/PlcIntoStationService_OP80_01.cs | 243 ++++++++++++++++++ .../Into/PlcIntoStationService_OP80_03.cs | 240 +++++++++++++++++ .../{ => Out}/PlcOutStationService_OP07_01.cs | 54 +--- RIZO.Service/PLCBackground/Stations/Result.cs | 92 +++++++ 6 files changed, 587 insertions(+), 98 deletions(-) rename RIZO.Service/PLCBackground/Stations/{PlcIntoStationService_OP07_01.cs => Into/PlcIntoStationService_OP70_01.cs} (91%) create mode 100644 RIZO.Service/PLCBackground/Stations/Into/PlcIntoStationService_OP80_01.cs create mode 100644 RIZO.Service/PLCBackground/Stations/Into/PlcIntoStationService_OP80_03.cs rename RIZO.Service/PLCBackground/Stations/{ => Out}/PlcOutStationService_OP07_01.cs (92%) create mode 100644 RIZO.Service/PLCBackground/Stations/Result.cs diff --git a/RIZO.Admin.WebApi/Program.cs b/RIZO.Admin.WebApi/Program.cs index 628f423..2f50484 100644 --- a/RIZO.Admin.WebApi/Program.cs +++ b/RIZO.Admin.WebApi/Program.cs @@ -14,7 +14,8 @@ using RIZO.Common.Cache; using RIZO.Common.DynamicApiSimple.Extens; using RIZO.Infrastructure.WebExtensions; using RIZO.Mall; -using RIZO.Service.PLCBackground.Stations; +using RIZO.Service.PLCBackground.Stations.Into; +using RIZO.Service.PLCBackground.Stations.Out; using RIZO.ServiceCore.Signalr; using RIZO.ServiceCore.SqlSugar; using S7.Net; @@ -110,7 +111,7 @@ builder.Services.AddLogo(); builder.Services.AddLocalization(options => options.ResourcesPath = ""); builder.Services.AddHostedService(); -builder.Services.AddHostedService(); +builder.Services.AddHostedService(); // 在应用程序启动的最开始处调用 diff --git a/RIZO.Service/PLCBackground/Stations/PlcIntoStationService_OP07_01.cs b/RIZO.Service/PLCBackground/Stations/Into/PlcIntoStationService_OP70_01.cs similarity index 91% rename from RIZO.Service/PLCBackground/Stations/PlcIntoStationService_OP07_01.cs rename to RIZO.Service/PLCBackground/Stations/Into/PlcIntoStationService_OP70_01.cs index 36d8af7..ee9fd5e 100644 --- a/RIZO.Service/PLCBackground/Stations/PlcIntoStationService_OP07_01.cs +++ b/RIZO.Service/PLCBackground/Stations/Into/PlcIntoStationService_OP70_01.cs @@ -13,9 +13,12 @@ using System; using System.Threading; using System.Threading.Tasks; -namespace RIZO.Service.PLCBackground.Stations +namespace RIZO.Service.PLCBackground.Stations.Into { - public class PlcIntoStationService_OP07_01 : BackgroundService + /// + /// OP点散热胶GF1500 + /// + public class PlcIntoStationService_OP70_01 : BackgroundService { private static Logger _logger = LogManager.GetCurrentClassLogger(); private PlcConntectHepler _plcService; @@ -24,7 +27,7 @@ namespace RIZO.Service.PLCBackground.Stations private readonly CpuType _cpuType = CpuType.S71500; private string WorkstationCode; private readonly SqlSugarClient Context; - public PlcIntoStationService_OP07_01() + public PlcIntoStationService_OP70_01() { Context = DbScoped.SugarScope.CopyNew(); } @@ -81,23 +84,12 @@ namespace RIZO.Service.PLCBackground.Stations PasstationDescription = "入站请求ASK", EffectTime = DateTime.Now, CreatedTime = DateTime.Now, - }; await Context.Insertable(ASKintoStation).ExecuteCommandAsync(); - //判断该产品是否允许进站 - EntryPermissionResult result = await checkEntryPermission(productModel, productSN, WorkstationCode, processOperations); await _plcService.WriteAsync("DB1010.DBW2000", (int)result); - - - } - - - - - await Task.Delay(_pollingInterval, stoppingToken); } @@ -243,35 +235,6 @@ namespace RIZO.Service.PLCBackground.Stations } - /// - /// 入站校验结果 - /// - enum EntryPermissionResult - { - //1之前工位数据正常 - AllowIntoStation = 1, - // 2上工位无记录 - NoRecordAtPreviousStation = 2, - // 3上工位NG - PreviousStationNG = 3, - // 4扫码产品型号错误 - ProductModelError = 4, - //5本工位NG - CurrentStationNG = 5, - //6时间超出规定无法生产 - TimeExceeded = 6, - //7固化时间未到规定时间 - CuringTimeNotReached = 7, - // 8未找到时间属性 - TimeAttributeNotFound = 8, - // 10条码为空 - BarcodeEmpty = 10, - //0之前工位数据异常 - PreviousStationDataAbnormal = 0, - //11 未知异常 - UnkownException = 11, - //12 最大重复入站次数 - MaximumRepeatedEntries = 12 - } + } diff --git a/RIZO.Service/PLCBackground/Stations/Into/PlcIntoStationService_OP80_01.cs b/RIZO.Service/PLCBackground/Stations/Into/PlcIntoStationService_OP80_01.cs new file mode 100644 index 0000000..0066c1f --- /dev/null +++ b/RIZO.Service/PLCBackground/Stations/Into/PlcIntoStationService_OP80_01.cs @@ -0,0 +1,243 @@ +using MDM.Model.Plant; +using MDM.Model.Process; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using NLog; +using RIZO.Model.Mes; +using RIZO.Model.MES.product_trace; +using RIZO.Repository; +using RIZO.Service.PLC; +using S7.Net; +using SqlSugar.IOC; +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace RIZO.Service.PLCBackground.Stations.Into +{ + /// + /// OP80_01 PCBA组装&拧紧 + /// + public class PlcIntoStationService_OP80_01 : BackgroundService + { + private static Logger _logger = LogManager.GetCurrentClassLogger(); + private PlcConntectHepler _plcService; + private readonly TimeSpan _pollingInterval = TimeSpan.FromSeconds(5); + private readonly string _ipAddress = "192.168.11.56"; + private readonly CpuType _cpuType = CpuType.S71500; + private string WorkstationCode; + private readonly SqlSugarClient Context; + + + public PlcIntoStationService_OP80_01() + { + Context = DbScoped.SugarScope.CopyNew(); + } + + protected override async Task ExecuteAsync(CancellationToken stoppingToken) + { + _logger.Info("PLC Polling Service started"); + + // 使用工厂方法创建服务实例 + using (_plcService = new PlcConntectHepler(_ipAddress, _cpuType)) + { + + // 获取当前的工序/工站 + WorkstationCode = await Context.Queryable() + .Where(it => it.PlcIP == _ipAddress) + .Select(it => it.WorkstationCode).FirstAsync(); + + + while (!stoppingToken.IsCancellationRequested) + { + try + { + //心跳检测 + await _plcService.WriteAsync("DB1020.DBW0", 1); + + // 轮询进站请求信号/工位开始查询请求 + int intoStationAsk = await _plcService.ReadAsync("DB1001.DBW2000"); + if (intoStationAsk == 1) + { + // 处理进站请求 + _logger.Info("Processing into station request..."); + + //获取产品SN码 + string productModel = await _plcService.ReadStringAsync("DB1001.DBB1000"); + string productSN = await _plcService.ReadStringAsync("DB1001.DBB1054"); + + // 获取工单 + + //获取工艺路线工序 + List processOperations = await Context.Queryable().LeftJoin((r, o) => r.RoutingCode == o.FkRoutingCode) + .Where((r, o) => r.FkProductMaterialCode == productModel && r.Status == 1) + .Select((r, o) => o).ToListAsync(); + //判断改产品是正常件还是返工件 + + + //插入入站请求ASK过站记录 + ProductPassStationRecord ASKintoStation = new ProductPassStationRecord + { + ProductSN = productSN, + WorkstationCode = WorkstationCode, + Routingcode = processOperations.First().FkRoutingCode, + OperationCode = WorkstationCode, + ProductionLifeStage = 1, // 1表示生产中 + PasstationType = 0, // 0表示入站请求 + PasstationDescription = "入站请求ASK", + EffectTime = DateTime.Now, + CreatedTime = DateTime.Now, + }; + await Context.Insertable(ASKintoStation).ExecuteCommandAsync(); + //判断该产品是否允许进站 + EntryPermissionResult result = await checkEntryPermission(productModel, productSN, WorkstationCode, processOperations); + await _plcService.WriteAsync("DB1020.DBW2000", (int)result); + } + await Task.Delay(_pollingInterval, stoppingToken); + + } + catch (OperationCanceledException) + { + _logger.Info("PLC Polling Service is stopping"); + break; + } + catch (Exception ex) + { + _logger.Error(ex, "PLC polling error"); + await Task.Delay(TimeSpan.FromSeconds(10), stoppingToken); + } + } + } + + _logger.Info("PLC Polling Service stopped"); + } + + /// + /// 校验是否可以进站 + /// + /// 产品型号 + /// 产品SN + /// + private async Task checkEntryPermission(string productModel, string productSN, string workstationCode, List processOperations) + { + + EntryPermissionResult result = EntryPermissionResult.UnkownException; + + + //2上工位无记录 + + //ProcessOperation LastOperation = processOperations.Where(operation => operation.OperationSeq < processOperations.Where(it => it.OperationCode == workstationCode).Select(it => it.OperationSeq).First()).OrderByDescending(operation => operation.OperationSeq).First(); + int LastOperationSeq = processOperations.Where(operation => operation.OperationCode == workstationCode).Select(operation => operation.LastOperationSeq ?? -1).First(); + ProcessOperation LastOperation = processOperations.Where(it => it.OperationSeq == LastOperationSeq).First(); + bool isExistLastOperationRecord = await DbScoped.SugarScope.CopyNew().Queryable() + .Where(it => it.ProductSN == productSN) + .Where(it => it.OperationCode == LastOperation.OperationCode) + .AnyAsync(); + if (!isExistLastOperationRecord) + { + return EntryPermissionResult.NoRecordAtPreviousStation; + } + + // 3 上工位NG 入站或者出站结果 NG + bool isExistLastOperationNG = await Context.Queryable() + .Where(it => it.ProductSN == productSN) + .Where(it => it.OperationCode == LastOperation.OperationCode) + .Where(it => it.PasstationType == 2 || it.PasstationType == 4) + .Where(it => it.ResultCode != 1) + .AnyAsync(); + if (!isExistLastOperationNG) + { + result = EntryPermissionResult.PreviousStationNG; + goto InsertPassrecord; + } + + + // 4 扫码产品型号错误 + bool isExistproductSN = await Context.Queryable() + .Where(it => it.ProductSN == productSN).AnyAsync(); + + + bool isExistproductSNProducting = await Context.Queryable() + .Where(it => it.ProductSN == productSN && (it.ProductCurrentStatus != 1 && it.ProductCurrentStatus != 3)).AnyAsync(); + if (!isExistproductSN || !isExistproductSNProducting) + { + result = EntryPermissionResult.ProductModelError; + goto InsertPassrecord; + } + //6时间超出规定无法生产 + + + //7固化时间未到规定时间 + + int LastOperationStandardTime = processOperations.Where(operation => operation.OperationCode == LastOperation.OperationCode) + .Select(operation => operation.StandardTime??0).First(); + + + + if (LastOperationStandardTime > 0) + { + // 上一站的入站时间 和本站的请求时间差值 + DateTime LastInStationTime= await Context.Queryable() + .Where(it => it.ProductSN == productSN) + .Where(it => it.OperationCode == LastOperation.OperationCode) + .Where(it => it.PasstationType == 1) + .MaxAsync(it => it.InStationTime??DateTime.MinValue); + TimeSpan timeDiff = DateTime.Now - LastInStationTime; + double totalSeconds = timeDiff.TotalSeconds; + if(totalSeconds < LastOperationStandardTime) + { + result = EntryPermissionResult.CuringTimeNotReached; + goto InsertPassrecord; + } + + } + + //12 最大重复入站次数 + int MaxRepeatEntries = processOperations.Where(operation => operation.OperationCode == workstationCode).Select(operation => operation.MaxStationCount??1).First(); + if(MaxRepeatEntries>1) + { + int currentStationEntryCount = await Context.Queryable() + .Where(it => it.ProductSN == productSN) + .Where(it => it.OperationCode == workstationCode) + .Where(it => it.PasstationType == 1) + .CountAsync(); + if(currentStationEntryCount >= MaxRepeatEntries) + { + result = EntryPermissionResult.MaximumRepeatedEntries; + goto InsertPassrecord; + } + } + + //OK 准许进站 + result = EntryPermissionResult.AllowIntoStation; + goto InsertPassrecord; + InsertPassrecord: + //插入入站请求Resp过站记录 + ProductPassStationRecord RespintoStation = new ProductPassStationRecord + { + ProductSN = productSN, + WorkstationCode = WorkstationCode, + Routingcode = processOperations.First().FkRoutingCode, + OperationCode = WorkstationCode, + ProductionLifeStage = 1, // 1表示生产中 + PasstationType = 1, // 入站完毕 + PasstationDescription = "入站完毕Resp", + EffectTime = DateTime.Now, + InStationTime = DateTime.Now, + ResultCode = (int)result, + ResultDescription = result.ToString(), + CreatedTime = DateTime.Now, + + }; + await Context.Insertable(RespintoStation).ExecuteCommandAsync(); + + return result; + } + + + + + } + +} + diff --git a/RIZO.Service/PLCBackground/Stations/Into/PlcIntoStationService_OP80_03.cs b/RIZO.Service/PLCBackground/Stations/Into/PlcIntoStationService_OP80_03.cs new file mode 100644 index 0000000..7ba1243 --- /dev/null +++ b/RIZO.Service/PLCBackground/Stations/Into/PlcIntoStationService_OP80_03.cs @@ -0,0 +1,240 @@ +using MDM.Model.Plant; +using MDM.Model.Process; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using NLog; +using RIZO.Model.Mes; +using RIZO.Model.MES.product_trace; +using RIZO.Repository; +using RIZO.Service.PLC; +using S7.Net; +using SqlSugar.IOC; +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace RIZO.Service.PLCBackground.Stations.Into +{ + /// + /// OP80_03 PWM压装&CUP上料&拧紧 + /// + public class PlcIntoStationService_OP80_03 : BackgroundService + { + private static Logger _logger = LogManager.GetCurrentClassLogger(); + private PlcConntectHepler _plcService; + private readonly TimeSpan _pollingInterval = TimeSpan.FromSeconds(5); + private readonly string _ipAddress = "192.168.11.71"; + private readonly CpuType _cpuType = CpuType.S71500; + private string WorkstationCode; + private readonly SqlSugarClient Context; + public PlcIntoStationService_OP80_03() + { + Context = DbScoped.SugarScope.CopyNew(); + } + + protected override async Task ExecuteAsync(CancellationToken stoppingToken) + { + _logger.Info("PLC Polling Service started"); + + // 使用工厂方法创建服务实例 + using (_plcService = new PlcConntectHepler(_ipAddress, _cpuType)) + { + + // 获取当前的工序/工站 + WorkstationCode = await Context.Queryable().Where(it => it.PlcIP == _ipAddress) + .Select(it => it.WorkstationCode).FirstAsync(); + + + while (!stoppingToken.IsCancellationRequested) + { + try + { + //心跳检测 + await _plcService.WriteAsync("DB1020.DBW0", 1); + + // 轮询进站请求信号/工位开始查询请求 + int intoStationAsk = await _plcService.ReadAsync("DB1021.DBW2000"); + if (intoStationAsk == 1) + { + // 处理进站请求 + _logger.Info("Processing into station request..."); + + //获取产品SN码 + string productModel = await _plcService.ReadStringAsync("DB1001.DBB1000"); + string productSN = await _plcService.ReadStringAsync("DB1001.DBB1054"); + + // 获取工单 + + //获取工艺路线工序 + List processOperations = await Context.Queryable().LeftJoin((r, o) => r.RoutingCode == o.FkRoutingCode) + .Where((r, o) => r.FkProductMaterialCode == productModel && r.Status == 1) + .Select((r, o) => o).ToListAsync(); + //判断改产品是正常件还是返工件 + + + //插入入站请求ASK过站记录 + ProductPassStationRecord ASKintoStation = new ProductPassStationRecord + { + ProductSN = productSN, + WorkstationCode = WorkstationCode, + Routingcode = processOperations.First().FkRoutingCode, + OperationCode = WorkstationCode, + ProductionLifeStage = 1, // 1表示生产中 + PasstationType = 0, // 0表示入站请求 + PasstationDescription = "入站请求ASK", + EffectTime = DateTime.Now, + CreatedTime = DateTime.Now, + }; + await Context.Insertable(ASKintoStation).ExecuteCommandAsync(); + //判断该产品是否允许进站 + EntryPermissionResult result = await checkEntryPermission(productModel, productSN, WorkstationCode, processOperations); + await _plcService.WriteAsync("DB1020.DBW2000", (int)result); + } + await Task.Delay(_pollingInterval, stoppingToken); + + } + catch (OperationCanceledException) + { + _logger.Info("PLC Polling Service is stopping"); + break; + } + catch (Exception ex) + { + _logger.Error(ex, "PLC polling error"); + await Task.Delay(TimeSpan.FromSeconds(10), stoppingToken); + } + } + } + + _logger.Info("PLC Polling Service stopped"); + } + + /// + /// 校验是否可以进站 + /// + /// 产品型号 + /// 产品SN + /// + private async Task checkEntryPermission(string productModel, string productSN, string workstationCode, List processOperations) + { + + EntryPermissionResult result = EntryPermissionResult.UnkownException; + + + //2上工位无记录 + + //ProcessOperation LastOperation = processOperations.Where(operation => operation.OperationSeq < processOperations.Where(it => it.OperationCode == workstationCode).Select(it => it.OperationSeq).First()).OrderByDescending(operation => operation.OperationSeq).First(); + int LastOperationSeq = processOperations.Where(operation => operation.OperationCode == workstationCode).Select(operation => operation.LastOperationSeq ?? -1).First(); + ProcessOperation LastOperation = processOperations.Where(it => it.OperationSeq == LastOperationSeq).First(); + bool isExistLastOperationRecord = await DbScoped.SugarScope.CopyNew().Queryable() + .Where(it => it.ProductSN == productSN) + .Where(it => it.OperationCode == LastOperation.OperationCode) + .AnyAsync(); + if (!isExistLastOperationRecord) + { + return EntryPermissionResult.NoRecordAtPreviousStation; + } + + // 3 上工位NG 入站或者出站结果 NG + bool isExistLastOperationNG = await Context.Queryable() + .Where(it => it.ProductSN == productSN) + .Where(it => it.OperationCode == LastOperation.OperationCode) + .Where(it => it.PasstationType == 2 || it.PasstationType == 4) + .Where(it => it.ResultCode != 1) + .AnyAsync(); + if (!isExistLastOperationNG) + { + result = EntryPermissionResult.PreviousStationNG; + goto InsertPassrecord; + } + + + // 4 扫码产品型号错误 + bool isExistproductSN = await Context.Queryable() + .Where(it => it.ProductSN == productSN).AnyAsync(); + + + bool isExistproductSNProducting = await Context.Queryable() + .Where(it => it.ProductSN == productSN && (it.ProductCurrentStatus != 1 && it.ProductCurrentStatus != 3)).AnyAsync(); + if (!isExistproductSN || !isExistproductSNProducting) + { + result = EntryPermissionResult.ProductModelError; + goto InsertPassrecord; + } + //6时间超出规定无法生产 + + + //7固化时间未到规定时间 + + int LastOperationStandardTime = processOperations.Where(operation => operation.OperationCode == LastOperation.OperationCode) + .Select(operation => operation.StandardTime??0).First(); + + + + if (LastOperationStandardTime > 0) + { + // 上一站的入站时间 和本站的请求时间差值 + DateTime LastInStationTime= await Context.Queryable() + .Where(it => it.ProductSN == productSN) + .Where(it => it.OperationCode == LastOperation.OperationCode) + .Where(it => it.PasstationType == 1) + .MaxAsync(it => it.InStationTime??DateTime.MinValue); + TimeSpan timeDiff = DateTime.Now - LastInStationTime; + double totalSeconds = timeDiff.TotalSeconds; + if(totalSeconds < LastOperationStandardTime) + { + result = EntryPermissionResult.CuringTimeNotReached; + goto InsertPassrecord; + } + + } + + //12 最大重复入站次数 + int MaxRepeatEntries = processOperations.Where(operation => operation.OperationCode == workstationCode).Select(operation => operation.MaxStationCount??1).First(); + if(MaxRepeatEntries>1) + { + int currentStationEntryCount = await Context.Queryable() + .Where(it => it.ProductSN == productSN) + .Where(it => it.OperationCode == workstationCode) + .Where(it => it.PasstationType == 1) + .CountAsync(); + if(currentStationEntryCount >= MaxRepeatEntries) + { + result = EntryPermissionResult.MaximumRepeatedEntries; + goto InsertPassrecord; + } + } + + //OK 准许进站 + result = EntryPermissionResult.AllowIntoStation; + goto InsertPassrecord; + InsertPassrecord: + //插入入站请求Resp过站记录 + ProductPassStationRecord RespintoStation = new ProductPassStationRecord + { + ProductSN = productSN, + WorkstationCode = WorkstationCode, + Routingcode = processOperations.First().FkRoutingCode, + OperationCode = WorkstationCode, + ProductionLifeStage = 1, // 1表示生产中 + PasstationType = 1, // 入站完毕 + PasstationDescription = "入站完毕Resp", + EffectTime = DateTime.Now, + InStationTime = DateTime.Now, + ResultCode = (int)result, + ResultDescription = result.ToString(), + CreatedTime = DateTime.Now, + + }; + await Context.Insertable(RespintoStation).ExecuteCommandAsync(); + + return result; + } + + + + + } + +} + diff --git a/RIZO.Service/PLCBackground/Stations/PlcOutStationService_OP07_01.cs b/RIZO.Service/PLCBackground/Stations/Out/PlcOutStationService_OP07_01.cs similarity index 92% rename from RIZO.Service/PLCBackground/Stations/PlcOutStationService_OP07_01.cs rename to RIZO.Service/PLCBackground/Stations/Out/PlcOutStationService_OP07_01.cs index 12c2060..83996dc 100644 --- a/RIZO.Service/PLCBackground/Stations/PlcOutStationService_OP07_01.cs +++ b/RIZO.Service/PLCBackground/Stations/Out/PlcOutStationService_OP07_01.cs @@ -15,7 +15,7 @@ using System.Diagnostics; using System.Threading; using System.Threading.Tasks; -namespace RIZO.Service.PLCBackground.Stations +namespace RIZO.Service.PLCBackground.Stations.Out { /// @@ -360,56 +360,6 @@ namespace RIZO.Service.PLCBackground.Stations } - /// - /// 出站校验结果 - /// - public enum OutPermissionResult - { - /// - /// 1 OK - 成功 - /// - OK = 1, - - /// - /// 2 产品时间属性增加失败 - /// - ProductTimeAttributeAddFailed = 2, - - /// - /// 3 产品条码合并失败 - /// - ProductBarcodeMergeFailed = 3, - - /// - /// 4 产品结果上传次数超出 - /// - ProductUploadCountExceeded = 4, - - /// - /// 5 时间属性移除失败 - /// - TimeAttributeRemoveFailed = 5, - - /// - /// 6 数据保存失败 - /// - DataSaveFailed = 6, - - /// - /// 10 上传条码为空 - /// - UploadBarcodeEmpty = 10, - /// - /// 11 未知异常 - /// - UnkownException = 11, - - /// - /// 工艺参数NG - /// - ProcessParameterNG = 12 - - - } + } diff --git a/RIZO.Service/PLCBackground/Stations/Result.cs b/RIZO.Service/PLCBackground/Stations/Result.cs new file mode 100644 index 0000000..4550e70 --- /dev/null +++ b/RIZO.Service/PLCBackground/Stations/Result.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RIZO.Service.PLCBackground.Stations +{ + /// + /// 入站校验结果 + /// + public enum EntryPermissionResult + { + //1之前工位数据正常 + AllowIntoStation = 1, + // 2上工位无记录 + NoRecordAtPreviousStation = 2, + // 3上工位NG + PreviousStationNG = 3, + // 4扫码产品型号错误 + ProductModelError = 4, + //5本工位NG + CurrentStationNG = 5, + //6时间超出规定无法生产 + TimeExceeded = 6, + //7固化时间未到规定时间 + CuringTimeNotReached = 7, + // 8未找到时间属性 + TimeAttributeNotFound = 8, + // 10条码为空 + BarcodeEmpty = 10, + //0之前工位数据异常 + PreviousStationDataAbnormal = 0, + //11 未知异常 + UnkownException = 11, + //12 最大重复入站次数 + MaximumRepeatedEntries = 12 + } + + + /// + /// 出站校验结果 + /// + public enum OutPermissionResult + { + /// + /// 1 OK - 成功 + /// + OK = 1, + + /// + /// 2 产品时间属性增加失败 + /// + ProductTimeAttributeAddFailed = 2, + + /// + /// 3 产品条码合并失败 + /// + ProductBarcodeMergeFailed = 3, + + /// + /// 4 产品结果上传次数超出 + /// + ProductUploadCountExceeded = 4, + + /// + /// 5 时间属性移除失败 + /// + TimeAttributeRemoveFailed = 5, + + /// + /// 6 数据保存失败 + /// + DataSaveFailed = 6, + + /// + /// 10 上传条码为空 + /// + UploadBarcodeEmpty = 10, + /// + /// 11 未知异常 + /// + UnkownException = 11, + + /// + /// 工艺参数NG + /// + ProcessParameterNG = 12 + + + } +}