质量待检任务。

This commit is contained in:
yinjinlu-pc\尹金路 2023-10-20 09:31:02 +08:00
parent 01fd608843
commit d987d92183
4 changed files with 70 additions and 1 deletions

View File

@ -139,6 +139,10 @@ create table qc_iqc (
iqc_code varchar(64) not null comment '来料检验单编号', iqc_code varchar(64) not null comment '来料检验单编号',
iqc_name varchar(500) not null comment '来料检验单名称', iqc_name varchar(500) not null comment '来料检验单名称',
template_id bigint(20) not null comment '检验模板ID', template_id bigint(20) not null comment '检验模板ID',
source_doc_id bigint(20) comment '来源单据ID',
source_doc_type varchar(64) comment '来源单据类型',
source_doc_code varchar(64) comment '来源单据编号',
source_line_id bigint(20) comment '来源单据行ID',
vendor_id bigint(20) not null comment '供应商ID', vendor_id bigint(20) not null comment '供应商ID',
vendor_code varchar(64) not null comment '供应商编码', vendor_code varchar(64) not null comment '供应商编码',
vendor_name varchar(255) not null comment '供应商名称', vendor_name varchar(255) not null comment '供应商名称',
@ -253,7 +257,10 @@ create table qc_ipqc (
ipqc_name varchar(255) comment '检验单名称', ipqc_name varchar(255) comment '检验单名称',
ipqc_type varchar(64) not null comment '检验类型', ipqc_type varchar(64) not null comment '检验类型',
template_id bigint(20) not null comment '检验模板ID', template_id bigint(20) not null comment '检验模板ID',
source_doc_id bigint(20) comment '来源单据ID',
source_doc_type varchar(64) comment '来源单据类型',
source_doc_code varchar(64) comment '来源单据编号',
source_line_id bigint(20) comment '来源单据行ID',
workorder_id bigint(20) not null comment '工单ID', workorder_id bigint(20) not null comment '工单ID',
workorder_code varchar(64) comment '工单编码', workorder_code varchar(64) comment '工单编码',
workorder_name varchar(255) comment '工单名称', workorder_name varchar(255) comment '工单名称',
@ -343,6 +350,10 @@ create table qc_oqc (
oqc_code varchar(64) not null comment '出货检验单编号', oqc_code varchar(64) not null comment '出货检验单编号',
oqc_name varchar(500) comment '出货检验单名称', oqc_name varchar(500) comment '出货检验单名称',
template_id bigint(20) not null comment '检验模板ID', template_id bigint(20) not null comment '检验模板ID',
source_doc_id bigint(20) comment '来源单据ID',
source_doc_type varchar(64) comment '来源单据类型',
source_doc_code varchar(64) comment '来源单据编号',
source_line_id bigint(20) comment '来源单据行ID',
client_id bigint(20) not null comment '客户ID', client_id bigint(20) not null comment '客户ID',
client_code varchar(64) not null comment '客户编码', client_code varchar(64) not null comment '客户编码',
client_name varchar(255) not null comment '客户名称', client_name varchar(255) not null comment '客户名称',

View File

@ -10,6 +10,9 @@ import com.ktg.mes.pro.domain.ProFeedback;
import com.ktg.mes.pro.service.IProFeedbackService; import com.ktg.mes.pro.service.IProFeedbackService;
import com.ktg.mes.qc.domain.*; import com.ktg.mes.qc.domain.*;
import com.ktg.mes.qc.service.*; import com.ktg.mes.qc.service.*;
import com.ktg.mes.wm.domain.WmItemRecptLine;
import com.ktg.mes.wm.service.IWmItemRecptLineService;
import com.ktg.mes.wm.service.IWmItemRecptService;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -53,6 +56,8 @@ public class QcIqcController extends BaseController
@Autowired @Autowired
private IQcDefectRecordService qcDefectRecordService; private IQcDefectRecordService qcDefectRecordService;
@Autowired
private IWmItemRecptLineService wmItemRecptLineService;
/** /**
@ -131,6 +136,29 @@ public class QcIqcController extends BaseController
return AjaxResult.error("单据编号已存在!"); return AjaxResult.error("单据编号已存在!");
} }
QcTemplateProduct param = new QcTemplateProduct();
param.setItemId(qcIqc.getItemId());
List<QcTemplateProduct> templates = qcTemplateProductService.selectQcTemplateProductList(param);
if(CollUtil.isNotEmpty(templates)){
qcIqc.setTemplateId(templates.get(0).getTemplateId());
}else{
return AjaxResult.error("当前产品未配置检测模板!");
}
qcIqc.setInspector(getUsername());
//如果是完成状态则根据来源单据更新其对应的检测单
if(UserConstants.ORDER_STATUS_FINISHED.equals(qcIqc.getStatus())){
if(StringUtils.isNotNull(qcIqc.getSourceDocCode())){
//这里默认是采购入库单后续有其他单据则根据单据类型(sourceDocType)进行区分
WmItemRecptLine line = wmItemRecptLineService.selectWmItemRecptLineByLineId(qcIqc.getSourceLineId());
if(StringUtils.isNotNull(line)){
line.setIqcCode(qcIqc.getIqcCode());
line.setIqcId(qcIqc.getIqcId());
wmItemRecptLineService.updateWmItemRecptLine(line);
}
}
}
return toAjax(qcIqcService.updateQcIqc(qcIqc)); return toAjax(qcIqcService.updateQcIqc(qcIqc));
} }

View File

@ -6,10 +6,14 @@ import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.ktg.common.constant.UserConstants; import com.ktg.common.constant.UserConstants;
import com.ktg.common.utils.StringUtils;
import com.ktg.mes.qc.domain.*; import com.ktg.mes.qc.domain.*;
import com.ktg.mes.qc.service.IQcOqcLineService; import com.ktg.mes.qc.service.IQcOqcLineService;
import com.ktg.mes.qc.service.IQcTemplateIndexService; import com.ktg.mes.qc.service.IQcTemplateIndexService;
import com.ktg.mes.qc.service.IQcTemplateProductService; import com.ktg.mes.qc.service.IQcTemplateProductService;
import com.ktg.mes.wm.domain.WmProductSalseLine;
import com.ktg.mes.wm.service.IWmProductSalseLineService;
import org.apache.catalina.User;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -51,6 +55,9 @@ public class QcOqcController extends BaseController
@Autowired @Autowired
private IQcTemplateIndexService qcTemplateIndexService; private IQcTemplateIndexService qcTemplateIndexService;
@Autowired
private IWmProductSalseLineService wmProductSalseLineService;
/** /**
* 查询出货检验单列表 * 查询出货检验单列表
*/ */
@ -128,6 +135,29 @@ public class QcOqcController extends BaseController
if(UserConstants.NOT_UNIQUE.equals(qcOqcService.checkOqcCodeUnique(qcOqc))){ if(UserConstants.NOT_UNIQUE.equals(qcOqcService.checkOqcCodeUnique(qcOqc))){
return AjaxResult.error("出货单编号已存在!"); return AjaxResult.error("出货单编号已存在!");
} }
//自动获取对应的检测模板
QcTemplateProduct param = new QcTemplateProduct();
param.setItemId(qcOqc.getItemId());
List<QcTemplateProduct> templates = qcTemplateProductService.selectQcTemplateProductList(param);
if(CollUtil.isNotEmpty(templates)){
qcOqc.setTemplateId(templates.get(0).getTemplateId());
}else{
return AjaxResult.error("当前产品未配置检测模板!");
}
//设置检测人
qcOqc.setInspector(getUsername());
if(UserConstants.ORDER_STATUS_FINISHED.equals(qcOqc.getStatus())){
if(StringUtils.isNotNull(qcOqc.getSourceDocCode())){
WmProductSalseLine line = wmProductSalseLineService.selectWmProductSalseLineByLineId(qcOqc.getSourceLineId());
if(StringUtils.isNotNull(line)){
line.setOqcId(qcOqc.getOqcId());
line.setOqcCode(qcOqc.getOqcCode());
wmProductSalseLineService.updateWmProductSalseLine(line);
}
}
}
return toAjax(qcOqcService.updateQcOqc(qcOqc)); return toAjax(qcOqcService.updateQcOqc(qcOqc));
} }