QMS:PDA质检接口
MES:车间生产接口
master
xins 8 months ago
parent ffae6718f8
commit 8160104cf9

@ -10,11 +10,10 @@ import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.domain.MesMaterialBom;
import com.hw.mes.domain.MesProductPlan;
import com.hw.mes.domain.MesProductPlanDetail;
import com.hw.mes.domain.vo.MesProductPlanDetailAttachVo;
import com.hw.mes.domain.vo.MesProductPlanDetailCompleteAttachVo;
import com.hw.mes.domain.vo.MesProductPlanDetailVo;
import com.hw.mes.service.IMesMaterialBomService;
import com.hw.mes.service.IMesProductOrderService;
import com.hw.mes.service.IMesProductPlanDetailService;
import com.hw.mes.service.IMesProductPlanService;
import com.hw.mes.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -24,7 +23,7 @@ import java.util.List;
/**
* MESController
*
* @author Yinq
* @author xins
* @date 2024-01-30
*/
@RestController
@ -99,6 +98,7 @@ public class MesApiController extends BaseController {
/**
*
* planDetailId
*/
@Log(title = "生产计划明细", businessType = BusinessType.COMPLETE)
@PostMapping(("/completeProductPlanDetail"))
@ -108,21 +108,35 @@ public class MesApiController extends BaseController {
/**
* IDID()
* ID()
*/
// @RequiresPermissions("mes:baseAttachInfo:query")
@GetMapping(value = "/getNewestProductPlanDetail")
public AjaxResult getNewestProductPlanDetail(MesProductPlanDetail queryProductPlanDetail) {
if (queryProductPlanDetail.getPlanId() == null) {
Long stationId = SecurityUtils.getStationId();
queryProductPlanDetail.setStationId(stationId);
}
// if (queryProductPlanDetail.getPlanId() == null) {
// Long stationId = SecurityUtils.getStationId();
// queryProductPlanDetail.setStationId(stationId);
// }
return success(productPlanDetailService.selectNewestMesProductPlanDetail(queryProductPlanDetail));
}
/**
* JoinID()
*/
// @RequiresPermissions("mes:baseAttachInfo:query")
@GetMapping(value = "/getNewestProductPlanDetailJoinAttach")
public AjaxResult getNewestProductPlanDetailJoinAttach(MesProductPlanDetail queryProductPlanDetail) {
// if (queryProductPlanDetail.getPlanId() == null) {
// Long stationId = SecurityUtils.getStationId();
// queryProductPlanDetail.setStationId(stationId);
// }
return success(productPlanDetailService.selectNewestMesProductPlanDetailJoinAttach(queryProductPlanDetail));
}
/**
*
*
* planId
*/
@Log(title = "生产计划明细", businessType = BusinessType.START)
@PostMapping(("/startNextProductPlanDetail"))
@ -130,5 +144,26 @@ public class MesApiController extends BaseController {
return success(productPlanDetailService.startNextMesProductPlanDetail(mesProductPlanDetail));
}
/**
*
* planIdattachId
*/
@Log(title = "生产计划明细", businessType = BusinessType.START)
@PostMapping(("/startNextProductPlanDetailAttach"))
public AjaxResult startNextProductPlanDetailAttach(@RequestBody MesProductPlanDetailAttachVo mesProductPlanDetailAttachVo) {
MesProductPlanDetail mesProductPlanDetail = new MesProductPlanDetail();
mesProductPlanDetail.setPlanId(mesProductPlanDetailAttachVo.getPlanId());
mesProductPlanDetail.setAttachId(mesProductPlanDetailAttachVo.getAttachId());
return success(productPlanDetailService.startNextMesProductPlanDetail(mesProductPlanDetail));
}
/**
* ()
*/
// @RequiresPermissions("mes:baseAttachInfo:query")
@GetMapping("/getProductPlanDrawings")
public AjaxResult getProductPlanDrawings(MesProductPlan queryProductPlan) {
return success(productPlanService.getDrawings(queryProductPlan));
}
}

@ -55,6 +55,12 @@ public class MesBaseAttachInfo extends BaseEntity {
@Excel(name = "激活标识")
private String activeFlag;
/**附件ID,多个以,隔开*/
private String attachIdStr;
/** 是否已下发图纸下发dispatchFlag为true下发dispatchFlag为true,默认为false*/
private boolean dispatchFlag = false;
public void setAttachId(Long attachId) {
this.attachId = attachId;
}
@ -111,6 +117,22 @@ public class MesBaseAttachInfo extends BaseEntity {
return activeFlag;
}
public String getAttachIdStr() {
return attachIdStr;
}
public void setAttachIdStr(String attachIdStr) {
this.attachIdStr = attachIdStr;
}
public boolean isDispatchFlag() {
return dispatchFlag;
}
public void setDispatchFlag(boolean dispatchFlag) {
this.dispatchFlag = dispatchFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -50,6 +50,8 @@ public class MesProductPlanDetail extends BaseEntity
@Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date realEndTime;
private Long attachId;
/** 明细状态1-未开始2-已开始3-已完成 */
@Excel(name = "明细状态1-未开始2-已开始3-已完成")
private String planDetailStatus;
@ -60,6 +62,8 @@ public class MesProductPlanDetail extends BaseEntity
private Long stationId;
private String attachName;
public void setPlanDetailId(Long planDetailId)
{
this.planDetailId = planDetailId;
@ -132,6 +136,15 @@ public class MesProductPlanDetail extends BaseEntity
{
return realEndTime;
}
public Long getAttachId() {
return attachId;
}
public void setAttachId(Long attachId) {
this.attachId = attachId;
}
public void setPlanDetailStatus(String planDetailStatus)
{
this.planDetailStatus = planDetailStatus;
@ -159,6 +172,14 @@ public class MesProductPlanDetail extends BaseEntity
this.stationId = stationId;
}
public String getAttachName() {
return attachName;
}
public void setAttachName(String attachName) {
this.attachName = attachName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -0,0 +1,25 @@
package com.hw.mes.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @Description: VO4使(with attach)
* @ClassName: MesProductPlanDetailAttachVo
* @Author : xins
* @Date :2024-03-08 15:51
* @Version :1.0
*/
@Data
public class MesProductPlanDetailAttachVo {
//生产计划ID
@NotNull(message = "生产计划ID必须输入")
private Long planId;
//生产计划ID
@NotNull(message = "图纸ID必须输入")
private Long attachId;
}

@ -0,0 +1,25 @@
package com.hw.mes.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @Description: VO4使(with attach)
* @ClassName: MesProductPlanDetailAttachVo
* @Author : xins
* @Date :2024-03-08 15:51
* @Version :1.0
*/
@Data
public class MesProductPlanDetailCompleteAttachVo {
//生产计划明细ID
@NotNull(message = "生产计划明细ID必须输入")
private Long planDetailId;
//生产计划ID
@NotNull(message = "图纸ID必须输入")
private Long attachId;
}

@ -68,4 +68,12 @@ public interface MesProductPlanDetailMapper
* @return
*/
public MesProductPlanDetail selectNewestMesProductPlanDetail(MesProductPlanDetail mesProductPlanDetail);
/**
* ,Join attach_info
*
* @param mesProductPlanDetail
* @return
*/
public MesProductPlanDetail selectNewestMesProductPlanDetailJoin(MesProductPlanDetail mesProductPlanDetail);
}

@ -96,6 +96,13 @@ public interface IMesProductPlanDetailService {
*/
public MesProductPlanDetail selectNewestMesProductPlanDetail(MesProductPlanDetail mesProductPlanDetail);
/**
* ,Join attach
*
* @param mesProductPlanDetail
* @return
*/
public MesProductPlanDetail selectNewestMesProductPlanDetailJoinAttach(MesProductPlanDetail mesProductPlanDetail);
/**
*

@ -101,4 +101,12 @@ public interface IMesProductPlanService
*/
public int productOrderRecall(MesProductOrder mesProductOrder);
/**
*
* @param mesProductPlan
* @return
*/
public List<MesBaseAttachInfo> getDrawings(MesProductPlan mesProductPlan);
}

@ -168,6 +168,8 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
throw new ServiceException("此生产计划已结束");
}
//todo:在开始生产计划时,更新生产工单状态、开始时间
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
Long userId = SecurityUtils.getUserId();
@ -213,11 +215,18 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
throw new ServiceException("此生产计划已结束");
}
//todo校验生产计划明细校验信息
//todo校验生产计划明细校验信息 更新生产工单状态、结束时间和完成数量(需要获取所有生产计划,顺序工单是否都已完成等)
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
BigDecimal planAmount = null;
if (mesProductPlanDetail.getAttachId() != null) {//如果是按图纸生产的
String attachId = dbProductPlan.getAttachId();
String[] attachIdArr = attachId.split(",");
planAmount = new BigDecimal(attachIdArr.length);
} else {
planAmount = dbProductPlan.getPlanAmount();
}
BigDecimal planAmount = dbProductPlan.getPlanAmount();
BigDecimal complementAmount = dbProductPlan.getCompleteAmount() == null ? BigDecimal.ZERO : dbProductPlan.getCompleteAmount();
BigDecimal newComplementAmount = complementAmount.add(BigDecimal.ONE);
@ -250,6 +259,18 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
}
/**
* ,Join attach
*
* @param mesProductPlanDetail
* @return
*/
@Override
public MesProductPlanDetail selectNewestMesProductPlanDetailJoinAttach(MesProductPlanDetail mesProductPlanDetail) {
return mesProductPlanDetailMapper.selectNewestMesProductPlanDetailJoin(mesProductPlanDetail);
}
/**
*
*
@ -261,7 +282,7 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
public MesProductPlanDetail startNextMesProductPlanDetail(MesProductPlanDetail mesProductPlanDetail) {
//根据planId获取最新一条的生产计划明细
MesProductPlanDetail newestPlanDetail = mesProductPlanDetailMapper.selectNewestMesProductPlanDetail(mesProductPlanDetail);
//todo:在开始生产计划时,更新生产工单状态、开始时间;
//如果此计划有最新的计划明细
if (newestPlanDetail != null) {
String planDetailStatus = newestPlanDetail.getPlanDetailStatus();

@ -10,6 +10,8 @@ import com.hw.common.core.utils.uuid.Seq;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.domain.MesBaseAttachInfo;
import com.hw.mes.domain.MesProductOrder;
import com.hw.mes.mapper.MesBaseAttachInfoMapper;
import com.hw.mes.mapper.MesProductPlanDetailMapper;
import com.hw.mes.service.IMesBaseAttachInfoService;
import com.hw.mes.service.IMesProductOrderService;
import org.springframework.beans.factory.annotation.Autowired;
@ -41,6 +43,12 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
@Autowired
private IMesBaseAttachInfoService mesBaseAttachInfoService;
@Autowired
private MesBaseAttachInfoMapper mesBaseAttachInfoMapper;
@Autowired
private MesProductPlanDetailMapper productPlanDetailMapper;
/**
*
*
@ -227,10 +235,42 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
@Override
public List<MesProductPlan> selectMesProductPlanJoinList(MesProductPlan mesProductPlan) {
Long stationId = SecurityUtils.getStationId();
stationId = 1L;
//todo stationId
mesProductPlan.setStationId(stationId);
return mesProductPlanMapper.selectMesProductPlanJoinList(mesProductPlan);
}
/**
*
*
* @param mesProductPlan
* @return
*/
@Override
public List<MesBaseAttachInfo> getDrawings(MesProductPlan mesProductPlan) {
String attachId = mesProductPlan.getAttachId();
List<MesBaseAttachInfo> baseAttachInfos;
if (attachId != null) {
MesBaseAttachInfo queryBaseAttachInfo = new MesBaseAttachInfo();
queryBaseAttachInfo.setAttachIdStr(attachId);
baseAttachInfos = mesBaseAttachInfoMapper.selectMesBaseAttachInfoList(queryBaseAttachInfo);
MesProductPlanDetail queryProductPlanDetail = new MesProductPlanDetail();
queryProductPlanDetail.setPlanId(mesProductPlan.getPlanId());
List<MesProductPlanDetail> productPlanDetails = productPlanDetailMapper.selectMesProductPlanDetailList(queryProductPlanDetail);
if (productPlanDetails != null && !productPlanDetails.isEmpty() && baseAttachInfos != null && !baseAttachInfos.isEmpty()) {
productPlanDetails.forEach(productPlanDetail -> {
for (MesBaseAttachInfo baseAttachInfo : baseAttachInfos) {
if (productPlanDetail.getAttachId() != null && productPlanDetail.getAttachId().equals(baseAttachInfo.getAttachId())) {
baseAttachInfo.setDispatchFlag(true);
}
}
});
}
return baseAttachInfos;
}
return null;
}
}

