From d113e15bf1fb77152d0476b4340cc0b6ed24e63d Mon Sep 17 00:00:00 2001
From: 王佳豪 <g675230687@126.com>
Date: 星期五, 12 三月 2021 16:04:49 +0800
Subject: [PATCH] 1.0.3 新增pda平仓移库功能

---
 src/main/java/com/zy/asrs/service/impl/LocNormalServiceImpl.java |   10 ++
 src/main/webapp/views/pda/index.html                             |   27 +++-
 src/main/java/com/zy/asrs/controller/LocNormalController.java    |   23 ++++
 src/main/java/com/zy/asrs/mapper/LocNormalMapper.java            |    4 
 src/main/webapp/views/pda/locNormalMove.html                     |  181 ++++++++++++++++++++++++++++++++++++
 src/main/resources/mapper/LocNormalMapper.xml                    |   20 ++++
 src/main/webapp/views/pda/locNormalIn.html                       |    8 
 src/main/webapp/views/pda/locNormalOut.html                      |    9 +
 src/main/java/com/zy/asrs/service/LocNormalService.java          |    4 
 9 files changed, 272 insertions(+), 14 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/LocNormalController.java b/src/main/java/com/zy/asrs/controller/LocNormalController.java
index d2db347..096887f 100644
--- a/src/main/java/com/zy/asrs/controller/LocNormalController.java
+++ b/src/main/java/com/zy/asrs/controller/LocNormalController.java
@@ -186,4 +186,27 @@
         locNormalService.pdaLocNormalOut(list);
         return R.ok();
     }
+
+    @RequestMapping(value = "/locNormal/pda/warehouseQuery")
+    @ManagerAuth(memo = "pda鏍规嵁搴撳尯鏌ヨ鐗╂枡娓呭崟")
+    @Transactional
+    public R locNormalPdaWarehouseQuery(String warehouse, String matnr) {
+        List<LocNormal> list = locNormalService.pdaLocNormalWarehouseQuery(warehouse, matnr);
+        return R.ok(list);
+    }
+
+    @RequestMapping(value = "/locNormal/pda/move")
+    @ManagerAuth(memo = "pda绉诲簱")
+    @Transactional
+    public R LocNormalPdaMove(@RequestBody LocNormalParam param) {
+        Long userId = getUserId();
+        Date timeNow = new Date();
+        List<LocNormal> list = param.getNormalList();
+        for (Integer i = 0; i < list.size(); i++) {
+            list.get(i).setModiUser(userId);
+            list.get(i).setModiTime(timeNow);
+        }
+        locNormalService.pdaLocNormalMove(list);
+        return R.ok();
+    }
 }
diff --git a/src/main/java/com/zy/asrs/mapper/LocNormalMapper.java b/src/main/java/com/zy/asrs/mapper/LocNormalMapper.java
index bda3fd0..573a9f4 100644
--- a/src/main/java/com/zy/asrs/mapper/LocNormalMapper.java
+++ b/src/main/java/com/zy/asrs/mapper/LocNormalMapper.java
@@ -33,4 +33,8 @@
     public void pdaLocNormalOut1(@Param("id") Integer id,@Param("matnr") String matnr, @Param("modiUser") Long modiUser, @Param("modiTime") Date modiTime, @Param("warehouse") String warehouse);
 
     public void pdaLocNormalOut2(@Param("id") Integer id,@Param("matnr") String matnr,@Param("anfme") BigDecimal anfme, @Param("modiUser") Long modiUser, @Param("modiTime") Date modiTime, @Param("warehouse") String warehouse);
+
+    public List<LocNormal> pdaLocNormalWarehouseQuery(@Param("warehouse") String warehouse, @Param("matnr") String matnr);
+
+    public void pdaLocNormalMove(List<LocNormal> list);
 }
diff --git a/src/main/java/com/zy/asrs/service/LocNormalService.java b/src/main/java/com/zy/asrs/service/LocNormalService.java
index bde76fa..ef15103 100644
--- a/src/main/java/com/zy/asrs/service/LocNormalService.java
+++ b/src/main/java/com/zy/asrs/service/LocNormalService.java
@@ -24,4 +24,8 @@
   public List<LocNormal> pdaLocNormalQuery(String matnr, String warehouse);
 
   public void pdaLocNormalOut(List<LocNormal> list);
+
+  public List<LocNormal> pdaLocNormalWarehouseQuery(String warehouse, String matnr);
+
+  public void pdaLocNormalMove(List<LocNormal> list);
 }
diff --git a/src/main/java/com/zy/asrs/service/impl/LocNormalServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/LocNormalServiceImpl.java
index 1a27ccd..88eb0f6 100644
--- a/src/main/java/com/zy/asrs/service/impl/LocNormalServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/LocNormalServiceImpl.java
@@ -62,4 +62,14 @@
             }
         }
     }
