feat(检验计划维护):新增检验计划维护
1.新增检验计划维护功能 refs:#13076
This commit is contained in:
parent
2433887bd4
commit
8d69faba34
@ -1,18 +0,0 @@
|
||||
package com.foreverwin.iep.qms.domain;
|
||||
|
||||
import com.foreverwin.iep.qms.entity.QmsVwItemRouterOperationQcPlan;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ProdQcPlan {
|
||||
|
||||
private String router;
|
||||
|
||||
private String routerDesc;
|
||||
|
||||
private String routerVer;
|
||||
|
||||
private List<QmsVwItemRouterOperationQcPlan> prodList;
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.foreverwin.iep.qms.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserGroup {
|
||||
|
||||
private String userGroup;
|
||||
private String roleName;
|
||||
private String roleDesc;
|
||||
}
|
||||
@ -1,29 +1,18 @@
|
||||
package com.foreverwin.iep.qms.dto;
|
||||
|
||||
|
||||
import com.foreverwin.iep.qms.entity.QmsQcPlanDetail;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class QmsQcPlanDetailDTO extends QmsQcPlanDetail {
|
||||
private String samplePlan;
|
||||
|
||||
private String qcItem;
|
||||
|
||||
private String qcItemDesc;
|
||||
|
||||
private String qcItemStatus;
|
||||
|
||||
private String itemType;
|
||||
|
||||
private String samplePlan;
|
||||
private String controlMode;
|
||||
|
||||
private String router;
|
||||
|
||||
private String routerDescription;
|
||||
|
||||
private String chartControl;
|
||||
private String sampleSize;
|
||||
private String itemType;
|
||||
}
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
package com.foreverwin.iep.qms.dto;
|
||||
|
||||
import com.foreverwin.iep.qms.entity.QmsQcPlanTarget;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class QmsQcPlanTargetDTO extends QmsQcPlanTarget {
|
||||
|
||||
private String userGroup;
|
||||
private String qcPlanDesc;
|
||||
}
|
||||
@ -37,7 +37,7 @@ import java.util.List;
|
||||
* 检验计划
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-06-06 16:43:15
|
||||
* @date 2023-07-11 16:28:57
|
||||
*/
|
||||
@Data
|
||||
@TableName("qms_qc_plan")
|
||||
@ -46,9 +46,7 @@ import java.util.List;
|
||||
public class QmsQcPlan extends Model<QmsQcPlan> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static final String KW_QMS_QC_PLAN_BO = "QCPlanBO";
|
||||
|
||||
public static final String KW_QMS_QC_PLAN_BO = "QcPlanBO";
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ -57,9 +55,9 @@ public class QmsQcPlan extends Model<QmsQcPlan> {
|
||||
private String handle;
|
||||
|
||||
/**
|
||||
* 生产点
|
||||
* 工厂
|
||||
*/
|
||||
@ApiModelProperty(value="生产点")
|
||||
@ApiModelProperty(value="工厂")
|
||||
private String site;
|
||||
|
||||
/**
|
||||
@ -86,23 +84,17 @@ public class QmsQcPlan extends Model<QmsQcPlan> {
|
||||
@ApiModelProperty(value="检验计划说明")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 检验模式
|
||||
*/
|
||||
@ApiModelProperty(value="检验模式")
|
||||
private String qcMode;
|
||||
|
||||
/**
|
||||
* 检验类型
|
||||
*/
|
||||
@ApiModelProperty(value="检验类型")
|
||||
private String qcType;
|
||||
private String inspecType;
|
||||
|
||||
/**
|
||||
* 检验频率编号
|
||||
* 检验频率主键
|
||||
*/
|
||||
@ApiModelProperty(value="检验频率编号")
|
||||
private String inspecNo;
|
||||
@ApiModelProperty(value="检验频率主键")
|
||||
private String inspecFreqBo;
|
||||
|
||||
/**
|
||||
* 检验人员群组
|
||||
@ -110,30 +102,6 @@ public class QmsQcPlan extends Model<QmsQcPlan> {
|
||||
@ApiModelProperty(value="检验人员群组")
|
||||
private String userGroup;
|
||||
|
||||
/**
|
||||
* 建立人
|
||||
*/
|
||||
@ApiModelProperty(value="建立人")
|
||||
private String createdUser;
|
||||
|
||||
/**
|
||||
* 建立日期
|
||||
*/
|
||||
@ApiModelProperty(value="建立日期")
|
||||
private LocalDateTime createdDateTime;
|
||||
|
||||
/**
|
||||
* 镱钛SIP汇入档案组名
|
||||
*/
|
||||
@ApiModelProperty(value="镱钛SIP汇入档案组名")
|
||||
private String sipGroupName;
|
||||
|
||||
/**
|
||||
* 镱钛SIP汇入档案文件名
|
||||
*/
|
||||
@ApiModelProperty(value="镱钛SIP汇入档案文件名")
|
||||
private String sipFileName;
|
||||
|
||||
/**
|
||||
* 抛送至SPC
|
||||
*/
|
||||
@ -141,45 +109,39 @@ public class QmsQcPlan extends Model<QmsQcPlan> {
|
||||
private String toSpc;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
* 创建日期
|
||||
*/
|
||||
@ApiModelProperty(value="修改时间")
|
||||
private String modifiedUser;
|
||||
@ApiModelProperty(value="创建日期")
|
||||
private LocalDateTime dateCreate;
|
||||
|
||||
/**
|
||||
* 修改人员
|
||||
* 更新日期
|
||||
*/
|
||||
@ApiModelProperty(value="修改人员")
|
||||
private LocalDateTime modifiedDateTime;
|
||||
@ApiModelProperty(value="更新日期")
|
||||
private LocalDateTime dateUpdate;
|
||||
|
||||
/**
|
||||
* 检验分类
|
||||
* 创建人员
|
||||
*/
|
||||
@ApiModelProperty(value="检验分类")
|
||||
private String qcClass;
|
||||
@ApiModelProperty(value="创建人员")
|
||||
private String creator;
|
||||
|
||||
/**
|
||||
* 卡控出站
|
||||
* 更新人员
|
||||
*/
|
||||
@ApiModelProperty(value="卡控出站")
|
||||
private String checkOutControl;
|
||||
@ApiModelProperty(value="更新人员")
|
||||
private String updater;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String inspecFreqNo;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String inspecFreqDesc;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<QmsQcPlanDetailDTO> qcPlanDetailList;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<QmsProdQcPlan> workCenterList;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<QmsProdQcPlan> resourceList;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<QmsProdQcPlan> itemList;
|
||||
|
||||
@TableField(exist = false)
|
||||
private boolean isCreateJob;
|
||||
|
||||
public static String genHandle( String site, String qcPlan, String revision ) {
|
||||
public static String genHandle(String site, String qcPlan, String revision) {
|
||||
return HandleBoProcessor.genHandle(KW_QMS_QC_PLAN_BO, site, qcPlan, revision);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, mom All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the foreverwin.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: mom
|
||||
*/
|
||||
|
||||
package com.foreverwin.iep.qms.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@ -9,14 +27,15 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 检验计划明细表
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-07-11 15:18:49
|
||||
* @date 2023-07-11 16:30:35
|
||||
*/
|
||||
@Data
|
||||
@TableName("qms_qc_plan_detail")
|
||||
@ -25,62 +44,69 @@ import java.math.BigDecimal;
|
||||
public class QmsQcPlanDetail extends Model<QmsQcPlanDetail> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public static final String KW_QMS_QC_PLAN_DETAIL_BO = "QmsQcPlanDetailBO";
|
||||
|
||||
|
||||
public static final String KW_QMS_QC_PLAN_DETAIL_BO = "QcPlanDetailBO";
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.INPUT)
|
||||
@ApiModelProperty(value = "主键")
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value="主键")
|
||||
private String handle;
|
||||
|
||||
/**
|
||||
* 检验计划主表主键
|
||||
*/
|
||||
@ApiModelProperty(value = "检验计划主表主键")
|
||||
@ApiModelProperty(value="检验计划主表主键")
|
||||
private String qcPlanBo;
|
||||
|
||||
/**
|
||||
* 顺序
|
||||
*/
|
||||
@ApiModelProperty(value = "顺序")
|
||||
@ApiModelProperty(value="顺序")
|
||||
private String seq;
|
||||
|
||||
/**
|
||||
* 检验项目主键
|
||||
*/
|
||||
@ApiModelProperty(value = "检验项目主键")
|
||||
@ApiModelProperty(value="检验项目主键")
|
||||
private String qcItemBo;
|
||||
|
||||
/**
|
||||
* 抽样计划主键
|
||||
*/
|
||||
@ApiModelProperty(value = "抽样计划主键")
|
||||
@ApiModelProperty(value="抽样计划主键")
|
||||
private String samplePlanBo;
|
||||
|
||||
/**
|
||||
* 规格上限
|
||||
*/
|
||||
@ApiModelProperty(value = "规格上限")
|
||||
@ApiModelProperty(value="规格上限")
|
||||
private BigDecimal maxValue;
|
||||
|
||||
/**
|
||||
* 规格下限
|
||||
*/
|
||||
@ApiModelProperty(value = "规格下限")
|
||||
@ApiModelProperty(value="规格下限")
|
||||
private BigDecimal minValue;
|
||||
|
||||
/**
|
||||
* 中心
|
||||
*/
|
||||
@ApiModelProperty(value = "中心")
|
||||
@ApiModelProperty(value="中心")
|
||||
private BigDecimal centerValue;
|
||||
|
||||
/**
|
||||
* 内文
|
||||
*/
|
||||
@ApiModelProperty(value = "内文")
|
||||
@ApiModelProperty(value="内文")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
@ApiModelProperty(value="备注")
|
||||
private String remark;
|
||||
|
||||
public static String genHandle( String qcPlanBo, String seq ) {
|
||||
return HandleBoProcessor.genHandle(KW_QMS_QC_PLAN_DETAIL_BO, qcPlanBo, seq);
|
||||
public static String genHandle(String qcPlanBo, String qcItemBo) {
|
||||
return HandleBoProcessor.genHandle(KW_QMS_QC_PLAN_DETAIL_BO, qcPlanBo, qcItemBo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,48 +0,0 @@
|
||||
package com.foreverwin.iep.qms.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 检验计划明细-要因表
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-06-06 16:45:35
|
||||
*/
|
||||
@Data
|
||||
@TableName("qms_qc_plan_detail_factor")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "检验计划明细-要因表")
|
||||
public class QmsQcPlanDetailFactor extends Model<QmsQcPlanDetailFactor> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value="主键")
|
||||
private String sid;
|
||||
|
||||
/**
|
||||
* 检验计划明细表Handle
|
||||
*/
|
||||
@ApiModelProperty(value="检验计划明细表Handle")
|
||||
private String qcPlanDetailBo;
|
||||
|
||||
/**
|
||||
* 要因主表Handle
|
||||
*/
|
||||
@ApiModelProperty(value="要因主表Handle")
|
||||
private String factorBo;
|
||||
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
package com.foreverwin.iep.qms.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.foreverwin.iep.common.utils.HandleBoProcessor;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 检验计划使用对象
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-07-12 11:23:14
|
||||
*/
|
||||
@Data
|
||||
@TableName("qms_qc_plan_target")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "检验计划使用对象")
|
||||
public class QmsQcPlanTarget extends Model<QmsQcPlanTarget> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public static final String KW_QMS_QC_PLAN_TARGET_BO = "QcPlanTargetBO";
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value="主键")
|
||||
private String handle;
|
||||
|
||||
/**
|
||||
* 工厂
|
||||
*/
|
||||
@ApiModelProperty(value="工厂")
|
||||
private String site;
|
||||
|
||||
/**
|
||||
* 检验计划编号
|
||||
*/
|
||||
@ApiModelProperty(value="检验计划编号")
|
||||
private String qcPlan;
|
||||
|
||||
/**
|
||||
* 顺序
|
||||
*/
|
||||
@ApiModelProperty(value="顺序")
|
||||
private String seq;
|
||||
|
||||
/**
|
||||
* 使用对象的主键
|
||||
*/
|
||||
@ApiModelProperty(value="使用对象的主键")
|
||||
private String targetBo;
|
||||
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
@ApiModelProperty(value="创建日期")
|
||||
private LocalDateTime dateCreate;
|
||||
|
||||
/**
|
||||
* 更新日期
|
||||
*/
|
||||
@ApiModelProperty(value="更新日期")
|
||||
private LocalDateTime dateUpdate;
|
||||
|
||||
/**
|
||||
* 创建人员
|
||||
*/
|
||||
@ApiModelProperty(value="创建人员")
|
||||
private String creator;
|
||||
|
||||
/**
|
||||
* 更新人员
|
||||
*/
|
||||
@ApiModelProperty(value="更新人员")
|
||||
private String updater;
|
||||
|
||||
public static String genHandle(String site, String qcPlan, String targetBo) {
|
||||
return HandleBoProcessor.genHandle(KW_QMS_QC_PLAN_TARGET_BO, site, qcPlan, targetBo);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.foreverwin.iep.qms.feign;
|
||||
|
||||
import com.foreverwin.iep.qms.entity.QmsQcPlanTarget;
|
||||
import com.foreverwin.mom.common.core.constant.SecurityConstants;
|
||||
import com.foreverwin.mom.common.core.util.R;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(contextId = "remoteQmsQcPlanTargetService", value = "iep-qms")
|
||||
public interface RemoteQmsQcPlanTargetService {
|
||||
|
||||
@PostMapping("/qc-plan-target/{targetBo}")
|
||||
R<Boolean> save( @PathVariable("targetBo") String targetBo, @RequestBody List<QmsQcPlanTarget> qmsQcPlanTargetList);
|
||||
}
|
||||
@ -1,57 +0,0 @@
|
||||
package com.foreverwin.iep.qms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.foreverwin.mom.common.core.util.R;
|
||||
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
|
||||
import com.foreverwin.mom.common.log.annotation.SysLog;
|
||||
import com.foreverwin.iep.qms.entity.QmsProdQcPlan;
|
||||
import com.foreverwin.iep.qms.service.QmsProdQcPlanService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.foreverwin.mom.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品检验计划表
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-06-06 16:41:41
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/prod-qc-plan" )
|
||||
@Api(value = "prod-qc-plan", tags = "产品检验计划表管理")
|
||||
public class QmsProdQcPlanController {
|
||||
|
||||
private final QmsProdQcPlanService qmsProdQcPlanService;
|
||||
|
||||
/**
|
||||
* 通过id查询产品检验计划表
|
||||
* @param sid id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询", notes = "通过id查询")
|
||||
@GetMapping("/{item}" )
|
||||
public R getByItem(@PathVariable("item" ) String item) {
|
||||
return R.ok(qmsProdQcPlanService.findItemRouterQcPlan(TenantContextHolder.getTenantId(), item));
|
||||
}
|
||||
|
||||
/**
|
||||
* 储存产品检验计划表
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "储存产品检验计划表", notes = "储存产品检验计划表")
|
||||
@SysLog("储存产品检验计划表" )
|
||||
@PostMapping("/{item}")
|
||||
public R save(@PathVariable("item" ) String item, @RequestBody List<QmsProdQcPlan> list) {
|
||||
qmsProdQcPlanService.addProdQcPlan(TenantContextHolder.getTenantId(), item, list);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,11 +1,12 @@
|
||||
package com.foreverwin.iep.qms.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.foreverwin.iep.common.base.FrontPage;
|
||||
import com.foreverwin.iep.common.utils.HandleBoProcessor;
|
||||
import com.foreverwin.mom.common.core.util.R;
|
||||
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
|
||||
import com.foreverwin.mom.common.log.annotation.SysLog;
|
||||
import com.foreverwin.iep.qms.entity.QmsQcPlan;
|
||||
import com.foreverwin.iep.qms.service.QmsQcPlanService;
|
||||
@ -22,7 +23,7 @@ import java.util.List;
|
||||
* 检验计划
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-06-06 16:43:15
|
||||
* @date 2023-07-11 16:28:57
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@ -41,12 +42,18 @@ public class QmsQcPlanController {
|
||||
@ApiOperation(value = "分页查询", notes = "分页查询")
|
||||
@GetMapping("/page" )
|
||||
public R getQmsQcPlanPage( FrontPage page, QmsQcPlan qmsQcPlan) {
|
||||
return R.ok(qmsQcPlanService.page(page.genOrders(), Wrappers.<QmsQcPlan>lambdaQuery()
|
||||
.eq(QmsQcPlan::getSite, TenantContextHolder.getTenantId())
|
||||
|
||||
IPage<QmsQcPlan> iPage = qmsQcPlanService.page(page.genOrders(), Wrappers.<QmsQcPlan>lambdaQuery()
|
||||
.eq(StrUtil.isNotBlank(qmsQcPlan.getInspecType()), QmsQcPlan::getInspecType, qmsQcPlan.getInspecType())
|
||||
.like(StrUtil.isNotBlank(qmsQcPlan.getQcPlan()), QmsQcPlan::getQcPlan, qmsQcPlan.getQcPlan())
|
||||
.eq(StrUtil.isNotBlank(qmsQcPlan.getQcMode()), QmsQcPlan::getQcMode, qmsQcPlan.getQcMode())
|
||||
.eq(StrUtil.isNotBlank(qmsQcPlan.getQcType()), QmsQcPlan::getQcType, qmsQcPlan.getQcType())
|
||||
.eq(StrUtil.isNotBlank(qmsQcPlan.getCurrentRevision()), QmsQcPlan::getCurrentRevision, qmsQcPlan.getCurrentRevision())));
|
||||
.eq(StrUtil.isNotBlank(qmsQcPlan.getUserGroup()), QmsQcPlan::getUserGroup, qmsQcPlan.getUserGroup())
|
||||
.eq(StrUtil.isNotBlank(qmsQcPlan.getCurrentRevision()), QmsQcPlan::getCurrentRevision, qmsQcPlan.getCurrentRevision())
|
||||
.eq(StrUtil.isNotBlank(qmsQcPlan.getInspecType()), QmsQcPlan::getInspecType, qmsQcPlan.getInspecType())
|
||||
.orderByAsc(QmsQcPlan::getQcPlan));
|
||||
iPage.getRecords().forEach(qcPlan->{
|
||||
qcPlan.setInspecFreqNo(HandleBoProcessor.trimHandle(qcPlan.getInspecFreqBo()));
|
||||
});
|
||||
return R.ok(iPage);
|
||||
}
|
||||
|
||||
|
||||
@ -56,9 +63,15 @@ public class QmsQcPlanController {
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询", notes = "通过id查询")
|
||||
@GetMapping("/{qcPlan}/{revision}" )
|
||||
public R getById(@PathVariable("qcPlan" ) String qcPlan, @PathVariable("revision" ) String revision) {
|
||||
return R.ok(qmsQcPlanService.findQCPlan(TenantContextHolder.getTenantId(), qcPlan, revision));
|
||||
@GetMapping("/{handle}" )
|
||||
public R getById(@PathVariable("handle" ) String handle) {
|
||||
return R.ok(qmsQcPlanService.getFullById(handle));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过qcPlan查询当前版本", notes = "通过qcPlan查询当前版本")
|
||||
@GetMapping("/getCurrent/{qcPlan}" )
|
||||
public R getCurrentFullById(@PathVariable("qcPlan" ) String qcPlan) {
|
||||
return R.ok(qmsQcPlanService.getCurrentFullById(qcPlan));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,9 +82,9 @@ public class QmsQcPlanController {
|
||||
@ApiOperation(value = "新增检验计划", notes = "新增检验计划")
|
||||
@SysLog("新增检验计划" )
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('qms_insp_plan_add')" )
|
||||
@PreAuthorize("@pms.hasPermission('qms_qc_plan_add')" )
|
||||
public R save(@RequestBody QmsQcPlan qmsQcPlan) {
|
||||
qmsQcPlanService.addQCPlan(qmsQcPlan);
|
||||
qmsQcPlanService.validateAndSave(qmsQcPlan);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ -83,44 +96,37 @@ public class QmsQcPlanController {
|
||||
@ApiOperation(value = "修改检验计划", notes = "修改检验计划")
|
||||
@SysLog("修改检验计划" )
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('qms_insp_plan_edit')" )
|
||||
@PreAuthorize("@pms.hasPermission('qms_qc_plan_edit')" )
|
||||
public R updateById(@RequestBody QmsQcPlan qmsQcPlan) {
|
||||
qmsQcPlanService.updateQCPlan(qmsQcPlan);
|
||||
qmsQcPlanService.validateAndUpdate(qmsQcPlan);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除检验计划
|
||||
* @param handle id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id删除检验计划", notes = "通过id删除检验计划")
|
||||
@SysLog("通过id删除检验计划" )
|
||||
@DeleteMapping("/{qcPlan}/{revision}" )
|
||||
@PreAuthorize("@pms.hasPermission('qms_insp_plan_del')" )
|
||||
public R removeById(@PathVariable("qcPlan" ) String qcPlan, @PathVariable("revision" ) String revision) {
|
||||
qmsQcPlanService.deleteQCPlan(TenantContextHolder.getTenantId(), qcPlan, revision);
|
||||
@DeleteMapping("/{handle}" )
|
||||
@PreAuthorize("@pms.hasPermission('qms_qc_plan_del')" )
|
||||
public R removeById(@PathVariable String handle) {
|
||||
qmsQcPlanService.validateAndDelete(handle);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 匯入检验计划
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "匯入检验计划", notes = "匯入检验计划")
|
||||
@SysLog("匯入检验计划" )
|
||||
@PostMapping("/import")
|
||||
@PreAuthorize("@pms.hasPermission('qms_insp_plan_import')" )
|
||||
public R qcPlanImport(@RequestBody List<QmsQcPlan> qmsQcPlanList) {
|
||||
return R.ok(qmsQcPlanService.qcPlanImport(qmsQcPlanList));
|
||||
@ApiOperation(value = "使用者群组开窗", notes = "使用者群组开窗")
|
||||
@SysLog("使用者群组开窗" )
|
||||
@GetMapping("/getUserGroup" )
|
||||
public R getUserGroup() {
|
||||
return R.ok(qmsQcPlanService.getUserGroup());
|
||||
}
|
||||
|
||||
/**
|
||||
* ISQC ROUTER開窗
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "ISQC ROUTER開窗", notes = "ISQC ROUTER開窗")
|
||||
@GetMapping("/qc/router" )
|
||||
public R getQcRouter() {
|
||||
return R.ok(qmsQcPlanService.getQcRouter(TenantContextHolder.getTenantId()));
|
||||
@ApiOperation(value = "检验计划开窗", notes = "检验计划开窗")
|
||||
@SysLog("检验计划开窗" )
|
||||
@GetMapping("/getDistinctQcPlan" )
|
||||
public R getDistinctQcPlan() {
|
||||
return R.ok(qmsQcPlanService.getDistinctQcPlan());
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
package com.foreverwin.iep.qms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.foreverwin.mom.common.core.util.R;
|
||||
import com.foreverwin.mom.common.log.annotation.SysLog;
|
||||
import com.foreverwin.iep.qms.entity.QmsQcPlanTarget;
|
||||
import com.foreverwin.iep.qms.service.QmsQcPlanTargetService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.foreverwin.mom.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检验计划使用对象
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-07-12 11:23:14
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/qc-plan-target" )
|
||||
@Api(value = "qc-plan-target", tags = "检验计划使用对象管理")
|
||||
public class QmsQcPlanTargetController {
|
||||
|
||||
private final QmsQcPlanTargetService qmsQcPlanTargetService;
|
||||
|
||||
@ApiOperation(value = "检验计划使用对象-检索", notes = "检验计划使用对象-检索")
|
||||
@SysLog("检验计划使用对象-检索" )
|
||||
@GetMapping("/{targetBo}")
|
||||
public R getByTargetBo(@PathVariable String targetBo) {
|
||||
return R.ok(qmsQcPlanTargetService.getByTargetBo(targetBo));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "储存检验计划使用对象", notes = "储存检验计划使用对象")
|
||||
@SysLog("储存检验计划使用对象" )
|
||||
@PostMapping("/{targetBo}")
|
||||
public R save(@PathVariable String targetBo, @RequestBody List<QmsQcPlanTarget> qmsQcPlanTargetList) {
|
||||
return R.ok(qmsQcPlanTargetService.saveFullByTargetBo(targetBo, qmsQcPlanTargetList));
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
package com.foreverwin.iep.qms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.foreverwin.iep.qms.domain.ProdQcPlan;
|
||||
import com.foreverwin.iep.qms.entity.QmsProdQcPlan;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品检验计划表
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-06-06 16:41:41
|
||||
*/
|
||||
public interface QmsProdQcPlanService extends IService<QmsProdQcPlan> {
|
||||
|
||||
void addProdQcPlan( String site, String item, List<QmsProdQcPlan> list );
|
||||
|
||||
ProdQcPlan findItemRouterQcPlan( String site, String item);
|
||||
|
||||
List<QmsProdQcPlan> findZProdQcPlanListByQcPlan( String site, String qcPlan, String revision );
|
||||
|
||||
void addZProdQcPlan( QmsProdQcPlan prod );
|
||||
|
||||
void deleteZProQcPlanByResrceIsNotNull( String site, String qcPlan, String revision );
|
||||
|
||||
void deleteZProQcPlanByWorkCenterIsNotNull( String site, String qcPlan, String revision );
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
package com.foreverwin.iep.qms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.foreverwin.iep.qms.entity.QmsQcPlanDetailFactor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检验计划明细-要因表
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-06-06 16:45:35
|
||||
*/
|
||||
public interface QmsQcPlanDetailFactorService extends IService<QmsQcPlanDetailFactor> {
|
||||
|
||||
List<QmsQcPlanDetailFactor> findZQcPlanDetailFactor( String qcPlanDetailBo );
|
||||
|
||||
void deleteZQcPlanDetailFactor( List<String> qcPlanDetailBoList );
|
||||
}
|
||||
@ -3,17 +3,12 @@ package com.foreverwin.iep.qms.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.foreverwin.iep.qms.entity.QmsQcPlanDetail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检验计划明细表
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-03-29 09:42:38
|
||||
* @date 2023-07-11 16:30:35
|
||||
*/
|
||||
public interface QmsQcPlanDetailService extends IService<QmsQcPlanDetail> {
|
||||
|
||||
List<QmsQcPlanDetail> findZQcPlanDetail( String qcPlanBo );
|
||||
|
||||
void deleteQmsQcPlanDetail( String qcPlanBo );
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package com.foreverwin.iep.qms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.foreverwin.iep.qms.domain.UserGroup;
|
||||
import com.foreverwin.iep.qms.entity.QmsQcPlan;
|
||||
import com.foreverwin.iep.qms.entity.QmsVwRouterCustom;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -10,19 +10,21 @@ import java.util.List;
|
||||
* 检验计划
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-06-06 16:43:15
|
||||
* @date 2023-07-11 16:28:57
|
||||
*/
|
||||
public interface QmsQcPlanService extends IService<QmsQcPlan> {
|
||||
|
||||
QmsQcPlan findQCPlan( String site, String qcPlan, String revision );
|
||||
QmsQcPlan getFullById(String handle);
|
||||
|
||||
void addQCPlan(QmsQcPlan qmsQcPlan);
|
||||
QmsQcPlan getCurrentFullById(String qcPlan);
|
||||
|
||||
void updateQCPlan(QmsQcPlan qmsQcPlan);
|
||||
void validateAndSave(QmsQcPlan qmsQcPlan);
|
||||
|
||||
void deleteQCPlan( String site, String qcPlan, String revision );
|
||||
void validateAndUpdate(QmsQcPlan qmsQcPlan);
|
||||
|
||||
List<QmsQcPlan> qcPlanImport( List<QmsQcPlan> qcPlanList );
|
||||
void validateAndDelete(String handle);
|
||||
|
||||
List<QmsVwRouterCustom> getQcRouter( String site );
|
||||
List<UserGroup> getUserGroup();
|
||||
|
||||
List<QmsQcPlan> getDistinctQcPlan();
|
||||
}
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
package com.foreverwin.iep.qms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.foreverwin.iep.qms.dto.QmsQcPlanTargetDTO;
|
||||
import com.foreverwin.iep.qms.entity.QmsQcPlanTarget;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检验计划使用对象
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-07-12 11:23:14
|
||||
*/
|
||||
public interface QmsQcPlanTargetService extends IService<QmsQcPlanTarget> {
|
||||
|
||||
List<QmsQcPlanTargetDTO> getByTargetBo(String targetBo);
|
||||
|
||||
boolean saveFullByTargetBo(String targetBo, List<QmsQcPlanTarget> qmsQcPlanTargetList);
|
||||
}
|
||||
@ -1,211 +0,0 @@
|
||||
package com.foreverwin.iep.qms.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.foreverwin.iep.common.utils.HandleBoProcessor;
|
||||
import com.foreverwin.iep.common.utils.SidUtils;
|
||||
import com.foreverwin.iep.prd.entity.Item;
|
||||
import com.foreverwin.iep.prd.entity.Operation;
|
||||
import com.foreverwin.iep.prd.entity.Router;
|
||||
import com.foreverwin.iep.prd.mapper.ItemMapper;
|
||||
import com.foreverwin.iep.prd.mapper.OperationMapper;
|
||||
import com.foreverwin.iep.prd.mapper.RouterMapper;
|
||||
import com.foreverwin.iep.qms.domain.ProdQcPlan;
|
||||
import com.foreverwin.iep.qms.entity.QmsProdQcPlan;
|
||||
import com.foreverwin.iep.qms.entity.QmsQcPlan;
|
||||
import com.foreverwin.iep.qms.entity.QmsVwItemRouterOperationQcPlan;
|
||||
import com.foreverwin.iep.qms.mapper.QmsProdQcPlanMapper;
|
||||
import com.foreverwin.iep.qms.mapper.QmsQcPlanMapper;
|
||||
import com.foreverwin.iep.qms.service.QmsProdQcPlanService;
|
||||
import com.foreverwin.iep.qms.service.QmsVwItemRouterOperationQcPlanService;
|
||||
import com.foreverwin.mom.common.core.exception.BusinessException;
|
||||
import com.foreverwin.mom.common.core.util.I18nUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 产品检验计划表
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-06-06 16:41:41
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class QmsProdQcPlanServiceImpl extends ServiceImpl<QmsProdQcPlanMapper, QmsProdQcPlan> implements QmsProdQcPlanService {
|
||||
|
||||
private QmsQcPlanMapper qmsQcPlanMapper;
|
||||
private ItemMapper itemMapper;
|
||||
private OperationMapper operationMapper;
|
||||
private RouterMapper routerMapper;
|
||||
private QmsVwItemRouterOperationQcPlanService qmsVwItemRouterOperationQcPlanService;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void addProdQcPlan( String site, String item, List<QmsProdQcPlan> list ) {
|
||||
List<QmsProdQcPlan> prodList = super.list(Wrappers.<QmsProdQcPlan>lambdaQuery()
|
||||
.eq(QmsProdQcPlan::getSite, site)
|
||||
.eq(QmsProdQcPlan::getItem, item));
|
||||
prodList.forEach(super::removeById);
|
||||
|
||||
|
||||
if (list.size() > 0) {
|
||||
list.forEach(prod -> {
|
||||
if (StrUtil.isNotBlank(prod.getQcPlan())) {
|
||||
List<String> qcList = Arrays.asList(prod.getQcPlan().split(","));
|
||||
|
||||
// 新增產品檢驗計畫
|
||||
qcList.forEach(qc -> {
|
||||
List<QmsQcPlan> qList = qmsQcPlanMapper.selectList(Wrappers.<QmsQcPlan>lambdaQuery()
|
||||
.eq(QmsQcPlan::getSite, prod.getSite())
|
||||
.eq(QmsQcPlan::getCurrentRevision, "true")
|
||||
.eq(QmsQcPlan::getQcPlan, qc));
|
||||
if (qList.size() == 0) {
|
||||
throw BusinessException.build(I18nUtil.getI18nText("qms.prod.qc.error1", prod.getOperation(), qc));
|
||||
}
|
||||
// 0: SFC
|
||||
String mode = qList.get(0).getQcMode();
|
||||
if (!mode.equals("0")) {
|
||||
throw BusinessException.build(I18nUtil.getI18nText("qms.prod.qc.error2", qc));
|
||||
}
|
||||
prod.setQcPlan(qc);
|
||||
addZProdQcPlan(prod);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProdQcPlan findItemRouterQcPlan( String site, String item ) {
|
||||
ProdQcPlan prodQcPlan = new ProdQcPlan();
|
||||
// find router
|
||||
Item itemObj = itemMapper.selectOne(Wrappers.<Item>lambdaQuery()
|
||||
.eq(Item::getSite, site)
|
||||
.eq(Item::getItem, item)
|
||||
.eq(Item::getCurrentRevision, "true"));
|
||||
if (itemObj == null) {
|
||||
throw BusinessException.build(I18nUtil.getI18nText("qms.prod.qc.plan"));
|
||||
}
|
||||
|
||||
String routerBo = itemObj.getRouterBo();
|
||||
if (StrUtil.isNotBlank(routerBo)) {
|
||||
|
||||
String router = HandleBoProcessor.trimHandle(routerBo);
|
||||
String routerVer = HandleBoProcessor.trimRevision(routerBo);
|
||||
Router routerObj;
|
||||
if (routerVer.equals("#")) {
|
||||
routerObj = routerMapper.selectOne(Wrappers.<Router>lambdaQuery()
|
||||
.eq(Router::getSite, site)
|
||||
.eq(Router::getRouter, router)
|
||||
.eq(Router::getCurrentRevision, "true"));
|
||||
} else {
|
||||
routerObj = routerMapper.selectById(routerBo);
|
||||
}
|
||||
if (routerObj != null) {
|
||||
// set router & desc & ver
|
||||
prodQcPlan.setRouter(routerObj.getRouter());
|
||||
prodQcPlan.setRouterVer(routerObj.getRevision());
|
||||
prodQcPlan.setRouterDesc(routerObj.getDescription());
|
||||
}
|
||||
}
|
||||
// set 產品檢驗計畫
|
||||
List<QmsVwItemRouterOperationQcPlan> qcList = qmsVwItemRouterOperationQcPlanService.list(Wrappers.<QmsVwItemRouterOperationQcPlan>lambdaQuery()
|
||||
.eq(QmsVwItemRouterOperationQcPlan::getSite, site)
|
||||
.eq(QmsVwItemRouterOperationQcPlan::getItem, item)
|
||||
.isNotNull(QmsVwItemRouterOperationQcPlan::getOperation))
|
||||
.stream()
|
||||
.filter(distinctByKey(QmsVwItemRouterOperationQcPlan::getOperation)).collect(Collectors.toList());
|
||||
prodQcPlan.setProdList(qcList);
|
||||
return prodQcPlan;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QmsProdQcPlan> findZProdQcPlanListByQcPlan( String site, String qcPlan, String revision ) {
|
||||
return super.list(Wrappers.<QmsProdQcPlan>lambdaQuery()
|
||||
.eq(QmsProdQcPlan::getSite, site)
|
||||
.eq(QmsProdQcPlan::getQcPlan, qcPlan)
|
||||
.eq(QmsProdQcPlan::getQcPlanRevision, revision)
|
||||
.isNull(QmsProdQcPlan::getItem)
|
||||
.isNull(QmsProdQcPlan::getOperation));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addZProdQcPlan( QmsProdQcPlan prod ) {
|
||||
String qcRevision = null;
|
||||
|
||||
if (StrUtil.isNotBlank(prod.getItem())) {
|
||||
if (!itemMapper.exists(Wrappers.<Item>lambdaQuery()
|
||||
.eq(Item::getSite, prod.getSite())
|
||||
.eq(Item::getItem, prod.getItem()))) {
|
||||
throw BusinessException.build(I18nUtil.getI18nText("qms.prod.item.not.found", prod.getItem()));
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(prod.getOperation())) {
|
||||
if (!operationMapper.exists(Wrappers.<Operation>lambdaQuery()
|
||||
.eq(Operation::getSite, prod.getSite())
|
||||
.eq(Operation::getOperation, prod.getOperation()))) {
|
||||
throw BusinessException.build(I18nUtil.getI18nText("qms.prod.operation.not.found", prod.getOperation()));
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(prod.getItem()) && StrUtil.isBlank(prod.getOperation())) {
|
||||
if (StrUtil.isBlank(prod.getQcPlanRevision())) {
|
||||
qcRevision = qmsQcPlanMapper.selectOne(Wrappers.<QmsQcPlan>lambdaQuery()
|
||||
.eq(QmsQcPlan::getSite, prod.getSite())
|
||||
.eq(QmsQcPlan::getCurrentRevision, "true")
|
||||
.eq(QmsQcPlan::getQcPlan, prod.getQcPlan())).getRevision();
|
||||
} else {
|
||||
qcRevision = prod.getQcPlanRevision();
|
||||
}
|
||||
}
|
||||
|
||||
prod.setSid(SidUtils.genSid());
|
||||
prod.setCreatedDateTime(LocalDateTime.now());
|
||||
prod.setQcPlanRevision(qcRevision);
|
||||
super.save(prod);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteZProQcPlanByResrceIsNotNull( String site, String qcPlan, String revision ) {
|
||||
super.remove(Wrappers.<QmsProdQcPlan>lambdaQuery()
|
||||
.eq(QmsProdQcPlan::getSite, site)
|
||||
.eq(QmsProdQcPlan::getQcPlan, qcPlan)
|
||||
.eq(QmsProdQcPlan::getQcPlanRevision, revision)
|
||||
.isNotNull(QmsProdQcPlan::getResrce)
|
||||
.isNull(QmsProdQcPlan::getItem)
|
||||
.isNull(QmsProdQcPlan::getOperation)
|
||||
.isNull(QmsProdQcPlan::getWorkCenter)
|
||||
.isNull(QmsProdQcPlan::getMaterialNo));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteZProQcPlanByWorkCenterIsNotNull( String site, String qcPlan, String revision ) {
|
||||
super.remove(Wrappers.<QmsProdQcPlan>lambdaQuery()
|
||||
.eq(QmsProdQcPlan::getSite, site)
|
||||
.eq(QmsProdQcPlan::getQcPlan, qcPlan)
|
||||
.eq(QmsProdQcPlan::getQcPlanRevision, revision)
|
||||
.isNotNull(QmsProdQcPlan::getWorkCenter)
|
||||
.isNull(QmsProdQcPlan::getItem)
|
||||
.isNull(QmsProdQcPlan::getOperation)
|
||||
.isNull(QmsProdQcPlan::getResrce)
|
||||
.isNull(QmsProdQcPlan::getMaterialNo));
|
||||
}
|
||||
|
||||
private <T> Predicate<T> distinctByKey( Function<? super T, ?> keyExtractor) {
|
||||
Set<Object> seen = ConcurrentHashMap.newKeySet();
|
||||
return (t) -> {
|
||||
return seen.add(keyExtractor.apply(t));
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -1,31 +0,0 @@
|
||||
package com.foreverwin.iep.qms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.foreverwin.iep.qms.entity.QmsQcPlanDetailFactor;
|
||||
import com.foreverwin.iep.qms.mapper.QmsQcPlanDetailFactorMapper;
|
||||
import com.foreverwin.iep.qms.service.QmsQcPlanDetailFactorService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检验计划明细-要因表
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-06-06 16:45:35
|
||||
*/
|
||||
@Service
|
||||
public class QmsQcPlanDetailFactorServiceImpl extends ServiceImpl<QmsQcPlanDetailFactorMapper, QmsQcPlanDetailFactor> implements QmsQcPlanDetailFactorService {
|
||||
|
||||
@Override
|
||||
public List<QmsQcPlanDetailFactor> findZQcPlanDetailFactor( String qcPlanDetailBo ) {
|
||||
return super.list(Wrappers.<QmsQcPlanDetailFactor>lambdaQuery()
|
||||
.eq(QmsQcPlanDetailFactor::getQcPlanDetailBo, qcPlanDetailBo));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteZQcPlanDetailFactor( List<String> qcPlanDetailBoList ) {
|
||||
super.remove(Wrappers.<QmsQcPlanDetailFactor>lambdaQuery().in(QmsQcPlanDetailFactor::getQcPlanDetailBo, qcPlanDetailBoList));
|
||||
}
|
||||
}
|
||||
@ -1,35 +1,18 @@
|
||||
package com.foreverwin.iep.qms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.foreverwin.iep.qms.entity.QmsQcPlanDetail;
|
||||
import com.foreverwin.iep.qms.mapper.QmsQcPlanDetailMapper;
|
||||
import com.foreverwin.iep.qms.service.QmsQcPlanDetailService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检验计划明细表
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-03-29 09:42:38
|
||||
* @date 2023-07-11 16:30:35
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class QmsQcPlanDetailServiceImpl extends ServiceImpl<QmsQcPlanDetailMapper, QmsQcPlanDetail> implements QmsQcPlanDetailService {
|
||||
|
||||
@Override
|
||||
public List<QmsQcPlanDetail> findZQcPlanDetail( String qcPlanBo ) {
|
||||
return super.list(Wrappers.<QmsQcPlanDetail>query()
|
||||
.eq("qcPlanBo", qcPlanBo)
|
||||
.orderByAsc(" CONVERT(seq,SIGNED) "));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteQmsQcPlanDetail( String qcPlanBo ) {
|
||||
super.remove(Wrappers.<QmsQcPlanDetail>lambdaQuery()
|
||||
.eq(QmsQcPlanDetail::getQcPlanBo,qcPlanBo));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,598 +1,157 @@
|
||||
package com.foreverwin.iep.qms.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.foreverwin.iep.prd.mapper.RouterMapper;
|
||||
import com.foreverwin.iep.production.mapper.WorkCenterMapper;
|
||||
import com.foreverwin.iep.qms.entity.QmsInspecJob;
|
||||
import com.foreverwin.iep.qms.entity.QmsQcPlan;
|
||||
import com.foreverwin.iep.qms.entity.QmsQcPlanDetail;
|
||||
import com.foreverwin.iep.qms.entity.QmsVwRouterCustom;
|
||||
import com.foreverwin.iep.qms.mapper.QmsInspecJobMapper;
|
||||
import com.foreverwin.iep.qms.domain.UserGroup;
|
||||
import com.foreverwin.iep.qms.entity.*;
|
||||
import com.foreverwin.iep.qms.mapper.QmsQcPlanDetailMapper;
|
||||
import com.foreverwin.iep.qms.mapper.QmsQcPlanMapper;
|
||||
import com.foreverwin.iep.qms.service.*;
|
||||
import com.foreverwin.iep.smd.mapper.ResrceMapper;
|
||||
import com.foreverwin.mom.common.core.exception.BusinessException;
|
||||
import com.foreverwin.mom.common.core.util.I18nUtil;
|
||||
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
|
||||
import com.foreverwin.mom.common.security.util.SecurityUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 检验计划
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-06-06 16:43:15
|
||||
* @date 2023-07-11 16:28:57
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class QmsQcPlanServiceImpl extends ServiceImpl<QmsQcPlanMapper, QmsQcPlan> implements QmsQcPlanService {
|
||||
|
||||
private final QmsQcPlanDetailService qmsQcPlanDetailService;
|
||||
private final QmsQcPlanDetailFactorService qmsQcPlanDetailFactorService;
|
||||
private final QmsInspecFreqService qmsInspecFreqService;
|
||||
private final QmsProdQcPlanService qmsProdQcPlanService;
|
||||
private final QmsQcItemService qmsQcItemService;
|
||||
private final QmsFactorService qmsFactorService;
|
||||
private final QmsSamplePlanService qmsSamplePlanService;
|
||||
private final QmsInspecJobMapper qmsInspecJobMapper;
|
||||
private final RouterMapper routerMapper;
|
||||
private final ResrceMapper resrceMapper;
|
||||
private final WorkCenterMapper workCenterMapper;
|
||||
private final QmsVwRouterCustomService qmsVwRouterCustomService;
|
||||
|
||||
@Override
|
||||
public QmsQcPlan findQCPlan(String site, String qcPlan, String revision) {
|
||||
// QmsQcPlan qcPlanBase;
|
||||
// if (StrUtil.isNotBlank(revision)) {
|
||||
// qcPlanBase = this.findCurrQc(site, qcPlan);
|
||||
// } else {
|
||||
// qcPlanBase = super.getById(QmsQcPlan.genHandle(site, qcPlan, revision));
|
||||
// }
|
||||
//
|
||||
// if (qcPlanBase == null) {
|
||||
// if (StrUtil.isBlank(revision)) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.not.found"));
|
||||
// }
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.error1", qcPlan, revision));
|
||||
// }
|
||||
// List<QmsQcPlanDetail> qmsQcPlanDetails = qmsQcPlanDetailService.findZQcPlanDetail(qcPlanBase.getHandle());
|
||||
//
|
||||
// List<QmsQcPlanDetailDTO> qcPlanDetailList = qmsQcPlanDetails.stream().map(detail->{
|
||||
// QmsQcPlanDetailDTO dto = new QmsQcPlanDetailDTO();
|
||||
// BeanUtils.copyProperties(detail , dto);
|
||||
// return dto;
|
||||
// }).collect(Collectors.toList());
|
||||
//
|
||||
// qcPlanBase.setQcPlanDetailList(qcPlanDetailList.stream()
|
||||
// .peek(obj -> {
|
||||
// String qcItemSid = obj.getQcItemSid();
|
||||
// String samplePlanBo = obj.getSamplePlanBo();
|
||||
// String qcRoutingBo = obj.getQcRoutingBo();
|
||||
// // 檢驗項目
|
||||
// if (!"NA".equals(qcItemSid)) {
|
||||
// QmsQcItem qmsQcItem = qmsQcItemService.getById(qcItemSid);
|
||||
// if (qmsQcItem != null && StrUtil.isNotBlank(qmsQcItem.getSid())) {
|
||||
// obj.setQcItem(qmsQcItem.getQcItem());
|
||||
// obj.setQcItemDesc(qmsQcItem.getDescription());
|
||||
// obj.setQcItemStatus(qmsQcItem.getStatus());
|
||||
// obj.setItemType(qmsQcItem.getItemType());
|
||||
// obj.setControlMode(qmsQcItem.getControlMode());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 抽樣計畫
|
||||
// if (StrUtil.isNotBlank(samplePlanBo)) {
|
||||
// List<String> samples = Arrays.asList(samplePlanBo.split(","));
|
||||
// obj.setSamplePlan(samples.get(1));
|
||||
// }
|
||||
//
|
||||
// if (StrUtil.isNotBlank(qcRoutingBo)) {
|
||||
// Router router = routerMapper.selectById(qcRoutingBo);
|
||||
// if (router != null) {
|
||||
// obj.setRouter(router.getRouter());
|
||||
// obj.setRouterDescription(router.getDescription());
|
||||
// }
|
||||
// }
|
||||
// }).collect(Collectors.toList()));
|
||||
//
|
||||
// for (QmsQcPlanDetail detail : qcPlanBase.getQcPlanDetailList()) {
|
||||
// detail.setQcPlanDetailFactorList(qmsQcPlanDetailFactorService.findZQcPlanDetailFactor(detail.getHandle()));
|
||||
// }
|
||||
//
|
||||
// List<QmsProdQcPlan> zProdQcPlanList = qmsProdQcPlanService.findZProdQcPlanListByQcPlan(qcPlanBase.getSite(), qcPlanBase.getQcPlan(), qcPlanBase.getRevision());
|
||||
// for (QmsProdQcPlan prodQcPlan : zProdQcPlanList) {
|
||||
// if (StrUtil.isNotBlank(prodQcPlan.getWorkCenter()) && StrUtil.isBlank(prodQcPlan.getResrce())) {
|
||||
// qcPlanBase.getWorkCenterList().add(prodQcPlan);
|
||||
// }
|
||||
// if (StrUtil.isNotBlank((prodQcPlan.getResrce())) && StrUtil.isBlank(prodQcPlan.getWorkCenter())) {
|
||||
// qcPlanBase.getResourceList().add(prodQcPlan);
|
||||
// }
|
||||
// if (StrUtil.isNotBlank(prodQcPlan.getMaterialNo())) {
|
||||
// qcPlanBase.getItemList().add(prodQcPlan);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 是否開立檢驗任務 true:已開立 false:無
|
||||
// qcPlanBase.setCreateJob(qmsInspecJobMapper.exists(Wrappers.<QmsInspecJob>lambdaQuery()
|
||||
// .eq(QmsInspecJob::getSite, site)
|
||||
// .eq(QmsInspecJob::getQcPlan, qcPlan)
|
||||
// .eq(QmsInspecJob::getQcPlanRevision, revision)));
|
||||
//
|
||||
// return qcPlanBase;
|
||||
return null;
|
||||
private QmsQcPlanDetailService qmsQcPlanDetailService;
|
||||
private QmsInspecFreqService qmsInspecFreqService;
|
||||
private QmsQcPlanDetailMapper qmsQcPlanDetailMapper;
|
||||
private QmsInspecJobService getQmsInspecJobService() {
|
||||
return SpringUtil.getBean(QmsInspecJobService.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void addQCPlan(QmsQcPlan qcPlan) {
|
||||
// String site = TenantContextHolder.getTenantId();
|
||||
// String qcPlanBo = QmsQcPlan.genHandle(site, qcPlan.getQcPlan(), qcPlan.getRevision());
|
||||
// qcPlan.setHandle(qcPlanBo);
|
||||
//
|
||||
// if(super.getById(qcPlanBo) != null){
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.existed"));
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if (StrUtil.isNotBlank(qcPlan.getInspecNo()) && qmsInspecFreqService.findInspec(site, qcPlan.getInspecNo()).size() == 0) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.inspec.freq.not.found", qcPlan.getInspecNo()));
|
||||
// }
|
||||
//
|
||||
//// if (!FwUtils.isNullOrEmpty(qcPlan.getUserGroup()) && FwUtils.objIsEmpty(userRepository.findUserGroup(site, qcPlan.getUserGroup()))) {
|
||||
//// FwUtils.getCustomException("qms.qc.plan.user.group.not.found", new Object[]{ qcPlan.getUserGroup() });
|
||||
//// } else {
|
||||
//// if ("1".equals(qcPlan.getQcType())) {
|
||||
//// if (FwUtils.isEmpty(userRepository.findGroupByCustom(site, qcPlan.getUserGroup(), "QMS_GROUP", "QC"))) {
|
||||
//// FwUtils.getCustomException("qms.qc.plan.user.group.not.is.this.type", new Object[]{ qcPlan.getUserGroup(), "QC" });
|
||||
//// }
|
||||
//// } else {
|
||||
//// if (FwUtils.isEmpty(userRepository.findGroupByCustom(site, qcPlan.getUserGroup(), "QMS_GROUP", "OP"))) {
|
||||
//// FwUtils.getCustomException("qms.qc.plan.user.group.not.is.this.type", new Object[]{ qcPlan.getUserGroup(), "OP" });
|
||||
//// }
|
||||
//// }
|
||||
//// }
|
||||
//
|
||||
// if ("true".equals(qcPlan.getCurrentRevision())) {
|
||||
// // 如勾選當前版本,把以前的計畫更新為舊版本
|
||||
// QmsQcPlan qmsQcPlan = findCurrQc(site, qcPlan.getQcPlan());
|
||||
// if(qmsQcPlan != null){
|
||||
// qmsQcPlan.setCurrentRevision("false");
|
||||
// super.removeById(qmsQcPlan.getHandle());
|
||||
// super.save(qmsQcPlan);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// qcPlan.setToSpc(qcPlan.getToSpc());
|
||||
// qcPlan.setCreatedDateTime(LocalDateTime.now());
|
||||
// if (StrUtil.isBlank(qcPlan.getCheckOutControl())) {
|
||||
// qcPlan.setCheckOutControl(null);
|
||||
// }
|
||||
// super.save(qcPlan);
|
||||
//
|
||||
// qcPlan.getQcPlanDetailList().forEach(detail -> {
|
||||
// detail.setHandle(QmsQcPlanDetail.genHandle(qcPlanBo, detail.getSeq()));
|
||||
// detail.setQcPlanBo(qcPlan.getHandle());
|
||||
// if (StrUtil.isBlank(detail.getSamplePlanBo())) {
|
||||
// detail.setSamplePlanBo(null);
|
||||
// }
|
||||
// if (StrUtil.isNotBlank(detail.getQcRoutingBo())) {
|
||||
// detail.setQcItemSid("NA");
|
||||
// }
|
||||
// qmsQcPlanDetailService.save(detail);
|
||||
//
|
||||
// if(StrUtil.isNotBlank(detail.getQcRoutingBo())){
|
||||
// detail.getQcPlanDetailFactorList().forEach(factor -> {
|
||||
// factor.setSid(SidUtils.genSid());
|
||||
// factor.setQcPlanDetailBo(detail.getHandle());
|
||||
// qmsQcPlanDetailFactorService.save(factor);
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// if ("1".equals(qcPlan.getQcMode())) {
|
||||
// for (QmsProdQcPlan prodQcPlan : qcPlan.getResourceList()) {
|
||||
// qmsProdQcPlanService.addZProdQcPlan(prodQcPlan);
|
||||
// }
|
||||
// } else if ("2".equals(qcPlan.getQcMode())) {
|
||||
// for (QmsProdQcPlan prodQcPlan : qcPlan.getWorkCenterList()) {
|
||||
// qmsProdQcPlanService.addZProdQcPlan(prodQcPlan);
|
||||
// }
|
||||
// }
|
||||
public QmsQcPlan getFullById( String handle ) {
|
||||
|
||||
QmsQcPlan qcPlan = super.getById(handle);
|
||||
|
||||
QmsInspecFreq inspecFreq = qmsInspecFreqService.getById(qcPlan.getInspecFreqBo());
|
||||
|
||||
qcPlan.setInspecFreqNo(inspecFreq.getInspecNo());
|
||||
qcPlan.setInspecFreqDesc(inspecFreq.getDescription());
|
||||
|
||||
qcPlan.setQcPlanDetailList(qmsQcPlanDetailMapper.getFullDetailByQcPlanBo(handle));
|
||||
|
||||
return qcPlan;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateQCPlan(QmsQcPlan qcPlan) {
|
||||
// String site = TenantContextHolder.getTenantId();
|
||||
// String qcPlanBo = QmsQcPlan.genHandle(site, qcPlan.getQcPlan(), qcPlan.getRevision());
|
||||
// qcPlan.setHandle(qcPlanBo);
|
||||
//
|
||||
//// if (!FwUtils.isNullOrEmpty(qcPlan.getUserGroup()) && FwUtils.objIsEmpty(userRepository.findUserGroup(site, qcPlan.getUserGroup()))) {
|
||||
//// FwUtils.getCustomException("qms.qc.plan.user.group.not.found", new Object[]{ qcPlan.getUserGroup() });
|
||||
//// } else {
|
||||
//// if ("1".equals(qcPlan.getQcType())) {
|
||||
//// if (FwUtils.isEmpty(userRepository.findGroupByCustom(site, qcPlan.getUserGroup(), "QMS_GROUP", "QC"))) {
|
||||
//// FwUtils.getCustomException("qms.qc.plan.user.group.not.is.this.type", new Object[]{ qcPlan.getUserGroup(), "QC" });
|
||||
//// }
|
||||
//// } else {
|
||||
//// if (FwUtils.isEmpty(userRepository.findGroupByCustom(site, qcPlan.getUserGroup(), "QMS_GROUP", "OP"))) {
|
||||
//// FwUtils.getCustomException("qms.qc.plan.user.group.not.is.this.type", new Object[]{ qcPlan.getUserGroup(), "OP" });
|
||||
//// }
|
||||
//// }
|
||||
//// }
|
||||
//
|
||||
// if (StrUtil.isNotBlank(qcPlan.getInspecNo()) && qmsInspecFreqService.findInspec(site, qcPlan.getInspecNo()).size() == 0) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.inspec.freq.not.found", qcPlan.getInspecNo()));
|
||||
// }
|
||||
//
|
||||
// if ("true".equals(qcPlan.getCurrentRevision())) {
|
||||
// // 如勾選當前版本,把以前的計畫更新為舊版本
|
||||
// QmsQcPlan qmsQcPlan = findCurrQc(site, qcPlan.getQcPlan());
|
||||
// if(qmsQcPlan != null){
|
||||
// qmsQcPlan.setCurrentRevision("false");
|
||||
// super.removeById(qmsQcPlan.getHandle());
|
||||
// super.save(qmsQcPlan);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// super.removeById(qcPlanBo);
|
||||
// if (StrUtil.isBlank(qcPlan.getCheckOutControl())) {
|
||||
// qcPlan.setCheckOutControl(null);
|
||||
// }
|
||||
// qcPlan.setCreatedDateTime(LocalDateTime.now());
|
||||
// qcPlan.setModifiedDateTime(LocalDateTime.now());
|
||||
// qcPlan.setModifiedUser(qcPlan.getCreatedUser());
|
||||
// super.save(qcPlan);
|
||||
//
|
||||
// List<QmsQcPlanDetail> oriDetails = qmsQcPlanDetailService.findZQcPlanDetail(qcPlanBo);
|
||||
// qmsQcPlanDetailService.deleteQmsQcPlanDetail(qcPlanBo);
|
||||
//
|
||||
// qcPlan.getQcPlanDetailList().forEach(detail -> {
|
||||
// detail.setHandle(QmsQcPlanDetail.genHandle(qcPlanBo, detail.getSeq()));
|
||||
// detail.setQcPlanBo(qcPlan.getHandle());
|
||||
// if (StrUtil.isBlank(detail.getSamplePlanBo())) {
|
||||
// detail.setSamplePlanBo(null);
|
||||
// }
|
||||
// if (StrUtil.isNotBlank(detail.getQcRoutingBo())) {
|
||||
// detail.setQcItemSid("NA");
|
||||
// }
|
||||
// qmsQcPlanDetailService.save(detail);
|
||||
// });
|
||||
//
|
||||
// qmsQcPlanDetailFactorService.deleteZQcPlanDetailFactor((oriDetails.stream()
|
||||
// .map(QmsQcPlanDetail::getHandle)
|
||||
// .collect(Collectors.toList())));
|
||||
//
|
||||
// qcPlan.getQcPlanDetailList().forEach(qcPlanDetail -> {
|
||||
// if (StrUtil.isNotBlank(qcPlanDetail.getQcRoutingBo())) {
|
||||
// qcPlanDetail.getQcPlanDetailFactorList().forEach(factor -> {
|
||||
// factor.setSid(SidUtils.genSid());
|
||||
// factor.setQcPlanDetailBo(qcPlanDetail.getHandle());
|
||||
// qmsQcPlanDetailFactorService.save(factor);
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// // 刪除
|
||||
// qmsProdQcPlanService.deleteZProQcPlanByResrceIsNotNull(site, qcPlan.getQcPlan(), qcPlan.getRevision());
|
||||
// qmsProdQcPlanService.deleteZProQcPlanByWorkCenterIsNotNull(site, qcPlan.getQcPlan(), qcPlan.getRevision());
|
||||
//
|
||||
// if ("1".equals(qcPlan.getQcMode())) {
|
||||
// for (QmsProdQcPlan zProdQcPlan : qcPlan.getResourceList()) {
|
||||
// qmsProdQcPlanService.addZProdQcPlan(zProdQcPlan);
|
||||
// }
|
||||
// } else if ("2".equals(qcPlan.getQcMode())) {
|
||||
// for (QmsProdQcPlan zProdQcPlan : qcPlan.getWorkCenterList()) {
|
||||
// qmsProdQcPlanService.addZProdQcPlan(zProdQcPlan);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void deleteQCPlan(String site, String qcPlan, String revision) {
|
||||
if (!qmsInspecJobMapper.exists(Wrappers.<QmsInspecJob>lambdaQuery()
|
||||
.eq(QmsInspecJob::getSite, site)
|
||||
.eq(QmsInspecJob::getQcPlan, qcPlan)
|
||||
.eq(QmsInspecJob::getQcPlanRevision, revision))) {
|
||||
String handle = QmsQcPlan.genHandle(site, qcPlan, revision);
|
||||
super.removeById(handle);
|
||||
|
||||
List<QmsQcPlanDetail> zQcPlanDetailList = qmsQcPlanDetailService.list(Wrappers.<QmsQcPlanDetail>lambdaQuery()
|
||||
.eq(QmsQcPlanDetail::getQcPlanBo, handle));
|
||||
qmsQcPlanDetailService.remove(Wrappers.<QmsQcPlanDetail>lambdaQuery()
|
||||
.eq(QmsQcPlanDetail::getQcPlanBo, handle));
|
||||
qmsQcPlanDetailFactorService.deleteZQcPlanDetailFactor(zQcPlanDetailList.stream()
|
||||
.map(QmsQcPlanDetail::getHandle)
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
qmsProdQcPlanService.deleteZProQcPlanByResrceIsNotNull(site, qcPlan, revision);
|
||||
qmsProdQcPlanService.deleteZProQcPlanByWorkCenterIsNotNull(site, qcPlan, revision);
|
||||
} else {
|
||||
throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.qc.plan.used.not.delete"));
|
||||
public QmsQcPlan getCurrentFullById( String qcPlan ) {
|
||||
QmsQcPlan qmsQcPlan = super.getOne(Wrappers.<QmsQcPlan>lambdaQuery()
|
||||
.eq(QmsQcPlan::getSite, TenantContextHolder.getTenantId())
|
||||
.eq(QmsQcPlan::getQcPlan, qcPlan));
|
||||
if(qmsQcPlan == null){
|
||||
throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.error3", qcPlan));
|
||||
}else {
|
||||
return this.getFullById(qmsQcPlan.getHandle());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public List<QmsQcPlan> qcPlanImport(List<QmsQcPlan> qcPlanList) {
|
||||
// if (qcPlanList == null || qcPlanList.size() == 0) {
|
||||
// return new ArrayList<>();
|
||||
// }
|
||||
//
|
||||
// List<QmsFactor> factors = qmsFactorService.findFactorList(qcPlanList.get(0).getSite()).stream()
|
||||
// .filter(f -> "true".equals(f.getIsDefault()))
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// for (QmsQcPlan qcPlan : qcPlanList) {
|
||||
// String site = qcPlan.getSite();
|
||||
// String plan = qcPlan.getQcPlan();
|
||||
// String revision = qcPlan.getRevision();
|
||||
// String qcPlanBo = QmsQcPlan.genHandle(site, plan, revision);
|
||||
// String qcMode = qcPlan.getQcMode();
|
||||
//
|
||||
// if (super.getById(qcPlanBo) != null) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error8", plan, revision));
|
||||
// }
|
||||
//
|
||||
// qcPlan.setHandle(qcPlanBo);
|
||||
// qcPlan.setCreatedDateTime(LocalDateTime.now());
|
||||
//
|
||||
// if (qcPlan.getQcPlanDetailList() == null || qcPlan.getQcPlanDetailList().size() == 0) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.format.detail.null"));
|
||||
// }
|
||||
//
|
||||
// // 檢驗類型
|
||||
// switch (qcMode) {
|
||||
// case "0":
|
||||
// // 檢查頻率
|
||||
// String inspecNo = qcPlan.getInspecNo();
|
||||
//
|
||||
// if (StrUtil.isBlank(inspecNo)) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error16", plan));
|
||||
// }
|
||||
//
|
||||
// List<QmsInspecFreq> qmsInspecFreqList = qmsInspecFreqService.findInspec(site, inspecNo);
|
||||
// if (qmsInspecFreqList.size() == 0) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error17", plan, inspecNo));
|
||||
// }
|
||||
// break;
|
||||
// case "1":
|
||||
// // 檢查資源
|
||||
// if (qcPlan.getResourceList() == null || qcPlan.getResourceList().size() == 0) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error18", plan));
|
||||
// }
|
||||
//
|
||||
// qcPlan.getResourceList().forEach(resource -> {
|
||||
// if (resrceMapper.selectById(Resrce.genHandle(site, resource.getResrce())) == null) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error3", plan));
|
||||
// }
|
||||
// });
|
||||
// break;
|
||||
// case "2":
|
||||
// // 檢查工作中心
|
||||
// if (qcPlan.getWorkCenterList() == null || qcPlan.getWorkCenterList().size() == 0) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error19", plan));
|
||||
// }
|
||||
//
|
||||
// qcPlan.getWorkCenterList().forEach(workCenter -> {
|
||||
// if (workCenterMapper.selectById(WorkCenter.genHandle(site, workCenter.getWorkCenter())) == null) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error2", plan));
|
||||
// }
|
||||
// });
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// for (QmsQcPlanDetailDTO qcPlanDetail : qcPlan.getQcPlanDetailList()) {
|
||||
// String qcItem = qcPlanDetail.getQcItem();
|
||||
// String router = qcPlanDetail.getRouter();
|
||||
//
|
||||
// if (StrUtil.isNotBlank(qcItem)) {
|
||||
// // 檢查檢驗項目
|
||||
// QmsQcItem qmsQcItem = qmsQcItemService.getOne(site, qcItem);
|
||||
// if (qmsQcItem == null) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error4", plan, qcItem));
|
||||
// }
|
||||
// qcPlanDetail.setQcItemSid(qmsQcItem.getSid());
|
||||
//
|
||||
// // 檢查計量、內文
|
||||
// BigDecimal centerValue = qcPlanDetail.getCenterValue();
|
||||
// BigDecimal maxValue = qcPlanDetail.getMaxValue();
|
||||
// BigDecimal minValue = qcPlanDetail.getMinValue();
|
||||
// String controlMode = qmsQcItem.getControlMode();
|
||||
// String itemType = qmsQcItem.getItemType();
|
||||
// switch (itemType) {
|
||||
// case "0":
|
||||
// //計數
|
||||
// qcPlanDetail.setMaxValue(null);
|
||||
// qcPlanDetail.setMinValue(null);
|
||||
// qcPlanDetail.setCenterValue(null);
|
||||
// qcPlanDetail.setContent(null);
|
||||
// if ("1".equals(qcPlan.getToSpc())) {
|
||||
// if (qcPlanDetail.getSampleSizeSpc() != null) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error25", plan, qcItem));
|
||||
// }
|
||||
// if (StrUtil.isNotBlank(qcPlanDetail.getChartControl())) {
|
||||
// if (!Arrays.asList("U-CHART", "P-CHART").contains(qcPlanDetail.getChartControl())) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error27", plan, qcItem));
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// qcPlanDetail.setSampleSizeSpc(null);
|
||||
// qcPlanDetail.setChartControl(null);
|
||||
// }
|
||||
// break;
|
||||
// case "1":
|
||||
// //計量
|
||||
// if (qcPlanDetail.getMeasurementPoints() == null) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error9", plan, qcItem));
|
||||
// }
|
||||
//
|
||||
// if (maxValue == null) {
|
||||
// // 上限&雙邊管制
|
||||
// if (!controlMode.equals("1")) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error11", plan, qcItem));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (minValue == null) {
|
||||
// // 下限&雙邊管制
|
||||
// if (!controlMode.equals("0")) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error12", plan, qcItem));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (centerValue != null) {
|
||||
// // 檢查中心
|
||||
// if (!controlMode.equals("1")) {
|
||||
// if (centerValue.compareTo(maxValue) > 0) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error13", plan, qcItem));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (!controlMode.equals("0")) {
|
||||
// if (centerValue.compareTo(minValue) < 0) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error14", plan, qcItem));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (controlMode.equals("2")) {
|
||||
// if (maxValue.compareTo(minValue) < 0) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error15", plan, qcItem));
|
||||
// }
|
||||
// } else if (controlMode.equals("1")) {
|
||||
// qcPlanDetail.setMaxValue(null);
|
||||
// } else if (controlMode.equals("0")) {
|
||||
// qcPlanDetail.setMinValue(null);
|
||||
// }
|
||||
//
|
||||
// if ("1".equals(qcPlan.getToSpc())) {
|
||||
// if (qcPlanDetail.getSampleSizeSpc() != null || StrUtil.isNotBlank(qcPlanDetail.getChartControl())) {
|
||||
// if (qcPlanDetail.getSampleSizeSpc() == null) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error21", plan, qcItem));
|
||||
// }
|
||||
// if (qcPlanDetail.getSampleSizeSpc().compareTo(BigDecimal.ZERO) <= 0 ||
|
||||
// qcPlanDetail.getSampleSizeSpc().subtract(new BigDecimal(qcPlanDetail.getSampleSizeSpc().intValue())).compareTo(BigDecimal.ZERO) > 0) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error22", plan, qcItem));
|
||||
// }
|
||||
// if (StrUtil.isBlank(qcPlanDetail.getChartControl())) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error23", plan, qcItem));
|
||||
// } else {
|
||||
// if (!Arrays.asList("XBAR-R", "XBAR-S", "X-RM").contains(qcPlanDetail.getChartControl())) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error24", plan, qcItem));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// qcPlanDetail.setSampleSizeSpc(null);
|
||||
// qcPlanDetail.setChartControl(null);
|
||||
// }
|
||||
// break;
|
||||
// case "2":
|
||||
// //內文
|
||||
// qcPlanDetail.setMeasurementPoints(null);
|
||||
// qcPlanDetail.setMaxValue(null);
|
||||
// qcPlanDetail.setMinValue(null);
|
||||
// qcPlanDetail.setCenterValue(null);
|
||||
// if (StrUtil.isBlank(qcPlanDetail.getContent())) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error6", plan, qcItem));
|
||||
// }
|
||||
//
|
||||
// if ("1".equals(qcPlan.getToSpc())) {
|
||||
// if (qcPlanDetail.getSampleSizeSpc() != null) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error28", plan, qcItem));
|
||||
// }
|
||||
// if (StrUtil.isNotBlank(qcPlanDetail.getChartControl())) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error29", plan, qcItem));
|
||||
// }
|
||||
// } else {
|
||||
// qcPlanDetail.setSampleSizeSpc(null);
|
||||
// qcPlanDetail.setChartControl(null);
|
||||
// }
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// // 檢查抽樣計畫
|
||||
// String samplePlan = qcPlanDetail.getSamplePlan();
|
||||
// if ("0".equals(qcMode) || "3".equals(qcMode)) {
|
||||
// if (itemType.equals("0") || itemType.equals("1")) {
|
||||
// if (StrUtil.isBlank(samplePlan)) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error10", plan, qcItem));
|
||||
// }
|
||||
//
|
||||
// QmsSamplePlan qmsSamplePlan = qmsSamplePlanService.getSamplePlan(site, samplePlan);
|
||||
// if (qmsSamplePlan == null) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error7", plan, qcItem));
|
||||
// }
|
||||
// qcPlanDetail.setSamplePlanBo(qmsSamplePlan.getHandle());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// List<QmsQcPlanDetailFactor> qcPlanDetailFactors = qcPlanDetail.getQcPlanDetailFactorList();
|
||||
// // 必要要因
|
||||
// factors.forEach(factor -> {
|
||||
// String handle = factor.getHandle();
|
||||
//
|
||||
// List<QmsQcPlanDetailFactor> detailFactors = qcPlanDetailFactors.stream()
|
||||
// .filter(f -> f.getFactorBo().equals(handle))
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// if (detailFactors.size() == 0) {
|
||||
// QmsQcPlanDetailFactor qmsQcPlanDetailFactor = new QmsQcPlanDetailFactor();
|
||||
// qmsQcPlanDetailFactor.setFactorBo(handle);
|
||||
// qcPlanDetailFactors.add(qmsQcPlanDetailFactor);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// qcPlanDetailFactors.forEach(zQcPlanDetailFactor -> {
|
||||
// zQcPlanDetailFactor.setSid(SidUtils.genSid());
|
||||
// zQcPlanDetailFactor.setQcPlanDetailBo(qcPlanDetail.getHandle());
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// if (StrUtil.isNotBlank(router)) {
|
||||
// List<Router> routerList = routerMapper.selectList(Wrappers.<Router>lambdaQuery()
|
||||
// .eq(Router::getSite, TenantContextHolder.getTenantId())
|
||||
// .eq(Router::getCurrentRevision, "true")
|
||||
// .eq(Router::getRouter, router));
|
||||
// if (routerList.size() == 0) {
|
||||
// throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.import.error30", plan, router));
|
||||
// }
|
||||
// Router routerInfo = routerList.get(0);
|
||||
// qcPlanDetail.setQcRoutingBo(routerInfo.getHandle());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
public void validateAndSave( QmsQcPlan qmsQcPlan ) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
qmsQcPlan.setHandle(QmsQcPlan.genHandle(site, qmsQcPlan.getQcPlan(), qmsQcPlan.getRevision()));
|
||||
if(super.baseMapper.exists(Wrappers.<QmsQcPlan>lambdaQuery()
|
||||
.eq(QmsQcPlan::getHandle, qmsQcPlan.getHandle()))){
|
||||
throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.error1", qmsQcPlan.getQcPlan(), qmsQcPlan.getRevision()));
|
||||
}
|
||||
|
||||
// List<QmsQcPlan> response = new ArrayList<>();
|
||||
// for (QmsQcPlan qcPlan : qcPlanList) {
|
||||
// addQCPlan(qcPlan);
|
||||
// response.add(qcPlan);
|
||||
// }
|
||||
return null;
|
||||
qmsQcPlan.setDateCreate(LocalDateTime.now());
|
||||
qmsQcPlan.setCreator(SecurityUtils.getUserName());
|
||||
|
||||
if("Y".equals(qmsQcPlan.getCurrentRevision())){
|
||||
super.update(Wrappers.<QmsQcPlan>lambdaUpdate()
|
||||
.eq(QmsQcPlan::getSite, site)
|
||||
.eq(QmsQcPlan::getQcPlan, qmsQcPlan.getQcPlan())
|
||||
.set(QmsQcPlan::getCurrentRevision, "N"));
|
||||
}
|
||||
|
||||
super.save(qmsQcPlan);
|
||||
|
||||
qmsQcPlanDetailService.remove(Wrappers.<QmsQcPlanDetail>lambdaQuery()
|
||||
.eq(QmsQcPlanDetail::getQcPlanBo, qmsQcPlan.getHandle()));
|
||||
|
||||
qmsQcPlan.getQcPlanDetailList().forEach(detail -> {
|
||||
detail.setQcPlanBo(qmsQcPlan.getHandle());
|
||||
detail.setQcItemBo(QmsQcItem.genHandle(site, detail.getQcItem()));
|
||||
detail.setHandle(QmsQcPlanDetail.genHandle(qmsQcPlan.getHandle(), detail.getQcItemBo()));
|
||||
detail.setSamplePlanBo(QmsSamplePlan.genHandle(site, detail.getSamplePlan()));
|
||||
qmsQcPlanDetailMapper.insert(detail);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QmsVwRouterCustom> getQcRouter(String site) {
|
||||
return qmsVwRouterCustomService.list(Wrappers.<QmsVwRouterCustom>lambdaQuery()
|
||||
.eq(QmsVwRouterCustom::getSite, site)
|
||||
.eq(QmsVwRouterCustom::getFieldName, "ISQC")
|
||||
.eq(QmsVwRouterCustom::getFieldValue, "Y"));
|
||||
@Transactional
|
||||
public void validateAndUpdate( QmsQcPlan qmsQcPlan ) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
|
||||
qmsQcPlan.setUpdater(SecurityUtils.getUserName());
|
||||
qmsQcPlan.setDateUpdate(LocalDateTime.now());
|
||||
|
||||
if("Y".equals(qmsQcPlan.getCurrentRevision())){
|
||||
super.update(Wrappers.<QmsQcPlan>lambdaUpdate()
|
||||
.eq(QmsQcPlan::getSite, site)
|
||||
.eq(QmsQcPlan::getQcPlan, qmsQcPlan.getQcPlan())
|
||||
.set(QmsQcPlan::getCurrentRevision, "N"));
|
||||
}
|
||||
|
||||
super.updateById(qmsQcPlan);
|
||||
|
||||
qmsQcPlanDetailService.remove(Wrappers.<QmsQcPlanDetail>lambdaQuery()
|
||||
.eq(QmsQcPlanDetail::getQcPlanBo, qmsQcPlan.getHandle()));
|
||||
|
||||
qmsQcPlan.getQcPlanDetailList().forEach(detail -> {
|
||||
detail.setQcItemBo(QmsQcItem.genHandle(site, detail.getQcItem()));
|
||||
detail.setHandle(QmsQcPlanDetail.genHandle(qmsQcPlan.getHandle(), detail.getQcItemBo()));
|
||||
detail.setQcPlanBo(qmsQcPlan.getHandle());
|
||||
detail.setSamplePlanBo(QmsSamplePlan.genHandle(site, detail.getSamplePlan()));
|
||||
qmsQcPlanDetailMapper.insert(detail);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private QmsQcPlan findCurrQc(String site, String qcPlan) {
|
||||
return super.getOne(Wrappers.<QmsQcPlan>lambdaQuery()
|
||||
.eq(QmsQcPlan::getSite, site)
|
||||
.eq(QmsQcPlan::getCurrentRevision, "true")
|
||||
.eq(StrUtil.isNotBlank(qcPlan), QmsQcPlan::getQcPlan, qcPlan));
|
||||
@Override
|
||||
@Transactional
|
||||
public void validateAndDelete( String handle ) {
|
||||
|
||||
String[] handleSplit = handle.split(",");
|
||||
|
||||
if(getQmsInspecJobService().list(Wrappers.<QmsInspecJob>lambdaQuery()
|
||||
.eq(QmsInspecJob::getQcPlan, handleSplit[1])
|
||||
.eq(QmsInspecJob::getQcPlanRevision, handleSplit[2])).size() > 0){
|
||||
throw BusinessException.build(I18nUtil.getI18nText("qms.qc.plan.error2", handleSplit[1]));
|
||||
}
|
||||
|
||||
super.removeById(handle);
|
||||
qmsQcPlanDetailService.remove(Wrappers.<QmsQcPlanDetail>lambdaQuery()
|
||||
.eq(QmsQcPlanDetail::getQcPlanBo, handle));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserGroup> getUserGroup() {
|
||||
return super.baseMapper.getUserGroup(TenantContextHolder.getTenantId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QmsQcPlan> getDistinctQcPlan() {
|
||||
return super.baseMapper.getDistinctQcPlan(TenantContextHolder.getTenantId());
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
package com.foreverwin.iep.qms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.foreverwin.iep.qms.dto.QmsQcPlanTargetDTO;
|
||||
import com.foreverwin.iep.qms.entity.QmsQcPlanTarget;
|
||||
import com.foreverwin.iep.qms.mapper.QmsQcPlanTargetMapper;
|
||||
import com.foreverwin.iep.qms.service.QmsQcPlanTargetService;
|
||||
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
|
||||
import com.foreverwin.mom.common.security.util.SecurityUtils;
|
||||
import io.seata.spring.annotation.GlobalTransactional;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检验计划使用对象
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-07-12 11:23:14
|
||||
*/
|
||||
@Service
|
||||
public class QmsQcPlanTargetServiceImpl extends ServiceImpl<QmsQcPlanTargetMapper, QmsQcPlanTarget> implements QmsQcPlanTargetService {
|
||||
|
||||
@Override
|
||||
public List<QmsQcPlanTargetDTO> getByTargetBo( String targetBo ) {
|
||||
return super.baseMapper.getByTargetBo(targetBo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@GlobalTransactional
|
||||
public boolean saveFullByTargetBo( String targetBo, List<QmsQcPlanTarget> qmsQcPlanTargetList ) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
|
||||
super.remove(Wrappers.<QmsQcPlanTarget>lambdaQuery().eq(QmsQcPlanTarget::getTargetBo, targetBo));
|
||||
|
||||
qmsQcPlanTargetList.forEach(qmsQcPlanTarget -> {
|
||||
qmsQcPlanTarget.setSite(site);
|
||||
qmsQcPlanTarget.setHandle(QmsQcPlanTarget.genHandle(site, qmsQcPlanTarget.getQcPlan(), targetBo));
|
||||
qmsQcPlanTarget.setTargetBo(targetBo);
|
||||
qmsQcPlanTarget.setDateCreate(LocalDateTime.now());
|
||||
qmsQcPlanTarget.setCreator(SecurityUtils.getUserName());
|
||||
});
|
||||
|
||||
super.saveBatch(qmsQcPlanTargetList);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -4,15 +4,10 @@ qms.sample.plan.error1=\u7535\u6027\u62BD\u6D4B\u89C4\u5219\u5DF2\u914D\u7F6E\u3
|
||||
qms.sample.plan.error2=\u300E{0}\u300F\u5DF2\u88ABIQC\u4F7F\u7528\uFF0C\u4E0D\u5F97\u5220\u9664
|
||||
qms.sample.plan.error3=\u62BD\u6837\u6570\u91CF\u4E0D\u6B63\u786E: {0}
|
||||
|
||||
#ProdQcPlan
|
||||
qms.prod.qc.plan=\u4EA7\u54C1\u7F16\u53F7\u4E0D\u5B58\u5728
|
||||
qms.prod.qc.error1={0}\u4F5C\u4E1A\u7AD9\u8F93\u5165\u7684{1}\u68C0\u9A8C\u8BA1\u753B\u4E0D\u5B58\u5728
|
||||
qms.prod.item.not.found=\u4EA7\u54C1\u7F16\u53F7\u300E{0}\u300F\u4E0D\u5B58\u5728\uFF0C\u8BF7\u786E\u8BA4!
|
||||
qms.prod.operation.not.found=\u4F5C\u4E1A\u7AD9\u70B9\u300E{0}\u300F\u4E0D\u5B58\u5728\uFF0C\u8BF7\u786E\u8BA4!
|
||||
qms.prod.qc.error2=\u68C0\u9A8C\u8BA1\u753B\u300E{0}\u300F\uFF0C\u68C0\u9A8C\u7C7B\u578B\u975ESFC
|
||||
|
||||
#QC Plan
|
||||
qms.qc.plan.qc.plan.used.not.delete=\u5DF2\u5EFA\u7ACB\u8FC7\u68C0\u9A8C\u4EFB\u52A1\uFF0C\u4E0D\u53EF\u5220\u9664!
|
||||
qms.qc.plan.error1=\u300E{0}\u300F/\u300E{1}\u300F\u5DF2\u5B58\u5728
|
||||
qms.qc.plan.error2=\u68C0\u9A8C\u8BA1\u5212\u300E{0}\u300F\u5DF2\u4F7F\u7528\u4E0D\u53EF\u5220\u9664
|
||||
qms.qc.plan.error3=\u68C0\u9A8C\u8BA1\u5212\u300E{0}\u300F\u6CA1\u6709\u5F53\u524D\u7248\u672C\u7684\u8D44\u8BAF
|
||||
|
||||
#QC Item
|
||||
qc.item.error1=\u300E{0}\u300F\u5DF2\u5B58\u5728
|
||||
|
||||
@ -1,16 +0,0 @@
|
||||
package com.foreverwin.iep.qms.mapper;
|
||||
|
||||
import com.foreverwin.mom.common.data.datascope.MomBaseMapper;
|
||||
import com.foreverwin.iep.qms.entity.QmsProdQcPlan;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 产品检验计划表
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-06-06 16:41:41
|
||||
*/
|
||||
@Mapper
|
||||
public interface QmsProdQcPlanMapper extends MomBaseMapper<QmsProdQcPlan> {
|
||||
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
package com.foreverwin.iep.qms.mapper;
|
||||
|
||||
import com.foreverwin.mom.common.data.datascope.MomBaseMapper;
|
||||
import com.foreverwin.iep.qms.entity.QmsQcPlanDetailFactor;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 检验计划明细-要因表
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-06-06 16:45:35
|
||||
*/
|
||||
@Mapper
|
||||
public interface QmsQcPlanDetailFactorMapper extends MomBaseMapper<QmsQcPlanDetailFactor> {
|
||||
|
||||
}
|
||||
@ -1,16 +1,21 @@
|
||||
package com.foreverwin.iep.qms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.foreverwin.iep.qms.dto.QmsQcPlanDetailDTO;
|
||||
import com.foreverwin.mom.common.data.datascope.MomBaseMapper;
|
||||
import com.foreverwin.iep.qms.entity.QmsQcPlanDetail;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检验计划明细表
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-03-29 09:42:38
|
||||
* @date 2023-07-11 16:30:35
|
||||
*/
|
||||
@Mapper
|
||||
public interface QmsQcPlanDetailMapper extends BaseMapper<QmsQcPlanDetail> {
|
||||
public interface QmsQcPlanDetailMapper extends MomBaseMapper<QmsQcPlanDetail> {
|
||||
|
||||
List<QmsQcPlanDetailDTO> getFullDetailByQcPlanBo( @Param("qcPlanBo") String qcPlanBo);
|
||||
}
|
||||
|
||||
@ -1,16 +1,23 @@
|
||||
package com.foreverwin.iep.qms.mapper;
|
||||
|
||||
import com.foreverwin.iep.qms.domain.UserGroup;
|
||||
import com.foreverwin.mom.common.data.datascope.MomBaseMapper;
|
||||
import com.foreverwin.iep.qms.entity.QmsQcPlan;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检验计划
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-06-06 16:43:15
|
||||
* @date 2023-07-11 16:28:57
|
||||
*/
|
||||
@Mapper
|
||||
public interface QmsQcPlanMapper extends MomBaseMapper<QmsQcPlan> {
|
||||
|
||||
List<UserGroup> getUserGroup( @Param("site") String site);
|
||||
|
||||
List<QmsQcPlan> getDistinctQcPlan(@Param("site") String site);
|
||||
}
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
package com.foreverwin.iep.qms.mapper;
|
||||
|
||||
import com.foreverwin.iep.qms.dto.QmsQcPlanTargetDTO;
|
||||
import com.foreverwin.mom.common.data.datascope.MomBaseMapper;
|
||||
import com.foreverwin.iep.qms.entity.QmsQcPlanTarget;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检验计划使用对象
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2023-07-12 11:23:14
|
||||
*/
|
||||
@Mapper
|
||||
public interface QmsQcPlanTargetMapper extends MomBaseMapper<QmsQcPlanTarget> {
|
||||
|
||||
List<QmsQcPlanTargetDTO> getByTargetBo( @Param("targetBo") String targetBo);
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.foreverwin.iep.qms.mapper.QmsProdQcPlanMapper">
|
||||
|
||||
<resultMap id="qmsProdQcPlanMap" type="com.foreverwin.iep.qms.entity.QmsProdQcPlan">
|
||||
<id property="sid" column="SID"/>
|
||||
<result property="site" column="SITE"/>
|
||||
<result property="item" column="ITEM"/>
|
||||
<result property="workCenter" column="WORK_CENTER"/>
|
||||
<result property="operation" column="OPERATION"/>
|
||||
<result property="resrce" column="RESRCE"/>
|
||||
<result property="qcPlan" column="QC_PLAN"/>
|
||||
<result property="qcPlanRevision" column="QC_PLAN_REVISION"/>
|
||||
<result property="createdUser" column="CREATED_USER"/>
|
||||
<result property="createdDateTime" column="CREATED_DATE_TIME"/>
|
||||
<result property="materialNo" column="MATERIAL_NO"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.foreverwin.iep.qms.mapper.QmsQcPlanDetailFactorMapper">
|
||||
|
||||
<resultMap id="qmsQcPlanDetailFactorMap" type="com.foreverwin.iep.qms.entity.QmsQcPlanDetailFactor">
|
||||
<id property="sid" column="SID"/>
|
||||
<result property="qcPlanDetailBo" column="QC_PLAN_DETAIL_BO"/>
|
||||
<result property="factorBo" column="FACTOR_BO"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@ -3,7 +3,7 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.foreverwin.iep.qms.mapper.QmsQcPlanDetailMapper">
|
||||
|
||||
|
||||
<resultMap id="qmsQcPlanDetailMap" type="com.foreverwin.iep.qms.entity.QmsQcPlanDetail">
|
||||
<id property="handle" column="HANDLE"/>
|
||||
<result property="qcPlanBo" column="QC_PLAN_BO"/>
|
||||
@ -16,4 +16,22 @@
|
||||
<result property="content" column="CONTENT"/>
|
||||
<result property="remark" column="REMARK"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="qmsQcPlanDetailDTOMap" extends="qmsQcPlanDetailMap" type="com.foreverwin.iep.qms.dto.QmsQcPlanDetailDTO">
|
||||
<result property="qcItem" column="qc_item"/>
|
||||
<result property="qcItemDesc" column="qc_item_desc"/>
|
||||
<result property="samplePlan" column="sample_plan"/>
|
||||
<result property="controlMode" column="control_mode"/>
|
||||
<result property="chartControl" column="chart_control"/>
|
||||
<result property="sampleSize" column="sample_size"/>
|
||||
<result property="itemType" column="ITEM_TYPE"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getFullDetailByQcPlanBo" resultMap="qmsQcPlanDetailDTOMap">
|
||||
select a.*, b.qc_item, b.DESCRIPTION qc_item_desc, c.sample_plan, b.ITEM_TYPE, b.CONTROL_MODE, b.chart_control, b.sample_size
|
||||
from QMS_QC_PLAN_DETAIL a
|
||||
join QMS_QC_ITEM b on a.QC_ITEM_BO = b.HANDLE
|
||||
join QMS_SAMPLE_PLAN c on a.sample_plan_bo = c.handle
|
||||
where a.QC_PLAN_BO = #{qcPlanBo}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -11,18 +11,32 @@
|
||||
<result property="revision" column="REVISION"/>
|
||||
<result property="currentRevision" column="CURRENT_REVISION"/>
|
||||
<result property="description" column="DESCRIPTION"/>
|
||||
<result property="qcMode" column="QC_MODE"/>
|
||||
<result property="qcType" column="QC_TYPE"/>
|
||||
<result property="inspecNo" column="INSPEC_NO"/>
|
||||
<result property="inspecType" column="INSPEC_TYPE"/>
|
||||
<result property="inspecFreqBo" column="INSPEC_FREQ_BO"/>
|
||||
<result property="userGroup" column="USER_GROUP"/>
|
||||
<result property="createdUser" column="CREATED_USER"/>
|
||||
<result property="createdDateTime" column="CREATED_DATE_TIME"/>
|
||||
<result property="sipGroupName" column="SIP_GROUP_NAME"/>
|
||||
<result property="sipFileName" column="SIP_FILE_NAME"/>
|
||||
<result property="toSpc" column="TO_SPC"/>
|
||||
<result property="modifiedUser" column="MODIFIED_USER"/>
|
||||
<result property="modifiedDateTime" column="MODIFIED_DATE_TIME"/>
|
||||
<result property="qcClass" column="QC_CLASS"/>
|
||||
<result property="checkOutControl" column="CHECK_OUT_CONTROL"/>
|
||||
<result property="dateCreate" column="DATE_CREATE"/>
|
||||
<result property="dateUpdate" column="DATE_UPDATE"/>
|
||||
<result property="creator" column="CREATOR"/>
|
||||
<result property="updater" column="UPDATER"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="userGroupMap" type="com.foreverwin.iep.qms.domain.UserGroup">
|
||||
<result property="userGroup" column="USER_GROUP"/>
|
||||
<result property="roleName" column="ROLE_NAME"/>
|
||||
<result property="roleDesc" column="ROLE_DESC"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getUserGroup" resultMap="userGroupMap">
|
||||
select distinct a.user_group, B.ROLE_NAME, B.ROLE_DESC
|
||||
from QMS_QC_PLAN a
|
||||
join momx.sys_role b on a.user_group = b.role_code and a.site = tenant_id
|
||||
where a.site = #{site}
|
||||
</select>
|
||||
|
||||
<select id="getDistinctQcPlan" resultMap="qmsQcPlanMap">
|
||||
select distinct A.QC_PLAN, A.DESCRIPTION, A.INSPEC_TYPE
|
||||
from QMS_QC_PLAN a
|
||||
where a.site = #{site}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.foreverwin.iep.qms.mapper.QmsQcPlanTargetMapper">
|
||||
|
||||
<resultMap id="qmsQcPlanTargetMap" type="com.foreverwin.iep.qms.entity.QmsQcPlanTarget">
|
||||
<id property="handle" column="HANDLE"/>
|
||||
<result property="site" column="SITE"/>
|
||||
<result property="qcPlan" column="QC_PLAN"/>
|
||||
<result property="seq" column="SEQ"/>
|
||||
<result property="targetBo" column="TARGET_BO"/>
|
||||
<result property="dateCreate" column="DATE_CREATE"/>
|
||||
<result property="dateUpdate" column="DATE_UPDATE"/>
|
||||
<result property="creator" column="CREATOR"/>
|
||||
<result property="updater" column="UPDATER"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="userGroupMap" type="com.foreverwin.iep.qms.dto.QmsQcPlanTargetDTO" extends="qmsQcPlanTargetMap">
|
||||
<result property="userGroup" column="USER_GROUP"/>
|
||||
<result property="qcPlanDesc" column="QC_PLAN_DESC"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getByTargetBo" resultMap="userGroupMap">
|
||||
select a.*, b.DESCRIPTION QC_PLAN_DESC, b.USER_GROUP
|
||||
from QMS_QC_PLAN_TARGET a
|
||||
left join QMS_QC_PLAN b on a.site = b.site and a.qc_plan = b.qc_plan and CURRENT_REVISION = 'Y'
|
||||
where a.TARGET_BO = #{targetBo}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user