Commit 5ce4edffbb7da529cf09b7a3c5d66183c9141df1
1 parent
63841495
库位监控BUG修复
Signed-off-by: TanYibin <5491541@qq.com>
Showing
2 changed files
with
289 additions
and
468 deletions
ant-design-vue-jeecg/src/views/system/monitor/locationStatus.vue
1 | 1 | <template> |
2 | 2 | <a-card :bordered="false"> |
3 | - <div class="container-div"> | |
4 | - <div class="row"> | |
5 | - <div class="col-sm-12 select-info"> | |
6 | - <form id="container-form"> | |
7 | - <div class="select-list"> | |
8 | - <ul id="select_info"> | |
9 | - <li> | |
10 | - <a-select | |
11 | - show-search | |
12 | - placeholder="请选择库区" | |
13 | - option-filter-prop="children" | |
14 | - v-model="zoneCode" | |
15 | - @change="refresh" | |
16 | - style="width: 200px"> | |
17 | - <a-select-option selected="0" id="zoneCode" v-for="item in zoneList" :key="item.name" :value="item.code">{{ item.name }} | |
18 | - </a-select-option> | |
19 | - </a-select> | |
20 | - </li> | |
21 | - <li>第 | |
22 | - <select id="editable-num" name="num" style="width: 70px" /> | |
23 | - </li> | |
24 | - <li> | |
25 | - <select id="editable-select" name="col" @click="show" style="width: 70px"> | |
26 | - <option value="row" selected>行</option> | |
27 | - <option value="line">列</option> | |
28 | - <option value="layer">层</option> | |
29 | - </select> | |
30 | - </li> | |
31 | - <li> | |
32 | - <a-button type="primary" @click="Search()" icon="search">查询</a-button> | |
33 | - </li> | |
34 | - <li> | |
35 | - <a-button @click='expressDelivery()' v-if="this.expressDeliveryVisible" type='primary'>快速出库</a-button> | |
36 | - </li> | |
37 | - <li> | |
38 | - <a-button @click="expressStorage()" type="primary" v-if="expressStorageVisible">快速入库</a-button> | |
39 | - </li> | |
40 | - </ul> | |
41 | - </div> | |
42 | - </form> | |
43 | - </div> | |
44 | - <div class="col-sm-12 select-info"> | |
45 | - <form id="receiptHeader-form"> | |
46 | - <div class="select-list"> | |
47 | - <ul id="img_list" style=""> | |
48 | - <li>空柜空闲:<img src="~@/assets/icon/grid_rest.png"></li> | |
49 | - <li>空盘空闲:<img src="~@/assets/icon/grid_empty.png"></li> | |
50 | -<!-- <li>半盘空闲:<img src="~@/assets/icon/grid_half.png"></li>--> | |
51 | - <li>整盘空闲:<img src="~@/assets/icon/grid_all.png"></li> | |
52 | - <li>空柜锁定:<img src="~@/assets/icon/grid_emp_lock.png"></li> | |
53 | - <li>空盘锁定:<img src="~@/assets/icon/grid_empty_lock.png"></li> | |
54 | -<!-- <li>半盘锁定:<img src="~@/assets/icon/grid_half_lock.png"></li>--> | |
55 | - <li>整盘锁定:<img src="~@/assets/icon/grid_all_lock.png"></li> | |
56 | -<!-- <li>空柜禁用:<img src="~@/assets/icon/grid_emp_waing.png"></li>--> | |
57 | -<!-- <li>空盘禁用:<img src="~@/assets/icon/grid_empty_waring.png"></li>--> | |
58 | -<!-- <li>半盘禁用:<img src="~@/assets/icon/grid_half_waring.png"></li>--> | |
59 | -<!-- <li>整盘禁用:<img src="~@/assets/icon/ContainerDisabled.png"></li>--> | |
60 | - <li> | |
61 | - <span style="font-size: 12px">库位统计情况:</span> | |
62 | - <input style="width: 400px; font-size: 12px" type="text" id="zone" disabled/> | |
63 | - </li> | |
64 | - </ul> | |
65 | - <br><br> | |
66 | - <ul id="info_list"> | |
67 | - <li><span>库位:</span><input type="text" id="code" disabled/></li> | |
68 | - <li><span>容器编码:</span><input type="text" id="containerCode" disabled/></li> | |
69 | - <li><span>物料信息:<select id="material" style="width: auto; min-width: 200px;padding: 0px 8px;appearance: none;pointer-events: none;"><option>无</option></select></span></li> | |
70 | - </ul> | |
71 | - </div> | |
72 | - </form> | |
73 | - </div> | |
74 | - | |
75 | - <div class="col-sm-12 select-info"> | |
76 | - <div id="borderCol" style="overflow-y: auto;white-space:nowrap" v-show="showPrise"> | |
77 | - <div class="location" id="location"> | |
3 | + <div class="container-div"> | |
4 | + <div class="row"> | |
5 | + <div class="col-sm-12 select-info"> | |
6 | + <form id="container-form"> | |
7 | + <div class="select-list"> | |
8 | + <ul id="select_info"> | |
9 | + <li> | |
10 | + <a-select | |
11 | + show-search | |
12 | + placeholder="请选择库区" | |
13 | + option-filter-prop="children" | |
14 | + v-model="zoneCode" | |
15 | + @change="refresh" | |
16 | + style="width: 200px"> | |
17 | + <a-select-option selected="0" id="zoneCode" v-for="item in zoneList" :key="item.name" :value="item.code">{{ item.name }} | |
18 | + </a-select-option> | |
19 | + </a-select> | |
20 | + </li> | |
21 | + <li>第 | |
22 | + <a-select | |
23 | + show-search | |
24 | + option-filter-prop="children" | |
25 | + v-model="num" | |
26 | + style="width: 70px"> | |
27 | + <a-select-option id="num" v-for="num in nums" :key="num" :value="num">{{ num }} | |
28 | + </a-select-option> | |
29 | + </a-select> | |
30 | + </li> | |
31 | + <li> | |
32 | + <a-select | |
33 | + show-search | |
34 | + option-filter-prop="children" | |
35 | + v-model="col" | |
36 | + @change="refresh" | |
37 | + style="width: 70px"> | |
38 | + <a-select-option id="col" v-for="item in colList" :key="item.name" :value="item.code">{{ item.name }} | |
39 | + </a-select-option> | |
40 | + </a-select> | |
41 | + </li> | |
42 | + <li> | |
43 | + <a-button type="primary" @click="search()" icon="search">查询</a-button> | |
44 | + </li> | |
45 | + <li> | |
46 | + <a-button @click='expressDelivery()' v-if="expressDeliveryVisible" type='primary'>快速出库</a-button> | |
47 | + </li> | |
48 | + <li> | |
49 | + <a-button @click="expressStorage()" type="primary" v-if="expressStorageVisible">快速入库</a-button> | |
50 | + </li> | |
51 | + </ul> | |
52 | + </div> | |
53 | + </form> | |
54 | + </div> | |
55 | + <div class="col-sm-12 select-info"> | |
56 | + <form id="receiptHeader-form"> | |
57 | + <div class="select-list"> | |
58 | + <ul id="img_list"> | |
59 | + <li style="font-size: 12px">空柜空闲:<img src="~@/assets/icon/grid_rest.png"></li> | |
60 | + <li style="font-size: 12px">空盘空闲:<img src="~@/assets/icon/grid_empty.png" alt=""></li> | |
61 | + <li style="font-size: 12px">整盘空闲:<img src="~@/assets/icon/grid_all.png"></li> | |
62 | + <li style="font-size: 12px">空柜锁定:<img src="~@/assets/icon/grid_emp_lock.png"></li> | |
63 | + <li style="font-size: 12px">空盘锁定:<img src="~@/assets/icon/grid_empty_lock.png"></li> | |
64 | + <li style="font-size: 12px">整盘锁定:<img src="~@/assets/icon/grid_all_lock.png"></li> | |
65 | + </ul> | |
66 | + <ul id="info_list"> | |
67 | + <li> | |
68 | + <span style="font-size: 12px">库位统计情况:</span> | |
69 | + <input style="width: 600px; font-size: 12px; border: none;" type="text" id="zone" disabled/> | |
70 | + </li><br><br> | |
71 | + <li><span>库位:</span><input type="text" style="width: 100px; font-size: 12px; border: none;" id="code" disabled/></li> | |
72 | + <li><span>容器编码:</span><input type="text" style="width: 200px; font-size: 12px; border: none;" id="containerCode" disabled/></li><br><br> | |
73 | + <li> | |
74 | + <span>物料信息: | |
75 | + <select id="material" style="width: 600px; padding: 0px 8px;border: none;"> | |
76 | + <option>无</option> | |
77 | + </select> | |
78 | + </span> | |
79 | + </li> | |
80 | + </ul> | |
81 | + </div> | |
82 | + </form> | |
83 | + </div> | |
84 | + <div class="col-sm-12 select-info"> | |
85 | + <div id="borderCol" style="overflow-y: auto;white-space:nowrap" v-show="showPrise"> | |
86 | + <div class="location" id="location"/> | |
78 | 87 | </div> |
88 | + <a-spin tip="库位视图生成中..." :spinning="spinning"> | |
89 | + <a-skeleton active :loading="loading" :paragraph="{ rows: 5 }"/> | |
90 | + </a-spin> | |
79 | 91 | </div> |
80 | - <a-spin tip="库位视图生成中..." :spinning="spinning"> | |
81 | - <a-skeleton active :loading="loading" :paragraph="{ rows: 5 }"/> | |
82 | - </a-spin> | |
83 | 92 | </div> |
84 | - | |
85 | - | |
86 | 93 | </div> |
87 | - </div> | |
88 | - | |
89 | - <ExpressStorageModal ref="ExpressStorageModal" @ok="Search"></ExpressStorageModal> | |
90 | - <ExpressDeliveryModal ref="ExpressDeliveryModal" @ok="Search"></ExpressDeliveryModal> | |
94 | + <ExpressStorageModal ref="ExpressStorageModal" @ok="search"></ExpressStorageModal> | |
95 | + <ExpressDeliveryModal ref="ExpressDeliveryModal" @ok="search"></ExpressDeliveryModal> | |
91 | 96 | </a-card> |
92 | 97 | </template> |
93 | 98 | |
94 | 99 | <script> |
95 | -var prefix = "/location/locationMonitor"; | |
96 | -var grid_row; | |
97 | -var grid_line; | |
98 | -var grid_layer; | |
99 | -var list_info; | |
100 | -var grid_num_1 = 0; | |
101 | -var grid_num_2 = 0; | |
102 | -var grid_num_3 = 0; | |
103 | -var grid_num_4 = 0; | |
104 | -var grid_num_5 = 0; | |
105 | -var grid_num_6 = 0; | |
106 | -var grid_num_7 = 0; | |
107 | -var grid_num_8 = 0; | |
108 | -var grid_num_9 = 0; | |
109 | -var grid_num_10 = 0; | |
110 | -var grid_num_11 = 0; | |
111 | -var grid_num_12 = 0; | |
112 | -var currentContainerCode; | |
113 | -var currentLocationCode = 0; | |
114 | -var currentMaterialCode = 0; | |
115 | 100 | |
116 | -import huahengUI from '../../../assets/css/huahengUI.css' | |
101 | +import huahengUI from '@/assets/css/huahengUI.css' | |
117 | 102 | import $ from '../../../assets/js/jquery-1.11.1.min' |
118 | 103 | import grid_rest from '@/assets/icon/grid_rest.png' |
119 | 104 | import grid_empty from '@/assets/icon/grid_empty.png' |
... | ... | @@ -128,21 +113,15 @@ import grid_empty_lock from '@/assets/icon/grid_empty_lock.png' |
128 | 113 | import grid_half_lock from '@/assets/icon/grid_half_lock.png' |
129 | 114 | import grid_all_lock from '@/assets/icon/grid_all_lock.png' |
130 | 115 | import rel_empty from '@/assets/icon/rel_empty.png' |
131 | -import Vue from 'vue' | |
132 | -import {ACCESS_TOKEN} from "@/store/mutation-types" | |
133 | 116 | import {getInventoryDetailByLocationCode, getZoneList} from '@/api/api' |
134 | -import MaterialTaskModal from "../task/modules/MaterialTaskModal"; | |
135 | 117 | import ExpressDeliveryModal from "@views/system/monitor/modules/ExpressDeliveryModal"; |
136 | 118 | import ExpressStorageModal from "@views/system/monitor/modules/ExpressStorageModal"; |
137 | 119 | import {JeecgListMixin} from '@/mixins/JeecgListMixin' |
120 | +import {getAction, postAction} from "@api/manage"; | |
138 | 121 | |
139 | 122 | |
140 | 123 | export default { |
141 | 124 | name: "locationStatus", |
142 | - zoneCode: "", | |
143 | - // parameter:{ | |
144 | - // code:'', | |
145 | - // } , | |
146 | 125 | mixins: [JeecgListMixin], |
147 | 126 | components: { |
148 | 127 | ExpressStorageModal, |
... | ... | @@ -154,24 +133,36 @@ export default { |
154 | 133 | loading: true, |
155 | 134 | showPrise: false, |
156 | 135 | expressDeliveryVisible: false, |
157 | - expressStorageVisible:false, | |
158 | - // loading:true, | |
136 | + expressStorageVisible: false, | |
137 | + col: "row", | |
138 | + colList: [ | |
139 | + {code: "row", name: "行"}, | |
140 | + {code: "line", name: "列"}, | |
141 | + {code: "layer", name: "层"} | |
142 | + ], | |
159 | 143 | zoneCode: '', |
160 | 144 | zoneList: [], |
145 | + num: 1, | |
146 | + nums: [], | |
161 | 147 | model: {}, |
162 | - locationContent: '' | |
148 | + url: { | |
149 | + getStatus: "/location/locationMonitor/getStatus", | |
150 | + getLocationInfo: "/location/locationMonitor/getLocationInfo", | |
151 | + getAllLocation: "/location/locationMonitor/getAllLocation" | |
152 | + }, | |
153 | + grid_row: null, | |
154 | + grid_line: null, | |
155 | + grid_layer: null, | |
156 | + list_info: null, | |
157 | + currentLocationCode: 0, | |
163 | 158 | } |
164 | 159 | }, |
165 | - | |
166 | - | |
167 | 160 | created() { |
168 | - let _this = this | |
169 | - _this.loadFrom() | |
170 | - window.gridMsg = _this.gridMsg | |
171 | - window.Mclose = _this.Mclose | |
172 | - window.lays = _this.lays | |
161 | + this.loadFrom() | |
162 | + window.gridMsg = this.gridMsg | |
163 | + window.mClose = this.mClose | |
164 | + window.lays = this.lays | |
173 | 165 | }, |
174 | - | |
175 | 166 | mounted() { |
176 | 167 | // 监听浏览器宽度的改变 |
177 | 168 | const resizeObserver = new ResizeObserver(entries => { |
... | ... | @@ -180,89 +171,54 @@ export default { |
180 | 171 | } |
181 | 172 | }); |
182 | 173 | resizeObserver.observe(document.querySelector('.location')); |
174 | + | |
175 | + let that = this; | |
176 | + setTimeout(function () { | |
177 | + that.refresh(); | |
178 | + }, 1000); | |
183 | 179 | }, |
184 | 180 | methods: { |
181 | + loadData() { | |
182 | + // 空方法,为了覆盖混入文件中的方法,解决报错 | |
183 | + }, | |
185 | 184 | loadFrom() { |
186 | 185 | getZoneList().then((res) => { |
187 | 186 | if (res.success) { |
188 | 187 | this.zoneList = res.result; |
189 | 188 | if (this.zoneList.length > 0) { |
190 | 189 | this.zoneCode = this.zoneList[0].code; |
191 | - let _this = this; | |
192 | - this.resetAjax(this.zoneCode); | |
193 | 190 | } |
194 | 191 | } |
195 | 192 | }) |
196 | 193 | }, |
197 | - refresh: function () { | |
198 | - $.ajax({ | |
199 | - url: window._CONFIG['domianURL'] + prefix + "/getAllLocation", | |
200 | - type: "post", | |
201 | - data: { | |
202 | - zoneCode: this.zoneCode | |
203 | - }, | |
204 | - headers: { | |
205 | - "X-Access-Token": Vue.ls.get(ACCESS_TOKEN) | |
206 | - }, | |
207 | - success: function (res) { | |
208 | - grid_row = res.result.maxRow; | |
209 | - grid_line = res.result.maxLine; | |
210 | - grid_layer = res.result.maxLayer; | |
211 | - } | |
212 | - }); | |
213 | - let num = $("#editable-select").val(); | |
214 | - $("#editable-num").children().remove(); | |
215 | - if (num === "row") { | |
216 | - for (let i = 1; i <= grid_row; i++) { | |
217 | - $("#editable-num").append("<option value='" + i + "'>" + i + "</option>") | |
218 | - } | |
219 | - } else if (num === "line") { | |
220 | - for (let i = 1; i <= grid_line; i++) { | |
221 | - $("#editable-num").append("<option value='" + i + "'>" + i + "</option>") | |
222 | - } | |
223 | - } else if (num === "layer") { | |
224 | - for (let i = 1; i <= grid_layer; i++) { | |
225 | - $("#editable-num").append("<option value='" + i + "'>" + i + "</option>") | |
226 | - } | |
194 | + handleNumsSelect() { | |
195 | + let col = this.col; | |
196 | + if (col === "row") { | |
197 | + this.nums = this.grid_row; | |
198 | + } else if (col === "line") { | |
199 | + this.nums = this.grid_line; | |
200 | + } else if (col === "layer") { | |
201 | + this.nums = this.grid_layer; | |
202 | + } else { | |
203 | + this.$message.warning("错误"); | |
227 | 204 | } |
228 | - | |
229 | - let zoneCode = $("#zoneCode").val(); | |
230 | - this.resetAjax(this.zoneCode); | |
231 | - // this.show(); | |
232 | 205 | }, |
233 | - show: function () { | |
234 | - //库位类型和行列层选择 | |
235 | - $("#editable-select").change(function () { | |
236 | - let num = $("#editable-select").val(); | |
237 | - $("#editable-num").children().remove(); | |
238 | - if (num === "row") { | |
239 | - for (let i = 1; i <= grid_row; i++) { | |
240 | - $("#editable-num").append("<option value='" + i + "'>" + i + "</option>") | |
241 | - } | |
242 | - } else if (num === "line") { | |
243 | - for (let i = 1; i <= grid_line; i++) { | |
244 | - $("#editable-num").append("<option value='" + i + "'>" + i + "</option>") | |
245 | - } | |
246 | - } else if (num === "layer") { | |
247 | - for (let i = 1; i <= grid_layer; i++) { | |
248 | - $("#editable-num").append("<option value='" + i + "'>" + i + "</option>") | |
249 | - } | |
206 | + refresh() { | |
207 | + let url = this.url.getAllLocation | |
208 | + getAction(url, {zoneCode: this.zoneCode}).then(res => { | |
209 | + if (res.success) { | |
210 | + this.grid_row = res.result.maxRow; | |
211 | + this.grid_line = res.result.maxLine; | |
212 | + this.grid_layer = res.result.maxLayer; | |
213 | + } else { | |
214 | + this.$message.warning(res.message) | |
250 | 215 | } |
251 | - }); | |
252 | - | |
253 | - $("#zoneCode").change(function () { | |
254 | - let zoneCode = $("#zoneCode").val(); | |
255 | - this.resetAjax(this.zoneCode); | |
256 | - }); | |
257 | - }, | |
258 | - | |
259 | - //边框高度 | |
260 | - border() { | |
261 | - let box_height = $("#borderCol").offset().top; | |
262 | - let window_height = $(window).height() - 20; | |
263 | - $("#borderCol").css({"height": window_height - box_height}); | |
216 | + }).finally(() => { | |
217 | + this.handleNumsSelect(); | |
218 | + this.search(); | |
219 | + }) | |
220 | + this.locationStatistics(); | |
264 | 221 | }, |
265 | - | |
266 | 222 | //格子宽度 |
267 | 223 | changeMargin() { |
268 | 224 | let box_width = 0; |
... | ... | @@ -270,12 +226,12 @@ export default { |
270 | 226 | box_width = document.getElementById("location").offsetWidth; |
271 | 227 | } |
272 | 228 | box_width = box_width - 80; |
273 | - let num = $("#editable-select").val(); | |
229 | + let num = this.col; | |
274 | 230 | let grid_width; |
275 | 231 | if (num === "layer" || num === "row") { |
276 | - grid_width = box_width / grid_line; | |
232 | + grid_width = box_width / this.grid_line; | |
277 | 233 | } else if (num === "line") { |
278 | - grid_width = box_width / grid_row; | |
234 | + grid_width = box_width / this.grid_row; | |
279 | 235 | } |
280 | 236 | if (grid_width >= 50) { |
281 | 237 | $(".grid").css({"width": "50px", "height": "50px"}); |
... | ... | @@ -285,40 +241,32 @@ export default { |
285 | 241 | $(".grid").css({"width": grid_width, "height": grid_width}); |
286 | 242 | } |
287 | 243 | }, |
288 | - | |
289 | 244 | //tips信息 |
290 | 245 | lays(x) { |
291 | 246 | let $j = $(x); |
292 | 247 | let row = $j.attr("data-i"); |
293 | 248 | let line = $j.attr("data-j"); |
294 | 249 | let layers = $j.attr("data-k"); |
295 | - | |
296 | 250 | row = parseInt(row); |
297 | 251 | line = parseInt(line); |
298 | 252 | layers = parseInt(layers); |
299 | - if (list_info) { | |
300 | - for (let i = 0; i < list_info.length; i++) { | |
301 | - if (list_info[i].row === row && list_info[i].icolumn === line && list_info[i].layer === layers) { | |
253 | + if (this.list_info) { | |
254 | + for (const element of this.list_info) { | |
255 | + if (element.row === row && element.icolumn === line && element.layer === layers) { | |
302 | 256 | let str_info = ''; |
303 | 257 | let container_code = ''; |
304 | - let list_qty = 0; | |
305 | - if (list_info[i].containerCode) { | |
306 | - container_code = "\n容器编码:" + list_info[i].containerCode + ""; | |
307 | - if (list_info[i].materialName) { | |
308 | - for (let j = 0; j < list_info[i].materialName.length; j++) { | |
309 | - let list_batch = list_info[i].batch[j] === null ? "无" : list_info[i].batch[j] === "" ? "无" : list_info[i].batch[j]; | |
310 | - list_qty += list_info[i].qty[j]; | |
311 | - if (j == list_info[i].materialName.length - 1) { | |
312 | - str_info = str_info + "\n物料信息:批次->" + list_batch + ",物料名称->" + list_info[i].materialName[j] + ",物料编码->" + list_info[i].materialCode[j] + | |
313 | - ",数量->" + list_qty + "" | |
314 | - } | |
258 | + if (element.containerCode) { | |
259 | + container_code = "\n容器编码:" + element.containerCode + ""; | |
260 | + if (element.materialName) { | |
261 | + for (let j = 0; j < element.materialName.length; j++) { | |
262 | + let list_batch = element.batch[j].length == 0 ? "无" : element.batch[j]; | |
263 | + let list_qty = element.qty[j]; | |
264 | + str_info += "\n物料信息:批次->" + list_batch + ",物料名称->" + element.materialName[j] + ",物料编码->" + element.materialCode[j] + ",数量->" + list_qty + "" | |
315 | 265 | } |
316 | 266 | } |
317 | 267 | } |
318 | - let code = list_info[i].code === null ? "无" : list_info[i].code; | |
268 | + let code = element.code === null ? "无" : element.code; | |
319 | 269 | $("[data-i='" + row + "']" + "[data-j='" + line + "']" + "[data-k='" + layers + "']").attr({"title": "第" + row + "行,第" + line + "列,第" + layers + "层\n库位:" + code + container_code + str_info}); |
320 | - // Vue.prototype.$Jnotification.success({message: '系统提示', description: "第"+row+"行,第"+line+"列,第"+ layers +"层<br>库位:"+ code + container_code + str_info, duration: 4}) | |
321 | - | |
322 | 270 | } |
323 | 271 | } |
324 | 272 | } else { |
... | ... | @@ -326,15 +274,15 @@ export default { |
326 | 274 | } |
327 | 275 | }, |
328 | 276 | // 快速入库 |
329 | - expressStorage(){ | |
277 | + expressStorage() { | |
330 | 278 | let json = { |
331 | - "containerCode":currentContainerCode, | |
332 | - "locationCode":currentLocationCode | |
279 | + "containerCode": this.currentContainerCode, | |
280 | + "locationCode": this.currentLocationCode | |
333 | 281 | } |
334 | 282 | this.$refs.ExpressStorageModal.edit(json); |
335 | 283 | }, |
336 | 284 | // 获取库存信息 |
337 | - getInventory(locationCode){ | |
285 | + getInventory(locationCode) { | |
338 | 286 | let params = { |
339 | 287 | locationCode: locationCode |
340 | 288 | } |
... | ... | @@ -342,8 +290,8 @@ export default { |
342 | 290 | if (res.success) { |
343 | 291 | let parameter = []; |
344 | 292 | let newArr = res.result.records; |
345 | - for(var i of newArr){ | |
346 | - var param = { | |
293 | + for (let i of newArr) { | |
294 | + let param = { | |
347 | 295 | materialCode: i.materialCode, |
348 | 296 | shipQty: i.qty, |
349 | 297 | inventoryDetailId: i.id, |
... | ... | @@ -358,230 +306,174 @@ export default { |
358 | 306 | }); |
359 | 307 | }, |
360 | 308 | //快速出库 |
361 | - expressDelivery(){ | |
362 | - this.getInventory(currentLocationCode); | |
309 | + expressDelivery() { | |
310 | + this.getInventory(this.currentLocationCode); | |
363 | 311 | }, |
364 | 312 | // 显示快速出库 |
365 | - revealExpressDelivery(code, materialCode){ | |
366 | - if (materialCode){ | |
367 | - this.expressDeliveryVisible = true; | |
368 | - }else { | |
369 | - this.expressDeliveryVisible = false; | |
370 | - } | |
313 | + revealExpressDelivery(code, materialCode) { | |
314 | + this.expressDeliveryVisible = !!materialCode; | |
371 | 315 | }, |
372 | 316 | // 显示快速入库 |
373 | - revealExpressStorage(code){ | |
374 | - if(code){ | |
375 | - this.expressStorageVisible = true | |
376 | - }else { | |
377 | - this.expressStorageVisible = false; | |
378 | - } | |
317 | + revealExpressStorage(code) { | |
318 | + this.expressStorageVisible = !!code; | |
379 | 319 | }, |
380 | - | |
381 | 320 | //关闭tips |
382 | - Mclose(x) { | |
321 | + mClose(x) { | |
383 | 322 | //关闭 |
384 | 323 | // Vue.prototype.$Jnotification.error({message: '系统提示', description: "鼠标拿走了", duration: 4}) |
385 | 324 | }, |
386 | - | |
387 | 325 | //库位信息请求和状态显示 |
388 | 326 | ajaxGrid(x, info) { |
389 | 327 | let _this = this |
390 | - // let load=layer.msg('加载中', {icon: 16,shade: 0.4,time: false}); | |
391 | - $.ajax({ | |
392 | - url: window._CONFIG['domianURL'] + prefix + "/getLocationInfo", | |
393 | - type: "post", | |
394 | - headers: { | |
395 | - "X-Access-Token": Vue.ls.get(ACCESS_TOKEN) | |
396 | - }, | |
397 | - data: info, | |
398 | - success: function (res) { | |
399 | - if (res.code === 200 || res.result) { | |
400 | - grid_num_1 = 0; | |
401 | - grid_num_2 = 0; | |
402 | - grid_num_3 = 0; | |
403 | - grid_num_4 = 0; | |
404 | - grid_num_5 = 0; | |
405 | - grid_num_6 = 0; | |
406 | - grid_num_7 = 0; | |
407 | - grid_num_8 = 0; | |
408 | - grid_num_9 = 0; | |
409 | - grid_num_10 = 0; | |
410 | - grid_num_11 = 0; | |
411 | - grid_num_12 = 0; | |
412 | - if (x === "row") { | |
413 | - for (let i = 0; i < res.result.length; i++) { | |
414 | - let index = res.result[i].icolumn + ((res.result[i].layer - 1) * grid_line); | |
415 | - index = index - 1; | |
416 | - _this.resShow(res, index, i); | |
417 | - } | |
418 | - _this.clearLocation(grid_line, grid_layer); | |
419 | - // layer.close(load); | |
420 | - } else if (x === "line") { | |
421 | - for (let i = 0; i < res.result.length; i++) { | |
422 | - let index = res.result[i].row + ((res.result[i].layer - 1) * grid_row); | |
423 | - index = index - 1; | |
424 | - _this.resShow(res, index, i); | |
425 | - } | |
426 | - _this.clearLocation(grid_row, grid_layer); | |
427 | - // layer.close(load); | |
428 | - } else if (x === "layer") { | |
429 | - for (let i = 0; i < res.result.length; i++) { | |
430 | - let index = res.result[i].icolumn + ((res.result[i].row - 1) * grid_line); | |
431 | - index = index - 1; | |
432 | - _this.resShow(res, index, i); | |
433 | - } | |
434 | - _this.clearLocation(grid_line, grid_row); | |
435 | - // layer.close(load); | |
328 | + let url = this.url.getLocationInfo; | |
329 | + postAction(url, info).then(res => { | |
330 | + if (res.success) { | |
331 | + if (x === "row") { | |
332 | + for (let i = 0; i < res.result.length; i++) { | |
333 | + let index = res.result[i].icolumn + ((res.result[i].layer - 1) * this.grid_line); | |
334 | + index = index - 1; | |
335 | + _this.resShow(res, index, i); | |
336 | + } | |
337 | + _this.clearLocation(this.grid_line, this.grid_layer); | |
338 | + } else if (x === "line") { | |
339 | + for (let i = 0; i < res.result.length; i++) { | |
340 | + let index = res.result[i].row + ((res.result[i].layer - 1) * this.grid_row); | |
341 | + index = index - 1; | |
342 | + _this.resShow(res, index, i); | |
436 | 343 | } |
437 | - } else if (res.code !== 200) { | |
438 | - // layer.close(load); | |
439 | - // layer.open({ | |
440 | - // title: '错误', | |
441 | - // content: res.msg | |
442 | - // }); | |
344 | + _this.clearLocation(this.grid_row, this.grid_layer); | |
345 | + } else if (x === "layer") { | |
346 | + for (let i = 0; i < res.result.length; i++) { | |
347 | + let index = res.result[i].icolumn + ((res.result[i].row - 1) * this.grid_line); | |
348 | + index = index - 1; | |
349 | + _this.resShow(res, index, i); | |
350 | + } | |
351 | + _this.clearLocation(this.grid_line, this.grid_row); | |
443 | 352 | } |
444 | - list_info = res.result; | |
445 | - }, | |
446 | - error: function (req, msg) { | |
447 | - console.log(msg); | |
353 | + } else { | |
354 | + this.$message.error(res.message); | |
448 | 355 | } |
356 | + this.list_info = res.result; | |
357 | + }).finally(() => { | |
358 | + | |
449 | 359 | }) |
450 | 360 | }, |
451 | 361 | //库位请求的结果显示 |
452 | 362 | resShow(res, index, i) { |
453 | - // if (res.result[i].deleted === false) { | |
454 | - var row = res.result[i].row; | |
455 | - var jColumn = res.result[i].icolumn; | |
456 | - var kLayer = res.result[i].layer; | |
363 | + let row = res.result[i].row; | |
364 | + let jColumn = res.result[i].icolumn; | |
365 | + let kLayer = res.result[i].layer; | |
457 | 366 | if (res.result[i].locationAttribute === "1") { |
458 | 367 | $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({ |
459 | 368 | "src": grid_rest, |
460 | 369 | "isTrue": 1 |
461 | 370 | }); |
462 | - grid_num_1 = grid_num_1 + 1; | |
463 | 371 | } else if (res.result[i].locationAttribute === "2") { |
464 | 372 | $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({ |
465 | 373 | "src": grid_empty, |
466 | 374 | "isTrue": 1 |
467 | 375 | }); |
468 | - grid_num_2 = grid_num_2 + 1; | |
469 | 376 | } else if (res.result[i].locationAttribute === "3") { |
470 | 377 | $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({ |
471 | 378 | "src": grid_half, |
472 | 379 | "isTrue": 1 |
473 | 380 | }); |
474 | - grid_num_3 = grid_num_3 + 1; | |
475 | 381 | } else if (res.result[i].locationAttribute === "4") { |
476 | 382 | $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({ |
477 | 383 | "src": grid_all, |
478 | 384 | "isTrue": 1 |
479 | 385 | }); |
480 | - grid_num_4 = grid_num_4 + 1; | |
481 | 386 | } else if (res.result[i].locationAttribute === "5") { |
482 | 387 | $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({ |
483 | 388 | "src": grid_emp_lock, |
484 | 389 | "isTrue": 1 |
485 | 390 | }); |
486 | - grid_num_5 = grid_num_5 + 1; | |
487 | 391 | } else if (res.result[i].locationAttribute === "6") { |
488 | 392 | $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({ |
489 | 393 | "src": grid_empty_lock, |
490 | 394 | "isTrue": 1 |
491 | 395 | }); |
492 | - grid_num_6 = grid_num_6 + 1; | |
493 | 396 | } else if (res.result[i].locationAttribute === "7") { |
494 | 397 | $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({ |
495 | 398 | "src": grid_half_lock, |
496 | 399 | "isTrue": 1 |
497 | 400 | }); |
498 | - grid_num_7 = grid_num_7 + 1; | |
499 | 401 | } else if (res.result[i].locationAttribute === "8") { |
500 | 402 | $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({ |
501 | 403 | "src": grid_all_lock, |
502 | 404 | "isTrue": 1 |
503 | 405 | }); |
504 | - grid_num_8 = grid_num_8 + 1; | |
505 | 406 | } else if (res.result[i].locationAttribute === "9") { |
506 | 407 | $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({ |
507 | 408 | "src": grid_emp_waing, |
508 | 409 | "isTrue": 1 |
509 | 410 | }); |
510 | - grid_num_9 = grid_num_9 + 1; | |
511 | 411 | } else if (res.result[i].locationAttribute === "10") { |
512 | 412 | $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({ |
513 | 413 | "src": grid_empty_waring, |
514 | 414 | "isTrue": 1 |
515 | 415 | }); |
516 | - grid_num_10 = grid_num_10 + 1; | |
517 | 416 | } else if (res.result[i].locationAttribute === "11") { |
518 | 417 | $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({ |
519 | 418 | "src": grid_half_waring, |
520 | 419 | "isTrue": 1 |
521 | 420 | }); |
522 | - grid_num_11 = grid_num_11 + 1; | |
523 | 421 | } else if (res.result[i].locationAttribute === "12") { |
524 | 422 | $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({ |
525 | 423 | "src": grid_all_waring, |
526 | 424 | "isTrue": 1 |
527 | 425 | }); |
528 | - grid_num_12 = grid_num_12 + 1; | |
529 | 426 | } |
530 | - | |
531 | 427 | }, |
532 | - | |
533 | 428 | //清除将数据库中没有的库位 |
534 | 429 | clearLocation(x, y) { |
535 | 430 | for (let j = 0; j < x * y; j++) { |
536 | - let sta = $(".grid").eq(j).attr("isTrue"); | |
431 | + let $grid = $(".grid"); | |
432 | + let sta = $grid.eq(j).attr("isTrue"); | |
537 | 433 | if (sta !== "1") { |
538 | - $(".grid").eq(j).attr({"src": rel_empty, "onmouseover": "", "onclick": ""}); | |
434 | + $grid.eq(j).attr({"src": rel_empty, "onmouseover": "", "onclick": ""}); | |
539 | 435 | } |
540 | 436 | } |
541 | 437 | this.spinning = false; |
542 | 438 | this.showPrise = true; |
543 | 439 | this.loading = false; |
544 | 440 | }, |
545 | - | |
546 | 441 | //点击显示当前库位信息 |
547 | 442 | gridMsg(msg) { |
548 | 443 | let $j = $(msg); |
549 | 444 | let row = $j.attr("data-i"); |
550 | 445 | let line = $j.attr("data-j"); |
551 | 446 | let layers = $j.attr("data-k"); |
552 | - | |
553 | 447 | row = parseInt(row); |
554 | 448 | line = parseInt(line); |
555 | 449 | layers = parseInt(layers); |
556 | - if (list_info) {//缓存查询 | |
557 | - for (let i = 0; i < list_info.length; i++) { | |
558 | - if (list_info[i].row === row && list_info[i].icolumn === line && list_info[i].layer === layers) { | |
450 | + //缓存查询 | |
451 | + if (this.list_info) { | |
452 | + for (const element of this.list_info) { | |
453 | + if (element.row === row && element.icolumn === line && element.layer === layers) { | |
559 | 454 | let materialCode = ''; |
560 | - if (list_info[i].materialName) { | |
561 | - let list_batch = ''; | |
562 | - let list_qty = 0; | |
563 | - $("#material").children().remove(); | |
564 | - for (let j = 0; j < list_info[i].materialName.length; j++) { | |
565 | - list_batch = list_info[i].batch[j] === null ? "无" : list_info[i].batch[j] === "" ? "无" : list_info[i].batch[j]; | |
566 | - list_qty += list_info[i].qty[j]; | |
567 | - let str_info = "批次->" + list_batch + ",物料名称->" + list_info[i].materialName[j] + ",物料编码->" + list_info[i].materialCode[j] + | |
568 | - ",数量->" + list_qty + ""; | |
569 | - if (j == list_info[i].materialName.length - 1) { | |
570 | - $("#material").append("<option>" + str_info + "</option>"); | |
571 | - } | |
572 | - currentMaterialCode = list_info[i].materialCode[j] | |
573 | - materialCode = list_info[i].materialCode[j]; | |
455 | + let $material = $("#material"); | |
456 | + if (element.materialName) { | |
457 | + $material.children().remove(); | |
458 | + let str_info = ''; | |
459 | + for (let j = 0; j < element.materialName.length; j++) { | |
460 | + let list_batch = element.batch[j].length === 0 ? "无" : element.batch[j]; | |
461 | + let list_qty = element.qty[j]; | |
462 | + str_info = "批次->" + list_batch + ",物料名称->" + element.materialName[j] + ",物料编码->" + element.materialCode[j] + ",数量->" + list_qty + "\r\n"; | |
463 | + materialCode = element.materialCode[j]; | |
464 | + $material.append("<option>" + str_info + "</option>"); | |
574 | 465 | } |
575 | 466 | } else { |
576 | - $("#material").children().remove(); | |
577 | - $("#material").append("<option>无</option>"); | |
467 | + $material.children().remove(); | |
468 | + $material.append("<option>无</option>"); | |
578 | 469 | } |
579 | - $("#code").val(list_info[i].code); | |
580 | - $("#containerCode").val(list_info[i].containerCode === "" ? "无" : list_info[i].containerCode); | |
581 | - currentContainerCode = list_info[i].containerCode; | |
582 | - currentLocationCode = $("#code").val() | |
583 | - this.revealExpressDelivery(list_info[i].code,materialCode); | |
584 | - this.revealExpressStorage(list_info[i].code); | |
470 | + let $code = $("#code"); | |
471 | + $code.val(element.code); | |
472 | + $("#containerCode").val(element.containerCode === "" ? "无" : element.containerCode); | |
473 | + this.currentContainerCode = element.containerCode; | |
474 | + this.currentLocationCode = $code.val() | |
475 | + this.revealExpressDelivery(element.code, materialCode); | |
476 | + this.revealExpressStorage(element.code); | |
585 | 477 | break; |
586 | 478 | } |
587 | 479 | } |
... | ... | @@ -589,129 +481,55 @@ export default { |
589 | 481 | return "" |
590 | 482 | } |
591 | 483 | }, |
592 | - | |
593 | - //页面初始化请求 | |
594 | - resetAjax(zoneCode) { | |
595 | - var _this = this; | |
596 | - $.ajax({ | |
597 | - url: window._CONFIG['domianURL'] + prefix + "/getAllLocation", | |
598 | - type: "post", | |
599 | - data: { | |
600 | - zoneCode: zoneCode | |
601 | - }, | |
602 | - headers: { | |
603 | - "X-Access-Token": Vue.ls.get(ACCESS_TOKEN) | |
604 | - }, | |
605 | - success: function (res) { | |
606 | - grid_row = res.result.maxRow; | |
607 | - grid_line = res.result.maxLine; | |
608 | - grid_layer = res.result.maxLayer; | |
609 | - //初始格子 | |
610 | - $("#location").children().remove(); | |
611 | - for (let i = 1; i <= grid_layer; i++) { | |
612 | - // var index=i+1;<span style='margin-top:30px'>第"+ index +"行</span> | |
613 | - $(".location").append("<br>"); | |
614 | - for (let j = 1; j <= grid_line; j++) { | |
615 | - // $(".location").append("<img data-i='1' data-j="+j+" data-k="+ i +" class='grid'>"); | |
616 | - $(".location").append("<img v-html data-i='1' data-j=" + j + " data-k=" + i + " class='grid' onmouseove='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>"); | |
617 | - } | |
618 | - } | |
619 | - let num = $("#editable-select").val(); | |
620 | - $("#editable-num").children().remove(); | |
621 | - if (num === "row") { | |
622 | - for (let i = 1; i <= grid_row; i++) { | |
623 | - $("#editable-num").append("<option value='" + i + "'>" + i + "</option>") | |
624 | - } | |
625 | - } else if (num === "line") { | |
626 | - for (let i = 1; i <= grid_line; i++) { | |
627 | - $("#editable-num").append("<option value='" + i + "'>" + i + "</option>") | |
628 | - } | |
629 | - } else if (num === "layer") { | |
630 | - for (let i = 1; i <= grid_layer; i++) { | |
631 | - $("#editable-num").append("<option value='" + i + "'>" + i + "</option>") | |
632 | - } | |
633 | - } | |
634 | - _this.Search(); | |
635 | - } | |
636 | - }); | |
637 | - }, | |
638 | 484 | //搜索平面库位 |
639 | - Search() { | |
485 | + search() { | |
640 | 486 | this.spinning = true; |
641 | 487 | this.showPrise = false; |
642 | 488 | this.loading = true; |
643 | - let index = $("#editable-select").val(); | |
644 | - let num = $("#editable-num").val(); | |
645 | - let zoneCode = ""; | |
646 | - | |
647 | - $("#code").val(""); | |
648 | - $("#containerCode").val(""); | |
649 | - $("#material").children().remove(); | |
650 | - $("#material").append("<option>无</option>"); | |
489 | + let col = this.col; | |
490 | + let num = this.num; | |
651 | 491 | let data; |
652 | - this.seachZone(); | |
653 | - if (index === "row") { | |
492 | + | |
493 | + $("#location").children().remove(); | |
494 | + let $location = $(".location"); | |
495 | + if (col === "row") { | |
654 | 496 | data = {zoneCode: this.zoneCode, row: num}; |
655 | - $("#location").children().remove(); | |
656 | - for (let i = grid_layer; i > 0; i--) { | |
657 | - $(".location").append("<br><span style='display: inline-block;text-align: right;width: 50px; margin-right: 10px;'>第" + i + "层</span>"); | |
658 | - for (let j = 1; j <= grid_line; j++) { | |
659 | - $(".location").append("<img data-i=" + num + " data-j=" + j + " data-k=" + i + " class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>"); | |
497 | + for (let i = this.grid_layer; i > 0; i--) { | |
498 | + $location.append("<br><span style='display: inline-block;text-align: right;width: 50px; margin-right: 10px;'>第" + i + "层</span>"); | |
499 | + for (let j = 1; j <= this.grid_line; j++) { | |
500 | + $location.append("<img data-i=" + num + " data-j=" + j + " data-k=" + i + " class='grid' onmouseover='lays(this)' onmouseout='mClose(this)' onclick='gridMsg(this)'>"); | |
660 | 501 | } |
661 | 502 | } |
662 | - // this.changeMargin(); | |
663 | - this.ajaxGrid(index, data); | |
664 | - } else if (index === "line") { | |
503 | + } else if (col === "line") { | |
665 | 504 | data = {zoneCode: this.zoneCode, line: num}; |
666 | - $("#location").children().remove(); | |
667 | - for (let k = grid_layer; k > 0; k--) { | |
668 | - $(".location").append("<br><span style='display: inline-block;text-align: right;width: 50px; margin-right: 10px;'>第" + k + "层</span>"); | |
669 | - for (let l = 1; l <= grid_row; l++) { | |
670 | - $(".location").append("<img data-i=" + l + " data-j=" + num + " data-k=" + k + " class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>"); | |
505 | + for (let k = this.grid_layer; k > 0; k--) { | |
506 | + $location.append("<br><span style='display: inline-block;text-align: right;width: 50px; margin-right: 10px;'>第" + k + "层</span>"); | |
507 | + for (let l = 1; l <= this.grid_row; l++) { | |
508 | + $location.append("<img data-i=" + l + " data-j=" + num + " data-k=" + k + " class='grid' onmouseover='lays(this)' onmouseout='mClose(this)' onclick='gridMsg(this)'>"); | |
671 | 509 | } |
672 | 510 | } |
673 | - // this.changeMargin(); | |
674 | - this.ajaxGrid(index, data); | |
675 | - } else if (index === "layer") { | |
511 | + } else if (col === "layer") { | |
676 | 512 | data = {zoneCode: this.zoneCode, layer: num}; |
677 | - $("#location").children().remove(); | |
678 | - for (let m = 1; m <= grid_row; m++) { | |
679 | - $(".location").append("<br><span style='display: inline-block;text-align: right;width: 50px; margin-right: 10px;'>第" + m + "行</span>"); | |
680 | - for (let n = 1; n <= grid_line; n++) { | |
681 | - $(".location").append("<img data-i=" + m + " data-j=" + n + " data-k=" + num + " class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>"); | |
513 | + for (let m = 1; m <= this.grid_row; m++) { | |
514 | + $location.append("<br><span style='display: inline-block;text-align: right;width: 50px; margin-right: 10px;'>第" + m + "行</span>"); | |
515 | + for (let n = 1; n <= this.grid_line; n++) { | |
516 | + $location.append("<img data-i=" + m + " data-j=" + n + " data-k=" + num + " class='grid' onmouseover='lays(this)' onmouseout='mClose(this)' onclick='gridMsg(this)'>"); | |
682 | 517 | } |
683 | 518 | } |
684 | - // this.changeMargin(); | |
685 | - this.ajaxGrid(index, data); | |
686 | 519 | } |
520 | + this.ajaxGrid(col, data); | |
687 | 521 | }, |
688 | - seachZone() { | |
689 | - let _this = this | |
690 | - | |
691 | - $.ajax({ | |
692 | - url: window._CONFIG['domianURL'] + prefix + "/getStatus", | |
693 | - data: { | |
694 | - zoneCode: _this.zoneCode | |
695 | - }, | |
696 | - headers: { | |
697 | - "X-Access-Token": Vue.ls.get(ACCESS_TOKEN) | |
698 | - }, | |
699 | - success: function (response) { | |
700 | - if (response.code == 200) { | |
701 | - $("#zone").val("库位总数:" + response.result.location + ", 空库位:" + response.result.emptyLocation + | |
702 | - ", 空托盘库位:" + response.result.haveContainLocation + ", 有货库位:" + response.result.haveInventoryLocation) | |
703 | - } else { | |
704 | - alert(response.message) | |
705 | - } | |
706 | - }, | |
707 | - error: function () { | |
708 | - alert("未知的错误") | |
522 | + locationStatistics() { | |
523 | + let url = this.url.getStatus; | |
524 | + getAction(url, {zoneCode: this.zoneCode}).then(res => { | |
525 | + if (res.success) { | |
526 | + $("#zone").val("库位总数:" + res.result.location + ",空库位:" + res.result.emptyLocation + | |
527 | + ",空托盘库位:" + res.result.haveContainLocation + ",有货库位:" + res.result.haveInventoryLocation) | |
528 | + } else { | |
529 | + this.$message.warning(res.message) | |
709 | 530 | } |
710 | - }) | |
711 | - }, | |
531 | + }).finally() | |
532 | + } | |
712 | 533 | } |
713 | 534 | } |
714 | -</script> | |
715 | - | |
716 | -<style scoped> | |
717 | -</style> | |
718 | 535 | \ No newline at end of file |
536 | +</script> | |
719 | 537 | \ No newline at end of file |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/locationMonitor/controller/LocationMonitorController.java
... | ... | @@ -9,6 +9,7 @@ import java.util.stream.Collectors; |
9 | 9 | import javax.annotation.Resource; |
10 | 10 | import javax.servlet.http.HttpServletRequest; |
11 | 11 | |
12 | +import cn.hutool.core.util.ObjectUtil; | |
12 | 13 | import org.jeecg.common.api.vo.Result; |
13 | 14 | import org.jeecg.modules.wms.config.container.entity.Container; |
14 | 15 | import org.jeecg.modules.wms.config.container.service.IContainerService; |
... | ... | @@ -40,7 +41,8 @@ import lombok.extern.slf4j.Slf4j; |
40 | 41 | @RequestMapping("/location/locationMonitor") |
41 | 42 | @Slf4j |
42 | 43 | public class LocationMonitorController { |
43 | - @Autowired | |
44 | + | |
45 | + @Resource | |
44 | 46 | private IContainerService containerService; |
45 | 47 | @Resource |
46 | 48 | private ILocationService locationService; |
... | ... | @@ -51,7 +53,6 @@ public class LocationMonitorController { |
51 | 53 | * 库存概括 |
52 | 54 | */ |
53 | 55 | @GetMapping("/getStatus") |
54 | - @ResponseBody | |
55 | 56 | public Result<?> getStatus(String zoneCode, HttpServletRequest req) { |
56 | 57 | LambdaQueryWrapper<Location> queryWrapper = Wrappers.lambdaQuery(); |
57 | 58 | HuahengJwtUtil.setWarehouseCode(queryWrapper, Location.class, req); |
... | ... | @@ -95,16 +96,20 @@ public class LocationMonitorController { |
95 | 96 | * 查询库位列表 |
96 | 97 | */ |
97 | 98 | @PostMapping("/getLocationInfo") |
98 | - @ResponseBody | |
99 | - public Result<?> getLocationInfo(String zoneCode, String row, String line, String layer, String grid, HttpServletRequest req) { | |
99 | + public Result<?> getLocationInfo(@RequestBody Location inLocation, HttpServletRequest req) { | |
100 | + String zoneCode = inLocation.getZoneCode(); | |
100 | 101 | if (StringUtils.isEmpty(zoneCode)) { |
101 | 102 | return Result.error("zoneCode 不能为空"); |
102 | 103 | } |
104 | + Integer row = inLocation.getRow(); | |
105 | + Integer line = inLocation.getIcolumn(); | |
106 | + Integer layer = inLocation.getLayer(); | |
107 | + Integer grid = inLocation.getGrid(); | |
103 | 108 | /* 查询库位信息 */ |
104 | 109 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); |
105 | 110 | HuahengJwtUtil.setWarehouseCode(locationLambdaQueryWrapper, Location.class, req); |
106 | - locationLambdaQueryWrapper.eq(StringUtils.isNotEmpty(row), Location::getRow, row).eq(StringUtils.isNotEmpty(line), Location::getIcolumn, line) | |
107 | - .eq(StringUtils.isNotEmpty(layer), Location::getLayer, layer).eq(StringUtils.isNotEmpty(grid), Location::getGrid, grid) | |
111 | + locationLambdaQueryWrapper.eq(ObjectUtil.isNotNull(row), Location::getRow, row).eq(ObjectUtil.isNotNull(line), Location::getIcolumn, line) | |
112 | + .eq(ObjectUtil.isNotNull(layer), Location::getLayer, layer).eq(ObjectUtil.isNotNull(grid), Location::getGrid, grid) | |
108 | 113 | .eq(StringUtils.isNotEmpty(zoneCode), Location::getZoneCode, zoneCode); |
109 | 114 | List<Location> locations = locationService.list(locationLambdaQueryWrapper); |
110 | 115 | List<Location> locationList = new ArrayList<>(); |
... | ... | @@ -115,13 +120,13 @@ public class LocationMonitorController { |
115 | 120 | HuahengJwtUtil.setWarehouseCode(inventoryDetailLambda, InventoryDetail.class, req); |
116 | 121 | List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambda); |
117 | 122 | |
118 | - for (Location location1 : locations) { | |
123 | + for (Location location : locations) { | |
119 | 124 | List<InventoryDetail> inventoryDetails = |
120 | - inventoryDetailList.stream().filter(inventoryDetail1 -> inventoryDetail1.getLocationCode().equals(location1.getCode())).collect(Collectors.toList()); | |
125 | + inventoryDetailList.stream().filter(inventoryDetail1 -> inventoryDetail1.getLocationCode().equals(location.getCode())).collect(Collectors.toList()); | |
121 | 126 | |
122 | 127 | int locationAttribute = 0; |
123 | - String status = location1.getStatus(); | |
124 | - String containerCode = location1.getContainerCode(); | |
128 | + String status = location.getStatus(); | |
129 | + String containerCode = location.getContainerCode(); | |
125 | 130 | List<String> materialNameList = inventoryDetails.stream().map(InventoryDetail::getMaterialName).collect(Collectors.toList()); |
126 | 131 | List<String> batchList = inventoryDetails.stream().map(InventoryDetail::getBatch).collect(Collectors.toList()); |
127 | 132 | List<String> materialCodeList = inventoryDetails.stream().map(InventoryDetail::getMaterialCode).collect(Collectors.toList()); |
... | ... | @@ -133,10 +138,10 @@ public class LocationMonitorController { |
133 | 138 | if (inventoryDetails.size() == 0) { |
134 | 139 | locationAttribute = LocationStatus.IDLE_EMPTY_CONTAINER; |
135 | 140 | } else { |
136 | - location1.setMaterialName(materialNameList); | |
137 | - location1.setMaterialCode(materialCodeList); | |
138 | - location1.setBatch(batchList); | |
139 | - location1.setQty(qtyList); | |
141 | + location.setMaterialName(materialNameList); | |
142 | + location.setMaterialCode(materialCodeList); | |
143 | + location.setBatch(batchList); | |
144 | + location.setQty(qtyList); | |
140 | 145 | locationAttribute = LocationStatus.IDLE_SOME_CONTAINER; |
141 | 146 | } |
142 | 147 | } |
... | ... | @@ -147,17 +152,17 @@ public class LocationMonitorController { |
147 | 152 | if (inventoryDetails.size() == 0) { |
148 | 153 | locationAttribute = LocationStatus.LOCK_EMPTY_CONTAINER; |
149 | 154 | } else { |
150 | - location1.setMaterialName(materialNameList); | |
151 | - location1.setMaterialCode(materialCodeList); | |
152 | - location1.setBatch(batchList); | |
153 | - location1.setQty(qtyList); | |
155 | + location.setMaterialName(materialNameList); | |
156 | + location.setMaterialCode(materialCodeList); | |
157 | + location.setBatch(batchList); | |
158 | + location.setQty(qtyList); | |
154 | 159 | locationAttribute = LocationStatus.LOCK_SOME_CONTAINER; |
155 | 160 | } |
156 | 161 | } |
157 | 162 | } |
158 | 163 | |
159 | - location1.setLocationAttribute(String.valueOf(locationAttribute)); | |
160 | - locationList.add(location1); | |
164 | + location.setLocationAttribute(String.valueOf(locationAttribute)); | |
165 | + locationList.add(location); | |
161 | 166 | } |
162 | 167 | return Result.ok(locations); |
163 | 168 | } |
... | ... | @@ -165,8 +170,7 @@ public class LocationMonitorController { |
165 | 170 | /** |
166 | 171 | * 查询库位列表 |
167 | 172 | */ |
168 | - @PostMapping("/getAllLocation") | |
169 | - @ResponseBody | |
173 | + @GetMapping("/getAllLocation") | |
170 | 174 | public Result<?> getAllLocation(@RequestParam(name = "zoneCode") String zoneCode, HttpServletRequest req) { |
171 | 175 | if (StringUtils.isEmpty(zoneCode)) { |
172 | 176 | return Result.error("zoneCode 不能为空"); |
... | ... | @@ -176,5 +180,4 @@ public class LocationMonitorController { |
176 | 180 | HuahengJwtUtil.setWarehouseCode(req, location); |
177 | 181 | return Result.ok(locationService.getAllLocation(location)); |
178 | 182 | } |
179 | - | |
180 | 183 | } |
... | ... |