审核模块

This commit is contained in:
dingjie 2023-12-19 09:01:17 +08:00
parent e9ddb918e3
commit 942ec67479
16 changed files with 479 additions and 78 deletions

View File

@ -70,8 +70,7 @@ public class RepairAuditDetailsController extends BaseController
@ApiOperation("修饰任务审核")
@Log(title = "修饰任务审核", businessType = BusinessType.UPDATE)
@PostMapping("/audit")
public AjaxResult audit(@RequestBody ScrapAudit scrapAudit)
{
public AjaxResult audit(@RequestBody ScrapAudit scrapAudit) throws Exception {
return toAjax(repairAuditDetailsService.auditRepair(scrapAudit));
}

View File

@ -70,8 +70,7 @@ public class ScrapApplyDetailsController extends BaseController
@ApiOperation("报废任务审核")
@Log(title = "报废任务审核", businessType = BusinessType.UPDATE)
@PostMapping("/audit")
public AjaxResult audit(@RequestBody ScrapAudit scrapAudit)
{
public AjaxResult audit(@RequestBody ScrapAudit scrapAudit) throws Exception {
return toAjax(scrapApplyDetailsService.auditScrap(scrapAudit));
}

View File

@ -6,6 +6,7 @@ import java.util.Date;
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.bonus.sgzb.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -71,6 +72,26 @@ public class RepairAuditDetails extends BaseEntity
@Excel(name = "数据所属组织")
private Integer companyId;
@ApiModelProperty(value = "规格型号")
private String specificationType;
@ApiModelProperty(value = "机具类型名称")
private String machineTypeName;
@ApiModelProperty(value = "机具编号")
private String maCode;
// 传入参数
@ApiModelProperty(value = "单位id")
private Integer backUnit;
@ApiModelProperty(value = "工程id")
private Integer backPro;
@ApiModelProperty(value = "工机具类型id")
private Integer type;
@ApiModelProperty(value = "维修单号")
private Integer backCode;
public void setId(Long id)
{
this.id = id;
@ -189,6 +210,62 @@ public class RepairAuditDetails extends BaseEntity
return companyId;
}
public String getSpecificationType() {
return specificationType;
}
public void setSpecificationType(String specificationType) {
this.specificationType = specificationType;
}
public String getMachineTypeName() {
return machineTypeName;
}
public void setMachineTypeName(String machineTypeName) {
this.machineTypeName = machineTypeName;
}
public String getMaCode() {
return maCode;
}
public void setMaCode(String maCode) {
this.maCode = maCode;
}
public Integer getBackUnit() {
return backUnit;
}
public void setBackUnit(Integer backUnit) {
this.backUnit = backUnit;
}
public Integer getBackPro() {
return backPro;
}
public void setBackPro(Integer backPro) {
this.backPro = backPro;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getBackCode() {
return backCode;
}
public void setBackCode(Integer backCode) {
this.backCode = backCode;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -0,0 +1,169 @@
package com.bonus.sgzb.material.domain;
import java.math.BigDecimal;
import com.bonus.sgzb.common.core.annotation.Excel;
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 修试后入库对象
*
* @author bonus
* @date 2023-12-18
*/
public class RepairInputDetails extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 任务ID */
@Excel(name = "任务ID")
private Long taskId;
/** 维修审核ID */
@Excel(name = "维修审核ID")
private Long auditId;
/** 维修ID */
@Excel(name = "维修ID")
private Long repairId;
/** 机具ID */
@Excel(name = "机具ID")
private Long maId;
/** 规格ID */
@Excel(name = "规格ID")
private Long typeId;
/** 维修合格数量 */
@Excel(name = "维修合格数量")
private BigDecimal repairNum;
/** 入库数量 */
@Excel(name = "入库数量")
private BigDecimal inputNum;
/** 0未审核1已入库2驳回 */
@Excel(name = "0未审核1已入库2驳回")
private String status;
/** 数据所属组织 */
@Excel(name = "数据所属组织")
private Long companyId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTaskId(Long taskId)
{
this.taskId = taskId;
}
public Long getTaskId()
{
return taskId;
}
public void setAuditId(Long auditId)
{
this.auditId = auditId;
}
public Long getAuditId()
{
return auditId;
}
public void setRepairId(Long repairId)
{
this.repairId = repairId;
}
public Long getRepairId()
{
return repairId;
}
public void setMaId(Long maId)
{
this.maId = maId;
}
public Long getMaId()
{
return maId;
}
public void setTypeId(Long typeId)
{
this.typeId = typeId;
}
public Long getTypeId()
{
return typeId;
}
public void setRepairNum(BigDecimal repairNum)
{
this.repairNum = repairNum;
}
public BigDecimal getRepairNum()
{
return repairNum;
}
public void setInputNum(BigDecimal inputNum)
{
this.inputNum = inputNum;
}
public BigDecimal getInputNum()
{
return inputNum;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setCompanyId(Long companyId)
{
this.companyId = companyId;
}
public Long getCompanyId()
{
return companyId;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("taskId", getTaskId())
.append("auditId", getAuditId())
.append("repairId", getRepairId())
.append("maId", getMaId())
.append("typeId", getTypeId())
.append("repairNum", getRepairNum())
.append("inputNum", getInputNum())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("status", getStatus())
.append("remark", getRemark())
.append("companyId", getCompanyId())
.toString();
}
}

View File

@ -90,6 +90,19 @@ public class ScrapApplyDetails extends BaseEntity
@ApiModelProperty(value = "机具编号")
private String maCode;
// 传入参数
@ApiModelProperty(value = "单位id")
private Integer backUnit;
@ApiModelProperty(value = "工程id")
private Integer backPro;
@ApiModelProperty(value = "工机具类型id")
private Integer type;
@ApiModelProperty(value = "维修单号")
private Integer backCode;
public void setId(Long id)
{
this.id = id;
@ -250,6 +263,38 @@ public class ScrapApplyDetails extends BaseEntity
this.maCode = maCode;
}
public Integer getBackUnit() {
return backUnit;
}
public void setBackUnit(Integer backUnit) {
this.backUnit = backUnit;
}
public Integer getBackPro() {
return backPro;
}
public void setBackPro(Integer backPro) {
this.backPro = backPro;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getBackCode() {
return backCode;
}
public void setBackCode(Integer backCode) {
this.backCode = backCode;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -1,9 +1,6 @@
package com.bonus.sgzb.material.mapper;
import com.bonus.sgzb.material.domain.RepairTestInputDetailVo;
import com.bonus.sgzb.material.domain.RepairTestInputDto;
import com.bonus.sgzb.material.domain.RepairTestInputVo;
import com.bonus.sgzb.material.domain.RepairTestWarehousingDto;
import com.bonus.sgzb.material.domain.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@ -105,4 +102,6 @@ public interface RepairTestInputMapper {
* @date 2023/12/16 21:19
*/
void updateTmTaskStatus(@Param("params") RepairTestWarehousingDto dto, @Param("dictId") int dicId);
int insertRepairInputDetails(RepairInputDetails repairTestWarehousingDto);
}

View File

@ -66,5 +66,5 @@ public interface IRepairAuditDetailsService
List<RepairAuditDetails> getRepairAuditList(RepairAuditDetails repairAuditDetails);
int auditRepair(ScrapAudit scrapAudit);
int auditRepair(ScrapAudit scrapAudit) throws Exception;
}

View File

@ -64,6 +64,6 @@ public interface IScrapApplyDetailsService
List<ScrapApplyDetails> getScrapAuditList(ScrapApplyDetails scrapApplyDetails);
int auditScrap(ScrapAudit scrapAudit);
int auditScrap(ScrapAudit scrapAudit) throws Exception;
}

View File

@ -8,15 +8,15 @@ import java.util.List;
import com.bonus.sgzb.base.api.domain.TmTask;
import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.material.domain.RepairAuditDetails;
import com.bonus.sgzb.material.domain.ScrapApplyDetails;
import com.bonus.sgzb.material.domain.TmTaskAgreement;
import com.bonus.sgzb.material.domain.*;
import com.bonus.sgzb.material.mapper.*;
import com.bonus.sgzb.material.service.IRepairAuditDetailsService;
import com.bonus.sgzb.material.vo.ScrapApplyDetailsVO;
import com.bonus.sgzb.material.vo.ScrapAudit;
import javafx.concurrent.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
@ -41,6 +41,9 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
@Resource
private ScrapApplyDetailsMapper scrapApplyDetailsMapper;
@Resource
private RepairTestInputMapper repairTestInputMapper;
/**
* 查询修试审核详细repair_apply_details
@ -149,10 +152,16 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
* @return 结果
*/
@Override
public int auditRepair(ScrapAudit scrapAudit) {
@Transactional
public int auditRepair(ScrapAudit scrapAudit) throws Exception {
String checkResult = scrapAudit.getCheckResult();
List<Long> taskIdList = scrapAudit.getTaskIdList();
for (Long taskId : taskIdList) {
TmTask task1 = taskMapper.selectTmTaskByTaskId(taskId);
if (task1.getTaskStatus() == 47) {
throw new Exception("任务已审核已通过");
}
if ("通过".equals(checkResult)) {
// 查询协议表
TmTaskAgreement tmTaskAgreement = agreementMapper.selectTmTaskAgreementByTaskId(taskId);
List<RepairAuditDetails> repairAuditDetailsList = repairAuditDetailsMapper.selectRepairAuditDetailsByTaskId(taskId);
@ -161,7 +170,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
Long maId = repairAuditDetails.getMaId();
BigDecimal repairNum = repairAuditDetails.getRepairNum();
BigDecimal b = new BigDecimal(0);
// 创建修任务
// 创建饰后入库任务
if (repairNum.compareTo(b) > 0) {
TmTask task = new TmTask();
task.setCode(purchaseCodeRule("R",50));
@ -178,7 +187,16 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
agreementMapper.insertTmTaskAgreement(taskAgreement);
// 添加修试后入库任务
RepairInputDetails repairInputDetails = new RepairInputDetails();
repairInputDetails.setTaskId(task.getTaskId());
repairInputDetails.setAuditId(repairAuditDetails.getId());
repairInputDetails.setInputNum(repairAuditDetails.getRepairNum());
repairInputDetails.setTypeId(repairAuditDetails.getTypeId());
repairInputDetails.setMaId(repairAuditDetails.getMaId());
repairInputDetails.setStatus("0");
repairInputDetails.setCreateTime(new Date());
repairTestInputMapper.insertRepairInputDetails(repairInputDetails);
}
// 创建报废任务
@ -212,10 +230,19 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
}
}
} else {
// 修饰审核任务不通过时
TmTask tmTask = new TmTask();
tmTask.setTaskId(taskId);
tmTask.setRemark(scrapAudit.getRemark());
tmTask.setTaskStatus(47);
tmTask.setUpdateTime(new Date());
tmTask.setUpdateBy(SecurityUtils.getUsername());
taskMapper.updateTmTask(tmTask);
}
}
return 0;
return 1;
}
// 采购单号编码生成规则

View File

@ -1,9 +1,11 @@
package com.bonus.sgzb.material.service.impl;
import java.util.Date;
import java.util.List;
import com.bonus.sgzb.base.api.domain.TmTask;
import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.material.domain.ScrapApplyDetails;
import com.bonus.sgzb.material.mapper.PurchaseCheckInfoMapper;
import com.bonus.sgzb.material.mapper.ScrapApplyDetailsMapper;
@ -13,6 +15,7 @@ import com.bonus.sgzb.material.vo.ScrapApplyDetailsVO;
import com.bonus.sgzb.material.vo.ScrapAudit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
@ -130,10 +133,16 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService
* @return 结果
*/
@Override
public int auditScrap(ScrapAudit scrapAudit) {
@Transactional
public int auditScrap(ScrapAudit scrapAudit) throws Exception {
String checkResult = scrapAudit.getCheckResult();
List<Long> taskIdList = scrapAudit.getTaskIdList();
for (Long taskId : taskIdList) {
// 查询协议表
TmTask task1 = taskMapper.selectTmTaskByTaskId(taskId);
if (task1.getTaskStatus() == 47) {
throw new Exception("报废审核已通过");
}
TmTask task = new TmTask();
task.setTaskId(taskId);
if ("通过".equals(checkResult)) {
@ -147,7 +156,10 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService
task.setTaskStatus(59);
}else {
task.setTaskStatus(61);
task.setRemark(scrapAudit.getRemark());
}
task.setUpdateTime(new Date());
task.setUpdateBy(SecurityUtils.getUsername());
taskMapper.updateTmTask(task);
}
return 1;

View File

@ -37,6 +37,9 @@ public class ScrapApplyDetailsVO {
// 审核状态
private Integer taskStatus;
// 审核状态
private String taskStatusName;
// 不通过原因
private String remark;

View File

@ -14,4 +14,7 @@ public class ScrapAudit {
@ApiModelProperty(value = "审核任务id")
private List<Long> taskIdList;
@ApiModelProperty(value = "不通过原因")
private String remark;
}

View File

@ -30,8 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt1.type_name typeName, mma.ma_id maId
from purchase_macode_info pmi
left join ma_type mt on pmi.type_id = mt.type_id
left join (select type_id,type_name,parent_id from ma_type
where type_id in (select parent_id from ma_type where type_id = #{typeId})) mt1 on mt.parent_id = mt1.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
left join ma_machine mma on pmi.ma_code = mma.ma_code
where pmi.task_id = #{taskId}
<if test="typeId != null "> and pmi.type_id = #{typeId}</if>

View File

@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectRepairAuditDetailsList" parameterType="com.bonus.sgzb.material.domain.RepairAuditDetails" resultMap="RepairAuditDetailsResult">
select sad.* ,mt.type_name, mt1.type_name , mma.ma_code
select rad.* ,mt.type_name specificationType, mt1.type_name machineTypeName, mma.ma_code maCode
from repair_audit_details rad
left join ma_type mt on rad.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
@ -123,14 +123,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<select id="selectRepairQuestList" resultType="com.bonus.sgzb.material.vo.ScrapApplyDetailsVO">
select tk.code scrapNum,tk.task_status taskStatus, bui.unit_name unitName,bpl.lot_name projectName,
select tk.code scrapNum,tk.task_status taskStatus, dic.name taskStatusName, bui.unit_name unitName,bpl.lot_name projectName,
tk.create_by createBy, tk.create_time createTime, tk.remark ,tk.code repairNum,tk.task_id taskId
from tm_task tk
left join tm_task_agreement tta on tk.task_id = tta.task_id
left join bm_agreement_info bai on tta.agreement_id = bai.agreement_id
left join bm_project_lot bpl on bai.project_id = bpl.lot_id
left join bm_unit_info bui on bai.unit_id = bui.unit_id
left join (select id,p_id,name from sys_dic where p_id in (select id from sys_dic where value = 'ws_shenhe')) dic on tk.task_status = dic.id
left join repair_audit_details rad on tk.task_id = rad.task_id
left join ma_type mt on rad.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
where tk.task_type = 45
<if test="backUnit != null">
and bui.unit_id = #{backUnit}
</if>
<if test="backPro != null">
and bpl.lot_id = #{backPro}
</if>
<if test="type != null">
and mt1.type_id = #{type}
</if>
<if test="backCode != null">
and tk.code = #{backCode}
</if>
</select>
<select id="selectRepairAuditDetailsByTaskId" resultMap="RepairAuditDetailsResult">

View File

@ -146,4 +146,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
COUNT(*) AS totalNum
FROM repair_input_details WHERE task_id = #{taskId}
</select>
<insert id="insertRepairInputDetails" parameterType="com.bonus.sgzb.material.domain.RepairInputDetails">
insert into repair_input_details
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="taskId != null">task_id,</if>
<if test="auditId != null">audit_id,</if>
<if test="repairId != null">repair_id,</if>
<if test="maId != null">ma_id,</if>
<if test="typeId != null">type_id,</if>
<if test="repairNum != null">repair_num,</if>
<if test="inputNum != null">input_num,</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>
<if test="status != null">status,</if>
<if test="remark != null">remark,</if>
<if test="companyId != null">company_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="taskId != null">#{taskId},</if>
<if test="auditId != null">#{auditId},</if>
<if test="repairId != null">#{repairId},</if>
<if test="maId != null">#{maId},</if>
<if test="typeId != null">#{typeId},</if>
<if test="repairNum != null">#{repairNum},</if>
<if test="inputNum != null">#{inputNum},</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>
<if test="status != null">#{status},</if>
<if test="remark != null">#{remark},</if>
<if test="companyId != null">#{companyId},</if>
</trim>
</insert>
</mapper>

View File

@ -32,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectScrapApplyDetailsList" parameterType="com.bonus.sgzb.material.domain.ScrapApplyDetails" resultType="com.bonus.sgzb.material.vo.ScrapApplyDetailsVO">
select tk.code scrapNum,tk.task_status taskStatus, bui.unit_name unitName,bpl.lot_name projectName,
select tk.code scrapNum,tk.task_status taskStatus, dic.name taskStatusName, bui.unit_name unitName,bpl.lot_name projectName,
tk.create_by createBy, tk.create_time createTime, tk.remark ,tk1.code repairNum,tk.task_id taskId
from tm_task tk
left join tm_task_agreement tta on tk.task_id = tta.task_id
@ -41,7 +41,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join bm_unit_info bui on bai.unit_id = bui.unit_id
left join scrap_apply_details sad on tk.task_id = sad.task_id
left join tm_task tk1 on sad.parent_id = tk1.task_id
left join (select id,p_id,name from sys_dic where p_id in (select id from sys_dic where value = 'bf_task')) dic on tk.task_status = dic.id
left join ma_type mt on sad.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
where sad.scrap_source in ('1','2') and tk.task_type = 57
<if test="backUnit != null">
and bui.unit_id = #{backUnit}
</if>
<if test="backPro != null">
and bpl.lot_id = #{backPro}
</if>
<if test="type != null">
and mt1.type_id = #{type}
</if>
<if test="backCode != null">
and tk.code = #{backCode}
</if>
</select>
<select id="selectScrapApplyDetailsById" parameterType="Long" resultMap="ScrapApplyDetailsResult">
@ -135,7 +150,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<select id="selectScrapAuditList" resultMap="ScrapApplyDetailsResult">
select sad.* ,mt.type_name, mt1.type_name , mma.ma_code
select sad.* ,mt.type_name specificationType, mt1.type_name machineTypeName, mma.ma_code maCode
from scrap_apply_details sad
left join ma_type mt on pcd.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id