Преглед изворни кода

大屏优化和cnc出库过站

sunxianglong пре 3 недеља
родитељ
комит
4b3ac8eddb

+ 4 - 4
src/main/java/com/jeesite/modules/mes/web/MesProductRecordController.java

@@ -2926,10 +2926,10 @@ public String check(@RequestBody MesElectricTorque mesElectricTorque,HttpServlet
 			resp.setResult(Global.FALSE);
 			resp.setResult(Global.FALSE);
 		}
 		}
 
 
-		if(oprno.equals("OP080") && checkret.equalsIgnoreCase("OK")){
-			resp.setMessage("工件可以加工");
-			resp.setResult(Global.TRUE);
-		}
+//		if(oprno.equals("OP080") && checkret.equalsIgnoreCase("OK")){
+//			resp.setMessage("工件可以加工");
+//			resp.setResult(Global.TRUE);
+//		}
 		resp.setData(checkret);
 		resp.setData(checkret);
 		return resp;
 		return resp;
 	}
 	}

+ 45 - 0
src/main/java/com/jeesite/modules/scheduling/FswModbusScheduling.java

@@ -42,6 +42,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
  *   4040  指定焊接点压力 → pressure
  *   4040  指定焊接点压力 → pressure
  *   4590  指定焊接点偏移量 → pyl
  *   4590  指定焊接点偏移量 → pyl
  *   4742  B轴角度 → jd
  *   4742  B轴角度 → jd
+ *   4744  强制 NG(1=直接提交工位结果 NG;MES 不复位该位,同一次=1 只提交一次,回到 0 后才允许下次)
  *
  *
  * 配置(application.yml):
  * 配置(application.yml):
  *   mes.fsw.modbus.enabled   是否启用(默认 false)
  *   mes.fsw.modbus.enabled   是否启用(默认 false)
