Blame view

src/main/resources/templates/inventory/cycleCountDetail/add.html 12.9 KB
周鸿 authored
1
2
3
4
5
6
7
8
9
10
11
<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head>
    <th:block th:include="include :: header"/>
    <th:block th:include="include :: select2-css"/>
</head>
<body class="white-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 select-info">
pengyongcheng authored
12
            <form id="inventory-add-form">
周鸿 authored
13
14
                <div class="select-list">
                    <ul>
pengyongcheng authored
15
                        <li>
16
                            <label>物料编码:</label>
pengyongcheng authored
17
18
                            <!--                            <select id="materialCode" name="materialCode"></select>-->
                            <input id="materialCode" name="materialCode" placeholder="请输入物料编码" type="text"/>
周鸿 authored
19
20
21
22
23
24
                        </li>
                        <li>
                            <input type="hidden" id="cycleCountHeadCode" name="cycleCountHeadCode"
                                   th:value="${cycleCountHeadCode}" readonly="readonly"/>
                        </li>
                        <li>
25
                            <label>库位编码:</label>
pengyongcheng authored
26
                            <input id="locationCode" name="locationCode" placeholder="请输入库位编码" type="text"/>
周鸿 authored
27
28
                        </li>
                        <li>
29
                            <label>载具编码:</label>
pengyongcheng authored
30
31
32
33
34
                            <input id="containerCode" name="containerCode" placeholder="请输入载具编码" type="text"/>
                        </li>
                        <li>
                            <label>盛具编码:</label>
                            <input id="vehicleCode" name="vehicleCode" placeholder="请输入盛具编码" type="text"/>
周鸿 authored
35
36
                        </li>
                        <li class="select-time">
pengyongcheng authored
37
                            <label>入库时间:</label>
周鸿 authored
38
39
40
41
42
43
44
45
46
47
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间"
                                   name="createdBegin"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间"
                                   name="createdEnd"/>
                        </li>
                        <li style="float: right; margin-right: 45px">
                            <a id="search" class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()">
                                <i class="fa fa-search"></i>&nbsp;搜索
                            </a>
pengyongcheng authored
48
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('inventory-add-form')">
周鸿 authored
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
                                <i class="fa fa-refresh"></i>&nbsp;重置
                            </a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="col-sm-12 select-info">
            <a class="btn btn-success btn-sm" onclick="addDetails()" style="float: left; margin: 12px 0 12px 0"
               shiro:hasPermission="inventory:cyclecountDetail:add">
                <i class="fa fa-edit"></i>&nbsp;添加盘点库存</a>
            <table id="bootstrap-table" class="table table-bordered table-hover"></table>
        </div>
    </div>
</div>
<div th:include="include::footer"></div>
<th:block th:include="include :: select2-js"/>
<script th:inline="javascript">
pengyongcheng authored
67
68
69
70
71
72
73
    let addFlag = [[${@permission.hasPermi('inventory:cyclecountDetail:add')}]];
    let prefixDetail = ctx + "inventory/inventoryDetail";
    let prefix_cycleDetails = ctx + "inventory/cycleCountDetail";
    let prefix = ctx + "inventory/inventoryHeader";
    let report = [[${@permission.hasPermi('inventoryHeader:adjustHeader:report')}]];
    let inventoryStatus = [[${@dict.getType('inventorySts')}]];
    let supplier = [[${@SupplierService.getCode()}]];