@ -45,6 +45,7 @@
<if test="attachPath != null and attachPath != ''">and attach_path = #{attachPath}</if>
<if test="processId != null ">and process_id = #{processId}</if>
<if test="activeFlag != null and activeFlag != ''">and active_flag = #{activeFlag}</if>
<if test="attachIdStr != null and attachIdStr != ''">and attach_id in (${attachIdStr})</if>
</where>
</select>

@ -13,6 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="userName" column="user_name" />
<result property="realBeginTime" column="real_begin_time" />
<result property="realEndTime" column="real_end_time" />
<result property="attachId" column="attach_id" />
<result property="planDetailStatus" column="plan_detail_status" />
<result property="isFlag" column="is_flag" />
<result property="remark" column="remark" />
@ -21,10 +22,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="stationId" column="station_id" />
<result property="attachName" column="attach_name" />
</resultMap>
<sql id="selectMesProductPlanDetailVo">
select plan_detail_id, plan_detail_code, plan_id, plan_code, user_id, user_name, real_begin_time, real_end_time, plan_detail_status, is_flag, remark, create_by, create_time, update_by, update_time from mes_product_plan_detail
select plan_detail_id, plan_detail_code, plan_id, plan_code, user_id, user_name, real_begin_time, real_end_time,attach_id, plan_detail_status, is_flag, remark, create_by, create_time, update_by, update_time from mes_product_plan_detail
</sql>
<select id="selectMesProductPlanDetailList" parameterType="MesProductPlanDetail" resultMap="MesProductPlanDetailResult">
@ -40,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="planDetailStatus != null and planDetailStatus != ''"> and plan_detail_status = #{planDetailStatus}</if>
<if test="isFlag != null and isFlag != ''"> and is_flag = #{isFlag}</if>
</where>
order by plan_detail_status asc,plan_detail_id desc
</select>
<select id="selectMesProductPlanDetailByPlanDetailId" parameterType="Long" resultMap="MesProductPlanDetailResult">
@ -56,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null">user_id,</if>
<if test="userName != null">user_name,</if>
<if test="realBeginTime != null">real_begin_time,</if>
<if test="attachId != null">attach_id,</if>
<if test="realEndTime != null">real_end_time,</if>
<if test="planDetailStatus != null and planDetailStatus != ''">plan_detail_status,</if>
<if test="isFlag != null and isFlag != ''">is_flag,</if>
@ -73,6 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userName != null">#{userName},</if>
<if test="realBeginTime != null">#{realBeginTime},</if>
<if test="realEndTime != null">#{realEndTime},</if>
<if test="attachId != null">#{attachId},</if>
<if test="planDetailStatus != null and planDetailStatus != ''">#{planDetailStatus},</if>
<if test="isFlag != null and isFlag != ''">#{isFlag},</if>
<if test="remark != null">#{remark},</if>
@ -133,4 +138,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by plan_detail_id desc limit 1
</select>
<select id="selectNewestMesProductPlanDetailJoin" parameterType="MesProductPlanDetail" resultMap="MesProductPlanDetailResult">
select mppd.plan_detail_id, mppd.plan_detail_code, mppd.plan_id, mppd.plan_code, mppd.user_id, mppd.user_name,
mppd.real_begin_time, mppd.real_end_time, mppd.plan_detail_status,mbai.attach_name
from mes_product_plan_detail mppd left join mes_base_attach_info mbai on mppd.attach_id=mbai.attach_id
<where>
<if test="planId != null "> and mppd.plan_id = #{planId}</if>
<if test="planId == null "> and exists (select 1 from mes_product_plan mpp where mppd.plan_id=mpp.plan_id and mpp.station_id=#{stationId})</if>
</where>
order by mppd.plan_detail_id desc limit 1
</select>
</mapper>

@ -11,10 +11,7 @@ import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.qms.domain.*;
import com.hw.qms.domain.vo.QmsCheckResultDetailVo;
import com.hw.qms.domain.vo.QmsMaterialCheckVo;
import com.hw.qms.service.IMesBaseBarcodeInfoService;
import com.hw.qms.service.IQmsCheckResultDetailService;
import com.hw.qms.service.IQmsCheckResultService;
import com.hw.qms.service.IQmsCheckRuleService;
import com.hw.qms.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -38,9 +35,13 @@ public class QmsMobileController extends BaseController {
private IQmsCheckResultDetailService qmsCheckResultDetailService;
@Autowired
private IMesBaseBarcodeInfoService mesBaseBarcodeInfoService;
@Autowired
private IQmsQualityInstanceService qmsQualityInstanceService;
@Autowired
private IQmsCheckInstanceFileService qmsCheckInstanceFileService;
/**
*
*
*/
// @RequiresPermissions("qms:checkrule:list")
@GetMapping("/getCheckResultDetail")
@ -89,7 +90,7 @@ public class QmsMobileController extends BaseController {
/**
*
*
*/
// @RequiresPermissions("qms:checkrule:list")
@GetMapping("/getCheckResults")
@ -100,7 +101,7 @@ public class QmsMobileController extends BaseController {
}
/**
*
*
*/
// @RequiresPermissions("qms:checkrule:list")
@GetMapping("/getCheckResult")
@ -126,7 +127,7 @@ public class QmsMobileController extends BaseController {
/**
*
*
*/
// @RequiresPermissions("qms:checkresultdetail:add")
@Log(title = "质检结果", businessType = BusinessType.AUDIT)
@ -135,4 +136,45 @@ public class QmsMobileController extends BaseController {
return toAjax(qmsCheckResultService.auditQmsCheckResult(qmsCheckResult));
}
/**
* 4
*/
// @RequiresPermissions("qms:checkrule:list")
@GetMapping("/getCheckResult4Handle")
public AjaxResult getCheckResult4Handle(QmsCheckResult qmsCheckResult) {
QmsCheckResultDetailVo qmsCheckResultDetailVo = qmsCheckResultDetailService.getCheckResultDetailVo(qmsCheckResult.getCheckResultId());
int batchAmount = mesBaseBarcodeInfoService.selectBarcodeInfoCountByBatchcode(qmsCheckResult.getMaterialBatch());
qmsCheckResultDetailVo.setBatchAmount(batchAmount);
qmsCheckResultDetailVo.setCheckMode(qmsCheckResult.getCheckMode());
qmsCheckResultDetailVo.setCheckSample(qmsCheckResult.getCheckSample());
qmsCheckResultDetailVo.setMaterialCode(qmsCheckResult.getMaterialCode());
qmsCheckResultDetailVo.setMaterialName(qmsCheckResult.getMaterialName());
QmsQualityInstance qmsQualityInstance = qmsQualityInstanceService.selectQmsQualityInstanceByCheckResultId(qmsCheckResult.getCheckResultId());
if (qmsQualityInstance != null) {
List<QmsQualityInstanceActivity> qmsQualityInstanceActivities = qmsQualityInstance.getQmsQualityInstanceActivityList();
qmsCheckResultDetailVo.setQmsQualityInstanceActivities(qmsQualityInstanceActivities);
QmsCheckInstanceFile queryCheckInstanceFile = new QmsCheckInstanceFile();
queryCheckInstanceFile.setTargetType("1");
queryCheckInstanceFile.setTargetId(qmsQualityInstance.getQualityInstanceId());
List<QmsCheckInstanceFile> qmsCheckInstanceFiles = qmsCheckInstanceFileService.selectQmsCheckInstanceFileList(queryCheckInstanceFile);
qmsCheckResultDetailVo.setQmsCheckInstanceFiles(qmsCheckInstanceFiles);
}
return success(qmsCheckResultDetailVo);
}
/**
*
*/
// @RequiresPermissions("qms:checkresultdetail:add")
@Log(title = "质检工单实例", businessType = BusinessType.INSERT)
@PostMapping("/handleQualityInstance")
public AjaxResult handleQualityInstance(@RequestBody QmsQualityInstance qmsQualityInstance) {
System.out.println(qmsQualityInstance.getCheckResultId());
return success(1);
}
}

@ -0,0 +1,105 @@
package com.hw.qms.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.qms.domain.QmsQualityInstance;
import com.hw.qms.service.IQmsQualityInstanceService;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.utils.poi.ExcelUtil;
import com.hw.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author xins
* @date 2024-01-23
*/
@RestController
@RequestMapping("/qualityinstance")
public class QmsQualityInstanceController extends BaseController
{
@Autowired
private IQmsQualityInstanceService qmsQualityInstanceService;
/**
*
*/
@RequiresPermissions("qms:ualityinstance:list")
@GetMapping("/list")
public TableDataInfo list(QmsQualityInstance qmsQualityInstance)
{
startPage();
List<QmsQualityInstance> list = qmsQualityInstanceService.selectQmsQualityInstanceList(qmsQualityInstance);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("qms:ualityinstance:export")
@Log(title = "质检工单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, QmsQualityInstance qmsQualityInstance)
{
List<QmsQualityInstance> list = qmsQualityInstanceService.selectQmsQualityInstanceList(qmsQualityInstance);
ExcelUtil<QmsQualityInstance> util = new ExcelUtil<QmsQualityInstance>(QmsQualityInstance.class);
util.exportExcel(response, list, "质检工单数据");
}
/**
*
*/
@RequiresPermissions("qms:ualityinstance:query")
@GetMapping(value = "/{qualityInstanceId}")
public AjaxResult getInfo(@PathVariable("qualityInstanceId") Long qualityInstanceId)
{
return success(qmsQualityInstanceService.selectQmsQualityInstanceByQualityInstanceId(qualityInstanceId));
}
/**
*
*/
@RequiresPermissions("qms:ualityinstance:add")
@Log(title = "质检工单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody QmsQualityInstance qmsQualityInstance)
{
return toAjax(qmsQualityInstanceService.insertQmsQualityInstance(qmsQualityInstance));
}
/**
*
*/
@RequiresPermissions("qms:ualityinstance:edit")
@Log(title = "质检工单", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody QmsQualityInstance qmsQualityInstance)
{
return toAjax(qmsQualityInstanceService.updateQmsQualityInstance(qmsQualityInstance));
}
/**
*
*/
@RequiresPermissions("qms:ualityinstance:remove")
@Log(title = "质检工单", businessType = BusinessType.DELETE)
@DeleteMapping("/{qualityInstanceIds}")
public AjaxResult remove(@PathVariable Long[] qualityInstanceIds)
{
return toAjax(qmsQualityInstanceService.deleteQmsQualityInstanceByQualityInstanceIds(qualityInstanceIds));
}
}

@ -0,0 +1,79 @@
package com.hw.qms.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* qms_check_instance_file
*
* @author xins
* @date 2024-01-23
*/
public class QmsCheckInstanceFile extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键标识 */
private Long checkInstanceFileId;
/** 关联类型(1质检工单实例) */
@Excel(name = "关联类型(1质检工单实例)")
private String targetType;
/** 关联类型为1时关联质检工单实例ID */
@Excel(name = "关联类型为1时关联质检工单实例ID")
private Long targetId;
/** 故障文件地址,一般是图片 */
@Excel(name = "故障文件地址,一般是图片")
private String faultFile;
public void setCheckInstanceFileId(Long checkInstanceFileId)
{
this.checkInstanceFileId = checkInstanceFileId;
}
public Long getCheckInstanceFileId()
{
return checkInstanceFileId;
}
public void setTargetType(String targetType)
{
this.targetType = targetType;
}
public String getTargetType()
{
return targetType;
}
public void setTargetId(Long targetId)
{
this.targetId = targetId;
}
public Long getTargetId()
{
return targetId;
}
public void setFaultFile(String faultFile)
{
this.faultFile = faultFile;
}
public String getFaultFile()
{
return faultFile;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("checkInstanceFileId", getCheckInstanceFileId())
.append("targetType", getTargetType())
.append("targetId", getTargetId())
.append("faultFile", getFaultFile())
.toString();
}
}

@ -0,0 +1,144 @@
package com.hw.qms.domain;
import java.util.List;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* qms_quality_instance
*
* @author xins
* @date 2024-01-23
*/
public class QmsQualityInstance extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 质检工单实例ID */
private Long qualityInstanceId;
/** 工单流程ID关联wf_process的wf_process_id;固定流程ID */
@Excel(name = "工单流程ID关联wf_process的wf_process_id;固定流程ID")
private Long wfProcessId;
/** 状态0未启动1启动2执行中3结束4已撤回9已删除 */
@Excel(name = "状态", readConverterExp = "0=未启动1启动2执行中3结束4已撤回9已删除")
private String wfInstanceStatus;
/** 质检结果ID,关联qms_check_result主键 */
@Excel(name = "质检结果ID,关联qms_check_result主键")
private Long checkResultId;
/** 质检描述 */
@Excel(name = "质检描述")
private String qualityDescription;
/** 处理开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "处理开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime;
/** 处理结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "处理结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
/** 质检工单实例节点信息 */
private List<QmsQualityInstanceActivity> qmsQualityInstanceActivityList;
public void setQualityInstanceId(Long qualityInstanceId)
{
this.qualityInstanceId = qualityInstanceId;
}
public Long getQualityInstanceId()
{
return qualityInstanceId;
}
public void setWfProcessId(Long wfProcessId)
{
this.wfProcessId = wfProcessId;
}
public Long getWfProcessId()
{
return wfProcessId;
}
public void setWfInstanceStatus(String wfInstanceStatus)
{
this.wfInstanceStatus = wfInstanceStatus;
}
public String getWfInstanceStatus()
{
return wfInstanceStatus;
}
public void setCheckResultId(Long checkResultId)
{
this.checkResultId = checkResultId;
}
public Long getCheckResultId()
{
return checkResultId;
}
public void setQualityDescription(String qualityDescription)
{
this.qualityDescription = qualityDescription;
}
public String getQualityDescription()
{
return qualityDescription;
}
public void setStartTime(Date startTime)
{
this.startTime = startTime;
}
public Date getStartTime()
{
return startTime;
}
public void setEndTime(Date endTime)
{
this.endTime = endTime;
}
public Date getEndTime()
{
return endTime;
}
public List<QmsQualityInstanceActivity> getQmsQualityInstanceActivityList()
{
return qmsQualityInstanceActivityList;
}
public void setQmsQualityInstanceActivityList(List<QmsQualityInstanceActivity> qmsQualityInstanceActivityList)
{
this.qmsQualityInstanceActivityList = qmsQualityInstanceActivityList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("qualityInstanceId", getQualityInstanceId())
.append("wfProcessId", getWfProcessId())
.append("wfInstanceStatus", getWfInstanceStatus())
.append("checkResultId", getCheckResultId())
.append("qualityDescription", getQualityDescription())
.append("startTime", getStartTime())
.append("endTime", getEndTime())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("qmsQualityInstanceActivityList", getQmsQualityInstanceActivityList())
.toString();
}
}

@ -0,0 +1,212 @@
package com.hw.qms.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* qms_quality_instance_activity
*
* @author xins
* @date 2024-01-23
*/
public class QmsQualityInstanceActivity extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 质检工单实例节点ID */
private Long instanceActivityId;
/** 质检工单实例ID关联qms_quality_instance的quality_instance_id */
@Excel(name = "质检工单实例ID关联qms_quality_instance的quality_instance_id")
private Long qualityInstanceId;
/** 工单流程节点ID关联wf_process_activity的process_activity_id */
@Excel(name = "工单流程节点ID", readConverterExp = "关=联wf_process_activity的process_activity_id")
private Long processActivityId;
/** 处理意见 */
@Excel(name = "处理意见")
private String processHandleResolution;
/** 工单处理描述(预留) */
@Excel(name = "工单处理描述", readConverterExp = "预=留")
private String processHandleDesc;
/** 状态(0已结束1执行中2、待接取3、已转发 */
@Excel(name = "状态(0已结束1执行中2、待接取3、已转发")
private String processHandleStatus;
/** 工单流程步骤顺序 */
@Excel(name = "工单流程步骤顺序")
private Long processStepOrder;
/** 执行开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "执行开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime;
/** 执行结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "执行结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
/** 处理人ID关联sys_user的user_id) */
@Excel(name = "处理人ID", readConverterExp = "处理人ID关联sys_user的user_id)")
private Long handleUserId;
/** 处理人 */
@Excel(name = "处理人")
private String handleBy;
/** 处理时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "处理时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date handleTime;
/** 转单人用户id或转发协助用户id;1、在转发时生成新的工单节点实例执行人id为转发的用户而转单人是刚才转发给此用户的用户id是否协助工单为0并且转发后当前工单的状态为已结束此用户的用户id是否协助工单为0并且转发后当前工单的状态为已结束此用户的用户id是否协助工单为0并且转发后当前工单的状态为已结束此用户的用户id是否协助工单为0并且转发后当前工单的状态为已结束2、在添加协助时生成新的工单节点实例执行人id为添加协助的用户而转单人是刚才添加协助此用户的用户id是否协助工单为1并且转发后当前工单的状态仍为执行中 */
@Excel(name = "转单人用户id或转发协助用户id;1、在转发时生成新的工单节点实例执行人id为转发的用户而转单人是刚才转发给此用户的用户id是否协助工单为0并且转发后当前工单的状态为已结束此用户的用户id是否协助工单为0并且转发后当前工单的状态为已结束此用户的用户id是否协助工单为0并且转发后当前工单的状态为已结束此用户的用户id是否协助工单为0并且转发后当前工单的状态为已结束2、在添加协助时生成新的工单节点实例执行人id为添加协助的用户而转单人是刚才添加协助此用户的用户id是否协助工单为1并且转发后当前工单的状态仍为执行中")
private Long transferUserId;
public void setInstanceActivityId(Long instanceActivityId)
{
this.instanceActivityId = instanceActivityId;
}
public Long getInstanceActivityId()
{
return instanceActivityId;
}
public void setQualityInstanceId(Long qualityInstanceId)
{
this.qualityInstanceId = qualityInstanceId;
}
public Long getQualityInstanceId()
{
return qualityInstanceId;
}
public void setProcessActivityId(Long processActivityId)
{
this.processActivityId = processActivityId;
}
public Long getProcessActivityId()
{
return processActivityId;
}
public void setProcessHandleResolution(String processHandleResolution)
{
this.processHandleResolution = processHandleResolution;
}
public String getProcessHandleResolution()
{
return processHandleResolution;
}
public void setProcessHandleDesc(String processHandleDesc)
{
this.processHandleDesc = processHandleDesc;
}
public String getProcessHandleDesc()
{
return processHandleDesc;
}
public void setProcessHandleStatus(String processHandleStatus)
{
this.processHandleStatus = processHandleStatus;
}
public String getProcessHandleStatus()
{
return processHandleStatus;
}
public void setProcessStepOrder(Long processStepOrder)
{
this.processStepOrder = processStepOrder;
}
public Long getProcessStepOrder()
{
return processStepOrder;
}
public void setStartTime(Date startTime)
{
this.startTime = startTime;
}
public Date getStartTime()
{
return startTime;
}
public void setEndTime(Date endTime)
{
this.endTime = endTime;
}
public Date getEndTime()
{
return endTime;
}
public void setHandleUserId(Long handleUserId)
{
this.handleUserId = handleUserId;
}
public Long getHandleUserId()
{
return handleUserId;
}
public void setHandleBy(String handleBy)
{
this.handleBy = handleBy;
}
public String getHandleBy()
{
return handleBy;
}
public void setHandleTime(Date handleTime)
{
this.handleTime = handleTime;
}
public Date getHandleTime()
{
return handleTime;
}
public void setTransferUserId(Long transferUserId)
{
this.transferUserId = transferUserId;
}
public Long getTransferUserId()
{
return transferUserId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("instanceActivityId", getInstanceActivityId())
.append("qualityInstanceId", getQualityInstanceId())
.append("processActivityId", getProcessActivityId())
.append("processHandleResolution", getProcessHandleResolution())
.append("processHandleDesc", getProcessHandleDesc())
.append("processHandleStatus", getProcessHandleStatus())
.append("processStepOrder", getProcessStepOrder())
.append("startTime", getStartTime())
.append("endTime", getEndTime())
.append("handleUserId", getHandleUserId())
.append("handleBy", getHandleBy())
.append("handleTime", getHandleTime())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("transferUserId", getTransferUserId())
.toString();
}
}

@ -2,7 +2,9 @@ package com.hw.qms.domain.vo;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
import com.hw.qms.domain.QmsCheckInstanceFile;
import com.hw.qms.domain.QmsCheckResultDetailProject;
import com.hw.qms.domain.QmsQualityInstanceActivity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -31,6 +33,14 @@ public class QmsCheckResultDetailVo
private BigDecimal checkSample;
private String materialCode;
private String materialName;
List<QmsQualityInstanceActivity> qmsQualityInstanceActivities;
List<QmsCheckInstanceFile> qmsCheckInstanceFiles;
public int getBatchAmount() {
return batchAmount;
}
@ -70,4 +80,36 @@ public class QmsCheckResultDetailVo
public void setCheckSample(BigDecimal checkSample) {
this.checkSample = checkSample;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public List<QmsQualityInstanceActivity> getQmsQualityInstanceActivities() {
return qmsQualityInstanceActivities;
}
public void setQmsQualityInstanceActivities(List<QmsQualityInstanceActivity> qmsQualityInstanceActivities) {
this.qmsQualityInstanceActivities = qmsQualityInstanceActivities;
}
public List<QmsCheckInstanceFile> getQmsCheckInstanceFiles() {
return qmsCheckInstanceFiles;
}
public void setQmsCheckInstanceFiles(List<QmsCheckInstanceFile> qmsCheckInstanceFiles) {
this.qmsCheckInstanceFiles = qmsCheckInstanceFiles;
}
}

@ -0,0 +1,61 @@
package com.hw.qms.mapper;
import java.util.List;
import com.hw.qms.domain.QmsCheckInstanceFile;
/**
* Mapper
*
* @author xins
* @date 2024-01-23
*/
public interface QmsCheckInstanceFileMapper
{
/**
*
*
* @param checkInstanceFileId
* @return
*/
public QmsCheckInstanceFile selectQmsCheckInstanceFileByCheckInstanceFileId(Long checkInstanceFileId);
/**
*
*
* @param qmsCheckInstanceFile
* @return
*/
public List<QmsCheckInstanceFile> selectQmsCheckInstanceFileList(QmsCheckInstanceFile qmsCheckInstanceFile);
/**
*
*
* @param qmsCheckInstanceFile
* @return
*/
public int insertQmsCheckInstanceFile(QmsCheckInstanceFile qmsCheckInstanceFile);
/**
*
*
* @param qmsCheckInstanceFile
* @return
*/
public int updateQmsCheckInstanceFile(QmsCheckInstanceFile qmsCheckInstanceFile);
/**
*
*
* @param checkInstanceFileId
* @return
*/
public int deleteQmsCheckInstanceFileByCheckInstanceFileId(Long checkInstanceFileId);
/**
*
*
* @param checkInstanceFileIds
* @return
*/
public int deleteQmsCheckInstanceFileByCheckInstanceFileIds(Long[] checkInstanceFileIds);
}

@ -0,0 +1,97 @@
package com.hw.qms.mapper;
import java.util.List;
import com.hw.qms.domain.QmsQualityInstance;
import com.hw.qms.domain.QmsQualityInstanceActivity;
/**
* Mapper
*
* @author xins
* @date 2024-01-23
*/
public interface QmsQualityInstanceMapper
{
/**
*
*
* @param qualityInstanceId
* @return
*/
public QmsQualityInstance selectQmsQualityInstanceByQualityInstanceId(Long qualityInstanceId);
/**
*
*
* @param qmsQualityInstance
* @return
*/
public List<QmsQualityInstance> selectQmsQualityInstanceList(QmsQualityInstance qmsQualityInstance);
/**
*
*
* @param qmsQualityInstance
* @return
*/
public int insertQmsQualityInstance(QmsQualityInstance qmsQualityInstance);
/**
*
*
* @param qmsQualityInstance
* @return
*/
public int updateQmsQualityInstance(QmsQualityInstance qmsQualityInstance);
/**
*
*
* @param qualityInstanceId
* @return
*/
public int deleteQmsQualityInstanceByQualityInstanceId(Long qualityInstanceId);
/**
*
*
* @param qualityInstanceIds
* @return
*/
public int deleteQmsQualityInstanceByQualityInstanceIds(Long[] qualityInstanceIds);
/**
*
*
* @param qualityInstanceIds
* @return
*/
public int deleteQmsQualityInstanceActivityByQualityInstanceIds(Long[] qualityInstanceIds);
/**
*
*
* @param qmsQualityInstanceActivityList
* @return
*/
public int batchQmsQualityInstanceActivity(List<QmsQualityInstanceActivity> qmsQualityInstanceActivityList);
/**
*
*
* @param qualityInstanceId ID
* @return
*/
public int deleteQmsQualityInstanceActivityByQualityInstanceId(Long qualityInstanceId);
/**
*
*
* @param checkResultId ID
* @return
*/
public QmsQualityInstance selectQmsQualityInstanceByCheckResultId(Long checkResultId);
}

@ -0,0 +1,61 @@
package com.hw.qms.service;
import java.util.List;
import com.hw.qms.domain.QmsCheckInstanceFile;
/**
* Service
*
* @author xins
* @date 2024-01-23
*/
public interface IQmsCheckInstanceFileService
{
/**
*
*
* @param checkInstanceFileId
* @return
*/
public QmsCheckInstanceFile selectQmsCheckInstanceFileByCheckInstanceFileId(Long checkInstanceFileId);
/**
*
*
* @param qmsCheckInstanceFile
* @return
*/
public List<QmsCheckInstanceFile> selectQmsCheckInstanceFileList(QmsCheckInstanceFile qmsCheckInstanceFile);
/**
*
*
* @param qmsCheckInstanceFile
* @return
*/
public int insertQmsCheckInstanceFile(QmsCheckInstanceFile qmsCheckInstanceFile);
/**
*
*
* @param qmsCheckInstanceFile
* @return
*/
public int updateQmsCheckInstanceFile(QmsCheckInstanceFile qmsCheckInstanceFile);
/**
*
*
* @param checkInstanceFileIds
* @return
*/
public int deleteQmsCheckInstanceFileByCheckInstanceFileIds(Long[] checkInstanceFileIds);
/**
*
*
* @param checkInstanceFileId
* @return
*/
public int deleteQmsCheckInstanceFileByCheckInstanceFileId(Long checkInstanceFileId);
}

@ -0,0 +1,71 @@
package com.hw.qms.service;
import java.util.List;
import com.hw.qms.domain.QmsQualityInstance;
/**
* Service
*
* @author xins
* @date 2024-01-23
*/
public interface IQmsQualityInstanceService
{
/**
*
*
* @param qualityInstanceId
* @return
*/
public QmsQualityInstance selectQmsQualityInstanceByQualityInstanceId(Long qualityInstanceId);
/**
*
*
* @param qmsQualityInstance
* @return
*/
public List<QmsQualityInstance> selectQmsQualityInstanceList(QmsQualityInstance qmsQualityInstance);
/**
*
*
* @param qmsQualityInstance
* @return
*/
public int insertQmsQualityInstance(QmsQualityInstance qmsQualityInstance);
/**
*
*
* @param qmsQualityInstance
* @return
*/
public int updateQmsQualityInstance(QmsQualityInstance qmsQualityInstance);
/**
*
*
* @param qualityInstanceIds
* @return
*/
public int deleteQmsQualityInstanceByQualityInstanceIds(Long[] qualityInstanceIds);
/**
*
*
* @param qualityInstanceId
* @return
*/
public int deleteQmsQualityInstanceByQualityInstanceId(Long qualityInstanceId);
/**
*
*
* @param checkResultId ID
* @return
*/
public QmsQualityInstance selectQmsQualityInstanceByCheckResultId(Long checkResultId);
}

@ -0,0 +1,93 @@
package com.hw.qms.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.qms.mapper.QmsCheckInstanceFileMapper;
import com.hw.qms.domain.QmsCheckInstanceFile;
import com.hw.qms.service.IQmsCheckInstanceFileService;
/**
* Service
*
* @author xins
* @date 2024-01-23
*/
@Service
public class QmsCheckInstanceFileServiceImpl implements IQmsCheckInstanceFileService
{
@Autowired
private QmsCheckInstanceFileMapper qmsCheckInstanceFileMapper;
/**
*
*
* @param checkInstanceFileId
* @return
*/
@Override
public QmsCheckInstanceFile selectQmsCheckInstanceFileByCheckInstanceFileId(Long checkInstanceFileId)
{
return qmsCheckInstanceFileMapper.selectQmsCheckInstanceFileByCheckInstanceFileId(checkInstanceFileId);
}
/**
*
*
* @param qmsCheckInstanceFile
* @return
*/
@Override
public List<QmsCheckInstanceFile> selectQmsCheckInstanceFileList(QmsCheckInstanceFile qmsCheckInstanceFile)
{
return qmsCheckInstanceFileMapper.selectQmsCheckInstanceFileList(qmsCheckInstanceFile);
}
/**
*
*
* @param qmsCheckInstanceFile
* @return
*/
@Override
public int insertQmsCheckInstanceFile(QmsCheckInstanceFile qmsCheckInstanceFile)
{
return qmsCheckInstanceFileMapper.insertQmsCheckInstanceFile(qmsCheckInstanceFile);
}
/**
*
*
* @param qmsCheckInstanceFile
* @return
*/
@Override
public int updateQmsCheckInstanceFile(QmsCheckInstanceFile qmsCheckInstanceFile)
{
return qmsCheckInstanceFileMapper.updateQmsCheckInstanceFile(qmsCheckInstanceFile);
}
/**
*
*
* @param checkInstanceFileIds
* @return
*/
@Override
public int deleteQmsCheckInstanceFileByCheckInstanceFileIds(Long[] checkInstanceFileIds)
{
return qmsCheckInstanceFileMapper.deleteQmsCheckInstanceFileByCheckInstanceFileIds(checkInstanceFileIds);
}
/**
*
*
* @param checkInstanceFileId
* @return
*/
@Override
public int deleteQmsCheckInstanceFileByCheckInstanceFileId(Long checkInstanceFileId)
{
return qmsCheckInstanceFileMapper.deleteQmsCheckInstanceFileByCheckInstanceFileId(checkInstanceFileId);
}
}

@ -0,0 +1,154 @@
package com.hw.qms.service.impl;
import java.util.List;
import com.hw.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.hw.common.core.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.hw.qms.domain.QmsQualityInstanceActivity;
import com.hw.qms.mapper.QmsQualityInstanceMapper;
import com.hw.qms.domain.QmsQualityInstance;
import com.hw.qms.service.IQmsQualityInstanceService;
/**
* Service
*
* @author xins
* @date 2024-01-23
*/
@Service
public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService
{
@Autowired
private QmsQualityInstanceMapper qmsQualityInstanceMapper;
/**
*
*
* @param qualityInstanceId
* @return
*/
@Override
public QmsQualityInstance selectQmsQualityInstanceByQualityInstanceId(Long qualityInstanceId)
{
return qmsQualityInstanceMapper.selectQmsQualityInstanceByQualityInstanceId(qualityInstanceId);
}
/**
*
*
* @param qmsQualityInstance
* @return
*/
@Override
public List<QmsQualityInstance> selectQmsQualityInstanceList(QmsQualityInstance qmsQualityInstance)
{
return qmsQualityInstanceMapper.selectQmsQualityInstanceList(qmsQualityInstance);
}
/**
*
*
* @param qmsQualityInstance
* @return
*/
@Transactional
@Override
public int insertQmsQualityInstance(QmsQualityInstance qmsQualityInstance)
{
qmsQualityInstance.setCreateTime(DateUtils.getNowDate());
int rows = qmsQualityInstanceMapper.insertQmsQualityInstance(qmsQualityInstance);
insertQmsQualityInstanceActivity(qmsQualityInstance);
return rows;
}
/**
*
*
* @param qmsQualityInstance
* @return
*/
@Transactional
@Override
public int updateQmsQualityInstance(QmsQualityInstance qmsQualityInstance)
{
qmsQualityInstance.setUpdateTime(DateUtils.getNowDate());
qmsQualityInstanceMapper.deleteQmsQualityInstanceActivityByQualityInstanceId(qmsQualityInstance.getQualityInstanceId());
insertQmsQualityInstanceActivity(qmsQualityInstance);
return qmsQualityInstanceMapper.updateQmsQualityInstance(qmsQualityInstance);
}
/**
*
*
* @param qualityInstanceIds
* @return
*/
@Transactional
@Override
public int deleteQmsQualityInstanceByQualityInstanceIds(Long[] qualityInstanceIds)
{
qmsQualityInstanceMapper.deleteQmsQualityInstanceActivityByQualityInstanceIds(qualityInstanceIds);
return qmsQualityInstanceMapper.deleteQmsQualityInstanceByQualityInstanceIds(qualityInstanceIds);
}
/**
*
*
* @param qualityInstanceId
* @return
*/
@Transactional
@Override
public int deleteQmsQualityInstanceByQualityInstanceId(Long qualityInstanceId)
{
qmsQualityInstanceMapper.deleteQmsQualityInstanceActivityByQualityInstanceId(qualityInstanceId);
return qmsQualityInstanceMapper.deleteQmsQualityInstanceByQualityInstanceId(qualityInstanceId);
}
/**
*
*
* @param qmsQualityInstance
*/
public void insertQmsQualityInstanceActivity(QmsQualityInstance qmsQualityInstance)
{
List<QmsQualityInstanceActivity> qmsQualityInstanceActivityList = qmsQualityInstance.getQmsQualityInstanceActivityList();
Long qualityInstanceId = qmsQualityInstance.getQualityInstanceId();
if (StringUtils.isNotNull(qmsQualityInstanceActivityList))
{
List<QmsQualityInstanceActivity> list = new ArrayList<QmsQualityInstanceActivity>();
for (QmsQualityInstanceActivity qmsQualityInstanceActivity : qmsQualityInstanceActivityList)
{
qmsQualityInstanceActivity.setQualityInstanceId(qualityInstanceId);
list.add(qmsQualityInstanceActivity);
}
if (list.size() > 0)
{
qmsQualityInstanceMapper.batchQmsQualityInstanceActivity(list);
}
}
}
/**
*
*
* @param checkResultId ID
* @return
*/
@Override
public QmsQualityInstance selectQmsQualityInstanceByCheckResultId(Long checkResultId)
{
return qmsQualityInstanceMapper.selectQmsQualityInstanceByCheckResultId(checkResultId);
}
}

@ -0,0 +1,66 @@
<?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.hw.qms.mapper.QmsCheckInstanceFileMapper">
<resultMap type="QmsCheckInstanceFile" id="QmsCheckInstanceFileResult">
<result property="checkInstanceFileId" column="check_instance_file_id" />
<result property="targetType" column="target_type" />
<result property="targetId" column="target_id" />
<result property="faultFile" column="fault_file" />
</resultMap>
<sql id="selectQmsCheckInstanceFileVo">
select check_instance_file_id, target_type, target_id, fault_file from qms_check_instance_file
</sql>
<select id="selectQmsCheckInstanceFileList" parameterType="QmsCheckInstanceFile" resultMap="QmsCheckInstanceFileResult">
<include refid="selectQmsCheckInstanceFileVo"/>
<where>
<if test="targetType != null and targetType != ''"> and target_type = #{targetType}</if>
<if test="targetId != null "> and target_id = #{targetId}</if>
<if test="faultFile != null and faultFile != ''"> and fault_file = #{faultFile}</if>
</where>
</select>
<select id="selectQmsCheckInstanceFileByCheckInstanceFileId" parameterType="Long" resultMap="QmsCheckInstanceFileResult">
<include refid="selectQmsCheckInstanceFileVo"/>
where check_instance_file_id = #{checkInstanceFileId}
</select>
<insert id="insertQmsCheckInstanceFile" parameterType="QmsCheckInstanceFile" useGeneratedKeys="true" keyProperty="checkInstanceFileId">
insert into qms_check_instance_file
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="targetType != null and targetType != ''">target_type,</if>
<if test="targetId != null">target_id,</if>
<if test="faultFile != null and faultFile != ''">fault_file,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="targetType != null and targetType != ''">#{targetType},</if>
<if test="targetId != null">#{targetId},</if>
<if test="faultFile != null and faultFile != ''">#{faultFile},</if>
</trim>
</insert>
<update id="updateQmsCheckInstanceFile" parameterType="QmsCheckInstanceFile">
update qms_check_instance_file
<trim prefix="SET" suffixOverrides=",">
<if test="targetType != null and targetType != ''">target_type = #{targetType},</if>
<if test="targetId != null">target_id = #{targetId},</if>
<if test="faultFile != null and faultFile != ''">fault_file = #{faultFile},</if>
</trim>
where check_instance_file_id = #{checkInstanceFileId}
</update>
<delete id="deleteQmsCheckInstanceFileByCheckInstanceFileId" parameterType="Long">
delete from qms_check_instance_file where check_instance_file_id = #{checkInstanceFileId}
</delete>
<delete id="deleteQmsCheckInstanceFileByCheckInstanceFileIds" parameterType="String">
delete from qms_check_instance_file where check_instance_file_id in
<foreach item="checkInstanceFileId" collection="array" open="(" separator="," close=")">
#{checkInstanceFileId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,157 @@
<?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.hw.qms.mapper.QmsQualityInstanceMapper">
<resultMap type="QmsQualityInstance" id="QmsQualityInstanceResult">
<result property="qualityInstanceId" column="quality_instance_id" />
<result property="wfProcessId" column="wf_process_id" />
<result property="wfInstanceStatus" column="wf_instance_status" />
<result property="checkResultId" column="check_result_id" />
<result property="qualityDescription" column="quality_description" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<resultMap id="QmsQualityInstanceQmsQualityInstanceActivityResult" type="QmsQualityInstance" extends="QmsQualityInstanceResult">
<collection property="qmsQualityInstanceActivityList" notNullColumn="sub_instance_activity_id" javaType="java.util.List" resultMap="QmsQualityInstanceActivityResult" />
</resultMap>
<resultMap type="QmsQualityInstanceActivity" id="QmsQualityInstanceActivityResult">
<result property="instanceActivityId" column="sub_instance_activity_id" />
<result property="qualityInstanceId" column="sub_quality_instance_id" />
<result property="processActivityId" column="sub_process_activity_id" />
<result property="processHandleResolution" column="sub_process_handle_resolution" />
<result property="processHandleDesc" column="sub_process_handle_desc" />
<result property="processHandleStatus" column="sub_process_handle_status" />
<result property="processStepOrder" column="sub_process_step_order" />
<result property="startTime" column="sub_start_time" />
<result property="endTime" column="sub_end_time" />
<result property="handleUserId" column="sub_handle_user_id" />
<result property="handleBy" column="sub_handle_by" />
<result property="handleTime" column="sub_handle_time" />
<result property="createBy" column="sub_create_by" />
<result property="createTime" column="sub_create_time" />
<result property="transferUserId" column="sub_transfer_user_id" />
</resultMap>
<sql id="selectQmsQualityInstanceVo">
select quality_instance_id, wf_process_id, wf_instance_status, check_result_id, quality_description, start_time, end_time, create_by, create_time, update_by, update_time from qms_quality_instance
</sql>
<select id="selectQmsQualityInstanceList" parameterType="QmsQualityInstance" resultMap="QmsQualityInstanceResult">
<include refid="selectQmsQualityInstanceVo"/>
<where>
<if test="wfProcessId != null "> and wf_process_id = #{wfProcessId}</if>
<if test="wfInstanceStatus != null and wfInstanceStatus != ''"> and wf_instance_status = #{wfInstanceStatus}</if>
<if test="checkResultId != null "> and check_result_id = #{checkResultId}</if>
<if test="qualityDescription != null and qualityDescription != ''"> and quality_description = #{qualityDescription}</if>
<if test="startTime != null "> and start_time = #{startTime}</if>
<if test="endTime != null "> and end_time = #{endTime}</if>
</where>
</select>
<select id="selectQmsQualityInstanceByQualityInstanceId" parameterType="Long" resultMap="QmsQualityInstanceQmsQualityInstanceActivityResult">
select a.quality_instance_id, a.wf_process_id, a.wf_instance_status, a.check_result_id, a.quality_description, a.start_time, a.end_time, a.create_by, a.create_time, a.update_by, a.update_time,
b.instance_activity_id as sub_instance_activity_id, b.quality_instance_id as sub_quality_instance_id, b.process_activity_id as sub_process_activity_id, b.process_handle_resolution as sub_process_handle_resolution, b.process_handle_desc as sub_process_handle_desc, b.process_handle_status as sub_process_handle_status, b.process_step_order as sub_process_step_order, b.start_time as sub_start_time, b.end_time as sub_end_time, b.handle_user_id as sub_handle_user_id, b.handle_by as sub_handle_by, b.handle_time as sub_handle_time, b.create_by as sub_create_by, b.create_time as sub_create_time, b.transfer_user_id as sub_transfer_user_id
from qms_quality_instance a
left join qms_quality_instance_activity b on b.quality_instance_id = a.quality_instance_id
where a.quality_instance_id = #{qualityInstanceId}
</select>
<insert id="insertQmsQualityInstance" parameterType="QmsQualityInstance" useGeneratedKeys="true" keyProperty="qualityInstanceId">
insert into qms_quality_instance
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="wfProcessId != null">wf_process_id,</if>
<if test="wfInstanceStatus != null and wfInstanceStatus != ''">wf_instance_status,</if>
<if test="checkResultId != null">check_result_id,</if>
<if test="qualityDescription != null">quality_description,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="wfProcessId != null">#{wfProcessId},</if>
<if test="wfInstanceStatus != null and wfInstanceStatus != ''">#{wfInstanceStatus},</if>
<if test="checkResultId != null">#{checkResultId},</if>
<if test="qualityDescription != null">#{qualityDescription},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateQmsQualityInstance" parameterType="QmsQualityInstance">
update qms_quality_instance
<trim prefix="SET" suffixOverrides=",">
<if test="wfProcessId != null">wf_process_id = #{wfProcessId},</if>
<if test="wfInstanceStatus != null and wfInstanceStatus != ''">wf_instance_status = #{wfInstanceStatus},</if>
<if test="checkResultId != null">check_result_id = #{checkResultId},</if>
<if test="qualityDescription != null">quality_description = #{qualityDescription},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where quality_instance_id = #{qualityInstanceId}
</update>
<delete id="deleteQmsQualityInstanceByQualityInstanceId" parameterType="Long">
delete from qms_quality_instance where quality_instance_id = #{qualityInstanceId}
</delete>
<delete id="deleteQmsQualityInstanceByQualityInstanceIds" parameterType="String">
delete from qms_quality_instance where quality_instance_id in
<foreach item="qualityInstanceId" collection="array" open="(" separator="," close=")">
#{qualityInstanceId}
</foreach>
</delete>
<delete id="deleteQmsQualityInstanceActivityByQualityInstanceIds" parameterType="String">
delete from qms_quality_instance_activity where quality_instance_id in
<foreach item="qualityInstanceId" collection="array" open="(" separator="," close=")">
#{qualityInstanceId}
</foreach>
</delete>
<delete id="deleteQmsQualityInstanceActivityByQualityInstanceId" parameterType="Long">
delete from qms_quality_instance_activity where quality_instance_id = #{qualityInstanceId}
</delete>
<insert id="batchQmsQualityInstanceActivity">
insert into qms_quality_instance_activity( instance_activity_id, quality_instance_id, process_activity_id, process_handle_resolution, process_handle_desc, process_handle_status, process_step_order, start_time, end_time, handle_user_id, handle_by, handle_time, create_by, create_time, transfer_user_id) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.instanceActivityId}, #{item.qualityInstanceId}, #{item.processActivityId}, #{item.processHandleResolution}, #{item.processHandleDesc}, #{item.processHandleStatus}, #{item.processStepOrder}, #{item.startTime}, #{item.endTime}, #{item.handleUserId}, #{item.handleBy}, #{item.handleTime}, #{item.createBy}, #{item.createTime}, #{item.transferUserId})
</foreach>
</insert>
<select id="selectQmsQualityInstanceByCheckResultId" parameterType="Long" resultMap="QmsQualityInstanceQmsQualityInstanceActivityResult">
select a.quality_instance_id, a.wf_process_id, a.wf_instance_status, a.check_result_id, a.quality_description, a.start_time, a.end_time, a.create_by, a.create_time, a.update_by, a.update_time,
b.instance_activity_id as sub_instance_activity_id, b.quality_instance_id as sub_quality_instance_id, b.process_activity_id as sub_process_activity_id, b.process_handle_resolution as sub_process_handle_resolution, b.process_handle_desc as sub_process_handle_desc, b.process_handle_status as sub_process_handle_status, b.process_step_order as sub_process_step_order, b.start_time as sub_start_time, b.end_time as sub_end_time, b.handle_user_id as sub_handle_user_id, b.handle_by as sub_handle_by, b.handle_time as sub_handle_time, b.create_by as sub_create_by, b.create_time as sub_create_time, b.transfer_user_id as sub_transfer_user_id
from qms_quality_instance a
left join qms_quality_instance_activity b on b.quality_instance_id = a.quality_instance_id
where a.check_result_id = #{checkResultId}
</select>
</mapper>
Loading…
Cancel
Save