Browse Source

首件接口-异常列表-用户列表等

wuzhenyue 3 years ago
parent
commit
9e34d86162
16 changed files with 753 additions and 6 deletions
  1. 8 0
      application-facade/src/main/java/com/factory/controller/web/FirstArticleController.java
  2. 11 0
      application-facade/src/main/java/com/factory/controller/web/PreventMistakeController.java
  3. 29 0
      application-facade/src/main/java/com/factory/web/entity/fa/req/SearchUserListReq.java
  4. 38 0
      application-facade/src/main/java/com/factory/web/entity/fa/res/UserListRes.java
  5. 29 0
      application-facade/src/main/java/com/factory/web/entity/pm/req/SearchAbnormalListReq.java
  6. 41 0
      application-facade/src/main/java/com/factory/web/entity/pm/req/SearchAbnormalReq.java
  7. 71 6
      application-facade/src/main/java/com/factory/web/entity/pm/res/AbnormalItemRes.java
  8. 53 0
      application-facade/src/main/java/com/factory/web/entity/pm/res/AbnormalItemResultRes.java
  9. 9 0
      application-facade/src/main/java/com/factory/web/mapper/fa/FirstArticleMapper.java
  10. 59 0
      application-facade/src/main/java/com/factory/web/mapper/pm/PreventMistakeMapper.java
  11. 8 0
      application-facade/src/main/java/com/factory/web/service/fa/FirstArticleService.java
  12. 25 0
      application-facade/src/main/java/com/factory/web/service/impl/fa/FirstArticleServiceImpl.java
  13. 136 0
      application-facade/src/main/java/com/factory/web/service/impl/pm/PreventMistakeServiceImpl.java
  14. 10 0
      application-facade/src/main/java/com/factory/web/service/pm/PreventMistakeService.java
  15. 43 0
      application-facade/src/main/resources/mapper/FirstArticleMapper.xml
  16. 183 0
      application-facade/src/main/resources/mapper/PreventMistakeMapper.xml

+ 8 - 0
application-facade/src/main/java/com/factory/controller/web/FirstArticleController.java

@@ -39,6 +39,7 @@ import com.factory.web.entity.fa.res.FaPlanListForPadRes;
 import com.factory.web.entity.fa.res.FaPlanListRes;
 import com.factory.web.entity.fa.res.FaPlanRes;
 import com.factory.web.entity.fa.res.FaWorkshopNoGoListRes;
+import com.factory.web.entity.fa.res.UserListRes;
 import com.factory.web.entity.pm.OnsiteApprovalPlan;
 import com.factory.web.entity.pm.req.PmPlanPauseFlagReq;
 import com.factory.web.entity.pm.req.SearchPmPlanReq;
@@ -202,4 +203,11 @@ public class FirstArticleController {
 		return ResponseBeanBuilder.ok(firstArticleService.getFaAllCheckFlag(req));
 	}
 	
+	@ApiOperation(value = "取得用户列表")
+	@PostMapping("/getUserList")
+	@ApiOperationSupport(order = 20)
+	public ResponseBean<List<UserListRes>> getUserList() {
+		return ResponseBeanBuilder.ok(firstArticleService.getUserList());
+	}
+	
 }

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

@@ -21,6 +21,7 @@ import com.factory.web.entity.pm.req.AddPmPlanReq;
 import com.factory.web.entity.pm.req.EditItemResultListReq;
 import com.factory.web.entity.pm.req.EditPmPlanReq;
 import com.factory.web.entity.pm.req.PmPlanPauseFlagReq;
+import com.factory.web.entity.pm.req.SearchAbnormalListReq;
 import com.factory.web.entity.pm.req.SearchAllWorkshopReq;
 import com.factory.web.entity.pm.req.SearchItemListReq;
 import com.factory.web.entity.pm.req.SearchPmAllCheckFlagReq;
@@ -33,6 +34,7 @@ import com.factory.web.entity.pm.req.SearchPmPlanReq;
 import com.factory.web.entity.pm.req.SearchPmWorkshopNoGoListReq;
 import com.factory.web.entity.pm.req.SearchTaskReq;
 import com.factory.web.entity.pm.req.SearchWorkshopReq;
+import com.factory.web.entity.pm.res.AbnormalTaskInfoRes;
 import com.factory.web.entity.pm.res.PmAllCheckFlagRes;
 import com.factory.web.entity.pm.res.PmAllWorkshopListRes;
 import com.factory.web.entity.pm.res.PmCheckListRes;
@@ -227,6 +229,15 @@ public class PreventMistakeController {
 	public ResponseBean<PmAllCheckFlagRes> getPmAllCheckFlag(@RequestBody SearchPmAllCheckFlagReq req) {
 		return ResponseBeanBuilder.ok(preventMistakeService.getPmAllCheckFlag(req));
 	}
+	
+	
+	
+	@ApiOperation(value = "取得异常列表")
+	@PostMapping("/getAbnormalList")
+	@ApiOperationSupport(order = 24)
+	public ResponseBean<List<AbnormalTaskInfoRes>> getAbnormalList(@RequestBody SearchAbnormalListReq req) {
+		return preventMistakeService.getAbnormalList(req);
+	}
 
 	// 计划审批、任务审批,都在小程序端做
 }

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

