diff --git a/MDM/Models/Process/ProcessOperation.cs b/MDM/Models/Process/ProcessOperation.cs index b13d14e..3e7850e 100644 --- a/MDM/Models/Process/ProcessOperation.cs +++ b/MDM/Models/Process/ProcessOperation.cs @@ -62,6 +62,13 @@ namespace MDM.Model.Process [SugarColumn(ColumnName = "standard_time")] public int? StandardTime { get; set; } + /// + /// 最大重复过站次数 + /// + [SugarColumn(ColumnName = "max_station_count")] + public int? MaxStationCount { get; set; } + + /// /// 控制策略(枚举[1,2,3,4]) /// diff --git a/RIZO.Service/PLCBackground/Stations/PlcIntoStationService_OP07_01.cs b/RIZO.Service/PLCBackground/Stations/PlcIntoStationService_OP07_01.cs index 7f45ecd..576690f 100644 --- a/RIZO.Service/PLCBackground/Stations/PlcIntoStationService_OP07_01.cs +++ b/RIZO.Service/PLCBackground/Stations/PlcIntoStationService_OP07_01.cs @@ -171,6 +171,31 @@ namespace RIZO.Service.PLCBackground.Stations } //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; + } + + } //OK 准许进站 result = EntryPermissionResult.AllowIntoStation; goto InsertPassrecord; diff --git a/RIZO.Service/PLCBackground/Stations/PlcOutStationService_OP07_01.cs b/RIZO.Service/PLCBackground/Stations/PlcOutStationService_OP07_01.cs index 7eaf180..12c2060 100644 --- a/RIZO.Service/PLCBackground/Stations/PlcOutStationService_OP07_01.cs +++ b/RIZO.Service/PLCBackground/Stations/PlcOutStationService_OP07_01.cs @@ -94,7 +94,7 @@ namespace RIZO.Service.PLCBackground.Stations //上传工艺参数 bool CheckOutstationResult = await UploadProcessParameters(productSN, processOperations.First().FkRoutingCode, WorkstationCode); - //判断该产品是否允许进站 + //判断该产品是否允许出站 OutPermissionResult result = await checkOutPermission(productModel, productSN, WorkstationCode, processOperations, CheckOutstationResult); await _plcService.WriteAsync("DB1010.DBW2000", (int)result);