From f4a3430eb6b6800d4ef7330293dd8fb834eee196 Mon Sep 17 00:00:00 2001
From: yantian yue <306727702@qq.com>
Date: 星期三, 18 十月 2023 14:32:04 +0800
Subject: [PATCH] OPCUA更新

---
 guns-vip-main/src/main/webapp/assets/modular/pm/workOrder/workOrder.js |  126 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 114 insertions(+), 12 deletions(-)

diff --git a/guns-vip-main/src/main/webapp/assets/modular/pm/workOrder/workOrder.js b/guns-vip-main/src/main/webapp/assets/modular/pm/workOrder/workOrder.js
index 3974779..32aac30 100644
--- a/guns-vip-main/src/main/webapp/assets/modular/pm/workOrder/workOrder.js
+++ b/guns-vip-main/src/main/webapp/assets/modular/pm/workOrder/workOrder.js
@@ -151,9 +151,9 @@
         var result = ajax.start();
         if(result.data.length === 0) {
             var operation = function () {
-                var ajax = new $ax(Feng.ctxPath + "/productionOrdeInfo/editItem", function (data) {
+                var ajax = new $ax(Feng.ctxPath + "/workOrder/editItem", function (data) {
                     Feng.success("寮�濮嬪伐鍗曟垚鍔�!");
-                    table.reload(ProductionOrdeInfo.tableId);
+                    table.reload(WorkOrder.tableId);
                 }, function (data) {
                     Feng.error("寮�濮嬪伐鍗曞け璐�!" + data.responseJSON.message + "!");
                 });
@@ -173,10 +173,114 @@
         }
     };
 
+    /**
+     * 鍐荤粨宸ュ崟
+     */
+    WorkOrder.freezeOrder = function (data) {
+        console.log(data)
+        var operation = function () {
+            var ajax = new $ax(Feng.ctxPath + "/workOrder/editOrderState", function (data) {
+                Feng.success("鍐荤粨宸ュ崟鎴愬姛!");
+                table.reload(WorkOrder.tableId);
+            }, function (data) {
+                Feng.error("鍐荤粨宸ュ崟澶辫触!" + data.responseJSON.message + "!");
+            });
+            ajax.set(data);
+            console.log(data)
+            ajax.start();
+        };
+        Feng.confirm("鏄惁鍐荤粨宸ュ崟?", operation);
+    };
+
+    /**
+     * 鐐瑰嚮瑙e喕宸ュ崟
+     */
+    WorkOrder.thawOrder = function (data) {
+        var ajax = new $ax(Feng.ctxPath + "/workOrder/list?state=3");
+        var result = ajax.start();
+        if(result.data.length === 0) {
+            var operation = function () {
+                var ajax = new $ax(Feng.ctxPath + "/workOrder/editItem", function (data) {
+                    Feng.success("瑙e喕宸ュ崟鎴愬姛!");
+                    table.reload(WorkOrder.tableId);
+                }, function (data) {
+                    Feng.error("瑙e喕宸ュ崟澶辫触!" + data.responseJSON.message + "!");
+                });
+                ajax.set(data);
+                ajax.start();
+            };
+            Feng.confirm("鏄惁瑙e喕宸ュ崟?", operation);
+        }else {
+            layer.open({
+                title: "鎿嶄綔鎻愮ず",
+                icon: 0,
+                closeBtn: 2,
+                area: ['450px', '200px'],
+                time: 5000,
+                content: '<span style="font-size: 30px;color: red">瑙e喕澶辫触锛屽彧鑳芥湁涓�鏉$敓浜т腑鐨勫伐鍗曡繘琛岀敓浜э紒</span>'
+            });
+        }
+    };
+
+    /**
+     * 鍏抽棴宸ュ崟
+     */
+    WorkOrder.closeOrder = function (data) {
+        var operation = function () {
+            var ajax = new $ax(Feng.ctxPath + "/workOrder/editOrderState", function (data) {
+                Feng.success("鍏抽棴宸ュ崟鎴愬姛!");
+                table.reload(WorkOrder.tableId);
+            }, function (data) {
+                Feng.error("鍏抽棴宸ュ崟澶辫触!" + data.responseJSON.message + "!");
+            });
+            ajax.set(data);
+            console.log(data)
+            ajax.start();
+        };
+        Feng.confirm("鏄惁鍏抽棴宸ュ崟?", operation);
+    };
+
+    /**
+     * 鐐瑰嚮鍚敤宸ュ崟
+     */
+    WorkOrder.enableOrder = function (data) {
+        var operation = function () {
+            var ajax = new $ax(Feng.ctxPath + "/workOrder/editItem", function (data) {
+                Feng.success("鍚敤宸ュ崟鎴愬姛!");
+                table.reload(WorkOrder.tableId);
+            }, function (data) {
+                Feng.error("鍚敤宸ュ崟澶辫触!" + data.responseJSON.message + "!");
+            });
+            ajax.set(data);
+            ajax.start();
+        };
+        Feng.confirm("鏄惁鍚敤宸ュ崟?", operation);
+    };
+
+    /**
+     * 鐐瑰嚮瀹屾垚
+     *
+     * @param data 鐐瑰嚮鎸夐挳鏃跺�欑殑琛屾暟鎹�
+     */
+    WorkOrder.finish = function (data) {
+        var operation = function () {
+            var ajax = new $ax(Feng.ctxPath + "/workOrder/editItem", function (data) {
+                Feng.success("宸插畬鎴�!");
+                table.reload(WorkOrder.tableId);
+            }, function (data) {
+                Feng.error("鍒犻櫎澶辫触!" + data.responseJSON.message + "!");
+            });
+            ajax.set(data);
+            ajax.start();
+        };
+        Feng.confirm("鏄惁瀹屾垚?", operation);
+    };
+
     // 宸ュ叿鏉$偣鍑讳簨浠�
     table.on('tool(' + WorkOrder.tableId + ')', function (obj) {
         var data = obj.data;
         var layEvent = obj.event;
+        console.log(data)
 
         // if (layEvent === 'edit') {
         //     WorkOrder.jumpEditPage(data);
@@ -187,28 +291,26 @@
             WorkOrder.jumpEditPage(data);
         }
         else if (layEvent === 'start') {//寮�濮�
-            data.orderStatus = '3';
-            // data.actualStartTime = getDateTime();
+            data.state = '3';
+            data.produceStartTime = getDateTime();
             WorkOrder.startOrder(data);
         }else if (layEvent === 'freeze') {//鍐荤粨
-            data.orderStatus = '4';
+            data.state = '4';
             WorkOrder.freezeOrder(data);
         }else if (layEvent === 'thaw') {//瑙e喕
-            data.orderStatus = '3';
+            data.state = '3';
             WorkOrder.thawOrder(data);
         }else if (layEvent === 'close') {//鍏抽棴
-            data.orderStatus = '6';
+            data.state = '6';
             WorkOrder.closeOrder(data);
         }else if (layEvent === 'enable') {//鍚敤
-            data.orderStatus = '1';
+            data.state = '1';
             WorkOrder.enableOrder(data);
         }else if (layEvent === 'delete') {
             WorkOrder.onDeleteItem(data);
-        }else if (layEvent === 'materialCodeClick') {
-            WorkOrder.materialCodeClick(data);
         }else if (layEvent === 'finish') {//瀹屾垚
-            data.orderStatus = '5';
-            data.actualEndTime = getDateTime();
+            data.state = '5';
+            data.produceEndTime = getDateTime();
             WorkOrder.finish(data);
         }
     });

--
Gitblit v1.9.3