seyason 1 år sedan
förälder
incheckning
4b56455788

+ 2 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/entity/vo/UserMonthWork.java

@@ -11,4 +11,6 @@ public class UserMonthWork {
     public String corpwxUserId;
     public String corpwxDeptId;
     public List<Map<String, Object>> worktimeList;
+
+    public double totalWorkTime = 0;
 }

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

@@ -148,7 +148,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
     public HttpRespMsg submitReport(Report report, HttpServletRequest request) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         String token = request.getHeader("TOKEN");
-        Integer companyId = userMapper.selectById(token).getCompanyId();
+        User user = userMapper.selectById(token);
+        Integer companyId = user.getCompanyId();
         report.setCreatorId(token);
         LocalDate today = LocalDate.now();
         report.setCreateDate(today);
@@ -160,20 +161,37 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         double curReportTime = 0.0;
         //查找上一次该工序的报工
         Report lastReport = reportMapper.selectOne(new QueryWrapper<Report>().eq("creator_id", token).eq("prod_procedure_id", report.getProdProcedureId()).lt("create_date", today).orderByDesc("create_date").last("limit 1"));
+        if (report.getProgress() <= lastReport.getProgress()) {
+            httpRespMsg.setError("进度不能小于等于上次报工进度");
+            return httpRespMsg;
+        }
         if (lastReport != null) {
             curReportTime = (prodProcedureTeam.getWorkTime() * (report.getProgress() - lastReport.getProgress())/100);
         } else {
             curReportTime = (prodProcedureTeam.getWorkTime() * report.getProgress()/100);
         }
+
         report.setWorkingTime(curReportTime);//本次报工的工时数
         Plan plan = planMapper.selectById(report.getPlanId());
         report.setDeptId(plan.getStationId());
         report.setProductId(plan.getProductId());
+        if (report.getProgress() == 100) {
+            //设置质检人
+            if (report.getCheckType() == 0) {
+                report.setCheckerId(user.getId());
+            }
+            prodProcedureTeam.setCheckerId(report.getCheckerId());
+        }
+        prodProcedureTeam.setProgress(report.getProgress());
         if (existReport == null) {
             reportMapper.insert(report);
         } else {
-            reportMapper.updateById(existReport);
+            report.setId(existReport.getId());
+            reportMapper.updateById(report);
         }
+        //更新自己执行的工序上的进度
+
+        prodProcedureTeamMapper.updateById(prodProcedureTeam);
         return httpRespMsg;
     }
 
@@ -1480,7 +1498,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             Optional<Map<String, Object>> first = reportNameByDate.stream().filter(r -> r.get("id").equals(u.getId())).findFirst();
             //获取角色请假情况 存在同条件下多条请假记录
             if (first.isPresent()) {
-                user.put("state", first.get().get("state"));
                 user.put("workingTime", first.get().get("workingTime"));
             }
             userMapList.add(user);
@@ -1809,7 +1826,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             Integer corpwxDeptId = (Integer) data.get("corpwxDeptId");
             Map<String, Object> map = new HashMap<>();
             String date = new SimpleDateFormat("yyyy-MM-dd").format((Date)data.get("createDate"));
-            map.put("workingTime", data.get("workingTime"));
+            map.put("workingTime", (double)data.get("workingTime"));
             map.put("createDate", date);
             if (id.equals(lastUserId)) {
                 //同一个用户的数据
@@ -1826,6 +1843,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                 lastUserData.worktimeList.add(map);
                 userMonthWorks.add(lastUserData);
             }
+
+            lastUserData.totalWorkTime += (double)map.get("workingTime");
             lastUserId = id;
         }
 

+ 1 - 1
fhKeeper/formulahousekeeper/management-workshop/src/main/resources/mapper/ProdProcedureTeamMapper.xml

@@ -36,7 +36,7 @@
 
     <select id="getFillProcedureDetail" resultType="java.util.HashMap" >
         SELECT a.*, date_format(plan.`start_date`,'%Y-%m-%d') as start_date, date_format(plan.`end_date`,'%Y-%m-%d') as end_date, plan.`plan_type`, plan.`product_scheduling_num`,plan.task_type_name,plan.task_name,plan.task_change_notice_num,
-               product.`name` AS product_name,prod_procedure.name AS procedure_name, prod_procedure.check_type
+               product.`name` AS product_name,prod_procedure.name AS procedure_name, prod_procedure.check_type,plan.station_id
         FROM prod_procedure_team a
                  LEFT JOIN plan ON plan.id = a.plan_id
                  LEFT JOIN product ON product.id = plan.`product_id`