报废优化

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

View File

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

View File

@ -1,5 +1,6 @@
package com.bonus.material.scrap.service.impl; package com.bonus.material.scrap.service.impl;
import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List; 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.utils.DateUtils;
import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils; 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.scrap.domain.vo.ScrapTaskListVo;
import com.bonus.material.task.domain.TmTask; import com.bonus.material.task.domain.TmTask;
import com.bonus.material.task.domain.TmTaskAgreement; import com.bonus.material.task.domain.TmTaskAgreement;
@ -41,6 +44,9 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
@Resource @Resource
private TmTaskAgreementMapper taskAgreementMapper; private TmTaskAgreementMapper taskAgreementMapper;
@Resource
private BmFileInfoMapper fileInfoMapper;
/** /**
* 查询报废任务详细 * 查询报废任务详细
* *
@ -71,7 +77,20 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
*/ */
@Override @Override
public List<ScrapApplyDetails> selectRepairQuestListByTaskId(ScrapApplyDetails scrapApplyDetails) { 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_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 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 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 repair_audit_details rad ON sad.parent_id = rad.id
left join tm_task tt2 ON tt2.task_id = rad.task_id left join tm_task tt2 ON tt2.task_id = rad.task_id
<where> <where>
@ -90,13 +91,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectRepairQuestListByTaskId" resultType="com.bonus.material.scrap.domain.ScrapApplyDetails"> <select id="selectRepairQuestListByTaskId" resultType="com.bonus.material.scrap.domain.ScrapApplyDetails">
select select
sad.id as id,sad.task_id as taskId,sad.parent_id as parentId,sad.ma_id as maId, 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.scrap_source,sad.scrap_type,ifnull(sad.scrap_num,0) as scrapNum,
sad.audit_by,sad.audit_remark,sad.audit_time as auditTime, sad.audit_by,sad.audit_remark,sad.audit_time as auditTime,
sad.update_time as updateTime,sad.type_id as typeId, sad.update_time as updateTime,sad.type_id as typeId,
sad.create_by,sad.create_time,sad.file_name,sad.file_url, sad.create_by,sad.create_time,sad.file_name,sad.file_url,
mt2.type_name as typeName,mt2.type_id as typeNameId, 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, mm.ma_code as code,
su.nick_name as scraper, su.nick_name as scraper,
CASE sad.status CASE sad.status
@ -104,13 +105,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
when 1 then '报废审核通过' when 1 then '报废审核通过'
when 2 then '报废审核驳回' when 2 then '报废审核驳回'
else '未知' 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 from
scrap_apply_details sad scrap_apply_details sad
left join ma_type mt on sad.type_id = mt.type_id 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 ma_machine mm on mm.ma_id = sad.ma_id
left join sys_user su on sad.create_by = su.user_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 ma_type mt2 on mt.parent_id = mt2.type_id
left join repair_audit_details rad on sad.parent_id = rad.id
where where
sad.task_id = #{taskId} sad.task_id = #{taskId}
GROUP BY sad.id GROUP BY sad.id