Jelajahi Sumber

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

Min 1 tahun lalu
induk
melakukan
a6ff35832a

+ 7 - 1
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/entity/ProdProcedureTeam.java

@@ -17,7 +17,7 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author Seyason
- * @since 2023-07-29
+ * @since 2023-08-02
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -74,6 +74,12 @@ public class ProdProcedureTeam extends Model<ProdProcedureTeam> {
     @TableField("plan_procedure_id")
     private Integer planProcedureId;
 
+    /**
+     * 员工执行状态:0-待接收,1-进行中,2-已完工,3-已中止(员工自己中止或者管理端中止)
+     */
+    @TableField("status")
+    private Integer status;
+
 
     @Override
     protected Serializable pkVal() {

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

@@ -125,6 +125,8 @@ public class Report extends Model<Report> {
     private Integer userProcedureTeamId;
 
 
+    @TableField(exist = false)
+    private Boolean isTerminated;
     @Override
     protected Serializable pkVal() {
         return this.id;

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

@@ -117,6 +117,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         LocalDate today = LocalDate.now();
         report.setCreateDate(today);
         report.setCompanyId(companyId);
+
         Plan plan = planMapper.selectById(report.getPlanId());
         if (plan.getPlanType() == 0) {
             //普通计划检查产品是否存在
@@ -133,17 +134,23 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         ProdProcedureTeam prodProcedureTeam = prodProcedureTeamMapper.selectById(report.getUserProcedureTeamId());
         double curReportTime = 0.0;
         //查找上一次该工序的报工
+        Integer currentProgress = 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 (lastReport != null) {
             if (report.getProgress() <= lastReport.getProgress()) {
-                httpRespMsg.setError("进度必须大于上次报工进度("+lastReport.getProgress()+"%)");
+                httpRespMsg.setError("进度必须大于上次报工进度("+currentProgress+"%)");
                 return httpRespMsg;
             }
-            curReportTime = (prodProcedureTeam.getWorkTime() * (report.getProgress() - lastReport.getProgress())/100);
+            currentProgress = report.getProgress();
         } else {
-            curReportTime = (prodProcedureTeam.getWorkTime() * report.getProgress()/100);
+            if (report.getProgress() <= currentProgress) {
+                httpRespMsg.setError("进度必须大于上次报工进度("+currentProgress+"%)");
+                return httpRespMsg;
+            }
+            currentProgress = prodProcedureTeam.getProgress();
         }
-
+        curReportTime = (prodProcedureTeam.getWorkTime() * (report.getProgress() - currentProgress)/100);
         report.setWorkingTime(curReportTime);//本次报工的工时数
         report.setDeptId(plan.getStationId());
         if (plan.getPlanType() == 0) {
@@ -159,6 +166,13 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         }
         prodProcedureTeam.setUpdateTime(LocalDateTime.now());
         prodProcedureTeam.setProgress(report.getProgress());
+        if (report.getProgress() == 100) {
+            //完工了
+            prodProcedureTeam.setStatus(2);//顺利完工
+        } else if (report.getIsTerminated() != null && report.getIsTerminated().booleanValue()) {
+            prodProcedureTeam.setStatus(3);//中止
+        }
+
         if (existReport == null) {
             reportMapper.insert(report);
         } else {

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

@@ -14,14 +14,14 @@
         <result column="checker_name" property="checkerName" />
         <result column="update_time" property="updateTime" />
         <result column="plan_procedure_id" property="planProcedureId" />
+        <result column="status" property="status" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, company_id, user_id, work_time, job_of_money, progress, checker_id, checker_name, update_time, plan_procedure_id
+        id, company_id, user_id, work_time, job_of_money, progress, checker_id, checker_name, update_time, plan_procedure_id, status
     </sql>
 
-
     <select id="getReportForWorkList" resultType="java.util.HashMap" >
         SELECT a.*, plan_procedure_total.plan_id, plan_procedure_total.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.check_type as plan_check_type
@@ -30,7 +30,7 @@
                  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 = plan_procedure_total.prod_procedure_id
-        where 1 = 1 and a.progress &lt; 100 and a.user_id=#{userId}
+        where 1 = 1 and a.status = 1 and a.user_id=#{userId}
         order by plan.id desc
     </select>
 
@@ -38,7 +38,7 @@
         SELECT a.*, plan_procedure_total.plan_id, plan_procedure_total.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, if(plan.plan_type=0,prod_procedure.check_type, plan.check_type) as check_type, plan.station_id
         FROM prod_procedure_team a
-            left join plan_procedure_total on plan_procedure_total.id = a.plan_procedure_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 = plan_procedure_total.prod_procedure_id

+ 9 - 1
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/workView/fillReport.vue

@@ -17,6 +17,13 @@
             <van-stepper v-model="reportForm.progress" step="10" :min="0" :max="100"/>
           </template>
         </van-cell>
+        <van-cell title="中止工作" v-if="reportForm.progress < 100">
+          <template>
+            <div style="float:right;">
+              <van-checkbox v-model="reportForm.isTerminated" />
+            </div>
+          </template>
+        </van-cell>
         <van-cell title="质检类型" :value="checkTypeTxt[reportForm.check_type]" v-if="reportForm.progress==100"/>
         <van-cell title="质检人" :value="reportForm.checker_name" is-link v-if="reportForm.progress==100" @click="showCheckerOptionList">
         </van-cell>
@@ -102,7 +109,8 @@ export default {
           prodProcedureId: this.reportForm.prod_procedure_id,
           progress: this.reportForm.progress,
           planId: this.reportForm.plan_id,
-          checkType: this.reportForm.check_type
+          checkType: this.reportForm.check_type,
+          isTerminated: this.reportForm.isTerminated
         };
         if (this.reportForm.progress == 100) {
           if (this.reportForm.check_type != 0) {

+ 2 - 2
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/workView/workView.vue

@@ -13,8 +13,8 @@
           <div class="distribution_box" v-for="item,index in prod.procedureList" :key="index" @click="reportItem(item)">
             <div>
               <van-row >
-                <van-col span="20">{{ prod.plan_type == 0?item.procedure_name : prod.task_change_notice_num}}</van-col>
-                <van-col span="4"><span style="color:goldenrod;font-size:16px;">{{ item.work_time }}</span> <span style="font-size:12px;">分钟</span></van-col>
+                <van-col span="19">{{ prod.plan_type == 0?item.procedure_name : prod.task_change_notice_num}}</van-col>
+                <van-col span="5" style="text-align:right;"><span style="color:goldenrod;font-size:16px;">{{ item.work_time }}</span> <span style="font-size:12px;">分钟</span></van-col>
               </van-row>
               <div style="margin-top:10px;text-align: center;">
                 <van-row gutter="20" >