jingbo 3 tháng trước cách đây
mục cha
commit
6f918556d8

+ 2 - 2
src/main/java/com/jeesite/modules/mes/service/MesProductRecordService.java

@@ -874,11 +874,11 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
 		mesProcessProduct.setProductCate(lineSn);
 		mesProcessProductService.updateSnIsNull(mesProcessProduct);
 
-		// 下线工位
+		// 下线工位(任意产线:当前工位为下线工位且结果OK时,更新产品状态为合格)
 		MesLineProcess mesLineProcess = mesLineProcessService.getOffLineOprno(lineSn);
 		String xxOprno = ObjectUtils.isEmpty(mesLineProcess)?"":mesLineProcess.getOprno();
 		// 下线
-		if(lineSn.equals("XT") && oprno.equals(xxOprno) && content.equals("OK")){ // 更新产品状态
+		if(oprno.equals(CommonUitl.formatOprno(xxOprno)) && content.equals("OK")){ // 更新产品状态
 			MesProduct mesProduct = new MesProduct();
 			mesProduct.setSn(sn);
 			mesProduct.setCate(cateSn);

+ 20 - 1
src/main/java/com/jeesite/modules/mes/web/MesProductController.java

@@ -1397,16 +1397,35 @@ public class MesProductController extends BaseController {
 		ngBefore.add(Calendar.HOUR_OF_DAY, -48);
 		MesProductRecord ngRecordQuery = new MesProductRecord();
 		ngRecordQuery.setContent("NG");
+		ngRecordQuery.setCraft("100000");
 		ngRecordQuery.setUpdateDate_lte(ngBefore.getTime());
 		ngRecordQuery.getSqlMap().getOrder().setOrderBy("a.update_date ASC");
 		List<MesProductRecord> ngRecordList = mesProductRecordService.findList(ngRecordQuery);
 		if (ngRecordList != null) {
 			SimpleDateFormat dateTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+			Map<String, String> oprnoTitleCache = new HashMap<>();
 			for (MesProductRecord record : ngRecordList) {
 				Map<String, Object> item = MapUtils.newHashMap();
 				item.put("sn", record.getSn());
 				item.put("oprno", record.getOprno());
-				item.put("title", StringUtils.isEmpty(record.getTitle()) ? record.getOprnoTitle() : record.getTitle());
+				String lineSn = record.getLineSn();
+				String oprno = StringUtils.isEmpty(record.getOprno()) ? "" : CommonUitl.formatOprno(record.getOprno());
+				String titleKey = (StringUtils.isEmpty(lineSn) ? "" : lineSn) + "|" + oprno;
+				if (!oprnoTitleCache.containsKey(titleKey)) {
+					String oprnoTitle = "";
+					if (StringUtils.isNotEmpty(lineSn) && StringUtils.isNotEmpty(oprno)) {
+						MesLineProcess mesLineProcess = new MesLineProcess();
+						mesLineProcess.setLineSn(lineSn);
+						mesLineProcess.setOprno(oprno);
+						MesLineProcess processInfo = mesLineProcessService.findInfo(mesLineProcess);
+						if (processInfo != null && StringUtils.isNotEmpty(processInfo.getTitle())) {
+							oprnoTitle = processInfo.getTitle();
+						}
+					}
+					oprnoTitleCache.put(titleKey, oprnoTitle);
+				}
+				item.put("title", oprnoTitleCache.get(titleKey));
+				item.put("oprnoTitle", oprnoTitleCache.get(titleKey));
 				item.put("result", record.getContent());
 				item.put("time", record.getUpdateDate() == null ? "" : dateTimeFormat.format(record.getUpdateDate()));
 				ngWarnings.add(item);

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

@@ -4311,7 +4311,17 @@ public class MesProductRecordController extends BaseController {
 			return resp;
 		}
 
-		// 1.检查是否存在工件码  2.检查是否存在工位  3.判断是否为万能码 4.检查是否开启防呆和重复检测
+
+		// 当为OP050时直接放行
+		if("OP050A".equals(oldOprno)){
+			resp.setMessage("工件可以加工");
+			resp.setResult(Global.TRUE);
+			return resp;
+		}
+
+
+
+			// 1.检查是否存在工件码  2.检查是否存在工位  3.判断是否为万能码 4.检查是否开启防呆和重复检测
 		// 5.开启防呆后判断状态(开班点检、判断物料批次是否符合绑定、检查配件寿命是否到期、当前工位结果、上面工位结果)
 		String ret = checkQualityCommon(oldOprno,sn,lineSn,userCode);
 		String checkret = ret.substring(3,5);
@@ -4689,6 +4699,19 @@ public class MesProductRecordController extends BaseController {
 		String sn = request.getParameter("sn");
 		String oprno = request.getParameter("oprno");
 		String lineSn = request.getParameter("lineSn");
+
+		// 根据lineSn获取产品信息(mesProductCate表)
+		MesProductCate mesProductCate = mesProductCateService.findBySn(lineSn);
+		// 按照规格检查工件码是否合规(根据)
+		Boolean ret =  CommonUitl.checkSnByModel(sn,mesProductCate.getSpec(),mesProductCate.getSpecStart(),mesProductCate.getLength());
+		if (!ret){
+			resp.setResult(Global.FALSE);
+			resp.setMessage("图号不正确,请重新扫码");
+			return resp;
+		}
+
+
+
 		if ("true".equals(resp.getResult())){
 			try {
 				// 将二维码放置在工位
@@ -4703,6 +4726,9 @@ public class MesProductRecordController extends BaseController {
 				// 新增表 工件码 工位号 ucode
 				resp.setResult(Global.TRUE);
 				resp.setMessage("扫码成功");
+				if ("OP050A".equals(oprno)){
+					resp.setMessage("扫码成功,请进行检查,工件码:"+sn);
+				}
 				return resp;
 			}catch (Exception e){
 				resp.setResult(Global.FALSE);

+ 40 - 13
src/main/resources/views/modules/mes/mesDeviceOeeScreen.html

@@ -599,36 +599,63 @@
 	}
 
 	function renderStatusChart(statusList) {
-		var chartData = (statusList || []).map(function(item) {
-			return {
-				name: item.name,
-				value: safeNumber(item.value),
-				itemStyle: { color: item.color }
-			};
+		// 仅展示数量>0 的状态,避免 0 值扇区抢颜色/引线,导致「停机」显示成故障红等错位
+		var chartData = (statusList || [])
+			.filter(function(item) {
+				return safeNumber(item.value) > 0;
+			})
+			.map(function(item) {
+				return {
+					name: item.name,
+					value: safeNumber(item.value),
+					itemStyle: { color: item.color }
+				};
+			});
+		var colors = chartData.map(function(item) {
+			return item.itemStyle.color;
 		});
 		statusChart.setOption({
 			backgroundColor: 'transparent',
+			color: colors,
 			tooltip: {
 				trigger: 'item',
-				formatter: '{b}: {c}'
+				formatter: '{b}: {c} ({d}%)'
 			},
+			graphic: [{
+				type: 'text',
+				left: 'center',
+				top: 'middle',
+				z: 10,
+				style: {
+					text: '状态\n总览',
+					fill: '#eafdff',
+					fontSize: 18,
+					lineHeight: 26,
+					textAlign: 'center',
+					textVerticalAlign: 'middle'
+				}
+			}],
 			series: [{
 				type: 'pie',
 				radius: ['58%', '76%'],
 				center: ['50%', '50%'],
 				avoidLabelOverlap: true,
+				minShowLabelAngle: 1,
 				label: {
 					show: true,
-					position: 'center',
-					formatter: '状态\\n总览',
+					formatter: '{b}',
 					color: '#eafdff',
-					fontSize: 18,
-					lineHeight: 26
+					fontSize: 12
+				},
+				labelLine: {
+					show: true,
+					length: 12,
+					length2: 8,
+					lineStyle: { color: 'rgba(173, 216, 230, 0.55)' }
 				},
-				labelLine: { show: false },
 				data: chartData.length ? chartData : [{ name: '暂无数据', value: 1, itemStyle: { color: '#31506f' } }]
 			}]
-		});
+		}, true);
 	}
 
 	function renderLegend(statusList) {

+ 33 - 15
src/main/resources/views/modules/mes/mesScreenLiuan.html

@@ -246,6 +246,16 @@
             height: 28px;
             text-align: center;
         }
+        .ng-table th:nth-child(1),
+        .ng-table td:nth-child(1) { width: 38%; }
+        .ng-table th:nth-child(2),
+        .ng-table td:nth-child(2) { width: 14%; }
+        .ng-table th:nth-child(3),
+        .ng-table td:nth-child(3) { width: 18%; }
+        .ng-table th:nth-child(4),
+        .ng-table td:nth-child(4) { width: 10%; }
+        .ng-table th:nth-child(5),
+        .ng-table td:nth-child(5) { width: 20%; }
         .ng-table td {
             height: 30px;
             color: #fff;
@@ -256,6 +266,21 @@
             text-overflow: ellipsis;
             white-space: nowrap;
         }
+        /* 工件码完整展示,不截断 */
+        .ng-table td.ng-sn {
+            font-size: 11px;
+            letter-spacing: 0;
+            white-space: normal;
+            word-break: break-all;
+            line-height: 1.25;
+            text-overflow: clip;
+            overflow: visible;
+            vertical-align: middle;
+            padding: 2px 4px;
+        }
+        .ng-table td.ng-title {
+            font-size: 11px;
+        }
         .ng-table tbody tr:nth-child(odd) td {
             background: rgba(10, 88, 153, .36);
         }
@@ -320,14 +345,6 @@
         .line-green { background: #10f2b4; }
         .line-yellow { background: #ffc82e; }
         .line-blue { background: #18b8ff; }
-        .rate-number {
-            position: absolute;
-            right: 42px;
-            top: 85px;
-            color: #23f8ff;
-            font-size: 24px;
-            font-weight: 900;
-        }
         .daily-legend {
             position: absolute;
             right: 34px;
@@ -427,7 +444,7 @@
                 <tr>
                     <th>工件号</th>
                     <th>工位号</th>
-                    <th>提交名称</th>
+                    <th>工位名称</th>
                     <th>结果</th>
                     <th>预警时间</th>
                 </tr>
@@ -442,7 +459,6 @@
                 <img src="${ctxStatic}/screen/imgs/liuan13.png" alt="">
                 <div><span>IQC检测合格率</span><strong id="iqcRateText">0%</strong></div>
             </div>
-            <div class="rate-number" id="iqcRate">0%</div>
             <div class="legend"><span><i class="line-yellow"></i>不合格数量</span><span><i class="line-green"></i>合格率</span></div>
             <div class="chart-with-metrics" id="iqcChart"></div>
         </section>
@@ -833,10 +849,12 @@
         }
         for (var i = 0; i < pageRows.length; i++) {
             var row = pageRows[i] || {};
+            var snText = row.sn || row.msg || '';
+            var titleText = row.title || row.oprnoTitle || '';
             html += '<tr>' +
-                '<td title="' + escapeHtml(row.sn || row.msg || '') + '">' + escapeHtml(row.sn || row.msg || '') + '</td>' +
+                '<td class="ng-sn" title="' + escapeHtml(snText) + '">' + escapeHtml(snText) + '</td>' +
                 '<td>' + escapeHtml(row.oprno || '') + '</td>' +
-                '<td title="' + escapeHtml(row.title || '') + '">' + escapeHtml(row.title || '') + '</td>' +
+                '<td class="ng-title" title="' + escapeHtml(titleText) + '">' + escapeHtml(titleText) + '</td>' +
                 '<td>' + escapeHtml(row.result || row.content || '') + '</td>' +
                 '<td>' + escapeHtml(row.time || row.createDate || row.updateDate || '') + '</td>' +
                 '</tr>';
@@ -887,7 +905,7 @@
         var checkPassDaily = alignNumbers(screenData.checkPassDaily, dates.length);
         var checkNgDaily = alignNumbers(screenData.checkNgDaily, dates.length);
         var checkPassRate = numberValue(screenData.checkPassRate);
-        var deliveryRate = percent(todayOut, today || plan);
+        var deliveryRate = percent(today, plan);
         var iqcRateValues = dates.map(function (_, i) { return percent(quality1[i], quality1[i] + quality2[i]); });
         var iqcRate = iqcRateValues.length ? iqcRateValues[iqcRateValues.length - 1] : 0;
 
@@ -898,10 +916,10 @@
         $('#deliveryRateText').text(deliveryRate + '%');
         $('#todayPlanRate').text(finishRate + '%');
         $('#checkPassRateText').text(checkPassRate + '%');
-        $('#iqcRate,#iqcRateText').text(iqcRate + '%');
+        $('#iqcRateText').text(iqcRate + '%');
 
         renderBars('workpieceChart', dates, output, '#83ff64', '#14a9ff');
-        renderLineArea('deliveryChart', dates, warehouseOut, output);
+        renderLineArea('deliveryChart', dates, output, planDaily);
         renderBars('warehouseChart', dates, warehouseOut, '#86ff62', '#13a4ff', {
             top: 12,
             left: 28,

+ 26 - 4
src/main/resources/views/modules/sys/officeForm.html

@@ -57,6 +57,9 @@
 							</div>
 						</div>
 					</div>
+					<% /* 机构类型:表单已简化隐藏,保存时自动赋默认值,避免后端校验 officeType 不能为空 */ %>
+					<#form:hidden path="officeType"/>
+					<#form:hidden path="treeSort"/>
 <!--					<div class="col-xs-6">-->
 <!--						<div class="form-group">-->
 <!--							<label class="control-label col-sm-4" title="">-->
@@ -146,8 +149,30 @@
 </div>
 <% } %>
 <script>
+// 机构类型未在页面展示时,提交前补默认值(2=市级公司,与现有数据常用类型一致)
+function ensureOfficeTypeDefault() {
+	if (!$('#officeType').val()) {
+		$('#officeType').val('2');
+	}
+}
+// 新增时初始化排序号(原排序号输入框已隐藏)
+function initNextNodeDefaults(parentCode) {
+	$.get('${ctx}/sys/office/createNextNode?parentCode=' + (parentCode || ''), function(data){
+		if (!$('#treeSort').val() && data.treeSort != null) {
+			$('#treeSort').val(data.treeSort);
+		}
+	});
+}
+ensureOfficeTypeDefault();
+<% if (office.isNewRecord) { %>
+initNextNodeDefaults($('#parentCode').val());
+<% } %>
 $("#inputForm").validate({
 	submitHandler: function(form){
+		ensureOfficeTypeDefault();
+		if (!$('#treeSort').val()) {
+			$('#treeSort').val('30');
+		}
 		js.ajaxSubmitForm($(form), function(data){
 			js.showMessage(data.message);
 			if(data.result == Global.TRUE){
@@ -168,10 +193,7 @@ $('#officeName').change(function(){
 function treeselectCallback(id, act, index, layero){
 	if (id == 'parent' && (act == 'ok' || act == 'clear')){
 		// 创建并初始化下一个节点信息,如:排序号、默认值
-		$.get('${ctx}/sys/office/createNextNode?parentCode='
-				+$('#parentCode').val(), function(data){
-			$('#treeSort').val(data.treeSort);
-		});
+		initNextNodeDefaults($('#parentCode').val());
 	}
 }
 </script>