Commit 7018cfc9aaaa10b37c77e19757bb0ad16be4044c
1 parent
1904e1f5
增加批量实盘登记
Showing
7 changed files
with
298 additions
and
14 deletions
ant-design-vue-jeecg/src/api/api.js
... | ... | @@ -314,6 +314,8 @@ export const getInventoryDetailByLocationCode = (params) => getAction('/inventor |
314 | 314 | export const quickShipment = (params) => postAction("/task/taskHeader/quickShipment", params); |
315 | 315 | //出库复核 |
316 | 316 | export const shipmentCheck = (params) => postAction("/shipment/shipmentCombination/shipmentCheck", params); |
317 | +//查询盘点明细子表 | |
318 | +export const listCycleDetailChildByDetailId = (params) => postAction("/cycleCountDetail/cycleCountDetail/listCycleDetailChildByDetailId", params); | |
317 | 319 | |
318 | 320 | // 中转HTTP请求 |
319 | 321 | export const transitRESTful = { |
... | ... |
ant-design-vue-jeecg/src/views/system/stocktaking/CycleCountDetailList.vue
... | ... | @@ -74,13 +74,12 @@ |
74 | 74 | </template> |
75 | 75 | <template slot="action" slot-scope="text, record"> |
76 | 76 | <cycle-count-detail-chi-id-modal ref="adjustmentModal" @ok="modalFormOk" :id="record.id"/> |
77 | - <a v-if="record.enableStatus != '100'" @click="createMany()"><a-icon/>新增</a> | |
78 | - <a-divider type="vertical"/> | |
77 | + <a v-if="record.enableStatus != '100'" @click="createMany()"><a-icon/>新增 <a-divider type="vertical"/></a> | |
79 | 78 | <a-popconfirm v-if="record.enableStatus === 1" v-has="'cycleCountHeader:delete'" title="确定删除吗?" @confirm="() => handleDelete(record.id)"> |
80 | 79 | <a>删除 <a-divider type="vertical"/> </a> |
81 | 80 | </a-popconfirm> |
82 | 81 | <a v-if="record.enableStatus == '1' && record.zoneType == 'L'" @click="selectPort(record)">生成盘点任务 <a-divider type="vertical"/></a> |
83 | - | |
82 | + <a v-if="record.enableStatus != '100'" @click="cycleConfirm(record.id)"><a-icon/>盘点登记 <a-divider type="vertical"/></a> | |
84 | 83 | <a @click="loadDatas(record.cycleCountHeadId)"><a-icon type="sync"/>刷新</a> |
85 | 84 | </template> |
86 | 85 | |
... | ... | @@ -92,6 +91,7 @@ |
92 | 91 | |
93 | 92 | <cycle-count-select-modal ref="modalForm2"></cycle-count-select-modal> |
94 | 93 | <cycle-count-detail-modal ref="modalForm" @ok="modalFormOk"/> |
94 | + <cycle-count-confirm-modal ref="modalForm3" @ok="modalFormOk"/> | |
95 | 95 | |
96 | 96 | </a-card> |
97 | 97 | </template> |
... | ... | @@ -107,12 +107,14 @@ |
107 | 107 | import {createCycleCoutTaskByDetailId, stockTakeTask} from "@/api/api"; |
108 | 108 | import Utils from "../../../components/jeecgbiz/JButtonBizComponent/util.js" |
109 | 109 | import CycleCountDetailChiIdModal from "./modules/CycleCountDetailChiIdModal"; |
110 | + import CycleCountConfirmModal from "@views/system/stocktaking/modules/CycleCountConfirmModal.vue"; | |
110 | 111 | |
111 | 112 | export default { |
112 | 113 | name: 'CycleCountDetailList', |
113 | 114 | cycleCountDetailId:'', |
114 | 115 | mixins: [JeecgListMixin], |
115 | 116 | components: { |
117 | + CycleCountConfirmModal, | |
116 | 118 | CycleCountDetailModal, |
117 | 119 | CycleCountDetailChildSubTable, |
118 | 120 | CycleCountSelectModal, |
... | ... | @@ -353,6 +355,11 @@ |
353 | 355 | this.$refs.adjustmentModal.edit(); |
354 | 356 | this.$refs.adjustmentModal.title = "新增"; |
355 | 357 | }, |
358 | + | |
359 | + cycleConfirm(record) { | |
360 | + this.$refs.modalForm3.edit(record); | |
361 | + this.$refs.modalForm3.title = "盘点登记"; | |
362 | + }, | |
356 | 363 | } |
357 | 364 | } |
358 | 365 | </script> |
... | ... |
ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountConfirmModal.vue
0 → 100644
1 | +<template> | |
2 | + <j-modal | |
3 | + :title="title" | |
4 | + :width="width" | |
5 | + :visible="visible" | |
6 | + :confirmLoading="confirmLoading" | |
7 | + switchFullscreen | |
8 | + @ok="handleOk" | |
9 | + @cancel="handleCancel" | |
10 | + cancelText="关闭" | |
11 | + > | |
12 | + | |
13 | + <a-spin :spinning="confirmLoading"> | |
14 | + <a-form-model ref="form" :model="model" :rules="validatorRules"> | |
15 | + | |
16 | + </a-form-model> | |
17 | + </a-spin> | |
18 | + | |
19 | + <a-table ref="table" rowKey="id" size="middle" :columns="columns" :dataSource="dataSource" :pagination="false"> | |
20 | + <span slot="action" slot-scope="text, record"> | |
21 | + <a-input-number placeholder="" v-model="record.countedQty" :value="text" /> | |
22 | + </span> | |
23 | + | |
24 | + | |
25 | + <span slot="inventoryStatus" slot-scope="inventoryStatus"> | |
26 | + <a-tag :key="inventoryStatus" color="blue" :color="getStatusColor(inventoryStatus)"> | |
27 | + {{ solutionInvStatus(inventoryStatus) }} | |
28 | + </a-tag> | |
29 | + </span> | |
30 | + | |
31 | + </a-table> | |
32 | + </j-modal> | |
33 | + | |
34 | +</template> | |
35 | + | |
36 | +<script> | |
37 | +import { httpAction } from '@/api/manage' | |
38 | +import { mixinDevice } from '@/utils/mixin' | |
39 | +import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |
40 | +import { filterMultiDictText } from '@/components/dict/JDictSelectUtil' | |
41 | +import { validateDuplicateValue } from '@/utils/util' | |
42 | +import {listCycleDetailChildByDetailId, queryCycleCountDetailChildByMainId, searchMaterialByCode} from '@/api/api' | |
43 | +import { listReceiveByReceiveId,ajaxGetDictItems } from '@/api/api' | |
44 | + | |
45 | +export default { | |
46 | + name: 'CycleCountConfirmModal', | |
47 | + components: {}, | |
48 | + props: { | |
49 | + mainId: { | |
50 | + type: String, | |
51 | + required: false, | |
52 | + default: '' | |
53 | + } | |
54 | + }, | |
55 | + data() { | |
56 | + return { | |
57 | + title: '操作', | |
58 | + width: 800, | |
59 | + visible: false, | |
60 | + materialList: {}, | |
61 | + querySource: {}, | |
62 | + dataSource: [], | |
63 | + invStatus:[], | |
64 | + model: {}, | |
65 | + labelCol: { | |
66 | + xs: { span: 24 }, | |
67 | + sm: { span: 5 } | |
68 | + }, | |
69 | + wrapperCol: { | |
70 | + xs: { span: 24 }, | |
71 | + sm: { span: 16 } | |
72 | + }, | |
73 | + columns: [ | |
74 | + { | |
75 | + title: '物料编码', | |
76 | + dataIndex: 'materialCode', | |
77 | + align: 'center', | |
78 | + width: 124 | |
79 | + }, | |
80 | + { | |
81 | + title: '物料名称', | |
82 | + dataIndex: 'materialName', | |
83 | + align: 'center', | |
84 | + width: 96 | |
85 | + }, | |
86 | + { | |
87 | + title: '库存状态', | |
88 | + dataIndex: 'inventoryStatus', | |
89 | + align: 'center', | |
90 | + width: 96, | |
91 | + scopedSlots: {customRender: 'inventoryStatus'} | |
92 | + }, | |
93 | + { | |
94 | + title: '批次', | |
95 | + dataIndex: 'batch', | |
96 | + align: 'center' | |
97 | + }, | |
98 | + { | |
99 | + title: '系统数量', | |
100 | + dataIndex: 'systemQty', | |
101 | + align: 'center', | |
102 | + width: 80 | |
103 | + }, | |
104 | + { | |
105 | + title: '实盘数量', | |
106 | + dataIndex: 'countedQty', | |
107 | + align: 'center', | |
108 | + key: 'countedQty', | |
109 | + scopedSlots: { customRender: 'action' } | |
110 | + }, | |
111 | + ], | |
112 | + confirmLoading: false, | |
113 | + validatorRules: { | |
114 | + containerCode: [{ required: true, message: '请输入容器编码!' }] | |
115 | + }, | |
116 | + dictOptions: {}, | |
117 | + superFieldList:[], | |
118 | + url: { | |
119 | + batchConfirmGapQty: '/cycleCountDetail/cycleCountDetail/batchConfirmGapQty', | |
120 | + } | |
121 | + } | |
122 | + }, | |
123 | + created() { | |
124 | + //备份model原始值 | |
125 | + this.getSuperFieldList() | |
126 | + // this.modelDefault = JSON.parse(JSON.stringify(this.model)) | |
127 | + this.loadFrom(); | |
128 | + }, | |
129 | + methods: { | |
130 | + loadFrom(){ | |
131 | + ajaxGetDictItems('inventory_status').then((res) => { | |
132 | + if (res.success) { | |
133 | + this.invStatus = res.result | |
134 | + } | |
135 | + }) | |
136 | + }, | |
137 | + getStatusColor(status) { | |
138 | + const colors = { | |
139 | + 'good ': 'green', | |
140 | + 'defective': 'red', | |
141 | + 'discussed ': 'grey', | |
142 | + 'scrap': 'purple', | |
143 | + default: 'blue' | |
144 | + }; | |
145 | + return colors[status] || colors.default; | |
146 | + }, | |
147 | + getContainerCode(e){ | |
148 | + this.$nextTick(function (){ | |
149 | + let record={containerCode: e} | |
150 | + this.model = Object.assign({}, record) | |
151 | + }) | |
152 | + }, | |
153 | + solutionInvStatus(value) { | |
154 | + var actions = [] | |
155 | + Object.keys(this.invStatus).some(key => { | |
156 | + if (this.invStatus[key].value == '' + value) { | |
157 | + actions.push(this.invStatus[key].text) | |
158 | + return true | |
159 | + } | |
160 | + }) | |
161 | + return actions.join('') | |
162 | + }, | |
163 | + | |
164 | + edit(record) { | |
165 | + this.model = Object.assign({}, record) | |
166 | + this.visible = true | |
167 | + this.searchCycle(record); | |
168 | + }, | |
169 | + | |
170 | + selectContainer(record){ | |
171 | + this.$refs.selectContainerForm.edit(record); | |
172 | + }, | |
173 | + close() { | |
174 | + this.$emit('close') | |
175 | + this.visible = false | |
176 | + this.$refs.form.clearValidate() | |
177 | + }, | |
178 | + searchCycle(record) { | |
179 | + console.log("searchCycle " + record); | |
180 | + const that = this | |
181 | + that.querySource.id = record; | |
182 | + listCycleDetailChildByDetailId(that.querySource).then(res => { | |
183 | + that.dataSource = res.result | |
184 | + }) | |
185 | + }, | |
186 | + initDictConfig() {}, | |
187 | + getSuperFieldList() { | |
188 | + let fieldList = [] | |
189 | + fieldList.push({type:'string',value:'inventoryStatus',text:'库存状态',dictCode:'inventory_status'}) | |
190 | + this.superFieldList = fieldList | |
191 | + }, | |
192 | + handleOk() { | |
193 | + console.log('handleOk') | |
194 | + const that = this | |
195 | + // 触发表单验证 | |
196 | + this.$refs.form.validate(valid => { | |
197 | + if (valid) { | |
198 | + that.confirmLoading = true | |
199 | + let httpurl = '' | |
200 | + let method = '' | |
201 | + httpurl += this.url.batchConfirmGapQty | |
202 | + method = 'post' | |
203 | + if (this.dataSource[0] == null) { | |
204 | + that.confirmLoading = false | |
205 | + that.$message.warning('没有盘点明细!') | |
206 | + return | |
207 | + } | |
208 | + httpAction(httpurl, this.dataSource, method) | |
209 | + .then(res => { | |
210 | + if (res.success) { | |
211 | + that.$message.success(res.message) | |
212 | + that.$emit('ok') | |
213 | + that.close() | |
214 | + } else { | |
215 | + that.$message.warning(res.message) | |
216 | + } | |
217 | + }) | |
218 | + .finally(() => { | |
219 | + that.confirmLoading = false | |
220 | + }) | |
221 | + } else { | |
222 | + return false | |
223 | + } | |
224 | + }) | |
225 | + }, | |
226 | + handleCancel() { | |
227 | + this.close() | |
228 | + } | |
229 | + } | |
230 | +} | |
231 | +</script> | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentDetailServiceImpl.java
... | ... | @@ -217,13 +217,13 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, |
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
220 | -// @Override | |
221 | -// @Transactional(rollbackFor = Exception.class) | |
222 | -// public Result removeDetailListById(List<String> idList) { | |
223 | -// Result result = null; | |
224 | -// for (String id : idList) { | |
225 | -// result = shipmentHeaderService.deleteShipmentDetail(id); | |
226 | -// } | |
227 | -// return result; | |
228 | -// } | |
220 | + @Override | |
221 | + @Transactional(rollbackFor = Exception.class) | |
222 | + public Result removeDetailListById(List<String> idList) { | |
223 | + Result result = null; | |
224 | + for (String id : idList) { | |
225 | + result = shipmentHeaderService.deleteShipmentDetail(id); | |
226 | + } | |
227 | + return result; | |
228 | + } | |
229 | 229 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/controller/CycleCountDetailController.java
1 | 1 | package org.jeecg.modules.wms.stocktaking.cycleCountDetail.controller; |
2 | 2 | |
3 | 3 | import java.io.IOException; |
4 | +import java.math.BigDecimal; | |
4 | 5 | import java.util.ArrayList; |
5 | 6 | import java.util.Arrays; |
6 | 7 | import java.util.List; |
... | ... | @@ -14,6 +15,7 @@ import javax.servlet.http.HttpServletResponse; |
14 | 15 | import org.apache.shiro.SecurityUtils; |
15 | 16 | import org.jeecg.common.api.vo.Result; |
16 | 17 | import org.jeecg.common.aspect.annotation.AutoLog; |
18 | +import org.jeecg.common.exception.JeecgBootException; | |
17 | 19 | import org.jeecg.common.system.query.QueryGenerator; |
18 | 20 | import org.jeecg.common.system.vo.LoginUser; |
19 | 21 | import org.jeecg.common.util.oConvertUtils; |
... | ... | @@ -49,6 +51,7 @@ import org.springframework.web.servlet.ModelAndView; |
49 | 51 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
50 | 52 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
51 | 53 | import com.baomidou.mybatisplus.core.metadata.IPage; |
54 | +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |
52 | 55 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
53 | 56 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
54 | 57 | |
... | ... | @@ -271,6 +274,30 @@ public class CycleCountDetailController extends HuahengBaseController { |
271 | 274 | } |
272 | 275 | |
273 | 276 | /** |
277 | + * 实盘登记 | |
278 | + * @return | |
279 | + */ | |
280 | + @PostMapping("/batchConfirmGapQty") | |
281 | + @ResponseBody | |
282 | + public Result batchConfirmGapQty(@RequestBody List<CycleCountDetail> cycleCountDetailList) { | |
283 | + if (CollectionUtils.isEmpty(cycleCountDetailList)) { | |
284 | + return Result.error("批量实盘登记失败参数为空"); | |
285 | + } | |
286 | + for (CycleCountDetail cycleCountDetail : cycleCountDetailList) { | |
287 | + int id = cycleCountDetail.getId(); | |
288 | + BigDecimal countedQty = cycleCountDetail.getCountedQty(); | |
289 | + if (countedQty == null) { | |
290 | + throw new JeecgBootException("批量实盘登记失败参数为空"); | |
291 | + } | |
292 | + Result result = cycleCountDetailChildService.confirmGapQty(String.valueOf(id), String.valueOf(countedQty), null); | |
293 | + if (!result.isSuccess()) { | |
294 | + throw new JeecgBootException(result.getMessage()); | |
295 | + } | |
296 | + } | |
297 | + return Result.ok("批量实盘登记成功"); | |
298 | + } | |
299 | + | |
300 | + /** | |
274 | 301 | * 通过id查询 |
275 | 302 | * @param id |
276 | 303 | * @return |
... | ... | @@ -288,6 +315,15 @@ public class CycleCountDetailController extends HuahengBaseController { |
288 | 315 | return Result.OK(page); |
289 | 316 | } |
290 | 317 | |
318 | + @PostMapping("/listCycleDetailChildByDetailId") | |
319 | + @ResponseBody | |
320 | + public Result listCycleDetailChildByDetailId(@RequestBody CycleCountDetail cycleCountDetail) { | |
321 | + LambdaQueryWrapper<CycleCountDetailChild> cycleCountDetailChildLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
322 | + cycleCountDetailChildLambdaQueryWrapper.eq(CycleCountDetailChild::getCycleCountDetailid, cycleCountDetail.getId()); | |
323 | + List<CycleCountDetailChild> cycleCountDetailChildList = cycleCountDetailChildService.list(cycleCountDetailChildLambdaQueryWrapper); | |
324 | + return Result.OK(cycleCountDetailChildList); | |
325 | + } | |
326 | + | |
291 | 327 | /** |
292 | 328 | * 导出excel |
293 | 329 | * @param request |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailChildServiceImpl.java
... | ... | @@ -105,6 +105,9 @@ public class CycleCountDetailChildServiceImpl extends ServiceImpl<CycleCountDeta |
105 | 105 | if (StringUtils.isEmpty(zoneType)) { |
106 | 106 | return Result.error("实盘登记, 盘点明细" + id + "库区类型为空!"); |
107 | 107 | } |
108 | + if (countedQty == null) { | |
109 | + return Result.error("实盘登记数不能为空"); | |
110 | + } | |
108 | 111 | BigDecimal qty = new BigDecimal(countedQty); |
109 | 112 | if (qty.compareTo(BigDecimal.ZERO) == -1) { |
110 | 113 | return Result.error("实盘登记数不能小于0"); |
... | ... | @@ -145,7 +148,9 @@ public class CycleCountDetailChildServiceImpl extends ServiceImpl<CycleCountDeta |
145 | 148 | BigDecimal ystem_qty = new BigDecimal(0); |
146 | 149 | BigDecimal gap_qty = new BigDecimal(0); |
147 | 150 | for (CycleCountDetailChild cycleCountDetailChild : cycleCountDetailChildList) { |
148 | - counted_qty = counted_qty.add(cycleCountDetailChild.getCountedQty()); | |
151 | + if (cycleCountDetailChild.getCountedQty() != null) { | |
152 | + counted_qty = counted_qty.add(cycleCountDetailChild.getCountedQty()); | |
153 | + } | |
149 | 154 | ystem_qty = ystem_qty.add(cycleCountDetailChild.getSystemQty()); |
150 | 155 | gap_qty = gap_qty.add(cycleCountDetailChild.getGapQty()); |
151 | 156 | } |
... | ... | @@ -229,6 +234,9 @@ public class CycleCountDetailChildServiceImpl extends ServiceImpl<CycleCountDeta |
229 | 234 | if (child.getChildStatus().equals(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED)) { |
230 | 235 | continue; |
231 | 236 | } |
237 | + if (child.getCountedQty() == null) { | |
238 | + continue; | |
239 | + } | |
232 | 240 | if (child.getCountedQty().compareTo(BigDecimal.ZERO) == 0) { |
233 | 241 | continue; |
234 | 242 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java
... | ... | @@ -243,7 +243,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap |
243 | 243 | cycleCountDetailChild.setBatch(inventoryDetail.getBatch()); |
244 | 244 | cycleCountDetailChild.setLot(inventoryDetail.getLot()); |
245 | 245 | cycleCountDetailChild.setSystemQty(inventoryDetail.getQty()); |
246 | - cycleCountDetailChild.setCountedQty(BigDecimal.ZERO); | |
246 | +// cycleCountDetailChild.setCountedQty(BigDecimal.ZERO); | |
247 | 247 | cycleCountDetailChild.setGapQty(BigDecimal.ZERO); |
248 | 248 | cycleCountDetailChild.setInventoryDetaiId(inventoryDetail.getId()); |
249 | 249 | cycleCountDetailChildServiceImpl.save(cycleCountDetailChild); |
... | ... |