fix(oms):入库执行单列表单号搜索查不到,businessNumber死条件改单号模糊互查;库存查询货主过滤移回主表并修正委托方误判
- 入库执行单列表:businessNumber条件原为BUSINESS_NUMBER精确等值,该列无写入恒空致全条件查询0条,改为业务单号/入库单号OR模糊互查 - 入库执行单列表:inOrderNumber精确等值改模糊like;删除重复的createByName条件;补businessInOrderNumber过滤(业务单号/入库单号互查) - 库存查询:货主过滤(shipperId/Code/Name/shipperInfo)从物料表b移回库存主表a,避免LEFT JOIN退化INNER JOIN丢行 - 库存查询:委托方判定由组织层级改为UserPo.shipperEnterpriseName,避免二级组织运营人员(2841/2842)被误判强制按本人userId过滤
This commit is contained in:
+4
-3
@@ -57,15 +57,16 @@ public class ReservationMaterialInventoryApplicationService {
|
|||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
if (loginUser != null && loginUser.getUserPo() != null) {
|
if (loginUser != null && loginUser.getUserPo() != null) {
|
||||||
Long loginTopOrgId = loginUser.getUserPo().getTopOrganizationId();
|
Long loginTopOrgId = loginUser.getUserPo().getTopOrganizationId();
|
||||||
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
|
|
||||||
boolean isTopOrgUser = userOrganizationId != null && userOrganizationId.equals(loginTopOrgId);
|
|
||||||
|
|
||||||
// 出库预约-添加货物:按一级组织(租户)过滤;委托方(货主)叠加货主维度查自己的货
|
// 出库预约-添加货物:按一级组织(租户)过滤;委托方(货主)叠加货主维度查自己的货
|
||||||
|
// 委托方判定以"挂货主企业"为准,不再按组织层级判定,
|
||||||
|
// 避免二级组织(谷丰2842/仓码2841等)运营人员被误判为委托方、强制按本人userId过滤导致查不到库存
|
||||||
materialInventoryDO.setOrganizationId(null);
|
materialInventoryDO.setOrganizationId(null);
|
||||||
if (loginTopOrgId != null && loginTopOrgId != 1) {
|
if (loginTopOrgId != null && loginTopOrgId != 1) {
|
||||||
materialInventoryDO.setTopOrganizationId(loginTopOrgId);
|
materialInventoryDO.setTopOrganizationId(loginTopOrgId);
|
||||||
}
|
}
|
||||||
if (!isTopOrgUser && materialInventoryDO.getShipperId() == null) {
|
boolean isShipperUser = StringUtils.isNotBlank(loginUser.getUserPo().getShipperEnterpriseName());
|
||||||
|
if (isShipperUser && materialInventoryDO.getShipperId() == null) {
|
||||||
materialInventoryDO.setShipperId(loginUser.getUserPo().getUserId());
|
materialInventoryDO.setShipperId(loginUser.getUserPo().getUserId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-5
@@ -229,7 +229,12 @@
|
|||||||
and a.notice_number = #{noticeNumber}
|
and a.notice_number = #{noticeNumber}
|
||||||
</if>
|
</if>
|
||||||
<if test="inOrderNumber != null and inOrderNumber != ''">
|
<if test="inOrderNumber != null and inOrderNumber != ''">
|
||||||
and a.in_order_number = #{inOrderNumber}
|
and a.in_order_number like concat('%', #{inOrderNumber}, '%')
|
||||||
|
</if>
|
||||||
|
<!-- 业务入库单号:同时模糊匹配业务单号/入库单号,两种单号输混也能搜到 -->
|
||||||
|
<if test="businessInOrderNumber != null and businessInOrderNumber != ''">
|
||||||
|
and (a.business_in_order_number like concat('%', #{businessInOrderNumber}, '%')
|
||||||
|
or a.in_order_number like concat('%', #{businessInOrderNumber}, '%'))
|
||||||
</if>
|
</if>
|
||||||
<if test="status != null ">
|
<if test="status != null ">
|
||||||
and a.status = #{status}
|
and a.status = #{status}
|
||||||
@@ -451,11 +456,10 @@
|
|||||||
<if test="reservationOrderSource != null and reservationOrderSource != ''">
|
<if test="reservationOrderSource != null and reservationOrderSource != ''">
|
||||||
and a.RESERVATION_ORDER_SOURCE = #{reservationOrderSource}
|
and a.RESERVATION_ORDER_SOURCE = #{reservationOrderSource}
|
||||||
</if>
|
</if>
|
||||||
|
<!-- businessNumber:该列无写入链路(历史数据恒空),原精确等值必查空;改为按业务单号/入库单号模糊互查兜底 -->
|
||||||
<if test="businessNumber != null and businessNumber != ''">
|
<if test="businessNumber != null and businessNumber != ''">
|
||||||
and a.BUSINESS_NUMBER = #{businessNumber}
|
and (a.business_in_order_number like concat('%', #{businessNumber}, '%')
|
||||||
</if>
|
or a.in_order_number like concat('%', #{businessNumber}, '%'))
|
||||||
<if test="createByName != null and createByName != ''">
|
|
||||||
and a.create_by_name like concat('%', #{createByName}, '%')
|
|
||||||
</if>
|
</if>
|
||||||
<if test="storageTimeStart != null and storageTimeStart != ''">
|
<if test="storageTimeStart != null and storageTimeStart != ''">
|
||||||
and a.storage_time >= #{storageTimeStart}
|
and a.storage_time >= #{storageTimeStart}
|
||||||
|
|||||||
+8
-10
@@ -88,15 +88,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<!-- 该片段总是在物料基础信息表使用别名 b 时被 include,例如:
|
<!-- 该片段总是在物料基础信息表使用别名 b 时被 include,例如:
|
||||||
FROM ... LEFT JOIN material_base_info b ON ...
|
FROM ... LEFT JOIN material_base_info b ON ...
|
||||||
因此这里所有列名都加上 b. 前缀以避免和主表列名歧义 -->
|
因此这里所有列名都加上 b. 前缀以避免和主表列名歧义 -->
|
||||||
<if test="shipperId != null ">
|
|
||||||
and b.shipper_id = #{shipperId}
|
|
||||||
</if>
|
|
||||||
<if test="shipperCode != null and shipperCode != ''">
|
|
||||||
and b.shipper_code like concat('%', #{shipperCode}, '%')
|
|
||||||
</if>
|
|
||||||
<if test="shipperName != null and shipperName != ''">
|
|
||||||
and b.shipper_name like concat('%', #{shipperName}, '%')
|
|
||||||
</if>
|
|
||||||
<if test="materialCode != null and materialCode != ''">
|
<if test="materialCode != null and materialCode != ''">
|
||||||
and b.material_code = #{materialCode}
|
and b.material_code = #{materialCode}
|
||||||
</if>
|
</if>
|
||||||
@@ -123,7 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
and b.material_type_name like concat('%', #{materialTypeName}, '%')
|
and b.material_type_name like concat('%', #{materialTypeName}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="shipperInfo != null and shipperInfo != ''">
|
<if test="shipperInfo != null and shipperInfo != ''">
|
||||||
and (b.shipper_code like concat('%', #{shipperInfo}, '%') or b.shipper_name like concat('%', #{shipperInfo}, '%'))
|
and (a.shipper_code like concat('%', #{shipperInfo}, '%') or a.shipper_name like concat('%', #{shipperInfo}, '%'))
|
||||||
</if>
|
</if>
|
||||||
<if test="materialInfo != null and materialInfo != ''">
|
<if test="materialInfo != null and materialInfo != ''">
|
||||||
and (b.material_code = #{materialInfo} or b.material_name like concat('%', #{materialInfo}, '%') or b.bar_code = #{materialInfo})
|
and (b.material_code = #{materialInfo} or b.material_name like concat('%', #{materialInfo}, '%') or b.bar_code = #{materialInfo})
|
||||||
@@ -175,9 +166,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="warehouseId != null ">
|
<if test="warehouseId != null ">
|
||||||
and a.warehouse_id = #{warehouseId}
|
and a.warehouse_id = #{warehouseId}
|
||||||
</if>
|
</if>
|
||||||
|
<!-- 货主维度过滤只走库存主表 -->
|
||||||
<if test="shipperId != null ">
|
<if test="shipperId != null ">
|
||||||
and a.shipper_id = #{shipperId}
|
and a.shipper_id = #{shipperId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="shipperCode != null and shipperCode != ''">
|
||||||
|
and a.shipper_code like concat('%', #{shipperCode}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="shipperName != null and shipperName != ''">
|
||||||
|
and a.shipper_name like concat('%', #{shipperName}, '%')
|
||||||
|
</if>
|
||||||
<if test="warehouseCode != null and warehouseCode != ''">
|
<if test="warehouseCode != null and warehouseCode != ''">
|
||||||
and a.warehouse_code = #{warehouseCode}
|
and a.warehouse_code = #{warehouseCode}
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
Reference in New Issue
Block a user