Commit c01b30ae34834b1636036b8dd6e8c395dfafc2cb
Merge branch 'develop' of http://git.huahengcloud.com/wms/wms4.git into develop
Showing
13 changed files
with
267 additions
and
4 deletions
ant-design-vue-jeecg/src/api/api.js
@@ -151,6 +151,8 @@ export const autoCombination = (params) => postAction('/shipment/shipmentCombina | @@ -151,6 +151,8 @@ export const autoCombination = (params) => postAction('/shipment/shipmentCombina | ||
151 | export const autoShipment = (params) => postAction('/shipment/shipmentHeader/autoShipment', params); | 151 | export const autoShipment = (params) => postAction('/shipment/shipmentHeader/autoShipment', params); |
152 | //自动预配盘出库 | 152 | //自动预配盘出库 |
153 | export const autoShipmentAdvice = (params) => postAction('/shipment/shipmentHeader/autoShipmentAdvice', params); | 153 | export const autoShipmentAdvice = (params) => postAction('/shipment/shipmentHeader/autoShipmentAdvice', params); |
154 | +//备货 | ||
155 | +export const stockUp = (params) => postAction('/shipment/shipmentHeader/stockUp', params); | ||
154 | //平库路径指引 | 156 | //平库路径指引 |
155 | export const autoFlatShipmentAdvice = (params) => postAction('/shipment/shipmentHeader/autoFlatShipmentAdvice', params); | 157 | export const autoFlatShipmentAdvice = (params) => postAction('/shipment/shipmentHeader/autoFlatShipmentAdvice', params); |
156 | //根据序列号扣减预配盘的库存 | 158 | //根据序列号扣减预配盘的库存 |
ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue
@@ -120,6 +120,7 @@ | @@ -120,6 +120,7 @@ | ||
120 | <div class="table-operator"> | 120 | <div class="table-operator"> |
121 | <a-button v-has="'shipmentHeader:add'" @click="handleAdd" type="primary" icon="plus">新增</a-button> | 121 | <a-button v-has="'shipmentHeader:add'" @click="handleAdd" type="primary" icon="plus">新增</a-button> |
122 | <a-button v-has="'shipmentHeader:mergeShipment'" @click="mergeShipment" type="primary">合并单据</a-button> | 122 | <a-button v-has="'shipmentHeader:mergeShipment'" @click="mergeShipment" type="primary">合并单据</a-button> |
123 | + <a-button v-has="'shipmentHeader:stockUp'" @click="stockUp" type="primary">备货</a-button> | ||
123 | <a-button v-has="'shipmentHeader:export'" type="primary" icon="download" @click="handleExportXls('出库单')">导出</a-button> | 124 | <a-button v-has="'shipmentHeader:export'" type="primary" icon="download" @click="handleExportXls('出库单')">导出</a-button> |
124 | <a-upload v-has="'shipmentHeader:import'" name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | 125 | <a-upload v-has="'shipmentHeader:import'" name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> |
125 | <a-button type="primary" icon="import">导入</a-button> | 126 | <a-button type="primary" icon="import">导入</a-button> |
@@ -275,7 +276,7 @@ import {downFile, getAction} from '@/api/manage' | @@ -275,7 +276,7 @@ import {downFile, getAction} from '@/api/manage' | ||
275 | import ShipmentDetailList from './ShipmentDetailList' | 276 | import ShipmentDetailList from './ShipmentDetailList' |
276 | import {initDictOptions, filterMultiDictText} from '@/components/dict/JDictSelectUtil' | 277 | import {initDictOptions, filterMultiDictText} from '@/components/dict/JDictSelectUtil' |
277 | import '@/assets/less/TableExpand.less' | 278 | import '@/assets/less/TableExpand.less' |
278 | -import {getCompanyList, backErpShipment, getZoneList, autoFlatShipmentAdvice} from '@/api/api' | 279 | +import {getCompanyList, backErpShipment, getZoneList, autoFlatShipmentAdvice, stockUp} from '@/api/api' |
279 | import {getShipmentTypeList} from '@/api/api' | 280 | import {getShipmentTypeList} from '@/api/api' |
280 | import {getCustomerList} from '@/api/api' | 281 | import {getCustomerList} from '@/api/api' |
281 | import {autoCombination} from '@/api/api' | 282 | import {autoCombination} from '@/api/api' |
@@ -712,6 +713,31 @@ export default { | @@ -712,6 +713,31 @@ export default { | ||
712 | this.searchQuery(); | 713 | this.searchQuery(); |
713 | }); | 714 | }); |
714 | }, | 715 | }, |
716 | + stockUp() { | ||
717 | + if (this.selectedRowKeys.length <= 0) { | ||
718 | + this.$message.warning('至少选择一条记录!') | ||
719 | + return | ||
720 | + } | ||
721 | + var shipmentHeaderList = [] | ||
722 | + for (var a = 0; a < this.selectedRowKeys.length; a++) { | ||
723 | + if (this.selectionRows[a] != null && this.selectionRows[a].firstStatus == 0 && this.selectionRows[a].lastStatus == 0) { | ||
724 | + shipmentHeaderList.push(this.selectionRows[a]) | ||
725 | + } | ||
726 | + } | ||
727 | + if (shipmentHeaderList.length > 0) { | ||
728 | + stockUp(shipmentHeaderList).then(res => { | ||
729 | + this.loading = false | ||
730 | + if (res.success) { | ||
731 | + this.$message.success(res.message) | ||
732 | + this.searchQuery() | ||
733 | + } else { | ||
734 | + this.$message.error(res.message) | ||
735 | + } | ||
736 | + }) | ||
737 | + } else { | ||
738 | + this.$message.error("至少选择两条符合条件的记录!") | ||
739 | + } | ||
740 | + }, | ||
715 | autoFlatShipmentAdvice(record) { | 741 | autoFlatShipmentAdvice(record) { |
716 | this.loading = true; | 742 | this.loading = true; |
717 | autoFlatShipmentAdvice(record).then((res) => { | 743 | autoFlatShipmentAdvice(record).then((res) => { |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/service/IHuahengMultiHandlerService.java
@@ -46,6 +46,8 @@ public interface IHuahengMultiHandlerService { | @@ -46,6 +46,8 @@ public interface IHuahengMultiHandlerService { | ||
46 | 46 | ||
47 | Result autoFlatShipmentAdvice(String shipmentCode, String warehouseCode); | 47 | Result autoFlatShipmentAdvice(String shipmentCode, String warehouseCode); |
48 | 48 | ||
49 | + Result stockUp(List<ShipmentHeader> shipmentHeaderList, String warehouseCode); | ||
50 | + | ||
49 | Result autoShipment(String shipmentCode, String warehouseCode); | 51 | Result autoShipment(String shipmentCode, String warehouseCode); |
50 | 52 | ||
51 | Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber); | 53 | Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber); |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/service/impl/HuahengMultiHandlerServiceImpl.java
@@ -408,6 +408,18 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem | @@ -408,6 +408,18 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem | ||
408 | } | 408 | } |
409 | 409 | ||
410 | @Override | 410 | @Override |
411 | + public Result stockUp(List<ShipmentHeader> shipmentHeaderList, String warehouseCode) { | ||
412 | + Result result = handleMultiProcess("stockUp", new MultiProcessListener() { | ||
413 | + @Override | ||
414 | + public Result<?> doProcess() { | ||
415 | + Result result = shipmentHeaderService.stockUp(shipmentHeaderList, warehouseCode); | ||
416 | + return result; | ||
417 | + } | ||
418 | + }); | ||
419 | + return result; | ||
420 | + } | ||
421 | + | ||
422 | + @Override | ||
411 | public Result autoShipment(String shipmentCode, String warehouseCode) { | 423 | public Result autoShipment(String shipmentCode, String warehouseCode) { |
412 | Result result = handleMultiProcess("combination", new MultiProcessListener() { | 424 | Result result = handleMultiProcess("combination", new MultiProcessListener() { |
413 | @Override | 425 | @Override |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryDetail.java
@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.annotation.IdType; | @@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.annotation.IdType; | ||
12 | import com.baomidou.mybatisplus.annotation.TableField; | 12 | import com.baomidou.mybatisplus.annotation.TableField; |
13 | import com.baomidou.mybatisplus.annotation.TableId; | 13 | import com.baomidou.mybatisplus.annotation.TableId; |
14 | import com.baomidou.mybatisplus.annotation.TableName; | 14 | import com.baomidou.mybatisplus.annotation.TableName; |
15 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
15 | 16 | ||
16 | import io.swagger.annotations.ApiModel; | 17 | import io.swagger.annotations.ApiModel; |
17 | import io.swagger.annotations.ApiModelProperty; | 18 | import io.swagger.annotations.ApiModelProperty; |
@@ -124,6 +125,7 @@ public class InventoryDetail implements Serializable { | @@ -124,6 +125,7 @@ public class InventoryDetail implements Serializable { | ||
124 | /** 入库日期 */ | 125 | /** 入库日期 */ |
125 | @Excel(name = "入库日期", width = 15) | 126 | @Excel(name = "入库日期", width = 15) |
126 | @ApiModelProperty(value = "入库日期") | 127 | @ApiModelProperty(value = "入库日期") |
128 | + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") | ||
127 | private Date receiptDate; | 129 | private Date receiptDate; |
128 | /** 库龄(天) */ | 130 | /** 库龄(天) */ |
129 | @Excel(name = "库龄(天)", width = 15) | 131 | @Excel(name = "库龄(天)", width = 15) |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/IShipmentCombinationService.java
@@ -4,6 +4,7 @@ import java.math.BigDecimal; | @@ -4,6 +4,7 @@ import java.math.BigDecimal; | ||
4 | import java.util.List; | 4 | import java.util.List; |
5 | 5 | ||
6 | import org.jeecg.common.api.vo.Result; | 6 | import org.jeecg.common.api.vo.Result; |
7 | +import org.jeecg.modules.wms.config.location.entity.Location; | ||
7 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; | 8 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; |
8 | import org.jeecg.modules.wms.shipment.shipmentCombination.entity.CombinationModel; | 9 | import org.jeecg.modules.wms.shipment.shipmentCombination.entity.CombinationModel; |
9 | import org.jeecg.modules.wms.shipment.shipmentCombination.entity.FlatShipment; | 10 | import org.jeecg.modules.wms.shipment.shipmentCombination.entity.FlatShipment; |
@@ -11,6 +12,7 @@ import org.jeecg.modules.wms.shipment.shipmentContainerAdvice.entity.ShipmentCon | @@ -11,6 +12,7 @@ import org.jeecg.modules.wms.shipment.shipmentContainerAdvice.entity.ShipmentCon | ||
11 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerDetail; | 12 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerDetail; |
12 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; | 13 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; |
13 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; | 14 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; |
15 | +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; | ||
14 | 16 | ||
15 | /** | 17 | /** |
16 | * @author 游杰 | 18 | * @author 游杰 |
@@ -29,6 +31,8 @@ public interface IShipmentCombinationService { | @@ -29,6 +31,8 @@ public interface IShipmentCombinationService { | ||
29 | 31 | ||
30 | Result autoCombination(String shipmentCode, boolean advice, String warehouseCode); | 32 | Result autoCombination(String shipmentCode, boolean advice, String warehouseCode); |
31 | 33 | ||
34 | + Result stockUp(List<ShipmentHeader> shipmentHeaderList, String warehouseCode); | ||
35 | + | ||
32 | Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber); | 36 | Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber); |
33 | 37 | ||
34 | Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, int forceTaskType, String warehouseCode); | 38 | Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, int forceTaskType, String warehouseCode); |
@@ -50,6 +54,10 @@ public interface IShipmentCombinationService { | @@ -50,6 +54,10 @@ public interface IShipmentCombinationService { | ||
50 | 54 | ||
51 | Result autoCombinationDetail(ShipmentDetail shipmentDetail, boolean advice, BigDecimal shipQty); | 55 | Result autoCombinationDetail(ShipmentDetail shipmentDetail, boolean advice, BigDecimal shipQty); |
52 | 56 | ||
57 | + Result stockUp(ShipmentDetail shipmentDetail); | ||
58 | + | ||
59 | + Result stockUpMove(Location location); | ||
60 | + | ||
53 | ShipmentContainerHeader addShipmentContainerHeader(InventoryDetail inventoryDetail, ShipmentDetail shipmentDetail); | 61 | ShipmentContainerHeader addShipmentContainerHeader(InventoryDetail inventoryDetail, ShipmentDetail shipmentDetail); |
54 | 62 | ||
55 | ShipmentContainerDetail addShipmentContainerDetail(ShipmentContainerHeader shipmentContainerHeader, CombinationModel combinationModel); | 63 | ShipmentContainerDetail addShipmentContainerDetail(ShipmentContainerHeader shipmentContainerHeader, CombinationModel combinationModel); |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java
@@ -299,6 +299,58 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi | @@ -299,6 +299,58 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi | ||
299 | 299 | ||
300 | @Override | 300 | @Override |
301 | @Transactional(rollbackFor = Exception.class) | 301 | @Transactional(rollbackFor = Exception.class) |
302 | + public Result stockUp(List<ShipmentHeader> shipmentHeaderList, String warehouseCode) { | ||
303 | + log.info("备货,单号" + shipmentHeaderList); | ||
304 | + List<String> shipmentCodeList = shipmentHeaderList.stream().map(ShipmentHeader::getCode).collect(Collectors.toList()); | ||
305 | + for (ShipmentHeader shipmentHeader : shipmentHeaderList) { | ||
306 | + if (shipmentHeader == null) { | ||
307 | + return Result.error("备货, 系统没有此单据"); | ||
308 | + } | ||
309 | + if (shipmentHeader.getLastStatus() >= QuantityConstant.SHIPMENT_HEADER_COMPLETED) { | ||
310 | + return Result.OK("备货,出库单已经作业完毕"); | ||
311 | + } | ||
312 | + } | ||
313 | + LambdaQueryWrapper<ShipmentDetail> shipmentDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
314 | + shipmentDetailLambdaQueryWrapper.in(ShipmentDetail::getShipmentCode, shipmentCodeList).eq(ShipmentDetail::getWarehouseCode, warehouseCode); | ||
315 | + List<ShipmentDetail> shipmentDetailList = shipmentDetailService.list(shipmentDetailLambdaQueryWrapper); | ||
316 | + if (shipmentDetailList.isEmpty()) { | ||
317 | + return Result.error("备货, 出库单没有明细", null); | ||
318 | + } | ||
319 | + boolean over = true; | ||
320 | + for (int i = 0; i < shipmentDetailList.size() - 1; i++) { | ||
321 | + for (int j = shipmentDetailList.size() - 1; j > i; j--) { | ||
322 | + ShipmentDetail shipmentDetail1 = shipmentDetailList.get(i); | ||
323 | + ShipmentDetail shipmentDetail2 = shipmentDetailList.get(j); | ||
324 | + if (shipmentDetail1.getMaterialCode().equals(shipmentDetail2.getMaterialCode()) && shipmentDetail1.getBatch().equals(shipmentDetail2.getBatch()) | ||
325 | + && shipmentDetail1.getLot().equals(shipmentDetail2.getLot()) && shipmentDetail1.getProject().equals(shipmentDetail2.getProject()) | ||
326 | + && shipmentDetail1.getInventoryStatus().equals(shipmentDetail2.getInventoryStatus())) { | ||
327 | + BigDecimal totalQty = shipmentDetail1.getQty().add(shipmentDetail2.getQty()); | ||
328 | + shipmentDetail1.setQty(totalQty); | ||
329 | + ShipmentDetail shipmentDetail = new ShipmentDetail(); | ||
330 | + shipmentDetail.setId(shipmentDetail1.getId()); | ||
331 | + shipmentDetail.setQty(totalQty); | ||
332 | + shipmentDetailList.remove(j); | ||
333 | + } | ||
334 | + } | ||
335 | + } | ||
336 | + for (ShipmentDetail shipmentDetail : shipmentDetailList) { | ||
337 | + if (shipmentDetail.getTaskQty().compareTo(shipmentDetail.getQty()) < 0) { | ||
338 | + over = false; | ||
339 | + } | ||
340 | + Result result = shipmentCombinationService.stockUp(shipmentDetail); | ||
341 | + if (!result.isSuccess()) { | ||
342 | + throw new JeecgBootException(result.getMessage()); | ||
343 | + } | ||
344 | + } | ||
345 | + log.info("备货完成,单号" + shipmentHeaderList); | ||
346 | + if (over) { | ||
347 | + return Result.error("出库单已经备货"); | ||
348 | + } | ||
349 | + return Result.OK("备货完成"); | ||
350 | + } | ||
351 | + | ||
352 | + @Override | ||
353 | + @Transactional(rollbackFor = Exception.class) | ||
302 | public Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber) { | 354 | public Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber) { |
303 | return shipmentCombinationService.createShipmentTask(shipmentContainerHeader, 0, warehouseCode, shipmentOrder, sequence, sequenceNumber); | 355 | return shipmentCombinationService.createShipmentTask(shipmentContainerHeader, 0, warehouseCode, shipmentOrder, sequence, sequenceNumber); |
304 | } | 356 | } |
@@ -403,6 +455,107 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi | @@ -403,6 +455,107 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi | ||
403 | 455 | ||
404 | @Override | 456 | @Override |
405 | @Transactional(rollbackFor = Exception.class) | 457 | @Transactional(rollbackFor = Exception.class) |
458 | + public Result stockUp(ShipmentDetail shipmentDetail) { | ||
459 | + // 出库数量 | ||
460 | + BigDecimal shipmentQty = shipmentDetail.getQty().subtract(shipmentDetail.getTaskQty()); | ||
461 | + // 判断是否还有需要出库的物料,如果没有就跳过该物料 | ||
462 | + if (shipmentQty.compareTo(BigDecimal.ZERO) <= 0) { | ||
463 | + return Result.OK("备货, 出库数量必须大于0"); | ||
464 | + } | ||
465 | + List<InventoryDetail> inventoryList = shipmentCombinationService.getInventorys(shipmentDetail); | ||
466 | + // 去除已锁的库存 | ||
467 | + ArrayList<InventoryDetail> removeInventoryList = new ArrayList<>(); | ||
468 | + List<ReceiptContainerHeader> receiptContainerHeaderList = receiptContainerHeaderService.getUnCompleteCombineList(); | ||
469 | + List<ShipmentContainerHeader> shipmentContainerHeaderList = shipmentContainerHeaderService.getNotCombineList(); | ||
470 | + for (InventoryDetail inventoryDetail : inventoryList) { | ||
471 | + String containerCode = inventoryDetail.getContainerCode(); | ||
472 | + String warehouseCode = inventoryDetail.getWarehouseCode(); | ||
473 | + Container container = containerService.getContainerByCode(containerCode, warehouseCode); | ||
474 | + if (container == null) { | ||
475 | + return Result.error("备货,没有找到容器:" + containerCode); | ||
476 | + } | ||
477 | + if (container.getStatus().equals(QuantityConstant.STATUS_CONTAINER_LOCK)) { | ||
478 | + removeInventoryList.add(inventoryDetail); | ||
479 | + continue; | ||
480 | + } | ||
481 | + for (ReceiptContainerHeader receiptContainerHeader : receiptContainerHeaderList) { | ||
482 | + if (receiptContainerHeader.getContainerCode().equals(containerCode)) { | ||
483 | + removeInventoryList.add(inventoryDetail); | ||
484 | + continue; | ||
485 | + } | ||
486 | + } | ||
487 | + for (ShipmentContainerHeader shipmentContainerHeader : shipmentContainerHeaderList) { | ||
488 | + if (shipmentContainerHeader.getContainerCode().equals(containerCode)) { | ||
489 | + removeInventoryList.add(inventoryDetail); | ||
490 | + continue; | ||
491 | + } | ||
492 | + } | ||
493 | + } | ||
494 | + inventoryList.removeAll(removeInventoryList); | ||
495 | + if (inventoryList.size() < 1) { | ||
496 | + return Result.error("备货," + shipmentDetail.getMaterialName() + "没有符合出库条件的库存"); | ||
497 | + } | ||
498 | + | ||
499 | + for (InventoryDetail inventoryDetail : inventoryList) { | ||
500 | + BigDecimal inventoryQty = inventoryDetail.getQty().subtract(inventoryDetail.getTaskQty()); | ||
501 | + if (inventoryQty.compareTo(BigDecimal.ZERO) == 0) { | ||
502 | + continue; | ||
503 | + } | ||
504 | + // 判断需要配盘数量是否等于0,等于0代表配盘完毕,完毕就退出内循环 | ||
505 | + if (shipmentQty.compareTo(BigDecimal.ZERO) == 0) { | ||
506 | + break; | ||
507 | + } | ||
508 | + if (shipmentQty.compareTo(BigDecimal.ZERO) < 0) { | ||
509 | + throw new JeecgBootException("备货,出库数量不能小于0"); | ||
510 | + } | ||
511 | + if (inventoryQty.compareTo(shipmentQty) >= 0) { | ||
512 | + shipmentQty = BigDecimal.ZERO; | ||
513 | + } else { | ||
514 | + shipmentQty = shipmentQty.subtract(inventoryQty); | ||
515 | + } | ||
516 | + String locationCode = inventoryDetail.getLocationCode(); | ||
517 | + Location location = locationService.getLocationByCode(locationCode, inventoryDetail.getWarehouseCode()); | ||
518 | + Result result = shipmentCombinationService.stockUpMove(location); | ||
519 | + if (!result.isSuccess()) { | ||
520 | + throw new JeecgBootException("备货失败" + result.getMessage()); | ||
521 | + } | ||
522 | + } | ||
523 | + return Result.OK("备货成功"); | ||
524 | + } | ||
525 | + | ||
526 | + @Override | ||
527 | + @Transactional(rollbackFor = Exception.class) | ||
528 | + public Result stockUpMove(Location fromLocation) { | ||
529 | + int rowFlag = fromLocation.getRowFlag(); | ||
530 | + Location insideLocation = locationService.getInsideNear(fromLocation); | ||
531 | + if (insideLocation == null) { | ||
532 | + return Result.ok("备货移库, 分配库位时" + fromLocation + "没有找到对应的内侧库位"); | ||
533 | + } | ||
534 | + String insideLocationCode = insideLocation.getCode(); | ||
535 | + String warehouseCode = insideLocation.getWarehouseCode(); | ||
536 | + if (rowFlag == QuantityConstant.ROW_OUT) { | ||
537 | + // 如果对应内侧库位有托盘 | ||
538 | + if (StringUtils.isNotEmpty(insideLocation.getContainerCode())) { | ||
539 | + // 如果对应内侧库位有托盘数据,那么不可能会有入库类型的任务,因为正在执行的入库类型的任务 库位是不会有托盘数据的。 | ||
540 | + TaskHeader unCompleteTaskHeader = taskHeaderService.getUnCompleteTaskByFromLocationCode(insideLocationCode, warehouseCode); | ||
541 | + if (unCompleteTaskHeader == null) { | ||
542 | + // 找空闲库位,优先找外侧空闲库位,作为移库目的地 | ||
543 | + Location destinationLocation = locationService.getEmptyLocation(insideLocation); | ||
544 | + if (destinationLocation == null) { | ||
545 | + return Result.error("备货移库, 移库没有剩余库位"); | ||
546 | + } | ||
547 | + Result<TaskHeader> result = taskHeaderService.createTransferTask(insideLocation.getCode(), destinationLocation.getCode(), warehouseCode); | ||
548 | + if (!result.isSuccess()) { | ||
549 | + throw new JeecgBootException("备货移库," + result.getMessage()); | ||
550 | + } | ||
551 | + } | ||
552 | + } | ||
553 | + } | ||
554 | + return Result.ok("备货移库成功"); | ||
555 | + } | ||
556 | + | ||
557 | + @Override | ||
558 | + @Transactional(rollbackFor = Exception.class) | ||
406 | @OperationLog(bizId = "''", bizType = "'出库单追踪'", tag = "'详情配盘'", extra = "#extraJsonString", msg = "''", recordReturnValue = true) | 559 | @OperationLog(bizId = "''", bizType = "'出库单追踪'", tag = "'详情配盘'", extra = "#extraJsonString", msg = "''", recordReturnValue = true) |
407 | public Result combination(CombinationModel combinationModel) { | 560 | public Result combination(CombinationModel combinationModel) { |
408 | BigDecimal shipmentQty = combinationModel.getShipQty(); | 561 | BigDecimal shipmentQty = combinationModel.getShipQty(); |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java
@@ -471,6 +471,16 @@ public class ShipmentHeaderController extends JeecgController<ShipmentHeader, IS | @@ -471,6 +471,16 @@ public class ShipmentHeaderController extends JeecgController<ShipmentHeader, IS | ||
471 | return result; | 471 | return result; |
472 | } | 472 | } |
473 | 473 | ||
474 | + @AutoLog(value = "备货") | ||
475 | + @ApiOperation(value = "备货", notes = "备货") | ||
476 | + @PostMapping("/stockUp") | ||
477 | + @ResponseBody | ||
478 | + public Result stockUp(@RequestBody List<ShipmentHeader> shipmentHeaderList, HttpServletRequest req) { | ||
479 | + String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); | ||
480 | + Result result = huahengMultiHandlerService.stockUp(shipmentHeaderList, warehouseCode); | ||
481 | + return result; | ||
482 | + } | ||
483 | + | ||
474 | /** | 484 | /** |
475 | * 获取出库单物料库存信息 | 485 | * 获取出库单物料库存信息 |
476 | * @return | 486 | * @return |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/IShipmentDetailService.java
@@ -4,7 +4,6 @@ import java.math.BigDecimal; | @@ -4,7 +4,6 @@ import java.math.BigDecimal; | ||
4 | import java.util.List; | 4 | import java.util.List; |
5 | 5 | ||
6 | import org.jeecg.common.api.vo.Result; | 6 | import org.jeecg.common.api.vo.Result; |
7 | -import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; | ||
8 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; | 7 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; |
9 | 8 | ||
10 | import com.baomidou.mybatisplus.extension.service.IService; | 9 | import com.baomidou.mybatisplus.extension.service.IService; |
@@ -23,6 +22,8 @@ public interface IShipmentDetailService extends IService<ShipmentDetail> { | @@ -23,6 +22,8 @@ public interface IShipmentDetailService extends IService<ShipmentDetail> { | ||
23 | 22 | ||
24 | public List<ShipmentDetail> getShipmentDetailListByShipmentId(Integer id); | 23 | public List<ShipmentDetail> getShipmentDetailListByShipmentId(Integer id); |
25 | 24 | ||
25 | + List<ShipmentDetail> getShipmentDetailListByShipmentCode(String code); | ||
26 | + | ||
26 | boolean batchSave(List<ShipmentDetail> shipmentDetailList); | 27 | boolean batchSave(List<ShipmentDetail> shipmentDetailList); |
27 | 28 | ||
28 | boolean updateTaskQtyAndStatusById(BigDecimal taskQty, int status, int id); | 29 | boolean updateTaskQtyAndStatusById(BigDecimal taskQty, int status, int id); |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/IShipmentHeaderService.java
@@ -54,6 +54,8 @@ public interface IShipmentHeaderService extends IService<ShipmentHeader> { | @@ -54,6 +54,8 @@ public interface IShipmentHeaderService extends IService<ShipmentHeader> { | ||
54 | 54 | ||
55 | Result autoFlatShipmentAdvice(String shipmentCode, String warehouseCode); | 55 | Result autoFlatShipmentAdvice(String shipmentCode, String warehouseCode); |
56 | 56 | ||
57 | + Result stockUp(List<ShipmentHeader> shipmentHeaderList, String warehouseCode); | ||
58 | + | ||
57 | Result createShipment(WaveConfig waveConfig, List<WaveConfigDetail> waveConfigDetailList); | 59 | Result createShipment(WaveConfig waveConfig, List<WaveConfigDetail> waveConfigDetailList); |
58 | 60 | ||
59 | Result updateShipmentHeader(ShipmentDetail shipmentDetail); | 61 | Result updateShipmentHeader(ShipmentDetail shipmentDetail); |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentDetailServiceImpl.java
@@ -117,6 +117,14 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | @@ -117,6 +117,14 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | ||
117 | } | 117 | } |
118 | 118 | ||
119 | @Override | 119 | @Override |
120 | + public List<ShipmentDetail> getShipmentDetailListByShipmentCode(String code) { | ||
121 | + LambdaQueryWrapper<ShipmentDetail> shipmentDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
122 | + shipmentDetailLambdaQueryWrapper.eq(ShipmentDetail::getShipmentCode, code); | ||
123 | + List<ShipmentDetail> shipmentDetailList = shipmentDetailService.list(shipmentDetailLambdaQueryWrapper); | ||
124 | + return shipmentDetailList; | ||
125 | + } | ||
126 | + | ||
127 | + @Override | ||
120 | public boolean batchSave(List<ShipmentDetail> shipmentDetailList) { | 128 | public boolean batchSave(List<ShipmentDetail> shipmentDetailList) { |
121 | return this.saveBatch(shipmentDetailList); | 129 | return this.saveBatch(shipmentDetailList); |
122 | } | 130 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java
@@ -496,7 +496,7 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, | @@ -496,7 +496,7 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, | ||
496 | if (shipmentContainerHeader == null) { | 496 | if (shipmentContainerHeader == null) { |
497 | throw new JeecgBootException("自动出库, 没有找到出库表头:" + shipmentContainerId); | 497 | throw new JeecgBootException("自动出库, 没有找到出库表头:" + shipmentContainerId); |
498 | } | 498 | } |
499 | - if (shipmentContainerHeader.getStatus().intValue() == QuantityConstant.SHIPMENT_CONTAINER_FINISHED) { | 499 | + if (shipmentContainerHeader.getStatus().intValue() > QuantityConstant.SHIPMENT_CONTAINER_BUILD) { |
500 | continue; | 500 | continue; |
501 | } | 501 | } |
502 | int taskType = shipmentContainerHeader.getTaskType(); | 502 | int taskType = shipmentContainerHeader.getTaskType(); |
@@ -690,6 +690,44 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, | @@ -690,6 +690,44 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, | ||
690 | 690 | ||
691 | @Override | 691 | @Override |
692 | @Transactional(rollbackFor = Exception.class) | 692 | @Transactional(rollbackFor = Exception.class) |
693 | + public Result stockUp(List<ShipmentHeader> shipmentHeaderList, String warehouseCode) { | ||
694 | + for (ShipmentHeader shipmentHeader : shipmentHeaderList) { | ||
695 | + if (shipmentHeader == null) { | ||
696 | + throw new JeecgBootException("备货, 没有找到出库单"); | ||
697 | + } | ||
698 | + String shipmentCode = shipmentHeader.getCode(); | ||
699 | + if (StringUtils.isEmpty(shipmentCode)) { | ||
700 | + return Result.error("备货, 出库单编码为空"); | ||
701 | + } | ||
702 | + if (StringUtils.isEmpty(warehouseCode)) { | ||
703 | + return Result.error("备货, 仓库编码为空"); | ||
704 | + } | ||
705 | + String zoneCode = shipmentHeader.getZoneCode(); | ||
706 | + if (StringUtils.isEmpty(zoneCode)) { | ||
707 | + throw new JeecgBootException("备货, 库区编码为空"); | ||
708 | + } | ||
709 | + Zone zone = zoneService.getZoneByCode(zoneCode, warehouseCode); | ||
710 | + if (zone == null) { | ||
711 | + throw new JeecgBootException("备货, 库区为空"); | ||
712 | + } | ||
713 | + String zoneType = zone.getType(); | ||
714 | + if (StringUtils.isEmpty(zoneType)) { | ||
715 | + throw new JeecgBootException("备货, 库区类型编码为空"); | ||
716 | + } | ||
717 | + if (!zoneType.equals(QuantityConstant.ZONE_TYPE_STEREOSCOPIC)) { | ||
718 | + throw new JeecgBootException("备货, 库区类型必须为立库区类型"); | ||
719 | + } | ||
720 | + } | ||
721 | + Result result = shipmentCombinationService.stockUp(shipmentHeaderList, warehouseCode); | ||
722 | + if (!result.isSuccess()) { | ||
723 | + throw new JeecgBootException("备货," + result.getMessage()); | ||
724 | + } | ||
725 | + | ||
726 | + return Result.OK("备货成功"); | ||
727 | + } | ||
728 | + | ||
729 | + @Override | ||
730 | + @Transactional(rollbackFor = Exception.class) | ||
693 | public Result createShipment(WaveConfig waveConfig, List<WaveConfigDetail> waveConfigDetailList) { | 731 | public Result createShipment(WaveConfig waveConfig, List<WaveConfigDetail> waveConfigDetailList) { |
694 | String zoneType = null; | 732 | String zoneType = null; |
695 | if (StringUtils.isNotEmpty(waveConfig.getZoneCode())) { | 733 | if (StringUtils.isNotEmpty(waveConfig.getZoneCode())) { |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
@@ -1918,7 +1918,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1918,7 +1918,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1918 | @Transactional(rollbackFor = Exception.class) | 1918 | @Transactional(rollbackFor = Exception.class) |
1919 | public boolean combineInventoryDetail(String containerCode, String warehouseCode) { | 1919 | public boolean combineInventoryDetail(String containerCode, String warehouseCode) { |
1920 | boolean success = false; | 1920 | boolean success = false; |
1921 | - | ||
1922 | InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); | 1921 | InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); |
1923 | if (inventoryHeader == null) { | 1922 | if (inventoryHeader == null) { |
1924 | throw new JeecgBootException("合并库存时, 没有找到库存头"); | 1923 | throw new JeecgBootException("合并库存时, 没有找到库存头"); |