Browse Source

首件-接口

wuzhenyue 3 years ago
parent
commit
9d9ab83751
15 changed files with 273 additions and 28 deletions
  1. 1 1
      application-facade/src/main/java/com/factory/controller/web/PreventMistakeController.java
  2. 5 0
      application-facade/src/main/java/com/factory/web/entity/fa/FirstArticleWorkshop.java
  3. 10 4
      application-facade/src/main/java/com/factory/web/entity/fa/req/SearchFaAllCheckFlagReq.java
  4. 32 0
      application-facade/src/main/java/com/factory/web/entity/fa/req/SearchFaItemResultCountReq.java
  5. 6 0
      application-facade/src/main/java/com/factory/web/entity/fa/req/SearchFaWorkshopListForPadReq.java
  6. 32 0
      application-facade/src/main/java/com/factory/web/entity/fa/req/SearchFaWsItemResultCountReq.java
  7. 5 0
      application-facade/src/main/java/com/factory/web/entity/pm/OnsiteWorkshop.java
  8. 32 0
      application-facade/src/main/java/com/factory/web/entity/pm/req/SearchPmWsAllCheckFlagReq.java
  9. 18 2
      application-facade/src/main/java/com/factory/web/mapper/fa/FirstArticleMapper.java
  10. 16 1
      application-facade/src/main/java/com/factory/web/mapper/pm/PreventMistakeMapper.java
  11. 63 18
      application-facade/src/main/java/com/factory/web/service/impl/fa/FirstArticleServiceImpl.java
  12. 18 1
      application-facade/src/main/java/com/factory/web/service/impl/pm/PreventMistakeServiceImpl.java
  13. 1 1
      application-facade/src/main/java/com/factory/web/service/pm/PreventMistakeService.java
  14. 17 0
      application-facade/src/main/resources/mapper/FirstArticleMapper.xml
  15. 17 0
      application-facade/src/main/resources/mapper/PreventMistakeMapper.xml

+ 1 - 1
application-facade/src/main/java/com/factory/controller/web/PreventMistakeController.java

