浏览代码

1. 工时管家修改新版按周填报合并的月末天数为3天
2. 车间系统提交日报时,对于完工的计划,设置hideState=1

seyason 1 年之前
父节点
当前提交
93fa47b966

+ 27 - 9
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -7383,8 +7383,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         //需要填报的最后一天
         //需要填报的最后一天
         LocalDate lastDayOfWeek = sunday;
         LocalDate lastDayOfWeek = sunday;
         int days = sunday.lengthOfMonth() - sunday.getDayOfMonth();
         int days = sunday.lengthOfMonth() - sunday.getDayOfMonth();
-        if (days <= 2) {
-            //周日距离月底相差天数在2天以内,比如周日是10.29,则10.30和10.31也算在本周内
+        if (days <= 3) {
+            //周日距离月底相差天数在3天以内,比如周日是10.28,则10.29,10.30和10.31也算在本周内
             lastDayOfWeek = sunday.plusDays(days);
             lastDayOfWeek = sunday.plusDays(days);
         }
         }
         //如果上周只有2天以内工作日,需要并到这周来
         //如果上周只有2天以内工作日,需要并到这周来
@@ -7392,7 +7392,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         LocalDate lastSaturday = lastSunday.with(DayOfWeek.SATURDAY);
         LocalDate lastSaturday = lastSunday.with(DayOfWeek.SATURDAY);
 
 
         if (WorkDayCalculateUtils.isWorkDay(lastSunday) && WorkDayCalculateUtils.isWorkDay(lastSaturday)) {
         if (WorkDayCalculateUtils.isWorkDay(lastSunday) && WorkDayCalculateUtils.isWorkDay(lastSaturday)) {
-            //上周周末两天是工作日,并且只有2天以内工作日,需要并到这周来
+            //合并上周的工作日的情况:上周周末两天是工作日,并且只有2天以内工作日,需要并到这周来
             LocalDate lastMonday = lastSunday.with(DayOfWeek.MONDAY);
             LocalDate lastMonday = lastSunday.with(DayOfWeek.MONDAY);
             boolean hasMoreWorkDays = false;
             boolean hasMoreWorkDays = false;
             while (lastMonday.isBefore(lastSaturday)) {
             while (lastMonday.isBefore(lastSaturday)) {
@@ -7405,15 +7405,33 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             if (!hasMoreWorkDays) {
             if (!hasMoreWorkDays) {
                 firstDayOfWeek = lastSaturday;
                 firstDayOfWeek = lastSaturday;
             }
             }
-        }
-        //如果本周一周二中有工作日,但是是上个月的月末,会被合并到上周去,本周要去掉
-        if (WorkDayCalculateUtils.isWorkDay(firstDayOfWeek) && firstDayOfWeek.getDayOfMonth() >= 30) {
-            firstDayOfWeek = firstDayOfWeek.plusDays(1);
-            if (WorkDayCalculateUtils.isWorkDay(firstDayOfWeek) && firstDayOfWeek.getDayOfMonth() >= 30) {
-                firstDayOfWeek = firstDayOfWeek.plusDays(1);
+        } else {
+            //剔除被合并到上周的情况,如果本周一周二周三中有工作日,但是是上个月的月末,会被合并到上周去,本周要去掉
+            boolean hasFirstDayOfMonth = false;
+            LocalDate checkDate = firstDayOfWeek;
+            int beforeDays = 0;
+            while (!checkDate.isAfter(lastDayOfWeek)) {
+                if (checkDate.getDayOfMonth() == 1) {
+                    hasFirstDayOfMonth = true;
+                    break;
+                } else {
+                    beforeDays++;
+                }
+                checkDate = checkDate.plusDays(1);
+            }
+            if (hasFirstDayOfMonth && beforeDays <= 3) {
+                firstDayOfWeek = checkDate;
             }
             }
         }
         }
 
 
+//        if (WorkDayCalculateUtils.isWorkDay(firstDayOfWeek) && firstDayOfWeek.getDayOfMonth() >= 30) {
+//            firstDayOfWeek = firstDayOfWeek.plusDays(1);
+//            if (WorkDayCalculateUtils.isWorkDay(firstDayOfWeek) && firstDayOfWeek.getDayOfMonth() >= 30) {
+//                firstDayOfWeek = firstDayOfWeek.plusDays(1);
+//            }
+//        }
+
+
         //再按照当前用户的入职离职日期进行过滤
         //再按照当前用户的入职离职日期进行过滤
         LocalDate entryDate = user.getInductionDate();
         LocalDate entryDate = user.getInductionDate();
         LocalDate leaveDate = user.getInactiveDate();
         LocalDate leaveDate = user.getInactiveDate();

+ 1 - 10
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -142,18 +142,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         if (report.getFinishNum() == null) {
         if (report.getFinishNum() == null) {
             report.setFinishNum(0.0);
             report.setFinishNum(0.0);
         }
         }
-//        LocalDate today = LocalDate.now();
         LocalDate targetDate = report.getCreateDate();
         LocalDate targetDate = report.getCreateDate();
-//        if (report.getId() == null) {
-//            report.setCreateDate(today);
-//            targetDate = today;
-//        } else {
-//            Report report1 = reportMapper.selectById(report.getId());
-//            targetDate = report1.getCreateDate();
-//            report.setCreateDate(report1.getCreateDate());
-//        }
         report.setCompanyId(companyId);
         report.setCompanyId(companyId);
-
         Plan plan = planMapper.selectById(report.getPlanId());
         Plan plan = planMapper.selectById(report.getPlanId());
         if (plan.getNum() == 0) {
         if (plan.getNum() == 0) {
             httpRespMsg.setError("该计划件数为0,无法报工");
             httpRespMsg.setError("该计划件数为0,无法报工");
@@ -270,6 +260,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         if (isAllFinish) {
         if (isAllFinish) {
             //该计划下的所有工序都已经完成了,那么该计划就是完成状态
             //该计划下的所有工序都已经完成了,那么该计划就是完成状态
             plan.setRealEndDate(LocalDate.now());
             plan.setRealEndDate(LocalDate.now());
+            plan.setHideState(1);//完成的隐藏掉
             planMapper.updateById(plan);
             planMapper.updateById(plan);
         }
         }
         return httpRespMsg;
         return httpRespMsg;