@@ -0,0 +1,29 @@
+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 SearchUserListReq {
+	
+	@ApiModelProperty(value = "角色Id")
+	private Long roleId;
+	
+}

+ 38 - 0
application-facade/src/main/java/com/factory/web/entity/fa/res/UserListRes.java

@@ -0,0 +1,38 @@
+package com.factory.web.entity.fa.res;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+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 UserListRes implements Serializable {
+
+	@ApiModelProperty(value = "用户ID")
+	private Long id;
+
+	@ApiModelProperty(value = "用户名")
+	private String username;
+
+	@ApiModelProperty(value = "姓名")
+	private String name;
+
+}

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

@@ -0,0 +1,29 @@
+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 SearchAbnormalListReq {
+	
+	@ApiModelProperty(value = "年月日", example = "2021-06-08")
+	private String checkDate;
+
+}

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

@@ -0,0 +1,41 @@
+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 SearchAbnormalReq {
+	
+	@ApiModelProperty(value = "年月日", example = "2021-06-08")
+	private String checkDate;
+	
+	@ApiModelProperty(value = "工作站id")
+	private Long workshopId;
+	
+	@ApiModelProperty(value = "任务id")
+	private Long taskId;
+	
+	@ApiModelProperty(value = "巡检项目id")
+	private Long itemId;
+	
+	@ApiModelProperty(value = "0表示首件 1表示200件 2表示中断")
+	private Integer typeFlag;
+	
+}

+ 71 - 6
application-facade/src/main/java/com/factory/web/entity/pm/res/AbnormalItemRes.java

@@ -1,14 +1,10 @@
 package com.factory.web.entity.pm.res;
 
 import java.io.Serializable;
-import java.time.LocalDateTime;
 import java.util.List;
 
-import javax.validation.constraints.NotEmpty;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
-import com.factory.web.entity.pm.OnsiteWorkshop;
+import com.factory.web.entity.fa.FirstArticleItemResult;
 import com.fasterxml.jackson.annotation.JsonInclude;
 
 import io.swagger.annotations.ApiModel;
@@ -33,6 +29,75 @@ import lombok.NoArgsConstructor;
 public class AbnormalItemRes implements Serializable {
 	
 	@ApiModelProperty(value = "巡检项目id")
-	private Long onsiteItemId;
+	private Long itemId;
+	
+	@ApiModelProperty(value = "巡检项目内容")
+	private String itemContent;
+	
+	@ApiModelProperty(value = "防错检查结果:0通过 1巡检不通过 2没有巡检")
+	private Integer result;
+	
+	@ApiModelProperty(value = "判断标准")
+	private String itemStandard;
+	
+	@ApiModelProperty(value = "测量点前缀")
+	private String prefix;
+	
+	@ApiModelProperty(value = "测量点序号开始")
+	private Integer snoStart;
+	
+	@ApiModelProperty(value = "测量点序号结束")
+	private Integer snoEnd;
+
+	@ApiModelProperty(value = "数据类型 0数值 1属性")
+	private Integer valFlag;
+	
+	@ApiModelProperty(value = "上限 对应数据类型0数值")
+	private Integer valUp;
+	
+	@ApiModelProperty(value = "下限 对应数据类型0数值")
+	private Integer valDown;
+
+	@ApiModelProperty(value = "单位 对应数据类型0数值")
+	private Integer valUnit;
+	
+	@ApiModelProperty(value = "0表示ok 1表示nook 对应数据类型1属性")
+	private Integer valOk;
+	
+	@ApiModelProperty(value = "描述 对应数据类型1属性")
+	private String valDesc;
+
+	@ApiModelProperty(value = "特性等级")
+	private String levelInfo;
+	
+	@ApiModelProperty(value = "产品特性")
+	private String productInfo;
+	
+	@ApiModelProperty(value = "检验工具id")
+	private Integer toolId;
+	
+	@ApiModelProperty(value = "检验工具描述")
+	private String toolDesc;
+
+	@ApiModelProperty(value = "检验频次首件 0没选择 1选择")
+	private Integer firstFlag;
+	
+	@ApiModelProperty(value = "检验频次200件 0没选择 1选择")
+	private Integer twoHundredFlag;
+	
+	@ApiModelProperty(value = "检验频次中断 0没选择 1选择")
+	private Integer catchFlag;
+	
+//	@ApiModelProperty(value = "首件检查结果")
+//	private List<AbnormalItemResultRes> abnormalItemResultList;
+	
+	@ApiModelProperty(value = "首件检查结果")
+    private List<AbnormalItemResultRes> firstItemResultList; // 用于页面返回值
+	
+	@ApiModelProperty(value = "200件检查结果")
+    private List<AbnormalItemResultRes> twoHundredItemResultList; // 用于页面返回值
+
+	@ApiModelProperty(value = "中断检查结果")
+    private List<AbnormalItemResultRes> catchItemResultList; // 用于页面返回值
 
 }

