常熟吴彦祖 2 weeks ago
parent
commit
10f16b256e
  1. 28
      src/main/java/com/gaotao/modules/check/service/impl/PhysicalInventoryServiceImpl.java

28
src/main/java/com/gaotao/modules/check/service/impl/PhysicalInventoryServiceImpl.java

@ -2265,12 +2265,28 @@ public class PhysicalInventoryServiceImpl extends ServiceImpl<PhysicalInventoryM
month= (lastCompletedCycleIndex ) * cycle; month= (lastCompletedCycleIndex ) * cycle;
} }
// 获取当前年份 // 获取当前年份
int currentYear = LocalDate.now().getYear();
YearMonth yearMonth = YearMonth.of(currentYear, month);
LocalDate lastDay = yearMonth.atEndOfMonth();
LocalDateTime lastDayTime = lastDay.atTime(23, 59, 59);
Date lastPandian=Date.from(lastDayTime.atZone(ZoneId.of("Asia/Shanghai")).toInstant());
log.info("获得上次盘点结束日期: {}", lastPandian.toString());
Date lastPandian;
if(month>0) {
int currentYear = LocalDate.now().getYear();
YearMonth yearMonth = YearMonth.of(currentYear, month);
LocalDate lastDay = yearMonth.atEndOfMonth();
LocalDateTime lastDayTime = lastDay.atTime(23, 59, 59);
lastPandian = Date.from(lastDayTime.atZone(ZoneId.of("Asia/Shanghai")).toInstant());
log.info("获得上次盘点结束日期: {}", lastPandian.toString());
}else {
// 获取当前日期系统默认时区
LocalDate today = LocalDate.now();
// 获取去年的年份
int lastYear = today.getYear() - 1;
// 构造去年的最后一天12月31日
LocalDate lastDayOfLastYear = LocalDate.of(lastYear, 12, 31);
// 转换为 Date使用系统默认时区
lastPandian = Date.from(lastDayOfLastYear.atStartOfDay(ZoneId.systemDefault()).toInstant());
}
baseMapper.updateLastPandianHU(site, lastPandian); baseMapper.updateLastPandianHU(site, lastPandian);
//开启盘点模式 //开启盘点模式

Loading…
Cancel
Save