Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
4e9b5c8d0c
@ -0,0 +1,10 @@
|
||||
package com.foreverwin.iep.qms.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CreateAndCollectInspectDataSourceResponse {
|
||||
|
||||
private String jobNo;
|
||||
private String inspectionBatch;
|
||||
}
|
||||
@ -0,0 +1,125 @@
|
||||
package com.foreverwin.iep.qms.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class InspecJobExtend{
|
||||
|
||||
|
||||
/**
|
||||
* 工厂
|
||||
*/
|
||||
private String site;
|
||||
|
||||
/**
|
||||
* 检验类型
|
||||
*/
|
||||
private String inspecType;
|
||||
|
||||
/*
|
||||
* 供应商基础数据主键
|
||||
*/
|
||||
private String supplierBasisBo;
|
||||
|
||||
/*
|
||||
* 检验对象主键
|
||||
*/
|
||||
private String targetBo;
|
||||
|
||||
/*
|
||||
* 检验级别
|
||||
*/
|
||||
private String inspectLevel;
|
||||
/**
|
||||
* 检验批
|
||||
*/
|
||||
private String inspectionBatch;
|
||||
|
||||
/**
|
||||
* 检验任务编号
|
||||
*/
|
||||
private String jobNo;
|
||||
|
||||
/**
|
||||
* 收料单号
|
||||
*/
|
||||
private String receiptNo;
|
||||
|
||||
/**
|
||||
* 项次号
|
||||
*/
|
||||
private String itemNumber;
|
||||
|
||||
/**
|
||||
* 采购订单号
|
||||
*/
|
||||
private String purchaseNo;
|
||||
|
||||
/**
|
||||
* 供应商批号
|
||||
*/
|
||||
private String supplierBatch;
|
||||
|
||||
/**
|
||||
* 供应商编号
|
||||
*/
|
||||
private String supplierNo;
|
||||
|
||||
/**
|
||||
* 物料主键
|
||||
*/
|
||||
private String itemBo;
|
||||
|
||||
/**
|
||||
* 收料总量
|
||||
*/
|
||||
private BigDecimal receiptQuantity;
|
||||
|
||||
/**
|
||||
* 收料拖数
|
||||
*/
|
||||
private Long dragQuantity;
|
||||
|
||||
/**
|
||||
* 收货批次
|
||||
*/
|
||||
private String receiptBatch;
|
||||
|
||||
/**
|
||||
* SAP批次
|
||||
*/
|
||||
private String sapBatch;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 创建人员
|
||||
*/
|
||||
private String creator;
|
||||
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
private LocalDateTime dateCreate;
|
||||
|
||||
/**
|
||||
* 更新人员
|
||||
*/
|
||||
private String updater;
|
||||
|
||||
/**
|
||||
* 更新日期
|
||||
*/
|
||||
private LocalDateTime dateUpdate;
|
||||
|
||||
}
|
||||
@ -0,0 +1,173 @@
|
||||
package com.foreverwin.iep.qms.entity;
|
||||
|
||||
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.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* IQC检验任务数据来源表
|
||||
*/
|
||||
@Data
|
||||
@TableName("qms_iqc_inspec_data_source")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "IQC检验任务数据来源表")
|
||||
public class QmsIqcInspecDataSource extends Model<QmsIqcInspecDataSource> {
|
||||
|
||||
public static final String KW_QMS_IQC_INSPEC_DATASOURCE_BO = "IqcInspectDsBO";
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "HANDLE")
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String handle;
|
||||
|
||||
/**
|
||||
* 工厂
|
||||
*/
|
||||
@TableField(value = "SITE")
|
||||
@ApiModelProperty(value = "工厂")
|
||||
private String site;
|
||||
|
||||
/**
|
||||
* 检验类型
|
||||
*/
|
||||
@TableField(value = "INSPEC_TYPE")
|
||||
@ApiModelProperty(value = "检验类型")
|
||||
private String inspecType;
|
||||
|
||||
/**
|
||||
* 检验批
|
||||
*/
|
||||
@TableField(value = "INSPECTION_BATCH")
|
||||
@ApiModelProperty(value = "检验批")
|
||||
private String inspectionBatch;
|
||||
|
||||
/**
|
||||
* 检验任务编号
|
||||
*/
|
||||
@TableField(value = "JOB_NO")
|
||||
@ApiModelProperty(value = "检验任务编号")
|
||||
private String jobNo;
|
||||
|
||||
/**
|
||||
* 收料单号
|
||||
*/
|
||||
@TableField(value = "RECEIPT_NO")
|
||||
@ApiModelProperty(value = "收料单号")
|
||||
private String receiptNo;
|
||||
|
||||
/**
|
||||
* 项次号
|
||||
*/
|
||||
@TableField(value = "ITEM_NUMBER")
|
||||
@ApiModelProperty(value = "项次号")
|
||||
private String itemNumber;
|
||||
|
||||
/**
|
||||
* 采购订单号
|
||||
*/
|
||||
@TableField(value = "PURCHASE_NO")
|
||||
@ApiModelProperty(value = "采购订单号")
|
||||
private String purchaseNo;
|
||||
|
||||
/**
|
||||
* 供应商批号
|
||||
*/
|
||||
@TableField(value = "SUPPLIER_BATCH")
|
||||
@ApiModelProperty(value = "供应商批号")
|
||||
private String supplierBatch;
|
||||
|
||||
/**
|
||||
* 供应商编号
|
||||
*/
|
||||
@TableField(value = "SUPPLIER_NO")
|
||||
@ApiModelProperty(value = "供应商编号")
|
||||
private String supplierNo;
|
||||
|
||||
/**
|
||||
* 物料主键
|
||||
*/
|
||||
@TableField(value = "ITEM_BO")
|
||||
@ApiModelProperty(value = "物料主键")
|
||||
private String itemBo;
|
||||
|
||||
/**
|
||||
* 收料总量
|
||||
*/
|
||||
@TableField(value = "RECEIPT_QUANTITY")
|
||||
@ApiModelProperty(value = "收料总量")
|
||||
private BigDecimal receiptQuantity;
|
||||
|
||||
/**
|
||||
* 收料拖数
|
||||
*/
|
||||
@TableField(value = "DRAG_QUANTITY")
|
||||
@ApiModelProperty(value = "收料拖数")
|
||||
private Long dragQuantity;
|
||||
|
||||
/**
|
||||
* 收货批次
|
||||
*/
|
||||
@TableField(value = "RECEIPT_BATCH")
|
||||
@ApiModelProperty(value = "收货批次")
|
||||
private String receiptBatch;
|
||||
|
||||
/**
|
||||
* SAP批次
|
||||
*/
|
||||
@TableField(value = "SAP_BATCH")
|
||||
@ApiModelProperty(value = "SAP批次")
|
||||
private String sapBatch;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@TableField(value = "STATUS")
|
||||
@ApiModelProperty(value = "状态")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 创建人员
|
||||
*/
|
||||
@TableField(value = "CREATOR")
|
||||
@ApiModelProperty(value = "创建人员")
|
||||
private String creator;
|
||||
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
@TableField(value = "DATE_CREATE")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private LocalDateTime dateCreate;
|
||||
|
||||
/**
|
||||
* 更新人员
|
||||
*/
|
||||
@TableField(value = "UPDATER")
|
||||
@ApiModelProperty(value = "更新人员")
|
||||
private String updater;
|
||||
|
||||
/**
|
||||
* 更新日期
|
||||
*/
|
||||
@TableField(value = "DATE_UPDATE")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private LocalDateTime dateUpdate;
|
||||
|
||||
public static String genHandle(String site, String inspectionBatch) {
|
||||
return HandleBoProcessor.genHandle(KW_QMS_IQC_INSPEC_DATASOURCE_BO, site, inspectionBatch);
|
||||
}
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@ -1,7 +1,9 @@
|
||||
package com.foreverwin.iep.qms.feign;
|
||||
|
||||
import com.foreverwin.iep.qms.domain.AutoCreateJobRequest;
|
||||
import com.foreverwin.iep.qms.domain.CreateAndCollectInspectDataSourceResponse;
|
||||
import com.foreverwin.iep.qms.domain.InspecJob;
|
||||
import com.foreverwin.iep.qms.domain.InspecJobExtend;
|
||||
import com.foreverwin.iep.qms.entity.QmsInspecJob;
|
||||
import com.foreverwin.mom.common.core.constant.SecurityConstants;
|
||||
import com.foreverwin.mom.common.core.util.R;
|
||||
@ -12,6 +14,8 @@ 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 = "remoteQmsInspecJobService", value = "iep-qms")
|
||||
public interface RemoteQmsInspecJobService {
|
||||
|
||||
@ -23,4 +27,7 @@ public interface RemoteQmsInspecJobService {
|
||||
|
||||
@GetMapping("/inspec-job/api/closeByTargetBo/{targetBo}")
|
||||
void closeByTargetBo(@PathVariable("targetBo") String targetBo);
|
||||
|
||||
@PostMapping("/inspec-job/api/createAndCollecttInspectDataSource")
|
||||
R<List<CreateAndCollectInspectDataSourceResponse>> createAndCollecttInspectDataSource(@RequestBody InspecJobExtend inspecJobExtend);
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.foreverwin.iep.qms.controller;
|
||||
import com.foreverwin.iep.common.base.FrontPage;
|
||||
import com.foreverwin.iep.qms.domain.AutoCreateJobRequest;
|
||||
import com.foreverwin.iep.qms.domain.InspecJob;
|
||||
import com.foreverwin.iep.qms.domain.InspecJobExtend;
|
||||
import com.foreverwin.iep.qms.dto.QmsInspecDetailDTO;
|
||||
import com.foreverwin.iep.qms.dto.QmsInspecJobDTO;
|
||||
import com.foreverwin.iep.qms.dto.QmsInspecResultNccodeDTO;
|
||||
@ -284,4 +285,11 @@ public class QmsInspecJobController {
|
||||
qmsInspecJobService.reInspection(inspecJob);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "檢驗任務創建并收集检验数据源数据", notes = "檢驗任務創建并收集检验数据源数据")
|
||||
@PostMapping("/createAndCollecttInspectDataSource")
|
||||
public R createAndCollecttInspectDataSource(@RequestBody InspecJobExtend inspecJobExtend) {
|
||||
return R.ok(qmsInspecJobService.create(inspecJobExtend));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,10 +3,7 @@ package com.foreverwin.iep.qms.service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.foreverwin.iep.common.base.FrontPage;
|
||||
import com.foreverwin.iep.qms.domain.InspecJob;
|
||||
import com.foreverwin.iep.qms.domain.Item;
|
||||
import com.foreverwin.iep.qms.domain.ReceiptInfo;
|
||||
import com.foreverwin.iep.qms.domain.Resource;
|
||||
import com.foreverwin.iep.qms.domain.*;
|
||||
import com.foreverwin.iep.qms.dto.QmsInspecDetailDTO;
|
||||
import com.foreverwin.iep.qms.dto.QmsInspecJobDTO;
|
||||
import com.foreverwin.iep.qms.dto.QmsInspecResultNccodeDTO;
|
||||
@ -168,4 +165,13 @@ public interface QmsInspecJobService extends IService<QmsInspecJob> {
|
||||
|
||||
void closeInspec(QmsInspecJob inspecJob);
|
||||
void reInspection(QmsInspecJob inspecJob);
|
||||
|
||||
|
||||
/**
|
||||
* 創建新的檢驗任務并收集数據源數據
|
||||
*
|
||||
* @param inspecJobExtend 檢驗任務實體
|
||||
* @return 創建的檢驗任務
|
||||
*/
|
||||
List<CreateAndCollectInspectDataSourceResponse> create(InspecJobExtend inspecJobExtend);
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.foreverwin.iep.qms.service;
|
||||
|
||||
import com.foreverwin.iep.qms.entity.QmsIqcInspecDataSource;
|
||||
import com.foreverwin.mom.common.data.mybatis.expand.service.ExpansionService;
|
||||
|
||||
/**
|
||||
* @author qiangguo.liu
|
||||
* @description 针对表【qms_iqc_inspec_data_source(IQC检验任务数据来源表)】的数据库操作Service
|
||||
* @createDate 2024-11-22 14:33:18
|
||||
*/
|
||||
public interface QmsIqcInspecDataSourceService extends ExpansionService<QmsIqcInspecDataSource> {
|
||||
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package com.foreverwin.iep.qms.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@ -40,16 +41,8 @@ import com.foreverwin.iep.prd.feign.RemoteNextNumberService;
|
||||
import com.foreverwin.iep.prd.feign.RemoteRouterService;
|
||||
import com.foreverwin.iep.qms.constant.Factor;
|
||||
import com.foreverwin.iep.qms.constant.Freq;
|
||||
import com.foreverwin.iep.qms.domain.InspecJob;
|
||||
import com.foreverwin.iep.qms.domain.Item;
|
||||
import com.foreverwin.iep.qms.domain.ReceiptInfo;
|
||||
import com.foreverwin.iep.qms.domain.Resource;
|
||||
import com.foreverwin.iep.qms.dto.QmsInspecDetailDTO;
|
||||
import com.foreverwin.iep.qms.dto.QmsInspecFactorDTO;
|
||||
import com.foreverwin.iep.qms.dto.QmsInspecJobDTO;
|
||||
import com.foreverwin.iep.qms.dto.QmsInspecResultNccodeDTO;
|
||||
import com.foreverwin.iep.qms.dto.QmsQcPlanDetailDTO;
|
||||
import com.foreverwin.iep.qms.dto.QmsSamplePlanDTO;
|
||||
import com.foreverwin.iep.qms.domain.*;
|
||||
import com.foreverwin.iep.qms.dto.*;
|
||||
import com.foreverwin.iep.qms.entity.*;
|
||||
import com.foreverwin.iep.qms.mapper.QmsInspecJobMapper;
|
||||
import com.foreverwin.iep.qms.service.*;
|
||||
@ -124,7 +117,11 @@ public class QmsInspecJobServiceImpl extends ServiceImpl<QmsInspecJobMapper, Qms
|
||||
private final QmsInspecResultService qmsInspecResultService;
|
||||
|
||||
private final QmsInspecResultNccodeService qmsInspecResultNccodeService;
|
||||
|
||||
|
||||
private final QmsQcPlanTargetService qmsQcPlanTargetService;
|
||||
|
||||
private final QmsIqcInspecDataSourceService qmsIqcInspecDataSourceService;
|
||||
|
||||
private final QmsInspecSnService qmsInspecSnService;
|
||||
|
||||
private final QmsQcItemService qmsQcItemService;
|
||||
@ -1129,6 +1126,179 @@ public class QmsInspecJobServiceImpl extends ServiceImpl<QmsInspecJobMapper, Qms
|
||||
super.updateById(qmsInspecJob);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<CreateAndCollectInspectDataSourceResponse> create(InspecJobExtend inspecJobExtend) {
|
||||
List<CreateAndCollectInspectDataSourceResponse> result = new ArrayList<>();
|
||||
try {
|
||||
validation(inspecJobExtend);
|
||||
// 获取物料+检验级别对应的检验计划
|
||||
List<QmsQcPlanTargetDTO> qmsQcPlanTargetList = qmsQcPlanTargetService.getByTargetBoAndInspectLevel(inspecJobExtend.getItemBo(), inspecJobExtend.getInspectLevel());
|
||||
if (CollUtil.isNotEmpty(qmsQcPlanTargetList)) {
|
||||
// 根据检验计划项,生成对应数量的检验批次编号
|
||||
GenerateNextNumberRequest generateNextNumberRequest = new GenerateNextNumberRequest();
|
||||
generateNextNumberRequest.setSite(inspecJobExtend.getSite());
|
||||
generateNextNumberRequest.setNextNumberType("QMS_INSPEC_BATCH");// 硬编码
|
||||
generateNextNumberRequest.setNumberOfValues(qmsQcPlanTargetList.size());
|
||||
R<GenerateNextNumberResponse> generates = remoteNextNumberService.generate(generateNextNumberRequest, SecurityConstants.FROM_IN);
|
||||
|
||||
if (generates != null && generates.getData() != null && generates.getData().getIds() != null) {
|
||||
for (int i = 0; i < qmsQcPlanTargetList.size(); i++) {
|
||||
// 1.创建任务
|
||||
QmsInspecJob returnJob = createInspecJob(qmsQcPlanTargetList.get(i), inspecJobExtend);
|
||||
// 2.存入数据 QMS_IQC_INSPEC_DATA_SOURCE
|
||||
String inspectionBatch = generates.getData().getIds().get(i); // 通过编号规则生成
|
||||
QmsIqcInspecDataSource qmsIqcInspecDataSource = createQmsIqcInspecDataSource(inspecJobExtend, returnJob, inspectionBatch);
|
||||
qmsIqcInspecDataSourceService.save(qmsIqcInspecDataSource);
|
||||
// 3.处理返回结果
|
||||
CreateAndCollectInspectDataSourceResponse response = new CreateAndCollectInspectDataSourceResponse();
|
||||
response.setJobNo(returnJob.getJobNo());
|
||||
response.setInspectionBatch(inspectionBatch);
|
||||
result.add(response);
|
||||
}
|
||||
} else {
|
||||
throw BusinessException.build("生成检验批次编号失败");
|
||||
}
|
||||
}
|
||||
} catch (BusinessException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw BusinessException.build("创建检验任务时发生错误");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 创建检验作业
|
||||
* 根据质量计划目标和检验作业扩展信息来创建一个新的检验作业对象
|
||||
* @param qcPlanTarget 质量计划目标DTO,包含了与质量计划相关的必要信息
|
||||
* @param inspecJobExtend 检验作业扩展对象,包含了创建检验作业所需的额外信息
|
||||
* @return 返回创建好的QmsInspecJob对象
|
||||
*/
|
||||
private QmsInspecJob createInspecJob(QmsQcPlanTargetDTO qcPlanTarget, InspecJobExtend inspecJobExtend) {
|
||||
// 创建一个新的检验作业对象
|
||||
InspecJob job = new InspecJob();
|
||||
// 设置质量计划
|
||||
job.setQcPlan(qcPlanTarget.getQcPlan());
|
||||
// 设置检验频率为“收货时”
|
||||
job.setQcFreq("RECEIPT");
|
||||
// 设置下一个编号类型为QMS_IQC_INSPEC_JOB,用于标识检验作业
|
||||
job.setNextNumberType(NextNumberTypeEnum.QMS_IQC_INSPEC_JOB.toString());
|
||||
// 设置目标业务对象
|
||||
job.setTargetBo(inspecJobExtend.getTargetBo());
|
||||
// 设置项目,通过HandleBoProcessor.trimHandle方法处理项目业务对象
|
||||
job.setItem(HandleBoProcessor.trimHandle(inspecJobExtend.getItemBo()));
|
||||
// 设置检验类型为“1”,可能代表某种特定的检验方式
|
||||
job.setInspecType("1");
|
||||
// 设置总体数量,即检验作业扩展中的收货数量
|
||||
job.setPopulationQty(inspecJobExtend.getReceiptQuantity());
|
||||
// 设置供应商,通过HandleBoProcessor.trimHandle方法处理供应商业务对象
|
||||
job.setSupplier(HandleBoProcessor.trimHandle(inspecJobExtend.getSupplierBasisBo()));
|
||||
// 设置供应商批次
|
||||
job.setSupplierBatch(inspecJobExtend.getSupplierBatch());
|
||||
// 调用create方法创建并返回检验作业
|
||||
return this.create(job);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验参数
|
||||
* @param inspecJobExtend
|
||||
*/
|
||||
private void validation(InspecJobExtend inspecJobExtend) {
|
||||
// 检查站点是否为空
|
||||
checkNotEmpty(inspecJobExtend.getSite(), "站点");
|
||||
// 检查物料是否为空
|
||||
checkNotEmpty(inspecJobExtend.getItemBo(), "物料");
|
||||
// 检查检验类型是否为空
|
||||
checkNotEmpty(inspecJobExtend.getInspecType(), "检验类型");
|
||||
// 检查收料单号是否为空
|
||||
checkNotEmpty(inspecJobExtend.getReceiptNo(), "收料单号");
|
||||
// 检查项次号是否为空
|
||||
checkNotEmpty(inspecJobExtend.getItemNumber(), "项次号");
|
||||
// 检查采购单号是否为空
|
||||
checkNotEmpty(inspecJobExtend.getPurchaseNo(), "采购单号");
|
||||
// 检查收料总量是否为空
|
||||
checkNotNull(inspecJobExtend.getReceiptQuantity(), "收料总量");
|
||||
// 检查收料拖数是否为空
|
||||
checkNotNull(inspecJobExtend.getDragQuantity(), "收料拖数");
|
||||
// 检查更新人是否为空
|
||||
checkNotEmpty(inspecJobExtend.getUpdater(), "更新人");
|
||||
// 检查创建人是否为空
|
||||
checkNotEmpty(inspecJobExtend.getCreator(), "创建人");
|
||||
if (!"N".equals(inspecJobExtend.getStatus()) && !"Y".equals(inspecJobExtend.getStatus())){
|
||||
throw BusinessException.build("状态只能选择Y(需检验)或N(不需检验)");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查指定的字符串是否为空
|
||||
* 如果字符串为空(null或空字符串),则抛出业务异常,指出相应的字段未被正确填写
|
||||
* 此方法用于在执行业务逻辑前,验证输入数据的完整性
|
||||
*
|
||||
* @param value 待检查的字符串值,不应为null或空字符串
|
||||
* @param fieldName 字段名称,用于在错误消息中指出是哪个字段为空
|
||||
* @throws BusinessException 如果字符串为空,则抛出此异常,包含具体的错误信息
|
||||
*/
|
||||
private void checkNotEmpty(String value, String fieldName) {
|
||||
// 检查字符串是否为null或空,如果是,则生成错误信息并抛出异常
|
||||
if (value == null || value.isEmpty()) {
|
||||
// 格式化错误信息,指出字段为空
|
||||
String errorMessage = String.format("%s为空,请检查请求参数", fieldName);
|
||||
// 根据错误信息构建并抛出业务异常
|
||||
throw BusinessException.build(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查指定的值是否为null,如果为null则抛出异常
|
||||
* 此方法用于校验方法参数或对象属性是否为空,为空则抛出异常,提示具体哪个字段为空
|
||||
*
|
||||
* @param value 要检查的值,可以是任何类型的对象
|
||||
* @param fieldName 值对应的字段名称,用于在错误信息中提示
|
||||
* @throws BusinessException 如果value为null,则抛出此异常,并包含具体的错误信息
|
||||
*/
|
||||
private void checkNotNull(Object value, String fieldName) {
|
||||
if (value == null) {
|
||||
// 当value为null时,构造错误信息并抛出异常
|
||||
String errorMessage = String.format("%s为空,请检查请求参数", fieldName);
|
||||
throw BusinessException.build(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建QmsIqcInspecDataSource对象
|
||||
* 该方法用于根据检验工作扩展信息和返回的工作信息,结合检验批次,生成一个新的QmsIqcInspecDataSource对象
|
||||
* 主要功能包括:
|
||||
* 1. 实现属性从InspecJobExtend到QmsIqcInspecDataSource的复制
|
||||
* 2. 设置工作编号、处理标识、检验批次以及创建和更新日期
|
||||
*
|
||||
* @param inspecJobExtend 检验工作扩展对象,包含详细的检验工作信息
|
||||
* @param returnJob 返回的工作信息对象,用于提供工作编号
|
||||
* @param inspectionBatch 检验批次字符串,用于标识特定的检验批次
|
||||
* @return 返回一个新创建的QmsIqcInspecDataSource对象
|
||||
*/
|
||||
private QmsIqcInspecDataSource createQmsIqcInspecDataSource(InspecJobExtend inspecJobExtend, QmsInspecJob returnJob, String inspectionBatch) {
|
||||
// 创建一个新的QmsIqcInspecDataSource对象
|
||||
QmsIqcInspecDataSource qmsIqcInspecDataSource = new QmsIqcInspecDataSource();
|
||||
// 将inspecJobExtend的属性值复制到qmsIqcInspecDataSource中
|
||||
BeanUtil.copyProperties(inspecJobExtend, qmsIqcInspecDataSource);
|
||||
// 设置工作编号,来源于returnJob对象
|
||||
qmsIqcInspecDataSource.setJobNo(returnJob.getJobNo());
|
||||
// 生成并设置处理标识,基于站点和检验批次
|
||||
qmsIqcInspecDataSource.setHandle(QmsIqcInspecDataSource.genHandle(inspecJobExtend.getSite(), inspectionBatch));
|
||||
// 设置检验批次
|
||||
qmsIqcInspecDataSource.setInspectionBatch(inspectionBatch);
|
||||
// 设置更新日期为当前时间
|
||||
qmsIqcInspecDataSource.setDateUpdate(LocalDateTime.now());
|
||||
// 设置创建日期为当前时间
|
||||
qmsIqcInspecDataSource.setDateCreate(LocalDateTime.now());
|
||||
// 返回新创建的对象
|
||||
return qmsIqcInspecDataSource;
|
||||
}
|
||||
|
||||
private void updateDetailByType(QmsInspecJob qmsInspecJob) {
|
||||
String jobBo = qmsInspecJob.getHandle();
|
||||
List<QmsInspecDetailDTO> details = qmsInspecDetailService.selectAll(jobBo);
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
package com.foreverwin.iep.qms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.foreverwin.iep.qms.entity.QmsIqcInspecDataSource;
|
||||
import com.foreverwin.iep.qms.entity.QmsQcItemFactor;
|
||||
import com.foreverwin.iep.qms.mapper.QmsIqcInspecDataSourceMapper;
|
||||
import com.foreverwin.iep.qms.service.QmsIqcInspecDataSourceService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author qiangguo.liu
|
||||
* @description 针对表【qms_iqc_inspec_data_source(IQC检验任务数据来源表)】的数据库操作Service实现
|
||||
* @createDate 2024-11-22 14:33:18
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class QmsIqcInspecDataSourceServiceImpl extends ServiceImpl<QmsIqcInspecDataSourceMapper, QmsIqcInspecDataSource>
|
||||
implements QmsIqcInspecDataSourceService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
package com.foreverwin.iep.qms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.foreverwin.iep.qms.entity.QmsInspectionLevel;
|
||||
import com.foreverwin.iep.qms.entity.QmsIqcInspecDataSource;
|
||||
import com.foreverwin.mom.common.data.datascope.MomBaseMapper;
|
||||
import com.foreverwin.mom.common.data.mybatis.expand.mapper.ExpansionBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author qiangguo.liu
|
||||
* @description 针对表【qms_iqc_inspec_data_source(IQC检验任务数据来源表)】的数据库操作Mapper
|
||||
* @createDate 2024-11-22 14:33:18
|
||||
* @Entity com.forewin.iep.qms.entity.QmsIqcInspecDataSource
|
||||
*/
|
||||
@Mapper
|
||||
public interface QmsIqcInspecDataSourceMapper extends ExpansionBaseMapper<QmsIqcInspecDataSource> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
<?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.QmsIqcInspecDataSourceMapper">
|
||||
<resultMap id="BaseResultMap" type="com.foreverwin.iep.qms.entity.QmsIqcInspecDataSource">
|
||||
<id property="handle" column="HANDLE" jdbcType="VARCHAR"/>
|
||||
<result property="site" column="SITE" jdbcType="VARCHAR"/>
|
||||
<result property="inspecType" column="INSPEC_TYPE" jdbcType="VARCHAR"/>
|
||||
<result property="inspectionBatch" column="INSPECTION_BATCH" jdbcType="VARCHAR"/>
|
||||
<result property="jobNo" column="JOB_NO" jdbcType="VARCHAR"/>
|
||||
<result property="receiptNo" column="RECEIPT_NO" jdbcType="VARCHAR"/>
|
||||
<result property="itemNumber" column="ITEM_NUMBER" jdbcType="VARCHAR"/>
|
||||
<result property="purchaseNo" column="PURCHASE_NO" jdbcType="VARCHAR"/>
|
||||
<result property="supplierBatch" column="SUPPLIER_BATCH" jdbcType="VARCHAR"/>
|
||||
<result property="supplierNo" column="SUPPLIER_NO" jdbcType="VARCHAR"/>
|
||||
<result property="itemBo" column="ITEM_BO" jdbcType="VARCHAR"/>
|
||||
<result property="receiptQuantity" column="RECEIPT_QUANTITY" jdbcType="DECIMAL"/>
|
||||
<result property="dragQuantity" column="DRAG_QUANTITY" jdbcType="DECIMAL"/>
|
||||
<result property="receiptBatch" column="RECEIPT_BATCH" jdbcType="VARCHAR"/>
|
||||
<result property="sapBatch" column="SAP_BATCH" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="STATUS" jdbcType="VARCHAR"/>
|
||||
<result property="creator" column="CREATOR" jdbcType="VARCHAR"/>
|
||||
<result property="dateCreate" column="DATE_CREATE" jdbcType="TIMESTAMP"/>
|
||||
<result property="updater" column="UPDATER" jdbcType="VARCHAR"/>
|
||||
<result property="dateUpdate" column="DATE_UPDATE" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
HANDLE,SITE,INSPEC_TYPE,
|
||||
INSPECTION_BATCH,JOB_NO,RECEIPT_NO,
|
||||
ITEM_NUMBER,PURCHASE_NO,SUPPLIER_BATCH,
|
||||
SUPPLIER_NO,ITEM_BO,RECEIPT_QUANTITY,
|
||||
DRAG_QUANTITY,RECEIPT_BATCH,SAP_BATCH,
|
||||
STATUS,CREATOR,DATE_CREATE,
|
||||
UPDATER,DATE_UPDATE
|
||||
</sql>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user