+ 53 - 0
application-facade/src/main/java/com/factory/web/entity/pm/res/AbnormalItemResultRes.java

@@ -0,0 +1,53 @@
+package com.factory.web.entity.pm.res;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.List;
+
+import javax.validation.constraints.NotEmpty;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.factory.web.entity.pm.OnsiteWorkshop;
+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 AbnormalItemResultRes implements Serializable {
+	
+	@ApiModelProperty(value = "对应数据类型0数值")
+	private String val;
+	
+	@ApiModelProperty(value = "对应数据类型1属性")
+	private String valDesc;
+
+	@ApiModelProperty(value = "0通过 1巡检不通过 2没有巡检")
+	private Integer result;
+
+	@ApiModelProperty(value = "测量点前缀")
+	private String prefix;
+
+	@ApiModelProperty(value = "测量点序号")
+	private Integer sno;
+
+	@ApiModelProperty(value = "工具")
+	private String toolDesc;
+
+}

+ 9 - 0
application-facade/src/main/java/com/factory/web/mapper/fa/FirstArticleMapper.java

@@ -23,12 +23,14 @@ 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.SearchUserListReq;
 import com.factory.web.entity.fa.res.FaItemListForPadRes;
 import com.factory.web.entity.fa.res.FaItemNoGoListRes;
 import com.factory.web.entity.fa.res.FaNoGoTaskAapprovalRes;
 import com.factory.web.entity.fa.res.FaPlanListForPadRes;
 import com.factory.web.entity.fa.res.FaPlanListRes;
 import com.factory.web.entity.fa.res.FaWorkshopNoGoListRes;
+import com.factory.web.entity.fa.res.UserListRes;
 
 /**
  * 首件计划
@@ -138,4 +140,11 @@ public interface FirstArticleMapper extends BaseMapper<BentelerPlan> {
      */
     public int getFaWsItemResultCount(@Param("req") SearchFaWsItemResultCountReq req);
     
+    /**
+     * 取得用户列表
+     * @param req
+     * @return 用户列表
+     */
+    public List<UserListRes> getUserList(@Param("req") SearchUserListReq req);
+    
 }

+ 59 - 0
application-facade/src/main/java/com/factory/web/mapper/pm/PreventMistakeMapper.java

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.factory.base.entity.po.benteler.BentelerPlan;
 import com.factory.web.entity.pm.OnsiteApprovalPlan;
+import com.factory.web.entity.pm.req.SearchAbnormalReq;
 import com.factory.web.entity.pm.req.SearchApprovalUserReq;
 import com.factory.web.entity.pm.req.SearchCheckRecordReq;
 import com.factory.web.entity.pm.req.SearchPmAllCheckFlagReq;
@@ -20,6 +21,9 @@ 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.AbnormalItemRes;
+import com.factory.web.entity.pm.res.AbnormalItemResultRes;
+import com.factory.web.entity.pm.res.AbnormalTaskInfoRes;
 import com.factory.web.entity.pm.res.ApprovalUserRes;
 import com.factory.web.entity.pm.res.PmCheckListRes;
 import com.factory.web.entity.pm.res.PmCheckRecordListRes;
@@ -154,4 +158,59 @@ public interface PreventMistakeMapper extends BaseMapper<BentelerPlan> {
      * @return 工作站下当前task的点检结果数
      */
     public int getPmWsItemResultCount(@Param("req") SearchPmWsAllCheckFlagReq req);
+    
+    
+    
+    /**
+     * 取得防错放行
+     * @param req
+     * @return 防错放行
+     */
+    public List<AbnormalTaskInfoRes> getPmReleaseList(@Param("req") SearchAbnormalReq req);
+    
+    /**
+     * 取得防错重检
+     * @param req
+     * @return 防错重检
+     */
+    public List<AbnormalTaskInfoRes> getPmRepeatList(@Param("req") SearchAbnormalReq req);
+    
+    /**
+     * 取得防错工作站下的巡检项目和检查结果
+     * @param req
+     * @return 防错工作站下的巡检项目和检查结果
+     */
+    public List<AbnormalItemRes> getPmAbnormalItemList(@Param("req") SearchAbnormalReq req);
+    
+    /**
+     * 取得首件放行
+     * @param req
+     * @return 首件放行
+     */
+    public List<AbnormalTaskInfoRes> getFaReleaseList(@Param("req") SearchAbnormalReq req);
+
+    /**
+     * 取得首件重检
+     * @param req
+     * @return 首件重检
+     */
+    public List<AbnormalTaskInfoRes> getFaRepeatList(@Param("req") SearchAbnormalReq req);
+    
+    /**
+     * 取得首件工作站下的巡检项目
+     * @param req
+     * @return 首件工作站下的巡检项目
+     */
+    public List<AbnormalItemRes> getFaAbnormalItemList(@Param("req") SearchAbnormalReq req);
+    
+    /**
+     * 取得首件检查结果
+     * @param req
+     * @return 首件检查结果
+     */
+    public List<AbnormalItemResultRes> getFaAbnormalItemResultList(@Param("req") SearchAbnormalReq req);
+    
+    
+    
+    
 }

