From 4f58ba24b9a7e24dc38aa8eb9ca0b92c83e161ac Mon Sep 17 00:00:00 2001
From: yantian yue <306727702@qq.com>
Date: 星期五, 20 十月 2023 15:48:14 +0800
Subject: [PATCH] OPCUA更新

---
 guns-vip-main/src/main/webapp/assets/modular/kb/formula/formulaView.js |  119 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 113 insertions(+), 6 deletions(-)

diff --git a/guns-vip-main/src/main/webapp/assets/modular/kb/formula/formulaView.js b/guns-vip-main/src/main/webapp/assets/modular/kb/formula/formulaView.js
index f95701e..ea5d056 100644
--- a/guns-vip-main/src/main/webapp/assets/modular/kb/formula/formulaView.js
+++ b/guns-vip-main/src/main/webapp/assets/modular/kb/formula/formulaView.js
@@ -7,6 +7,29 @@
     var form = layui.form;
     var element = layui.element;
 
+    /**
+     * 閰嶆柟閰嶇疆瀛愪俊鎭鐞�
+     */
+    var FormulaChildInfo = {
+        tableId: "formulaChildInfoTable"
+    };
+
+    $('#imgs').attr("src", "http://localhost:8081/img/9f2f070828381f30fdf1be0da9014c086f06f0ad.jpg");
+
+    /**
+     * 鍒濆鍖栬〃鏍肩殑鍒�
+     */
+    FormulaChildInfo.initColumn = function () {
+        return [[
+            {field: 'id', hide: true, title: 'id'},
+            {type:"numbers" ,title:'宸ユ',width:40},
+            {field: 'operationSteps', sort: true, title: '鎿嶄綔鍐呭'},
+            {field: 'techRequirement', sort: true, title: '鎶�鏈姹�'},
+            {field: 'operationType', sort: true, title: '绫诲瀷'},
+        ]];
+    };
+
+
     initLineInfo();
 
     var ajax = new $ax(Feng.ctxPath + "/workOrder/list?state=3");
@@ -19,7 +42,40 @@
     $('#planQty').text(msg.planQty);
     $('#planStartTime').text(msg.planStartTime);
     $('#planEndTime').text(msg.planEndTime);
+    $('#recipeCode').text(msg.recipeCode);
     var radioElement = $('#sex1');
+
+    var queryData = {};
+    queryData['formulaCode'] = msg.recipeCode;
+    // 娓叉煋琛ㄦ牸
+    table.render({
+        elem: '#' + FormulaChildInfo.tableId,
+        url: Feng.ctxPath + '/formulaChildInfo/list',
+        page: false,
+        // height: "full-158",
+        // height: 460,
+        height: 400,
+        cellMinWidth: 100,
+        where: queryData,
+        cols: FormulaChildInfo.initColumn(),
+        done: function (res, curr, count) {
+            console.log(res);
+            //寰楀埌褰撳墠椤电爜
+            console.log(curr);
+            //寰楀埌鏁版嵁鎬婚噺
+            console.log(count);
+            // 鏍规嵁鏉′欢鍒ゆ柇鍔犺儗鏅壊
+            $.each(res.data, function (index, item) {
+                console.log(item)
+                console.log(item.spareField1)
+                if (item.spareField1 === "3") {
+                    // 娉�1
+                    $("#formulaChildInfoTable").next().find('tbody tr[data-index="' + index +
+                        '"]').css("background-color", "#00ff66");
+                }
+            });
+        }
+    });
 
     function initLineInfo(){
         $.ajax({
@@ -77,12 +133,13 @@
         }
     });
 
-    setInterval(function() {
-        $('input[name="sex1"][value="nan1"]').prop('checked', true);
-    }, 1000);
-    setInterval(function() {
-        radioElement.prop('checked', false);
-    }, 2000);
+    // //redio闂儊
+    // setInterval(function() {
+    //     $('input[name="sex1"][value="nan1"]').prop('checked', true);
+    // }, 1000);
+    // setInterval(function() {
+    //     radioElement.prop('checked', false);
+    // }, 2000);
 
     //Hash鍦板潃鐨勫畾浣�
     var layid = location.hash.replace(/^#test=/, '');
@@ -92,4 +149,54 @@
         location.hash = 'test='+ $(this).attr('lay-id');
     });
 
+    /**
+     * 鍩虹BOM绠$悊
+     */
+    var ProductBomChildInfo = {
+        tableId: "productBomChildInfoTable"
+    };
+
+    /**
+     * 鍒濆鍖栬〃鏍肩殑鍒�
+     */
+    ProductBomChildInfo.initColumn = function () {
+        return [[
+            {field: 'id', hide: true, title: '涓婚敭id'},
+            {field: 'opCode', sort: true, title: '宸ュ簭缂栫爜'},
+            {field: 'opName', sort: true, title: '宸ュ簭鍚嶇О'},
+            {field: 'materialCode', sort: true, title: '鐗╂枡缂栫爜'},
+            {field: 'costQty', sort: true, title: '鍗曡��'},
+            {field: 'bomCode', sort: true, title: 'BOM缂栫爜'},
+        ]];
+    };
+
+    var queryData = {};
+    queryData['bomCode'] = "301002000021";
+    // 娓叉煋琛ㄦ牸
+    table.render({
+        elem: '#' + ProductBomChildInfo.tableId,
+        url: Feng.ctxPath + '/productBomChildInfo/list',
+        page: true,
+        height: 460,
+        cellMinWidth: 100,
+        where: queryData,
+        cols: ProductBomChildInfo.initColumn()
+    });
+
+    $("#scanCode").keydown(function(event) {
+        if (event.keyCode === 13) {
+            // 鎵ц鎮ㄦ兂瑕佺殑浠g爜
+            var ajax = new $ax(Feng.ctxPath + "/kb/formulaView/addFormulaState?formulaCode="+msg.recipeCode);
+            var result = ajax.start();
+            table.reload("formulaChildInfoTable")
+            return false; // 闃绘榛樿琛屼负
+        }
+    });
+
+    $("#clear").click(function() {
+        var ajax = new $ax(Feng.ctxPath + "/kb/formulaView/clear?formulaCode="+msg.recipeCode);
+        var result = ajax.start();
+        table.reload("formulaChildInfoTable")
+    });
+
 });

--
Gitblit v1.9.3