feat(oms):入库业务单新增页面新增按物料编号查询库存批次最近5条过期日期接口 /reservationMaterialInventoryApi/queryRecentExpiryDates/{materialCode},按物料编号关联 NGWL_TEST_WMS.material_base_info 查 reservation_material_inventory 库存批次,返回过期日期+批次号(date_format 按天去重、到期日倒序、limit 5),供前端下拉回显(也可点日期图标手动选择);非平台租户按登录用户一级组织 top_organization_id 过滤(与 /list 一致);沿用 Api→ApplicationService→DomainService→Facade→Impl→Mapper 分层,新增响应对象 MaterialInventoryExpiryBatchPO(expiryDate/batchNumber)
This commit is contained in:
+6
@@ -2,6 +2,7 @@ package com.mhd.oms.domain.reservationMaterialInventory.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.entity.ReservationMaterialInventory;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.po.MaterialInventoryExpiryBatchPO;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryPO;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryQueryListPO;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.MaterialInventoryParamDO;
|
||||
@@ -113,4 +114,9 @@ public interface IReservationMaterialInventoryService extends IService<Reservati
|
||||
public void xgkc(MaterialInventoryOmsParamDO materialInventoryParamDO);
|
||||
|
||||
public void kctzjl(MaterialInventoryOmsParamDO materialInventoryParamDO,String adjustAction,LoginUser loginUser);
|
||||
|
||||
/**
|
||||
* 根据物料编号查询库存批次最近5条过期日期+批次号(入库业务单新增页面下拉回显)
|
||||
*/
|
||||
public List<MaterialInventoryExpiryBatchPO> selectRecentExpiryBatches(String materialCode, Long topOrganizationId);
|
||||
}
|
||||
+4
@@ -2,6 +2,7 @@ package com.mhd.oms.domain.reservationMaterialInventory.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.entity.ReservationMaterialInventory;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.po.MaterialInventoryExpiryBatchPO;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryPO;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.MaterialBarCodePO;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.MaterialBaseInfo;
|
||||
@@ -36,4 +37,7 @@ public interface ReservationMaterialInventoryMapper extends BaseMapper<Reservati
|
||||
public MaterialBaseInfo getByInfoId(@Param("id") Long id);
|
||||
|
||||
public List<MaterialBarCodePO> getInfoByMaterialBaseInfoIds(@Param("id") Long id);
|
||||
|
||||
//入库业务单新增:根据物料编号查询库存批次去重后的过期日期+批次号(最近5条),供前端下拉回显
|
||||
public List<MaterialInventoryExpiryBatchPO> selectRecentExpiryBatches(@Param("materialCode") String materialCode, @Param("topOrganizationId") Long topOrganizationId);
|
||||
}
|
||||
+9
@@ -13,6 +13,7 @@ import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.mapper
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.entity.ReservationMaterialInventory;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.facade.IReservationMaterialInventoryService;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.mapper.ReservationMaterialInventoryMapper;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.po.MaterialInventoryExpiryBatchPO;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryPO;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryQueryListPO;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.MaterialBarCodePO;
|
||||
@@ -120,6 +121,14 @@ public class ReservationMaterialInventoryImpl extends ServiceImpl<ReservationMat
|
||||
return materialInventoryPO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据物料编号查询库存批次最近5条过期日期+批次号(入库业务单新增页面下拉回显)
|
||||
*/
|
||||
@Override
|
||||
public List<MaterialInventoryExpiryBatchPO> selectRecentExpiryBatches(String materialCode, Long topOrganizationId) {
|
||||
return materialInventoryMapper.selectRecentExpiryBatches(materialCode, topOrganizationId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean omsEdit(MaterialInventoryOmsParamDO materialInventoryOmsParamDO) {
|
||||
String inOrderNumber = materialInventoryOmsParamDO.getInOrderNumber();
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.mhd.oms.domain.reservationMaterialInventory.repository.po;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 物料库存批次过期日期对象(入库业务单新增页面下拉回显)
|
||||
*
|
||||
* @author rcx
|
||||
* @date 2026-08-31
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "物料库存批次过期日期", description = "物料库存批次过期日期响应对象")
|
||||
public class MaterialInventoryExpiryBatchPO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("过期日期 yyyy-MM-dd")
|
||||
private String expiryDate;
|
||||
|
||||
@ApiModelProperty("批次号")
|
||||
private String batchNumber;
|
||||
}
|
||||
+17
@@ -8,6 +8,7 @@ import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.mapper.ReservationMaterialInventoryMapper;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.po.MaterialInventoryExpiryBatchPO;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryPO;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryQueryListPO;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.MaterialBarCodePO;
|
||||
@@ -185,6 +186,22 @@ public class ReservationMaterialInventoryApplicationService {
|
||||
return materialInventoryDomainService.getInventoryByStorageLocationIdAndMaterialBaseInfoId(storageLocationId, materialBaseInfoId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据物料编号查询库存批次最近5条过期日期+批次号(入库业务单新增页面下拉回显)
|
||||
* 与 queryList 一致:按登录用户一级组织(租户)过滤,一级组织(平台)不限制
|
||||
*/
|
||||
public List<MaterialInventoryExpiryBatchPO> selectRecentExpiryBatches(String materialCode) {
|
||||
Long topOrganizationId = null;
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null && loginUser.getUserPo() != null) {
|
||||
Long loginTopOrgId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (loginTopOrgId != null && loginTopOrgId != 1) {
|
||||
topOrganizationId = loginTopOrgId;
|
||||
}
|
||||
}
|
||||
return materialInventoryDomainService.selectRecentExpiryBatches(materialCode, topOrganizationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description:库存查询列表
|
||||
* @param materialInventoryQueryListDO
|
||||
|
||||
+8
@@ -3,6 +3,7 @@ package com.mhd.oms.domain.reservationMaterialInventory.service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.entity.ReservationMaterialInventory;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.facade.IReservationMaterialInventoryService;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.po.MaterialInventoryExpiryBatchPO;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryPO;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryQueryListPO;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.ReservationMaterialInventoryDO;
|
||||
@@ -88,6 +89,13 @@ public class ReservationMaterialInventoryDomainService {
|
||||
return materialInventory.getInventoryQuantity();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据物料编号查询库存批次最近5条过期日期+批次号(入库业务单新增页面下拉回显)
|
||||
*/
|
||||
public List<MaterialInventoryExpiryBatchPO> selectRecentExpiryBatches(String materialCode, Long topOrganizationId) {
|
||||
return materialInventoryService.selectRecentExpiryBatches(materialCode, topOrganizationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description:库存查询列表
|
||||
* @param materialInventoryQueryListDO
|
||||
|
||||
+14
@@ -177,6 +177,20 @@ public class ReservationMaterialInventoryApi extends BaseController {
|
||||
return AjaxResult.success(materialInventoryApplicationService.getInventoryByStorageLocationIdAndMaterialBaseInfoId(storageLocationId, materialBaseInfoId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 入库业务单新增页面:根据物料编号查询其库存批次过期日期+批次号,去重取最近5条,
|
||||
* 供前端下拉回显;用户也可点击右侧"日期"小图标手动选择日期
|
||||
*/
|
||||
@ApiOperation("根据物料编号查询库存批次最近5条过期日期+批次号")
|
||||
@GetMapping(value = "/queryRecentExpiryDates/{materialCode}")
|
||||
public AjaxResult queryRecentExpiryDates(@PathVariable("materialCode") String materialCode)
|
||||
{
|
||||
if (StringUtils.isBlank(materialCode)) {
|
||||
return AjaxResult.error("物料编号不能为空");
|
||||
}
|
||||
return AjaxResult.success(materialInventoryApplicationService.selectRecentExpiryBatches(materialCode));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+17
@@ -557,4 +557,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
FROM NGWL_TEST_WMS.material_bar_code
|
||||
WHERE material_base_info_id = #{id} AND del_flag = 1
|
||||
</select>
|
||||
|
||||
<!-- 入库业务单新增:根据物料编号查询其库存批次的过期日期+批次号,去重后取最近5条,供前端下拉回显 -->
|
||||
<select id="selectRecentExpiryBatches" resultType="com.mhd.oms.domain.reservationMaterialInventory.repository.po.MaterialInventoryExpiryBatchPO">
|
||||
select distinct
|
||||
date_format(a.expiry_date, '%Y-%m-%d') as expiryDate,
|
||||
a.batch_number as batchNumber
|
||||
from reservation_material_inventory a
|
||||
left join NGWL_TEST_WMS.material_base_info b on a.material_base_info_id = b.material_base_info_id
|
||||
where a.del_flag = 1
|
||||
and a.expiry_date is not null
|
||||
and b.material_code = #{materialCode}
|
||||
<if test="topOrganizationId != null">
|
||||
and a.top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
order by expiryDate desc, batchNumber desc
|
||||
limit 5
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user