Commit fe97f723660a5d353def77afed80c6405ea57275
1 parent
cd1b594c
批量新增 减少查询
Showing
7 changed files
with
61 additions
and
5 deletions
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/service/IInventoryTransactionService.java
... | ... | @@ -3,6 +3,8 @@ package org.jeecg.modules.wms.inventory.inventoryTransaction.service; |
3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
4 | 4 | import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; |
5 | 5 | |
6 | +import java.util.List; | |
7 | + | |
6 | 8 | /** |
7 | 9 | * @Description: 库存交易记录 |
8 | 10 | * @Author: jeecg-boot |
... | ... | @@ -11,4 +13,6 @@ import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTran |
11 | 13 | */ |
12 | 14 | public interface IInventoryTransactionService extends IService<InventoryTransaction> { |
13 | 15 | |
16 | + boolean batchSave(List<InventoryTransaction> inventoryTransactionList); | |
17 | + | |
14 | 18 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/service/impl/InventoryTransactionServiceImpl.java
... | ... | @@ -7,6 +7,8 @@ import org.springframework.stereotype.Service; |
7 | 7 | |
8 | 8 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
9 | 9 | |
10 | +import java.util.List; | |
11 | + | |
10 | 12 | /** |
11 | 13 | * @Description: 库存交易记录 |
12 | 14 | * @Author: jeecg-boot |
... | ... | @@ -16,4 +18,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
16 | 18 | @Service |
17 | 19 | public class InventoryTransactionServiceImpl extends ServiceImpl<InventoryTransactionMapper, InventoryTransaction> implements IInventoryTransactionService { |
18 | 20 | |
21 | + @Override | |
22 | + public boolean batchSave(List<InventoryTransaction> inventoryTransactionList) { | |
23 | + return this.saveBatch(inventoryTransactionList); | |
24 | + } | |
19 | 25 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/service/IReceiptDetailService.java
... | ... | @@ -18,4 +18,6 @@ public interface IReceiptDetailService extends IService<ReceiptDetail> { |
18 | 18 | public List<ReceiptDetail> selectByMainId(String mainId); |
19 | 19 | |
20 | 20 | public Result saveReceiptDetail(ReceiptDetail receiptDetail); |
21 | + | |
22 | + boolean batchSave(List<ReceiptDetail> receiptDetailList); | |
21 | 23 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/service/impl/ReceiptDetailServiceImpl.java
... | ... | @@ -81,4 +81,9 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R |
81 | 81 | } |
82 | 82 | return Result.OK("添加成功!"); |
83 | 83 | } |
84 | + | |
85 | + @Override | |
86 | + public boolean batchSave(List<ReceiptDetail> receiptDetailList) { | |
87 | + return this.saveBatch(receiptDetailList); | |
88 | + } | |
84 | 89 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/IShipmentDetailService.java
... | ... | @@ -20,4 +20,6 @@ public interface IShipmentDetailService extends IService<ShipmentDetail> { |
20 | 20 | public Result saveShipmentDetail(ShipmentDetail shipmentDetail); |
21 | 21 | |
22 | 22 | public List<ShipmentDetail> getShipmentDetailListByShipmentId(Integer id); |
23 | + | |
24 | + boolean batchSave(List<ShipmentDetail> shipmentDetailList); | |
23 | 25 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentDetailServiceImpl.java
... | ... | @@ -94,4 +94,9 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, |
94 | 94 | List<ShipmentDetail> shipmentDetailList = shipmentDetailService.list(shipmentDetailLambdaQueryWrapper); |
95 | 95 | return shipmentDetailList; |
96 | 96 | } |
97 | + | |
98 | + @Override | |
99 | + public boolean batchSave(List<ShipmentDetail> shipmentDetailList) { | |
100 | + return this.saveBatch(shipmentDetailList); | |
101 | + } | |
97 | 102 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... | ... | @@ -1561,6 +1561,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1561 | 1561 | String warehousingOrderCode=null; |
1562 | 1562 | |
1563 | 1563 | |
1564 | + | |
1565 | + | |
1566 | + | |
1567 | + | |
1568 | + | |
1569 | + List<ShipmentDetail> shipmentDetailList = new ArrayList<>(); | |
1570 | + List<ReceiptDetail> receiptDetailList=new ArrayList<>(); | |
1571 | + List<InventoryTransaction> inventoryTransactionList=new ArrayList<>(); | |
1572 | + //筛选明细 | |
1564 | 1573 | for (CycleCountDetailChild child : children) |
1565 | 1574 | { |
1566 | 1575 | if (!child.getChildStatus().equals(QuantityConstant.CYCLECOUNT_STATUS_REGISTERED)) |
... | ... | @@ -1569,6 +1578,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1569 | 1578 | } |
1570 | 1579 | |
1571 | 1580 | |
1581 | + | |
1582 | + //如果是有库存明细的 | |
1572 | 1583 | if (child.getInventoryDetaiId()!=null) |
1573 | 1584 | { |
1574 | 1585 | InventoryDetail inventoryDetail = inventoryDetailService.getById(child.getInventoryDetaiId()); |
... | ... | @@ -1581,6 +1592,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1581 | 1592 | inventoryDetailService.updateById(inventoryDetail); |
1582 | 1593 | }else |
1583 | 1594 | { |
1595 | + //没库存明细就加一个 没库存明细就是盘盈多出来的一种物料 | |
1584 | 1596 | InventoryDetail inventoryDetail=new InventoryDetail(); |
1585 | 1597 | inventoryDetail.setInventoryHeaderId(inventoryHeader.getId()); |
1586 | 1598 | inventoryDetail.setWarehouseCode(inventoryHeader.getWarehouseCode()); |
... | ... | @@ -1639,7 +1651,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1639 | 1651 | receiptDetail.setBatch(child.getBatch()); |
1640 | 1652 | receiptDetail.setLot(child.getLot()); |
1641 | 1653 | receiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); |
1642 | - receiptDetailService.save(receiptDetail); | |
1654 | + receiptDetailList.add(receiptDetail); | |
1655 | +// receiptDetailService.save(receiptDetail); | |
1643 | 1656 | |
1644 | 1657 | //增加库存交易记录 |
1645 | 1658 | InventoryTransaction inventoryTransaction=new InventoryTransaction(); |
... | ... | @@ -1658,7 +1671,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1658 | 1671 | inventoryTransaction.setQty(child.getCountedQty()); |
1659 | 1672 | inventoryTransaction.setBatch(child.getBatch()); |
1660 | 1673 | inventoryTransaction.setLot(child.getLot()); |
1661 | - inventoryTransactionService.save(inventoryTransaction); | |
1674 | + inventoryTransactionList.add(inventoryTransaction); | |
1675 | +// inventoryTransactionService.save(inventoryTransaction); | |
1662 | 1676 | |
1663 | 1677 | } |
1664 | 1678 | |
... | ... | @@ -1709,7 +1723,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1709 | 1723 | shipmentDetail.setBatch(child.getBatch()); |
1710 | 1724 | shipmentDetail.setLot(child.getLot()); |
1711 | 1725 | shipmentDetail.setStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); |
1712 | - shipmentDetailService.save(shipmentDetail); | |
1726 | + shipmentDetailList.add(shipmentDetail); | |
1713 | 1727 | |
1714 | 1728 | InventoryTransaction inventoryTransaction=new InventoryTransaction(); |
1715 | 1729 | inventoryTransaction.setWarehouseCode(taskHeader.getWarehouseCode()); |
... | ... | @@ -1727,17 +1741,35 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1727 | 1741 | inventoryTransaction.setQty(child.getCountedQty()); |
1728 | 1742 | inventoryTransaction.setBatch(child.getBatch()); |
1729 | 1743 | inventoryTransaction.setLot(child.getLot()); |
1730 | - inventoryTransactionService.save(inventoryTransaction); | |
1744 | + inventoryTransactionList.add(inventoryTransaction); | |
1731 | 1745 | } |
1732 | 1746 | cycleCountDetailChildService.updateById(child); |
1733 | 1747 | } |
1734 | 1748 | |
1735 | - | |
1736 | 1749 | if (inventoryHeader.getTotalQty().compareTo(BigDecimal.ZERO)<1) |
1737 | 1750 | { |
1738 | 1751 | inventoryHeaderService.removeById(inventoryHeader); |
1739 | 1752 | } |
1740 | 1753 | |
1754 | + | |
1755 | + | |
1756 | + //保存出库明细 | |
1757 | + if (!shipmentDetailService.batchSave(shipmentDetailList)) { | |
1758 | + throw new ServiceException("出库明细失败!"); | |
1759 | + } | |
1760 | + | |
1761 | + //保存入库明细 | |
1762 | + if (!receiptDetailService.batchSave(receiptDetailList)) { | |
1763 | + throw new ServiceException("保存入库明细失败!"); | |
1764 | + } | |
1765 | + | |
1766 | + | |
1767 | + //保存交易记录 | |
1768 | + if (!inventoryTransactionService.batchSave(inventoryTransactionList)) { | |
1769 | + throw new ServiceException("保存库存记录失败!"); | |
1770 | + } | |
1771 | + | |
1772 | + | |
1741 | 1773 | inventoryHeaderService.updateById(inventoryHeader); |
1742 | 1774 | |
1743 | 1775 | //4.完成当前任务 |
... | ... |