+ 8 - 0
application-facade/src/main/java/com/factory/web/service/fa/FirstArticleService.java

@@ -37,6 +37,7 @@ import com.factory.web.entity.fa.res.FaPlanListForPadRes;
 import com.factory.web.entity.fa.res.FaPlanListRes;
 import com.factory.web.entity.fa.res.FaPlanRes;
 import com.factory.web.entity.fa.res.FaWorkshopNoGoListRes;
+import com.factory.web.entity.fa.res.UserListRes;
 
 /**
  * 首件计划
@@ -223,4 +224,11 @@ public interface FirstArticleService extends IService<BentelerPlan> {
      * @return 判断检验结果是否填写完成
      */
     public FaAllCheckFlagRes getFaAllCheckFlag(SearchFaAllCheckFlagReq req);
+    
+    /**
+     * 取得用户列表
+     * @param req
+     * @return 取得用户列表
+     */
+    public List<UserListRes> getUserList();
 }

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

@@ -56,6 +56,7 @@ 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.SearchUserListReq;
 import com.factory.web.entity.fa.req.SubmitFaTaskReq;
 import com.factory.web.entity.fa.res.FaAllCheckFlagRes;
 import com.factory.web.entity.fa.res.FaCheckRecordListRes;
@@ -67,6 +68,7 @@ import com.factory.web.entity.fa.res.FaPlanListRes;
 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.fa.res.UserListRes;
 import com.factory.web.entity.pm.OnsiteApprovalPlan;
 import com.factory.web.entity.pm.res.ApprovalUserRes;
 import com.factory.web.mapper.fa.FirstArticleMapper;
@@ -94,6 +96,8 @@ import com.factory.web.service.pm.PreventMistakeService;
 @Transactional(rollbackFor = Exception.class)
 public class FirstArticleServiceImpl extends ServiceImpl<FirstArticleMapper, BentelerPlan> implements FirstArticleService {
 
+	private static long ROLE_ID = -1;
+	
 	@Autowired
 	private FirstArticleMapper firstArticleMapper;
 
@@ -735,6 +739,15 @@ public class FirstArticleServiceImpl extends ServiceImpl<FirstArticleMapper, Ben
 				firstArticleApprovalTaskService.save(firstArticleApprovalTask);
 			}
 		}
+		
+		/* 更新中断的操作人 */
+		if (req.getTypeFlag() == 2) {
+			LambdaUpdateWrapper<FirstArticleCalendar> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
+	        lambdaUpdateWrapper.eq(FirstArticleCalendar::getBentelerPlanId, req.getBentelerPlanId())
+	                           .eq(FirstArticleCalendar::getTypeFlag, 2)
+	                           .set(FirstArticleCalendar::getUserId, req.getUserId());
+	        firstArticleCalendarService.update(lambdaUpdateWrapper);
+		}
 
 		return ResponseBeanBuilder.ok();
 	}
@@ -1003,6 +1016,18 @@ public class FirstArticleServiceImpl extends ServiceImpl<FirstArticleMapper, Ben
 	}
 	
 	
