From f6e0107233bd7fc000b77b3cc9164c5c00b16448 Mon Sep 17 00:00:00 2001
From: 王佳豪 <g675230687@126.com>
Date: 星期三, 10 三月 2021 11:19:56 +0800
Subject: [PATCH] 1.0.5 1.增加平仓入库功能 2.优化平仓管理出入库状态查询功能
---
src/main/java/com/zy/asrs/service/impl/LocNormalServiceImpl.java | 5
src/main/java/com/zy/asrs/controller/LocNormalController.java | 19 ++
src/main/java/com/zy/asrs/mapper/LocNormalMapper.java | 2
src/main/resources/mapper/LocNormalMapper.xml | 14 +
src/main/webapp/static/js/locNormal/locNormalIn.js | 248 +++++++++++++++++++++++++++++++
src/main/webapp/views/locNormal/locNormal.html | 15 +
src/main/java/com/zy/asrs/service/LocNormalService.java | 2
src/main/webapp/views/locNormal/locNormalIn.html | 129 ++++++++++++++++
8 files changed, 430 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/LocNormalController.java b/src/main/java/com/zy/asrs/controller/LocNormalController.java
index 275454e..14353d6 100644
--- a/src/main/java/com/zy/asrs/controller/LocNormalController.java
+++ b/src/main/java/com/zy/asrs/controller/LocNormalController.java
@@ -53,7 +53,9 @@
if (!Cools.isEmpty(orderByField)) {
wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
}
- wrapper.eq("state", "1").or().eq("state", "2");
+ if (Cools.isEmpty(param.get("state"))) {
+ wrapper.eq("state", "1").or().eq("state", "2");
+ }
return R.ok(locNormalService.selectPage(new Page<>(curr, limit), wrapper));
}
@@ -142,4 +144,19 @@
locNormalService.pdaLocNormalIn(param.getNormalList());
return R.ok();
}
+
+ /* 骞充粨鍏ュ簱 */
+ @RequestMapping(value = "/locNormal/in")
+ @ManagerAuth(memo = "骞充粨鍏ュ簱")
+ @Transactional
+ public R locNormalIn(@RequestBody LocNormalParam param) {
+ Long userId = getUserId();
+ Date timeNow = new Date();
+ for (Integer i = 0; i < param.getNormalList().size(); i++) {
+ param.getNormalList().get(i).setAppeUser(userId);
+ param.getNormalList().get(i).setAppeTime(timeNow);
+ }
+ locNormalService.locNormalIn(param.getNormalList());
+ 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 0e808c1..7da997d 100644
--- a/src/main/java/com/zy/asrs/mapper/LocNormalMapper.java
+++ b/src/main/java/com/zy/asrs/mapper/LocNormalMapper.java
@@ -25,4 +25,6 @@
public void removeLocNormal(@Param("matnr") String matnr, @Param("modiUser") Long modiUser, @Param("modiTime") Date modiTime);
public void pdaLocNormalIn(List<LocNormal> list);
+
+ public void locNormalIn(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 507f32e..63799c0 100644
--- a/src/main/java/com/zy/asrs/service/LocNormalService.java
+++ b/src/main/java/com/zy/asrs/service/LocNormalService.java
@@ -17,4 +17,6 @@
public void removeLocNormal(String matnr, Long modiUser, Date modiTime);
public void pdaLocNormalIn(List<LocNormal> list);
+
+ public void locNormalIn(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 5c8e190..1bc6ece 100644
--- a/src/main/java/com/zy/asrs/service/impl/LocNormalServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/LocNormalServiceImpl.java
@@ -39,4 +39,9 @@
public void pdaLocNormalIn(List<LocNormal> list) {
baseMapper.pdaLocNormalIn(list);
}
+
+ @Override
+ public void locNormalIn(List<LocNormal> list) {
+ baseMapper.locNormalIn(list);
+ }
}
diff --git a/src/main/resources/mapper/LocNormalMapper.xml b/src/main/resources/mapper/LocNormalMapper.xml
index 8d8f254..a9f41e8 100644
--- a/src/main/resources/mapper/LocNormalMapper.xml
+++ b/src/main/resources/mapper/LocNormalMapper.xml
@@ -54,4 +54,18 @@
</foreach>
END;
</insert>
+
+ <insert id="locNormalIn">
+ BEGIN
+ <foreach collection="list" item="item" index="index">
+ INSERT INTO asr_loc_normal (matnr, maktx, anfme, altme, lgnum, type, supplier, brand, warehouse, state,
+ appe_user, appe_time)
+ VALUES (#{item.matnr,jdbcType=VARCHAR}, #{item.maktx,jdbcType=VARCHAR}, #{item.anfme,jdbcType=DECIMAL},
+ #{item.altme,jdbcType=VARCHAR},#{item.lgnum, jdbcType=VARCHAR}, #{item.type, jdbcType=VARCHAR},
+ #{item.supplier, jdbcType=VARCHAR},#{item.brand, jdbcType=VARCHAR},
+ #{item.warehouse,jdbcType=VARCHAR}, '1', #{item.appeUser,jdbcType=DECIMAL},
+ #{item.appeTime,jdbcType=TIMESTAMP})
+ </foreach>
+ END;
+ </insert>
</mapper>
diff --git a/src/main/webapp/static/js/locNormal/locNormalIn.js b/src/main/webapp/static/js/locNormal/locNormalIn.js
new file mode 100644
index 0000000..2d3931f
--- /dev/null
+++ b/src/main/webapp/static/js/locNormal/locNormalIn.js
@@ -0,0 +1,248 @@
+var initCountVal = 0;
+var matCodeData = [];
+var index = 0;
+
+function getCol() {
+ var cols = [
+ // {type: 'checkbox', fixed: 'left'},
+ {
+ fixed: 'left',
+ field: 'anfme',
+ title: '鏁伴噺(蹇呭~)',
+ align: 'center',
+ edit: 'text',
+ width: 120,
+ style: 'color: blue;font-weight: bold'
+ }
+ ];
+ locNormalCols.map(function (item) {
+ if (item.field === 'supplier') {
+ item.edit = 'text';
+ }
+ })
+ cols.push.apply(cols, locNormalCols);
+ // cols.push({field: 'matStatus', title: '鐗╂枡鐘舵��', align: 'center', width: 120, templet: '#matStatus'});
+ cols.push({fixed: 'right', title: '鎿嶄綔', align: 'center', toolbar: '#operate', width: 80});
+ return cols;
+}
+
+layui.use(['table', 'laydate', 'form'], function () {
+ var table = layui.table;
+ var $ = layui.jquery;
+ var layer = layui.layer;
+ var layDate = layui.laydate;
+ var form = layui.form;
+
+ tableIns = table.render({
+ elem: '#chooseData',
+ data: [],
+ even: true,
+ limit: 500,
+ cellMinWidth: 50,
+ toolbar: '#toolbar',
+ cols: [getCol()],
+ done: function (res, curr, count) {
+ $('td[data-field=count] div').html(initCountVal);
+ setMatCodeData(res.data);
+ limit();
+ getInBound();
+ }
+ });
+
+ // 椤甸潰淇敼
+ table.on('edit(chooseData)', function (obj) {
+ if (obj.field === 'anfme') {
+ updateMatCodeData(obj.data.matnr, Number(obj.value), obj.data.index);
+ }
+ });
+
+ // 鐩戝惉澶村伐鍏锋爮浜嬩欢
+ table.on('toolbar(chooseData)', function (obj) {
+ var checkStatus = table.checkStatus(obj.config.id);
+ var data = checkStatus.data;
+ switch (obj.event) {
+ case 'comb':
+ // 鍒ゆ柇鏄惁瀛樺湪鐗╂枡
+ if (matCodeData.length === 0) {
+ layer.msg("璇峰厛娣诲姞鐗╂枡");
+ return;
+ }
+ // 鍒ゆ柇鐗╂枡鏁伴噺鏄惁瀛樺湪寮傚父
+ for (var i = 0; i < matCodeData.length; i++) {
+ if (isNaN(matCodeData[i].anfme)) {
+ layer.msg("璇疯緭鍏ユ暟瀛�");
+ return;
+ }
+ if (matCodeData[i].anfme === 0) {
+ layer.msg("鏁伴噺涓嶈兘涓洪浂");
+ return;
+ }
+ }
+ // 鍒ゆ柇搴撳尯鏄惁涓虹┖
+ var warehouse = $('#putSiteSelect').val();
+ if (!warehouse || warehouse === '') {
+ layer.msg("璇烽�夋嫨搴撳尯");
+ return;
+ }
+ // 鍏ュ簱鏁版嵁璧嬪�煎簱鍖�
+ matCodeData.map(function (item) {
+ item.warehouse = warehouse;
+ });
+ // 璇锋眰鎺ュ彛杩涜骞充粨鍏ュ簱
+ $.ajax({
+ url: baseUrl + "/locNormal/in",
+ headers: {'token': localStorage.getItem('token')},
+ data: JSON.stringify({
+ normalList: matCodeData,
+ }),
+ contentType: 'application/json;charset=UTF-8',
+ method: 'POST',
+ async: false,
+ success: function (res) {
+ if (res.code === 200) {
+ layer.msg("鍏ュ簱鍚姩鎴愬姛");
+ matCodeData = [];
+ tableIns.reload({
+ data: matCodeData, done: function (res) {
+ limit();
+ getInBound();
+ }
+ });
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/";
+ } else {
+ layer.msg(res.msg)
+ }
+ }
+ })
+ break;
+ }
+ });
+
+ // 鐩戝惉琛屽伐鍏蜂簨浠�
+ table.on('tool(chooseData)', function (obj) {
+ var data = obj.data;
+ switch (obj.event) {
+ case 'remove':
+ for (var i = matCodeData.length - 1; i >= 0; i--) {
+ if (matCodeData[i].matnr === data.matnr && matCodeData[i].index === data.index) {
+ matCodeData.splice(i, 1);
+ }
+ }
+ tableIns.reload({
+ data: matCodeData,
+ });
+ break;
+ }
+ });
+
+ function setMatCodeData(data) {
+ matCodeData = data;
+ for (var i = 0; i < matCodeData.length; i++) {
+ matCodeData[i]["count"] = initCountVal;
+ }
+ }
+
+ function updateMatCodeData(matnr, count, index) {
+ if (isNaN(count)) {
+ layer.msg("璇疯緭鍏ユ暟瀛�");
+ } else {
+ if (count > 0) {
+ for (var i = 0; i < matCodeData.length; i++) {
+ if (matCodeData[i]["matnr"] === matnr && matCodeData[i]["index"] === index) {
+ matCodeData[i]["anfme"] = count;
+ }
+ }
+ } else {
+ layer.msg("鏁伴噺蹇呴』澶т簬闆�");
+ }
+ }
+
+ tableIns.reload({
+ data: matCodeData,
+ });
+ }
+
+ // 鑾峰彇鍙敤鍏ュ簱绔欑偣
+ function getInBound() {
+ // 鑾峰彇浠撳簱涓嬫媺
+ $.ajax({
+ url: baseUrl + "/locArea/queryAll/auth",
+ headers: {'token': localStorage.getItem('token')},
+ method: 'POST',
+ success: function (res) {
+ if (res.code === 200) {
+ var html = "";
+ if (res.data && res.data.length > 0) {
+ html += res.data.map(function (item) {
+ return "<Option value=" + item.id + ">" + item.name + "</Option>";
+ });
+ }
+ $('#putSiteSelect').append(html);
+ form.render('select');
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/";
+ } else {
+ layer.msg(res.msg)
+ }
+ }
+ })
+ }
+
+
+});
+
+// 鎻愬彇鐗╂枡
+var matCodeLayerIdx;
+function getMat() {
+ matCodeLayerIdx = layer.open({
+ type: 2,
+ title: '鎻愬彇鐗╂枡',
+ maxmin: true,
+ area: [top.detailWidth, top.detailHeight],
+ shadeClose: true,
+ content: '../pakStore/matQuery.html',
+ success: function (layero, index) {
+ }
+ });
+}
+
+// 娣诲姞琛ㄦ牸鏁版嵁
+function addTableData(data) {
+ // 鏁版嵁鏍煎紡杞崲
+ var newData = [];
+ data.map(function (item) {
+ newData.push({
+ matnr: item.matNo,
+ maktx: item.matName,
+ lgnum: item.str3,
+ type: item.str2,
+ supplier: item.str6,
+ warehouse: item.str7,
+ brand: item.str8,
+ altme: item.str1,
+ state: 1, // 鍏ュ簱鐘舵��
+ anfme: 0,
+ index: index,
+ });
+ });
+ index++;
+
+ for (var i = 0; i < newData.length; i++) {
+ let pass = false;
+ for (var j = 0; j < matCodeData.length; j++) {
+ if (newData[i].matnr === matCodeData[j].matNo) {
+ pass = true;
+ break;
+ }
+ }
+ if (pass) {
+ newData.splice(i--, 1);
+ } else {
+ newData[i]["count"] = initCountVal;
+ }
+ }
+ matCodeData.push.apply(matCodeData, newData);
+ tableIns.reload({data: matCodeData});
+ layer.close(matCodeLayerIdx);
+}
\ No newline at end of file
diff --git a/src/main/webapp/views/locNormal/locNormal.html b/src/main/webapp/views/locNormal/locNormal.html
index 5ee4626..83b0570 100644
--- a/src/main/webapp/views/locNormal/locNormal.html
+++ b/src/main/webapp/views/locNormal/locNormal.html
@@ -111,9 +111,9 @@
</div>
<!-- 鍔熻兘鍖� -->
- <div class="function-area">
- <button id="mat-query" class="function-btn" onclick="addLocNormal()">鏂板搴撳瓨</button>
- </div>
+ <!--<div class="function-area">-->
+ <!--<button id="mat-query" class="function-btn" onclick="addLocNormal()">鏂板搴撳瓨</button>-->
+ <!--</div>-->
<!-- 琛ㄦ牸 -->
@@ -153,6 +153,15 @@
{{# } else { }}
{{# } }}
</script>
+ <script type="text/html" id="locArea">
+ {{
+ locArea.map(function(item){
+ if (d.warehouse == item.id) {
+ return item.name;
+ }
+ });
+ }}
+ </script>
<script type="text/html" id="operate">
<button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="outLocNormal">鍑哄簱</button>
<button class="layui-btn layui-btn-xs layui-btn-danger" lay-event="removeLocNormal">绉婚櫎</button>
diff --git a/src/main/webapp/views/locNormal/locNormalIn.html b/src/main/webapp/views/locNormal/locNormalIn.html
new file mode 100644
index 0000000..15ace2d
--- /dev/null
+++ b/src/main/webapp/views/locNormal/locNormalIn.html
@@ -0,0 +1,129 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title></title>
+ <meta name="renderer" content="webkit">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+ <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all">
+ <link rel="stylesheet" href="../../static/css/cool.css" media="all">
+ <link rel="stylesheet" href="../../static/css/common.css" media="all">
+ <style>
+ html {
+ height: 100%;
+ padding: 10px;
+ background-color: #f1f1f1;
+ }
+ body {
+ background-color: #fff;
+ border-radius: 5px;
+ box-shadow: 0 0 3px rgba(0,0,0,.3);
+ }
+
+ .function-area {
+ padding: 20px 50px;
+ }
+ .function-btn {
+ font-size: 16px;
+ padding: 1px 1px 1px 1px;
+ width: 100px;
+ height: 50px;
+ border-color: #2b425b;
+ border-radius: 4px;
+ border-width: 2px;
+ background: none;
+ border-style: solid;
+ transition: 0.4s;
+ cursor: pointer;
+ letter-spacing: 3px;
+ }
+ .function-btn:hover {
+ background-color: #2b425b;
+ color: #fff;
+ }
+
+ .layui-layer-page .layui-layer-content {
+ position: relative;
+ overflow: visible !important;
+ }
+
+ #staNoSpan {
+ text-align: center;
+ display: inline-block;
+ width: 100px;
+ font-size: 13px;
+ }
+ .layui-btn-container .layui-form-select {
+ display: inline-block;
+ width: 150px;
+ height: 30px;
+ }
+ .layui-btn-container .layui-form-select.layui-form-selected {
+ display: inline-block;
+ width: 150px;
+ }
+ .layui-btn-container .layui-select-title input {
+ font-size: 13px;
+ }
+ .layui-btn-container .layui-anim.layui-anim-upbit dd {
+ font-size: 13px;
+ }
+
+ #btn-locIn {
+ margin-left: 60px;
+ }
+ </style>
+</head>
+<body>
+<!-- 鍔熻兘鍖� -->
+<div class="function-area">
+ <button id="mat-query" class="function-btn" onclick="getMat()">鏂板</button>
+</div>
+
+<hr>
+
+<!-- 琛ㄦ牸 -->
+<div style="padding-bottom: 5px; margin-bottom: 45px">
+
+ <!-- 澶撮儴 -->
+ <script type="text/html" id="toolbar">
+ <div class="layui-form">
+ <div class="layui-btn-container" style="margin-bottom: 8px">
+ <!-- 1.閫夋嫨鍏ュ簱鍙� -->
+ <span id="staNoSpan">搴撳尯锛�</span>
+ <select id="putSiteSelect" lay-verify="required">
+ <option value="">璇烽�夋嫨绔欑偣</option>
+ </select>
+ <!-- 2.鍚姩鍑哄簱 -->
+ <button class="layui-btn layui-btn-normal layui-btn-lg" id="btn-locIn" lay-event="comb">鍚姩鍏ュ簱</button>
+ </div>
+ </div>
+ </script>
+
+ <!-- 琛� -->
+ <script type="text/html" id="operate">
+ <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="remove">绉婚櫎</a>
+ </script>
+
+ <table class="layui-table" id="chooseData" lay-filter="chooseData"></table>
+</div>
+
+<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>
+<script type="text/javascript" src="../../static/js/locNormal/locNormalIn.js" charset="utf-8"></script>
+
+<script type="text/template" id="putSiteSelectTemplate">
+ {{#each data}}
+ <option value="{{this}}">{{this}}</option>
+ {{/each}}
+</script>
+<script type="text/html" id="matStatus">
+ {{ d.matStatus == '1' ? '<span style="color: green">鑹搧</span>' : '<span style="color: red">涓嶈壇鍝�</span>' }}
+</script>
+</body>
+</html>
+
--
Gitblit v1.9.1