@@ -74,6 +75,8 @@ public class FswModbusScheduling {
 	private static final int ADDR_WELD_PRESSURE = 4040;
 	private static final int ADDR_WELD_PRESSURE = 4040;
 	private static final int ADDR_WELD_OFFSET = 4590;
 	private static final int ADDR_WELD_OFFSET = 4590;
 	private static final int ADDR_B_AXIS_ANGLE = 4742;
 	private static final int ADDR_B_AXIS_ANGLE = 4742;
+	/** 强制 NG:为 1 时直接提交工位结果为 NG;MES 不写回该位 */
+	private static final int ADDR_FORCE_NG = 4744;
 
 
 	private static final String DEFAULT_HOST = "10.0.40.101";
 	private static final String DEFAULT_HOST = "10.0.40.101";
 	private static final int DEFAULT_PORT = 502;
 	private static final int DEFAULT_PORT = 502;
@@ -98,6 +101,8 @@ public class FswModbusScheduling {
 	private volatile ModbusTcp modbusTcp;
 	private volatile ModbusTcp modbusTcp;
 	/** 最近一次非空工件码(采集时 PLC 可能已清空 3620,用此兜底) */
 	/** 最近一次非空工件码(采集时 PLC 可能已清空 3620,用此兜底) */
 	private volatile String lastKnownSn;
 	private volatile String lastKnownSn;
+	/** 本轮 4744=1 是否已成功提交过 NG;4744 回到 0 后清除,允许下次 */
+	private final AtomicBoolean forceNgHandled = new AtomicBoolean(false);
 
 
 	/**
 	/**
 	 * 每秒执行:工件码质量校验 + 过程参数采集握手
 	 * 每秒执行:工件码质量校验 + 过程参数采集握手
@@ -127,6 +132,7 @@ public class FswModbusScheduling {
 				logger.info("FSW Modbus 4740={},未使能,跳过", enable);
 				logger.info("FSW Modbus 4740={},未使能,跳过", enable);
 				return;
 				return;
 			}
 			}
+			handleForceNg(plc);
 			handleQualityCheck(plc);
 			handleQualityCheck(plc);
 			handleCollectTrigger(plc);
 			handleCollectTrigger(plc);
 		} catch (Exception e) {
 		} catch (Exception e) {
@@ -138,6 +144,45 @@ public class FswModbusScheduling {
 	}
 	}
 
 
 	/**
 	/**
+	 * 4744=1 时直接将当前工件工位结果提交为 NG。
+	 * 成功后不复位 4744,靠本地标记避免同一次=1 重复提交;检测到 4744=0 后清除标记,开启下次循环。
+	 */
+	private void handleForceNg(ModbusTcp plc) {
+		Short forceNg = plc.readInt16(ADDR_FORCE_NG);
+		if (forceNg == null || forceNg != 1) {
+			if (forceNg != null && forceNg == 0) {
+				forceNgHandled.set(false);
+			}
+			return;
+		}
+		if (forceNgHandled.get()) {
+			return;
+		}
+
+		String sn = readWorkpieceCode(plc);
+		if (StringUtils.isBlank(sn)) {
+			sn = lastKnownSn;
+			logger.warn("FSW强制NG:3620 工件码为空,使用最近工件码 sn={}", sn);
+		}
+		if (StringUtils.isBlank(sn)) {
+			logger.error("FSW强制NG失败:无工件码,等待下次重试");
+			return;
+		}
+		lastKnownSn = sn;
+
+		try {
+			List<ParamsResp> params = new ArrayList<>();
+			List<BindMaterialResp> bmlists = new ArrayList<>();
+			mesProductRecordService.updateRecordResult(sn, FIXED_OPRNO, "100000", "", "NG",
+					"", params, FIXED_LINE_SN, true, bmlists, null);
+			forceNgHandled.set(true);
+			logger.info("FSW强制NG完成(不复位4744) sn={} oprno={}", sn, FIXED_OPRNO);
+		} catch (Exception e) {
+			logger.error("FSW强制NG失败,等待下次重试 sn={}:{}", sn, e.getMessage(), e);
+		}
+	}
+
+	/**
 	 * 强制采集并落库(供测试):不检查 4740 / 3600,直接读过程参数写入 mes_product_fsw。
 	 * 强制采集并落库(供测试):不检查 4740 / 3600,直接读过程参数写入 mes_product_fsw。
 	 *
 	 *
 	 * @param snOverride     指定工件码;为空则从 3620 读取,仍为空则用最近缓存
 	 * @param snOverride     指定工件码;为空则从 3620 读取,仍为空则用最近缓存

+ 3 - 0
src/main/resources/config/application.yml

@@ -770,6 +770,9 @@ shiro:
     ${adminPath}/mes/mesProductRecord/prevShiftCapacityData= anon
     ${adminPath}/mes/mesProductRecord/prevShiftCapacityData= anon
     ${adminPath}/mes/mesProduct/hourlyUpDownOkData= anon
     ${adminPath}/mes/mesProduct/hourlyUpDownOkData= anon
     ${adminPath}/mes/mesProductVoltage/add= anon
     ${adminPath}/mes/mesProductVoltage/add= anon
+    ${adminPath}/mes/mesOrderSn/getLotCodeBySn= anon
+    ${adminPath}/mes/mesMaterialLl/materialLl= anon
+    ${adminPath}/mes/mesOrderJjll/orderDisplayList= anon
     
     
   
   
     
     

+ 6 - 5
src/main/resources/views/modules/mes/mesScreen4.html

@@ -191,6 +191,7 @@
 			background: rgba(0, 100, 180, 0.28);
 			background: rgba(0, 100, 180, 0.28);
 			border-bottom: 2px solid rgba(77, 201, 245, 0.5);
 			border-bottom: 2px solid rgba(77, 201, 245, 0.5);
 			text-align: center;
 			text-align: center;
+			line-height: 1.25;
 		}
 		}
 		.op-table tbody td {
 		.op-table tbody td {
 			height: 88px;
 			height: 88px;
@@ -203,7 +204,7 @@
 		}
 		}
 		.op-table tbody tr:hover td { background: rgba(0, 200, 255, 0.06); }
 		.op-table tbody tr:hover td { background: rgba(0, 200, 255, 0.06); }
 		.op-table td.op-col  { color: #00C8FF; font-weight: bold; font-size: 26px; }
 		.op-table td.op-col  { color: #00C8FF; font-weight: bold; font-size: 26px; }
-		.op-table td.op-name { color: #ffffff; text-align: center; font-size: 22px; }
+		.op-table td.op-name { color: #FFDD00; text-align: center; font-size: 22px; }
 		.op-table td.op-val  { color: #00F7FF; font-weight: bold; font-size: 28px; }
 		.op-table td.op-val  { color: #00F7FF; font-weight: bold; font-size: 28px; }
 
 
 		/* ===== 产线阶段数据总览(对齐原 UI 四宫格框) ===== */
 		/* ===== 产线阶段数据总览(对齐原 UI 四宫格框) ===== */
@@ -329,8 +330,8 @@
 				<tr>
 				<tr>
 					<th style="width:100px">工位</th>
 					<th style="width:100px">工位</th>
 					<th style="width:150px">工位名称</th>
 					<th style="width:150px">工位名称</th>
-					<th id="thPrevDayPlan" style="width:100px">日计划</th>
-					<th id="thPrevDayOutput" style="width:100px">日产出</th>
+					<th id="thPrevDayPlan" style="width:100px">日<br>计划</th>
+					<th id="thPrevDayOutput" style="width:100px">日<br>产量</th>
 					<th id="thDayPlan" style="width:100px">白班计划</th>
 					<th id="thDayPlan" style="width:100px">白班计划</th>
 					<th id="thDayOutput" style="width:100px">白班产量</th>
 					<th id="thDayOutput" style="width:100px">白班产量</th>
 					<th id="thNightPlan" style="width:100px">夜班计划</th>
 					<th id="thNightPlan" style="width:100px">夜班计划</th>
@@ -491,8 +492,8 @@
 		var dayOutEl = document.getElementById('thDayOutput');
 		var dayOutEl = document.getElementById('thDayOutput');
 		var nightPlanEl = document.getElementById('thNightPlan');
 		var nightPlanEl = document.getElementById('thNightPlan');
 		var nightOutEl = document.getElementById('thNightOutput');
 		var nightOutEl = document.getElementById('thNightOutput');
-		if (prevPlanEl) prevPlanEl.textContent = prev + '日计划';
-		if (prevOutEl) prevOutEl.textContent = prev + '日产出';
+		if (prevPlanEl) prevPlanEl.innerHTML = prev + '日<br>计划';
+		if (prevOutEl) prevOutEl.innerHTML = prev + '日<br>产量';
 		if (dayPlanEl) dayPlanEl.textContent = today + '白班计划';
 		if (dayPlanEl) dayPlanEl.textContent = today + '白班计划';
 		if (dayOutEl) dayOutEl.textContent = today + '白班产量';
 		if (dayOutEl) dayOutEl.textContent = today + '白班产量';
 		if (nightPlanEl) nightPlanEl.textContent = today + '夜班计划';
 		if (nightPlanEl) nightPlanEl.textContent = today + '夜班计划';

+ 6 - 5
src/main/resources/views/modules/mes/mesScreen5.html

@@ -193,6 +193,7 @@
 			background: rgba(0, 100, 180, 0.28);
 			background: rgba(0, 100, 180, 0.28);
 			border-bottom: 2px solid rgba(77, 201, 245, 0.5);
 			border-bottom: 2px solid rgba(77, 201, 245, 0.5);
 			text-align: center;
 			text-align: center;
+			line-height: 1.25;
 		}
 		}
 		.op-table tbody td {
 		.op-table tbody td {
 			height: 76px;
 			height: 76px;
@@ -225,7 +226,7 @@
 			letter-spacing: 1px;
 			letter-spacing: 1px;
 		}
 		}
 		.op-table td.op-col  { color: #00C8FF; font-weight: bold; font-size: 26px; }
 		.op-table td.op-col  { color: #00C8FF; font-weight: bold; font-size: 26px; }
-		.op-table td.op-name { color: #ffffff; text-align: center; font-size: 22px; }
+		.op-table td.op-name { color: #FFDD00; text-align: center; font-size: 22px; }
 		.op-table td.op-line { color: #FFDD00; text-align: center; font-size: 20px; font-weight: bold; }
 		.op-table td.op-line { color: #FFDD00; text-align: center; font-size: 20px; font-weight: bold; }
 		.op-table td.op-val  { color: #00F7FF; font-weight: bold; font-size: 28px; }
 		.op-table td.op-val  { color: #00F7FF; font-weight: bold; font-size: 28px; }
 
 
@@ -349,8 +350,8 @@
 					<th style="width:100px">产线</th>
 					<th style="width:100px">产线</th>
 					<th style="width:90px">工位</th>
 					<th style="width:90px">工位</th>
 					<th style="width:120px">工位名称</th>
 					<th style="width:120px">工位名称</th>
-					<th id="thPrevDayPlan" style="width:90px">日计划</th>
-					<th id="thPrevDayOutput" style="width:90px">日产出</th>
+					<th id="thPrevDayPlan" style="width:90px">日<br>计划</th>
+					<th id="thPrevDayOutput" style="width:90px">日<br>产量</th>
 					<th id="thDayPlan" style="width:90px">白班计划</th>
 					<th id="thDayPlan" style="width:90px">白班计划</th>
 					<th id="thDayOutput" style="width:90px">白班产量</th>
 					<th id="thDayOutput" style="width:90px">白班产量</th>
 					<th id="thNightPlan" style="width:90px">夜班计划</th>
 					<th id="thNightPlan" style="width:90px">夜班计划</th>
@@ -511,8 +512,8 @@
 		var dayOutEl = document.getElementById('thDayOutput');
 		var dayOutEl = document.getElementById('thDayOutput');
 		var nightPlanEl = document.getElementById('thNightPlan');
 		var nightPlanEl = document.getElementById('thNightPlan');
 		var nightOutEl = document.getElementById('thNightOutput');
 		var nightOutEl = document.getElementById('thNightOutput');
-		if (prevPlanEl) prevPlanEl.textContent = prev + '日计划';
-		if (prevOutEl) prevOutEl.textContent = prev + '日产出';
+		if (prevPlanEl) prevPlanEl.innerHTML = prev + '日<br>计划';
+		if (prevOutEl) prevOutEl.innerHTML = prev + '日<br>产量';
 		if (dayPlanEl) dayPlanEl.textContent = today + '白班计划';
 		if (dayPlanEl) dayPlanEl.textContent = today + '白班计划';
 		if (dayOutEl) dayOutEl.textContent = today + '白班产量';
 		if (dayOutEl) dayOutEl.textContent = today + '白班产量';
 		if (nightPlanEl) nightPlanEl.textContent = today + '夜班计划';
 		if (nightPlanEl) nightPlanEl.textContent = today + '夜班计划';

+ 6 - 5
src/main/resources/views/modules/mes/mesScreen7.html

@@ -193,6 +193,7 @@
 			background: rgba(0, 100, 180, 0.28);
 			background: rgba(0, 100, 180, 0.28);
 			border-bottom: 2px solid rgba(77, 201, 245, 0.5);
 			border-bottom: 2px solid rgba(77, 201, 245, 0.5);
 			text-align: center;
 			text-align: center;
+			line-height: 1.25;
 		}
 		}
 		.op-table tbody td {
 		.op-table tbody td {
 			height: 76px;
 			height: 76px;
@@ -225,7 +226,7 @@
 			letter-spacing: 1px;
 			letter-spacing: 1px;
 		}
 		}
 		.op-table td.op-col  { color: #00C8FF; font-weight: bold; font-size: 26px; }
 		.op-table td.op-col  { color: #00C8FF; font-weight: bold; font-size: 26px; }
-		.op-table td.op-name { color: #ffffff; text-align: center; font-size: 22px; }
+		.op-table td.op-name { color: #FFDD00; text-align: center; font-size: 22px; }
 		.op-table td.op-val  { color: #00F7FF; font-weight: bold; font-size: 28px; }
 		.op-table td.op-val  { color: #00F7FF; font-weight: bold; font-size: 28px; }
 
 
 		/* ===== 产线阶段数据总览 (按模板排布) ===== */
 		/* ===== 产线阶段数据总览 (按模板排布) ===== */
@@ -347,8 +348,8 @@
 				<tr>
 				<tr>
 					<th style="width:100px">工位</th>
 					<th style="width:100px">工位</th>
 					<th style="width:150px">工位名称</th>
 					<th style="width:150px">工位名称</th>
-					<th id="thPrevDayPlan" style="width:100px">日计划</th>
-					<th id="thPrevDayOutput" style="width:100px">日产出</th>
+					<th id="thPrevDayPlan" style="width:100px">日<br>计划</th>
+					<th id="thPrevDayOutput" style="width:100px">日<br>产量</th>
 					<th id="thDayPlan" style="width:100px">白班计划</th>
 					<th id="thDayPlan" style="width:100px">白班计划</th>
 					<th id="thDayOutput" style="width:100px">白班产量</th>
 					<th id="thDayOutput" style="width:100px">白班产量</th>
 					<th id="thNightPlan" style="width:100px">夜班计划</th>
 					<th id="thNightPlan" style="width:100px">夜班计划</th>
@@ -509,8 +510,8 @@
 		var dayOutEl = document.getElementById('thDayOutput');
 		var dayOutEl = document.getElementById('thDayOutput');
 		var nightPlanEl = document.getElementById('thNightPlan');
 		var nightPlanEl = document.getElementById('thNightPlan');
 		var nightOutEl = document.getElementById('thNightOutput');
 		var nightOutEl = document.getElementById('thNightOutput');
-		if (prevPlanEl) prevPlanEl.textContent = prev + '日计划';
-		if (prevOutEl) prevOutEl.textContent = prev + '日产出';
+		if (prevPlanEl) prevPlanEl.innerHTML = prev + '日<br>计划';
+		if (prevOutEl) prevOutEl.innerHTML = prev + '日<br>产量';
 		if (dayPlanEl) dayPlanEl.textContent = today + '白班计划';
 		if (dayPlanEl) dayPlanEl.textContent = today + '白班计划';
 		if (dayOutEl) dayOutEl.textContent = today + '白班产量';
 		if (dayOutEl) dayOutEl.textContent = today + '白班产量';
 		if (nightPlanEl) nightPlanEl.textContent = today + '夜班计划';
 		if (nightPlanEl) nightPlanEl.textContent = today + '夜班计划';