+	/**
+     * 取得用户列表
+     * @param req
+     * @return 取得用户列表
+     */
+    public List<UserListRes> getUserList() {
+    	SearchUserListReq searchUserListReq = new SearchUserListReq();
+    	searchUserListReq.setRoleId(ROLE_ID);
+    	List<UserListRes> userList = firstArticleMapper.getUserList(searchUserListReq);
+        return userList;
+    }
+	
 	/**
      * Object转成byte[]
      * @param obj

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

@@ -23,6 +23,7 @@ import com.factory.base.entity.aggregates.ResponseBean;
 import com.factory.base.entity.enumPo.PlanType;
 import com.factory.base.entity.po.benteler.BentelerPlan;
 import com.factory.base.util.res.ResponseBeanBuilder;
+import com.factory.web.entity.fa.FirstArticleWorkshop;
 import com.factory.web.entity.pm.OnsiteApprovalPlan;
 import com.factory.web.entity.pm.OnsiteApprovalTask;
 import com.factory.web.entity.pm.OnsiteCalendar;
@@ -44,6 +45,8 @@ import com.factory.web.entity.pm.req.OnsiteCalendarReq;
 import com.factory.web.entity.pm.req.OnsiteItemReq;
 import com.factory.web.entity.pm.req.OnsiteWorkshopReq;
 import com.factory.web.entity.pm.req.PmPlanPauseFlagReq;
+import com.factory.web.entity.pm.req.SearchAbnormalListReq;
+import com.factory.web.entity.pm.req.SearchAbnormalReq;
 import com.factory.web.entity.pm.req.SearchAllWorkshopReq;
 import com.factory.web.entity.pm.req.SearchApprovalUserReq;
 import com.factory.web.entity.pm.req.SearchCheckRecordReq;
@@ -59,6 +62,10 @@ 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.AbnormalItemRes;
+import com.factory.web.entity.pm.res.AbnormalItemResultRes;
+import com.factory.web.entity.pm.res.AbnormalTaskInfoRes;
+import com.factory.web.entity.pm.res.AbnormalWorkshopRes;
 import com.factory.web.entity.pm.res.ApprovalUserRes;
 import com.factory.web.entity.pm.res.PmAllCheckFlagRes;
 import com.factory.web.entity.pm.res.PmAllWorkshopListRes;
@@ -76,6 +83,7 @@ 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.fa.FirstArticleWorkshopService;
 import com.factory.web.service.pm.OnsiteApprovalPlanService;
 import com.factory.web.service.pm.OnsiteApprovalTaskService;
 import com.factory.web.service.pm.OnsiteCalendarService;
@@ -88,6 +96,8 @@ import com.factory.web.service.pm.OnsiteTitleBlobService;
 import com.factory.web.service.pm.OnsiteWorkshopService;
 import com.factory.web.service.pm.PreventMistakeService;
 
+import io.swagger.annotations.ApiModelProperty;
+
 
 /**
  * 防错计划
@@ -134,6 +144,9 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
 
 	@Autowired
 	private OnsiteTaskHisBlobService onsiteTaskHisBlobService;
+	
+	@Autowired
+	private FirstArticleWorkshopService firstArticleWorkshopService;
 
 	/**
 	 * 新建防错计划
@@ -994,6 +1007,129 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
 		
 		return pmAllCheckFlagRes;
 	}
+	
+	/**
+	 * 取得异常列表
+	 * 
+	 * @param req
+	 * @return 异常列表
+	 */
+	@Override
+	public ResponseBean<List<AbnormalTaskInfoRes>> getAbnormalList(SearchAbnormalListReq req) {
+		/* 防错 */
+		SearchAbnormalReq searchReq = new SearchAbnormalReq();
+		searchReq.setCheckDate(req.getCheckDate());
+		List<AbnormalTaskInfoRes> pmReleaseList = preventMistakeMapper.getPmReleaseList(searchReq);
+		List<AbnormalTaskInfoRes> pmRepeatList = preventMistakeMapper.getPmRepeatList(searchReq);
+		List<AbnormalTaskInfoRes> pmList = new ArrayList<AbnormalTaskInfoRes>();
+		for (AbnormalTaskInfoRes pmRelease : pmReleaseList) {
+			pmList.add(pmRelease);
+		}
+		for (AbnormalTaskInfoRes pmRepeat : pmRepeatList) {
+			pmList.add(pmRepeat);
+		}
+		for (AbnormalTaskInfoRes pmInfo : pmList) {
+			List<OnsiteWorkshop> onsiteWorkshopList = onsiteWorkshopService.list(Wrappers.<OnsiteWorkshop>lambdaQuery()
+	                .eq(OnsiteWorkshop::getBentelerPlanId, pmInfo.getBentelerPlanId()));
+			
+			List<AbnormalWorkshopRes> abnormalWorkshopList = new ArrayList<AbnormalWorkshopRes>();
+			AbnormalWorkshopRes abnormalWorkshop = null;
+			for (OnsiteWorkshop workshop : onsiteWorkshopList) {
+				abnormalWorkshop = new AbnormalWorkshopRes();
+				abnormalWorkshop.setWorkshopId(workshop.getId());
+				abnormalWorkshop.setWsName(workshop.getWsName());
+				abnormalWorkshopList.add(abnormalWorkshop);
+			}
+			
+			for (AbnormalWorkshopRes abnormalWorkshopInfo : abnormalWorkshopList) {
+				searchReq = new SearchAbnormalReq();
+				searchReq.setWorkshopId(abnormalWorkshopInfo.getWorkshopId());
+				searchReq.setTaskId(pmInfo.getTaskId());
+				List<AbnormalItemRes> abnormalItemList = preventMistakeMapper.getPmAbnormalItemList(searchReq);
+				abnormalWorkshopInfo.setAbnormalItemList(abnormalItemList);
+			}
+			
+			pmInfo.setAbnormalWorkshopList(abnormalWorkshopList);
+		}
+		
+		/* 首件 */
+		searchReq = new SearchAbnormalReq();
+		searchReq.setCheckDate(req.getCheckDate());
+		List<AbnormalTaskInfoRes> faReleaseList = preventMistakeMapper.getFaReleaseList(searchReq);
+		List<AbnormalTaskInfoRes> faRepeatList = preventMistakeMapper.getFaRepeatList(searchReq);
+		
+		List<AbnormalTaskInfoRes> faList = new ArrayList<AbnormalTaskInfoRes>();
+		for (AbnormalTaskInfoRes faRelease : faReleaseList) {
+			faList.add(faRelease);
+		}
+		for (AbnormalTaskInfoRes faRepeat : faRepeatList) {
+			faList.add(faRepeat);
+		}
+		
+		for (AbnormalTaskInfoRes faInfo : faList) {
+			List<FirstArticleWorkshop> firstArticleWorkshopList = firstArticleWorkshopService.list(Wrappers.<FirstArticleWorkshop>lambdaQuery()
+	                .eq(FirstArticleWorkshop::getBentelerPlanId, faInfo.getBentelerPlanId()));
+
+			List<AbnormalWorkshopRes> abnormalWorkshopList = new ArrayList<AbnormalWorkshopRes>();
+			AbnormalWorkshopRes abnormalWorkshop = null;
+			for (FirstArticleWorkshop workshop : firstArticleWorkshopList) {
+				abnormalWorkshop = new AbnormalWorkshopRes();
+				abnormalWorkshop.setWorkshopId(workshop.getId());
+				abnormalWorkshop.setWsName(workshop.getWsName());
+				abnormalWorkshopList.add(abnormalWorkshop);
+			}
+			
+			for (AbnormalWorkshopRes abnormalWorkshopInfo : abnormalWorkshopList) {
+				searchReq = new SearchAbnormalReq();
+				searchReq.setWorkshopId(abnormalWorkshopInfo.getWorkshopId());
+				List<AbnormalItemRes> abnormalItemList = preventMistakeMapper.getFaAbnormalItemList(searchReq);
+				
+				for (AbnormalItemRes abnormalItemInfo : abnormalItemList) {
+					List<AbnormalItemResultRes> firstItemResultList = this.getAbnormalItemResultList(faInfo.getTaskId(), abnormalItemInfo.getItemId(), 0);
+					abnormalItemInfo.setFirstItemResultList(firstItemResultList);
+					
+					List<AbnormalItemResultRes> twoHundredItemResultList = this.getAbnormalItemResultList(faInfo.getTaskId(), abnormalItemInfo.getItemId(), 1);
+					abnormalItemInfo.setTwoHundredItemResultList(twoHundredItemResultList);
+
+					List<AbnormalItemResultRes> catchItemResultList = this.getAbnormalItemResultList(faInfo.getTaskId(), abnormalItemInfo.getItemId(), 2);
+					abnormalItemInfo.setCatchItemResultList(catchItemResultList);
+				}
+
+				abnormalWorkshopInfo.setAbnormalItemList(abnormalItemList);
+			}
+
+			faInfo.setAbnormalWorkshopList(abnormalWorkshopList);
+		}
+		
+		List<AbnormalTaskInfoRes> abnormalList = new ArrayList<AbnormalTaskInfoRes>();
+		for (AbnormalTaskInfoRes pm : pmList) {
+			abnormalList.add(pm);
+		}
+		for (AbnormalTaskInfoRes fa : faList) {
+			abnormalList.add(fa);
+		}
+
+		return ResponseBeanBuilder.ok(abnormalList, Function.identity());
+	}
+	
+	
+
+	/**
+	 * 取得检查结果
+	 * 
+	 * @param taskId
+	 * @param itemId
+	 * @param typeFlag 0表示首件 1表示200件 2表示中断
+	 * @return 检查结果
+	 */
+	private List<AbnormalItemResultRes> getAbnormalItemResultList(long taskId, long itemId, int typeFlag) {
+		SearchAbnormalReq searchReq = new SearchAbnormalReq();
+		searchReq.setTaskId(taskId);
+		searchReq.setItemId(itemId);
+		searchReq.setTypeFlag(typeFlag);
+		List<AbnormalItemResultRes> abnormalItemResultList = preventMistakeMapper.getFaAbnormalItemResultList(searchReq);
+	    return abnormalItemResultList;
+	}
 
 
     /**

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

@@ -16,6 +16,7 @@ import com.factory.web.entity.pm.req.AddPmPlanReq;
 import com.factory.web.entity.pm.req.EditItemResultListReq;
 import com.factory.web.entity.pm.req.EditPmPlanReq;
 import com.factory.web.entity.pm.req.PmPlanPauseFlagReq;
+import com.factory.web.entity.pm.req.SearchAbnormalListReq;
 import com.factory.web.entity.pm.req.SearchAllWorkshopReq;
 import com.factory.web.entity.pm.req.SearchApprovalUserReq;
 import com.factory.web.entity.pm.req.SearchItemListReq;
@@ -29,6 +30,7 @@ import com.factory.web.entity.pm.req.SearchPmPlanReq;
 import com.factory.web.entity.pm.req.SearchPmWorkshopNoGoListReq;
 import com.factory.web.entity.pm.req.SearchTaskReq;
 import com.factory.web.entity.pm.req.SearchWorkshopReq;
+import com.factory.web.entity.pm.res.AbnormalTaskInfoRes;
 import com.factory.web.entity.pm.res.ApprovalUserRes;
 import com.factory.web.entity.pm.res.PmAllCheckFlagRes;
 import com.factory.web.entity.pm.res.PmAllWorkshopListRes;
@@ -295,5 +297,13 @@ public interface PreventMistakeService extends IService<BentelerPlan> {
      * @return 判断检验结果是否填写完成
      */
     public PmAllCheckFlagRes getPmAllCheckFlag(SearchPmAllCheckFlagReq req);
