报废审核驳回修改

This commit is contained in:
1539530615@qq.com 2024-01-26 13:03:26 +08:00
parent 7c741a45af
commit 1839e0537c
10 changed files with 285 additions and 37 deletions

View File

@ -78,6 +78,8 @@ public class LeaseOutDetails implements Serializable {
/** 备注 */ /** 备注 */
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;
/** 车牌号 */
private String carCode;
/** 数据所属组织 */ /** 数据所属组织 */
@ApiModelProperty(value = "数据所属组织") @ApiModelProperty(value = "数据所属组织")

View File

@ -142,6 +142,7 @@ public class MaType extends BaseEntity {
/** 图片路径 */ /** 图片路径 */
@ApiModelProperty(value = "图片路径") @ApiModelProperty(value = "图片路径")
private String photoUrl; private String photoUrl;
private String childPhoto;
/** 文档名称 */ /** 文档名称 */
@ApiModelProperty(value = "文档名称") @ApiModelProperty(value = "文档名称")

View File

@ -74,6 +74,9 @@
<if test="companyId!= null"> <if test="companyId!= null">
company_id, company_id,
</if> </if>
<if test="carCode!= null">
car_code,
</if>
create_time, create_time,
update_time update_time
</trim> </trim>
@ -105,6 +108,9 @@
<if test="companyId!= null"> <if test="companyId!= null">
#{companyId}, #{companyId},
</if> </if>
<if test="carCode!= null">
#{carCode},
</if>
NOW(), NOW(),
NOW() NOW()
</trim> </trim>

View File

@ -32,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="isPlan" column="is_plan" /> <result property="isPlan" column="is_plan" />
<result property="isAncuo" column="is_ancuo" /> <result property="isAncuo" column="is_ancuo" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="childPhoto" column="childPhoto" />
</resultMap> </resultMap>
<sql id="selectMaTypeVo"> <sql id="selectMaTypeVo">
@ -347,17 +348,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectMaTypeTreeByLevel" resultMap="MaTypeResult" parameterType="java.lang.String"> <select id="selectMaTypeTreeByLevel" resultMap="MaTypeResult" parameterType="java.lang.String">
select m.type_id, m.type_name, m.parent_id, m.status, m.num, m.unit_id, m.manage_type,
m.lease_price, m.eff_time, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load,
m.holding_time, m.warn_num, m.del_flag, m.create_by, m.create_time,
m.remark, m.company_id
from ma_type m
<where>
m.level = '4' and m.parent_id = #{id,jdbcType=VARCHAR}
</where>
</select>
<select id="selectMaTypeListByLevelNotFour" resultMap="MaTypeResult">
select m.type_id, m.type_name, m.parent_id, m.status, m.num, m.unit_id, m.manage_type, select m.type_id, m.type_name, m.parent_id, m.status, m.num, m.unit_id, m.manage_type,
m.lease_price, m.eff_time, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load, m.lease_price, m.eff_time, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load,
m.holding_time, m.warn_num, m.del_flag, m.create_by, m.create_time, m.holding_time, m.warn_num, m.del_flag, m.create_by, m.create_time,
@ -365,7 +355,51 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from ma_type m from ma_type m
left join (select * from ma_type_file where file_type = '1') mtf on m.type_id = mtf.type_id left join (select * from ma_type_file where file_type = '1') mtf on m.type_id = mtf.type_id
<where> <where>
m.level != 4 m.level = '4' and m.parent_id = #{id,jdbcType=VARCHAR} and m.del_flag = '0'
</where>
</select>
<select id="selectMaTypeListByLevelNotFour" resultMap="MaTypeResult">
SELECT
m.type_id,
m.type_name,
m.parent_id,
m.STATUS,
m.num,
m.unit_id,
m.manage_type,
m.lease_price,
m.eff_time,
m.rent_price,
m.buy_price,
m.pay_price,
m.LEVEL,
m.rated_load,
m.test_load,
m.holding_time,
m.warn_num,
m.del_flag,
m.create_by,
m.create_time,
m.remark,
m.company_id,
mtf.file_url photoUrl,
mt.photoUrl as childPhoto
FROM
ma_type m
LEFT JOIN ( SELECT * FROM ma_type_file WHERE file_type = '1' ) mtf ON m.type_id = mtf.type_id
LEFT JOIN (
SELECT
m.*,
mtf.file_url photoUrl
FROM
ma_type m
LEFT JOIN ( SELECT * FROM ma_type_file WHERE file_type = '1' ) mtf ON m.type_id = mtf.type_id
WHERE
m.del_flag = '0'
) mt on mt.parent_id = m.type_id
<where>
m.level != 4 and m.del_flag = '0'
<if test="parentId!= null and parentId != ''"> <if test="parentId!= null and parentId != ''">
and m.parent_id = #{parentId} and m.parent_id = #{parentId}
</if> </if>

View File

@ -1,5 +1,7 @@
package com.bonus.sgzb.material.mapper; package com.bonus.sgzb.material.mapper;
import com.bonus.sgzb.material.domain.BackApplyInfo;
import com.bonus.sgzb.material.domain.RepairAuditDetails;
import com.bonus.sgzb.material.domain.ScrapApplyDetails; import com.bonus.sgzb.material.domain.ScrapApplyDetails;
import com.bonus.sgzb.material.vo.ScrapApplyDetailsVO; import com.bonus.sgzb.material.vo.ScrapApplyDetailsVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -72,4 +74,18 @@ public interface ScrapApplyDetailsMapper
String selectTypeNameByTaskId(Long taskId); String selectTypeNameByTaskId(Long taskId);
List<ScrapApplyDetailsVO> exportScrapApplyDetailsList(ScrapApplyDetails bean); List<ScrapApplyDetailsVO> exportScrapApplyDetailsList(ScrapApplyDetails bean);
List<ScrapApplyDetails> selectnotScrapByTaskId(Long taskId);
int addBackDetails(ScrapApplyDetails bean);
BackApplyInfo getBackApplyInfo(int parentId);
int addBackInfo(BackApplyInfo backApplyInfo);
RepairAuditDetails getRepairAudit(Long parentId);
int addRepaieAudit(RepairAuditDetails details);
int updateStatus(ScrapApplyDetails bean);
} }

