Commit c4459e30a363a927e388360c0cc243dc00b0e8a0
1 parent
48308bd0
增加库存新增功能
Showing
10 changed files
with
307 additions
and
11 deletions
ant-design-vue-jeecg/src/api/api.js
... | ... | @@ -306,8 +306,10 @@ export const flatReceipt = (params) => postAction('/receipt/receiveHeader/flatRe |
306 | 306 | export const createSerialMaterial = (params) => postAction('/config/materialSn/batchAdd', params); |
307 | 307 | //合托 |
308 | 308 | export const batchCreateCheckOut = (params) => postAction('/task/taskHeader/batchCreateCheckOut', params); |
309 | -//增加库存数量 | |
309 | +//增加库存 | |
310 | 310 | export const addInventoryDetail = (params) => postAction('/inventory/inventoryDetail/addInventoryDetail', params); |
311 | +//增加库存数量 | |
312 | +export const increaseInventoryDetail = (params) => postAction('/inventory/inventoryDetail/increaseInventoryDetail', params); | |
311 | 313 | //扣减库存数量 |
312 | 314 | export const reduceInventoryDetail = (params) => postAction('/inventory/inventoryDetail/reduceInventoryDetail', params); |
313 | 315 | // 根据库位编码查询库存详情 |
... | ... |
ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue
... | ... | @@ -79,7 +79,8 @@ |
79 | 79 | |
80 | 80 | <span slot="action" slot-scope="text, record"> |
81 | 81 | <a v-has="'inventoryDetail:edit'" @click="handleEdit(record)">编辑<a-divider type="vertical"/></a> |
82 | - <a v-has="'inventoryDetail:addInventoryDetail'" v-if="(record.containerStatus == 'lock')" @click="addInventoryDetail(record)">新增数量<a-divider type="vertical"/></a> | |
82 | + <a v-has="'inventoryDetail:addInventoryDetail'" v-if="(record.containerStatus == 'lock')" @click="addInventoryDetail(record)">新增物料 <a-divider type="vertical"/></a> | |
83 | + <a v-has="'inventoryDetail:addInventoryDetail'" v-if="(record.containerStatus == 'lock')" @click="increaseInventoryDetail(record)">新增数量<a-divider type="vertical"/></a> | |
83 | 84 | <a v-has="'inventoryDetail:reduceInventoryDetail'" v-if="(record.containerStatus == 'lock')" @click="reduceInventoryDetail(record)">减少数量<a-divider type="vertical"/></a> |
84 | 85 | <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> |
85 | 86 | <a v-has="'inventoryDetail:delete'">删除</a> |
... | ... | @@ -88,6 +89,7 @@ |
88 | 89 | </a-table> |
89 | 90 | </div> |
90 | 91 | |
92 | + <inventory-detail-add-modal ref="detailModalForm" @ok="modalFormOk" :mainId="mainId"></inventory-detail-add-modal> | |
91 | 93 | <inventoryDetail-modal ref="modalForm" @ok="modalFormOk" :mainId="mainId"></inventoryDetail-modal> |
92 | 94 | <inventory-detail-modify-modal ref="modifyModalForm" @ok="modalFormOk" :mainId="mainId"></inventory-detail-modify-modal> |
93 | 95 | </a-card> |
... | ... | @@ -98,11 +100,12 @@ import {JeecgListMixin} from '@/mixins/JeecgListMixin' |
98 | 100 | import InventoryDetailModal from './modules/InventoryDetailModal' |
99 | 101 | import {getCompanyList, getZoneList} from '@/api/api' |
100 | 102 | import InventoryDetailModifyModal from "@views/system/inventory/modules/InventoryDetailModifyModal.vue"; |
103 | +import InventoryDetailAddModal from "@views/system/inventory/modules/InventoryDetailAddModal.vue"; | |
101 | 104 | |
102 | 105 | export default { |
103 | 106 | name: 'InventoryDetailList', |
104 | 107 | mixins: [JeecgListMixin], |
105 | - components: {InventoryDetailModifyModal, InventoryDetailModal}, | |
108 | + components: {InventoryDetailAddModal, InventoryDetailModifyModal, InventoryDetailModal}, | |
106 | 109 | props: { |
107 | 110 | mainId: { |
108 | 111 | type: String, |
... | ... | @@ -313,6 +316,10 @@ export default { |
313 | 316 | }) |
314 | 317 | }, |
315 | 318 | addInventoryDetail(record) { |
319 | + this.$refs.detailModalForm.edit(record); | |
320 | + this.$refs.detailModalForm.title = "新增物料"; | |
321 | + }, | |
322 | + increaseInventoryDetail(record) { | |
316 | 323 | this.$refs.modifyModalForm.edit(record); |
317 | 324 | this.$refs.modifyModalForm.title = "增加库存数量"; |
318 | 325 | this.$refs.modifyModalForm.flag = 1; |
... | ... |
ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryDetailAddModal.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 | + <a-spin :spinning="confirmLoading"> | |
12 | + <a-form-model ref="form" :model="model" :rules="validatorRules"> | |
13 | + <a-row> | |
14 | + <a-col :span="24"> | |
15 | + <a-form-model-item label="物料" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialCode"> | |
16 | + <j-search-select-tag | |
17 | + v-model="model.materialCode" | |
18 | + dict="material,name,code" | |
19 | + placeholder="请选择物料编码" | |
20 | + :pageSize="10" | |
21 | + :async="true" | |
22 | + /> | |
23 | + </a-form-model-item> | |
24 | + </a-col> | |
25 | + <a-col :span="24"> | |
26 | + <a-form-model-item label="数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="qty"> | |
27 | + <a-input-number v-model="model.qty" placeholder="请输入数量" style="width: 100%"/> | |
28 | + </a-form-model-item> | |
29 | + </a-col> | |
30 | + </a-row> | |
31 | + </a-form-model> | |
32 | + </a-spin> | |
33 | + </j-modal> | |
34 | +</template> | |
35 | + | |
36 | +<script> | |
37 | + | |
38 | +import {httpAction} from '@/api/manage' | |
39 | +import {validateDuplicateValue} from '@/utils/util' | |
40 | +import {addInventoryDetail} from "@api/api"; | |
41 | + | |
42 | +export default { | |
43 | + name: "InventoryDetailAddModal", | |
44 | + components: {}, | |
45 | + props: { | |
46 | + mainId: { | |
47 | + type: String, | |
48 | + required: false, | |
49 | + default: '' | |
50 | + } | |
51 | + }, | |
52 | + data() { | |
53 | + return { | |
54 | + title: "操作", | |
55 | + width: 400, | |
56 | + visible: false, | |
57 | + model: {}, | |
58 | + flag: 0, | |
59 | + labelCol: { | |
60 | + xs: {span: 24}, | |
61 | + sm: {span: 5}, | |
62 | + }, | |
63 | + wrapperCol: { | |
64 | + xs: {span: 24}, | |
65 | + sm: {span: 16}, | |
66 | + }, | |
67 | + | |
68 | + confirmLoading: false, | |
69 | + validatorRules: { | |
70 | + qty: [{required: true, message: '请输入数量!'}], | |
71 | + }, | |
72 | + url: { | |
73 | + add: "/inventory/inventoryHeader/addInventoryDetail", | |
74 | + edit: "/inventory/inventoryHeader/editInventoryDetail", | |
75 | + } | |
76 | + | |
77 | + } | |
78 | + }, | |
79 | + created() { | |
80 | + //备份model原始值 | |
81 | + this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |
82 | + }, | |
83 | + methods: { | |
84 | + add() { | |
85 | + this.edit(this.modelDefault); | |
86 | + }, | |
87 | + edit(record) { | |
88 | + this.model = Object.assign({}, record); | |
89 | + this.model.qty = 0; | |
90 | + this.visible = true; | |
91 | + }, | |
92 | + close() { | |
93 | + this.$emit('close'); | |
94 | + this.visible = false; | |
95 | + this.$refs.form.clearValidate(); | |
96 | + }, | |
97 | + handleOk() { | |
98 | + const that = this; | |
99 | + // 触发表单验证 | |
100 | + this.$refs.form.validate(valid => { | |
101 | + if (valid) { | |
102 | + that.confirmLoading = true; | |
103 | + this.model['inventoryHeaderId'] = this.mainId | |
104 | + addInventoryDetail(this.model).then((res) => { | |
105 | + if (res.success) { | |
106 | + that.$message.success(res.message); | |
107 | + that.$emit('ok'); | |
108 | + } else { | |
109 | + that.$message.warning(res.message); | |
110 | + } | |
111 | + }).finally(() => { | |
112 | + that.confirmLoading = false; | |
113 | + that.close(); | |
114 | + }) | |
115 | + } else { | |
116 | + return false | |
117 | + } | |
118 | + }) | |
119 | + }, | |
120 | + handleCancel() { | |
121 | + this.close() | |
122 | + }, | |
123 | + | |
124 | + | |
125 | + } | |
126 | +} | |
127 | +</script> | |
... | ... |
ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryDetailModifyModal.vue
... | ... | @@ -26,7 +26,7 @@ |
26 | 26 | |
27 | 27 | import {httpAction} from '@/api/manage' |
28 | 28 | import {validateDuplicateValue} from '@/utils/util' |
29 | -import {addInventoryDetail, reduceInventoryDetail} from "@api/api"; | |
29 | +import {increaseInventoryDetail, reduceInventoryDetail} from "@api/api"; | |
30 | 30 | |
31 | 31 | export default { |
32 | 32 | name: "InventoryDetailModifyModal", |
... | ... | @@ -91,7 +91,7 @@ export default { |
91 | 91 | that.confirmLoading = true; |
92 | 92 | this.model['inventoryHeaderId'] = this.mainId |
93 | 93 | if (this.flag == 1) { |
94 | - addInventoryDetail(this.model).then((res) => { | |
94 | + increaseInventoryDetail(this.model).then((res) => { | |
95 | 95 | if (res.success) { |
96 | 96 | that.$message.success(res.message); |
97 | 97 | that.$emit('ok'); |
... | ... |
ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTogetherModal.vue
... | ... | @@ -100,9 +100,9 @@ export default { |
100 | 100 | } else { |
101 | 101 | this.$message.error(res.message); |
102 | 102 | } |
103 | + this.$emit("ok"); | |
104 | + this.close() | |
103 | 105 | }); |
104 | - this.$emit("ok", this.model.outPortCode); | |
105 | - this.close() | |
106 | 106 | }, |
107 | 107 | handleCancel() { |
108 | 108 | this.close() |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/LocationAllocationServiceImpl.java
... | ... | @@ -176,6 +176,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
176 | 176 | if (CollectionUtils.isEmpty(roadWays)) { |
177 | 177 | throw new JeecgBootException("分配库位时, 可用巷道为空"); |
178 | 178 | } |
179 | + roadWays = locationService.getRoadWayByZoneCode(zoneCode, warehouseCode); | |
179 | 180 | Integer roadWay = locationAllocationService.getRoadWay(roadWays, materialCode, zoneCode, warehouseCode); |
180 | 181 | // 优先找外侧库位 |
181 | 182 | LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery(); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wms/entity/WmsEntity.java
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryDetail/controller/InventoryDetailController.java
... | ... | @@ -280,9 +280,21 @@ public class InventoryDetailController extends JeecgController<InventoryDetail, |
280 | 280 | @ApiOperation(value = "库存详情-新增库存数量", notes = "库存详情-新增库存数量") |
281 | 281 | @RequestMapping(value = "/addInventoryDetail", method = {RequestMethod.PUT, RequestMethod.POST}) |
282 | 282 | public Result addInventoryDetail(@RequestBody InventoryDetail inventoryDetail) { |
283 | + return inventoryDetailService.addInventoryDetail(inventoryDetail); | |
284 | + } | |
285 | + | |
286 | + /** | |
287 | + * 新增库存数量 | |
288 | + * @param inventoryDetail | |
289 | + * @return | |
290 | + */ | |
291 | + @AutoLog(value = "库存详情-新增库存数量") | |
292 | + @ApiOperation(value = "库存详情-新增库存数量", notes = "库存详情-新增库存数量") | |
293 | + @RequestMapping(value = "/increaseInventoryDetail", method = {RequestMethod.PUT, RequestMethod.POST}) | |
294 | + public Result increaseInventoryDetail(@RequestBody InventoryDetail inventoryDetail) { | |
283 | 295 | InventoryDetail inventoryDetail1 = inventoryDetailService.getById(inventoryDetail.getId()); |
284 | 296 | BigDecimal qty = inventoryDetail.getQty(); |
285 | - return inventoryDetailService.addInventoryDetail(inventoryDetail1, qty); | |
297 | + return inventoryDetailService.increaseInventoryDetail(inventoryDetail1, qty); | |
286 | 298 | } |
287 | 299 | |
288 | 300 | /** |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryDetailService.java
... | ... | @@ -127,7 +127,15 @@ public interface IInventoryDetailService extends IService<InventoryDetail> { |
127 | 127 | * @param inventoryDetail 库存详情 |
128 | 128 | * @return |
129 | 129 | */ |
130 | - Result addInventoryDetail(InventoryDetail inventoryDetail, BigDecimal qty); | |
130 | + Result addInventoryDetail(InventoryDetail inventoryDetail); | |
131 | + | |
132 | + /** | |
133 | + * 进行出库查看时,可以增加库存数量 | |
134 | + * 添加库存详情 | |
135 | + * @param inventoryDetail 库存详情 | |
136 | + * @return | |
137 | + */ | |
138 | + Result increaseInventoryDetail(InventoryDetail inventoryDetail, BigDecimal qty); | |
131 | 139 | |
132 | 140 | /** |
133 | 141 | * 进行出库查看时,可以减少库存数量 |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java
... | ... | @@ -17,8 +17,15 @@ import org.jeecg.modules.wms.config.container.entity.Container; |
17 | 17 | import org.jeecg.modules.wms.config.container.service.IContainerService; |
18 | 18 | import org.jeecg.modules.wms.config.containerCapacity.entity.ContainerCapacity; |
19 | 19 | import org.jeecg.modules.wms.config.containerCapacity.service.IContainerCapacityService; |
20 | +import org.jeecg.modules.wms.config.location.entity.Location; | |
21 | +import org.jeecg.modules.wms.config.location.service.ILocationService; | |
22 | +import org.jeecg.modules.wms.config.material.entity.Material; | |
23 | +import org.jeecg.modules.wms.config.material.service.IMaterialService; | |
20 | 24 | import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; |
25 | +import org.jeecg.modules.wms.config.zone.entity.Zone; | |
26 | +import org.jeecg.modules.wms.config.zone.service.IZoneService; | |
21 | 27 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; |
28 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; | |
22 | 29 | import org.jeecg.modules.wms.inventory.inventoryHeader.mapper.InventoryDetailMapper; |
23 | 30 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; |
24 | 31 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; |
... | ... | @@ -86,6 +93,12 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe |
86 | 93 | private IShipmentContainerDetailService shipmentContainerDetailService; |
87 | 94 | @Resource |
88 | 95 | private IInventoryTransactionService inventoryTransactionService; |
96 | + @Resource | |
97 | + private IMaterialService materialService; | |
98 | + @Resource | |
99 | + private IZoneService zoneService; | |
100 | + @Resource | |
101 | + private ILocationService locationService; | |
89 | 102 | |
90 | 103 | @Override |
91 | 104 | public List<InventoryDetail> selectByMainId(String mainId) { |
... | ... | @@ -458,7 +471,88 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe |
458 | 471 | |
459 | 472 | @Override |
460 | 473 | @Transactional(rollbackFor = Exception.class) |
461 | - public Result addInventoryDetail(InventoryDetail inventoryDetail, BigDecimal qty) { | |
474 | + public Result addInventoryDetail(InventoryDetail inventoryDetail1) { | |
475 | + String materialCode = inventoryDetail1.getMaterialCode(); | |
476 | + BigDecimal qty = inventoryDetail1.getQty(); | |
477 | + if (StringUtils.isEmpty(materialCode)) { | |
478 | + return Result.error("增加库存,没有物料编码"); | |
479 | + } | |
480 | + if (qty == null) { | |
481 | + return Result.error("增加库存,没有数量"); | |
482 | + } | |
483 | + Material material = materialService.getMaterialByCode(materialCode); | |
484 | + if (material == null) { | |
485 | + return Result.error("增加库存,没有找到物料" + materialCode); | |
486 | + } | |
487 | + InventoryHeader inventoryHeader = inventoryHeaderService.getById(inventoryDetail1.getInventoryHeaderId()); | |
488 | + if (inventoryHeader == null) { | |
489 | + return Result.error("增加库存,没有找到库存" + inventoryDetail1.getInventoryHeaderId()); | |
490 | + } | |
491 | + String zoneCode = inventoryHeader.getZoneCode(); | |
492 | + String warehouseCode = inventoryHeader.getWarehouseCode(); | |
493 | + String companyCode = inventoryHeader.getCompanyCode(); | |
494 | + String containerCode = inventoryHeader.getContainerCode(); | |
495 | + String locationCode = inventoryHeader.getLocationCode(); | |
496 | + Zone zone = zoneService.getZoneByCode(zoneCode, warehouseCode); | |
497 | + if (zone == null) { | |
498 | + return Result.error("增加库存,没有找到库区" + zoneCode); | |
499 | + } | |
500 | + Location location = locationService.getLocationByCode(locationCode, warehouseCode); | |
501 | + if (location == null) { | |
502 | + return Result.error("增加库存,没有找到库位" + locationCode); | |
503 | + } | |
504 | + Integer roadWay = location.getRoadWay(); | |
505 | + String zoneType = zone.getType(); | |
506 | + InventoryDetail inventoryDetail = new InventoryDetail(); | |
507 | + inventoryDetail.setInventoryHeaderId(inventoryHeader.getId()); | |
508 | + inventoryDetail.setWarehouseCode(warehouseCode); | |
509 | + inventoryDetail.setCompanyCode(companyCode); | |
510 | + inventoryDetail.setZoneCode(zoneCode); | |
511 | + inventoryDetail.setZoneType(zoneType); | |
512 | + inventoryDetail.setContainerCode(containerCode); | |
513 | + inventoryDetail.setContainerStatus(QuantityConstant.STATUS_CONTAINER_LOCK); | |
514 | + inventoryDetail.setLocationCode(locationCode); | |
515 | + inventoryDetail.setMaterialCode(material.getCode()); | |
516 | + inventoryDetail.setMaterialName(material.getName()); | |
517 | + inventoryDetail.setMaterialSpec(material.getSpec()); | |
518 | + inventoryDetail.setMaterialUnit(material.getUnit()); | |
519 | + inventoryDetail.setQty(qty); | |
520 | + inventoryDetail.setRoadWay(roadWay); | |
521 | + inventoryDetail.setInventoryStatus(QuantityConstant.QUALITY_GOOD); | |
522 | + inventoryDetail.setReceiptDate(new Date()); | |
523 | + if (!inventoryDetailService.save(inventoryDetail)) { | |
524 | + throw new JeecgBootException("增加库存,新增库存详情失败"); | |
525 | + } | |
526 | + | |
527 | + InventoryTransaction inventoryTransaction = new InventoryTransaction(); | |
528 | + inventoryTransaction.setType(QuantityConstant.INVENTORY_TRANSACTION_CYCLEINTO); | |
529 | + inventoryTransaction.setWarehouseCode(inventoryHeader.getWarehouseCode()); | |
530 | + inventoryTransaction.setCompanyCode(inventoryDetail.getCompanyCode()); | |
531 | + inventoryTransaction.setContainerCode(inventoryHeader.getContainerCode()); | |
532 | + inventoryTransaction.setZoneCode(zoneCode); | |
533 | + inventoryTransaction.setToLocationCode(inventoryDetail.getLocationCode()); | |
534 | + inventoryTransaction.setMaterialCode(inventoryDetail.getMaterialCode()); | |
535 | + inventoryTransaction.setMaterialName(inventoryDetail.getMaterialName()); | |
536 | + inventoryTransaction.setMaterialSpec(inventoryDetail.getMaterialSpec()); | |
537 | + inventoryTransaction.setMaterialUnit(inventoryDetail.getMaterialUnit()); | |
538 | + inventoryTransaction.setInventoryStatus(inventoryDetail.getInventoryStatus()); | |
539 | + inventoryTransaction.setBatch(inventoryDetail.getBatch()); | |
540 | + inventoryTransaction.setLot(inventoryDetail.getLot()); | |
541 | + inventoryTransaction.setProject(inventoryDetail.getProject()); | |
542 | + inventoryTransaction.setQty(qty); | |
543 | + inventoryTransaction.setReceiptQty(qty); | |
544 | + if (!inventoryTransactionService.save(inventoryTransaction)) { | |
545 | + throw new JeecgBootException("增加库存, 保存库存交易记录失败"); | |
546 | + } | |
547 | + if (!taskHeaderService.combineInventoryDetail(inventoryHeader.getContainerCode(), inventoryHeader.getWarehouseCode())) { | |
548 | + throw new JeecgBootException("增加库存,合并数量托盘:" + inventoryHeader.getContainerCode() + "调整库存失败"); | |
549 | + } | |
550 | + return Result.OK("增加库存,托盘:" + inventoryHeader.getContainerCode() + "调整库存成功"); | |
551 | + } | |
552 | + | |
553 | + @Override | |
554 | + @Transactional(rollbackFor = Exception.class) | |
555 | + public Result increaseInventoryDetail(InventoryDetail inventoryDetail, BigDecimal qty) { | |
462 | 556 | String containerCode = inventoryDetail.getContainerCode(); |
463 | 557 | String warehouseCode = inventoryDetail.getWarehouseCode(); |
464 | 558 | TaskHeader taskHeader = taskHeaderService.getUnCompleteTaskByContainerCode(containerCode, warehouseCode); |
... | ... | @@ -472,6 +566,27 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe |
472 | 566 | if (qty.compareTo(BigDecimal.ZERO) <= 0) { |
473 | 567 | return Result.error("调整库存,托盘:" + containerCode + "调整数量必须大于0"); |
474 | 568 | } |
569 | + InventoryTransaction inventoryTransaction = new InventoryTransaction(); | |
570 | + inventoryTransaction.setType(QuantityConstant.INVENTORY_TRANSACTION_CYCLEINTO); | |
571 | + inventoryTransaction.setWarehouseCode(warehouseCode); | |
572 | + inventoryTransaction.setCompanyCode(inventoryDetail.getCompanyCode()); | |
573 | + inventoryTransaction.setContainerCode(containerCode); | |
574 | + inventoryTransaction.setZoneCode(inventoryDetail.getZoneCode()); | |
575 | + inventoryTransaction.setFromLocationCode(taskHeader.getFromLocationCode()); | |
576 | + inventoryTransaction.setToLocationCode(taskHeader.getToLocationCode()); | |
577 | + inventoryTransaction.setMaterialCode(inventoryDetail.getMaterialCode()); | |
578 | + inventoryTransaction.setMaterialName(inventoryDetail.getMaterialName()); | |
579 | + inventoryTransaction.setMaterialSpec(inventoryDetail.getMaterialSpec()); | |
580 | + inventoryTransaction.setMaterialUnit(inventoryDetail.getMaterialUnit()); | |
581 | + inventoryTransaction.setInventoryStatus(inventoryDetail.getInventoryStatus()); | |
582 | + inventoryTransaction.setBatch(inventoryDetail.getBatch()); | |
583 | + inventoryTransaction.setLot(inventoryDetail.getLot()); | |
584 | + inventoryTransaction.setProject(inventoryDetail.getProject()); | |
585 | + inventoryTransaction.setQty(qty); | |
586 | + inventoryTransaction.setReceiptQty(qty); | |
587 | + if (!inventoryTransactionService.save(inventoryTransaction)) { | |
588 | + throw new JeecgBootException("调整库存, 保存库存交易记录失败"); | |
589 | + } | |
475 | 590 | BigDecimal inventoryDetailQty = inventoryDetail.getQty(); |
476 | 591 | inventoryDetailQty = inventoryDetailQty.add(qty); |
477 | 592 | inventoryDetail.setQty(inventoryDetailQty); |
... | ... | @@ -506,6 +621,27 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe |
506 | 621 | if (inventoryDetailQty.compareTo(BigDecimal.ZERO) < 0) { |
507 | 622 | return Result.error("调整库存,托盘:" + containerCode + "调整后的数量不能小于0"); |
508 | 623 | } |
624 | + InventoryTransaction inventoryTransaction = new InventoryTransaction(); | |
625 | + inventoryTransaction.setType(QuantityConstant.INVENTORY_TRANSACTION_CYCLEOUT); | |
626 | + inventoryTransaction.setWarehouseCode(warehouseCode); | |
627 | + inventoryTransaction.setCompanyCode(inventoryDetail.getCompanyCode()); | |
628 | + inventoryTransaction.setContainerCode(containerCode); | |
629 | + inventoryTransaction.setZoneCode(inventoryDetail.getZoneCode()); | |
630 | + inventoryTransaction.setFromLocationCode(taskHeader.getFromLocationCode()); | |
631 | + inventoryTransaction.setToLocationCode(taskHeader.getToLocationCode()); | |
632 | + inventoryTransaction.setMaterialCode(inventoryDetail.getMaterialCode()); | |
633 | + inventoryTransaction.setMaterialName(inventoryDetail.getMaterialName()); | |
634 | + inventoryTransaction.setMaterialSpec(inventoryDetail.getMaterialSpec()); | |
635 | + inventoryTransaction.setMaterialUnit(inventoryDetail.getMaterialUnit()); | |
636 | + inventoryTransaction.setInventoryStatus(inventoryDetail.getInventoryStatus()); | |
637 | + inventoryTransaction.setBatch(inventoryDetail.getBatch()); | |
638 | + inventoryTransaction.setLot(inventoryDetail.getLot()); | |
639 | + inventoryTransaction.setProject(inventoryDetail.getProject()); | |
640 | + inventoryTransaction.setQty(qty); | |
641 | + inventoryTransaction.setShipmentQty(qty); | |
642 | + if (!inventoryTransactionService.save(inventoryTransaction)) { | |
643 | + throw new JeecgBootException("调整库存, 保存库存交易记录失败"); | |
644 | + } | |
509 | 645 | if (inventoryDetailQty.compareTo(BigDecimal.ZERO) == 0) { |
510 | 646 | if (!removeById(inventoryDetail.getId())) { |
511 | 647 | throw new JeecgBootException("调整库存,托盘:" + containerCode + "调整库存失败"); |
... | ... | @@ -525,8 +661,10 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe |
525 | 661 | if (!success) { |
526 | 662 | throw new JeecgBootException("调整库存,托盘:" + containerCode + "调整库存失败"); |
527 | 663 | } |
664 | + if (!taskHeaderService.combineInventoryDetail(containerCode, warehouseCode)) { | |
665 | + throw new JeecgBootException("调整库存,合并数量托盘:" + containerCode + "调整库存失败"); | |
666 | + } | |
528 | 667 | } |
529 | - | |
530 | 668 | return Result.OK("调整库存,托盘:" + containerCode + "调整库存成功"); |
531 | 669 | } |
532 | 670 | |
... | ... |