周鸿 authored
74
    $(function () {
pengyongcheng authored
75
        let options = {
周鸿 authored
76
77
78
79
80
81
            url: prefix + "/cycleCountInventoryHeader",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            modalName: "库存头",
            sortName: "id",
            sortOrder: "desc",
pengyongcheng authored
82
            pagination: false,
周鸿 authored
83
84
85
86
87
88
89
90
91
92
93
94
95
            search: false,
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            detailView: true,
            onExpandRow: function (index, row, $detail) {
                initChildTable(index, row, $detail);
            },
            columns: [
                {
                    checkbox: true
                },
pengyongcheng authored
96
                /*{{
周鸿 authored
97
                    field: 'id',
pengyongcheng authored
98
                    title: '库存头id',
周鸿 authored
99
                },
pengyongcheng authored
100
周鸿 authored
101
102
103
104
105
106
                    field: 'warehouseCode',
                    title: '仓库 ',
                    visible: true
                },
                {
                    field: 'companyCode',
107
                    title: '货主',
周鸿 authored
108
                    visible: true
pengyongcheng authored
109
                },*/
周鸿 authored
110
111
                {
                    field: 'locationCode',
pengyongcheng authored
112
                    title: '库位编码'
周鸿 authored
113
114
115
                },
                {
                    field: 'containerCode',
pengyongcheng authored
116
                    title: '载具编码'
周鸿 authored
117
118
                },
                {
pengyongcheng authored
119
120
                    field: 'vehicleCode',
                    title: '盛具编码'
周鸿 authored
121
                },
pengyongcheng authored
122
                /*{
周鸿 authored
123
                    field: 'totalWeight',
pengyongcheng authored
124
                    title: '总药量(g)'
pengyongcheng authored
125
                },*/
周鸿 authored
126
127
                {
                    field: 'totalQty',
128
                    title: '总数'
周鸿 authored
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
                },
                {
                    field: 'totalLines',
                    title: '总行',
                },
                {
                    field: 'created',
                    title: ' 创建时间'
                },
                {
                    field: 'createdBy',
                    title: ' 创建用户'
                },
            ]
        };
        $.table.init(options);
    });

    //子表
    initChildTable = function (index, row, $detail) {
149
        let childTable = $detail.html('<table style="table table-bordered table-hover text-nowrap"></table>').find('table');
周鸿 authored
150
151
152
153
154
155
156
157
158
159
160
161
162
163
        $(childTable).bootstrapTable({
            url: prefixDetail + "/inventoryCycleCountLook",
            method: 'post',
            sortName: "id",
            sortOrder: "desc",
            sidePagination: "server",
            contentType: "application/x-www-form-urlencoded",
            //页面渲染
            responseHandler: responseHandler,
            queryParams: {
                inventoryHeaderId: row.id,
                warehouseCode: row.warehouseCode,
            },
            columns: [
pengyongcheng authored
164
                /*{
周鸿 authored
165
                    field: 'id',
pengyongcheng authored
166
                    title: '明细id',
周鸿 authored
167
168
169
                },
                {
                    field: 'inventoryHeaderId',
pengyongcheng authored
170
                    title: '库存头id',
周鸿 authored
171
                    visible: false
pengyongcheng authored
172
173
                },*/
                /*{
周鸿 authored
174
                    field: 'locationCode',
pengyongcheng authored
175
                    title: '库位编码',
周鸿 authored
176
177
178
179
                    visible: false
                },
                {
                    field: 'containerCode',
pengyongcheng authored
180
                    title: '载具编码',
周鸿 authored
181
                },
pengyongcheng authored
182
183
184
185
                {
                    field: 'vehicleCode',
                    title: '盛具编码',
                },*/
周鸿 authored
186
187
188
189
190
191
192
193
194
195
196
197
198
199
                {
                    field: 'materialCode',
                    title: '物料编码'
                },
                {
                    field: 'materialName',
                    title: '物料名称',
                },
                {
                    field: 'materialSpec',
                    title: '物料规格',
                },
                {
                    field: 'materialUnit',
pengyongcheng authored
200
201
                    title: '物料单位'
                },
202
                /*{
pengyongcheng authored
203
204
                    field: 'auxiliaryUnit',
                    title: '辅单位'
205
                },*/
pengyongcheng authored
206
207
                {
                    field: 'weight',
pengyongcheng authored
208
                    title: '药量(g)'
pengyongcheng authored
209
210
211
212
213
214
215
216
                },
                {
                    field: 'inventorySts',
                    title: '库存状态',
                    align: 'center',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(inventoryStatus, value);
                    }
周鸿 authored
217
218
219
220
221
222
                },
                {
                    field: 'qty',
                    title: '数量',
                },
                {
223
224
225
226
227
228
229
230
                    field: 'locationNoX',
                    title: 'x',
                },
                {
                    field: 'locationNoY',
                    title: 'y',
                },
                {
pengyongcheng authored
231
232
                    field: 'tracingNo',
                    title: '追溯码',
周鸿 authored
233
234
235
236
237
                },
                {
                    field: 'receiptCode',
                    title: '入库单编码',
                },
pengyongcheng authored
238
                /*{
周鸿 authored
239
240
241
                    field: 'companyCode',
                    title: '货主编码',
                    width: 80
pengyongcheng authored
242
                },*/
周鸿 authored
243
244
                {
                    field: 'receiptDetailId',
pengyongcheng authored
245
                    title: '入库单明细id'
周鸿 authored
246
247
248
                },
                {
                    field: 'supplierCode',
pengyongcheng authored
249
250
251
252
253
254
255
256
257
258
259
                    title: '供应商',
                    formatter: function (value, row, index) {
                        let actions = [];
                        $.each(supplier, function (index, item) {
                            if (item.code === value) {
                                actions.push("<span class='badge badge-info'>" + item.name + "</span>");
                                return false;
                            }
                        });
                        return actions.join('');
                    },
周鸿 authored
260
261
262
263
264
265
266
                },
                {
                    field: 'inventorySts',
                    title: '库存状态',
                    align: 'center',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(inventoryStatus, value);
pengyongcheng authored
267
                    }
周鸿 authored
268
269
270
                },
                {
                    field: 'weight',
pengyongcheng authored
271
                    title: '药量(g)'
周鸿 authored
272
273
274
275
276
277
278
                },
                {
                    field: 'created',
                    title: '入库日期',
                },
                {
                    field: 'createdBy',
pengyongcheng authored
279
                    title: '创建用户'
周鸿 authored
280
281
282
                },
                {
                    field: 'lastUpdated',
pengyongcheng authored
283
                    title: '最后修改时间'
周鸿 authored
284
285
286
                },
                {
                    field: 'lastUpdatedBy',
pengyongcheng authored
287
                    title: '更新用户'
周鸿 authored
288
289
290
291
292
293
                },
            ]
        });
    };

    function addDetails() {
pengyongcheng authored
294
        let rows = $("#bootstrap-table").bootstrapTable('getSelections');
周鸿 authored
295
296
297
298
299
        if (rows.length < 1) {
            $.modal.alertWarning("请选择库存明细!");
            return;
        }
        $.modal.loading("正在处理,请稍后...");
pengyongcheng authored
300
        let ids = [];
周鸿 authored
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
        rows.forEach(function (item) {
            ids.push(item.id);
        });
        addInner($('#cycleCountHeadCode').val(), ids.join(','));
    }

    function addInner(cycleCountHeadCode, ids) {
        $.ajax({
            cache: true,
            type: "post",
            url: prefix_cycleDetails + "/add",
            data: {
                cycleCountHeadCode: cycleCountHeadCode,
                inventoryHeaderIds: ids
            },
            async: true,
            error: function (request) {
                $.modal.alertError("请求失败!");
            },
            success: function (data) {
周鸿 authored
321
                if (data.code === 200) {
周鸿 authored
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
                    $.modal.closeLoading();
                    $.modal.alertSuccess("添加盘点成功");
                    $.table.refresh();
                } else {
                    $.modal.closeLoading();
                    $.modal.alertError(data.msg);
                    $.table.refresh();
                }
                parent.$.table.refresh();
            }
        })
    }

    function responseHandler(res) {
        if (res.code === 200) {
            return {rows: res.data, total: res.total, code: 0};
        } else {
            $.modal.alertWarning(res.msg);
            return {rows: [], total: 0};
        }
    }

    $(function () {
pengyongcheng authored
345
        /*$('#materialCode').select2({
周鸿 authored
346
            width: "200",
pengyongcheng authored
347
            placeholder: "请输入物料编码",
周鸿 authored
348
349
350
351
352
353
354
355
356
            ajax: {
                url: ctx + 'config/material/getData',
                dataType: 'json',
                type: 'post',
                data: function (params) {
                    return {
                        materialName: params.term,
                    };
                }
pengyongcheng authored
357
358
359
            },
            templateResult: function (data) {
                return data.id + " " + data.text;
周鸿 authored
360
            }
pengyongcheng authored
361
        });*/
周鸿 authored
362
363
364
365
    });
</script>
</body>
</html>