View File

@ -319,6 +319,8 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
for (RepairAuditDetails bean : auditDetailList){ for (RepairAuditDetails bean : auditDetailList){
bean.setAuditBy(SecurityUtils.getLoginUser().getUserid()); bean.setAuditBy(SecurityUtils.getLoginUser().getUserid());
bean.setStatus(status); bean.setStatus(status);
bean.setUpdateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
bean.setAuditRemark(scrapAudit.getRemark());
repairAuditDetailsMapper.updateStatus(bean); repairAuditDetailsMapper.updateStatus(bean);
} }
} }
@ -327,6 +329,8 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
for (RepairAuditDetails bean : auditAllList){ for (RepairAuditDetails bean : auditAllList){
bean.setAuditBy(SecurityUtils.getLoginUser().getUserid()); bean.setAuditBy(SecurityUtils.getLoginUser().getUserid());
bean.setStatus(status); bean.setStatus(status);
bean.setUpdateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
bean.setAuditRemark(scrapAudit.getRemark());
repairAuditDetailsMapper.updateStatus(bean); repairAuditDetailsMapper.updateStatus(bean);
} }
} }

View File

@ -1,18 +1,23 @@
package com.bonus.sgzb.material.service.impl; package com.bonus.sgzb.material.service.impl;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.bonus.sgzb.common.core.exception.ServiceException;
import com.bonus.sgzb.common.core.utils.DateUtils; import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.common.security.utils.SecurityUtils; import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.material.domain.ScrapApplyDetails; import com.bonus.sgzb.material.domain.*;
import com.bonus.sgzb.material.domain.TmTask;
import com.bonus.sgzb.material.mapper.PurchaseCheckInfoMapper; import com.bonus.sgzb.material.mapper.PurchaseCheckInfoMapper;
import com.bonus.sgzb.material.mapper.ScrapApplyDetailsMapper; import com.bonus.sgzb.material.mapper.ScrapApplyDetailsMapper;
import com.bonus.sgzb.material.mapper.TaskMapper; import com.bonus.sgzb.material.mapper.TaskMapper;
import com.bonus.sgzb.material.mapper.TmTaskAgreementMapper;
import com.bonus.sgzb.material.service.IScrapApplyDetailsService; import com.bonus.sgzb.material.service.IScrapApplyDetailsService;
import com.bonus.sgzb.material.vo.ScrapApplyDetailsVO; import com.bonus.sgzb.material.vo.ScrapApplyDetailsVO;
import com.bonus.sgzb.material.vo.ScrapAudit; import com.bonus.sgzb.material.vo.ScrapAudit;
import org.apache.catalina.security.SecurityUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -26,8 +31,7 @@ import javax.annotation.Resource;
* @date 2023-12-15 * @date 2023-12-15
*/ */
@Service @Service
public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
{
@Autowired @Autowired
private ScrapApplyDetailsMapper scrapApplyDetailsMapper; private ScrapApplyDetailsMapper scrapApplyDetailsMapper;
@ -37,6 +41,9 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService
@Resource @Resource
private TaskMapper taskMapper; private TaskMapper taskMapper;
@Resource
private TmTaskAgreementMapper agreementMapper;
/** /**
* 查询报废任务详细scrap_apply_details * 查询报废任务详细scrap_apply_details
* *
@ -44,8 +51,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService
* @return 报废任务详细scrap_apply_details * @return 报废任务详细scrap_apply_details
*/ */
@Override @Override
public ScrapApplyDetails selectScrapApplyDetailsById(Long id) public ScrapApplyDetails selectScrapApplyDetailsById(Long id) {
{
return scrapApplyDetailsMapper.selectScrapApplyDetailsById(id); return scrapApplyDetailsMapper.selectScrapApplyDetailsById(id);
} }
@ -61,8 +67,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService
* @return 报废任务详细scrap_apply_details * @return 报废任务详细scrap_apply_details
*/ */
@Override @Override
public List<ScrapApplyDetailsVO> selectScrapApplyDetailsList(ScrapApplyDetails scrapApplyDetails) public List<ScrapApplyDetailsVO> selectScrapApplyDetailsList(ScrapApplyDetails scrapApplyDetails) {
{
List<ScrapApplyDetailsVO> scrapApplyDetailsList = scrapApplyDetailsMapper.selectScrapApplyDetailsList(scrapApplyDetails); List<ScrapApplyDetailsVO> scrapApplyDetailsList = scrapApplyDetailsMapper.selectScrapApplyDetailsList(scrapApplyDetails);
for (ScrapApplyDetailsVO applyDetails : scrapApplyDetailsList) { for (ScrapApplyDetailsVO applyDetails : scrapApplyDetailsList) {
Long taskId = applyDetails.getTaskId(); Long taskId = applyDetails.getTaskId();
@ -79,8 +84,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertScrapApplyDetails(ScrapApplyDetails scrapApplyDetails) public int insertScrapApplyDetails(ScrapApplyDetails scrapApplyDetails) {
{
scrapApplyDetails.setCreateTime(DateUtils.getNowDate()); scrapApplyDetails.setCreateTime(DateUtils.getNowDate());
return scrapApplyDetailsMapper.insertScrapApplyDetails(scrapApplyDetails); return scrapApplyDetailsMapper.insertScrapApplyDetails(scrapApplyDetails);
} }
@ -92,8 +96,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateScrapApplyDetails(ScrapApplyDetails scrapApplyDetails) public int updateScrapApplyDetails(ScrapApplyDetails scrapApplyDetails) {
{
scrapApplyDetails.setUpdateTime(DateUtils.getNowDate()); scrapApplyDetails.setUpdateTime(DateUtils.getNowDate());
return scrapApplyDetailsMapper.updateScrapApplyDetails(scrapApplyDetails); return scrapApplyDetailsMapper.updateScrapApplyDetails(scrapApplyDetails);
} }
@ -105,8 +108,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteScrapApplyDetailsByIds(Long[] ids) public int deleteScrapApplyDetailsByIds(Long[] ids) {
{
return scrapApplyDetailsMapper.deleteScrapApplyDetailsByIds(ids); return scrapApplyDetailsMapper.deleteScrapApplyDetailsByIds(ids);
} }
@ -117,8 +119,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteScrapApplyDetailsById(Long id) public int deleteScrapApplyDetailsById(Long id) {
{
return scrapApplyDetailsMapper.deleteScrapApplyDetailsById(id); return scrapApplyDetailsMapper.deleteScrapApplyDetailsById(id);
} }
@ -141,28 +142,115 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService
@Transactional @Transactional
public int auditScrap(ScrapAudit scrapAudit) throws Exception { public int auditScrap(ScrapAudit scrapAudit) throws Exception {
String checkResult = scrapAudit.getCheckResult(); String checkResult = scrapAudit.getCheckResult();
List<ScrapApplyDetails> scrapDetailList = scrapAudit.getScrapDetailList();
List<Long> taskIdList = scrapAudit.getTaskIdList(); List<Long> taskIdList = scrapAudit.getTaskIdList();
for (Long taskId : taskIdList) { for (Long taskId : taskIdList) {
// 查询协议表 String status = "0";
TmTask task1 = taskMapper.selectTmTaskByTaskId(taskId); TmTask task1 = taskMapper.selectTmTaskByTaskId(taskId);
// 查询协议表
TmTaskAgreement tmTaskAgreement = agreementMapper.selectTmTaskAgreementByTaskId(taskId);
List<ScrapApplyDetails> notScrapList = scrapApplyDetailsMapper.selectnotScrapByTaskId(taskId);
List<ScrapApplyDetails> scrapAllApplyDetails = scrapApplyDetailsMapper.selectScrapDetailsByTaskId(taskId);
if (task1.getTaskStatus() == 47) { if (task1.getTaskStatus() == 47) {
throw new Exception("报废审核已通过"); throw new Exception("报废审核已通过");
} }
TmTask task = new TmTask(); TmTask task = new TmTask();
task.setTaskId(taskId); task.setTaskId(taskId);
List<ScrapApplyDetails> scrapApplyDetailsList;
if (scrapDetailList != null && scrapDetailList.size()>0){
scrapApplyDetailsList = new ArrayList<>(scrapDetailList);
}else {
scrapApplyDetailsList = new ArrayList<>(scrapAllApplyDetails);
}
String taskCode ="";
int taskStatus= 0;
int taskType = 0;
int companyId = 0;
int parentId = 0;
if ("通过".equals(checkResult)) { if ("通过".equals(checkResult)) {
List<ScrapApplyDetails> scrapApplyDetailsList = scrapApplyDetailsMapper.selectScrapDetailsByTaskId(taskId); status = "1";
for (ScrapApplyDetails scrapApplyDetails : scrapApplyDetailsList) { if (scrapApplyDetailsList.size()>0){
Long maId = scrapApplyDetails.getMaId(); for (ScrapApplyDetails scrapApplyDetails : scrapApplyDetailsList) {
if (maId != null && maId > 0) { Long maId = scrapApplyDetails.getMaId();
scrapApplyDetailsMapper.updateMachine(maId); if (maId != null && maId > 0) {
scrapApplyDetailsMapper.updateMachine(maId);
}
} }
} }
task.setTaskStatus(59); if (notScrapList.size() == scrapApplyDetailsList.size()){
task.setTaskStatus(59);
}
}else { }else {
task.setTaskStatus(61); status = "2";
List<ScrapApplyDetails> backList = new ArrayList<>();
List<ScrapApplyDetails> repairList = new ArrayList<>();
if (scrapApplyDetailsList.size()>0){
for (ScrapApplyDetails bean : scrapApplyDetailsList){
if (bean.getScrapSource().equals("1")){
backList.add(bean);
}else if (bean.getScrapSource().equals("2")){
repairList.add(bean);
}
}
}
if (backList.size()>0){
if (backList.get(0).getCompanyId() != null){
companyId = Math.toIntExact(backList.get(0).getCompanyId());
}
if (backList.get(0).getParentId() != null){
parentId = Math.toIntExact(backList.get(0).getParentId());
}
taskCode = purchaseCodeRule("T",36);
taskStatus = 39;
taskType = 36;
long backTaskId = genTask(taskCode,taskType,taskStatus,tmTaskAgreement,companyId);
BackApplyInfo backApplyInfo = scrapApplyDetailsMapper.getBackApplyInfo(parentId);
backApplyInfo.setCode(taskCode);
backApplyInfo.setTaskId((int) backTaskId);
backApplyInfo.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
backApplyInfo.setUpdateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
scrapApplyDetailsMapper.addBackInfo(backApplyInfo);
for (ScrapApplyDetails bean : backList){
bean.setParentId(backApplyInfo.getId());
bean.setStatus("1");
bean.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
bean.setUpdateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
scrapApplyDetailsMapper.addBackDetails(bean);
}
}
if (repairList.size() >0){
if (repairList.get(0).getCompanyId() != null){
companyId = Math.toIntExact(repairList.get(0).getCompanyId());
}
taskCode = purchaseCodeRule("WX",45);
taskStatus = 46;
taskType = 45;
long repairTaskId = genTask(taskCode,taskType,taskStatus,tmTaskAgreement,companyId);
for (ScrapApplyDetails bean : repairList){
RepairAuditDetails details = scrapApplyDetailsMapper.getRepairAudit(bean.getParentId());
details.setTaskId(repairTaskId);
details.setStatus("0");
details.setRepairedNum(BigDecimal.valueOf(0));
details.setScrapNum(bean.getScrapNum());
details.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
details.setUpdateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
scrapApplyDetailsMapper.addRepaieAudit(details);
}
}
if (notScrapList.size() == scrapApplyDetailsList.size()){
task.setTaskStatus(61);
}
task.setRemark(scrapAudit.getRemark()); task.setRemark(scrapAudit.getRemark());
} }
if (scrapApplyDetailsList.size()>0){
for (ScrapApplyDetails bean :scrapApplyDetailsList){
bean.setAuditBy(SecurityUtils.getLoginUser().getUserid());
bean.setStatus(status);
bean.setAuditRemark(scrapAudit.getRemark());
bean.setUpdateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
scrapApplyDetailsMapper.updateStatus(bean);
}
}
task.setUpdateTime(new Date()); task.setUpdateTime(new Date());
task.setUpdateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid())); task.setUpdateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
taskMapper.updateTmTask(task); taskMapper.updateTmTask(task);
@ -170,5 +258,42 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService
return 1; return 1;
} }
private String purchaseCodeRule(String code,Integer taskType) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
Date nowDate = DateUtils.getNowDate();
String format = dateFormat.format(nowDate);
int taskNum = taskMapper.selectTaskNumByMonth(nowDate,taskType) + 1;
String codeNum="";
if (taskNum>9 && taskNum<100){
codeNum = code + format + "-00" + taskNum;
}else if (taskNum>99 && taskNum<1000){
codeNum = code + format + "-0" + taskNum;
}else {
codeNum = code + format + "-000" + taskNum;
}
return codeNum;
}
private long genTask(String taskCode,int taskType,int taskStatus,TmTaskAgreement tmTaskAgreement,int companyId){
TmTask task = new TmTask();
task.setCode(taskCode);
task.setTaskStatus(taskStatus);
task.setTaskType(taskType);
task.setCompanyId(companyId);
task.setCreateTime(new Date());
task.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
taskMapper.insertTmTask(task);
// 添加协议信息表
TmTaskAgreement taskAgreement = new TmTaskAgreement();
long taskId = task.getTaskId();
taskAgreement.setTaskId(taskId);
if (tmTaskAgreement.getAgreementId() == null){
throw new ServiceException("缺少协议数据");
}else {
taskAgreement.setAgreementId(tmTaskAgreement.getAgreementId());
}
taskAgreement.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
agreementMapper.insertTmTaskAgreement(taskAgreement);
return taskId;
}
} }

View File

@ -1,6 +1,7 @@
package com.bonus.sgzb.material.vo; package com.bonus.sgzb.material.vo;
import com.bonus.sgzb.material.domain.RepairAuditDetails; import com.bonus.sgzb.material.domain.RepairAuditDetails;
import com.bonus.sgzb.material.domain.ScrapApplyDetails;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -21,4 +22,7 @@ public class ScrapAudit {
@ApiModelProperty(value = "审核任务明细") @ApiModelProperty(value = "审核任务明细")
private List<RepairAuditDetails> auditDetailList; private List<RepairAuditDetails> auditDetailList;
@ApiModelProperty(value = "报废任务明细")
private List<ScrapApplyDetails> scrapDetailList;
} }

View File

@ -212,7 +212,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update repair_audit_details update repair_audit_details
set audit_by = #{auditBy}, set audit_by = #{auditBy},
audit_time = now(), audit_time = now(),
status = #{status} status = #{status},
update_by = #{updateBy},
update_time = now(),
audit_remark = #{auditRemark}
where id = #{id} where id = #{id}
</update> </update>

View File

@ -218,6 +218,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fileName != null">#{fileName},</if> <if test="fileName != null">#{fileName},</if>
</trim> </trim>
</insert> </insert>
<insert id="addBackDetails">
insert into back_apply_details (parent_id,type_id,pre_num,audit_num,status,create_by,create_time,update_by,update_time,company_id)
values (#{parentId},#{typeId},#{scrapNum},#{scrapNum},#{status},#{createBy},now(),#{updateBy},now(),#{companyId});
</insert>
<insert id="addBackInfo" useGeneratedKeys="true" keyProperty="id">
insert into back_apply_info (code,task_id,back_person,phone,direct_audit_by,direct_audit_time,direct_audit_remark,create_by,create_time,update_by,update_time,company_id,back_time,status)
values (#{code},#{taskId},#{backPerson},#{phone},#{directAuditBy},#{directAuditTime},#{directAuditRemark},#{createBy},now(),#{updateBy},now(),#{companyId},#{backTime},#{status});
</insert>
<insert id="addRepaieAudit">
insert into repair_audit_details (task_id,repair_id,ma_id,type_id,repair_num,repaired_num,scrap_num,status,create_by,create_time,update_by,update_time,company_id)
values (#{taskId},#{repairId},#{maId},#{typeId},#{repairNum},#{repairedNum},#{scrapNum},#{status},#{createBy},now(),#{updateBy},now(),#{companyId});
</insert>
<update id="updateScrapApplyDetails" parameterType="com.bonus.sgzb.material.domain.ScrapApplyDetails"> <update id="updateScrapApplyDetails" parameterType="com.bonus.sgzb.material.domain.ScrapApplyDetails">
update scrap_apply_details update scrap_apply_details
@ -285,6 +297,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateMachine"> <update id="updateMachine">
update ma_machine set ma_status = 22 where ma_id = #{maId} update ma_machine set ma_status = 22 where ma_id = #{maId}
</update> </update>
<update id="updateStatus">
update scrap_apply_details
set audit_by = #{auditBy},
audit_time = now(),
status = #{status},
update_by = #{updateBy},
update_time = now(),
audit_remark = #{auditRemark}
where id = #{id}
</update>
<select id="selectTypeNameByTaskId" resultType="java.lang.String"> <select id="selectTypeNameByTaskId" resultType="java.lang.String">
select GROUP_CONCAT(type_name) typeName from select GROUP_CONCAT(type_name) typeName from
@ -296,5 +318,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) t ) t
GROUP BY task_id GROUP BY task_id
</select> </select>
<select id="selectnotScrapByTaskId" resultType="com.bonus.sgzb.material.domain.ScrapApplyDetails">
<include refid="selectScrapApplyDetailsVo"/>
where task_id = #{taskId} and status = '0'
</select>
<select id="getBackApplyInfo" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">
select id,
code,
task_id as taskId,
back_person as backPerson,
phone,
direct_audit_by as directAuditBy,
direct_audit_time as directAuditTime,
direct_audit_remark as directAuditRemark,
company_id as companyId,
back_time as backTime,
status
from back_apply_info
where id = #{parentId}
</select>
<select id="getRepairAudit" resultType="com.bonus.sgzb.material.domain.RepairAuditDetails">
select id,
task_id as taskId,
repair_id as repairId,
ma_id as maId,
type_id as typeId,
repair_num as repairNum,
scrap_num as scrapNum,
company_id as companyId
from repair_audit_details
where id = #{parentId}
</select>
</mapper> </mapper>