+    
+    /**
+	 * 取得异常列表
+	 * 
+	 * @param req
+	 * @return 异常列表
+	 */
+	public ResponseBean<List<AbnormalTaskInfoRes>> getAbnormalList(SearchAbnormalListReq req);
 
 }

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

@@ -268,6 +268,7 @@
     </select>
 
     <!-- 取得首件、200件、中断每天的点检记录 -->
+    <!-- 
     <select id="getFaItemResultList" resultType="com.factory.web.entity.fa.FirstArticleItemResult">
         SELECT fair.sno,
 			   fair.result,
@@ -284,6 +285,33 @@
 		AND    DATE_FORMAT(fat.task_time, '%Y-%m-%d') = #{req.checkDate}
 		AND    fac.type_flag = #{req.typeFlag}
     </select>
+     -->
+    <select id="getFaItemResultList" resultType="com.factory.web.entity.fa.FirstArticleItemResult">
+        SELECT fair.sno,
+			   fair.result,
+			   fair.val,
+			   fair.val_desc,
+			   fair.prefix,
+			   fair.tool_desc
+		FROM   first_article_item_result fair,
+			   first_article_task fat,
+			   first_article_item fai
+		WHERE  fair.first_article_task_id = fat.id
+		AND    fair.first_article_item_id = fai.id
+		AND    fair.first_article_item_id = #{req.firstArticleItemId}
+		AND    DATE_FORMAT(fat.task_time, '%Y-%m-%d') = #{req.checkDate}
+		<if test="req.typeFlag == 0"> <!-- 首件 -->
+		AND    fai.first_flag = 1 
+		</if>
+		<if test="req.typeFlag == 1"> <!-- 200件 -->
+		AND    fai.two_hundred_flag = 1 
+		</if>
+		<if test="req.typeFlag == 2"> <!-- 中断 -->
+		AND    fai.catch_flag = 1
+		</if>
+    </select>
+    
+    
     
     <!-- 取得计划下的点检项目数 -->
 	<select id="getFaItemCount" resultType="int">
