Blame view

src/main/resources/templates/receipt/receiptHeader/getReceiptSI.html 10.7 KB
1
2
3
4
<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
xumiao authored
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
<style></style>
<body class="gray-bg">
<div class="row">
    <div class="col-sm-12 select-info">
        <form class="form-horizontal m" id="form-receiptHeader-add">
            <div class="select-list">
                <ul>
                    <li></li>
                    <li></li>
                    <li>
                        货主:
                        <select id="companyCode" name="companyCode" class="form-control" th:with="companyList=${@companyService.selectCompanyByCurrentUserId()}">
                            <option th:each="company : ${companyList}" th:text="${company['name']}" th:value="${company['code']}" th:attr = " code = ${company['code']}"></option>
                        </select>
                    </li>
                    <li>
                        u8仓库:
                        <select name="uWarehouseCode" id="uWarehouseCode"  class="form-control" th:with="warehouse=${@warehouseWu.selectList()}">
                            <option value="">所有</option>
                            <option th:each="e : ${warehouse}" th:text="${e['uWarehouseName']}" th:value="${e['uWarehouseCode']}" th:attr = " code = ${e['uWarehouseCode']}"></option>
                        </select>
                    </li>
                    <li>
                        产成品入库单单号:
                        <input id="code" name="code" class="form-control" type="text" style="width: 260px">
                    </li>
                </ul>
32
            </div>
xumiao authored
33
34
35
36
37
            <div class="select-list">
                <div class="form-control-static col-sm-offset-9">
                    <button type="submit" class="btn btn-primary">提交</button>
                    <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
                </div>
38
            </div>
xumiao authored
39
40
            <div class="container-div">
                <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
41
            </div>
xumiao authored
42
43
44
45
46
47
48
49
50
51
52
53
54
            <div class="container-div" id="toolbar1" role="group">
                <a class="btn btn-outline btn-success btn-rounded" onclick="receiptDetailPrint()">
                    <i class="fa fa-print"></i> 标签打印
                </a>
                <a class="btn btn-outline btn-primary btn-rounded" onclick="batchReceiptContainer()">
                    <i class="fa fa-save"></i> 批量组盘
                </a>
            </div>
            <div class="container-div">
                <table id="bootstrap-table1" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
            </div>
        </form>
    </div>
55
56
57
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
xumiao authored
58
    var detailPrefix = ctx + "receipt/receiptDetail";
59
60
61
62
63
64
65
66
67
68
    var prefix = ctx + "receipt/receiptHeader";
    $("#form-receiptHeader-add").validate({
        submitHandler: function (form) {
            $.ajax({
                cache: true,
                type: "POST",
                url: prefix + "/getReceiptSI",
                data: {
                    "code": $("input[name='code']").val(),
                    "companyCode": $("#companyCode option:selected").attr("code"),
xumiao authored
69
                    "uWarehouseCode":$("#uWarehouseCode option:selected").val()
70
71
72
73
74
                },
                async: false,
                error: function (request) {
                    $.modal.alertError("请求失败!");
                },
xumiao authored
75
76
77
78
79
80
81
                success: function (value) {
                    saveSuc(value);
                    let data = value.data;
                    let receiptHeader = data['receiptHeader'];
                    let receiptDetails = data['receiptDetails'];
                    $("#bootstrap-table").bootstrapTable('append',receiptHeader);
                    $("#bootstrap-table1").bootstrapTable('append',receiptDetails);
82
83
84
85
                }
            });
        }
    });
