From 938baa4217e35445b6dba52bcceef4ce2d30bfc3 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期五, 10 一月 2025 16:18:46 +0800
Subject: [PATCH] 1

---
 WebTM/views/设备管理/设备工艺参数订单点检表/SB_EquipICMOTechParamBillEdit.html |   70 ++++++++++++++++++++++++++++-------
 1 files changed, 56 insertions(+), 14 deletions(-)

diff --git "a/WebTM/views/\350\256\276\345\244\207\347\256\241\347\220\206/\350\256\276\345\244\207\345\267\245\350\211\272\345\217\202\346\225\260\350\256\242\345\215\225\347\202\271\346\243\200\350\241\250/SB_EquipICMOTechParamBillEdit.html" "b/WebTM/views/\350\256\276\345\244\207\347\256\241\347\220\206/\350\256\276\345\244\207\345\267\245\350\211\272\345\217\202\346\225\260\350\256\242\345\215\225\347\202\271\346\243\200\350\241\250/SB_EquipICMOTechParamBillEdit.html"
index a6177a4..54807c2 100644
--- "a/WebTM/views/\350\256\276\345\244\207\347\256\241\347\220\206/\350\256\276\345\244\207\345\267\245\350\211\272\345\217\202\346\225\260\350\256\242\345\215\225\347\202\271\346\243\200\350\241\250/SB_EquipICMOTechParamBillEdit.html"
+++ "b/WebTM/views/\350\256\276\345\244\207\347\256\241\347\220\206/\350\256\276\345\244\207\345\267\245\350\211\272\345\217\202\346\225\260\350\256\242\345\215\225\347\202\271\346\243\200\350\241\250/SB_EquipICMOTechParamBillEdit.html"
@@ -634,15 +634,15 @@
                         , { field: 'HTechParamUnitName', title: '宸ヨ壓鍙傛暟鍗曚綅鍚嶇О', width: 130, style: 'background-color:#efefef4d;' }
                         , { field: 'HSNO', title: '宸ヨ壓娆″簭', width: 110, style: 'background-color:#efefef4d;' }
                         , { field: 'HTechParamIDStd', title: 'HTechParamIDStd', width: 100, hide: true, style: 'background-color:#efefef4d;' }
-                        , { field: 'HTechParamIDStdName', title: '璁惧璁惧畾鍊煎伐鑹哄弬鏁�', width: 130, edit: 'text', event: "HTechParamIDStdName" }
-                        , { field: 'HResultStd', title: '璁惧璁惧畾鍊�', width: 130, edit: 'text' }
+                        , { field: 'HTechParamIDStdName', title: '璁惧璁惧畾鍊煎伐鑹哄弬鏁�', hide: true, width: 130, edit: 'text', event: "HTechParamIDStdName" }
+                        , { field: 'HResultStd', title: '璁惧璁惧畾鍊�', hide: true, width: 130, edit: 'text' }
                         , { field: 'HVaule', title: '宸ヨ壓鍙傛暟鍊�', width: 100, edit: false, event: "HVaule"  }
                         , { field: 'HStd', title: '鏍囧噯鍊�', width: 100, edit: 'text' }
                         , { field: 'HMax', title: '涓婇檺', width: 100, edit: 'text' }
                         , { field: 'HMin', title: '涓嬮檺', width: 100, edit: 'text' }
                         , { field: 'HResult', title: '妫�娴嬬粨鏋�', width: 100, templet: "#HResult" }
                         , { field: 'HRemark', title: '澶囨敞', width: 100, edit: 'text' }
-                        , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo', width: 70 }
+                       // , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo', width: 70 }
                     ]]                  
                 }
 
@@ -1284,17 +1284,47 @@
                 var field = cell.data('field'); // 鑾峰彇瀛楁
                 var rowIndex = cell.closest('tr').data('index'); // 鑾峰彇褰撳墠琛屾暟鎹储寮�
 
