seyason 1 year ago
parent
commit
9b26e60598

+ 5 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/entity/Company.java

@@ -6,9 +6,12 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
 
 /**
  * <p>
@@ -47,6 +50,8 @@ public class Company extends Model<Company> {
      * 会员到期时间
      */
     @TableField("expiration_date")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     private LocalDateTime expirationDate;
 
     /**

+ 7 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/entity/Report.java

@@ -8,9 +8,12 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
 
 /**
  * <p>
@@ -43,6 +46,8 @@ public class Report extends Model<Report> {
      * 日期
      */
     @TableField("create_date")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     private LocalDate createDate;
 
     /**
@@ -55,6 +60,8 @@ public class Report extends Model<Report> {
      * 创建时间
      */
     @TableField("create_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime createTime;
 
     /**

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

@@ -57,7 +57,7 @@ public class PlanProcedureTotalServiceImpl extends ServiceImpl<PlanProcedureTota
             if (prePlanId == null || !prePlanId.equals(curPlanId)) {
                 prePlanId = curPlanId;
                 HashMap planMap = new HashMap();
-                planMap.put("plan_d", curPlanId);
+                planMap.put("plan_id", curPlanId);
                 planMap.put("plan_name", map.get("plan_name"));
                 planMap.put("start_date", map.get("start_date"));
                 planMap.put("end_date", map.get("end_date"));

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

@@ -161,11 +161,11 @@ 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) {
+            if (report.getProgress() <= lastReport.getProgress()) {
+                httpRespMsg.setError("进度必须大于上次报工进度("+lastReport.getProgress()+"%)");
+                return httpRespMsg;
+            }
             curReportTime = (prodProcedureTeam.getWorkTime() * (report.getProgress() - lastReport.getProgress())/100);
         } else {
             curReportTime = (prodProcedureTeam.getWorkTime() * report.getProgress()/100);
@@ -182,6 +182,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             }
             prodProcedureTeam.setCheckerId(report.getCheckerId());
         }
+        prodProcedureTeam.setUpdateTime(LocalDateTime.now());
         prodProcedureTeam.setProgress(report.getProgress());
         if (existReport == null) {
             reportMapper.insert(report);
@@ -206,7 +207,9 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             user.setPassword(null);
             userList.add(user);
         } else if (checkType == 1) {
-            userList = userMapper.selectList(new QueryWrapper<User>().select("id, name, corpwx_userid").eq("department_id", deptId));
+            List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
+            List<Integer> deptIncludeSubDeptIds = departmentService.getDeptIncludeSubDeptIds(deptId, allDeptList);
+            userList = userMapper.selectList(new QueryWrapper<User>().select("id, name, corpwx_userid").in("department_id", deptIncludeSubDeptIds));
         } else if (checkType == 2) {
             List<DepartmentOtherManager> otherManagers = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("department_id", deptId));
             List<String> userIds = otherManagers.stream().map(DepartmentOtherManager::getOtherManagerId).collect(Collectors.toList());

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

@@ -23,23 +23,25 @@
 
 
     <select id="getReportForWorkList" 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,
+        SELECT a.*, plan_procedure_total.plan_id, prod_procedure_id.prod_procedure_id, 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
         FROM prod_procedure_team a
-                 LEFT JOIN plan ON plan.id = a.plan_id
+                 left join plan_procedure_total on plan_procedure_total.id = a.plan_procedure_id
+                 LEFT JOIN plan ON plan.id = plan_procedure_total.plan_id
                  LEFT JOIN product ON product.id = plan.`product_id`
-                 LEFT JOIN prod_procedure ON prod_procedure.id = a.prod_procedure_id
+                 LEFT JOIN prod_procedure ON prod_procedure.id = plan_procedure_total.prod_procedure_id
         where 1 = 1 and a.progress &lt; 100 and a.user_id=#{userId}
-        order by a.plan_id desc
+        order by plan.id desc
     </select>
 
     <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,
+        SELECT a.*, plan_procedure_total.plan_id, prod_procedure_id.prod_procedure_id, 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,plan.station_id
         FROM prod_procedure_team a
-                 LEFT JOIN plan ON plan.id = a.plan_id
+            left join plan_procedure_total on plan_procedure_total.id = a.plan_procedure_id
+                 LEFT JOIN plan ON plan.id = plan_procedure_total.plan_id
                  LEFT JOIN product ON product.id = plan.`product_id`
-                 LEFT JOIN prod_procedure ON prod_procedure.id = a.prod_procedure_id
+                 LEFT JOIN prod_procedure ON prod_procedure.id = plan_procedure_total.prod_procedure_id
         where a.id = #{id}
     </select>
 

+ 5 - 4
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/workView/fillReport.vue

@@ -51,6 +51,7 @@ export default {
   },
   data() {
     return {
+      checkerOptionList: [],
       checkerShow: false,
       user: JSON.parse(localStorage.userInfo),
       saving: false,
@@ -73,17 +74,18 @@ export default {
       this.$router.go(-1);
     },
     onConfirm(value,key){
-        this.reportForm.checkerId = value.id
+        this.reportForm.checker_id = value.id
         this.reportForm.checker_name = value.name
         this.checkerShow = false
     },
     showCheckerOptionList() {
       this.checkerShow = true;
-      this.$axios.post("/report/getCheckerList", {check_type: this.reportForm.check_type, deptId: this.reportForm.station_id})
+      this.$axios.post("/report/getCheckerList", {checkType: this.reportForm.check_type, deptId: this.reportForm.station_id})
         .then(res => {
           this.saving = false;
             if(res.code == "ok") {
                 this.checkerOptionList = res.data;
+                this.$forceUpdate();
             } else {
                 this.$toast.fail(res.msg);
             }
@@ -99,7 +101,6 @@ export default {
           prodProcedureId: this.reportForm.prod_procedure_id,
           progress: this.reportForm.progress,
           planId: this.reportForm.plan_id,
-          productId: this.reportForm.product_id,
           checkType: this.reportForm.check_type
         };
         if (this.reportForm.progress == 100) {
@@ -108,7 +109,7 @@ export default {
               this.$toast.fail('请选择检验人')
               return;
             } else {
-              this.postData.checkerId = this.reportForm.checker_id;
+              postData.checkerId = this.reportForm.checker_id;
             }
           }
         }