displace.html
9.44 KB
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head>
<th:block th:include="include :: header" />
<th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
<form class="form-horizontal m" id="form-task-emptyIn" th:object="${inventoryTransaction}">
<span style="color:red;margin-left:16%;">*点击提交后,会生成出库查看任务,要置换的托盘会送下来,置换物料后,将托盘回库,系统将自动为两个物料数据置换</span>
<br>
<span style="color:red;margin-left:16%;">*生成有延迟,不要关闭和重复点击,等待几秒</span>
<br>
<input id="id" name="id" th:field="*{id}" type="hidden">
<input id="inventoryDetailId" name="inventoryDetailId" type="hidden">
<br>
<div class="form-group">
<label class="col-sm-3 control-label">原物料颜色:</label>
<div class="col-sm-7">
<input id="materialColor" name="materialColor" th:field="*{materialColor}" readonly class="form-control" type="text">
</div>
<!-- <input type="button" class="btn-success btn" onclick="selectEmptyOut()" value="选取库存"/>-->
<button type="button" class="btn btn-primary" onclick="getInventoryTransaction()">查看物料详情</button>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">置换的物料颜色:</label>
<div class="col-sm-6">
<input id="displaceColor" name="displaceColor" readonly class="form-control" type="text">
</div>
<input type="button" class="btn-success btn" onclick="selectInventoryDetail()" value="选取置换的库存"/>
<button type="button" style="margin-right: 10px" class="btn btn-primary" onclick="getInventoryDetail()">查看物料详情</button>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">置换的数量:</label>
<div class="col-sm-2">
<input id="qty" name="qty" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">出库口:</label>
<div class="col-sm-2">
<select id="port" name="port" class="form-control"></select>
</div>
</div>
<div class="col-sm-12 select-info" id="selecttable">
<table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
</div>
<div class="form-group">
<div class="form-control-static col-sm-offset-9">
<button type="submit" class="btn btn-primary" id="btn-submit">提交置换</button>
<!-- <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>-->
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<script th:inline="javascript">
var prefix = ctx + "inventory/inventoryTransaction";
var prefix_inventoryDetail = ctx + "inventory/inventoryDetail"
var prefix_header = ctx + "inventory/inventoryTransaction";
var inventoryStatus = [[${@dict.getType('inventorySts')}]];
var company = [[${@companyService.getCode()}]];
var originalWarehouse = [[${@dict.getType('originalWarehouse')}]];
function getInventoryTransaction() {
var id = $("#id").val();
$.ajax({
url: prefix + '/inventoryTransactionList',
type: "post",
data: {
"id": id,
},
success: function (value) {
$("#bootstrap-table").bootstrapTable('load', value.data);
}
});
}
function getInventoryDetail() {
var inventoryDetailId = $("#inventoryDetailId").val();
inventoryDetailId==''?$.modal.alertError("请先选取库存"):
$.ajax({
url: prefix_inventoryDetail + '/inventoryDetailLook',
type: "post",
data: {
"id": inventoryDetailId
},
success: function (value) {
$("#bootstrap-table").bootstrapTable('load', value.data);
}
});
}
$("#bootstrap-table").bootstrapTable({
sortable: true, //排序
clickToSelect: true,
exportDataType: "all", //导出类型basic', 'all', 'selected'.当前页、所有数据、选中数据
modalName: "入库明细",
sortName: "lastUpdated",
sortOrder: "desc",
iconSize: "outline",
toolbar: "#toolbar1",
contentType: "application/x-www-form-urlencoded",
pagination: true, // 是否显示分页(*)
pageNumber: 1, // 初始化加载第一页,默认第一页
pageSize: 10, // 每页的记录行数(*)
pageList: [10, 25, 50], // 可供选择的每页的行数(*)
onRefresh: function () {
loadDetail();
},
columns: [
{
field: 'materialColor',
title: '主体颜色'
},
{
field: 'warehouse',
title: '原仓库',
align: 'center',
formatter: function (value, row, index) {
return $.table.selectDictLabel(originalWarehouse, value);
}
},
{
field: 'locationCode',
title: '库位编号'
},
{
field: 'containerCode',
title: '容器编号'
},
{
field: 'materialCode',
title: '物料编码'
},
{
field: 'materialName',
title: '物料名称'
},
{
field: 'qty',
title: '库存数量'
},
{
field: 'taskQty',
title: '预定执行数量(或出库数)'
},
{
field: 'materialSpec',
title: '物料规格'
},
{
field: 'materialUnit',
title: '物料单位'
},
{
field: 'receiptCode',
title: '入库单号'
},
{
field: 'noticeNo',
title: '通知单号'
},
{
field: 'id',
title: '库存交易ID或库存明细ID',
sortable: false
},
{
field: 'inventoryHeaderId',
title: '库存头ID',
},
{
field: 'created',
title: '创建时间',
align: 'center',
},
{
field: 'createdBy',
title: '创建用户',
align: 'center',
},
{
field: 'lastUpdated',
title: '更新时间',
align: 'center',
},
]
});
$("#form-task-emptyIn").validate({
rules:{
port:{
required:true,
},
},
submitHandler: function (form) {
$("#btn-submit").attr("disabled", true);
var inventoryDetailId = $("#inventoryDetailId").val();
var inventoryTransactionId = $("#id").val();
var port = $("#port").val();
if (inventoryDetailId === '' || inventoryTransactionId === '') {
$.modal.alertError("请先选取库存");
$("#btn-submit").attr("disabled", false);
return;
}
$.ajax({
url: prefix_header + "/inventoryDisplace",
type: "post",
data: {
"inventoryTransactionId": inventoryTransactionId,
"inventoryDetailId": inventoryDetailId,
"port":port
},
success: function (result) {
// console.log(result)
if (result.code === web_status.SUCCESS) {
$.modal.enable();
$.modal.alertSuccess(result.msg);
// $.modal.close();
} else if (result.code === web_status.WARNING) {
$.modal.enable();
$.modal.alertWarning(result.msg)
} else {
$.modal.enable();
$.modal.alertError(result.msg);
}
$("#btn-submit").attr("disabled", false);
}
});
}
});
function selectInventoryDetail() {
var inventoryTransactionId = $("#id").val();
var url = prefix_inventoryDetail + "/inventoryDetailChoose?inventoryTransactionId=" + inventoryTransactionId;
$.modal.openFull("库存选取", url);
}
function myFunction() {
$('#port').select2({
ajax: {
url: ctx+'config/station/getAllStation',
type: 'post',
// data: {},
success: function(data) {
}
}
});
}
$(function () {
myFunction();
})
</script>
</body>
</html>