|
|
|
@ -163,20 +163,35 @@ public class PoReceiveServiceImpl implements PoReceiveService { |
|
|
|
if(checkPartNo.size()==0){ |
|
|
|
throw new RuntimeException("物料不存在或者不在用"); |
|
|
|
} |
|
|
|
Date currentDate = new Date(); |
|
|
|
if(currentDate.after(inData.getExpiredDate())){ |
|
|
|
throw new RuntimeException("该物料已过期,失效日期为"+DateUtil.getStringDate(inData.getExpiredDate())); |
|
|
|
int days=45; |
|
|
|
String getExpire=normalSearchMapper.getPartPropertiesValue(inData.getSite(),inData.getPartNo(),"P00009"); |
|
|
|
if(getExpire==null){ |
|
|
|
|
|
|
|
}else { |
|
|
|
if(Integer.parseInt(getExpire)>0){ |
|
|
|
days= Integer.parseInt(getExpire); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Date currentDate = new Date(); |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
calendar.setTime(currentDate); |
|
|
|
|
|
|
|
// 使用 Calendar 类的方法计算45天前的日期 |
|
|
|
calendar.add(Calendar.DAY_OF_YEAR, -45); |
|
|
|
// // 使用 Calendar 类的方法计算45天前的日期 |
|
|
|
calendar.add(Calendar.DAY_OF_YEAR, days); |
|
|
|
Date pastDate = calendar.getTime(); |
|
|
|
// Date futureDate = new Date(currentDate.getTime() - (45 * 24 * 60 * 60 * 1000)); |
|
|
|
if(pastDate.after(inData.getManufactureDate())){ |
|
|
|
throw new RuntimeException("该物料生产日期在45天以前,生产日期为"+DateUtil.getStringDate(inData.getManufactureDate())); |
|
|
|
if(pastDate.after(inData.getExpiredDate())){ |
|
|
|
throw new RuntimeException("该物料有效期不足"+days+"天."); |
|
|
|
} |
|
|
|
// Calendar calendar = Calendar.getInstance(); |
|
|
|
// calendar.setTime(currentDate); |
|
|
|
// // 使用 Calendar 类的方法计算45天前的日期 |
|
|
|
// calendar.add(Calendar.DAY_OF_YEAR, -45); |
|
|
|
// Date pastDate = calendar.getTime(); |
|
|
|
// // Date futureDate = new Date(currentDate.getTime() - (45 * 24 * 60 * 60 * 1000)); |
|
|
|
// if(pastDate.after(inData.getManufactureDate())){ |
|
|
|
// throw new RuntimeException("该物料生产日期在45天以前,生产日期为"+DateUtil.getStringDate(inData.getManufactureDate())); |
|
|
|
// } |
|
|
|
for (int i = 0; i < inData.getRollNumber(); i++) { |
|
|
|
String rollNo= transNoControlService.transNo(inData.getSite(), "RollNo"); |
|
|
|
inData.setRollNo(rollNo); |
|
|
|
|