فهرست منبع

报工时自己之前选择的钢印号不要默认选中

seyason 1 سال پیش
والد
کامیت
9aec0e7bdd

+ 8 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/ReportController.java

@@ -143,6 +143,14 @@ public class ReportController {
         msg.data = reportService.getById(id);
         return msg;
     }
+
+    @RequestMapping("/fixSteelNumData")
+    public HttpRespMsg fixSteelNumData() {
+        HttpRespMsg msg = new HttpRespMsg();
+        //修复report表中钢印号存在重复问题
+        msg.data = reportService.fixSteelNumData();
+        return msg;
+    }
 //
 //    @RequestMapping("/getCardTime")
 //    public HttpRespMsg getCardTime(@RequestParam String date) {

+ 2 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/ReportService.java

@@ -146,4 +146,6 @@ public interface ReportService extends IService<Report> {
     HttpRespMsg productionQuantityList(Integer productId, String startDate, String endDate,Integer pageIndex, Integer pageSize);
 
     HttpRespMsg exportProductionQuantity(Integer productId, String startDate, String endDate);
+
+    Object fixSteelNumData();
 }

+ 3 - 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));
         if (oldReport != null) {
@@ -185,6 +186,8 @@ public class PlanProcedureTotalServiceImpl extends ServiceImpl<PlanProcedureTota
             List<Report> reportList = reportMapper.selectList(
                     new QueryWrapper<Report>().select("id", "steel_num_array","create_date", "creator_id")
                             .eq("plan_id", planId).eq("prod_procedure_id", (Integer)prodProcedureTeam.get("prod_procedure_id")));
+
+            //自己以前填过的钢印号
             List<String> filledSteelNumList=new ArrayList<>();
 
             for (Report report : reportList) {

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

@@ -4880,4 +4880,60 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         return msg;
     }
 
+    @Override
+    public Object fixSteelNumData() {
+        List<Report> reportList = reportMapper.selectList(new QueryWrapper<Report>());
+        int dealCount = 0;
+        for (int t=0;t<reportList.size(); t++) {
+            Report report = reportList.get(t);
+            String creatorId = report.getCreatorId();
+            LocalDate date = report.getCreateDate();
+            Integer userProcedureTeamId = report.getUserProcedureTeamId();
+            String steelNum = report.getSteelNumArray();
+            List<String> reportSteelNumArray1 = JSONArray.parseArray(steelNum, String.class);
+            if (!StringUtils.isEmpty(steelNum)) {
+                //检查该钢印号在其他的日报中当前员工是否也有填报的
+                for (int i=t+1;i<reportList.size(); i++) {
+                    Report iReport = reportList.get(i);
+                    if (iReport.getCreatorId().equals(creatorId) && iReport.getUserProcedureTeamId().equals(userProcedureTeamId) && !iReport.getCreateDate().isEqual(date)) {
+                        String steelNumArray = iReport.getSteelNumArray();
+                        if (!StringUtils.isEmpty(steelNumArray)) {
+                            List<String> reportSteelNumArray2 = JSONArray.parseArray(steelNumArray, String.class);
+                            JSONArray updateSteelNum = new JSONArray();
+                            boolean hasChange = false;
+                            for (int m=0;m<reportSteelNumArray2.size(); m++) {
+                                String s = reportSteelNumArray2.get(m);
+                                //之前已经报过了该钢印号
+                                if (reportSteelNumArray1.contains(s)) {
+                                    hasChange = true;
+                                } else {
+                                    updateSteelNum.add(s);
+                                }
+                            }
+                            if (hasChange) {
+                                //日报中的钢印号需要修正
+                                Report updateR = new Report();
+                                updateR.setId(iReport.getId());
+                                updateR.setSteelNumArray(updateSteelNum.toString());
+                                dealCount++;
+                                System.out.println("检测:"+steelNum+", 更新日报: id="+iReport.getId()+", 原始 steelArrayNum==" + steelNumArray + " ,更新为: "+updateSteelNum.toString());
+                                reportMapper.updateById(updateR);
+                                reportSteelNumMapper.delete(new QueryWrapper<ReportSteelNum>().eq("report_id", iReport.getId()));
+                                for (int q=0;q<updateSteelNum.size(); q++) {
+                                    ReportSteelNum num = new ReportSteelNum();
+                                    num.setReportId(updateR.getId());
+                                    num.setSteelNum(updateSteelNum.getString(q));
+                                    reportSteelNumMapper.insert(num);
+                                }
+                            }
+                        }
+
+                    }
+                }
+            }
+        }
+        System.out.println("共更新:"+dealCount);
+        return dealCount;
+    }
+
 }

+ 1 - 1
fhKeeper/formulahousekeeper/management-workshop/src/main/resources/application.yml

@@ -127,7 +127,7 @@ referer:
     - mobdevworkshop.ttkuaiban.com
     - devworkshop.ttkuaiban.com
     - 47.101.180.183
-excludeUrls: /wxcorp/*,/wxcorp/*/*,/dingding/*,/feishu-info/*,/error,/testClient,/corpWXAuth,/corpWXScanningAuth,/corpInsideWXAuth,/wx-corp-info/*,/clean/*,/innerRoles/*,/report/getReportListByToken,/report/getProcessErrorData,/project/synchronizationProject,/user/updateUserDeptHierarchy
+excludeUrls: /wxcorp/*,/wxcorp/*/*,/dingding/*,/feishu-info/*,/error,/testClient,/corpWXAuth,/corpWXScanningAuth,/corpInsideWXAuth,/wx-corp-info/*,/clean/*,/innerRoles/*,/report/getReportListByToken,/report/getProcessErrorData,/project/synchronizationProject,/user/updateUserDeptHierarchy,/report/fixSteelNumData
 
 #企业微信相关参数
 suitId: ww4e237fd6abb635af

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

@@ -209,7 +209,8 @@ export default {
           if (res.code == "ok") {
             this.reportForm = res.data;
             this.oldPlanSteelStampNumberList=this.reportForm.planSteelStampNumberList
-            this.reportForm.checkedSteelNum = JSON.parse(this.reportForm.steel_num_array);
+            //当日选中的钢印号,默认勾选上
+            this.reportForm.checkedSteelNum = this.reportForm.steelNumArray;
             if (this.reportForm.check_type == 0) {
               //自检
               this.reportForm.checker_name = this.user.name;