From 4ad58b3dbd72e7ca266318f24a203210da5b24d7 Mon Sep 17 00:00:00 2001
From: 懒羊羊 <15939171744@163.com>
Date: 星期二, 14 十一月 2023 15:36:39 +0800
Subject: [PATCH] 优化

---
 guns-vip-main/src/main/webapp/assets/modular/pm/workOrder/bulletBox/productListing.js                      |   18 +++++
 guns-vip-main/src/main/java/cn/stylefeng/guns/modular/zsx/pm/workOrder/controller/WorkOrderController.java |   11 +++
 guns-vip-main/src/main/webapp/assets/modular/pm/workOrder/workOrder_add.js                                 |   19 ++++++
 guns-vip-main/src/main/webapp/assets/modular/pm/workOrder/bulletBox/bomListing.js                          |   77 +++++++++++++++++++++++++
 guns-vip-main/src/main/webapp/pages/modular/pm/workOrder/bulletBox/bomListing.html                         |   35 +++++++++++
 5 files changed, 158 insertions(+), 2 deletions(-)

diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/zsx/pm/workOrder/controller/WorkOrderController.java b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/zsx/pm/workOrder/controller/WorkOrderController.java
index 712733e..8785ca5 100644
--- a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/zsx/pm/workOrder/controller/WorkOrderController.java
+++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/zsx/pm/workOrder/controller/WorkOrderController.java
@@ -74,6 +74,17 @@
     }
 
     /**
+     * BOM鍒楄〃椤甸潰
+     *
+     * @author ruimin
+     * @Date 2023-08-26
+     */
+    @RequestMapping("/bomListing")
+    public String bomListing() {
+        return PREFIX + "/bulletBox/bomListing.html";
+    }
+
+    /**
      * 鏂板鎺ュ彛
      *
      * @author ruimin
diff --git a/guns-vip-main/src/main/webapp/assets/modular/pm/workOrder/bulletBox/bomListing.js b/guns-vip-main/src/main/webapp/assets/modular/pm/workOrder/bulletBox/bomListing.js
new file mode 100644
index 0000000..0106b1f
--- /dev/null
+++ b/guns-vip-main/src/main/webapp/assets/modular/pm/workOrder/bulletBox/bomListing.js
@@ -0,0 +1,77 @@
+
+layui.use(['table'], function () {
+    var $ = layui.jquery;
+    var table = layui.table;
+
+    /**
+     * 鐗╂枡淇℃伅绠$悊
+     */
+    var MaterialInfo = {
+        tableId: "materialInfoTable"
+    };
+
+    var productCode = parent.productCode;
+
+    $('#serch').click(function(){
+        var queryData = {};
+        queryData['productCode'] = productCode;
+        queryData['bomCode'] = $("#bomCode").val();
+        queryData['bomName'] = $("#bomName").val();
+        table.reload(MaterialInfo.tableId, {
+            where: queryData, page: {curr: 1}
+        });
+    });
+    /**
+     * 缂烘枡鎶ヨ鍒濆鍖栬〃鏍肩殑鍒�
+     */
+    MaterialInfo.initColumn = function () {
+        return [[
+            {type: 'radio'},
+            {field: 'id', hide: true, title: '涓婚敭id'},
+            {field: 'bomCode', sort: true, title: 'BOM缂栫爜'},
+            {field: 'bomName', sort: true, title: 'BOM鍚嶇О'},
+            {field: 'productCode', sort: true, title: '浜у搧缂栫爜'},
+            {field: 'productName', sort: true, title: '浜у搧鍚嶇О'},
+        ]];
+    };
+
+    table =  $.extend(table, {config: {checkName: 'checked'}});
+
+    var queryData = {};
+    queryData['productCode'] = productCode;
+    var tableResult = table.render({
+        elem: '#' + MaterialInfo.tableId,
+        url: Feng.ctxPath + '/productBomInfo/list',
+        page: true,
+        where:queryData,
+        cellMinWidth: 80,
+        cols: MaterialInfo.initColumn()
+    });
+    let Msg='';
+    table.on('row(materialInfoTable)',function (data) {
+        Msg = data.data;
+    })
+    $('#btnSubmit').click(function(){
+        clearType();
+        if (Msg !=='' ){
+            // 鍒ゆ柇鏄惁鐐瑰嚮鐨勬槸纭畾
+            var index = parent.layer.getFrameIndex(window.name); //鍏堝緱鍒板綋鍓峣frame灞傜殑绱㈠紩
+            window.localStorage.setItem('message',JSON.stringify(Msg));
+            parent.layer.close(index);
+        }
+        else {
+            Feng.error("璇烽�夋嫨涓�鏉℃暟鎹�!")
+        }
+    });
+
+    $('#reset').click(function(){
+        clearType();
+        Msg = "";
+        window.localStorage.clear();
+    });
+
+    function clearType(){
+        parent.materialType="";
+    }
+
+});
\ No newline at end of file
diff --git a/guns-vip-main/src/main/webapp/assets/modular/pm/workOrder/bulletBox/productListing.js b/guns-vip-main/src/main/webapp/assets/modular/pm/workOrder/bulletBox/productListing.js
index bf447f7..1d62bc1 100644
--- a/guns-vip-main/src/main/webapp/assets/modular/pm/workOrder/bulletBox/productListing.js
+++ b/guns-vip-main/src/main/webapp/assets/modular/pm/workOrder/bulletBox/productListing.js
@@ -31,7 +31,23 @@
             {field: 'id', hide: true, title: '涓婚敭id'},
             {field: 'materialCode', sort: true, title: '浜у搧缂栧彿'},
             {field: 'materialName', sort: true, title: '浜у搧鍚嶇О'},
