فهرست منبع

手机端填报工时增加剩余件数和其他组员

seyason 1 سال پیش
والد
کامیت
84ee7fde6f

+ 24 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/PlanProcedureTotalServiceImpl.java

@@ -112,6 +112,7 @@ public class PlanProcedureTotalServiceImpl extends ServiceImpl<PlanProcedureTota
         HttpRespMsg msg = new HttpRespMsg();
         String token = request.getHeader("TOKEN");
         HashMap prodProcedureTeam = prodProcedureTeamMapper.getFillProcedureDetail(id);
+
         prodProcedureTeam.remove("steel_num_array");
         //道工序是否自己已经填过了,有的话取数据
         Report oldReport = reportMapper.selectOne(new QueryWrapper<Report>().eq("user_procedure_team_id", id).eq("creator_id", token).eq("create_date", createDate));
@@ -180,6 +181,29 @@ public class PlanProcedureTotalServiceImpl extends ServiceImpl<PlanProcedureTota
         if (prodProcedureTeam == null) {
             msg.setError("找不到该数据");
         } else {
+            Integer ppid = (Integer)prodProcedureTeam.get("plan_procedure_id");
+            //获取该工序的其他组员
+            List<ProdProcedureTeam> otherTeamList = prodProcedureTeamMapper.selectList(new QueryWrapper<ProdProcedureTeam>().eq("plan_procedure_id", ppid).ne("id", id));
+            if (otherTeamList.size() > 0) {
+               List<String> otherMembIds = otherTeamList.stream().map(ProdProcedureTeam::getUserId).collect(Collectors.toList());
+                List<User> otherMembList = userMapper.selectList(new QueryWrapper<User>().in("id", otherMembIds));
+                prodProcedureTeam.put("otherMembs", otherMembList.stream().map(User::getName).collect(Collectors.joining(",")));
+            } else {
+                prodProcedureTeam.put("otherMembs", "无");
+            }
+
+            //计算剩余可填报件数,先取到已经填报的件数
+            List<Report> allFileProcReportList = reportMapper.selectList(new QueryWrapper<Report>().eq("plan_id", planId).eq("prod_procedure_id", prodProcedureTeam.get("prod_procedure_id")));
+            allFileProcReportList.forEach(all->{
+                System.out.println(all.getCreatorId()+" "+all.getCreateDate()+" "+all.getFinishNum());
+            });
+            final LocalDate fDate = LocalDate.parse(createDate, dtf);
+            double allFileProcNum = allFileProcReportList.stream().filter(item->!(item.getCreatorId().equals(token) && item.getCreateDate().isEqual(fDate))).mapToDouble(Report::getFinishNum).sum();
+            Integer planNum = (Integer)prodProcedureTeam.get("num");
+            double remainNum = planNum - allFileProcNum;
+            if (remainNum < 0) remainNum = 0;
+            prodProcedureTeam.put("num", remainNum);
+
             Stream<String> sorted = list.stream().distinct().sorted();
             List<String> collect = sorted.collect(Collectors.toList());
             //如果钢印号有其他人已经填过了,就不显示

+ 3 - 0
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/workView/fillReport.vue

@@ -6,6 +6,9 @@
     <van-cell title="产品名称" :value="reportForm.product_name"></van-cell>
     <van-cell :title="reportForm.plan_type == 0?'排产工单号':'任务变更通知号'" :value="reportForm.plan_type == 0 ? reportForm.product_scheduling_num : reportForm.task_change_notice_num"></van-cell>
     <van-cell title="计划工期" :value="reportForm.start_date+'至'+(reportForm.end_date==null?' ':reportForm.end_date)"></van-cell>
+    <van-cell title="剩余可报件数" :value="reportForm.num"></van-cell>
+    <van-cell title="其他组员" :value="reportForm.otherMembs"></van-cell>
+    
     <!-- <div class="distribution_header">
       
       <div>{{ reportForm.product_name }}<span style="float:right;color:#20a0ff;">{{reportDate  }}</span> </div>