Просмотр исходного кода

优化单工位最大加工时长

hou 3 дней назад
Родитель
Сommit
74264cecef

+ 5 - 1
db/mysql/mes_station_time_rule.sql

@@ -1,7 +1,9 @@
-ALTER TABLE mes_line_process ADD COLUMN max_duration int(11) DEFAULT NULL COMMENT '最长加工时长(分钟)' AFTER duration;
+-- 工位最长加工时长(分钟)
+-- >0:开启本工位超时校验;NULL 或 0:关闭(不做本工位超时校验)
+-- 子工位 A/B 继承主工位 max_duration
+ALTER TABLE mes_line_process ADD COLUMN max_duration int(11) DEFAULT NULL COMMENT '最长加工时长(分钟,>0开启;0或空关闭)' AFTER duration;
 
+-- 可选:为需要管控的主工位预置 15 分钟(仅 pid 为空的主工位)
 UPDATE mes_line_process SET max_duration = 15 WHERE oprno IN ('OP015','OP200','OP210','OP260') AND pid IS NULL AND max_duration IS NULL;
 
 -- OP030 建议配置为不可重复加工

+ 7 - 10
src/main/java/com/jeesite/modules/mes/service/MesStationTimeValidateService.java

@@ -23,14 +23,9 @@ import java.util.Set;
 @Service
 public class MesStationTimeValidateService {
 
-	private static final int DEFAULT_MAX_PROCESS_MINUTES = 15;
 	private static final int COOLING_OP023_TO_OP030_MINUTES = 30;
 	private static final int CROSS_OP150_TO_OP160_MINUTES = 15;
 
-	private static final Set<String> MAX_DURATION_OPRNOS = new HashSet<>(Arrays.asList(
-			"OP015", "OP200", "OP210", "OP260"
-	));
-
 	private static final Set<String> CROSS_TO_OP160_OPRNOS = new HashSet<>(Arrays.asList(
 			"OP160", "OP160A", "OP160B"
 	));
@@ -79,7 +74,7 @@ public class MesStationTimeValidateService {
 		if (crossErr != null) {
 			return crossErr;
 		}
-		Integer maxMinutes = resolveMaxProcessMinutes(oldOprno, mesLineProcess);
+		Integer maxMinutes = resolveMaxProcessMinutes(mesLineProcess);
 		if (maxMinutes == null || maxMinutes <= 0) {
 			return null;
 		}
@@ -113,13 +108,15 @@ public class MesStationTimeValidateService {
 		return null;
 	}
 
-	private Integer resolveMaxProcessMinutes(String oldOprno, MesLineProcess mesLineProcess) {
+	/**
+	 * 仅使用工序配置 max_duration:
+	 * - &gt;0:开启本工位超时校验
+	 * - null 或 &lt;=0:明确关闭(不做本工位超时校验)
+	 */
+	private Integer resolveMaxProcessMinutes(MesLineProcess mesLineProcess) {
 		if (mesLineProcess.getMaxDuration() != null && mesLineProcess.getMaxDuration() > 0) {
 			return mesLineProcess.getMaxDuration();
 		}
-		if (MAX_DURATION_OPRNOS.contains(normalizeOprno(oldOprno))) {
-			return DEFAULT_MAX_PROCESS_MINUTES;
-		}
 		return null;
 	}
 

+ 3 - 3
src/main/resources/views/modules/mes/mesLineProcessForm.html

@@ -107,10 +107,10 @@
 					</div>
 					<div class="col-xs-12">
 						<div class="form-group">
-							<label class="control-label col-sm-2" title="">
-								<span class="required hide">*</span> ${text('最长加工时长(分钟)')}:<i class="fa icon-question hide"></i></label>
+							<label class="control-label col-sm-2" title="大于0开启本工位超时;填0或不填则关闭">
+								<span class="required hide">*</span> ${text('最长加工时长(分钟)')}:<i class="fa icon-question"></i></label>
 							<div class="col-sm-4">
-								<#form:input path="maxDuration" maxlength="8" class="form-control digits"/>
+								<#form:input path="maxDuration" maxlength="8" class="form-control digits" placeholder=">0开启,0或空关闭"/>
 							</div>
 						</div>
 					</div>