Commit 136accc4 authored by 温志超's avatar 温志超

车间异常单更改流程

parent 3677e37d
......@@ -192,7 +192,7 @@ public class ProProductionSolution extends BaseEntity {
private String sapUsageId;
/**
* 规格书
* 单价
*/
@ApiModelProperty("单价")
private BigDecimal unitPrice;
......
......@@ -76,17 +76,38 @@ public class QcAbnormalReportController extends BaseController {
return toAjax(qcAbnormalReportService.deleteQcAbnormalReportByAbnormalReportIds(abnormalReportIds));
}
/**
* 开始处理异常单
*/
@PreAuthorize("@ss.hasPermi('qc:report:remove')")
@PostMapping("/start/{abnormalReportId}")
public AjaxResult start(@PathVariable Long abnormalReportId) {
qcAbnormalReportService.start(abnormalReportId);
return AjaxResult.success("操作成功");
}
/**
* 完成按钮的功能实现
*/
@PreAuthorize("@ss.hasPermi('qc:report:remove')")
@Log(title = "车间异常单", businessType = BusinessType.DELETE)
@PutMapping("/complete/{abnormalReportIds}")
public AjaxResult putStatus(@PathVariable Long abnormalReportIds) {
qcAbnormalReportService.updateQcAbnormalReportAbmornalStatud(abnormalReportIds);
@PutMapping("/complete")
public AjaxResult putStatus(@RequestBody QcAbnormalReport qcAbnormalReport) {
qcAbnormalReport.setAbnormalStatus("FINISH");
qcAbnormalReportService.updateQcAbnormalReportAbmornalStatud(qcAbnormalReport);
return AjaxResult.success("");
}
/**
* 关闭按钮的功能实现
*/
@PreAuthorize("@ss.hasPermi('qc:report:remove')")
@Log(title = "车间异常单", businessType = BusinessType.DELETE)
@PutMapping("/close")
public AjaxResult close(@RequestBody QcAbnormalReport qcAbnormalReport) {
qcAbnormalReport.setAbnormalStatus("CLOSE");
qcAbnormalReportService.updateQcAbnormalReportAbmornalStatud(qcAbnormalReport);
return AjaxResult.success("");
}
/**
......@@ -98,4 +119,6 @@ public class QcAbnormalReportController extends BaseController {
String abnormalNumber = qcAbnormalReportService.getAbnormalNumber();
return AjaxResult.success("操作成功",abnormalNumber);
}
}
......@@ -88,4 +88,34 @@ QcAbnormalReport extends BaseEntity
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endPurchaseDate;
/**
* 单据开始处理时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
/**
* 异常处理开始人
*/
private String startBy;
/**
* 处理结束时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
/**
* 处理结束人
*/
private String endBy;
/**
* 处理该异常的耗时
*/
private Long timeConsuming;
private String remarks;
}
......@@ -67,7 +67,9 @@ public interface IQcAbnormalReportService {
* @param abnormalReportIds 车间异常单主键
* @return 结果
*/
void updateQcAbnormalReportAbmornalStatud(Long abnormalReportIds);
void updateQcAbnormalReportAbmornalStatud(QcAbnormalReport qcAbnormalReport);
String getAbnormalNumber();
void start(Long abnormalReportIds);
}
......@@ -3,6 +3,7 @@ package com.ximai.mes.qc.service.impl;
import com.ximai.common.constant.UserConstants;
import com.ximai.common.exception.ServiceException;
import com.ximai.common.utils.MessageUtils;
import com.ximai.common.utils.SecurityUtils;
import com.ximai.common.utils.data.DateUtils;
import com.ximai.common.utils.data.ExceptionUtil;
import com.ximai.common.utils.data.StringUtils;
......@@ -26,6 +27,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
......@@ -163,20 +165,16 @@ public class QcAbnormalReportServiceImpl implements IQcAbnormalReportService {
}
/**
* 完成按钮的功能实现
* 完成或关闭按钮的功能实现
*
* @param abnormalReportIds 车间异常单主键
* @param
* @return 结果
*/
@Override
public void updateQcAbnormalReportAbmornalStatud(Long abnormalReportIds) {
QcAbnormalReport qcAbnormalReport = qcAbnormalReportMapper.selectQcAbnormalReportByAbnormalReportId(abnormalReportIds);
if (qcAbnormalReport.getAbnormalStatus().equals("SUBMIT")) {
throw new ServiceException(MessageUtils.message("qc.error.status.finished"));
}
if (qcAbnormalReport.getAbnormalStatus().equals("FINISH")) {
throw new ServiceException(MessageUtils.message("qc.error.status.finished"));
public void updateQcAbnormalReportAbmornalStatud(QcAbnormalReport qcAbnormalReportInput) {
QcAbnormalReport qcAbnormalReport = qcAbnormalReportMapper.selectQcAbnormalReportByAbnormalReportId(qcAbnormalReportInput.getAbnormalReportId());
if (!qcAbnormalReport.getAbnormalStatus().equals("SUBMIT")) {
throw new ServiceException(MessageUtils.message("车间异常单不处于处理中状态无法完成"));
}
//修改关联名称的工作单元的故障状态
MdWorkunitVo mdWorkunitVo = iMdWorkunitService.selectMdWorkunitByWorkunitId(qcAbnormalReport.getWorkstationId());
......@@ -186,7 +184,13 @@ public class QcAbnormalReportServiceImpl implements IQcAbnormalReportService {
BeanUtils.copyProperties(mdWorkunitVo, w);
iMdWorkunitService.updateMdWorkunit(w);
}
qcAbnormalReport.setAbnormalStatus("FINISH");
String endBy = SecurityUtils.getUsername();
qcAbnormalReport.setEndBy(endBy);
qcAbnormalReport.setEndTime(new Date());
if(qcAbnormalReport.getStartTime() != null)
qcAbnormalReport.setTimeConsuming(qcAbnormalReport.getStartTime().getTime() - qcAbnormalReport.getEndTime().getTime());
qcAbnormalReport.setRemarks(qcAbnormalReportInput.getRemarks());
qcAbnormalReport.setAbnormalStatus(qcAbnormalReportInput.getAbnormalStatus());
qcAbnormalReportMapper.updateQcAbnormalReport(qcAbnormalReport);
}
......@@ -195,4 +199,19 @@ public class QcAbnormalReportServiceImpl implements IQcAbnormalReportService {
return autoCodeUtil.genSerialCode("ABNORMAL_NUMBER", null);
}
@Override
public void start(Long abnormalReportIds) {
QcAbnormalReport qcAbnormalReport = qcAbnormalReportMapper.selectQcAbnormalReportByAbnormalReportId(abnormalReportIds);
if(qcAbnormalReport == null)
throw new ServiceException(MessageUtils.message("没能根据单据ID找到车间异常单"));
if (!qcAbnormalReport.getAbnormalStatus().equals("NOT")) {
throw new ServiceException(MessageUtils.message("车间异常单不处于未提交状态无法开始"));
}
String startBy = SecurityUtils.getUsername();
qcAbnormalReport.setStartBy(startBy);
qcAbnormalReport.setStartTime(new Date());
qcAbnormalReport.setAbnormalStatus("SUBMIT");
qcAbnormalReportMapper.updateQcAbnormalReport(qcAbnormalReport);
}
}
......@@ -23,11 +23,19 @@
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result column="abnormal_number" jdbcType="INTEGER" property="abnormalNumber" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="start_by" jdbcType="VARCHAR" property="startBy" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="end_by" jdbcType="VARCHAR" property="endBy" />
<result column="time_consuming" jdbcType="BIGINT" property="timeConsuming" />
</resultMap>
<sql id="selectQcAbnormalReportVo">
select abnormal_report_id, batch_number, process_id, task_id, task_workunit_id, process_code, process_name, workstation_id, workstation_code, workstation_name, abnormal_type, abnormal_reason, abnormal_time, abnormal_status, create_by, create_time, update_by, update_time
,abnormal_number
select abnormal_report_id, batch_number, process_id, task_id, task_workunit_id, process_code,
process_name, workstation_id, workstation_code, workstation_name, abnormal_type,
abnormal_reason, abnormal_time, abnormal_status, create_by, create_time, update_by,
update_time, abnormal_number, start_time, start_by, end_time, end_by, time_consuming,remarks
from qc_abnormal_report
</sql>
......@@ -46,8 +54,9 @@
<if test="abnormalType != null and abnormalType != ''"> and abnormal_type = #{abnormalType}</if>
<if test="abnormalReason != null and abnormalReason != ''"> and abnormal_reason = #{abnormalReason}</if>
<if test="abnormalTime != null "> and abnormal_time = #{abnormalTime}</if>
<if test="beginPurchaseDate != null "> abnormal_time BETWEEN #{beginPurchaseDate} </if>
<if test="endPurchaseDate != null "> and #{endPurchaseDate} </if>
<if test="beginPurchaseDate != null and endPurchaseDate != null ">
and report.abnormal_time between #{beginPurchaseDate} and #{endPurchaseDate}
</if>
<if test="abnormalStatus != null and abnormalStatus != ''"> and abnormal_status = #{abnormalStatus}</if>
<if test="abnormalNumber != null">and abnormal_number = #{abnormalNumber}</if>
</where>
......@@ -123,6 +132,25 @@
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=TIMESTAMP},
</if>
<if test="startBy != null">
start_by = #{startBy,jdbcType=VARCHAR},
</if>
<if test="endTime != null">
end_time = #{endTime,jdbcType=TIMESTAMP},
</if>
<if test="endBy != null">
end_by = #{endBy,jdbcType=VARCHAR},
</if>
<if test="timeConsuming != null">
time_consuming = #{timeConsuming,jdbcType=BIGINT},
</if>
<if test="remarks != null">
remarks = #{remarks},
</if>
</trim>
where abnormal_report_id = #{abnormalReportId}
</update>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment