Browse Source

如果用户没有选择过期日期,则为当前时间+料号的默认保质期(如果有的话)设置过期日期;如果没有默认保质期,则设置一个默认的过期日期(例如当前时间+365天)

master
han\hanst 3 weeks ago
parent
commit
96a7409444
  1. 10
      src/main/java/com/gaotao/modules/production/service/impl/ProductionInboundServiceImpl.java
  2. 10
      src/main/java/com/gaotao/modules/salesreturn/service/impl/SalesReturnServiceImpl.java

10
src/main/java/com/gaotao/modules/production/service/impl/ProductionInboundServiceImpl.java

@ -572,12 +572,20 @@ public class ProductionInboundServiceImpl implements ProductionInboundService {
if (dto.getIfsExpiryDate() == null) { if (dto.getIfsExpiryDate() == null) {
List<InventoryPartVo> parts = ifsApiIssueAndReturnService.getInventoryPart(dto.getPartNo(),dto.getSite()); List<InventoryPartVo> parts = ifsApiIssueAndReturnService.getInventoryPart(dto.getPartNo(),dto.getSite());
// 如果用户没有选择过期日期则为当前时间+料号的默认保质期如果有的话设置过期日期 // 如果用户没有选择过期日期则为当前时间+料号的默认保质期如果有的话设置过期日期
if (!parts.isEmpty() && parts.getFirst().getDurabilityDays() > 0) {
if (!parts.isEmpty()) {
if (parts.getFirst().getDurabilityDays() > 0) {
// 当前时间+365天作为过期日期 // 当前时间+365天作为过期日期
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date()); calendar.setTime(new Date());
calendar.add(Calendar.DAY_OF_YEAR, parts.getFirst().getDurabilityDays()); calendar.add(Calendar.DAY_OF_YEAR, parts.getFirst().getDurabilityDays());
dto.setIfsExpiryDate(calendar.getTime()); dto.setIfsExpiryDate(calendar.getTime());
} else {
// 如果没有默认保质期则设置一个默认的过期日期例如当前时间+365天
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.DAY_OF_YEAR, 365);
dto.setIfsExpiryDate(calendar.getTime());
}
} }
} }
// 用于收集创建的HU unitIds // 用于收集创建的HU unitIds

10
src/main/java/com/gaotao/modules/salesreturn/service/impl/SalesReturnServiceImpl.java

@ -166,12 +166,20 @@ public class SalesReturnServiceImpl implements SalesReturnService {
if (dto.getExpiryDate() == null) { if (dto.getExpiryDate() == null) {
List<InventoryPartVo> parts = ifsApiIssueAndReturnService.getInventoryPart(dto.getPartNo(),dto.getSite()); List<InventoryPartVo> parts = ifsApiIssueAndReturnService.getInventoryPart(dto.getPartNo(),dto.getSite());
// 如果用户没有选择过期日期则为当前时间+料号的默认保质期如果有的话设置过期日期 // 如果用户没有选择过期日期则为当前时间+料号的默认保质期如果有的话设置过期日期
if (!parts.isEmpty() && parts.getFirst().getDurabilityDays() > 0) {
if (!parts.isEmpty()) {
if (parts.getFirst().getDurabilityDays() > 0) {
// 当前时间+365天作为过期日期 // 当前时间+365天作为过期日期
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date()); calendar.setTime(new Date());
calendar.add(Calendar.DAY_OF_YEAR, parts.getFirst().getDurabilityDays()); calendar.add(Calendar.DAY_OF_YEAR, parts.getFirst().getDurabilityDays());
dto.setExpiryDate(calendar.getTime()); dto.setExpiryDate(calendar.getTime());
} else {
// 如果没有默认保质期则设置一个默认的过期日期例如当前时间+365天
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.DAY_OF_YEAR, 365);
dto.setExpiryDate(calendar.getTime());
}
} }
} }
SysUserEntity currentUser = (SysUserEntity) SecurityUtils.getSubject().getPrincipal(); SysUserEntity currentUser = (SysUserEntity) SecurityUtils.getSubject().getPrincipal();

Loading…
Cancel
Save