@@ -161,7 +161,7 @@ public class PreventMistakeController {
 	@ApiOperation(value = "通过计划ID取得工作站列表")
 	@ApiOperationSupport(order = 14)
 	@PostMapping("/getWorkshopList")
-	public ResponseBean<List<OnsiteWorkshop>> getWorkshopList(@RequestBody SearchPmPlanReq req) {
+	public ResponseBean<List<OnsiteWorkshop>> getWorkshopList(@RequestBody SearchPmAllCheckFlagReq req) {
 		return preventMistakeService.getWorkshopList(req);
 	}
 

+ 5 - 0
application-facade/src/main/java/com/factory/web/entity/fa/FirstArticleWorkshop.java

@@ -43,4 +43,9 @@ public class FirstArticleWorkshop implements Serializable {
 	@TableField(exist = false)
 	@ApiModelProperty(value = "日周月点检规则")
     private List<FirstArticleItem> firstArticleItemList; // 用于页面返回值
+	
+	@TableField(exist = false)
+	@ApiModelProperty(value = "0没完成 1全部完成")
+	private Integer allCheckFlag;
+	
 }

+ 10 - 4
application-facade/src/main/java/com/factory/web/entity/fa/req/SearchFaAllCheckFlagReq.java

@@ -22,11 +22,17 @@ import lombok.NoArgsConstructor;
 @JsonInclude()
 @ApiModel("")
 public class SearchFaAllCheckFlagReq {
-	
-	@ApiModelProperty(value = "计划Id")
+
+	@ApiModelProperty(value = "计划id")
 	private Long bentelerPlanId;
 	
-	@ApiModelProperty(value = "任务id")
-	private Long firstArticleTaskId;
+	@ApiModelProperty(value = "0表示首件 1表示200件 2表示中断")
+	private Integer typeFlag;
+	
+	@ApiModelProperty(value = "点检人对应的用户ID")
+	private Long userId;
+
+//	@ApiModelProperty(value = "工作站Id")
+//	private Long workshopId;
 	
 }

+ 32 - 0
application-facade/src/main/java/com/factory/web/entity/fa/req/SearchFaItemResultCountReq.java

@@ -0,0 +1,32 @@
+package com.factory.web.entity.fa.req;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 取得不放行任务对应的工作站
+ *
+ * @author wzy
+ * @date 2021-07-09 12:00:00
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+@JsonInclude()
+@ApiModel("")
+public class SearchFaItemResultCountReq {
+	
+	@ApiModelProperty(value = "计划Id")
+	private Long bentelerPlanId;
+	
+	@ApiModelProperty(value = "任务id")
+	private Long firstArticleTaskId;
+	
+}

+ 6 - 0
application-facade/src/main/java/com/factory/web/entity/fa/req/SearchFaWorkshopListForPadReq.java

@@ -28,4 +28,10 @@ public class SearchFaWorkshopListForPadReq {
 	
 	@ApiModelProperty(value = "0表示首件 1表示200件 2表示中断")
 	private Integer typeFlag;
+	
+	@ApiModelProperty(value = "点检人对应的用户ID")
+	private Long userId;
+
+//	@ApiModelProperty(value = "工作站Id")
+//	private Long workshopId;
 }

+ 32 - 0
application-facade/src/main/java/com/factory/web/entity/fa/req/SearchFaWsItemResultCountReq.java

@@ -0,0 +1,32 @@
+package com.factory.web.entity.fa.req;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 取得不放行任务对应的工作站
+ *
+ * @author wzy
+ * @date 2021-07-09 12:00:00
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+@JsonInclude()
+@ApiModel("")
+public class SearchFaWsItemResultCountReq {
+	
+	@ApiModelProperty(value = "工作站id")
+	private Long workshopId;
+	
+	@ApiModelProperty(value = "任务id")
+	private Long firstArticleTaskId;
+	
+}

+ 5 - 0
application-facade/src/main/java/com/factory/web/entity/pm/OnsiteWorkshop.java

@@ -41,4 +41,9 @@ public class OnsiteWorkshop implements Serializable {
 	@TableField(exist = false)
 	@ApiModelProperty(value = "日周月点检规则")
     private List<OnsiteItem> onsiteItemList; // 用于页面返回值
+	
+	@TableField(exist = false)
+	@ApiModelProperty(value = "0没完成 1全部完成")
+	private Integer allCheckFlag;
+	
 }

+ 32 - 0
application-facade/src/main/java/com/factory/web/entity/pm/req/SearchPmWsAllCheckFlagReq.java

@@ -0,0 +1,32 @@
+package com.factory.web.entity.pm.req;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 取得不放行任务对应的工作站
+ *
+ * @author wzy
+ * @date 2021-07-09 12:00:00
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+@JsonInclude()
+@ApiModel("")
+public class SearchPmWsAllCheckFlagReq {
+	
+	@ApiModelProperty(value = "工作站id")
+	private Long workshopId;
+	
+	@ApiModelProperty(value = "任务id")
+	private Long onsiteTaskId;
+	
+}

+ 18 - 2
application-facade/src/main/java/com/factory/web/mapper/fa/FirstArticleMapper.java

@@ -11,9 +11,9 @@ import com.factory.base.entity.po.benteler.BentelerPlan;
 import com.factory.web.entity.fa.FirstArticleItemResult;
 import com.factory.web.entity.fa.FirstArticleTask;
 import com.factory.web.entity.fa.FirstArticleWorkshop;
-import com.factory.web.entity.fa.req.SearchFaAllCheckFlagReq;
 import com.factory.web.entity.fa.req.SearchFaItemListForPadReq;
 import com.factory.web.entity.fa.req.SearchFaItemNoGoListReq;
+import com.factory.web.entity.fa.req.SearchFaItemResultCountReq;
 import com.factory.web.entity.fa.req.SearchFaItemResultListReq;
 import com.factory.web.entity.fa.req.SearchFaPlanCheckListReq;
 import com.factory.web.entity.fa.req.SearchFaPlanListForPadReq;
@@ -22,6 +22,7 @@ import com.factory.web.entity.fa.req.SearchFaTaskInfoReq;
 import com.factory.web.entity.fa.req.SearchFaTaskReq;
 import com.factory.web.entity.fa.req.SearchFaWorkshopListForPadReq;
 import com.factory.web.entity.fa.req.SearchFaWorkshopNoGoListReq;
+import com.factory.web.entity.fa.req.SearchFaWsItemResultCountReq;
 import com.factory.web.entity.fa.res.FaItemListForPadRes;
 import com.factory.web.entity.fa.res.FaItemNoGoListRes;
 import com.factory.web.entity.fa.res.FaNoGoTaskAapprovalRes;
@@ -121,5 +122,20 @@ public interface FirstArticleMapper extends BaseMapper<BentelerPlan> {
      * @param req
      * @return 计划下当前task的点检结果数
      */
-    public int getFaItemResultCount(@Param("req") SearchFaAllCheckFlagReq req);
+    public int getFaItemResultCount(@Param("req") SearchFaItemResultCountReq req);
+    
+    /**
+     * 取得工作站下的点检项目数
+     * @param req
+     * @return 工作站下的点检项目数
+     */
+    public int getFaWsItemCount(@Param("req") SearchFaWsItemResultCountReq req);
+    
+    /**
+     * 取得工作站下当前task的点检结果数
+     * @param req
+     * @return 工作站下当前task的点检结果数
+     */
+    public int getFaWsItemResultCount(@Param("req") SearchFaWsItemResultCountReq req);
+    
 }

+ 16 - 1
application-facade/src/main/java/com/factory/web/mapper/pm/PreventMistakeMapper.java

@@ -11,13 +11,14 @@ import com.factory.base.entity.po.benteler.BentelerPlan;
 import com.factory.web.entity.pm.OnsiteApprovalPlan;
 import com.factory.web.entity.pm.req.SearchApprovalUserReq;
 import com.factory.web.entity.pm.req.SearchCheckRecordReq;
-import com.factory.web.entity.pm.req.SearchPmItemNoGoListReq;
 import com.factory.web.entity.pm.req.SearchPmAllCheckFlagReq;
+import com.factory.web.entity.pm.req.SearchPmItemNoGoListReq;
 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.SearchPmWorkshopNoGoListReq;
+import com.factory.web.entity.pm.req.SearchPmWsAllCheckFlagReq;
 import com.factory.web.entity.pm.req.SearchTaskReq;
 import com.factory.web.entity.pm.res.ApprovalUserRes;
 import com.factory.web.entity.pm.res.PmCheckListRes;
@@ -139,4 +140,18 @@ public interface PreventMistakeMapper extends BaseMapper<BentelerPlan> {
      * @return 计划下当前task的点检结果数
      */
     public int getPmItemResultCount(@Param("req") SearchPmAllCheckFlagReq req);
+    
+    /**
+     * 取得工作站下的点检项目数
+     * @param req
+     * @return 工作站下的点检项目数
+     */
+    public int getPmWsItemCount(@Param("req") SearchPmWsAllCheckFlagReq req);
+    
+    /**
+     * 取得工作站下当前task的点检结果数
+     * @param req
+     * @return 工作站下当前task的点检结果数
+     */
+    public int getPmWsItemResultCount(@Param("req") SearchPmWsAllCheckFlagReq req);
 }

+ 63 - 18
application-facade/src/main/java/com/factory/web/service/impl/fa/FirstArticleServiceImpl.java

@@ -46,6 +46,7 @@ import com.factory.web.entity.fa.req.SearchFaAllCheckFlagReq;
 import com.factory.web.entity.fa.req.SearchFaCheckRecordListReq;
 import com.factory.web.entity.fa.req.SearchFaItemListForPadReq;
 import com.factory.web.entity.fa.req.SearchFaItemNoGoListReq;
+import com.factory.web.entity.fa.req.SearchFaItemResultCountReq;
 import com.factory.web.entity.fa.req.SearchFaItemResultListReq;
 import com.factory.web.entity.fa.req.SearchFaPlanCheckListReq;
 import com.factory.web.entity.fa.req.SearchFaPlanListForPadReq;
@@ -54,6 +55,7 @@ import com.factory.web.entity.fa.req.SearchFaTaskInfoReq;
 import com.factory.web.entity.fa.req.SearchFaTaskReq;
 import com.factory.web.entity.fa.req.SearchFaWorkshopListForPadReq;
 import com.factory.web.entity.fa.req.SearchFaWorkshopNoGoListReq;
+import com.factory.web.entity.fa.req.SearchFaWsItemResultCountReq;
 import com.factory.web.entity.fa.req.SubmitFaTaskReq;
 import com.factory.web.entity.fa.res.FaAllCheckFlagRes;
 import com.factory.web.entity.fa.res.FaCheckRecordListRes;
@@ -66,10 +68,7 @@ import com.factory.web.entity.fa.res.FaPlanRes;
 import com.factory.web.entity.fa.res.FaTaskRes;
 import com.factory.web.entity.fa.res.FaWorkshopNoGoListRes;
 import com.factory.web.entity.pm.OnsiteApprovalPlan;
-import com.factory.web.entity.pm.req.SearchPmAllCheckFlagReq;
-import com.factory.web.entity.pm.req.SearchPmPlanReq;
 import com.factory.web.entity.pm.res.ApprovalUserRes;
-import com.factory.web.entity.pm.res.PmAllCheckFlagRes;
 import com.factory.web.mapper.fa.FirstArticleMapper;
 import com.factory.web.service.BentelerPlanService;
 import com.factory.web.service.fa.FirstArticleApprovalTaskService;
@@ -491,7 +490,42 @@ public class FirstArticleServiceImpl extends ServiceImpl<FirstArticleMapper, Ben
      */
     @Override
     public ResponseBean<List<FirstArticleWorkshop>> getFaWorkshopListForPad(SearchFaWorkshopListForPadReq req) {
+    	/* 取得task信息 */
+    	SearchFaTaskInfoReq searchFaTaskInfoReq = new SearchFaTaskInfoReq();
+    	searchFaTaskInfoReq.setBentelerPlanId(req.getBentelerPlanId());
+    	searchFaTaskInfoReq.setTypeFlag(req.getTypeFlag());
+    	
+    	FirstArticleTask faTaskInfo = null;
+    	if (req.getTypeFlag() == 0 || req.getTypeFlag() == 1) { // 0表示首件 1表示200件
+    		searchFaTaskInfoReq.setUserId(req.getUserId());
+    		faTaskInfo = this.getFaTaskInfo(searchFaTaskInfoReq);
+    	} else { // 2表示中断
+    		/* 取得中断最新的task */
+    		faTaskInfo = this.getFaTaskInfoCatchLatest(searchFaTaskInfoReq);
+    	}
+    	
+    	long firstArticleTaskId = 0;
+    	if (faTaskInfo != null) {
+    		firstArticleTaskId = faTaskInfo.getId();
+		}
+    	
     	List<FirstArticleWorkshop> listRes = firstArticleMapper.getFaWorkshopListForPad(req);
+    	
+    	SearchFaWsItemResultCountReq searchFaWsItemResultCountReq = null;
+    	for (FirstArticleWorkshop firstArticleWorkshop : listRes) {
+    		searchFaWsItemResultCountReq = new SearchFaWsItemResultCountReq();
+    		searchFaWsItemResultCountReq.setFirstArticleTaskId(firstArticleTaskId);
+    		searchFaWsItemResultCountReq.setWorkshopId(firstArticleWorkshop.getId());
+    		
+    		int itemCount = firstArticleMapper.getFaWsItemCount(searchFaWsItemResultCountReq);
+    		int itemResultCount = firstArticleMapper.getFaWsItemResultCount(searchFaWsItemResultCountReq);
+    		if (itemCount == itemResultCount) {
+    			firstArticleWorkshop.setAllCheckFlag(1);
+    		} else {
+    			firstArticleWorkshop.setAllCheckFlag(0);
+    		}
+    	}
+
 		return ResponseBeanBuilder.ok(listRes, Function.identity());
     }
     
@@ -517,19 +551,9 @@ public class FirstArticleServiceImpl extends ServiceImpl<FirstArticleMapper, Ben
     	}
     	
     	long firstArticleTaskId = 0;
-    	if (req.getTypeFlag() == 0 || req.getTypeFlag() == 1) { // 0表示首件 1表示200件
-    		if (faTaskInfo == null) {
-    			return ResponseBeanBuilder.fail("计划任务不存在!");
-    		} else {
-    			firstArticleTaskId = faTaskInfo.getId();
-    		}
-    	} else { // 2表示中断
-    		if (faTaskInfo == null) { // 没有初始化状态的task,新建一个
-    			//return ResponseBeanBuilder.fail("请先完成点检!");
-    		} else { // 存在一个初始化状态的task,就用这个
-    			firstArticleTaskId = faTaskInfo.getId();
-    		}
-    	}
+    	if (faTaskInfo != null) {
+    		firstArticleTaskId = faTaskInfo.getId();
+		}
 
     	/* 取得点检项目 */
     	List<FaItemListForPadRes> listResTemp = firstArticleMapper.getFaItemListForPad(req);
@@ -940,14 +964,35 @@ public class FirstArticleServiceImpl extends ServiceImpl<FirstArticleMapper, Ben
      */
 	@Override
 	public FaAllCheckFlagRes getFaAllCheckFlag(SearchFaAllCheckFlagReq req) {
+		/* 取得task信息 */
+    	SearchFaTaskInfoReq searchFaTaskInfoReq = new SearchFaTaskInfoReq();
+    	searchFaTaskInfoReq.setBentelerPlanId(req.getBentelerPlanId());
+    	searchFaTaskInfoReq.setTypeFlag(req.getTypeFlag());
+    	
+    	FirstArticleTask faTaskInfo = null;
+    	if (req.getTypeFlag() == 0 || req.getTypeFlag() == 1) { // 0表示首件 1表示200件
+    		searchFaTaskInfoReq.setUserId(req.getUserId());
+    		faTaskInfo = this.getFaTaskInfo(searchFaTaskInfoReq);
+    	} else { // 2表示中断
+    		/* 取得中断最新的task */
+    		faTaskInfo = this.getFaTaskInfoCatchLatest(searchFaTaskInfoReq);
+    	}
+    	
+    	long firstArticleTaskId = 0;
+    	if (faTaskInfo != null) {
+    		firstArticleTaskId = faTaskInfo.getId();
+		}
+
 		SearchFaPlanReq searchFaPlanReq = new SearchFaPlanReq();
 		searchFaPlanReq.setBentelerPlanId(req.getBentelerPlanId());
 		int itemCount = firstArticleMapper.getFaItemCount(searchFaPlanReq);
 
-		int itemResultCount = firstArticleMapper.getFaItemResultCount(req);
+		SearchFaItemResultCountReq searchFaItemResultCountReq = new SearchFaItemResultCountReq();
+		searchFaItemResultCountReq.setBentelerPlanId(req.getBentelerPlanId());
+		searchFaItemResultCountReq.setFirstArticleTaskId(firstArticleTaskId);
+		int itemResultCount = firstArticleMapper.getFaItemResultCount(searchFaItemResultCountReq);
 
 		FaAllCheckFlagRes faAllCheckFlagRes = new FaAllCheckFlagRes();
-
 		if (itemCount == itemResultCount) {
 			faAllCheckFlagRes.setAllCheckFlag(1); // 全部完成
 		} else {

+ 18 - 1
application-facade/src/main/java/com/factory/web/service/impl/pm/PreventMistakeServiceImpl.java

@@ -56,6 +56,7 @@ 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.SearchPmWorkshopNoGoListReq;
+import com.factory.web.entity.pm.req.SearchPmWsAllCheckFlagReq;
 import com.factory.web.entity.pm.req.SearchTaskReq;
 import com.factory.web.entity.pm.req.SearchWorkshopReq;
 import com.factory.web.entity.pm.res.ApprovalUserRes;
@@ -635,9 +636,25 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
      * @return 工作站列表
      */
     @Override
-    public ResponseBean<List<OnsiteWorkshop>> getWorkshopList(SearchPmPlanReq req) {
+    public ResponseBean<List<OnsiteWorkshop>> getWorkshopList(SearchPmAllCheckFlagReq req) {
     	List<OnsiteWorkshop> onsiteWorkshopList = onsiteWorkshopService.list(Wrappers.<OnsiteWorkshop>lambdaQuery()
                 .eq(OnsiteWorkshop::getBentelerPlanId, req.getBentelerPlanId()));
+    	SearchPmWsAllCheckFlagReq searchPmWsAllCheckFlagReq = null;
+    	for (OnsiteWorkshop onsiteWorkshop : onsiteWorkshopList) {
+    		/* 判断工作站下项目是否都检查完 */
+    		searchPmWsAllCheckFlagReq = new SearchPmWsAllCheckFlagReq();
+    		searchPmWsAllCheckFlagReq.setOnsiteTaskId(req.getOnsiteTaskId());    		
+    		searchPmWsAllCheckFlagReq.setWorkshopId(onsiteWorkshop.getId());
+    		
+    		int itemCount = preventMistakeMapper.getPmWsItemCount(searchPmWsAllCheckFlagReq);
+    		int itemResultCount = preventMistakeMapper.getPmWsItemResultCount(searchPmWsAllCheckFlagReq);
+    		if (itemCount == itemResultCount) {
+    			onsiteWorkshop.setAllCheckFlag(1);
+    		} else {
+    			onsiteWorkshop.setAllCheckFlag(0);
+    		}
+    	}
+
 		return ResponseBeanBuilder.ok(onsiteWorkshopList, Function.identity());
     }
 

+ 1 - 1
application-facade/src/main/java/com/factory/web/service/pm/PreventMistakeService.java

@@ -177,7 +177,7 @@ public interface PreventMistakeService extends IService<BentelerPlan> {
 	 * @param req
 	 * @return 工作站列表
 	 */
-	public ResponseBean<List<OnsiteWorkshop>> getWorkshopList(SearchPmPlanReq req);
+	public ResponseBean<List<OnsiteWorkshop>> getWorkshopList(SearchPmAllCheckFlagReq req);
 
 	/**
 	 * 取得巡检项目列表

+ 17 - 0
application-facade/src/main/resources/mapper/FirstArticleMapper.xml

@@ -305,6 +305,23 @@
 		AND     faw.benteler_plan_id = #{req.bentelerPlanId}
 		AND     fair.first_article_task_id = #{req.firstArticleTaskId}
 	</select>
+	
+	<!-- 取得工作站下的点检项目数 -->
+	<select id="getFaWsItemCount" resultType="int">
+	    SELECT COUNT(fai.id)
+		FROM   first_article_item fai
+		WHERE  fai.workshop_id = #{req.workshopId}
+	</select>
+	
+	<!-- 取得工作站下当前task的点检结果数 -->
+	<select id="getFaWsItemResultCount" resultType="int">
+	    SELECT  COUNT(fair.id)
+		FROM    first_article_item_result fair,
+		        first_article_item fai
+		WHERE   fair.first_article_item_id = fai.id
+		AND     fai.workshop_id = #{req.workshopId}
+		AND     fair.first_article_task_id = #{req.firstArticleTaskId}
+	</select>
     
     
     

+ 17 - 0
application-facade/src/main/resources/mapper/PreventMistakeMapper.xml

@@ -337,4 +337,21 @@
 		AND     ow.benteler_plan_id = #{req.bentelerPlanId}
 		AND     oir.onsite_task_id = #{req.onsiteTaskId}
 	</select>
+	
+	<!-- 取得工作站下的点检项目数 -->
+	<select id="getPmWsItemCount" resultType="int">
+	    SELECT COUNT(oi.id)
+		FROM   onsite_item oi
+		WHERE  oi.workshop_id = #{req.workshopId}
+	</select>
+	
+	<!-- 取得工作站下当前task的点检结果数 -->
+	<select id="getPmWsItemResultCount" resultType="int">
+		SELECT  COUNT(oir.id)
+		FROM    onsite_item_result oir,
+		        onsite_item oi
+		WHERE   oir.onsite_item_id = oi.id
+		AND     oi.workshop_id = #{req.workshopId}
+		AND     oir.onsite_task_id = #{req.onsiteTaskId}
+	</select>
 </mapper>