diff --git a/RIZO.Service/PLCBackground/Stations/PlcIntoStationService_OP07_01.cs b/RIZO.Service/PLCBackground/Stations/PlcIntoStationService_OP07_01.cs index 576690f..36d8af7 100644 --- a/RIZO.Service/PLCBackground/Stations/PlcIntoStationService_OP07_01.cs +++ b/RIZO.Service/PLCBackground/Stations/PlcIntoStationService_OP07_01.cs @@ -196,6 +196,23 @@ namespace RIZO.Service.PLCBackground.Stations } } + + //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; @@ -252,7 +269,9 @@ namespace RIZO.Service.PLCBackground.Stations //0之前工位数据异常 PreviousStationDataAbnormal = 0, //11 未知异常 - UnkownException = 11 + UnkownException = 11, + //12 最大重复入站次数 + MaximumRepeatedEntries = 12 } }