xumiao authored
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
237
238
239
240
    function saveSuc(result){
        if (result.code == web_status.FAIL) {
            $.modal.alertError(result.msg);
        }
    }
    function unique(result) {
        return result.filter(function(item, index, arr) {
            //当前元素,在原始数组中的第一个索引==当前索引值,否则返回当前元素
            return result.indexOf(item, 0) === index;
        });
    }
    function batchReceiptContainer(){
        var rows=$("#bootstrap-table1").bootstrapTable('getSelections');
        if (rows.length == 0) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        debugger;
        var sourceCodes="";
        var result= rows.map(function(row) {
            return row.sourceCode;
        })
        result=unique(result);
        debugger;
        for(var i=0; i<result.length; i++) {
            sourceCodes = sourceCodes + result[i] + ","
        }

        let storage=window.localStorage;
        storage.sourceCodes=sourceCodes;
        createMenuItem(ctx + "receipt/batchReceiving","产成品入库单批量组盘");
        debugger;
        parent.parent.$('.tabReload').click();
    }
    /* 打印*/
    function receiptDetailPrint() {
        var rows=$("#bootstrap-table1").bootstrapTable('getSelections');
        if (rows.length == 0) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        var ids = "";
        for(var i=0; i<rows.length; i++) {
            ids = ids + rows[i].id + ","
        }

        var url = detailPrefix + "/report/" + ids;
        $.modal.open("历史入库铭牌打印" , url);
    }

    $("#bootstrap-table").bootstrapTable({
        modalName: "产成品入库单",
        sortName: "created",
        sortOrder: "desc",
        search: false,
        pageSize: 10,
        pagination:true,
        columns: [
            {
                field:"cDepName",
                title:"部门名称",
                visible:true
            },
            {
                field : 'sourceCode',
                title : 'U8单号',
                visible:true
            },
            {
                field : 'companyCode',
                title : '货主编码',
                visible:true
            },
            {
                field : 'companyName',
                title : '货主名称',
                sortable:true
            },
            {
                field : 'uWarehouseName',
                title : 'U8仓库',
                sortable:true
            },
            {
                field: 'type',
                title: '类型',
            }
        ]
    });

    $("#bootstrap-table1").bootstrapTable({
        modalName: "入库明细",
        sortName: "moCode",
        sortOrder: "desc",
        search: false,
        pageSize: 10,
        pagination:true,                        // 可供选择的每页的行数(*)
        columns: [
            {
                checkbox: true
            },
            {
                field:"id",
                title:"id",
                visible:false
            },
            {
                field:"moCode",
                title:"工作令号",
                visible:true
            },
            {
                field : 'sourceCode',
                title : 'U8单号',
                visible:true
            },
            {
                field : 'companyCode',
                title : '货主编码',
                visible:true
            },
            {
                field : 'uWarehouseName',
                title : 'U8仓库',
                sortable:true
            },
            {
                field:"materialCode",
                title:"物料编码",
                visible:true
            },
            {
                field : 'materialName',
                title : '物料名称',
                visible:true
            },
            {
                field : 'unit',
                title : '单位',
                visible:true
            },
            {
                field : 'sourceLine',
                title : '上游系统行号',
                sortable:true
            },
            {
                field : 'qty',
                title : '数量',
                sortable:true
            }
        ]

    });
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291


    $(function () {
        //监听浏览器宽度的改变
        window.onresize = function(){
            resize();
        };
        resize();

        //货架input
        $("#code").bind('input propertychange keypress',function (e) {
            let theEvent = e || window.event;
            let code = theEvent.keyCode || theEvent.which || theEvent.charCode;
            if (code === 13) {
                e.preventDefault();
                //回车执行查询
                // getCode();
            }
        });
    });


    function resize(){
        $("#code").focus();
    }

    //货架
    // function getCode() {
    // 	resize();
    // 	let code=$("#code").val();
    // 	if(code){
    // 		$.ajax({
    // 			cache: true,
    // 			type: "POST",
    // 			url: prefix + "/getReceiptSI",
    // 			data:{
    // 				code:code,
    // 			},
    // 			async: false,
    // 			error: function (request) {
    // 				$.modal.alertError("请求失败!");
    // 			},
    // 			success: function (data) {
    // 				$.operate.saveSuccess(data);
    // 			}
    // 		});
    // 	}
    // 	else{
    // 		layer.tips('请输入单号!','#code',{tips:[1,"rgb(28,132,198)"],time:1000,area:'auto',maxWidth: '1000'})
    // 	}
    // }
xumiao authored
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
    $(function () {
        layui.use('laydate', function() {
            var laydate = layui.laydate;
            laydate.render({ elem: '#appointmentTime',min: 0, theme: 'molv' ,type: 'datetime'});
        });

        $("select[name='companyCode']").change(function (e) {
            let companyCode=$("select[name='companyCode'] option:selected").attr('code');
            $.ajax({
                url: ctx + "receipt/receiptHeader/getwarehouse",
                type:'post',
                data:{code:companyCode},
                success:function (response) {
                    if(response.code===200){
                        $("select[name='uWarehouseCode']").children().remove();
                        $("select[name='uWarehouseCode']").append(`<option value="">所有</option>`);
                        for (let item of response.data) {
                            let option=`<option value="${item.uWarehouseCode}">${item.uWarehouseName}</option>`;
                            $("select[name='uWarehouseCode']").append(option);
                        }
                    }
                    else {$.modal.msgError(response.msg)}
                }
            })
        })
    })
319
320

</script>
xumiao authored
321
322
323
</body>
</html>