Commit 8534352193bb994ff488c132f1767493cc79b500
1 parent
e2bf8a06
增加铁芯库入库
Showing
11 changed files
with
753 additions
and
1 deletions
ant-design-vue-jeecg/src/api/api.js
... | ... | @@ -283,6 +283,8 @@ export const cantaleverReceipt = (params) => postAction('/task/taskHeader/cantal |
283 | 283 | export const receiptStageingReceipt = (params) => postAction('/task/taskHeader/receiptStageingReceipt', params) |
284 | 284 | //快速入库 |
285 | 285 | export const stageingReceipt = (params) => postAction('/task/taskHeader/stageingReceipt', params) |
286 | +//铁芯库入库 | |
287 | +export const ironCoreReceipt = (params) => postAction('/task/taskHeader/ironCoreReceipt', params) | |
286 | 288 | //快速出库,批量快速出整托 |
287 | 289 | export const shipmentInventoryHeader = (params) => postAction('/inventory/inventoryHeader/shipmentInventoryHeader', params) |
288 | 290 | //快速出库,批量快速出库存详情 |
... | ... |
ant-design-vue-jeecg/src/views/system/task/AllTaskHeaderList.vue
... | ... | @@ -94,6 +94,7 @@ |
94 | 94 | <a-button v-has="'taskHeader:quickReceipt'" @click="stageingReceipt()" type="primary">货架暂存区入库</a-button> |
95 | 95 | <a-button v-has="'taskHeader:quickReceipt'" @click="cantaleverReceipt()" type="primary">悬臂库入库</a-button> |
96 | 96 | <a-button v-has="'taskHeader:quickReceipt'" @click="cantaleverStageingReceipt()" type="primary">悬臂库暂存区入库</a-button> |
97 | + <a-button v-has="'taskHeader:quickReceipt'" @click="ironCoreReceipt()" type="primary">铁芯库入库</a-button> | |
97 | 98 | <a-button v-has="'taskHeader:callReceiptBox'" @click="callReceiptBox()" type="primary" >呼叫入库有货托盘</a-button> |
98 | 99 | <a-button v-has="'taskHeader:callReceiptBox'" @click="callReceiptEmptyBox()" type="primary" >呼叫入库空托盘</a-button> |
99 | 100 | <a-button v-has="'taskHeader:emptyOut'" @click="createEmptyOut()" type="primary">空托出库</a-button> |
... | ... | @@ -214,6 +215,7 @@ |
214 | 215 | <shipment-material-modal ref="shipmentMaterialModal" @ok="modalFormOk"></shipment-material-modal> |
215 | 216 | <CantaleverShipmentModal ref="cantaleverShipmentModal" @ok="modalFormOk"></CantaleverShipmentModal> |
216 | 217 | <CantaleverStageingReceiptModal ref="cantaleverStageingReceiptModal" @ok="modalFormOk"></CantaleverStageingReceiptModal> |
218 | + <IronCoreReceiptModal ref="ironCoreReceiptModal" @ok="modalFormOk"></IronCoreReceiptModal> | |
217 | 219 | |
218 | 220 | </a-card> |
219 | 221 | </template> |
... | ... | @@ -226,7 +228,7 @@ import {getAction} from '@/api/manage' |
226 | 228 | import TaskDetailList from './TaskDetailList' |
227 | 229 | import {initDictOptions, filterMultiDictText} from '@/components/dict/JDictSelectUtil' |
228 | 230 | import '@/assets/less/TableExpand.less' |
229 | -import {completeTaskByWMS, cancelTask, switchTask} from '@/api/api' | |
231 | +import {completeTaskByWMS, cancelTask, switchTask, ironCoreReceipt} from '@/api/api' | |
230 | 232 | import {execute} from '@/api/api' |
231 | 233 | import {getZoneList, handleEmptyOut, handlePickupError, handleDoubleIn} from '@/api/api' |
232 | 234 | import EmptyInTaskModal from './modules/EmptyInTaskModal' |
... | ... | @@ -247,11 +249,13 @@ import ShipmentMaterialModal from "@views/system/task/modules/ShipmentMaterialMo |
247 | 249 | import CantaleverTaskModal from "@views/system/task/modules/CantaleverTaskModal.vue"; |
248 | 250 | import CantaleverShipmentModal from "@views/system/task/modules/CantaleverShipmentModal.vue"; |
249 | 251 | import CantaleverStageingReceiptModal from "@views/system/task/modules/CantaleverStageingReceiptModal.vue"; |
252 | +import IronCoreReceiptModal from "@views/system/task/modules/IronCoreReceiptModal.vue"; | |
250 | 253 | |
251 | 254 | export default { |
252 | 255 | name: "AllTaskHeaderList", |
253 | 256 | mixins: [JeecgListMixin], |
254 | 257 | components: { |
258 | + IronCoreReceiptModal, | |
255 | 259 | CantaleverStageingReceiptModal, |
256 | 260 | CantaleverShipmentModal, |
257 | 261 | CantaleverTaskModal, |
... | ... | @@ -604,6 +608,10 @@ export default { |
604 | 608 | this.$refs.cantaleverStageingReceiptModal.edit(); |
605 | 609 | this.$refs.cantaleverStageingReceiptModal.title = "悬臂暂存区入库"; |
606 | 610 | }, |
611 | + ironCoreReceipt(){ | |
612 | + this.$refs.ironCoreReceiptModal.edit(); | |
613 | + this.$refs.ironCoreReceiptModal.title = "铁芯库入库"; | |
614 | + }, | |
607 | 615 | callReceiptBox() { |
608 | 616 | this.$refs.modalForm5.edit(); |
609 | 617 | this.$refs.modalForm5.title = "呼叫入库有货托盘"; |
... | ... |
ant-design-vue-jeecg/src/views/system/task/modules/IronCoreReceiptModal.vue
0 → 100644
1 | +<template> | |
2 | + <a-modal | |
3 | + :title="title" | |
4 | + :width="800" | |
5 | + :visible="visible" | |
6 | + :maskClosable="false" | |
7 | + :confirmLoading="confirmLoading" | |
8 | + @ok="handleOk" | |
9 | + @cancel="handleCancel"> | |
10 | + | |
11 | + <a-spin :spinning="confirmLoading"> | |
12 | + <a-form-model ref="form" :label-col="labelCol" :wrapper-col="wrapperCol" :model="model"> | |
13 | + <!-- 主表单区域 --> | |
14 | + <a-row class="form-row" :gutter="24"> | |
15 | + <a-col :lg="8"> | |
16 | + <a-form-model-item label="托盘号" :rules="[{ required: true, message: '请输入托盘号!' }]"> | |
17 | + <a-input placeholder="请输入托盘号" v-model="quickMainModel.containerCode"/> | |
18 | + </a-form-model-item> | |
19 | + </a-col> | |
20 | + <a-col :lg="10"> | |
21 | + <a-form-model-item label="入库口"> | |
22 | +<!-- <a-input placeholder="请输入入库口" v-model="quickMainModel.toPort"/>--> | |
23 | + <j-search-select-tag | |
24 | + placeholder="请选择入库口" | |
25 | + v-model="quickMainModel.toPort" | |
26 | + dict="port,name,code,type='3'" | |
27 | + :pageSize="5" | |
28 | + :async="true"> | |
29 | + </j-search-select-tag> | |
30 | + </a-form-model-item> | |
31 | + </a-col> | |
32 | + </a-row> | |
33 | + <!-- 子表单区域 --> | |
34 | + <a-tabs defaultActiveKey="1"> | |
35 | + <a-tab-pane tab="物料信息" key="1"> | |
36 | + <div> | |
37 | + <a-row type="flex" style="margin-bottom:10px" :gutter="24"> | |
38 | + <a-col :span="12">物料编码</a-col> | |
39 | + <a-col :span="8">数量</a-col> | |
40 | + <a-col :span="4">操作</a-col> | |
41 | + </a-row> | |
42 | + <a-row type="flex" style="margin-bottom:-20px" :gutter="24" v-for="(item, index) in quickMainModel.receiptEntityList" :key="index"> | |
43 | + <a-col style="display: none"> | |
44 | + <a-form-model-item> | |
45 | + <a-input placeholder="id" v-model="item.id"/> | |
46 | + </a-form-model-item> | |
47 | + </a-col> | |
48 | + <a-col :span="12"> | |
49 | + <a-form-model-item> | |
50 | + <j-search-select-tag | |
51 | + placeholder="请选择" | |
52 | + v-model="item.materialCode" | |
53 | + :dict="'material,name,code'" | |
54 | + :pageSize="8" | |
55 | + :async="true"> | |
56 | + </j-search-select-tag> | |
57 | + </a-form-model-item> | |
58 | + </a-col> | |
59 | + <a-col :span="8"> | |
60 | + <a-form-model-item> | |
61 | + <a-input placeholder="数量" v-model="item.qty"/> | |
62 | + </a-form-model-item> | |
63 | + </a-col> | |
64 | + <a-col :span="4"> | |
65 | + <a-form-model-item> | |
66 | + <a-icon type="minus-circle" @click="delRowCustom(index)" style="fontSize :20px"/> | |
67 | + </a-form-model-item> | |
68 | + </a-col> | |
69 | + </a-row> | |
70 | + <a-button type="dashed" style="width: 100%;margin-top: 10px" @click="addRowCustom"><a-icon type="plus"/>添加物料信息</a-button> | |
71 | + </div> | |
72 | + </a-tab-pane> | |
73 | + </a-tabs> | |
74 | + </a-form-model> | |
75 | + </a-spin> | |
76 | + </a-modal> | |
77 | +</template> | |
78 | + | |
79 | +<script> | |
80 | + | |
81 | +import JEditableTable from '@/components/jeecg/JEditableTable' | |
82 | +import {execute, ironCoreReceipt, quickReceipt} from '@/api/api' | |
83 | +import JDate from '@/components/jeecg/JDate' | |
84 | +import JSelectMultiCanUseContainer from "../../../../components/jeecgbiz/JSelectMultiCanUseContainer"; | |
85 | + | |
86 | +export default { | |
87 | + name: 'IronCoreReceiptModal', | |
88 | + components: { | |
89 | + JDate, JEditableTable,JSelectMultiCanUseContainer | |
90 | + }, | |
91 | + data() { | |
92 | + return { | |
93 | + title: '铁芯库入库', | |
94 | + visible: false, | |
95 | + confirmLoading: false, | |
96 | + model: {}, | |
97 | + labelCol: { | |
98 | + xs: {span: 24}, | |
99 | + sm: {span: 4} | |
100 | + }, | |
101 | + wrapperCol: { | |
102 | + xs: {span: 24}, | |
103 | + sm: {span: 24} | |
104 | + }, | |
105 | + activeKey: '1', | |
106 | + quickMainModel: { | |
107 | + receiptEntityList: [{}], | |
108 | + }, | |
109 | + // 客户信息 | |
110 | + url: { | |
111 | + add: '/test/jeecgOrderMain/add', | |
112 | + edit: '/test/jeecgOrderMain/edit', | |
113 | + } | |
114 | + } | |
115 | + }, | |
116 | + created() { | |
117 | + }, | |
118 | + methods: { | |
119 | + handleOk() { | |
120 | + this.validateFields() | |
121 | + }, | |
122 | + handleCancel() { | |
123 | + this.visible = false | |
124 | + }, | |
125 | + | |
126 | + addRowCustom() { | |
127 | + this.quickMainModel.receiptEntityList.push({}); | |
128 | + this.$forceUpdate(); | |
129 | + }, | |
130 | + delRowCustom(index) { | |
131 | + console.log(index) | |
132 | + this.quickMainModel.receiptEntityList.splice(index, 1); | |
133 | + this.$forceUpdate(); | |
134 | + }, | |
135 | + addRowTicket() { | |
136 | + this.quickMainModel.jeecgOrderTicketList.push({}); | |
137 | + console.log(this.quickMainModel.jeecgOrderTicketList) | |
138 | + this.$forceUpdate(); | |
139 | + }, | |
140 | + delRowTicket(index) { | |
141 | + console.log(index) | |
142 | + this.quickMainModel.jeecgOrderTicketList.splice(index, 1); | |
143 | + this.$forceUpdate(); | |
144 | + }, | |
145 | + | |
146 | + edit(record) { | |
147 | + this.visible = true | |
148 | + this.activeKey = '1' | |
149 | + this.quickMainModel = Object.assign({ | |
150 | + receiptEntityList: [{}] | |
151 | + }, record); | |
152 | + }, | |
153 | + /** 触发表单验证 */ | |
154 | + validateFields() { | |
155 | + // 触发表单验证 | |
156 | + this.$refs.form.validate(valid => { | |
157 | + //alert(JSON.stringify(this.quickMainModel)); | |
158 | + this.receipt(this.quickMainModel); | |
159 | + }) | |
160 | + }, | |
161 | + | |
162 | + receipt(record) { | |
163 | + this.confirmLoading = true | |
164 | + this.model = Object.assign({}, record); | |
165 | + ironCoreReceipt(this.model).then((res) => { | |
166 | + this.loading = false; | |
167 | + if (res.success) { | |
168 | + this.$message.success(res.message); | |
169 | + this.$emit('ok'); | |
170 | + this.visible = false | |
171 | + } else { | |
172 | + this.$message.error(res.message); | |
173 | + } | |
174 | + this.confirmLoading = false | |
175 | + }); | |
176 | + }, | |
177 | + } | |
178 | +} | |
179 | +</script> | |
0 | 180 | \ No newline at end of file |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/entity/WcsTask.java
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/entity/ReceiptContainerDetail.java
... | ... | @@ -128,6 +128,10 @@ public class ReceiptContainerDetail implements Serializable { |
128 | 128 | @ApiModelProperty(value = "更新日期") |
129 | 129 | private Date updateTime; |
130 | 130 | |
131 | + /** 位置 */ | |
132 | + @ApiModelProperty(value = "位置") | |
133 | + private Integer position; | |
134 | + | |
131 | 135 | public void setQty(BigDecimal qty) { |
132 | 136 | if (qty.compareTo(BigDecimal.ZERO) <= 0) { |
133 | 137 | throw new JeecgBootException("入库组盘数量必须大于0"); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java
... | ... | @@ -240,6 +240,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai |
240 | 240 | taskDetail.setLot(receiptContainerDetail.getLot()); |
241 | 241 | taskDetail.setProject(receiptContainerDetail.getProject()); |
242 | 242 | taskDetail.setSn(receiptContainerDetail.getSn()); |
243 | + taskDetail.setPosition(receiptContainerDetail.getPosition()); | |
243 | 244 | taskDetail.setReceiveTime(receiptContainerDetail.getReceiveTime()); |
244 | 245 | taskDetailList.add(taskDetail); |
245 | 246 | ReceiptDetail receiptDetail = receiptDetailService.getById(receiptContainerDetail.getReceiptDetailId()); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/service/IReceiveService.java
... | ... | @@ -25,6 +25,11 @@ public interface IReceiveService extends IService<Receive> { |
25 | 25 | Result<ReceiptContainerHeader> receivingB(List<Receive> receiveList, String warehouseCode); |
26 | 26 | |
27 | 27 | /** |
28 | + * 铁芯堆垛组盘 | |
29 | + */ | |
30 | + Result<ReceiptContainerHeader> receivingIronCore(List<Receive> receiveList, String warehouseCode); | |
31 | + | |
32 | + /** | |
28 | 33 | * 立库组盘和生成任务 |
29 | 34 | */ |
30 | 35 | Result<TaskHeader> receivingAndCreateTask(List<Receive> receiveList, String warehouseCode); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/service/impl/ReceiveServiceImpl.java
... | ... | @@ -369,6 +369,217 @@ public class ReceiveServiceImpl extends ServiceImpl<ReceiveMapper, Receive> impl |
369 | 369 | |
370 | 370 | @Override |
371 | 371 | @Transactional(rollbackFor = Exception.class) |
372 | + public Result<ReceiptContainerHeader> receivingIronCore(List<Receive> receiveList, String warehouseCode) { | |
373 | + log.info("开始入库组盘"); | |
374 | + boolean success = false; | |
375 | + if (receiveList == null || receiveList.size() == 0) { | |
376 | + return Result.error("入库组盘,收货信息为空"); | |
377 | + } | |
378 | + if (StringUtils.isEmpty(warehouseCode)) { | |
379 | + return Result.error("入库组盘,仓库编码为空"); | |
380 | + } | |
381 | + String containerCode = receiveList.get(0).getContainerCode(); | |
382 | + if (StringUtils.isEmpty(containerCode)) { | |
383 | + return Result.error("入库组盘,容器编码为空"); | |
384 | + } | |
385 | + Container container = containerService.getContainerByCode(containerCode, warehouseCode); | |
386 | + if (container == null) { | |
387 | + return Result.error("入库组盘,根据容器编码 " + containerCode + ", 没有找到容器"); | |
388 | + } | |
389 | + String fromLocationCode = container.getLocationCode(); | |
390 | + if (StringUtils.isNotEmpty(fromLocationCode)) { | |
391 | + Location location = locationService.getLocationByCode(fromLocationCode, warehouseCode); | |
392 | + if (location == null) { | |
393 | + return Result.error("入库组盘,根据库位编码 " + fromLocationCode + ", 没有找到库位"); | |
394 | + } | |
395 | + String value = parameterConfigurationService.getValueByZoneCode(QuantityConstant.RULE_RECEIPT_TASK, container.getZoneCode()); | |
396 | + if (StringUtils.isNotEmpty(value)) { | |
397 | + int shipmentTaskRule = Integer.parseInt(value); | |
398 | + if (shipmentTaskRule == QuantityConstant.RULE_TASK_WHOLE) { | |
399 | + return Result.error("入库组盘," + containerCode + "不允许有补充入库"); | |
400 | + } | |
401 | + } | |
402 | + } | |
403 | + int callBox = QuantityConstant.NOT_CALL_BOX; | |
404 | + TaskHeader callBoxTask = taskHeaderService.getUnCompleteTaskByContainerCode(containerCode, warehouseCode); | |
405 | + if (callBoxTask != null) { | |
406 | + callBox = callBoxTask.getCallBox(); | |
407 | + } | |
408 | + // 如果不是呼叫料盒,那么要判断容器状态 | |
409 | + if (callBox == QuantityConstant.NOT_CALL_BOX) { | |
410 | + String containerStatus = container.getStatus(); | |
411 | + if (containerStatus.equals(QuantityConstant.STATUS_CONTAINER_LOCK)) { | |
412 | + return Result.error("入库组盘,容器被锁定不能用于收货" + containerCode); | |
413 | + } | |
414 | + String containerFillStatus = container.getFillStatus(); | |
415 | + if (!StringUtils.isEmpty(containerFillStatus) && containerFillStatus.equals(QuantityConstant.STATUS_CONTAINER_FILL_FULL)) { | |
416 | + return Result.error("入库组盘,容器已经是满盘不能用于收货" + containerCode); | |
417 | + } | |
418 | + } | |
419 | + String containerTypeCode = container.getContainerTypeCode(); | |
420 | + if (StringUtils.isEmpty(containerTypeCode)) { | |
421 | + return Result.error("入库组盘,容器类型编码为空" + containerCode); | |
422 | + } | |
423 | + ContainerType containerType = containerTypeService.getContainerTypeByCode(containerTypeCode, warehouseCode); | |
424 | + if (containerType == null) { | |
425 | + return Result.error("入库组盘,容器类型为空" + containerCode); | |
426 | + } | |
427 | + ShipmentContainerHeader shipmentContainerHeader = shipmentContainerHeaderService.getUnCompleteShipmentContainerByCode(containerCode, warehouseCode); | |
428 | + if (shipmentContainerHeader != null) { | |
429 | + return Result.error("入库组盘,容器" + containerCode + "不能有出库配盘"); | |
430 | + } | |
431 | + int taskType = QuantityConstant.TASK_TYPE_WHOLERECEIPT; | |
432 | + if (StringUtils.isNotEmpty(fromLocationCode)) { | |
433 | + taskType = QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT; | |
434 | + throw new JeecgBootException("铁芯库组盘,不能做补充入库"); | |
435 | + } | |
436 | + ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getUnCompleteReceiptContainerByCode(containerCode, warehouseCode); | |
437 | + if (receiptContainerHeader != null) { | |
438 | + if (receiptContainerHeader.getStatus() >= QuantityConstant.RECEIPT_CONTAINER_TASK) { | |
439 | + throw new JeecgBootException("入库组盘,容器已经生成任务,不能放物料了!"); | |
440 | + } | |
441 | + } else { | |
442 | + receiptContainerHeader = new ReceiptContainerHeader(); | |
443 | + receiptContainerHeader.setWarehouseCode(warehouseCode); | |
444 | + receiptContainerHeader.setContainerCode(containerCode); | |
445 | + receiptContainerHeader.setContainerTypeCode(containerTypeCode); | |
446 | + receiptContainerHeader.setStatus(QuantityConstant.RECEIPT_CONTAINER_BUILD); | |
447 | + receiptContainerHeader.setTaskType(taskType); | |
448 | + receiptContainerHeader.setFromLocationCode(fromLocationCode); | |
449 | + if (taskType == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT) { | |
450 | + String value = parameterConfigurationService.getValueByZoneCode(QuantityConstant.RULE_TASK_LOCATION, container.getZoneCode()); | |
451 | + int taskLocationRule = Integer.parseInt(value); | |
452 | + if (taskLocationRule == QuantityConstant.RULE_TASK_SET_LOCATION) { | |
453 | + receiptContainerHeader.setToLocationCode(fromLocationCode); | |
454 | + } | |
455 | + } | |
456 | + success = receiptContainerHeaderService.save(receiptContainerHeader); | |
457 | + if (!success) { | |
458 | + throw new JeecgBootException("入库组盘,保存入库组盘头失败"); | |
459 | + } | |
460 | + } | |
461 | + List<ReceiptDetail> receiptDetailList = new ArrayList<>(); | |
462 | + List<ReceiptContainerDetail> receiptContainerDetailList = new ArrayList<>(); | |
463 | + int position = 0; | |
464 | + for (Receive receive : receiveList) { | |
465 | + position++; | |
466 | + ReceiptDetail receiptDetail = receiptDetailService.getById(receive.getId()); | |
467 | + if (receiptDetail == null) { | |
468 | + throw new JeecgBootException("入库组盘,没有找到入库单详情ID:" + receive.getId()); | |
469 | + } | |
470 | + // 可收数量 | |
471 | + BigDecimal qty = receiptDetail.getQty().subtract(receiptDetail.getTaskQty()); | |
472 | + // 收货数量 | |
473 | + BigDecimal taskQty = receive.getTaskQty(); | |
474 | + if (qty == null || taskQty == null) { | |
475 | + throw new JeecgBootException("入库组盘,物料编码:" + receive.getMaterialCode() + " 收货数量或可收数量为空"); | |
476 | + } | |
477 | + if (taskQty.compareTo(BigDecimal.ZERO) < 0) { | |
478 | + throw new JeecgBootException("入库组盘,物料编码:" + receive.getMaterialCode() + " 收货数量不能小于0,收货数量:" + taskQty + "可收数量:" + qty); | |
479 | + } | |
480 | + if (taskQty.compareTo(qty) > 0) { | |
481 | + throw new JeecgBootException("入库组盘,物料编码:" + receive.getMaterialCode() + " 收货数量不能大于可收数量,收货数量:" + taskQty + "可收数量:" + qty); | |
482 | + } | |
483 | + // 入库单明细为0 跳过组盘 | |
484 | + if (taskQty.compareTo(BigDecimal.ZERO) <= 0) { | |
485 | + continue; | |
486 | + } | |
487 | + ReceiptHeader receiptHeader = receiptHeaderService.getById(receiptDetail.getReceiptId()); | |
488 | + if (receiptHeader == null) { | |
489 | + throw new JeecgBootException("入库组盘,没有找到入库单ID:" + receiptDetail.getReceiptId()); | |
490 | + } | |
491 | + if (!receiptHeader.getWarehouseCode().equals(warehouseCode)) { | |
492 | + throw new JeecgBootException("入库组盘,入库单操作仓库错误,请选择 " + receiptHeader.getWarehouseCode() + " 操作"); | |
493 | + } | |
494 | + String materialCode = receiptDetail.getMaterialCode(); | |
495 | + if (StringUtils.isEmpty(materialCode)) { | |
496 | + throw new JeecgBootException("入库组盘,物料编码为空"); | |
497 | + } | |
498 | + Material material = materialService.getMaterialByCode(materialCode); | |
499 | + if (material == null) { | |
500 | + throw new JeecgBootException("入库组盘," + materialCode + "物料不存在"); | |
501 | + } | |
502 | + BigDecimal receiptQty = receiptDetail.getQty(); | |
503 | + BigDecimal receiptTaskQty = receiptDetail.getTaskQty(); | |
504 | + receiptTaskQty = receiptTaskQty.add(taskQty); | |
505 | + if (receiptTaskQty.compareTo(receiptQty) > 0) { | |
506 | + throw new JeecgBootException("入库组盘,收货数量不能大于单据数量"); | |
507 | + } | |
508 | + | |
509 | + receiptDetail.setTaskQty(receiptTaskQty); | |
510 | + ReceiptDetail receiptDetail1 = new ReceiptDetail(); | |
511 | + receiptDetail1.setReceiptId(receiptDetail.getReceiptId()); | |
512 | + receiptDetail1.setId(receiptDetail.getId()); | |
513 | + receiptDetail1.setTaskQty(receiptTaskQty); | |
514 | + receiptDetail1.setStatus(QuantityConstant.RECEIPT_HEADER_RECEIVING); | |
515 | + if (receiptTaskQty.equals(receiptQty)) { | |
516 | + receiptDetail1.setStatus(QuantityConstant.RECEIPT_HEADER_WAIT_SHELF); | |
517 | + } | |
518 | + receiptDetailList.add(receiptDetail1); | |
519 | + | |
520 | +// LambdaQueryWrapper<ReceiptContainerDetail> receiptContainerDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
521 | +// receiptContainerDetailLambdaQueryWrapper.eq(ReceiptContainerDetail::getReceiptId, receiptDetail.getReceiptId()) | |
522 | +// .eq(ReceiptContainerDetail::getReceiptDetailId, receiptDetail.getId()) | |
523 | +// .eq(StringUtils.isNotEmpty(receive.getSn()), ReceiptContainerDetail::getSn, receive.getSn()) | |
524 | +// .eq(ReceiptContainerDetail::getReceiptContainerId, receiptContainerHeader.getId()); | |
525 | +// ReceiptContainerDetail receiptContainerDetail = receiptContainerDetailService.getOne(receiptContainerDetailLambdaQueryWrapper); | |
526 | +// if (receiptContainerDetail != null) { | |
527 | +// // 如果是已经组过的详情,那么直接相加收货数量 | |
528 | +// ReceiptContainerDetail receiptContainerDetail1 = new ReceiptContainerDetail(); | |
529 | +// receiptContainerDetail1.setId(receiptContainerDetail.getId()); | |
530 | +// receiptContainerDetail1.setQty(receiptContainerDetail.getQty().add(taskQty)); | |
531 | +// if (!receiptContainerDetailService.updateById(receiptContainerDetail1)) { | |
532 | +// throw new JeecgBootException("入库组盘, 更新入库组盘明细失败"); | |
533 | +// } | |
534 | +// } else { | |
535 | + ReceiptContainerDetail receiptContainerDetail = new ReceiptContainerDetail(); | |
536 | + receiptContainerDetail.setCompanyCode(receiptDetail.getCompanyCode()); | |
537 | + receiptContainerDetail.setReferCode(receiptDetail.getReferCode()); | |
538 | + receiptContainerDetail.setSn(receive.getSn()); | |
539 | + receiptContainerDetail.setContainerCode(receive.getContainerCode()); | |
540 | + receiptContainerDetail.setReceiptDetailId(receiptDetail.getId()); | |
541 | + receiptContainerDetail.setReceiptId(receiptDetail.getReceiptId()); | |
542 | + receiptContainerDetail.setReceiptCode(receiptDetail.getReceiptCode()); | |
543 | + receiptContainerDetail.setReceiptContainerId(receiptContainerHeader.getId()); | |
544 | + receiptContainerDetail.setWarehouseCode(receiptDetail.getWarehouseCode()); | |
545 | + receiptContainerDetail.setMaterialCode(receiptDetail.getMaterialCode()); | |
546 | + receiptContainerDetail.setMaterialName(receiptDetail.getMaterialName()); | |
547 | + receiptContainerDetail.setMaterialSpec(receiptDetail.getMaterialSpec()); | |
548 | + receiptContainerDetail.setMaterialUnit(receiptDetail.getMaterialUnit()); | |
549 | + receiptContainerDetail.setQty(taskQty); | |
550 | + receiptContainerDetail.setBatch(receiptDetail.getBatch()); | |
551 | + receiptContainerDetail.setLot(receiptDetail.getLot()); | |
552 | + receiptContainerDetail.setPosition(position); | |
553 | + receiptContainerDetail.setProject(receiptDetail.getProject()); | |
554 | + receiptContainerDetail.setInventoryStatus(receiptDetail.getInventoryStatus()); | |
555 | + receiptContainerDetailList.add(receiptContainerDetail); | |
556 | + } | |
557 | + if (CollectionUtils.isEmpty(receiptDetailList)) { | |
558 | + throw new JeecgBootException("入库组盘,请填入收货数量"); | |
559 | + } | |
560 | + success = receiptDetailService.updateBatchById(receiptDetailList); | |
561 | + if (!success) { | |
562 | + throw new JeecgBootException("入库组盘,批量更新入库单详情失败"); | |
563 | + } | |
564 | + List<Integer> receiptIdList = receiptDetailList.stream().map(ReceiptDetail::getReceiptId).distinct().collect(Collectors.toList()); | |
565 | + for (Integer receiptId : receiptIdList) { | |
566 | + if (!receiptHeaderService.updateReceiptHeaderStatus(receiptId)) { | |
567 | + throw new JeecgBootException("入库组盘, 更新入库单明细失败"); | |
568 | + } | |
569 | + } | |
570 | + if (receiptContainerDetailList.size() > 0) { | |
571 | + success = receiptContainerDetailService.saveBatch(receiptContainerDetailList); | |
572 | + if (!success) { | |
573 | + throw new JeecgBootException("入库组盘,保存入库组盘详情失败"); | |
574 | + } | |
575 | + } | |
576 | + LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(receiptContainerDetailList)); | |
577 | + log.info("完成入库组盘"); | |
578 | + return Result.OK("入库组盘成功", receiptContainerHeader); | |
579 | + } | |
580 | + | |
581 | + @Override | |
582 | + @Transactional(rollbackFor = Exception.class) | |
372 | 583 | public Result flatReceive(List<Receive> receiveList, String containerCode, String warehouseCode) { |
373 | 584 | log.info("开始平库入库组盘"); |
374 | 585 | boolean success = false; |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/controller/TaskHeaderController.java
... | ... | @@ -1009,6 +1009,26 @@ public class TaskHeaderController extends HuahengBaseController { |
1009 | 1009 | } |
1010 | 1010 | |
1011 | 1011 | /** |
1012 | + * 铁芯库入库 | |
1013 | + * @return | |
1014 | + */ | |
1015 | + @AutoLog(value = "铁芯库入库", operateType = 2) | |
1016 | + @PostMapping("ironCoreReceipt") | |
1017 | + @ApiOperation("铁芯库入库") | |
1018 | + public Result ironCoreReceipt(@RequestBody QucikReceiptEntity qucikReceiptEntity, HttpServletRequest req) { | |
1019 | + String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); | |
1020 | + qucikReceiptEntity.setWarehouseCode(warehouseCode); | |
1021 | + Result result = handleMultiProcess("ironCoreReceipt", new MultiProcessListener() { | |
1022 | + @Override | |
1023 | + public Result<?> doProcess() { | |
1024 | + Result result = taskHeaderService.ironCoreReceipt(qucikReceiptEntity); | |
1025 | + return result; | |
1026 | + } | |
1027 | + }); | |
1028 | + return result; | |
1029 | + } | |
1030 | + | |
1031 | + /** | |
1012 | 1032 | * 质检登记 |
1013 | 1033 | * @return |
1014 | 1034 | */ |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java
... | ... | @@ -303,6 +303,14 @@ public interface ITaskHeaderService extends IService<TaskHeader> { |
303 | 303 | */ |
304 | 304 | Result completeCantaleverReceiptTask(TaskHeader taskHeader); |
305 | 305 | |
306 | + | |
307 | + /** | |
308 | + * 完成入库 | |
309 | + * @param taskHeader | |
310 | + * @return | |
311 | + */ | |
312 | + Result completeIconCoreReceiptTask(TaskHeader taskHeader); | |
313 | + | |
306 | 314 | /** |
307 | 315 | * 完成出库 |
308 | 316 | * @param taskHeader |
... | ... | @@ -511,6 +519,12 @@ public interface ITaskHeaderService extends IService<TaskHeader> { |
511 | 519 | * add |
512 | 520 | * @return |
513 | 521 | */ |
522 | + Result ironCoreReceipt(QucikReceiptEntity qucikReceiptEntity); | |
523 | + | |
524 | + /** | |
525 | + * add | |
526 | + * @return | |
527 | + */ | |
514 | 528 | Result receiptStageingReceipt(QucikReceiptEntity qucikReceiptEntity); |
515 | 529 | |
516 | 530 | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... | ... | @@ -277,6 +277,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
277 | 277 | if (fromLocation.getZoneCode().equals(QuantityConstant.ZONE_B)) { |
278 | 278 | return Result.error("创建移库任务时,悬架式立库不支持这种移库方式"); |
279 | 279 | } |
280 | + if (fromLocation.getZoneCode().equals(QuantityConstant.ZONE_C)) { | |
281 | + return Result.error("创建移库任务时,铁芯库不支持移库"); | |
282 | + } | |
280 | 283 | Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); |
281 | 284 | if (toLocation == null) { |
282 | 285 | return Result.error("创建移库任务时,目标库位:" + toLocationCode + "未找到"); |
... | ... | @@ -1109,6 +1112,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1109 | 1112 | case QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT: |
1110 | 1113 | if (zoneCode.equals(QuantityConstant.ZONE_B)) { |
1111 | 1114 | result = taskHeaderService.completeCantaleverReceiptTask(taskHeader); |
1115 | + } else if (zoneCode.equals(QuantityConstant.ZONE_C)) { | |
1116 | + result = taskHeaderService.completeIconCoreReceiptTask(taskHeader); | |
1112 | 1117 | } else { |
1113 | 1118 | result = taskHeaderService.completeReceiptTask(taskHeader); |
1114 | 1119 | } |
... | ... | @@ -2128,6 +2133,182 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
2128 | 2133 | return Result.ok("完成入库任务"); |
2129 | 2134 | } |
2130 | 2135 | |
2136 | + @Override | |
2137 | + @Transactional(rollbackFor = Exception.class) | |
2138 | + public Result completeIconCoreReceiptTask(TaskHeader taskHeader) { | |
2139 | + if (taskHeader == null) { | |
2140 | + return Result.error("入库任务未找到,执行中止"); | |
2141 | + } | |
2142 | + log.info("开始完成入库任务, 任务号" + taskHeader.getId()); | |
2143 | + String warehouseCode = taskHeader.getWarehouseCode(); | |
2144 | + String fromLocationCode = taskHeader.getFromLocationCode(); | |
2145 | + String toLocationCode = taskHeader.getToLocationCode(); | |
2146 | + String containerCode = taskHeader.getContainerCode(); | |
2147 | + String zoneCode = taskHeader.getZoneCode(); | |
2148 | + int taskType = taskHeader.getTaskType(); | |
2149 | + List<TaskDetail> taskDetailList = taskDetailService.getTaskDetailListByTaskId(taskHeader.getId()); | |
2150 | + boolean success = false; | |
2151 | + if (taskHeader.getStatus().equals(QuantityConstant.TASK_STATUS_COMPLETED)) { | |
2152 | + return Result.ok("入库任务(" + taskHeader.getId() + ")已经是完成的!"); | |
2153 | + } | |
2154 | + if (taskDetailList.isEmpty()) { | |
2155 | + throw new JeecgBootException("完成入库任务时, 入库任务明细为空"); | |
2156 | + } | |
2157 | + Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); | |
2158 | + if (toLocation == null) { | |
2159 | + return Result.error("完成入库任务时,没有找到目的库位"); | |
2160 | + } | |
2161 | + if (StringUtils.isEmpty(zoneCode)) { | |
2162 | + return Result.error("完成入库任务时,没有找到目的库区编码"); | |
2163 | + } | |
2164 | + Zone zone = zoneService.getZoneByCode(zoneCode, warehouseCode); | |
2165 | + if (zone == null) { | |
2166 | + return Result.error("完成入库任务时,没有找到库区"); | |
2167 | + } | |
2168 | + String zoneType = zone.getType(); | |
2169 | + InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); | |
2170 | + if (inventoryHeader == null) { | |
2171 | + inventoryHeader = new InventoryHeader(); | |
2172 | + inventoryHeader.setWarehouseCode(warehouseCode); | |
2173 | + inventoryHeader.setCompanyCode(taskHeader.getCompanyCode()); | |
2174 | + inventoryHeader.setZoneCode(zoneCode); | |
2175 | + inventoryHeader.setContainerCode(containerCode); | |
2176 | + inventoryHeader.setLocationCode(toLocationCode); | |
2177 | + inventoryHeader.setTotalWeight(taskHeader.getWeight()); | |
2178 | + inventoryHeader.setCreateBy(taskHeader.getCreateBy()); | |
2179 | + inventoryHeader.setContainerStatus(QuantityConstant.STATUS_CONTAINER_EMPTY); | |
2180 | + inventoryHeader.setEnable(QuantityConstant.STATUS_ENABLE); | |
2181 | + if (!inventoryHeaderService.save(inventoryHeader)) { | |
2182 | + throw new JeecgBootException("完成入库任务时, 添加库存头失败"); | |
2183 | + } | |
2184 | + } | |
2185 | + | |
2186 | + List<InventoryDetail> inventoryDetailList = new ArrayList<>(); | |
2187 | + List<InventoryTransaction> inventoryTransactionList = new ArrayList<>(); | |
2188 | + List<ReceiptDetail> receiptDetaiList = new ArrayList<>(); | |
2189 | + for (TaskDetail taskDetail : taskDetailList) { | |
2190 | + ReceiptDetail receiptDetail = receiptDetailService.getById(taskDetail.getReceiptDetailId()); | |
2191 | + if (receiptDetail == null) { | |
2192 | + throw new JeecgBootException("未找到ID:" + taskDetail.getReceiptDetailId() + "入库单明细"); | |
2193 | + } | |
2194 | + ReceiptHeader receiptHeader = receiptHeaderService.getById(receiptDetail.getReceiptId()); | |
2195 | + if (receiptHeader == null) { | |
2196 | + throw new JeecgBootException("未找到ID:" + receiptDetail.getReceiptId() + "入库单头"); | |
2197 | + } | |
2198 | + // 操作记录统计用 | |
2199 | + taskDetail.setReceiptCode(receiptDetail.getReceiptCode()); | |
2200 | + BigDecimal qty = receiptDetail.getQty(); | |
2201 | + BigDecimal receiptDetailReceiptQty = receiptDetail.getReceiptQty(); | |
2202 | + receiptDetailReceiptQty = receiptDetailReceiptQty.add(taskDetail.getQty()); | |
2203 | + int receiptId = receiptDetail.getReceiptId(); | |
2204 | + ReceiptDetail updateReceiptDetail = new ReceiptDetail(); | |
2205 | + updateReceiptDetail.setId(receiptDetail.getId()); | |
2206 | + updateReceiptDetail.setReceiptId(receiptId); | |
2207 | + updateReceiptDetail.setReceiptQty(receiptDetailReceiptQty); | |
2208 | + if (receiptDetailReceiptQty.compareTo(qty) >= 0) { | |
2209 | + updateReceiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); | |
2210 | + } else { | |
2211 | + updateReceiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_SHELF); | |
2212 | + } | |
2213 | + receiptDetaiList.add(updateReceiptDetail); | |
2214 | + if (!receiptDetailService.updateById(updateReceiptDetail)) { | |
2215 | + throw new JeecgBootException("完成入库任务时,更新入库单详情失败"); | |
2216 | + } | |
2217 | + // 计算换算单位数量 | |
2218 | + materialMultipleService.materialMultiple(taskDetail); | |
2219 | + InventoryDetail inventoryDetail = new InventoryDetail(); | |
2220 | + inventoryDetail.setInventoryHeaderId(inventoryHeader.getId()); | |
2221 | + inventoryDetail.setWarehouseCode(warehouseCode); | |
2222 | + inventoryDetail.setCompanyCode(taskDetail.getCompanyCode()); | |
2223 | + inventoryDetail.setZoneCode(zoneCode); | |
2224 | + inventoryDetail.setZoneType(zoneType); | |
2225 | + inventoryDetail.setContainerCode(taskHeader.getContainerCode()); | |
2226 | + inventoryDetail.setLocationCode(toLocationCode); | |
2227 | + inventoryDetail.setMaterialCode(taskDetail.getMaterialCode()); | |
2228 | + inventoryDetail.setMaterialName(taskDetail.getMaterialName()); | |
2229 | + inventoryDetail.setMaterialSpec(taskDetail.getMaterialSpec()); | |
2230 | + inventoryDetail.setMaterialUnit(taskDetail.getMaterialUnit()); | |
2231 | + inventoryDetail.setQty(taskDetail.getQty()); | |
2232 | + inventoryDetail.setInventoryStatus(taskDetail.getInventoryStatus()); | |
2233 | + inventoryDetail.setBatch(taskDetail.getBatch()); | |
2234 | + inventoryDetail.setLot(taskDetail.getLot()); | |
2235 | + inventoryDetail.setProject(taskDetail.getProject()); | |
2236 | + inventoryDetail.setSn(taskDetail.getSn()); | |
2237 | + inventoryDetail.setPosition(taskDetail.getPosition()); | |
2238 | + inventoryDetail.setReceiveTime(taskDetail.getReceiveTime()); | |
2239 | + inventoryDetail.setReceiptDate(new Date()); | |
2240 | + inventoryDetailList.add(inventoryDetail); | |
2241 | + | |
2242 | + InventoryTransaction inventoryTransaction = new InventoryTransaction(); | |
2243 | + inventoryTransaction.setType(QuantityConstant.INVENTORY_TRANSACTION_RECEIPT); | |
2244 | + inventoryTransaction.setWarehouseCode(taskDetail.getWarehouseCode()); | |
2245 | + inventoryTransaction.setCompanyCode(taskDetail.getCompanyCode()); | |
2246 | + inventoryTransaction.setContainerCode(containerCode); | |
2247 | + inventoryTransaction.setZoneCode(zoneCode); | |
2248 | + inventoryTransaction.setToLocationCode(toLocationCode); | |
2249 | + inventoryTransaction.setMaterialCode(taskDetail.getMaterialCode()); | |
2250 | + inventoryTransaction.setMaterialName(taskDetail.getMaterialName()); | |
2251 | + inventoryTransaction.setMaterialSpec(taskDetail.getMaterialSpec()); | |
2252 | + inventoryTransaction.setMaterialUnit(taskDetail.getMaterialUnit()); | |
2253 | + inventoryTransaction.setReceiptId(taskDetail.getReceiptId()); | |
2254 | + inventoryTransaction.setReceiptCode(receiptHeader.getCode()); | |
2255 | + inventoryTransaction.setReceiptType(receiptHeader.getType()); | |
2256 | + inventoryTransaction.setReceiptDetailId(taskDetail.getReceiptDetailId()); | |
2257 | + inventoryTransaction.setReceiptContainerDetailId(taskDetail.getReceiptContainerDetailId()); | |
2258 | + inventoryTransaction.setBatch(taskDetail.getBatch()); | |
2259 | + inventoryTransaction.setLot(taskDetail.getLot()); | |
2260 | + inventoryTransaction.setProject(taskDetail.getProject()); | |
2261 | + inventoryTransaction.setSn(taskDetail.getSn()); | |
2262 | + inventoryTransaction.setInventoryStatus(taskDetail.getInventoryStatus()); | |
2263 | + inventoryTransaction.setReceiptQty(taskDetail.getQty()); | |
2264 | + inventoryTransaction.setQty(taskDetail.getQty()); | |
2265 | + // 获得库存总数 | |
2266 | + BigDecimal inventoryQty = inventoryDetailService.getInventorySumQty(inventoryDetail); | |
2267 | + // 获得物料在这个托盘上的库存数 | |
2268 | + BigDecimal containerInventoryQty = inventoryDetailService.getContainerInventorySumQty(inventoryDetail); | |
2269 | + inventoryQty = inventoryQty.add(taskDetail.getQty()); | |
2270 | + containerInventoryQty = containerInventoryQty.add(taskDetail.getQty()); | |
2271 | + inventoryTransaction.setInventoryQty(inventoryQty); | |
2272 | + inventoryTransaction.setContainerInventoryQty(containerInventoryQty); | |
2273 | + inventoryTransactionList.add(inventoryTransaction); | |
2274 | + } | |
2275 | + | |
2276 | + success = receiptContainerHeaderService.updateStatusById(QuantityConstant.RECEIPT_CONTAINER_FINISHED, taskHeader.getReceiptContainerHeaderId()); | |
2277 | + if (!success) { | |
2278 | + throw new JeecgBootException("完成入库任务时,更新入库组盘头表状态失败"); | |
2279 | + } | |
2280 | + success = inventoryDetailService.saveBatch(inventoryDetailList); | |
2281 | + if (!success) { | |
2282 | + throw new JeecgBootException("完成入库任务时,保存库存详情失败"); | |
2283 | + } | |
2284 | + success = inventoryTransactionService.saveBatch(inventoryTransactionList); | |
2285 | + if (!success) { | |
2286 | + throw new JeecgBootException("完成入库任务时,保存库存交易失败"); | |
2287 | + } | |
2288 | +// if (!taskHeaderService.combineInventoryDetail(containerCode, warehouseCode)) { | |
2289 | +// throw new JeecgBootException("完成入库任务时, 合并入库库存失败"); | |
2290 | +// } | |
2291 | + List<Integer> receiptIdList = receiptDetaiList.stream().map(ReceiptDetail::getReceiptId).distinct().collect(Collectors.toList()); | |
2292 | + for (Integer receiptId : receiptIdList) { | |
2293 | + success = receiptHeaderService.updateReceiptHeaderStatus(receiptId); | |
2294 | + if (!success) { | |
2295 | + throw new JeecgBootException("完成入库任务时,更新入库单头失败"); | |
2296 | + } | |
2297 | + } | |
2298 | + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), taskType, containerCode, fromLocationCode, | |
2299 | + toLocationCode, warehouseCode); | |
2300 | + if (!result.isSuccess()) { | |
2301 | + throw new JeecgBootException(result.getMessage()); | |
2302 | + } | |
2303 | + success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | |
2304 | + if (!success) { | |
2305 | + throw new JeecgBootException("完成入库任务时,保存任务头失败"); | |
2306 | + } | |
2307 | + receiptDetaiList = receiptDetaiList.stream().filter(t -> t.getStatus().equals(QuantityConstant.RECEIPT_HEADER_COMPLETED)).collect(Collectors.toList()); | |
2308 | + log.info("完成入库任务, 任务号:" + taskHeader.getId()); | |
2309 | + return Result.ok("完成入库任务"); | |
2310 | + } | |
2311 | + | |
2131 | 2312 | /** |
2132 | 2313 | * 完成出库任务 |
2133 | 2314 | * @param taskHeader 任务 |
... | ... | @@ -3309,6 +3490,124 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
3309 | 3490 | |
3310 | 3491 | @Override |
3311 | 3492 | @Transactional(rollbackFor = Exception.class) |
3493 | + public Result ironCoreReceipt(QucikReceiptEntity qucikReceiptEntity) { | |
3494 | + boolean success = false; | |
3495 | + String containerCode = qucikReceiptEntity.getContainerCode(); | |
3496 | + List<ReceiptEntity> receiptEntityList = qucikReceiptEntity.getReceiptEntityList(); | |
3497 | + String toPort = qucikReceiptEntity.getToPort(); | |
3498 | + String warehouseCode = qucikReceiptEntity.getWarehouseCode(); | |
3499 | + List<Receive> receiveList = new ArrayList<>(); | |
3500 | + if (StringUtils.isEmpty(containerCode)) { | |
3501 | + return Result.error("快速入库,容器编码为空"); | |
3502 | + } | |
3503 | + if (StringUtils.isEmpty(warehouseCode)) { | |
3504 | + return Result.error("快速入库,仓库编码为空"); | |
3505 | + } | |
3506 | + if (StringUtils.isEmpty(receiptEntityList)) { | |
3507 | + return Result.error("快速入库,入库信息为空"); | |
3508 | + } | |
3509 | + Container container = containerService.getContainerByCode(containerCode, warehouseCode); | |
3510 | + if (container == null) { | |
3511 | + return Result.error("快速入库,没有找到容器" + containerCode); | |
3512 | + } | |
3513 | + Port port = portService.getPortByCode(toPort, warehouseCode); | |
3514 | + if (port != null) { | |
3515 | + int portType = Integer.parseInt(port.getType()); | |
3516 | + if (portType == QuantityConstant.PORT_TYPE_OUT) { | |
3517 | + return Result.error("快速入库,不能选择出库口" + toPort); | |
3518 | + } | |
3519 | + } | |
3520 | + String receiptType = QuantityConstant.RECEIPT_BILL_TYPE_QTR; | |
3521 | + String remark = "快速入库"; | |
3522 | + ReceiptHeader receiptHeader = new ReceiptHeader(); | |
3523 | + receiptHeader.setWarehouseCode(warehouseCode); | |
3524 | + receiptHeader.setCompanyCode(QuantityConstant.DEFAULT_COMPANY); | |
3525 | + receiptHeader.setType(receiptType); | |
3526 | + receiptHeader.setRemark(remark); | |
3527 | + Result result = receiptHeaderService.saveReceiptHeader(receiptHeader); | |
3528 | + if (!result.isSuccess()) { | |
3529 | + throw new JeecgBootException("快速入库, 创建入库单头失败" + result.getMessage()); | |
3530 | + } | |
3531 | + for (ReceiptEntity receiptEntity : receiptEntityList) { | |
3532 | + BigDecimal qty = receiptEntity.getQty(); | |
3533 | + String materialCode = receiptEntity.getMaterialCode(); | |
3534 | + if (StringUtils.isEmpty(materialCode)) { | |
3535 | + throw new JeecgBootException("快速入库, 物料编码为空"); | |
3536 | + } | |
3537 | + if (qty == null) { | |
3538 | + throw new JeecgBootException("快速入库, 数量必须填写"); | |
3539 | + } | |
3540 | + if (qty.compareTo(BigDecimal.ZERO) <= 0) { | |
3541 | + throw new JeecgBootException("快速入库, 数量必须大于0"); | |
3542 | + } | |
3543 | + ReceiptDetail receiptDetail = new ReceiptDetail(); | |
3544 | + receiptDetail.setWarehouseCode(warehouseCode); | |
3545 | + receiptDetail.setCompanyCode(QuantityConstant.DEFAULT_COMPANY); | |
3546 | + receiptDetail.setReceiptCode(receiptHeader.getCode()); | |
3547 | + receiptDetail.setReceiptId(receiptHeader.getId()); | |
3548 | + receiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_BUILD); | |
3549 | + receiptDetail.setQty(qty); | |
3550 | + Material material = materialService.getMaterialByCode(materialCode); | |
3551 | + if (material == null) { | |
3552 | + throw new JeecgBootException("快速入库, 获取物料:" + materialCode + " 信息失败"); | |
3553 | + } | |
3554 | + receiptDetail.setInventoryStatus(QuantityConstant.QUALITY_GOOD); | |
3555 | + receiptDetail.setMaterialCode(materialCode); | |
3556 | + receiptDetail.setMaterialName(material.getName()); | |
3557 | + receiptDetail.setMaterialSpec(material.getSpec()); | |
3558 | + receiptDetail.setMaterialUnit(material.getUnit()); | |
3559 | + success = receiptDetailService.save(receiptDetail); | |
3560 | + if (!success) { | |
3561 | + throw new JeecgBootException("快速入库, 保存入库单详情失败"); | |
3562 | + } | |
3563 | + | |
3564 | + Receive receive = new Receive(); | |
3565 | + receive.setId(receiptDetail.getId()); | |
3566 | + receive.setContainerCode(containerCode); | |
3567 | + receive.setMaterialCode(materialCode); | |
3568 | + receive.setMaterialName(receiptDetail.getMaterialName()); | |
3569 | + receive.setMaterialSpec(receiptDetail.getMaterialSpec()); | |
3570 | + receive.setMaterialUnit(receiptDetail.getMaterialUnit()); | |
3571 | + receive.setInventoryStatus(receiptDetail.getInventoryStatus()); | |
3572 | + receive.setQty(receiptDetail.getQty()); | |
3573 | + receive.setTaskQty(receiptDetail.getQty()); | |
3574 | + receiveList.add(receive); | |
3575 | + } | |
3576 | + Result<ReceiptContainerHeader> taskResult = receiveService.receivingIronCore(receiveList, warehouseCode); | |
3577 | + if (!taskResult.isSuccess()) { | |
3578 | + throw new JeecgBootException(result.getMessage()); | |
3579 | + } | |
3580 | +// result = receiptContainerHeaderService.createReceiptTask(taskResult.getResult(), warehouseCode); | |
3581 | +// if (!success) { | |
3582 | +// throw new JeecgBootException(result.getMessage()); | |
3583 | +// } | |
3584 | + ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getUnCompleteReceiptContainerByCode(containerCode, warehouseCode); | |
3585 | + if (receiptContainerHeader == null) { | |
3586 | + throw new JeecgBootException(result.getMessage()); | |
3587 | + } | |
3588 | + receiptContainerHeader.setToPort(toPort); | |
3589 | + success = receiptContainerHeaderService.updateById(receiptContainerHeader); | |
3590 | + if (!success) { | |
3591 | + throw new JeecgBootException("快速入库,更新入库组盘头失败"); | |
3592 | + } | |
3593 | + result = receiptContainerHeaderService.createReceiptTask(receiptContainerHeader, warehouseCode); | |
3594 | + if (!result.isSuccess()) { | |
3595 | + throw new JeecgBootException(result.getMessage()); | |
3596 | + } | |
3597 | + TaskHeader taskHeader = (TaskHeader)result.getResult(); | |
3598 | + if (taskHeader.getTaskType() == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT) { | |
3599 | + if (port == null) { | |
3600 | + throw new JeecgBootException("快速入库, 生成补充任务时必须有入库口"); | |
3601 | + } | |
3602 | + } | |
3603 | + if (!receiptHeaderService.updateReceiptHeader(receiptHeader.getId())) { | |
3604 | + throw new JeecgBootException("快速入库, 更新入库表单头失败"); | |
3605 | + } | |
3606 | + return Result.OK("快速入库成功"); | |
3607 | + } | |
3608 | + | |
3609 | + @Override | |
3610 | + @Transactional(rollbackFor = Exception.class) | |
3312 | 3611 | public Result receiptStageingReceipt(QucikReceiptEntity qucikReceiptEntity) { |
3313 | 3612 | boolean success = false; |
3314 | 3613 | String containerCode = qucikReceiptEntity.getContainerCode(); |
... | ... |