From 315d96063abc7d4d688467ed970dfbd4a887db92 Mon Sep 17 00:00:00 2001 From: rcx <3084692334@qq.com> Date: Thu, 6 Aug 2026 17:08:54 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fix(=E5=BA=93=E5=AD=98=E6=A8=A1=E5=9D=97):?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E5=BA=93=E5=AD=98=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=B9=B6=E4=BC=98=E5=8C=96=E5=8D=B3=E6=97=B6?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 库存调整:修复部分商品在点击“完成库存调整”后数据未更新的问题。 即时库存:移除 JSON 返回列表中每个对象冗余的库存数量合计字段,改为在最外层统一返回,优化并缩短接口整体响应时间。 --- .../StatementStatisticsService.java | 23 ++--- ...nventoryAdjustmentRecordDomainService.java | 85 ++++++++++++++++--- .../po/ImmediateInventoryPO.java | 4 - .../StatementStatisticsApi.java | 21 ++++- .../MaterialInventoryMapper.xml | 1 - 5 files changed, 104 insertions(+), 30 deletions(-) diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/statementStatistics/StatementStatisticsService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/statementStatistics/StatementStatisticsService.java index f358a9a11..4c93bea75 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/statementStatistics/StatementStatisticsService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/statementStatistics/StatementStatisticsService.java @@ -129,16 +129,6 @@ public class StatementStatisticsService { } List immediateInventoryPOS = materialInventoryDomainService.queryImmediateInventoryList(immediateInventoryDO); - // 库存数量合计:与列表同筛选条件、不分页统计全部库存数量,回填到每行 - if (!CollectionUtils.isEmpty(immediateInventoryPOS)) { - BigDecimal totalInventoryQuantity = materialInventoryDomainService.sumImmediateInventoryQuantity(immediateInventoryDO); - if (totalInventoryQuantity == null) { - totalInventoryQuantity = BigDecimal.ZERO; - } - BigDecimal finalTotal = totalInventoryQuantity; - immediateInventoryPOS.forEach(po -> po.setTotalInventoryQuantity(finalTotal)); - } - // 性能优化:批量获取批次属性,避免N+1查询问题 // 1. 收集所有唯一的materialBaseInfoId Set materialBaseInfoIdSet = immediateInventoryPOS.stream() @@ -173,6 +163,19 @@ public class StatementStatisticsService { return immediateInventoryPOS; } + /** + * 获取库存数量合计 + * @param immediateInventoryDO 查询参数 + * @return 库存数量合计 + */ + public BigDecimal sumImmediateInventoryQuantity(ImmediateInventoryDO immediateInventoryDO) { + BigDecimal totalInventoryQuantity = materialInventoryDomainService.sumImmediateInventoryQuantity(immediateInventoryDO); + if (totalInventoryQuantity == null) { + totalInventoryQuantity = BigDecimal.ZERO; + } + return totalInventoryQuantity; + } + /** * 为物料库存设置更多属性(从库存表中获取值) * @param materialInventoryPOList 物料库存列表 diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/inventoryAdjustmentRecord/service/InventoryAdjustmentRecordDomainService.java b/mhd_wms/src/main/java/com/mhd/wms/domain/inventoryAdjustmentRecord/service/InventoryAdjustmentRecordDomainService.java index 9bccb9db7..f728e90c8 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/inventoryAdjustmentRecord/service/InventoryAdjustmentRecordDomainService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/inventoryAdjustmentRecord/service/InventoryAdjustmentRecordDomainService.java @@ -7,6 +7,8 @@ import com.mhd.common.core.constant.SnowFlakeConstants; import com.mhd.common.core.domain.po.UserPo; import com.mhd.common.core.utils.OrderSequence; import com.mhd.common.core.utils.uuid.IdGenerator; +import com.mhd.common.core.utils.StringUtils; +import com.mhd.common.core.web.domain.AjaxResult; import com.mhd.common.core.web.domain.BaseVOEntity; import com.mhd.common.security.utils.SecurityUtils; import com.mhd.system.api.OmsServiceFeign; @@ -115,6 +117,17 @@ public class InventoryAdjustmentRecordDomainService { inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid()); inventoryAdjustmentRecord.setCreateByName(loginUser.getUsername()); inventoryAdjustmentRecord.setCreateTime(new Date()); + if (inventoryAdjustmentRecordDO.getAdjustType() == null) { + throw new ServiceException("调整类型不能为空"); + } + if (inventoryAdjustmentRecordDO.getAdjustType() == 1 + && inventoryAdjustmentRecordDO.getMaterialInventoryId() == null) { + throw new ServiceException("请选择要调整的库存"); + } + if (inventoryAdjustmentRecordDO.getAdjustQuantity() == null + || inventoryAdjustmentRecordDO.getAdjustQuantity().compareTo(BigDecimal.ZERO) == 0) { + throw new ServiceException("调整数量不能为空且不能为0"); + } MaterialInventory materialInventory = null; //根据调整类型判断,数量调整只调整当前库存记录数量,状态调整减少当前原物料状态库存数量和可用数量,增加到现状态库存数量和可用数量 if (inventoryAdjustmentRecordDO.getAdjustType() != null && inventoryAdjustmentRecordDO.getAdjustType() == 1) { @@ -180,8 +193,8 @@ public class InventoryAdjustmentRecordDomainService { .eq(MaterialInventory::getStorageSectionId,inventoryAdjustmentRecordDO.getStorageSectionId()) .eq(MaterialInventory::getStorageLocationId,inventoryAdjustmentRecordDO.getStorageLocationId()) .eq(MaterialInventory::getMaterialStatusCode,inventoryAdjustmentRecordDO.getAdjustBeforeStatusCode()) - .eq(MaterialInventory::getBatchNumber,inventoryAdjustmentRecordDO.getBatchNumber()) - .eq(MaterialInventory::getContainerId,inventoryAdjustmentRecordDO.getContainerId()) + .eq(StringUtils.isNotBlank(inventoryAdjustmentRecordDO.getBatchNumber()),MaterialInventory::getBatchNumber,inventoryAdjustmentRecordDO.getBatchNumber()) + .eq(inventoryAdjustmentRecordDO.getContainerId() != null, MaterialInventory::getContainerId, inventoryAdjustmentRecordDO.getContainerId()) .eq(BaseVOEntity::getDelFlag, 1)); if (ObjectUtil.isNotNull(materialInventory)) { BeanUtils.copyProperties(materialInventory, inventoryAdjustmentRecord); @@ -218,6 +231,8 @@ public class InventoryAdjustmentRecordDomainService { inventoryAdjustmentRecord.setAdjustedGrossWeight(materialInventory.getGrossWeight()); inventoryAdjustmentRecord.setAdjustedVolume(materialInventory.getVolume()); inventoryAdjustmentRecord.setAdjustedArea(materialInventory.getArea()); + // ===== 新增:原状态库存扣减后立即落库,避免依赖末尾统一更新 ===== + materialInventoryService.updateById(materialInventory); } else { throw new ServiceException("根据原物料状态查询不到物料库存信息!"); } @@ -228,8 +243,8 @@ public class InventoryAdjustmentRecordDomainService { .eq(MaterialInventory::getStorageSectionId,inventoryAdjustmentRecordDO.getStorageSectionId()) .eq(MaterialInventory::getStorageLocationId,inventoryAdjustmentRecordDO.getStorageLocationId()) .eq(MaterialInventory::getMaterialStatusCode,inventoryAdjustmentRecordDO.getAdjustAfterStatusCode()) - .eq(MaterialInventory::getBatchNumber,inventoryAdjustmentRecordDO.getBatchNumber()) - .eq(MaterialInventory::getContainerId,inventoryAdjustmentRecordDO.getContainerId()) + .eq(StringUtils.isNotBlank(inventoryAdjustmentRecordDO.getBatchNumber()),MaterialInventory::getBatchNumber,inventoryAdjustmentRecordDO.getBatchNumber()) + .eq(inventoryAdjustmentRecordDO.getContainerId() != null,MaterialInventory::getContainerId,inventoryAdjustmentRecordDO.getContainerId()) .eq(BaseVOEntity::getDelFlag, 1)); if (ObjectUtil.isNotNull(materialInventory1)) { materialInventory1.setInventoryQuantity(materialInventory1.getInventoryQuantity().add(inventoryAdjustmentRecordDO.getAdjustQuantity())); @@ -245,21 +260,48 @@ public class InventoryAdjustmentRecordDomainService { inventoryAdjustmentRecord.setAdjustAfterStatusCode(inventoryAdjustmentRecordDO.getAdjustAfterStatusCode()); inventoryAdjustmentRecord.setAdjustAfterStatusName(inventoryAdjustmentRecordDO.getAdjustAfterStatusName()); } + // ===== 新增:adjustType 合法性兜底,避免异常类型导致 materialInventory 为 null 静默走完流程 ===== + if (ObjectUtil.isNull(materialInventory)) { + throw new ServiceException("不支持的调整类型:" + inventoryAdjustmentRecordDO.getAdjustType()); + } //生成库存调整追溯记录 if (ObjectUtil.isNotNull(materialInventory)){ genInventoryStandingDetail(materialInventory, inventoryAdjustmentRecordDO.getAdjustQuantity()); } - - materialInventoryService.updateById(materialInventory); + // ===== 修复:末尾更新加 null 保护,且 adjustType=2 已即时落库,只在 adjustType=1 时再更新 ===== + if (ObjectUtil.isNotNull(materialInventory) + && inventoryAdjustmentRecordDO.getAdjustType() != null + && inventoryAdjustmentRecordDO.getAdjustType().equals(1)) { + materialInventoryService.updateById(materialInventory); + } Boolean insert = inventoryAdjustmentRecordService.insert(inventoryAdjustmentRecord); //推送oms库存调整记录 - pushOms(materialInventory, inventoryAdjustmentRecordDO); + try{ + Boolean pushSuccess = pushOms(materialInventory, inventoryAdjustmentRecordDO); + if (!pushSuccess) { + throw new ServiceException("库存调整推送OMS失败,请稍后重试"); + } + }catch (Exception e){ + log.error("推送OMS库存调整记录异常,materialBaseInfoId={}, adjustDirection={}", + inventoryAdjustmentRecordDO.getMaterialBaseInfoId(), + inventoryAdjustmentRecordDO.getAdjustDirection()); + throw new ServiceException("库存调整推送OMS失败,请稍后重试"); + } + System.out.println("库存调整时间结束 ----" + System.currentTimeMillis()); return insert; } - - private void pushOms(MaterialInventory materialInventory,InventoryAdjustmentRecordDO inventoryAdjustmentRecordDO) { + /** + * 推送库存调整信息至OMS系统 + *

