|
@@ -30,10 +30,14 @@ import com.factory.web.entity.pm.OnsiteItem;
|
|
|
import com.factory.web.entity.pm.OnsiteItemResult;
|
|
|
import com.factory.web.entity.pm.OnsitePlanHisBlob;
|
|
|
import com.factory.web.entity.pm.OnsiteTask;
|
|
|
+import com.factory.web.entity.pm.OnsiteTaskHisBlob;
|
|
|
import com.factory.web.entity.pm.OnsiteTitleBlob;
|
|
|
import com.factory.web.entity.pm.OnsiteWorkshop;
|
|
|
+import com.factory.web.entity.pm.req.AddItemResultListReq;
|
|
|
import com.factory.web.entity.pm.req.AddItemResultReq;
|
|
|
import com.factory.web.entity.pm.req.AddPmPlanReq;
|
|
|
+import com.factory.web.entity.pm.req.EditItemResultListReq;
|
|
|
+import com.factory.web.entity.pm.req.EditItemResultReq;
|
|
|
import com.factory.web.entity.pm.req.EditPmPlanReq;
|
|
|
import com.factory.web.entity.pm.req.OnsiteCalendarReq;
|
|
|
import com.factory.web.entity.pm.req.OnsiteItemReq;
|
|
@@ -41,17 +45,22 @@ import com.factory.web.entity.pm.req.OnsiteWorkshopReq;
|
|
|
import com.factory.web.entity.pm.req.PmPlanPauseFlagReq;
|
|
|
import com.factory.web.entity.pm.req.SearchApprovalUserReq;
|
|
|
import com.factory.web.entity.pm.req.SearchPmItemResultListReq;
|
|
|
+import com.factory.web.entity.pm.req.SearchPmPlanCheckListReq;
|
|
|
import com.factory.web.entity.pm.req.SearchPmPlanListForPadReq;
|
|
|
import com.factory.web.entity.pm.req.SearchPmPlanListReq;
|
|
|
import com.factory.web.entity.pm.req.SearchPmPlanReq;
|
|
|
import com.factory.web.entity.pm.req.SearchTaskReq;
|
|
|
import com.factory.web.entity.pm.req.SearchWorkshopReq;
|
|
|
import com.factory.web.entity.pm.res.ApprovalUserRes;
|
|
|
+import com.factory.web.entity.pm.res.PmCheckListRes;
|
|
|
+import com.factory.web.entity.pm.res.PmItemNoGoListRes;
|
|
|
import com.factory.web.entity.pm.res.PmItemResultListRes;
|
|
|
import com.factory.web.entity.pm.res.PmPlanListForPadRes;
|
|
|
import com.factory.web.entity.pm.res.PmPlanListRes;
|
|
|
import com.factory.web.entity.pm.res.PmPlanRes;
|
|
|
import com.factory.web.entity.pm.res.PmTaskListRes;
|
|
|
+import com.factory.web.entity.pm.res.PmTaskRes;
|
|
|
+import com.factory.web.entity.pm.res.PmWorkshopNoGoListRes;
|
|
|
import com.factory.web.mapper.pm.PreventMistakeMapper;
|
|
|
import com.factory.web.service.BentelerPlanService;
|
|
|
import com.factory.web.service.pm.OnsiteApprovalPlanService;
|
|
@@ -60,6 +69,7 @@ import com.factory.web.service.pm.OnsiteCalendarService;
|
|
|
import com.factory.web.service.pm.OnsiteItemResultService;
|
|
|
import com.factory.web.service.pm.OnsiteItemService;
|
|
|
import com.factory.web.service.pm.OnsitePlanHisBlobService;
|
|
|
+import com.factory.web.service.pm.OnsiteTaskHisBlobService;
|
|
|
import com.factory.web.service.pm.OnsiteTaskService;
|
|
|
import com.factory.web.service.pm.OnsiteTitleBlobService;
|
|
|
import com.factory.web.service.pm.OnsiteWorkshopService;
|
|
@@ -108,6 +118,9 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
|
|
|
|
|
|
@Autowired
|
|
|
private OnsitePlanHisBlobService onsitePlanHisBlobService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private OnsiteTaskHisBlobService onsiteTaskHisBlobService;
|
|
|
|
|
|
/**
|
|
|
* 新建防错计划
|
|
@@ -231,6 +244,17 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 取得防错计划点检列表
|
|
|
+ * @param req
|
|
|
+ * @return 防错计划点检列表
|
|
|
+ */
|
|
|
+ public ResponseBean<PageBean<PmPlanListRes>> getPmPlanCheckList(SearchPmPlanCheckListReq req) {
|
|
|
+ Page<PmPlanListRes> page = new Page<>(req.getPage(), req.getSize());
|
|
|
+ Page<PmPlanListRes> listResPage = preventMistakeMapper.getPmPlanCheckList(page, req);
|
|
|
+ return ResponseBeanBuilder.ok(listResPage, Function.identity());
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 取得防错计划列表
|
|
@@ -243,38 +267,38 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
|
|
|
Page<PmPlanListRes> page = new Page<>(req.getPage(), req.getSize());
|
|
|
Page<PmPlanListRes> listResPage = preventMistakeMapper.getPmPlanList(page, req);
|
|
|
|
|
|
- // TODO 测一下status值是都设置成功
|
|
|
- SearchPmPlanReq searchPmPlanReq = null;
|
|
|
- for (PmPlanListRes pmPlan : listResPage.getRecords()) {
|
|
|
- searchPmPlanReq = new SearchPmPlanReq();
|
|
|
- searchPmPlanReq.setBentelerPlanId(pmPlan.getBentelerPlanId());
|
|
|
- List<PmTaskListRes> listRes = this.getTaskList(searchPmPlanReq);
|
|
|
- int planStatus = 0; // 计划今天的状态,0未完成 1已完成 2待重检
|
|
|
- int count0 = 0; // 任务的task.getStatus=0初始化
|
|
|
- int count1 = 0; // 任务的task.getStatus=1待审核状态
|
|
|
- int count2 = 0; // 任务的task.getStatus=2放行
|
|
|
- int count3 = 0; // 任务的task.getStatus=3不放行
|
|
|
- for (PmTaskListRes task : listRes) {
|
|
|
- if (task.getStatus() == 0) {
|
|
|
- count0++;
|
|
|
- } else if (task.getStatus() == 1) {
|
|
|
- count1++;
|
|
|
- } else if (task.getStatus() == 2) {
|
|
|
- count2++;
|
|
|
- } else if (task.getStatus() == 3) {
|
|
|
- count3++;
|
|
|
- }
|
|
|
- }
|
|
|
- if (count0 > 0 || count1 > 0) {
|
|
|
- planStatus = 0; // 存在未完成的任务,计划状态0未完成
|
|
|
- } else if (count2 == listRes.size()) {
|
|
|
- planStatus = 1; // 所有任务都检查完毕,都放行,计划状态1已完成
|
|
|
- } else if (count3 > 0) {
|
|
|
- planStatus = 2; // 所有任务都检查完毕,存在不放行记录,计划状态2待重检
|
|
|
- }
|
|
|
-
|
|
|
- pmPlan.setPlanStatus(planStatus);
|
|
|
- }
|
|
|
+// // TODO 测一下status值是都设置成功
|
|
|
+// SearchPmPlanReq searchPmPlanReq = null;
|
|
|
+// for (PmPlanListRes pmPlan : listResPage.getRecords()) {
|
|
|
+// searchPmPlanReq = new SearchPmPlanReq();
|
|
|
+// searchPmPlanReq.setBentelerPlanId(pmPlan.getBentelerPlanId());
|
|
|
+// List<PmTaskListRes> listRes = this.getTaskList(searchPmPlanReq);
|
|
|
+// int planStatus = 0; // 计划今天的状态,0未完成 1已完成 2待重检
|
|
|
+// int count0 = 0; // 任务的task.getStatus=0初始化
|
|
|
+// int count1 = 0; // 任务的task.getStatus=1待审核状态
|
|
|
+// int count2 = 0; // 任务的task.getStatus=2放行
|
|
|
+// int count3 = 0; // 任务的task.getStatus=3不放行
|
|
|
+// for (PmTaskListRes task : listRes) {
|
|
|
+// if (task.getStatus() == 0) {
|
|
|
+// count0++;
|
|
|
+// } else if (task.getStatus() == 1) {
|
|
|
+// count1++;
|
|
|
+// } else if (task.getStatus() == 2) {
|
|
|
+// count2++;
|
|
|
+// } else if (task.getStatus() == 3) {
|
|
|
+// count3++;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (count0 > 0 || count1 > 0) {
|
|
|
+// planStatus = 0; // 存在未完成的任务,计划状态0未完成
|
|
|
+// } else if (count2 == listRes.size()) {
|
|
|
+// planStatus = 1; // 所有任务都检查完毕,都放行,计划状态1已完成
|
|
|
+// } else if (count3 > 0) {
|
|
|
+// planStatus = 2; // 所有任务都检查完毕,存在不放行记录,计划状态2待重检
|
|
|
+// }
|
|
|
+//
|
|
|
+// pmPlan.setPlanStatus(planStatus);
|
|
|
+// }
|
|
|
|
|
|
return ResponseBeanBuilder.ok(listResPage, Function.identity());
|
|
|
}
|
|
@@ -366,19 +390,25 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
|
|
|
return ResponseBeanBuilder.fail("计划名称已存在");
|
|
|
}
|
|
|
|
|
|
- /* 将之前的plan所有信息和审批记录记到his中 */
|
|
|
- SearchPmPlanReq searchPmPlanReq = new SearchPmPlanReq();
|
|
|
- searchPmPlanReq.setBentelerPlanId(req.getBentelerPlanId());
|
|
|
- PmPlanRes pmPlanRes = this.getPmPlan(searchPmPlanReq);
|
|
|
- try {
|
|
|
- OnsitePlanHisBlob onsitePlanHisBlob = OnsitePlanHisBlob.builder()
|
|
|
- .bentelerPlanId(req.getBentelerPlanId())
|
|
|
- .hisContent(this.objectToByteArray(pmPlanRes))
|
|
|
- .build();
|
|
|
- onsitePlanHisBlobService.save(onsitePlanHisBlob);
|
|
|
- } catch (Exception e) {
|
|
|
- // TODO Auto-generated catch block
|
|
|
- e.printStackTrace();
|
|
|
+ /* 将之前的plan所有信息记到his中(暂时没记审批信息) */
|
|
|
+ int count = onsiteApprovalPlanService.count(
|
|
|
+ Wrappers.<OnsiteApprovalPlan> lambdaQuery()
|
|
|
+ .eq(OnsiteApprovalPlan::getBentelerPlanId, req.getBentelerPlanId())
|
|
|
+ .eq(OnsiteApprovalPlan::getStatus, 2));
|
|
|
+ if (count > 0) { // 当前审批状态为驳回
|
|
|
+ SearchPmPlanReq searchPmPlanReq = new SearchPmPlanReq();
|
|
|
+ searchPmPlanReq.setBentelerPlanId(req.getBentelerPlanId());
|
|
|
+ PmPlanRes pmPlanRes = this.getPmPlan(searchPmPlanReq);
|
|
|
+ try {
|
|
|
+ OnsitePlanHisBlob onsitePlanHisBlob = OnsitePlanHisBlob.builder()
|
|
|
+ .bentelerPlanId(req.getBentelerPlanId())
|
|
|
+ .hisContent(this.objectToByteArray(pmPlanRes))
|
|
|
+ .build();
|
|
|
+ onsitePlanHisBlobService.save(onsitePlanHisBlob);
|
|
|
+ } catch (Exception e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/* 修改放错计划 */
|
|
@@ -488,9 +518,9 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 取得每频次检查信息
|
|
|
+ * 取得巡检规则信息
|
|
|
* @param req
|
|
|
- * @return 每频次检查信息
|
|
|
+ * @return 巡检规则信息
|
|
|
*/
|
|
|
@Override
|
|
|
public ResponseBean<List<OnsiteCalendar>> getCalendarList(SearchPmPlanReq req) {
|
|
@@ -563,13 +593,17 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public ResponseBean addItemResult(AddItemResultReq req) {
|
|
|
- OnsiteItemResult onsiteItemResult = OnsiteItemResult.builder()
|
|
|
- .onsiteTaskId(req.getOnsiteTaskId())
|
|
|
- .onsiteItemId(req.getOnsiteItemId())
|
|
|
- .result(req.getResult())
|
|
|
- .build();
|
|
|
- onsiteItemResultService.save(onsiteItemResult);
|
|
|
+ public ResponseBean addItemResult(AddItemResultListReq req) {
|
|
|
+ List<AddItemResultReq> addItemResultList = req.getAddItemResultList();
|
|
|
+ for (AddItemResultReq addItemResult : addItemResultList) {
|
|
|
+ OnsiteItemResult onsiteItemResult = OnsiteItemResult.builder()
|
|
|
+ .onsiteTaskId(req.getOnsiteTaskId())
|
|
|
+ .onsiteItemId(addItemResult.getOnsiteItemId())
|
|
|
+ .result(addItemResult.getResult())
|
|
|
+ .build();
|
|
|
+ onsiteItemResultService.save(onsiteItemResult);
|
|
|
+ }
|
|
|
+
|
|
|
return ResponseBeanBuilder.ok();
|
|
|
}
|
|
|
|
|
@@ -647,6 +681,89 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
|
|
|
return approvalUserRes;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 取得每频次点检信息
|
|
|
+ *
|
|
|
+ * @param req
|
|
|
+ * @return 每频次点检信息
|
|
|
+ */
|
|
|
+ public ResponseBean<List<PmCheckListRes>> getPmCheckList(SearchPmPlanReq req) {
|
|
|
+ List<PmCheckListRes> pmCheckList = preventMistakeMapper.getPmCheckList(req);
|
|
|
+ return ResponseBeanBuilder.ok(pmCheckList, Function.identity());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 取得不放行任务对应的工作站
|
|
|
+ *
|
|
|
+ * @param req
|
|
|
+ * @return 不放行任务对应的工作站
|
|
|
+ */
|
|
|
+ public ResponseBean<List<PmWorkshopNoGoListRes>> getPmWorkshopNoGoList(SearchPmPlanReq req) {
|
|
|
+ List<PmWorkshopNoGoListRes> pmWorkshopNoGoList = preventMistakeMapper.getPmWorkshopNoGoList(req);
|
|
|
+ return ResponseBeanBuilder.ok(pmWorkshopNoGoList, Function.identity());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 取得不放行任务对应的点检项目
|
|
|
+ *
|
|
|
+ * @param req
|
|
|
+ * @return 不放行任务对应的点检项目
|
|
|
+ */
|
|
|
+ public ResponseBean<List<PmItemNoGoListRes>> getPmItemNoGoList(SearchWorkshopReq req) {
|
|
|
+ List<PmItemNoGoListRes> pmItemNoGoList = preventMistakeMapper.getPmItemNoGoList(req);
|
|
|
+ return ResponseBeanBuilder.ok(pmItemNoGoList, Function.identity());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改巡检项目检查结果(这里只有重检走这里)
|
|
|
+ *
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public ResponseBean editItemResult(EditItemResultListReq req) {
|
|
|
+ /* 任务和巡检结果记录历史 */
|
|
|
+ PmTaskRes pmTaskRes = new PmTaskRes();
|
|
|
+ OnsiteTask onsiteTask = onsiteTaskService.getById(req.getOnsiteTaskId());
|
|
|
+ pmTaskRes.setOnsiteTaskId(onsiteTask.getId());
|
|
|
+ pmTaskRes.setOnsiteCalendarId(onsiteTask.getOnsiteCalendarId());
|
|
|
+ pmTaskRes.setStatus(onsiteTask.getStatus());
|
|
|
+ pmTaskRes.setTaskTime(onsiteTask.getTaskTime());
|
|
|
+ pmTaskRes.setRemindTaskFlag(onsiteTask.getRemindTaskFlag());
|
|
|
+ pmTaskRes.setRemindNoworkFalg(onsiteTask.getRemindNoworkFalg());
|
|
|
+ List<OnsiteItemResult> onsiteItemResultList = onsiteItemResultService.list(Wrappers.<OnsiteItemResult>lambdaQuery()
|
|
|
+ .eq(OnsiteItemResult::getOnsiteTaskId, req.getOnsiteTaskId()));
|
|
|
+ pmTaskRes.setOnsiteItemResultList(onsiteItemResultList);
|
|
|
+
|
|
|
+ try {
|
|
|
+ OnsiteTaskHisBlob onsiteTaskHisBlob = OnsiteTaskHisBlob.builder()
|
|
|
+ .onsiteTaskId(req.getOnsiteTaskId())
|
|
|
+ .hisContent(this.objectToByteArray(pmTaskRes))
|
|
|
+ .build();
|
|
|
+ onsiteTaskHisBlobService.save(onsiteTaskHisBlob);
|
|
|
+ } catch (Exception e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 更新巡检项目检查结果 */
|
|
|
+ List<EditItemResultReq> editItemResultList = req.getEditItemResultList();
|
|
|
+ for (EditItemResultReq editItemResult : editItemResultList) {
|
|
|
+ onsiteItemResultService.remove(Wrappers.<OnsiteItemResult>lambdaQuery()
|
|
|
+ .eq(OnsiteItemResult::getOnsiteTaskId, req.getOnsiteTaskId())
|
|
|
+ .eq(OnsiteItemResult::getOnsiteItemId, editItemResult.getOnsiteItemId()));
|
|
|
+
|
|
|
+ OnsiteItemResult onsiteItemResult = OnsiteItemResult.builder()
|
|
|
+ .onsiteTaskId(req.getOnsiteTaskId())
|
|
|
+ .onsiteItemId(editItemResult.getOnsiteItemId())
|
|
|
+ .result(editItemResult.getResult())
|
|
|
+ .build();
|
|
|
+ onsiteItemResultService.save(onsiteItemResult);
|
|
|
+ }
|
|
|
+
|
|
|
+ return ResponseBeanBuilder.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* Object转成byte[]
|
|
|
* @param obj
|