-                // 浣跨敤 layui 鐨勮〃鏍兼柟娉曟洿鏂版暟鎹�
+                // 浣跨敤layui鐨勮〃鏍兼柟娉曟洿鏂版暟鎹�
                 var updatedData = table.cache['mainTable'].map(function (item) {
-                    if (item.LAY_TABLE_INDEX === rowIndex) { // 浣跨敤 numbers 鍒楃储寮曞畾浣�
+                    if (item.LAY_TABLE_INDEX === rowIndex) { // 浣跨敤numbers鍒楃储寮曞畾浣�
                         item[field] = newValue;
                     }
                     return item;
                 });
 
-                layui.table.reload('mainTable', {
-                    data: updatedData
+                // 鑾峰彇褰撳墠琛屾暟鎹�
+                var currentRowData = table.cache['mainTable'].find(function (item) {
+                    return item.LAY_TABLE_INDEX === rowIndex;
                 });
+
+                // 鍋囪杩欓噷瑕佸垽鏂殑瀛楁鏄� 'HVaule'锛屼綘鍙互鏍规嵁瀹為檯闇�姹備慨鏀硅鍒ゆ柇鐨勫瓧娈靛悕
+                if (field === 'HVaule') {
+                    var valueToCheck = parseFloat(newValue);
+                    var lowerLimit = parseFloat(currentRowData.HMin);
+                    var upperLimit = parseFloat(currentRowData.HMax);
+
+                    // 寰幆閬嶅巻褰撳墠琛屼笂涓嬮檺鏁版嵁骞惰繘琛屽垽鏂紙杩欓噷鍏跺疄涓昏鏄垽鏂綋鍓嶈鐨勪笂涓嬮檺涓庢洿鏂板�肩殑鍏崇郴锛�
+                    if (valueToCheck >= lowerLimit && valueToCheck <= upperLimit) {
+                        // 鏇存柊褰撳墠琛岀殑HResult涓篛K
+                        currentRowData.HResult = 'OK';
+                    } else {
+                        currentRowData.HResult = 'NG';
+                    }
+                }
+
+                checkRefresh();
+
+                //// 浣跨敤 layui 鐨勮〃鏍兼柟娉曟洿鏂版暟鎹�
+                //var updatedData = table.cache['mainTable'].map(function (item) {
+                //    if (item.LAY_TABLE_INDEX === rowIndex) { // 浣跨敤 numbers 鍒楃储寮曞畾浣�
+                //        item[field] = newValue; // 鏇存柊瀛楁鍊�
+                //        item.HResult = hResult; // 鏇存柊妫�娴嬬粨鏋�
+                //    }
+                //    return item;
+                //});                
+                //layui.table.reload('mainTable', {
+                //    data: updatedData
+                //});
                 // 鍙栨秷缂栬緫鐘舵��
                 cell.removeAttr('contenteditable');
                 //鍙栨秷鍐掓场
@@ -1417,9 +1447,9 @@
             function checkRefresh() {
                 for (var i = 1; i <= option.data.length; i++) {
                     //鐘舵��
-                    $('#HResult' + i + '').find("option[value='" + option.data[i - 1].HResult + "']").attr("selected", true);
+                    $('#HResult' + i + '').find("option[value='" + option.data[i - 1].HResult + "']").prop("selected", true);
                 }
-                form.render('select');
+                form.render('select');               
             }
             //#endregion
 
@@ -1474,6 +1504,13 @@
                             });
                             var rowdata = [];
                             for (var i = 0; i < result.data.length; i++) {
+                                // 鑾峰彇褰撳墠鐨勬暟閲囧�笺�佷笂闄愬�煎拰涓嬮檺鍊硷紝骞剁‘淇濆畠浠槸鏁板�肩被鍨�
+                                var value = parseFloat(result.data[i]["鏁伴噰鍊�"]);
+                                var max = parseFloat(result.data[i]["涓婇檺鍊�"]);
+                                var min = parseFloat(result.data[i]["涓嬮檺鍊�"]);
+
+                                // 鍒ゆ柇 HResult 鐨勫��
+                                var hResult = (value <= max && value >= min) ? "OK" : "NG";
                                 rowdata.push(
                                     {
                                         "HTechParamClassID": result.data[i]["HTechParamClassID"] == null ? 0 : result.data[i]["HTechParamClassID"],
@@ -1492,13 +1529,14 @@
                                         "HStd": result.data[i]["鏍囧噯鍊�"],
                                         "HMax": result.data[i]["涓婇檺鍊�"],
                                         "HMin": result.data[i]["涓嬮檺鍊�"],
-                                        "HRemark": result.data[i]["閲囬泦鏉ユ簮"]
+                                        "HRemark": result.data[i]["閲囬泦鏉ユ簮"],
+                                        "HResult": hResult
                                     }
                                 );
                             }
                             option.data = rowdata;
-
                             table.render(option);
+                            checkRefresh();
                             layer.close(ajaxLoad);
                         } else {
                             layer.close(ajaxLoad);
@@ -1577,7 +1615,7 @@
             form.on('submit(btn_Cancel)', function () {
                 layer.confirm('鎮ㄧ‘瀹氳閫�鍑哄悧锛�', { icon: 3, title: '鎻愮ず' }, function (index) {
                     //鎿嶄綔绫诲瀷锛圤perationType=1鏂板銆丱perationType=2缂栬緫锛�
-                    if (OperationType == 2) {
+                    if (OperationType == 2 || OperationType == 1) {
                         Pub_Close(1);
                     }
                     else {
@@ -1690,7 +1728,7 @@
                     }
                 });
             }
-            //#endregion
+            //#endregion        
 
         });
 
@@ -1774,7 +1812,11 @@
                 sSubStr = JSON.parse(sSubStr);
                 for (var i = 0; i <= sSubStr.length - 1; i++) {
                     if (sSubStr[i].HTechParamID == "0") {
-                        layer.msg("鏄庣粏璁板綍绗�" + (i + 1) + "琛�,宸ヨ壓鍙傛暟淇℃伅涓虹┖锛�", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                        layer.msg("鏄庣粏璁板綍绗�" + (i + 1) + "琛�,宸ヨ壓鍙傛暟浠g爜/鍚嶇О涓嶈兘涓虹┖锛�", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                        return Result = false;
+                    }
+                    if (sSubStr[i].HRemark == "鎵嬪姩杈撳叆" && (sSubStr[i].HVaule == "" || sSubStr[i].HVaule == null)) {
+                        layer.msg("鏄庣粏璁板綍绗�" + (i + 1) + "琛�,鎵嬫湳杈撳叆鐨勫伐鑹哄弬鏁板�间笉鑳戒负绌猴紒", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                         return Result = false;
                     }
                 }

--
Gitblit v1.9.1