#
mrzhssss
2022-04-26 d17c089f1d7ff3be848b05161917346e7f664a1d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<!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/admin.css?v=318" media="all">
    <link rel="stylesheet" href="../../static/css/cool.css" media="all">
    <link rel="stylesheet" href="../../static/css/common.css" media="all">
    <style>
        body {
            padding: 0 20px;
        }
 
        .layui-table-box {
            border-right: 1px solid #9F9F9F;
            border-left: 1px solid #9F9F9F;
        }
 
        #search-box {
            padding: 30px 0 20px 0;
        }
 
        #search-box .layui-inline:first-child {
            margin-left: 30px;
        }
 
        #search-box .layui-inline {
            margin-right: 5px;
        }
 
        #data-search-btn {
            margin-left: 10px;
            display: inline-block;
        }
 
        #data-search-btn.layui-btn-container .layui-btn {
            margin-right: 20px;
        }
        .red{
            color: #CF1900;
        }
        .blue{
            color: #0c64eb;
        }
    </style>
</head>
<body>
 
 
<fieldset class="layui-elem-field" style="margin-top: 10px">
    <legend>搜索</legend>
    <div class="layui-row" style="padding-top: 10px; padding-left: 10px">
        <div class="layui-col-md5">
            <form class="layui-form toolbar">
                <div class="layui-form-item">
                    <div class="layui-inline" >
                        <input id="waveNo$" name="waveNo$" class="layui-input" placeholder="输入波次号"/>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn icon-btn" lay-filter="wavaBackResearch" lay-submit>
                            <i class="layui-icon">&#xe615;</i>搜索
                        </button>
                        <button class="layui-btn icon-btn" lay-filter="reset" lay-submit>
                            <i class="layui-icon">&#xe666;</i>重置
                        </button>
                    </div>
                </div>
 
            </form>
            <div class="layui-inline">
                <input id="backOrderOne" class="layui-input" placeholder="请输入播种物料号"/>
            </div>
            <div class="layui-inline">
                <button class="layui-btn icon-btn" id="once">
                    <i class="layui-icon">&#xe657;</i>播种一次
                </button>
            </div>
            <div class="layui-inline">
                <button class="layui-btn icon-btn" id="submit" >
                    <i class="layui-icon">&#xe657;</i>提交
                </button>
            </div>
        </div>
 
        <div class="layui-col-md6">
            <div class="layui-card">
                <div class="layui-card-header" id="cardTitile">使用说明</div>
                <div class="layui-card-body" id="cardBody">
                    首先搜索波次号,然后输入需要播种的物料ID(每次播种一个)<br>
                </div>
            </div>
        </div>
 
 
    </div>
</fieldset>
<div class="layui-form">
    <table id="showWave" lay-filter="showWave"></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>
 
 
</body>
<script>
    var pageCurr;
    var allRecord = [];
 
    layui.use(['table', 'laydate', 'form', 'util'], function () {
        var table = layui.table;
        var $ = layui.jquery;
        var layer = layui.layer;
        var layDate = layui.laydate;
        var form = layui.form;
        var util = layui.util;
        var insTb = table.render({
            elem: '#showWave',
            url: baseUrl + '/order/orderByWave/auth',
            height: 'full-100',
            limit: 15,
            limits: [15, 30, 50, 100, 200, 500],
            page: true,
            headers: {token: localStorage.getItem('token')},
            request: {
                pageName: 'curr',
                pageSize: 'limit'
            },
 
            parseData: function (res) {
                if (allRecord.length === 0) {
                    allRecord = res.data.records;
                }
 
 
                return {
                    'code': res.code,
                    'msg': res.msg,
                    'count': res.data.total,
                    'data': allRecord
                }
            },
            response: {
                statusCode: 200
            },
 
            defaultToolbar: [],
            cols: [[
                {field: 'waveNo$', title: '波次号', minWidth: 175}
                , {field: 'orderNo', align: 'center', title: '单据编号'}
                , {field: 'matnr', align: 'center', title: '物料ID' , minWidth: 175}
                , {field: 'maktx', align: 'center', title: '物料名称'}
                , {field: 'anfme', align: 'center', title: '应出库量', minWidth: 50}
                , {field: 'outQty', align: 'center', title: '已出库量', minWidth: 50}
 
            ]]
        });
        $('#once').click(function () {
 
            var matNo = $('input[id="backOrderOne"]').val();
            for (let i = 0; i < allRecord.length; i++) {
                if (matNo === allRecord[i].matnr) {
                    if (allRecord[i].anfme > allRecord[i].outQty){
                        allRecord[i].outQty = allRecord[i].outQty + 1
                        break;
                    }
                }
            }
            insTb.reload({
                page: {curr: 1}
            })
        });
 
        $('#submit').click(function (data) {
            layer.confirm('[重要]确定提交吗?',{
                skin: 'layui-layer-admin',
                shade: .1
            },function (data) {
 
                $.ajax({
                    url: baseUrl+"/order/waveBack",
 
                    header:{'token': localStorage.getItem('token')},
                    contentType:'application/json;charset=UTF-8',
                    data:JSON.stringify({
                        orderDetls: allRecord
                    }),
                    // data:{
                    //     orders: allRecord
                    // },
 
                    method: 'POST',
                    success: function (res) {
                        layer.msg(res.msg, {icon: 1})
                    }
                });
            });
        });
        form.on('submit(wavaBackResearch)', function (data) {
            var newRecord = [];
            if (data.field.waveNo$ === "") {
                allRecord.length = 0;
 
            } else {
                for (let i = 0; i < allRecord.length; i++) {
                    let record = allRecord[i];
                    if (record.waveNo$ === data.field.waveNo$) {
                        newRecord.push(record);
                    }
                }
                allRecord = newRecord;
            }
            insTb.reload({
                page: {curr: 1}
 
            });
            return false;
        });
        form.on('submit(reset)', function (data) {
            $('#waveNo$').val = "";
            allRecord.length = 0;
            insTb.reload({
                page: {curr: 1}
            });
            return false;
        });
    });
</script>
</html>