From 580a85c33e14a7d83d63de555bafc943547015f8 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期六, 26 三月 2022 14:46:22 +0800
Subject: [PATCH] #杰克缝纫机立库 【订单出库预览】

---
 src/main/webapp/static/js/orderTable.js                 |    1 
 src/main/webapp/static/js/order/out.js                  |  127 +++++++++++++++++++------------
 src/main/webapp/views/order/out.html                    |   42 ++++++----
 src/main/java/com/zy/asrs/controller/OutController.java |   39 +++++++++
 4 files changed, 142 insertions(+), 67 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/OutController.java b/src/main/java/com/zy/asrs/controller/OutController.java
new file mode 100644
index 0000000..8f20a4f
--- /dev/null
+++ b/src/main/java/com/zy/asrs/controller/OutController.java
@@ -0,0 +1,39 @@
+package com.zy.asrs.controller;
+
+import com.core.common.BaseRes;
+import com.core.common.Cools;
+import com.core.common.R;
+import com.zy.asrs.entity.OrderDetl;
+import com.zy.asrs.service.OrderDetlService;
+import com.zy.asrs.service.OrderService;
+import com.zy.common.web.BaseController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * Created by vincent on 2022/3/26
+ */
+
+@RestController
+public class OutController extends BaseController {
+
+    @Autowired
+    private OrderService orderService;
+    @Autowired
+    private OrderDetlService orderDetlService;
+
+    @PostMapping("/out/pakout/preview/auth")
+    public R pakoutPreview(@RequestBody List<Long> ids) {
+        if (Cools.isEmpty(ids)) {
+            return R.parse(BaseRes.PARAM);
+        }
+        List<OrderDetl> orderDetls = orderDetlService.selectBatchIds(ids);
+        return R.ok().add(orderDetls);
+
+    }
+
+}
diff --git a/src/main/webapp/static/js/order/out.js b/src/main/webapp/static/js/order/out.js
index dcd4433..da0cc77 100644
--- a/src/main/webapp/static/js/order/out.js
+++ b/src/main/webapp/static/js/order/out.js
@@ -82,9 +82,16 @@
     });
 
     /* 琛ㄦ牸2澶村伐鍏锋爮鐐瑰嚮浜嬩欢 */