+ * 根据调整方向(1=增加库存,2=减少库存)分别构造入库调整单或出库调整单, + * 并通过Feign接口推送至OMS系统,同时推送对应的物料明细信息。 + * + * @param materialInventory 调整涉及的物料库存信息,包含仓库、库区、库位、货主等上下文数据 + * @param inventoryAdjustmentRecordDO 库存调整记录,包含调整方向、调整数量、物料编码等数据 + */ + private Boolean pushOms(MaterialInventory materialInventory,InventoryAdjustmentRecordDO inventoryAdjustmentRecordDO) { LoginUser loginUser = SecurityUtils.getLoginUser(); UserPo userPo = loginUser.getUserPo(); MaterialBaseInfo materialBaseInfo = materialBaseInfoService.getById(materialInventory.getMaterialBaseInfoId()); @@ -327,8 +369,16 @@ public class InventoryAdjustmentRecordDomainService { inMaterialDetail.setStorageLocationCode(materialInventory.getStorageLocationCode()); inMaterialDetail.setStorageLocationName(materialInventory.getStorageLocationName()); inMaterialDetail.setSingleGrossWeight(materialBaseInfo.getWeightLimit()); - omsServiceFeign.pushInOrder(stockInOrder); - omsServiceFeign.pushInOrderDetail(inMaterialDetail); + AjaxResult inOrderResult = omsServiceFeign.pushInOrder(stockInOrder); + AjaxResult inOrderDetailResult = omsServiceFeign.pushInOrderDetail(inMaterialDetail); + if (inOrderResult == null || inOrderDetailResult == null + || !"200".equals(String.valueOf(inOrderResult.get("code"))) + || !"200".equals(String.valueOf(inOrderDetailResult.get("code"))) + ) { + log.error("推送OMS入库调整单失败,pushInOrder={}, pushInOrderDetail={}", + inOrderResult, inOrderDetailResult); + return false; + } } else { StockOutOrderTZPD stockOutOrder = new StockOutOrderTZPD(); stockOutOrder.setOrganizationId(loginUser.getUserPo().getOrganizationId()); @@ -391,9 +441,18 @@ public class InventoryAdjustmentRecordDomainService { outMaterialDetail.setStorageLocationCode(materialInventory.getStorageLocationCode()); outMaterialDetail.setStorageLocationName(materialInventory.getStorageLocationName()); outMaterialDetail.setSingleGrossWeight(materialBaseInfo.getWeightLimit()); - omsServiceFeign.pushOutOrder(stockOutOrder); - omsServiceFeign.pushOutOrderDetail(outMaterialDetail); + AjaxResult inOrderResult = omsServiceFeign.pushOutOrder(stockOutOrder); + AjaxResult inOrderDetailResult = omsServiceFeign.pushOutOrderDetail(outMaterialDetail); + if (inOrderResult == null || inOrderDetailResult == null + || !"200".equals(String.valueOf(inOrderResult.get("code"))) + || !"200".equals(String.valueOf(inOrderDetailResult.get("code"))) + ) { + log.error("推送OMS入库调整单失败,pushInOrder={}, pushInOrderDetail={}", + inOrderResult, inOrderDetailResult); + return false; + } } + return true; } /** diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/statementStatistics/po/ImmediateInventoryPO.java b/mhd_wms/src/main/java/com/mhd/wms/domain/statementStatistics/po/ImmediateInventoryPO.java index 8d9f51786..0c8f09f62 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/statementStatistics/po/ImmediateInventoryPO.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/statementStatistics/po/ImmediateInventoryPO.java @@ -50,10 +50,6 @@ public class ImmediateInventoryPO { @Excel(name = "库存数量") private BigDecimal inventoryQuantity; - @ApiModelProperty("库存数量合计(当前查询条件下所有库存数量之和)") - @Excel(name = "库存数量合计") - private BigDecimal totalInventoryQuantity; - @ApiModelProperty("可用数量 ") @Excel(name = "可用数量 ") private BigDecimal allocationQuantity; diff --git a/mhd_wms/src/main/java/com/mhd/wms/interfaces/facadeApi/statementStatistics/StatementStatisticsApi.java b/mhd_wms/src/main/java/com/mhd/wms/interfaces/facadeApi/statementStatistics/StatementStatisticsApi.java index f4b7232de..8f9d46883 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/interfaces/facadeApi/statementStatistics/StatementStatisticsApi.java +++ b/mhd_wms/src/main/java/com/mhd/wms/interfaces/facadeApi/statementStatistics/StatementStatisticsApi.java @@ -23,6 +23,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.HashMap; import java.util.List; /** @@ -48,13 +50,14 @@ public class StatementStatisticsApi { */ @ApiOperation("查询即时库存列表") @GetMapping("/queryImmediateInventoryList") - public TableDataInfo queryImmediateInventoryList(ImmediateInventoryDTO immediateInventoryDTO) + public HashMap queryImmediateInventoryList(ImmediateInventoryDTO immediateInventoryDTO) { //转换实体 ImmediateInventoryDO immediateInventoryDO = immediateInventoryAssembler.toDO(immediateInventoryDTO); startPage(); List list = statementStatisticsService.queryImmediateInventoryList(immediateInventoryDO); - return getDataTable(list); + BigDecimal bigDecimal = statementStatisticsService.sumImmediateInventoryQuantity(immediateInventoryDO); + return getDataTableWarehouse(list,bigDecimal); } /** * 分页查询入库日报表列表 @@ -129,4 +132,18 @@ public class StatementStatisticsApi { rspData.setTotal(new PageInfo(list).getTotal()); return rspData; } + + /** + * 响应请求分页、仓库数量 数据 + */ + protected HashMap getDataTableWarehouse(List list,BigDecimal bigDecimal) + { + HashMap stringObjectHashMap = new HashMap<>(); + stringObjectHashMap.put("data",list); + stringObjectHashMap.put("total",new PageInfo(list).getTotal()); + stringObjectHashMap.put("code",HttpStatus.SUCCESS); + stringObjectHashMap.put("msg","查询成功"); + stringObjectHashMap.put("totalInventoryQuantity",bigDecimal); + return stringObjectHashMap; + } } diff --git a/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml b/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml index 5a5708903..767c0ba16 100644 --- a/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml +++ b/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml @@ -1054,7 +1054,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - From 57649dbdfae709b4f6f653d14f126c88a8efb511 Mon Sep 17 00:00:00 2001 From: rcx <3084692334@qq.com> Date: Thu, 6 Aug 2026 18:07:38 +0800 Subject: [PATCH 2/6] =?UTF-8?q?fix(=E5=BA=93=E5=AD=98=E6=A8=A1=E5=9D=97):?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E5=BA=93=E5=AD=98=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E7=94=9F=E6=95=88=20bug=20=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E8=B0=83=E6=95=B4=EF=BC=9A=E4=BF=AE=E5=A4=8D=E6=89=80=E6=9C=89?= =?UTF-8?q?=E5=95=86=E5=93=81=E8=B0=83=E6=95=B4=E7=82=B9=E5=87=BB=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4=E4=B9=8B=E5=90=8E=E6=9C=AA=E7=94=9F=E6=95=88=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/InventoryAdjustmentRecordDomainService.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/inventoryAdjustmentRecord/service/InventoryAdjustmentRecordDomainService.java b/mhd_wms/src/main/java/com/mhd/wms/domain/inventoryAdjustmentRecord/service/InventoryAdjustmentRecordDomainService.java index f728e90c8..f63a274de 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/inventoryAdjustmentRecord/service/InventoryAdjustmentRecordDomainService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/inventoryAdjustmentRecord/service/InventoryAdjustmentRecordDomainService.java @@ -269,10 +269,8 @@ public class InventoryAdjustmentRecordDomainService { genInventoryStandingDetail(materialInventory, inventoryAdjustmentRecordDO.getAdjustQuantity()); } - // ===== 修复:末尾更新加 null 保护,且 adjustType=2 已即时落库,只在 adjustType=1 时再更新 ===== - if (ObjectUtil.isNotNull(materialInventory) - && inventoryAdjustmentRecordDO.getAdjustType() != null - && inventoryAdjustmentRecordDO.getAdjustType().equals(1)) { + // ===== 修复:末尾更新加 null 保护 ===== + if (ObjectUtil.isNotNull(materialInventory)) { materialInventoryService.updateById(materialInventory); } Boolean insert = inventoryAdjustmentRecordService.insert(inventoryAdjustmentRecord); From 0f26cd3d0d8a8c982bffe8b8b9b1999534ac3828 Mon Sep 17 00:00:00 2001 From: zhaoqing <3160641494@qq.com> Date: Fri, 7 Aug 2026 09:40:32 +0800 Subject: [PATCH 3/6] =?UTF-8?q?feat(bms):=E6=96=B0=E5=A2=9E=E8=B4=A6?= =?UTF-8?q?=E5=8D=95=E8=B4=B9=E7=94=A8=E6=94=AF=E6=8C=81=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=88=E5=8C=85=E5=90=AB=E7=A8=8E=E8=B4=B9=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../billingStatement/BillingStatementApplicationService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java index 9e56458e6..fa761a104 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java @@ -594,7 +594,10 @@ public class BillingStatementApplicationService { BeanUtils.copyProperties(billingStatementDO,billingStatementPO); billingStatementPO.setBillingTotalAmount(billingStatementDO.getBillingAmount()); billingStatementPO.setDataSources(2); - billingStatementPO.setBillingFlow(OrderSequence.getOrderCode("JFLS")); + // 若传入了计费流水号,则直接使用;否则自动生成 + if (StringUtils.isEmpty(billingStatementPO.getBillingFlow())) { + billingStatementPO.setBillingFlow(OrderSequence.getOrderCode("JFLS")); + } billingStatementPO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); billingStatementPO.setOrganizationId(loginUser.getUserPo().getOrganizationId()); billingStatementPO.setOrganizationName(loginUser.getUserPo().getOrganizationName()); From cb136a19b4694820779bf35820d984fd46752443 Mon Sep 17 00:00:00 2001 From: rcx <3084692334@qq.com> Date: Fri, 7 Aug 2026 15:08:05 +0800 Subject: [PATCH 4/6] =?UTF-8?q?feat=EF=BC=9A=20=E3=80=8C=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E3=80=8D-=E3=80=8C=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E3=80=8D=E5=A2=9E=E5=8A=A0=E6=8C=89=E8=B4=A7?= =?UTF-8?q?=E4=B8=BB/=E7=89=A9=E6=96=99=E6=9F=A5=E8=AF=A2=20-=20=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E6=8C=89=EF=BC=88=E8=B4=A7=E4=B8=BB=20+=20=E7=89=A9?= =?UTF-8?q?=E6=96=99=20+=20=E4=BB=93=E5=BA=93=20+=20=E5=8C=85=E8=A3=85?= =?UTF-8?q?=E5=8D=95=E4=BD=8D=EF=BC=89=E7=BB=84=E5=90=88=E8=81=9A=E5=90=88?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E6=9B=B4=E6=96=B0=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E5=8F=96=E7=BB=84=E5=86=85=E6=9C=80=E6=96=B0=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/MaterialInventoryMapper.java | 2 + .../persistence/MaterialInventoryImpl.java | 12 +++-- .../MaterialInventoryMapper.xml | 49 +++++++++++++++++++ 3 files changed, 58 insertions(+), 5 deletions(-) diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/mapper/MaterialInventoryMapper.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/mapper/MaterialInventoryMapper.java index 2cb15e4f0..58fbf0e2f 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/mapper/MaterialInventoryMapper.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/mapper/MaterialInventoryMapper.java @@ -38,6 +38,8 @@ public interface MaterialInventoryMapper extends BaseMapper public List queryListByHz(MaterialInventoryDO materialInventoryDO); //查物料库存列表-货主+物料(同一物料在不同货主下各一行) public List queryListByHzWl(MaterialInventoryDO materialInventoryDO); + //查物料库存列表-按货主+物料+仓库(库存查询第三个页签,update_time 取合并后最大值) + public List queryListByHzWlUnit(MaterialInventoryDO materialInventoryDO); /** * @description 批量增加库存 diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java index 4b1e1b14e..a536436ce 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java @@ -77,17 +77,19 @@ public class MaterialInventoryImpl extends ServiceImpl + + + + a.shipper_id, a.shipper_code, a.shipper_name, + b.material_base_info_id, b.material_code, b.material_name, b.SPECIFICATION_MODEL, + a.warehouse_id, a.warehouse_code, a.warehouse_name, + a.organization_id, a.organization_name, a.top_organization_id, + MAX(b.material_type) AS material_type, + MAX(b.material_type_name) AS material_type_name, + MAX(b.bar_code) AS bar_code, + MAX(nvl(a.unit_name, b.unit_name)) AS unit_name, + MAX(b.pack_id) AS pack_id, + MAX(b.pack_code) AS pack_code, + MAX(b.pack_name) AS pack_name, + MAX(a.unit) AS unit, + IFNULL(SUM(a.freeze_quantity), 0) AS freeze_quantity, + IFNULL(SUM(a.inventory_quantity), 0) AS inventory_quantity, + IFNULL(SUM(a.allocation_quantity), 0) AS allocation_quantity, + IFNULL(SUM(a.area), 0) AS area, + IFNULL(SUM(a.NET_WEIGHT), 0) AS NET_WEIGHT, + IFNULL(SUM(a.GROSS_WEIGHT), 0) AS GROSS_WEIGHT, + IFNULL(SUM(a.VOLUME), 0) AS VOLUME, + MIN(a.create_time) AS create_time, -- 新增:首次入库时间 + MAX(a.update_time) AS update_time, + CASE WHEN IFNULL(SUM(a.inventory_quantity), 0) = 0 THEN 1 ELSE 0 END AS sort_order + + + +