@@ -325,4 +353,19 @@
     
     
     
+    <!--取得用户列表 -->
+    <select id="getUserList" resultType="com.factory.web.entity.fa.res.UserListRes">
+        SELECT  uu.id,
+		        uu.username,
+		        uu.`name`
+		FROM    us_user uu,
+		        us_user_role uur
+		WHERE   uu.id = uur.user_id
+		AND     uu.`lock` = 0
+		AND     uu.del_flag = 0
+		<if test="req.roleId != -1">
+		AND     uur.role_id = #{req.roleId}
+		</if>
+    </select>
+    
 </mapper>

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

@@ -354,4 +354,187 @@
 		AND     oi.workshop_id = #{req.workshopId}
 		AND     oir.onsite_task_id = #{req.onsiteTaskId}
 	</select>
+	
+	
+	
+	
+	
+	<!-- 取得防错放行 -->
+    <select id="getPmReleaseList" resultType="com.factory.web.entity.pm.res.AbnormalTaskInfoRes">
+        SELECT  oc.benteler_plan_id,
+		        bp.`name` AS benteler_plan_name,
+				bp.plan_type,
+				oat.approval_level,
+				uu.`name` AS person,
+				1 AS method,
+				oat.reason,
+				oat.updated_time,
+				ot.`status`,
+				oc.type_flag,
+				ot.id AS task_id
+		FROM    onsite_task ot,
+		        onsite_calendar oc,
+				benteler_plan bp,
+				onsite_approval_task oat,
+				us_user uu
+		WHERE   ot.onsite_calendar_id = oc.id
+		AND     oc.benteler_plan_id = bp.id
+		AND     ot.id = oat.onsite_task_id
+		AND     oat.approval_user_id = uu.id
+		AND     oat.`status` = 1
+		AND     ot.`status` = 2
+		AND     DATE_FORMAT(ot.task_time, '%Y-%m-%d') = #{req.checkDate}
+    </select>
+    
+    <!-- 取得防错重检 -->
+    <select id="getPmRepeatList" resultType="com.factory.web.entity.pm.res.AbnormalTaskInfoRes">
+        SELECT  oc.benteler_plan_id,
+        		bp.`name` AS benteler_plan_name,
+			    bp.plan_type,
+				uu.`name` AS person,
+				2 AS method,
+				ot.`status`,
+				oc.type_flag,
+				ot.id AS task_id
+		FROM    onsite_task ot,
+		        onsite_calendar oc,
+				benteler_plan bp,
+				us_user uu,
+		        (
+				SELECT DISTINCT othb.onsite_task_id
+				FROM   onsite_task_his_blob othb,
+					   onsite_task ot
+				WHERE  othb.onsite_task_id = ot.id
+				) r
+		WHERE   ot.id = r.onsite_task_id
+		AND     ot.onsite_calendar_id = oc.id
+		AND     oc.benteler_plan_id = bp.id
+		AND     oc.user_id = uu.id
+		AND     DATE_FORMAT(ot.task_time, '%Y-%m-%d') = #{req.checkDate}
+    </select>
+    
+    <!-- 取得防错工作站下的巡检项目和检查结果 -->
+    <select id="getPmAbnormalItemList" resultType="com.factory.web.entity.pm.res.AbnormalItemRes">
+        SELECT  oir.onsite_item_id AS item_id,
+		        oi.item_content,
+				oir.result
+		FROM    onsite_item_result oir,
+		        onsite_item oi
+		WHERE   oir.onsite_item_id = oi.id
+		AND     oir.onsite_task_id = #{req.taskId}
+		AND     oi.workshop_id = #{req.workshopId}
+    </select>
+    
+    
+    
+    
+    <!-- 取得首件放行 -->
+    <select id="getFaReleaseList" resultType="com.factory.web.entity.pm.res.AbnormalTaskInfoRes">
+       SELECT   fac.benteler_plan_id,
+        		bp.`name` AS benteler_plan_name,
+			    bp.plan_type,
+				faat.approval_level,
+				uu.`name` AS person,
+				1 AS method,
+				faat.reason,
+				faat.updated_time,
+				fat.`status`,
+				fac.type_flag,
+				fat.id AS task_id
+		FROM    first_article_task fat,
+		        first_article_calendar fac,
+				benteler_plan bp,
+				first_article_approval_task faat,
+				us_user uu
+		WHERE   fat.first_article_calendar_id = fac.id
+		AND     fac.benteler_plan_id = bp.id
+		AND     fat.id = faat.first_article_task_id
+		AND     faat.approval_user_id = uu.id
+		AND     faat.`status` = 1
+		AND     fat.`status` = 2
+		AND     DATE_FORMAT(fat.task_time, '%Y-%m-%d') = #{req.checkDate}
+    </select>
+    
+    <!-- 取得首件重检 -->
+    <select id="getFaRepeatList" resultType="com.factory.web.entity.pm.res.AbnormalTaskInfoRes">
+        SELECT  fac.benteler_plan_id,
+        		bp.`name` AS benteler_plan_name,
+			    bp.plan_type,
+				uu.`name` AS person,
+				2 AS method,
+				fat.`status`,
+				fac.type_flag,
+				fat.id AS task_id
+		FROM    first_article_task fat,
+		        first_article_calendar fac,
+				benteler_plan bp,
+				us_user uu,
+       		    (
+				SELECT DISTINCT fathb.first_article_task_id
+				FROM   first_article_task_his_blob fathb,
+					   first_article_task fat
+				WHERE  fathb.first_article_task_id = fat.id
+				) r
+		WHERE   fat.id = r.first_article_task_id
+		AND     fat.first_article_calendar_id = fac.id
+		AND     fac.benteler_plan_id = bp.id
+		AND     fac.user_id = uu.id
+		AND     DATE_FORMAT(fat.task_time, '%Y-%m-%d') = #{req.checkDate}
+    </select>
+    
+    <!-- 取得首件工作站下的巡检项目 -->
+    <select id="getFaAbnormalItemList" resultType="com.factory.web.entity.pm.res.AbnormalItemRes">
+        SELECT
+			fai.id AS item_id,
+			fai.item_content,
+			fai.item_standard,
+			fai.prefix,
+			fai.sno_start,
+			fai.sno_end,
+			fai.val_flag,
+			fai.val_up,
+			fai.val_down,
+			fai.val_ok,
+			fai.val_desc,
+			fai.level_info,
+			fai.product_info,
+			fai.tool_id,
+			fai.tool_desc,
+			fai.first_flag,
+			fai.two_hundred_flag,
+			fai.catch_flag,
+			fai.val_unit 
+		FROM
+			first_article_item fai 
+		WHERE
+			fai.workshop_id = #{req.workshopId}
+    </select>
+    
+    <!-- 取得首件检查结果 -->
+    <select id="getFaAbnormalItemResultList" resultType="com.factory.web.entity.pm.res.AbnormalItemResultRes">
+        SELECT
+			fair.prefix,
+			fair.sno,
+			fair.val,
+			fair.val_desc,
+			fair.result,
+			fair.tool_desc 
+		FROM
+			first_article_item_result fair,
+			first_article_item fai
+		WHERE
+		    fair.first_article_item_id = fai.id
+			AND fair.first_article_task_id = #{req.taskId}
+			AND fair.first_article_item_id = #{req.itemId}
+			<if test="req.typeFlag == 0"> <!-- 首件 -->
+			AND fai.first_flag = 1 
+			</if>
+			<if test="req.typeFlag == 1"> <!-- 200件 -->
+			AND fai.two_hundred_flag = 1 
+			</if>
+			<if test="req.typeFlag == 2"> <!-- 中断 -->
+			AND fai.catch_flag = 1
+			</if>
+    </select>
+    
 </mapper>