设备管理表结构修改;过程检验工序信息完善;生产工单保存BUG修复。

This commit is contained in:
yinjinlu-pc\尹金路 2023-09-19 16:10:57 +08:00
parent 69cb50e767
commit 8c0fc15ec2
8 changed files with 211 additions and 5 deletions

View File

@ -108,7 +108,7 @@ create table dv_check_plan (
-- ---------------------------- -- ----------------------------
-- 5、点检保养设备表 -- 5、点检保养计划设备表
-- ---------------------------- -- ----------------------------
drop table if exists dv_check_machinery; drop table if exists dv_check_machinery;
create table dv_check_machinery ( create table dv_check_machinery (
@ -133,7 +133,7 @@ create table dv_check_machinery (
-- ---------------------------- -- ----------------------------
-- 6、点检保养项目表 -- 6、点检保养计划项目表
-- ---------------------------- -- ----------------------------
drop table if exists dv_check_subject; drop table if exists dv_check_subject;
create table dv_check_subject ( create table dv_check_subject (
@ -159,6 +159,127 @@ create table dv_check_subject (
-- ----------------------------
-- 7、设备点检记录表
-- ----------------------------
drop table if exists dv_check_record;
create table dv_check_record (
record_id bigint(20) not null auto_increment comment '计划ID',
plan_id bigint(20) comment '计划ID',
plan_code varchar(64) comment '计划编码',
plan_name varchar(255) comment '计划名称',
plan_type varchar(64) comment '计划类型',
machinery_id bigint(20) not null comment '设备ID',
machinery_code varchar(64) not null comment '设备编码',
machinery_name varchar(255) not null comment '设备名称',
machinery_brand varchar(255) comment '品牌',
machinery_spec varchar(255) comment '规格型号',
check_time datetime not null comment '点检时间',
status varchar(64) default 'PREPARE' comment '状态',
remark varchar(500) default '' comment '备注',
attr1 varchar(64) default null comment '预留字段1',
attr2 varchar(255) default null comment '预留字段2',
attr3 int(11) default 0 comment '预留字段3',
attr4 int(11) default 0 comment '预留字段4',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
primary key (record_id)
) engine=innodb auto_increment=200 comment = '设备点检记录表';
-- ----------------------------
-- 8、设备点检记录行表
-- ----------------------------
drop table if exists dv_check_record_line;
create table dv_check_record_line (
line_id bigint(20) not null auto_increment comment '计划ID',
record_id bigint(20) not null comment '计划ID',
subject_id bigint(20) not null comment '项目ID',
subject_code varchar(64) not null comment '项目编码',
subject_name varchar(255) comment '项目名称',
subject_type varchar(64) comment '项目类型',
subject_content varchar(500) not null comment '项目内容',
subject_standard varchar(255) comment '标准',
check_status varchar(64) not null comment '点检结果',
check_result varchar(500) comment '异常描述',
attr1 varchar(64) default null comment '预留字段1',
attr2 varchar(255) default null comment '预留字段2',
attr3 int(11) default 0 comment '预留字段3',
attr4 int(11) default 0 comment '预留字段4',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
primary key (line_id)
) engine=innodb auto_increment=200 comment = '设备点检记录行表';
-- ----------------------------
-- 7、设备保养记录表
-- ----------------------------
drop table if exists dv_mainten_record;
create table dv_mainten_record (
record_id bigint(20) not null auto_increment comment '计划ID',
plan_id bigint(20) comment '计划ID',
plan_code varchar(64) comment '计划编码',
plan_name varchar(255) comment '计划名称',
plan_type varchar(64) comment '计划类型',
machinery_id bigint(20) not null comment '设备ID',
machinery_code varchar(64) not null comment '设备编码',
machinery_name varchar(255) not null comment '设备名称',
machinery_brand varchar(255) comment '品牌',
machinery_spec varchar(255) comment '规格型号',
mainten_time datetime not null comment '保养时间',
status varchar(64) default 'PREPARE' comment '状态',
remark varchar(500) default '' comment '备注',
attr1 varchar(64) default null comment '预留字段1',
attr2 varchar(255) default null comment '预留字段2',
attr3 int(11) default 0 comment '预留字段3',
attr4 int(11) default 0 comment '预留字段4',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
primary key (record_id)
) engine=innodb auto_increment=200 comment = '设备保养记录表';
-- ----------------------------
-- 8、设备保养记录行表
-- ----------------------------
drop table if exists dv_mainten_record_line;
create table dv_mainten_record_line (
line_id bigint(20) not null auto_increment comment '计划ID',
record_id bigint(20) not null comment '计划ID',
subject_id bigint(20) not null comment '项目ID',
subject_code varchar(64) not null comment '项目编码',
subject_name varchar(255) comment '项目名称',
subject_type varchar(64) comment '项目类型',
subject_content varchar(500) not null comment '项目内容',
subject_standard varchar(255) comment '标准',
mainten_status varchar(64) not null comment '保养结果',
mainten_result varchar(500) comment '异常描述',
attr1 varchar(64) default null comment '预留字段1',
attr2 varchar(255) default null comment '预留字段2',
attr3 int(11) default 0 comment '预留字段3',
attr4 int(11) default 0 comment '预留字段4',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
primary key (line_id)
) engine=innodb auto_increment=200 comment = '设备保养记录行表';
-- ---------------------------- -- ----------------------------
-- 7、设备维修单 -- 7、设备维修单
-- ---------------------------- -- ----------------------------
@ -223,3 +344,29 @@ create table dv_repair_line (
) engine=innodb auto_increment=200 comment = '设备维修单行'; ) engine=innodb auto_increment=200 comment = '设备维修单行';
-- ----------------------------
-- 7、设备开停机记录表
-- ----------------------------
drop table if exists dv_dss_record;
create table dv_dss_record (
record_id bigint(20) not null auto_increment comment '记录ID',
plan_code varchar(64) comment '记录编号',
record_type varchar(64) default 'STOP' comment '记录类型',
machinery_id bigint(20) not null comment '设备ID',
machinery_code varchar(64) not null comment '设备编码',
machinery_name varchar(255) not null comment '设备名称',
machinery_brand varchar(255) comment '品牌',
machinery_spec varchar(255) comment '规格型号',
record_time datetime not null comment '记录时间',
status varchar(64) default 'PREPARE' comment '状态',
remark varchar(500) default '' comment '备注',
attr1 varchar(64) default null comment '预留字段1',
attr2 varchar(255) default null comment '预留字段2',
attr3 int(11) default 0 comment '预留字段3',
attr4 int(11) default 0 comment '预留字段4',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
primary key (record_id)
) engine=innodb auto_increment=200 comment = '设备保养记录表';

View File

@ -95,8 +95,8 @@ public class ProWorkorder extends TreeEntity
private Date requestDate; private Date requestDate;
/** 完成时间 */ /** 完成时间 */
@JsonFormat(pattern = "yyyy-MM-dd hh:mi:ss") @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
@Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd hh:mi:ss") @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd hh:mm:ss")
private Date finishDate; private Date finishDate;
/** 单据状态 */ /** 单据状态 */

View File

@ -14,6 +14,7 @@ import com.ktg.mes.qc.service.*;
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;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
@ -116,6 +117,14 @@ public class QcIpqcController extends BaseController
qcIpqc.setSpecification(workorder.getProductSpc()); qcIpqc.setSpecification(workorder.getProductSpc());
qcIpqc.setUnitOfMeasure(workorder.getUnitOfMeasure()); qcIpqc.setUnitOfMeasure(workorder.getUnitOfMeasure());
//查询工序相关信息
List<QcIpqc> infos = qcIpqcService.getProcessInfo(qcIpqc);
if(!CollectionUtils.isEmpty(infos)&&infos.size() ==1){
qcIpqc.setProcessId(infos.get(0).getProcessId());
qcIpqc.setProcessCode(infos.get(0).getProcessCode());
qcIpqc.setProcessName(infos.get(0).getProcessName());
}
//根据产品和检测类型获取检测模板 //根据产品和检测类型获取检测模板
QcTemplate param = new QcTemplate(); QcTemplate param = new QcTemplate();
param.setQcTypes(qcIpqc.getIpqcType()); param.setQcTypes(qcIpqc.getIpqcType());
@ -151,6 +160,9 @@ public class QcIpqcController extends BaseController
return AjaxResult.error("检测单编码已存在!"); return AjaxResult.error("检测单编码已存在!");
} }
//对合格品和不合格品数量进行检查
//根据工单获取产品信息 //根据工单获取产品信息
ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(qcIpqc.getWorkorderId()); ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(qcIpqc.getWorkorderId());
qcIpqc.setWorkorderId(workorder.getWorkorderId()); qcIpqc.setWorkorderId(workorder.getWorkorderId());
@ -162,6 +174,14 @@ public class QcIpqcController extends BaseController
qcIpqc.setSpecification(workorder.getProductSpc()); qcIpqc.setSpecification(workorder.getProductSpc());
qcIpqc.setUnitOfMeasure(workorder.getUnitOfMeasure()); qcIpqc.setUnitOfMeasure(workorder.getUnitOfMeasure());
//查询工序相关信息
List<QcIpqc> infos = qcIpqcService.getProcessInfo(qcIpqc);
if(!CollectionUtils.isEmpty(infos)&&infos.size() ==1){
qcIpqc.setProcessId(infos.get(0).getProcessId());
qcIpqc.setProcessCode(infos.get(0).getProcessCode());
qcIpqc.setProcessName(infos.get(0).getProcessName());
}
//根据产品和检测类型获取检测模板 //根据产品和检测类型获取检测模板
QcTemplate param = new QcTemplate(); QcTemplate param = new QcTemplate();
param.setQcTypes(qcIpqc.getIpqcType()); param.setQcTypes(qcIpqc.getIpqcType());

View File

@ -34,6 +34,14 @@ public interface QcIpqcMapper
*/ */
public QcIpqc checkIpqcCodeUnique(QcIpqc qcIpqc); public QcIpqc checkIpqcCodeUnique(QcIpqc qcIpqc);
/**
* 根据当前传递的过程检验单查询更多工艺相关信息
* @param qcIpqc
* @return
*/
public List<QcIpqc> getProcessInfo(QcIpqc qcIpqc);
/** /**
* 新增过程检验单 * 新增过程检验单
* *

View File

@ -35,6 +35,14 @@ public interface IQcIpqcService
*/ */
public String checkIpqcCodeUnique(QcIpqc qcIpqc); public String checkIpqcCodeUnique(QcIpqc qcIpqc);
/**
* 根据当前传递的过程检验单查询更多工艺相关信息
* @param qcIpqc
* @return
*/
public List<QcIpqc> getProcessInfo(QcIpqc qcIpqc);
/** /**
* 新增过程检验单 * 新增过程检验单
* *

View File

@ -57,6 +57,11 @@ public class QcIpqcServiceImpl implements IQcIpqcService
return UserConstants.UNIQUE; return UserConstants.UNIQUE;
} }
@Override
public List<QcIpqc> getProcessInfo(QcIpqc qcIpqc) {
return qcIpqcMapper.getProcessInfo(qcIpqc);
}
/** /**
* 新增过程检验单 * 新增过程检验单
* *

View File

@ -104,7 +104,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="checkIpqcCodeUnique" parameterType="QcIpqc" resultMap="QcIpqcResult"> <select id="checkIpqcCodeUnique" parameterType="QcIpqc" resultMap="QcIpqcResult">
select * from qc_ipqc where ipqc_code = #{ipqcCode} select * from qc_ipqc where ipqc_code = #{ipqcCode}
</select> </select>
<select id="getProcessInfo" parameterType="QcIpqc" resultMap="QcIpqcResult">
select pw.workorder_id, pw.workorder_code,pw.workorder_name, rp.process_id, rp.process_code,rp.process_name,mw.workstation_id, mw.workstation_code,mw.workstation_name
from pro_workorder pw
left join pro_route_product prp
on pw.product_code = prp.item_code
left join pro_route_process rp
on rp.route_id = prp.route_id
left join md_workstation mw
on mw.process_id = rp.process_id
<where>
<if test="workorderId">and pw.workorder_id = #{workorderId}</if>
<if test="workorderCode">and pw.workorder_code = #{workorderCode}</if>
<if test="workstationId">and mw.workstation_id = #{workstationId}</if>
<if test="workstationCode">and mw.workstation_code = #{workstationCode}</if>
</where>
</select>
<insert id="insertQcIpqc" parameterType="QcIpqc" useGeneratedKeys="true" keyProperty="ipqcId"> <insert id="insertQcIpqc" parameterType="QcIpqc" useGeneratedKeys="true" keyProperty="ipqcId">
insert into qc_ipqc insert into qc_ipqc
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">