Browse Source

采购入库

master
ruanqi 2 years ago
parent
commit
73dd9df706
  1. 13
      src/main/java/com/spring/modules/base/dao/NormalSearchMapper.java
  2. 12
      src/main/java/com/spring/modules/material/service/Impl/IssureSoServiceImpl.java
  3. 8
      src/main/resources/mapper/base/NormalSearchMapper.xml

13
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<InventoryStockRoll>
* @throw
*/
List<InventoryStockRoll> newInNewOutWithSitePart(@Param("site") String site,@Param("partNo") String partNo);
}

12
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<InventoryStockRoll> 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());

8
src/main/resources/mapper/base/NormalSearchMapper.xml

@ -84,4 +84,12 @@
<select id="getPartPropertiesValue" resultType="String">
select dbo.Get_PartPropertiesValue(#{site},#{partNo},#{itemNo})
</select>
<select id="newInNewOutWithSitePart" resultType="com.spring.modules.base.entity.InventoryStockRoll">
select top 1 a.site,a.RollNo,a.PartNo,a.ManufactureDate
from InventoryStock_Roll a left join TransDetailsub_cach b on a.Site=b.site and a.RollNo=b.RollNo
where a.site=#{site} and a.PartNo=#{partNo} and b.site is null and QtyOnHand>0
order by a.ManufactureDate
</select>
</mapper>
Loading…
Cancel
Save