diff --git a/src/main/java/com/spring/modules/base/dao/NormalSearchMapper.java b/src/main/java/com/spring/modules/base/dao/NormalSearchMapper.java index 2f48d66..cd5cbd3 100644 --- a/src/main/java/com/spring/modules/base/dao/NormalSearchMapper.java +++ b/src/main/java/com/spring/modules/base/dao/NormalSearchMapper.java @@ -1,5 +1,6 @@ package com.spring.modules.base.dao; +import com.spring.modules.base.entity.InventoryStockRoll; import com.spring.modules.base.entity.PartInformationEntity; import com.spring.modules.material.entity.Supplier; import com.spring.modules.sys.entity.SysUserEntity; @@ -34,4 +35,16 @@ public interface NormalSearchMapper { * @throw */ String getPartPropertiesValue(@Param("site") String site,@Param("partNo") String partNo,@Param("itemNo") String itemNo); + + /** + * @Description 先进先出 + * @Title newInNewOutWithSitePart + * @param site +  * @param partNo + * @author rq + * @date 2024/7/15 17:59 + * @return List + * @throw + */ + List newInNewOutWithSitePart(@Param("site") String site,@Param("partNo") String partNo); } diff --git a/src/main/java/com/spring/modules/material/service/Impl/IssureSoServiceImpl.java b/src/main/java/com/spring/modules/material/service/Impl/IssureSoServiceImpl.java index 5b7d864..80277a9 100644 --- a/src/main/java/com/spring/modules/material/service/Impl/IssureSoServiceImpl.java +++ b/src/main/java/com/spring/modules/material/service/Impl/IssureSoServiceImpl.java @@ -20,6 +20,7 @@ import com.spring.modules.production.entity.ShopOrder; import com.spring.modules.production.mapper.ShopOrderMapper; import com.spring.modules.production.vo.ShopOrderVo; import com.spring.modules.report.dao.ProcedureDao; +import com.spring.modules.schedule.utils.DateUtils; import com.spring.modules.sys.entity.SysUserEntity; import org.apache.shiro.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -170,6 +171,17 @@ public class IssureSoServiceImpl implements IssureSoService { if(InventoryStockRollList.size()==0){ throw new RuntimeException("卷号不存在或者不在库!"); } + if("Y".equals(InventoryStockRollList.get(0).getFreezeFlag())){ + throw new RuntimeException("该卷被冻结无法出库!"); + } + //用物料和site去查询最早的生产日期来实现先进先出 + List newInNewOut= normalSearchMapper.newInNewOutWithSitePart(InventoryStockRollList.get(0).getSite(),InventoryStockRollList.get(0).getPartNo()); + if(newInNewOut.size()==0){ + throw new RuntimeException("物料库存不足!"); + } + if(InventoryStockRollList.get(0).getManufactureDate().after(newInNewOut.get(0).getManufactureDate())){ + throw new RuntimeException("请按照先进先出规则!最早生产日期为:"+ DateUtils.getStringDate(newInNewOut.get(0).getManufactureDate())); + } ShopOrderVo shopOrder=new ShopOrderVo(); shopOrder.setSite(inData.getSite()); shopOrder.setOrderNo(inData.getOrderNo()); diff --git a/src/main/resources/mapper/base/NormalSearchMapper.xml b/src/main/resources/mapper/base/NormalSearchMapper.xml index 82742cb..992fe08 100644 --- a/src/main/resources/mapper/base/NormalSearchMapper.xml +++ b/src/main/resources/mapper/base/NormalSearchMapper.xml @@ -84,4 +84,12 @@ + + + \ No newline at end of file