-    table.on('toolbar(sensorTable)', function (obj) {
-        if (obj.event === 'add') { // 娣诲姞
-            showEditModel()
+    table.on('toolbar(orderDetlTable)', function (obj) {
+        var checkStatus = table.checkStatus(obj.config.id).data;
+        if (obj.event === 'pakoutPreview') { // 娣诲姞
+            if (checkStatus.length === 0) {
+                layer.msg('璇烽�夋嫨鑷冲皯涓�鏉″嚭搴撴槑缁�', {icon: 2});
+                return;
+            }
+            pakoutPreview(checkStatus.map(function (d) {
+                return d.id;
+            }));
         } else if (obj.event === 'del') { // 鍒犻櫎
             var checkRows = table.checkStatus('sensorTable');
             if (checkRows.data.length === 0) {
@@ -99,61 +106,85 @@
     });
 
     /* 琛ㄦ牸2宸ュ叿鏉$偣鍑讳簨浠� */
-    table.on('tool(sensorTable)', function (obj) {
+    table.on('tool(orderDetlTable)', function (obj) {
         var data = obj.data;
         switch (obj.event) {
-            case 'detl':
-                top.sensorByDetl = data.id;
+            // 鍑哄簱
+            case 'pakoutPreview':
+                pakoutPreview([data.id])
                 break;
             // 缂栬緫
             case 'edit':
                 showEditModel(data);
                 break;
-            // 鍒犻櫎
-            case 'del':
-                var ids = [data.id];
-                doDelSensor({ids: ids});
-                break;
-            // 鍩虹偣瀹氫綅
-            case 'lbs':
-                notice.msg('璇锋眰涓�...', {icon: 4, position: "topCenter"});
-                var param = {
-                    uuid: data.uuid,
-                    event: obj.event
-                };
-                $.ajax({
-                    url: baseUrl+"/main/command/v1/auth",
-                    headers: {'token': localStorage.getItem('token')},
-                    data: JSON.stringify(param),
-                    contentType:'application/json;charset=UTF-8',
-                    method: 'POST',
-                    success: function (res) {
-                        notice.destroy();
-                        if (res.code === 200){
-                            admin.open({
-                                title: '缁堢鍝嶅簲',
-                                url: 'callback.html',
-                                area: '360px',
-                                data: {
-                                    request: param,
-                                    response: res.data
-                                },
-                                tpl: true
-                            });
-                        } else if (res.code === 403){
-                            top.location.href = baseUrl+"/";
-                        }else {
-                            layer.msg(res.msg, {icon: 2});
-                        }
-                    }
-                })
-                break
         }
     });
 
-    // 璁惧鏄庣粏灞曞紑鍥炶皟
-    window.onSensorDetlDialog = function () {
-    };
+    function pakoutPreview(ids) {
+        var loadIndex = layer.load(2);
+        $.ajax({
+            url: baseUrl + "/out/pakout/preview/auth",
+            headers: {'token': localStorage.getItem('token')},
+            contentType: 'application/json;charset=UTF-8',
+            data: JSON.stringify(ids),
+            method: 'POST',
+            success: function (res) {
+                layer.close(loadIndex);
+                if (res.code === 200){
+                    layer.open({
+                        type: 1
+                        ,title: false
+                        ,closeBtn: false
+                        ,offset: '100px'
+                        ,area: '1000px'
+                        ,shade: 0.5
+                        ,shadeClose: true
+                        ,btn: ['绔嬪嵆鐢熸垚', '绋嶅悗澶勭悊']
+                        ,btnAlign: 'c'
+                        ,moveType: 1 //鎷栨嫿妯″紡锛�0鎴栬��1
+                        ,content: $('#pakoutPreviewBox')
+                        ,success: function(layero, index){
+                            console.log(res.data)
+                            table.render({
+                                elem: '#stoPreTab',
+                                data: res.data,
+                                page: false,
+                                cellMinWidth: 100,
+                                height: 432,
+                                cols: [[
+                                    {field: 'title', title: '鍟嗗搧', merge: true, align: 'center'},
+                                    {field: 'anfme', title: '鎬绘暟閲�', merge: ['title'], align: 'center', style: 'font-weight: bold', width: 90},
+                                    {field: 'type', title: '浠撳簱', merge: true, align: 'center', templet: '#typeTpl', width: 90},
+                                    {field: 'locNo', title: '璐т綅', align: 'center'},
+                                    {field: 'prior$', title: '鎺ㄨ崘璐т綅', align: 'center', width: 100},
+                                    {field: 'reduce', title: '鏁伴噺', align: 'center', width: 90, style: 'font-weight: bold'},
+                                    // {field: 'remQty', title: '浣欓噺', align: 'center', width: 80},
+                                    {field: 'total', title: '鎬婚噺', align: 'center', width: 90},
+                                ]],
+                                done: function () {
+                                    $('.layui-table-body.layui-table-main').css("overflow", "auto")
+                                }
+                            });
+
+                        }
+                        ,yes: function(index, layero){
+                            //鎸夐挳銆愰┈涓婃嫞璐с�戠殑鍥炶皟
+                            stockOut(data.orderNo);
+                        }
+                        ,btn2: function(index, layero){
+                            //鎸夐挳銆愮◢鍚庡鐞嗐�戠殑鍥炶皟
+                            layer.close(index)
+                            //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
+                        }
+                    });
+                } else if (res.code === 403){
+                    top.location.href = baseUrl+"/";
+                } else {
+                    layer.msg(res.msg, {icon: 2})
+                }
+            }
+        })
+    }
 
 
     /* 鏄剧ず琛ㄥ崟寮圭獥 */
diff --git a/src/main/webapp/static/js/orderTable.js b/src/main/webapp/static/js/orderTable.js
index 1665bd7..e775a03 100644
--- a/src/main/webapp/static/js/orderTable.js
+++ b/src/main/webapp/static/js/orderTable.js
@@ -42,7 +42,6 @@
             {field: 'orderNo', title: '鍗曟嵁缂栧彿', align: 'center'}
         ]],
         done: function (res, curr, count) {
-            console.log(res)
             $('#dictTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click');
         }
     });
diff --git a/src/main/webapp/views/order/out.html b/src/main/webapp/views/order/out.html
index e036adf..4b7f752 100644
--- a/src/main/webapp/views/order/out.html
+++ b/src/main/webapp/views/order/out.html
@@ -22,18 +22,18 @@
         }
 
         /* 鏉冮檺鎺у埗 */
-        #btn-add {
-            display: none;
-        }
-        #btn-delete {
-            display: none;
-        }
-        .btn-edit {
-            display: none;
-        }
-        .btn-more {
-            display: none;
-        }
+        /*#btn-add {*/
+        /*    display: none;*/
+        /*}*/
+        /*#btn-delete {*/
+        /*    display: none;*/
+        /*}*/
+        /*.btn-edit {*/
+        /*    display: none;*/
+        /*}*/
+        /*.btn-more {*/
+        /*    display: none;*/
+        /*}*/
     </style>
 </head>
 <body>
@@ -102,19 +102,25 @@
 <!-- 澶村伐鍏锋爮 -->
 <script type="text/html" id="orderDetToolbar">
     <div class="layui-btn-container">
-        <button class="layui-btn layui-btn-sm layui-btn-normal" id="btn-add" lay-event="add"><i class="layui-icon">&#xe654;</i>鏂板</button>
-        <button class="layui-btn layui-btn-sm layui-btn-danger" id="btn-delete" lay-event="del"><i class="layui-icon">&#xe640;</i>鍒犻櫎</button>
+        <button class="layui-btn layui-btn-sm layui-btn-danger btn-pakoutPreview" id="btn-pakoutPreview" lay-event="pakoutPreview">鎵归噺鍑哄簱</button>
     </div>
 </script>
 
 <!-- 琛屽伐鍏锋爮 -->
 <script type="text/html" id="operate">
-    <a class="layui-btn layui-btn-xs btn-edit" lay-event="detl" ew-event="popupRight"
-       data-type="1" data-window="top" data-area="1250px" data-url="sensor5/sensor_detl.html">
-        <i class="layui-icon">&#xe6b2;</i>鏌ョ湅</a>
-    <a class="layui-btn layui-btn-xs layui-btn-primary btn-edit" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>淇敼</a>
+    {{#if (d.anfme > d.qty){ }}
+        <a class="layui-btn layui-btn-xs layui-btn-danger btn-pakoutPreview" lay-event="pakoutPreview"><i class="layui-icon layui-icon-prev-circle"></i>鍑哄簱</a>
+    {{# } }}
 </script>
 
+<!-- 鍑哄簱棰勮 -->
+<div id="pakoutPreviewBox" style="display: none">
+    <div  style="padding: 25px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">
+        <span style="font-size: large; font-weight: bold">鍑哄簱棰勮</span>
+    </div>
+    <table id="stoPreTab" lay-filter="stoPreTab"></table>
+</div>
+
 <!-- 琛屾牱寮� -->
 <script type="text/html" id="orderNoTpl">
     <span name="orderNo" class="layui-badge layui-badge-gray">{{d.orderNo}}</span>

--
Gitblit v1.9.1