-            {field: 'typeL', sort: true, title: '绫诲瀷'},
+            {
+                field: 'typeL', align: "center", title: '绫诲瀷', templet: function (d) {
+                    console.log(d.typeL)
+                    switch(d.typeL){
+                        case "PRODUCE" :
+                            return "浜у搧";
+                            break;
+                        case "SEMIFINISHEDPRODUCTS" :
+                            return "鍗婃垚鍝�";
+                            break;
+                        case "COMPONENTSANDPARTS" :
+                            return "闆堕儴浠�";
+                            break;
+                        default :
+                    }
+                }
+            },
         ]];
     };
 
diff --git a/guns-vip-main/src/main/webapp/assets/modular/pm/workOrder/workOrder_add.js b/guns-vip-main/src/main/webapp/assets/modular/pm/workOrder/workOrder_add.js
index 44b1b9e..da6358a 100644
--- a/guns-vip-main/src/main/webapp/assets/modular/pm/workOrder/workOrder_add.js
+++ b/guns-vip-main/src/main/webapp/assets/modular/pm/workOrder/workOrder_add.js
@@ -104,7 +104,7 @@
         layer.open({
             type: 2,
             area: ['1000px', '600px'],
-            title: '鐗╂枡淇℃伅',
+            title: '浜у搧淇℃伅',
             content: Feng.ctxPath + '/workOrder/productListing',
             success: function (layero, index) {
                 window.materialType = 'PRODUCE';
@@ -117,6 +117,23 @@
         });
     });
 
+    $('#bomCode').click(function () {
+        layer.open({
+            type: 2,
+            area: ['1000px', '600px'],
+            title: 'BOM淇℃伅',
+            content: Feng.ctxPath + '/workOrder/bomListing',
+            success: function (layero, index) {
+                window.productCode = $('#productCode').val();
+            },
+            end: function () {
+                let msg = JSON.parse(window.localStorage.getItem('message'));
+                console.log(msg);
+                $('#bomCode').val(msg.bomCode);
+            }
+        });
+    });
+
     //琛ㄥ崟鎻愪氦浜嬩欢
     form.on('submit(btnSubmit)', function (data) {
         var ajax = new $ax(Feng.ctxPath + "/workOrder/addItem", function (data) {
diff --git a/guns-vip-main/src/main/webapp/pages/modular/pm/workOrder/bulletBox/bomListing.html b/guns-vip-main/src/main/webapp/pages/modular/pm/workOrder/bulletBox/bomListing.html
new file mode 100644
index 0000000..da6f20b
--- /dev/null
+++ b/guns-vip-main/src/main/webapp/pages/modular/pm/workOrder/bulletBox/bomListing.html
@@ -0,0 +1,35 @@
+@layout("/common/_form.html",{js:["/assets/modular/pm/workOrder/bulletBox/bomListing.js"]}){
+    <div class="layui-fluid" style="padding-bottom: 75px;">
+        <div class="layui-card">
+            <div class="layui-card-body">
+                <div class="layui-form-item layui-row">
+                    <input id= "id" name="id" type="hidden"/>
+                    <input id= "materialType" name="materialType" type="hidden"/>
+                    <div class="layui-inline layui-col-md4">
+                        <label class="layui-form-label">BOM缂栧彿<span style="color: red;">*</span></label>
+                        <div class="layui-input-block">
+                            <input id="bomCode" name="bomCode" placeholder="璇疯緭鍏ヤ骇鍝佺紪鍙�" type="text" class="layui-input"/>
+                        </div>
+                    </div>
+                    <div class="layui-inline layui-col-md4">
+                        <label class="layui-form-label">BOM鍚嶇О<span style="color: red;">*</span></label>
+                        <div class="layui-input-block">
+                            <input id="bomName" name="bomName" placeholder="璇疯緭鍏ョ墿鏂欏悕绉�" type="text" class="layui-input"/>
+                        </div>
+                    </div>
+                    <div class="layui-inline layui-col-md-offset3">
+                        <button class="layui-btn" id="serch">鎼滅储</button>
+                    </div>
+                </div>
+                <table class="layui-table" id="materialInfoTable" lay-filter="materialInfoTable"></table>
+            </div>
+        </div>
+    </div>
+
+<div class="form-group-bottom text-center">
+    <button class="layui-btn" id="btnSubmit">&emsp;鎻愪氦&emsp;</button>
+    <button type="reset" id="reset" class="layui-btn layui-btn-primary" ew-event="closeDialog">&emsp;鍏抽棴&emsp;</button>
+</div>
+
+
+@}
\ No newline at end of file

--
Gitblit v1.9.3