From 63b3e26d5fffcaf96fb6c62a28094418d8bfc685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Fri, 13 Mar 2026 11:35:34 +0800 Subject: [PATCH] =?UTF-8?q?PDA=E4=BB=BB=E5=8A=A1=E8=BD=AC=E6=8E=A5?= =?UTF-8?q?=E5=8F=AA=E6=98=BE=E7=A4=BA=E4=BB=93=E5=BA=93=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E7=9A=84=E7=94=A8=E6=88=B7=EF=BC=8C=E7=9B=98=E7=82=B9=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E6=98=BE=E7=A4=BA=E7=89=A9=E6=96=99=E6=89=B9=E6=AC=A1?= =?UTF-8?q?=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UserApplicationService.java | 30 +++++++ .../feign/SystemServiceFeign.java | 16 ++++ .../mhd/user/interfaces/facade/UserAPI.java | 10 +++ ...InvestigationManageApplicationService.java | 81 ++++++++++++++++--- .../repository/po/InvestigationManagePO.java | 10 +++ .../InvestigationManageMapper.xml | 75 +++++++++-------- 6 files changed, 178 insertions(+), 44 deletions(-) diff --git a/mhd-user-center/src/main/java/com/mhd/user/application/service/UserApplicationService.java b/mhd-user-center/src/main/java/com/mhd/user/application/service/UserApplicationService.java index 854f1cb0e..69de86695 100644 --- a/mhd-user-center/src/main/java/com/mhd/user/application/service/UserApplicationService.java +++ b/mhd-user-center/src/main/java/com/mhd/user/application/service/UserApplicationService.java @@ -31,6 +31,7 @@ import com.mhd.system.api.OrganizationServiceFeign; import com.mhd.system.api.TicketServiceFeign; import com.mhd.system.api.TransportFeign; import com.mhd.system.api.domain.PlatformUserDTO; +import com.mhd.system.api.domain.cache.AssociationWarehouseCacheDO; import com.mhd.system.api.domain.WlhyLoginUser; import com.mhd.system.api.domain.finance.AccountCashWalletPo; import com.mhd.system.api.service.webSocket.AsyncWebSocketApplicationService; @@ -239,6 +240,35 @@ public class UserApplicationService { return userPoList; } + /** + * PDA任务转交:只查询当前仓库绑定的用户列表 + * @param userDo 查询条件 + * @return 当前仓库绑定的用户列表 + */ + public List selectListForTaskHandover(UserDO userDo) { + // 获取当前用户设置的仓库 + AjaxResult warehouseResult = systemServiceFeign.getWarehouseInfo(); + if (!"200".equals(String.valueOf(warehouseResult.get("code")))) { + return Collections.emptyList(); + } + AssociationWarehouseCacheDO warehouseCache = JSON.parseObject(JSONUtil.toJsonStr(warehouseResult.get("data")), AssociationWarehouseCacheDO.class); + if (warehouseCache == null || warehouseCache.getWarehouseId() == null) { + return Collections.emptyList(); + } + // 查询该仓库绑定的用户ID列表 + AjaxResult correlationResult = systemServiceFeign.queryListCorrelationId(warehouseCache.getWarehouseId()); + if (!"200".equals(String.valueOf(correlationResult.get("code")))) { + return Collections.emptyList(); + } + List warehouseUserIds = JSON.parseArray(JSONUtil.toJsonStr(correlationResult.get("data")), Long.class); + if (CollectionUtil.isEmpty(warehouseUserIds)) { + return Collections.emptyList(); + } + userDo.setUserIds(warehouseUserIds); + startPage(); + return userDomainService.selectList(userDo); + } + @DataPermissions(cacheName = "tenants") public List getAllUser(UserDO userDo) { //这里处理身份证状态查询 diff --git a/mhd-user-center/src/main/java/com/mhd/user/infrastructure/feign/SystemServiceFeign.java b/mhd-user-center/src/main/java/com/mhd/user/infrastructure/feign/SystemServiceFeign.java index 856b1ac75..f0fb33430 100644 --- a/mhd-user-center/src/main/java/com/mhd/user/infrastructure/feign/SystemServiceFeign.java +++ b/mhd-user-center/src/main/java/com/mhd/user/infrastructure/feign/SystemServiceFeign.java @@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; import java.util.List; @@ -74,4 +75,19 @@ public interface SystemServiceFeign { */ @PostMapping("/dict/data/getDictDataList") public R> getDictDataList(@RequestBody SysDictData sysDictData); + + /** + * 查询仓库关联的用户ID集合(用于PDA任务转交等场景) + * @param warehouseId 仓库ID + * @return 用户ID列表 + */ + @GetMapping("/associationWarehouseApi/queryListCorrelationId") + public AjaxResult queryListCorrelationId(@RequestParam(value = "warehouseId", required = false) Long warehouseId); + + /** + * 获取当前登录用户设置的仓库 + * @return 仓库信息(含warehouseId) + */ + @GetMapping("/associationWarehouseApi/getWarehouseInfo") + public AjaxResult getWarehouseInfo(); } diff --git a/mhd-user-center/src/main/java/com/mhd/user/interfaces/facade/UserAPI.java b/mhd-user-center/src/main/java/com/mhd/user/interfaces/facade/UserAPI.java index dba8c54da..f5c1d3806 100644 --- a/mhd-user-center/src/main/java/com/mhd/user/interfaces/facade/UserAPI.java +++ b/mhd-user-center/src/main/java/com/mhd/user/interfaces/facade/UserAPI.java @@ -89,6 +89,16 @@ public class UserAPI extends BaseController { return getDataTable(list); } + @Log(title = "PDA任务转交-查询用户", description ="只查询当前仓库绑定的用户列表", businessType = BusinessType.INQUIRE) + @ApiOperation("PDA任务转交-查询当前仓库绑定的用户列表") + @GetMapping("/listByCurrentWarehouse") + public TableDataInfo listByCurrentWarehouse(UserDTO userDTO) { + UserDO userDO = new UserDO(); + BeanUtils.copyProperties(userDTO, userDO); + List list = userApplicationService.selectListForTaskHandover(userDO); + return getDataTable(list); + } + @Log(title = "用户中台管理-查询", description ="查询用户列表",businessType = BusinessType.INQUIRE) @ApiOperation("查询用户列表") @GetMapping("/getAllByOrganization") diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/investigationManage/InvestigationManageApplicationService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/investigationManage/InvestigationManageApplicationService.java index a6da8e5bd..f893c148d 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/investigationManage/InvestigationManageApplicationService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/investigationManage/InvestigationManageApplicationService.java @@ -32,6 +32,7 @@ import org.springframework.util.CollectionUtils; import java.lang.reflect.Field; import java.math.BigDecimal; +import java.math.RoundingMode; import java.text.SimpleDateFormat; import java.util.*; import java.util.function.Function; @@ -116,7 +117,17 @@ public class InvestigationManageApplicationService { investigationManageDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId()); } } - return investigationManageDomainService.queryList(investigationManageDO); + List list = investigationManageDomainService.queryList(investigationManageDO); + // 计算盘点进度 = 已盘点状态的库存数量 / 盘点单库存总数量 + list.forEach(po -> { + if (po.getTotalInventoryQuantity() != null && po.getTotalInventoryQuantity().compareTo(BigDecimal.ZERO) > 0 + && po.getInvestigatedInventoryQuantity() != null) { + po.setInvestigationProgress(po.getInvestigatedInventoryQuantity().divide(po.getTotalInventoryQuantity(), 4, RoundingMode.HALF_UP)); + } else { + po.setInvestigationProgress(BigDecimal.ZERO); + } + }); + return list; } @@ -441,19 +452,71 @@ public class InvestigationManageApplicationService { /** - * 按库位拣货 获取拣货作业单详细信息 + * 按库位盘点 获取盘点单详细信息(动态返回物料绑定的批次属性) */ - public InvestigationManagePO getInfoByStorageLocation(Long investigationManageId) - { - return investigationManageDomainService.getInfoByStorageLocation(investigationManageId); + public InvestigationManagePO getInfoByStorageLocation(Long investigationManageId) { + InvestigationManagePO po = investigationManageDomainService.getInfoByStorageLocation(investigationManageId); + enrichInvestigationWithBatchAttributes(po); + return po; } /** - *按物料拣货 获取拣货作业单详细信息 + * 按物料盘点 获取盘点单详细信息(动态返回物料绑定的批次属性) */ - public InvestigationManagePO getInfoByMaterial(Long investigationManageId) - { - return investigationManageDomainService.getInfoByMaterial(investigationManageId); + public InvestigationManagePO getInfoByMaterial(Long investigationManageId) { + InvestigationManagePO po = investigationManageDomainService.getInfoByMaterial(investigationManageId); + enrichInvestigationWithBatchAttributes(po); + return po; + } + + /** + * 为盘点单的物料明细填充批次属性(与getInfo、StockOutTaskOrder等模块保持一致) + */ + private void enrichInvestigationWithBatchAttributes(InvestigationManagePO investigationManagePO) { + if (investigationManagePO == null) { + return; + } + List detailList = new ArrayList<>(); + if (!CollectionUtils.isEmpty(investigationManagePO.getInvestigetionStorageList())) { + investigationManagePO.getInvestigetionStorageList().forEach(storage -> { + if (!CollectionUtils.isEmpty(storage.getInvestigetionManageDetailList())) { + detailList.addAll(storage.getInvestigetionManageDetailList()); + } + }); + } + if (!CollectionUtils.isEmpty(investigationManagePO.getInvestigetionMaterialList())) { + investigationManagePO.getInvestigetionMaterialList().forEach(material -> { + if (!CollectionUtils.isEmpty(material.getInvestigetionManageDetailList())) { + detailList.addAll(material.getInvestigetionManageDetailList()); + } + }); + } + if (CollectionUtils.isEmpty(detailList)) { + return; + } + Set materialBaseInfoIdSet = detailList.stream() + .map(InvestigetionManageDetailPO::getMaterialBaseInfoId) + .filter(Objects::nonNull) + .collect(Collectors.toSet()); + Map> batchDetailMap = new HashMap<>(); + for (Long materialBaseInfoId : materialBaseInfoIdSet) { + try { + AjaxResult ajaxResult = systemServiceFeign.getBatchDetailListByMaterialBaseInfoId(materialBaseInfoId); + if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) { + List batchDetailFeignPOList = JSON.parseArray( + JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class); + if (!CollectionUtils.isEmpty(batchDetailFeignPOList)) { + List filteredList = batchDetailFeignPOList.stream() + .filter(batchDetail -> batchDetail.getIsDisplay() != null && batchDetail.getIsDisplay() == 1) + .collect(Collectors.toList()); + batchDetailMap.put(materialBaseInfoId, filteredList); + } + } + } catch (Exception e) { + log.warn("获取物料批次属性失败,物料基础信息ID:{},错误:{}", materialBaseInfoId, e.getMessage()); + } + } + setMaterialMoreDetailListFromInventory(detailList, batchDetailMap); } /** diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/investigationManage/repository/po/InvestigationManagePO.java b/mhd_wms/src/main/java/com/mhd/wms/domain/investigationManage/repository/po/InvestigationManagePO.java index 243b4274d..7d3aa0df6 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/investigationManage/repository/po/InvestigationManagePO.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/investigationManage/repository/po/InvestigationManagePO.java @@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.math.BigDecimal; import java.util.Date; import java.util.List; @@ -155,4 +156,13 @@ public class InvestigationManagePO extends BaseVOEntity { @ApiModelProperty("按物料盘点详情") private List investigetionMaterialList; + + @ApiModelProperty("盘点单库存总数量") + private BigDecimal totalInventoryQuantity; + + @ApiModelProperty("已盘点状态的库存数量") + private BigDecimal investigatedInventoryQuantity; + + @ApiModelProperty("盘点进度=已盘点状态的库存数量/盘点单库存总数量") + private BigDecimal investigationProgress; } diff --git a/mhd_wms/src/main/resources/mapper/investigationManage/InvestigationManageMapper.xml b/mhd_wms/src/main/resources/mapper/investigationManage/InvestigationManageMapper.xml index 8e28f8b76..b8b8cd8ee 100644 --- a/mhd_wms/src/main/resources/mapper/investigationManage/InvestigationManageMapper.xml +++ b/mhd_wms/src/main/resources/mapper/investigationManage/InvestigationManageMapper.xml @@ -38,111 +38,116 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + - select investigation_manage_id, organization_id, organization_name, top_organization_id, investigation_number, old_investigation_number,investigation_status, investigation_range, investigation_type, investigation_method, investigation_frequency, different_number, warehouse_id, warehouse_code, warehouse_name, audit_status, audit_remark, audit_by, audit_by_name, audit_time, task_distribution, task_distribution_time, operators_by, operators_name, nullify, remark, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag from investigation_manage + select m.investigation_manage_id, m.organization_id, m.organization_name, m.top_organization_id, m.investigation_number, m.old_investigation_number, m.investigation_status, m.investigation_range, m.investigation_type, m.investigation_method, m.investigation_frequency, m.different_number, m.warehouse_id, m.warehouse_code, m.warehouse_name, m.audit_status, m.audit_remark, m.audit_by, m.audit_by_name, m.audit_time, m.task_distribution, m.task_distribution_time, m.operators_by, m.operators_name, m.nullify, m.remark, m.create_time, m.create_by, m.create_by_name, m.update_time, m.update_by, m.update_by_name, m.del_flag, + (SELECT IFNULL(SUM(d.inventory_quantity), 0) FROM investigetion_manage_detail d WHERE d.investigation_number = m.investigation_number AND d.del_flag = 1) as total_inventory_quantity, + (SELECT IFNULL(SUM(d.inventory_quantity), 0) FROM investigetion_manage_detail d WHERE d.investigation_number = m.investigation_number AND d.del_flag = 1 AND d.investigation_status = 4) as investigated_inventory_quantity + from investigation_manage m - and del_flag = 1 + and m.del_flag = 1 - and organization_id = #{organizationId} + and m.organization_id = #{organizationId} - and organization_name like concat('%', #{organizationName}, '%') + and m.organization_name like concat('%', #{organizationName}, '%') - and top_organization_id = #{topOrganizationId} + and m.top_organization_id = #{topOrganizationId} - and investigation_number like concat('%',#{investigationNumber},'%') + and m.investigation_number like concat('%',#{investigationNumber},'%') - and old_investigation_number = concat('%',#{oldInvestigationNumber},'%') + and m.old_investigation_number = concat('%',#{oldInvestigationNumber},'%') - and investigation_status = #{investigationStatus} + and m.investigation_status = #{investigationStatus} - and investigation_range = #{investigationRange} + and m.investigation_range = #{investigationRange} - and investigation_type = #{investigationType} + and m.investigation_type = #{investigationType} - and investigation_method = #{investigationMethod} + and m.investigation_method = #{investigationMethod} - and investigation_frequency = #{investigationFrequency} + and m.investigation_frequency = #{investigationFrequency} - and different_number = #{differentNumber} + and m.different_number = #{differentNumber} - and warehouse_id = #{warehouseId} + and m.warehouse_id = #{warehouseId} - and warehouse_code = #{warehouseCode} + and m.warehouse_code = #{warehouseCode} - and warehouse_name like concat('%', #{warehouseName}, '%') + and m.warehouse_name like concat('%', #{warehouseName}, '%') - and audit_status = #{auditStatus} + and m.audit_status = #{auditStatus} - and audit_remark = #{auditRemark} + and m.audit_remark = #{auditRemark} - and audit_by = #{auditBy} + and m.audit_by = #{auditBy} - and audit_by_name like concat('%', #{auditByName}, '%') + and m.audit_by_name like concat('%', #{auditByName}, '%') - and audit_time = #{auditTime} + and m.audit_time = #{auditTime} - and task_distribution = #{taskDistribution} + and m.task_distribution = #{taskDistribution} - and task_distribution_time = #{taskDistributionTime} + and m.task_distribution_time = #{taskDistributionTime} - and operators_by = #{operatorsBy} + and m.operators_by = #{operatorsBy} - and operators_name like concat('%', #{operatorsName}, '%') + and m.operators_name like concat('%', #{operatorsName}, '%') - and nullify = #{nullify} + and m.nullify = #{nullify} - and create_by_name like concat('%', #{createByName}, '%') + and m.create_by_name like concat('%', #{createByName}, '%') - and update_by_name like concat('%', #{updateByName}, '%') + and m.update_by_name like concat('%', #{updateByName}, '%') - and date_format(create_time,'%Y-%m-%d %H:%i:%s') =]]> #{createStartTime} + and date_format(m.create_time,'%Y-%m-%d %H:%i:%s') =]]> #{createStartTime} - and date_format(create_time,'%Y-%m-%d %H:%i:%s') #{createEndTime} + and date_format(m.create_time,'%Y-%m-%d %H:%i:%s') #{createEndTime} - and remark like concat('%',#{remark},'%') + and m.remark like concat('%',#{remark},'%') - and investigation_manage_id in + and m.investigation_manage_id in #{item} - and del_flag = #{delFlag} - and del_flag = 1 + and m.del_flag = #{delFlag} + and m.del_flag = 1 @@ -150,6 +155,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" \ No newline at end of file