报废优化

This commit is contained in:
mashuai 2025-01-03 15:06:19 +08:00
parent ba3fc88ce0
commit b4e3a03c9b
4 changed files with 80 additions and 19 deletions

View File

@ -4,6 +4,7 @@ import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.bonus.material.basic.domain.BmFileInfo;
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.bonus.common.core.annotation.Excel;
@ -39,6 +40,9 @@ public class ScrapApplyDetails extends BaseEntity {
@ApiModelProperty(value = "任务ID")
private Long taskId;
@ApiModelProperty(value = "维修ID")
private Long repairId;
@ApiModelProperty(value = "前任务ID")
private Long preTaskId;
@ -75,7 +79,7 @@ public class ScrapApplyDetails extends BaseEntity {
private Long typeId;
@ApiModelProperty(value = "规格型号名称")
private String type;
private String typeModelName;
@ApiModelProperty(value = "物资类型ID")
private Long typeNameId;
@ -94,6 +98,18 @@ public class ScrapApplyDetails extends BaseEntity {
@ApiModelProperty(value = "维修单号")
private String repairCode;
@ApiModelProperty(value = "退料数量")
private BigDecimal backNum;
@ApiModelProperty(value = "已修数量")
private BigDecimal repairNum;
@ApiModelProperty(value = "费用合计")
private BigDecimal totalCost;
@ApiModelProperty(value = "购置价")
private BigDecimal buyPrice;
/** 报废数量 */
@Excel(name = "报废数量")
@ApiModelProperty(value = "报废数量")
@ -141,6 +157,8 @@ public class ScrapApplyDetails extends BaseEntity {
@ApiModelProperty(value = "文件url")
private String fileUrl;
private List<BmFileInfo> fileList;
/** 报废备注 */
private String scrapRemark;
}

View File

@ -5,6 +5,8 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author : 阮世耀
* @version : 1.0
@ -25,8 +27,7 @@ public class ScrapTaskListVo {
@ApiModelProperty(value = "报废单号")
private String scrapCode;
@ApiModelProperty(value = "维修单号")
private String repairCode;
@ApiModelProperty(value = "组织id")
private Long companyId;
@ -34,32 +35,48 @@ public class ScrapTaskListVo {
@ApiModelProperty(value = "协议id")
private Long agreementId;
@ApiModelProperty(value = "机具类型")
@Excel(name = "机具类型",sort = 8)
private String type;
@ApiModelProperty(value = "规格型号")
@Excel(name = "规格型号",sort = 9)
private String typeName;
@ApiModelProperty(value = "退料单位名称")
@Excel(name = "退料单位名称",sort = 2)
@Excel(name = "退料单位")
private String backUnit;
@ApiModelProperty(value = "退料工程名称")
@Excel(name = "退料工程名称",sort = 3)
@Excel(name = "工程名称")
private String backPro;
@ApiModelProperty(value = "维修单号")
@Excel(name = "维修单号")
private String repairCode;
@ApiModelProperty(value = "机具类型")
@Excel(name = "物资类型")
private String type;
@ApiModelProperty(value = "任务创建人昵称")
@Excel(name = "提交人",sort = 4)
private String createName;
@ApiModelProperty(value = "任务创建人")
private Long createBy;
@ApiModelProperty(value = "任务创建时间")
@Excel(name = "任务创建时间",sort = 5)
private String createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "提交时间", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@ApiModelProperty(value = "任务创建人昵称")
@Excel(name = "任务创建人",sort = 4)
private String createName;
@ApiModelProperty(value = "审核人")
private Long auditBy;
@ApiModelProperty(value = "审核人")
@Excel(name = "审核人")
private String auditByName;
@ApiModelProperty(value = "审核时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "审核时间", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date auditTime;
@ApiModelProperty(value = "更新时间")
private String updateTime;
@ -73,9 +90,11 @@ public class ScrapTaskListVo {
private String endTime;
@ApiModelProperty(value = "任务状态名称")
@Excel(name = "状态")
private String taskStatusName;
@ApiModelProperty(value = "备注")
@Excel(name = "备注")
private String remark;
private String keyWord;

View File

@ -1,5 +1,6 @@
package com.bonus.material.scrap.service.impl;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@ -12,6 +13,8 @@ import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.basic.domain.BmFileInfo;
import com.bonus.material.basic.mapper.BmFileInfoMapper;
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
import com.bonus.material.task.domain.TmTask;
import com.bonus.material.task.domain.TmTaskAgreement;
@ -41,6 +44,9 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
@Resource
private TmTaskAgreementMapper taskAgreementMapper;
@Resource
private BmFileInfoMapper fileInfoMapper;
/**
* 查询报废任务详细
*
@ -71,7 +77,20 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
*/
@Override
public List<ScrapApplyDetails> selectRepairQuestListByTaskId(ScrapApplyDetails scrapApplyDetails) {
return scrapApplyDetailsMapper.selectRepairQuestListByTaskId(scrapApplyDetails);
BigDecimal totalCost = BigDecimal.ZERO.setScale(2, BigDecimal.ROUND_HALF_UP);
List<ScrapApplyDetails> list = scrapApplyDetailsMapper.selectRepairQuestListByTaskId(scrapApplyDetails);
if (CollectionUtils.isNotEmpty(list)) {
for (ScrapApplyDetails applyDetails : list) {
totalCost = totalCost.add(applyDetails.getScrapNum().multiply(applyDetails.getBuyPrice()));
applyDetails.setTotalCost(totalCost);
BmFileInfo bmFileInfo = new BmFileInfo();
bmFileInfo.setModelId(applyDetails.getRepairId());
bmFileInfo.setTaskType(4);
List<BmFileInfo> fileInfos = fileInfoMapper.selectBmFileInfoList(bmFileInfo);
applyDetails.setFileList(fileInfos);
}
}
return list;
}
/**

View File

@ -57,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_unit bui ON bai2.unit_id = bui.unit_id
LEFT JOIN bm_project bpi ON bai2.project_id = bpi.pro_id and bpi.del_flag = '0'
left join sys_user su on sad.create_by = su.user_id
left join sys_user su1 on sad.audit_by = su1.user_id
left join repair_audit_details rad ON sad.parent_id = rad.id
left join tm_task tt2 ON tt2.task_id = rad.task_id
<where>
@ -90,13 +91,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectRepairQuestListByTaskId" resultType="com.bonus.material.scrap.domain.ScrapApplyDetails">
select
sad.id as id,sad.task_id as taskId,sad.parent_id as parentId,sad.ma_id as maId,
sad.status as status,
sad.status as status,rad.repair_id as repairId,
sad.scrap_source,sad.scrap_type,ifnull(sad.scrap_num,0) as scrapNum,
sad.audit_by,sad.audit_remark,sad.audit_time as auditTime,
sad.update_time as updateTime,sad.type_id as typeId,
sad.create_by,sad.create_time,sad.file_name,sad.file_url,
mt2.type_name as typeName,mt2.type_id as typeNameId,
mt.type_name as type,mt.unit_name as unitName,mt.manage_type as manageType,
mt.type_name as typeModelName,mt.unit_name as unitName,mt.manage_type as manageType,
mm.ma_code as code,
su.nick_name as scraper,
CASE sad.status
@ -104,13 +105,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
when 1 then '报废审核通过'
when 2 then '报废审核驳回'
else '未知'
END as statusName
END as statusName,
ifnull(rad.repair_num,0) as repairNum,
ifnull(rad.repaired_num,0) as repairedNum,
mt.buy_price as buyPrice
from
scrap_apply_details sad
left join ma_type mt on sad.type_id = mt.type_id
left join ma_machine mm on mm.ma_id = sad.ma_id
left join sys_user su on sad.create_by = su.user_id
left join ma_type mt2 on mt.parent_id = mt2.type_id
left join repair_audit_details rad on sad.parent_id = rad.id
where
sad.task_id = #{taskId}
GROUP BY sad.id