PDA任务转接只显示仓库绑定的用户,盘点详情显示物料批次属性

This commit is contained in:
秦鸿展
2026-03-13 11:35:34 +08:00
parent 1d1adc61e8
commit 63b3e26d5f
6 changed files with 178 additions and 44 deletions
@@ -31,6 +31,7 @@ import com.mhd.system.api.OrganizationServiceFeign;
import com.mhd.system.api.TicketServiceFeign; import com.mhd.system.api.TicketServiceFeign;
import com.mhd.system.api.TransportFeign; import com.mhd.system.api.TransportFeign;
import com.mhd.system.api.domain.PlatformUserDTO; 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.WlhyLoginUser;
import com.mhd.system.api.domain.finance.AccountCashWalletPo; import com.mhd.system.api.domain.finance.AccountCashWalletPo;
import com.mhd.system.api.service.webSocket.AsyncWebSocketApplicationService; import com.mhd.system.api.service.webSocket.AsyncWebSocketApplicationService;
@@ -239,6 +240,35 @@ public class UserApplicationService {
return userPoList; return userPoList;
} }
/**
* PDA任务转交:只查询当前仓库绑定的用户列表
* @param userDo 查询条件
* @return 当前仓库绑定的用户列表
*/
public List<UserPo> 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<Long> 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") @DataPermissions(cacheName = "tenants")
public List<UserPo> getAllUser(UserDO userDo) { public List<UserPo> getAllUser(UserDO userDo) {
//这里处理身份证状态查询 //这里处理身份证状态查询
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
@@ -74,4 +75,19 @@ public interface SystemServiceFeign {
*/ */
@PostMapping("/dict/data/getDictDataList") @PostMapping("/dict/data/getDictDataList")
public R<List<SysDictData>> getDictDataList(@RequestBody SysDictData sysDictData); public R<List<SysDictData>> 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();
} }
@@ -89,6 +89,16 @@ public class UserAPI extends BaseController {
return getDataTable(list); 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<UserPo> list = userApplicationService.selectListForTaskHandover(userDO);
return getDataTable(list);
}
@Log(title = "用户中台管理-查询", description ="查询用户列表",businessType = BusinessType.INQUIRE) @Log(title = "用户中台管理-查询", description ="查询用户列表",businessType = BusinessType.INQUIRE)
@ApiOperation("查询用户列表") @ApiOperation("查询用户列表")
@GetMapping("/getAllByOrganization") @GetMapping("/getAllByOrganization")
@@ -32,6 +32,7 @@ import org.springframework.util.CollectionUtils;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
@@ -116,7 +117,17 @@ public class InvestigationManageApplicationService {
investigationManageDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId()); investigationManageDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
} }
} }
return investigationManageDomainService.queryList(investigationManageDO); List<InvestigationManagePO> 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) public InvestigationManagePO getInfoByStorageLocation(Long investigationManageId) {
{ InvestigationManagePO po = investigationManageDomainService.getInfoByStorageLocation(investigationManageId);
return investigationManageDomainService.getInfoByStorageLocation(investigationManageId); enrichInvestigationWithBatchAttributes(po);
return po;
} }
/** /**
*按物料拣货 获取拣货作业单详细信息 * 按物料盘点 获取盘点单详细信息动态返回物料绑定的批次属性
*/ */
public InvestigationManagePO getInfoByMaterial(Long investigationManageId) public InvestigationManagePO getInfoByMaterial(Long investigationManageId) {
{ InvestigationManagePO po = investigationManageDomainService.getInfoByMaterial(investigationManageId);
return investigationManageDomainService.getInfoByMaterial(investigationManageId); enrichInvestigationWithBatchAttributes(po);
return po;
}
/**
* 为盘点单的物料明细填充批次属性与getInfoStockOutTaskOrder等模块保持一致
*/
private void enrichInvestigationWithBatchAttributes(InvestigationManagePO investigationManagePO) {
if (investigationManagePO == null) {
return;
}
List<InvestigetionManageDetailPO> 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<Long> materialBaseInfoIdSet = detailList.stream()
.map(InvestigetionManageDetailPO::getMaterialBaseInfoId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
Map<Long, List<BatchDetailFeignPO>> batchDetailMap = new HashMap<>();
for (Long materialBaseInfoId : materialBaseInfoIdSet) {
try {
AjaxResult ajaxResult = systemServiceFeign.getBatchDetailListByMaterialBaseInfoId(materialBaseInfoId);
if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) {
List<BatchDetailFeignPO> batchDetailFeignPOList = JSON.parseArray(
JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class);
if (!CollectionUtils.isEmpty(batchDetailFeignPOList)) {
List<BatchDetailFeignPO> 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);
} }
/** /**
@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -155,4 +156,13 @@ public class InvestigationManagePO extends BaseVOEntity {
@ApiModelProperty("按物料盘点详情") @ApiModelProperty("按物料盘点详情")
private List<InvestigetionMaterialPO> investigetionMaterialList; private List<InvestigetionMaterialPO> investigetionMaterialList;
@ApiModelProperty("盘点单库存总数量")
private BigDecimal totalInventoryQuantity;
@ApiModelProperty("已盘点状态的库存数量")
private BigDecimal investigatedInventoryQuantity;
@ApiModelProperty("盘点进度=已盘点状态的库存数量/盘点单库存总数量")
private BigDecimal investigationProgress;
} }
@@ -38,111 +38,116 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateByName" column="update_by_name" /> <result property="updateByName" column="update_by_name" />
<result property="delFlag" column="del_flag" /> <result property="delFlag" column="del_flag" />
<result property="totalInventoryQuantity" column="total_inventory_quantity" />
<result property="investigatedInventoryQuantity" column="investigated_inventory_quantity" />
</resultMap> </resultMap>
<sql id="selectInvestigationManagePo"> <sql id="selectInvestigationManagePo">
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
</sql> </sql>
<sql id="selectInvestigationManagePo1"> <sql id="selectInvestigationManagePo1">
<where> <where>
and del_flag = 1 and m.del_flag = 1
<if test="organizationId != null "> <if test="organizationId != null ">
and organization_id = #{organizationId} and m.organization_id = #{organizationId}
</if> </if>
<if test="organizationName != null and organizationName != ''"> <if test="organizationName != null and organizationName != ''">
and organization_name like concat('%', #{organizationName}, '%') and m.organization_name like concat('%', #{organizationName}, '%')
</if> </if>
<if test="topOrganizationId != null "> <if test="topOrganizationId != null ">
and top_organization_id = #{topOrganizationId} and m.top_organization_id = #{topOrganizationId}
</if> </if>
<if test="investigationNumber != null and investigationNumber != ''"> <if test="investigationNumber != null and investigationNumber != ''">
and investigation_number like concat('%',#{investigationNumber},'%') and m.investigation_number like concat('%',#{investigationNumber},'%')
</if><if test="oldInvestigationNumber != null and oldInvestigationNumber != ''"> </if><if test="oldInvestigationNumber != null and oldInvestigationNumber != ''">
and old_investigation_number = concat('%',#{oldInvestigationNumber},'%') and m.old_investigation_number = concat('%',#{oldInvestigationNumber},'%')
</if> </if>
<if test="investigationStatus != null "> <if test="investigationStatus != null ">
and investigation_status = #{investigationStatus} and m.investigation_status = #{investigationStatus}
</if> </if>
<if test="investigationRange != null and investigationRange != ''"> <if test="investigationRange != null and investigationRange != ''">
and investigation_range = #{investigationRange} and m.investigation_range = #{investigationRange}
</if> </if>
<if test="investigationType != null "> <if test="investigationType != null ">
and investigation_type = #{investigationType} and m.investigation_type = #{investigationType}
</if> </if>
<if test="investigationMethod != null "> <if test="investigationMethod != null ">
and investigation_method = #{investigationMethod} and m.investigation_method = #{investigationMethod}
</if> </if>
<if test="investigationFrequency != null "> <if test="investigationFrequency != null ">
and investigation_frequency = #{investigationFrequency} and m.investigation_frequency = #{investigationFrequency}
</if> </if>
<if test="differentNumber != null and differentNumber != ''"> <if test="differentNumber != null and differentNumber != ''">
and different_number = #{differentNumber} and m.different_number = #{differentNumber}
</if> </if>
<if test="warehouseId != null "> <if test="warehouseId != null ">
and warehouse_id = #{warehouseId} and m.warehouse_id = #{warehouseId}
</if> </if>
<if test="warehouseCode != null and warehouseCode != ''"> <if test="warehouseCode != null and warehouseCode != ''">
and warehouse_code = #{warehouseCode} and m.warehouse_code = #{warehouseCode}
</if> </if>
<if test="warehouseName != null and warehouseName != ''"> <if test="warehouseName != null and warehouseName != ''">
and warehouse_name like concat('%', #{warehouseName}, '%') and m.warehouse_name like concat('%', #{warehouseName}, '%')
</if> </if>
<if test="auditStatus != null "> <if test="auditStatus != null ">
and audit_status = #{auditStatus} and m.audit_status = #{auditStatus}
</if> </if>
<if test="auditRemark != null and auditRemark != ''"> <if test="auditRemark != null and auditRemark != ''">
and audit_remark = #{auditRemark} and m.audit_remark = #{auditRemark}
</if> </if>
<if test="auditBy != null "> <if test="auditBy != null ">
and audit_by = #{auditBy} and m.audit_by = #{auditBy}
</if> </if>
<if test="auditByName != null and auditByName != ''"> <if test="auditByName != null and auditByName != ''">
and audit_by_name like concat('%', #{auditByName}, '%') and m.audit_by_name like concat('%', #{auditByName}, '%')
</if> </if>
<if test="auditTime != null "> <if test="auditTime != null ">
and audit_time = #{auditTime} and m.audit_time = #{auditTime}
</if> </if>
<if test="taskDistribution != null "> <if test="taskDistribution != null ">
and task_distribution = #{taskDistribution} and m.task_distribution = #{taskDistribution}
</if> </if>
<if test="taskDistributionTime != null "> <if test="taskDistributionTime != null ">
and task_distribution_time = #{taskDistributionTime} and m.task_distribution_time = #{taskDistributionTime}
</if> </if>
<if test="operatorsBy != null "> <if test="operatorsBy != null ">
and operators_by = #{operatorsBy} and m.operators_by = #{operatorsBy}
</if> </if>
<if test="operatorsName != null and operatorsName != ''"> <if test="operatorsName != null and operatorsName != ''">
and operators_name like concat('%', #{operatorsName}, '%') and m.operators_name like concat('%', #{operatorsName}, '%')
</if> </if>
<if test="nullify != null "> <if test="nullify != null ">
and nullify = #{nullify} and m.nullify = #{nullify}
</if> </if>
<if test="createByName != null and createByName != ''"> <if test="createByName != null and createByName != ''">
and create_by_name like concat('%', #{createByName}, '%') and m.create_by_name like concat('%', #{createByName}, '%')
</if> </if>
<if test="updateByName != null and updateByName != ''"> <if test="updateByName != null and updateByName != ''">
and update_by_name like concat('%', #{updateByName}, '%') and m.update_by_name like concat('%', #{updateByName}, '%')
</if> </if>
<if test="createStartTime != null"> <if test="createStartTime != null">
and date_format(create_time,'%Y-%m-%d %H:%i:%s') <![CDATA[>=]]> #{createStartTime} and date_format(m.create_time,'%Y-%m-%d %H:%i:%s') <![CDATA[>=]]> #{createStartTime}
</if> </if>
<if test="createEndTime != null"> <if test="createEndTime != null">
and date_format(create_time,'%Y-%m-%d %H:%i:%s') <![CDATA[<=]]> #{createEndTime} and date_format(m.create_time,'%Y-%m-%d %H:%i:%s') <![CDATA[<=]]> #{createEndTime}
</if> </if>
<if test="remark != null and remark != ''"> <if test="remark != null and remark != ''">
and remark like concat('%',#{remark},'%') and m.remark like concat('%',#{remark},'%')
</if> </if>
<if test="investigationManageIds != null and investigationManageIds.size > 0 "> <if test="investigationManageIds != null and investigationManageIds.size > 0 ">
and investigation_manage_id in and m.investigation_manage_id in
<foreach collection="investigationManageIds" item="item" index="index" open="(" close=")" separator=","> <foreach collection="investigationManageIds" item="item" index="index" open="(" close=")" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<choose> <choose>
<when test="delFlag != null"> and del_flag = #{delFlag} </when> <when test="delFlag != null"> and m.del_flag = #{delFlag} </when>
<otherwise> and del_flag = 1 </otherwise> <otherwise> and m.del_flag = 1 </otherwise>
</choose> </choose>
</where> </where>
</sql> </sql>
@@ -150,6 +155,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="queryList" parameterType="com.mhd.wms.domain.investigationManage.repository.todo.InvestigationManageDO" resultMap="InvestigationManageResult"> <select id="queryList" parameterType="com.mhd.wms.domain.investigationManage.repository.todo.InvestigationManageDO" resultMap="InvestigationManageResult">
<include refid="selectInvestigationManagePo"/> <include refid="selectInvestigationManagePo"/>
<include refid="selectInvestigationManagePo1"/> <include refid="selectInvestigationManagePo1"/>
order by create_time desc order by m.create_time desc
</select> </select>
</mapper> </mapper>