+
+    @Override
+    public List<LocNormal> pdaLocNormalWarehouseQuery(String warehouse, String matnr) {
+        return baseMapper.pdaLocNormalWarehouseQuery(warehouse, matnr);
+    }
+
+    @Override
+    public void pdaLocNormalMove(List<LocNormal> list) {
+        baseMapper.pdaLocNormalMove(list);
+    }
 }
diff --git a/src/main/resources/mapper/LocNormalMapper.xml b/src/main/resources/mapper/LocNormalMapper.xml
index 6246f17..3a2faf0 100644
--- a/src/main/resources/mapper/LocNormalMapper.xml
+++ b/src/main/resources/mapper/LocNormalMapper.xml
@@ -83,4 +83,24 @@
         update asr_loc_normal set anfme = #{anfme, jdbcType=DECIMAL},modi_user = #{modiUser, jdbcType=DECIMAL},modi_time = #{modiTime, jdbcType=TIMESTAMP}
         where matnr = #{matnr,jdbcType=VARCHAR} and warehouse = #{warehouse,jdbcType=VARCHAR} and id = #{id,jdbcType=DECIMAL}
     </update>
+
+    <select id="pdaLocNormalWarehouseQuery" resultMap="BaseResultMap">
+        select id,matnr, maktx, warehouse from asr_loc_normal
+        where warehouse = #{warehouse, jdbcType=VARCHAR}
+        and state = '1'
+        <if test="matnr != ''">
+            and matnr = #{matnr, jdbcType=VARCHAR}
+        </if>
+        COLLATE Chinese_PRC_CS_AS
+    </select>
+
+    <update id="pdaLocNormalMove">
+        BEGIN
+        <foreach collection="list" item="item" index="index">
+            update asr_loc_normal set warehouse = #{item.warehouse,jdbcType=VARCHAR},
+            modi_user = #{item.modiUser, jdbcType=DECIMAL},modi_time = #{item.modiTime, jdbcType=TIMESTAMP}
+            where id = #{item.id,jdbcType=DECIMAL}
+        </foreach>
+        END;
+    </update>
 </mapper>
