|
|
|
@ -22,10 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
@Service |
|
|
|
@ -152,11 +149,17 @@ public class PoReceiveServiceImpl implements PoReceiveService { |
|
|
|
} |
|
|
|
Date currentDate = new Date(); |
|
|
|
if(currentDate.after(inData.getExpiredDate())){ |
|
|
|
throw new RuntimeException("该物料已过期,失效日期为"+DateUtil.getStringDate(inData.getManufactureDate())); |
|
|
|
throw new RuntimeException("该物料已过期,失效日期为"+DateUtil.getStringDate(inData.getExpiredDate())); |
|
|
|
} |
|
|
|
Date futureDate = new Date(currentDate.getTime() - (45 * 24 * 60 * 60 * 1000)); |
|
|
|
if(futureDate.after(inData.getManufactureDate())){ |
|
|
|
throw new RuntimeException("该物料生产日期在45天以前,生产日期为"+DateUtil.getStringDate(inData.getExpiredDate())); |
|
|
|
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"); |
|
|
|
|