diff --git a/src/main/webapp/views/pda/index.html b/src/main/webapp/views/pda/index.html
index a2cfd52..2a2aa3b 100644
--- a/src/main/webapp/views/pda/index.html
+++ b/src/main/webapp/views/pda/index.html
@@ -77,6 +77,10 @@
         }
 
         td {
+            color: white;
+            background-image: linear-gradient(to top, #09203f 0%, #537895 100%);
+            /*background-color: rgba(204,204,204,.6);*/
+            border-radius: 8px;
             text-align: center;
             vertical-align: middle;
             height: 80px;
@@ -87,29 +91,34 @@
 <body>
 
 <!-- 瀵艰埅鑿滃崟 -->
-<table id="navList" style="width: 100%; border-color: #e6e6e6" border="1" cellspacing="1">
+<table id="navList" style="width: 100%; border-color: #e6e6e6" border="0" cellspacing="2">
     <tr>
         <td>
-            <a id="comb" onclick="nav(this.id)" class="nav-select" href="#">缁勬墭</a>
+            <div id="comb" onclick="nav(this.id)">缁勬墭</div>
         </td>
         <td>
-            <a id="combPro" onclick="nav(this.id)" class="nav-unselect" href="#">鍏宠仈缁勬墭</a>
+            <div id="combPro" onclick="nav(this.id)">鍏宠仈缁勬墭</div>
         </td>
     </tr>
     <tr>
         <td>
-            <a id="stockIn" onclick="nav(this.id)" class="nav-unselect" href="#">鍏ュ簱</a>
+            <div id="stockIn" onclick="nav(this.id)">鍏ュ簱</div>
         </td>
         <td>
-            <a id="stockOut" onclick="nav(this.id)" class="nav-unselect" href="#">鍑哄簱</a>
+            <div id="stockOut" onclick="nav(this.id)">鍑哄簱</div>
         </td>
     </tr>
     <tr>
         <td>
-            <a id="locNormalIn" onclick="nav(this.id)" class="nav-unselect" href="#">骞充粨鍏ュ簱</a>
+            <div id="locNormalIn" onclick="nav(this.id)">骞充粨鍏ュ簱</div>
         </td>
         <td>
-            <a id="locNormalOut" onclick="nav(this.id)" class="nav-unselect" href="#">骞充粨鍑哄簱</a>
+            <div id="locNormalOut" onclick="nav(this.id)">骞充粨鍑哄簱</div>
+        </td>
+    </tr>
+    <tr>
+        <td>
+            <div id="locNormalMove" onclick="nav(this.id)">骞充粨绉诲簱</div>
         </td>
     </tr>
 </table>
@@ -122,8 +131,8 @@
 <script>
     // 瀵艰埅鏍�
     function nav(id) {
-        $('.nav-select').attr("class", "nav-unselect");
-        $('#' + id).attr("class", "nav-select");
+//        $('.nav-select').attr("class", "nav-unselect");
+//        $('#' + id).attr("class", "nav-select");
         $('#content').attr("src", id + ".html");
         $('#navList').css('display', 'none');
         $('#content').css('display', 'block');
diff --git a/src/main/webapp/views/pda/locNormalIn.html b/src/main/webapp/views/pda/locNormalIn.html
index 0a07ed3..f91e840 100644
--- a/src/main/webapp/views/pda/locNormalIn.html
+++ b/src/main/webapp/views/pda/locNormalIn.html
@@ -20,7 +20,7 @@
 <header>
     <div>
         <div class="layui-input-inline">
-            <label class="layui-form-label">搴�&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;鍖�</label>
+            <label class="layui-form-label">搴撳尯</label>
             <input class="layui-input" type="number" id="warehouse" onkeyup="findCode(this)" placeholder="鎵爜 / 杈撳叆"
                    autocomplete="off">
         </div>
@@ -128,7 +128,7 @@
 
     // 閲嶇疆
     function reset() {
-        $('#code').val("");
+        $('#warehouse').val("");
         matData = [];
         tableIns.reload({data: matData});
     }
@@ -202,8 +202,8 @@
             $("#comb-btn").focus();
             comb();
         } else if (key === 113) {
-            $("#code").val("");
-            $("#code").focus();
+            $("#warehouse").val("");
+            $("#warehouse").focus();
         }
     }
 
diff --git a/src/main/webapp/views/pda/locNormalMove.html b/src/main/webapp/views/pda/locNormalMove.html
new file mode 100644
index 0000000..0f7d878
--- /dev/null
+++ b/src/main/webapp/views/pda/locNormalMove.html
@@ -0,0 +1,181 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>骞充粨绉诲簱</title>
+    <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all">
+    <link rel="stylesheet" href="../../static/css/pda.css" media="all">
+    <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
+    <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script>
+    <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
+    <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script>
+    <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script>
+</head>
+<body>
+<!-- 澶撮儴 -->
+<header>
+    <div>
+        <div class="layui-input-inline">
+            <label class="layui-form-label">鐗╂枡缂栫爜</label>
+            <input class="layui-input" id="matnr" onkeyup="find()" placeholder="鎵爜 / 杈撳叆"
+                   autocomplete="off" style="width: 60%">
+        </div>
+    </div>
+    <div>
+        <div class="layui-input-inline">
+            <label class="layui-form-label" style="margin-left: 16px">婧愬簱鍖�</label>
+            <input class="layui-input" type="number" id="warehouse1" onkeyup="find()" placeholder="鎵爜 / 杈撳叆"
+                   autocomplete="off" style="width: 60%">
+        </div>
+    </div>
+    <div>
+        <div class="layui-input-inline">
+            <label class="layui-form-label">鐩爣搴撳尯</label>
+            <input class="layui-input" type="number" id="warehouse2" placeholder="鎵爜 / 杈撳叆"
+                   autocomplete="off" style="width: 60%">
+        </div>
+    </div>
+</header>
+
+<!-- 涓讳綋 -->
+<main>
+    <table class="layui-table" id="locNormalMove" lay-filter="locNormalMove"></table>
+</main>
+
+<!-- 灏鹃儴 -->
+<footer>
+    <div class="layui-btn-container">
+        <button type="button" id="reset-btn" class="layui-btn layui-btn-primary" onclick="reset()">閲嶇疆</button>
+        <button type="button" id="comb-btn" class="layui-btn layui-btn-normal " onclick="move()"
+                style="margin-left: 20px">杞Щ
+        </button>
+        <button type="button" id="retrun-btn" class="layui-btn layui-btn-primary " onclick="back()"
+                style="margin-left: 20px">杩斿洖
+        </button>
+        <span id="tips"></span>
+    </div>
+</footer>
+
+</body>
+<script>
+    var tableIns;
+    layui.use(['table', 'laydate', 'form'], function () {
+        var table = layui.table;
+        var $ = layui.jquery;
+        var layer = layui.layer;
+        var form = layui.form;
+
+        tableIns = table.render({
+            id: 'locNormalMove',
+            elem: '#locNormalMove',
+            data: [],
+            limit: 500,
+            cellMinWidth: 50,
+            cols: [[
+                {type: 'checkbox', fixed: 'left', width: 30},
+                {field: 'matnr', align: 'center', title: '缂栫爜', event: 'detail', width: 80},
+                {field: 'maktx', align: 'center', title: '鍚嶇О', event: 'detail'},
+                {field: 'warehouse', align: 'center', title: '搴撳尯', event: 'detail', width: 50}
+            ]],
+            done: function (res, curr, count) {
+            }
+        });
+    });
+
+    /* 搴撳瓨杞Щ */
+    move = () => {
+        // 鍒ゆ柇鐩爣搴撳尯鏄惁涓虹┖
+        var warehouse1 = $("#warehouse1").val();
+        var warehouse2 = $("#warehouse2").val();
+        if (!warehouse2 || warehouse2 == '') {
+            layer.msg("璇风‘瀹氱洰鏍囧簱鍖�");
+            return;
+        }
+        if (warehouse1 == warehouse2) {
+            layer.msg("鐩爣搴撳尯鍜屾簮搴撳尯涓�鑷�");
+            return;
+        }
+        // 鍒ゆ柇鍕鹃�夋暟鎹槸鍚︿负绌�
+        var table = layui.table;
+        var checkStatus = table.checkStatus('locNormalMove');
+        var data = checkStatus.data;
+        if (data.length == 0) {
+            layer.msg("璇烽�夋嫨鐗╂枡");
+            return;
+        }
+        // 澶勭悊鍕鹃�夋暟鎹慨鏀箇arehouse涓虹洰鏍囧簱鍖�
+        data.map(function (item) {
+            item.warehouse = warehouse2;
+        });
+        // 璇锋眰绉诲簱鎺ュ彛锛岄�変腑鐨勭墿鏂欑殑warehouse鏇存柊涓虹洰鏍囧簱鍖�
+        $.ajax({
+            url: baseUrl + "/locNormal/pda/move",
+            headers: {'token': localStorage.getItem('token')},
+            data: JSON.stringify({
+                normalList: data,
+            }),
+            contentType: 'application/json;charset=UTF-8',
+            method: 'POST',
+            async: false,
+            success: function (res) {
+                if (res.code === 200) {
+                    tips("绉诲簱鎴愬姛")
+                    reset();
+                } else if (res.code === 403) {
+                    top.location.href = baseUrl + "/pda";
+                } else {
+                    tips(res.msg, true)
+                }
+            },
+        });
+    }
+
+    /* 鏍规嵁搴撳尯鍙锋绱㈢墿鏂欎俊鎭� */
+    find = () => {
+        var warehouse = $("#warehouse1").val();
+        var matnr = $("#matnr").val();
+        // 鏌ヨ鎺ュ彛
+        $.ajax({
+            url: baseUrl + "/locNormal/pda/warehouseQuery?warehouse=" + warehouse + "&matnr=" + matnr,
+            headers: {'token': localStorage.getItem('token')},
+            method: 'GET',
+            async: false,
+            success: function (res) {
+                if (res.code === 200) {
+                    tableIns.reload({
+                        data: res.data,
+                    })
+                } else if (res.code === 403) {
+                    top.location.href = baseUrl + "/pda";
+                } else {
+                    tips(res.msg, true)
+                }
+            },
+        });
+    }
+
+    window.onload = function () {
+        document.getElementById("matnr").focus();
+    }
+
+    function back() {
+        parent.backIndex();
+    }
+
+    /**
+     * 鎻愮ず淇℃伅
+     * @param msg 鎻愮ず鍐呭
+     * @param warn true锛氱孩鑹插瓧浣�
+     */
+    function tips(msg, warn) {
+        layer.msg(msg, {icon: warn?2:1})
+    }
+
+    function reset() {
+        $('#warehouse1').val("");
+        $('#warehouse2').val("");
+        $('#matnr').val("");
+        tableIns.reload({data: []});
+    }
+</script>
+</html>
\ No newline at end of file
diff --git a/src/main/webapp/views/pda/locNormalOut.html b/src/main/webapp/views/pda/locNormalOut.html
index fe564c9..31cce18 100644
--- a/src/main/webapp/views/pda/locNormalOut.html
+++ b/src/main/webapp/views/pda/locNormalOut.html
@@ -46,7 +46,7 @@
 <header>
     <div>
         <div class="layui-input-inline">
-            <label class="layui-form-label">搴�&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;鍖�</label>
+            <label class="layui-form-label" style="margin-left: 32px">搴撳尯</label>
             <input class="layui-input" type="number" id="warehouse" onkeyup="findCode(this, 'warehouse')" placeholder="鎵爜 / 杈撳叆"
                    autocomplete="off">
         </div>
@@ -312,5 +312,12 @@
             },
         });
     }
+
+    function reset() {
+        $("#warehouse").val(null);
+        $("#matnr").val(null);
+        normalOutList = [];
+        tableIns.reload({data: normalOutList});
+    }
 </script>
 </html>
\ No newline at end of file

--
Gitblit v1.9.1