报废管理一级页面

This commit is contained in:
syruan 2024-12-13 14:33:19 +08:00
parent a742267844
commit 592f55515b
10 changed files with 153 additions and 38 deletions

View File

@ -371,7 +371,7 @@ public class RepairServiceImpl implements RepairService {
} }
BigDecimal repairNum = details.getRepairedNum().add(bean.getRepairNum()) ; BigDecimal repairNum = details.getRepairedNum().add(bean.getRepairNum()) ;
if (repairNum.add(details.getScrapNum()).compareTo(details.getRepairNum())>0) { if (repairNum.add(details.getScrapNum()).compareTo(details.getRepairNum()) > 0) {
throw new ServiceException("维修数量大于维修总量"); throw new ServiceException("维修数量大于维修总量");
} }
return repairNum; return repairNum;
@ -609,14 +609,16 @@ public class RepairServiceImpl implements RepairService {
throw new ServiceException("本次维修提交总数过大"); throw new ServiceException("本次维修提交总数过大");
} }
//本次修完了 //本次修完了
// TODO 这里需要完善要全部先走This后再提交时PUT到真实修改数量 // TODO 2024-12-11 阮世耀经过讨论 这里不管一次是否全部修完 都要先修复this 那么此判断是无意义的
if ((bean.getRepairNum().subtract(innerRepairNum).subtract(outerRepairNum).subtract(scrapNum).compareTo(BigDecimal.valueOf(0)) ) == 0) { if ((bean.getRepairNum().subtract(innerRepairNum).subtract(outerRepairNum).subtract(scrapNum).compareTo(BigDecimal.valueOf(0)) ) == 0) {
repairMapper.updateRepairedNum(bean.getId(), innerRepairNum.add(outerRepairNum) , loginUser.getUserid(), loginUser.getUserid()); // TODO 2024-12-12 阮世耀按逻辑来说 在审核之后才会PUT到真实的维修or报废数量那么这里统一只修改this值
repairMapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid()); // repairMapper.updateRepairedNum(bean.getId(), innerRepairNum.add(outerRepairNum) , loginUser.getUserid(), loginUser.getUserid());
// repairMapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid());
repairMapper.updateThisRepairedAndScrapNum(bean.getId(), innerRepairNum.add(outerRepairNum), scrapNum, loginUser.getUserid(), loginUser.getUserid()); repairMapper.updateThisRepairedAndScrapNum(bean.getId(), innerRepairNum.add(outerRepairNum), scrapNum, loginUser.getUserid(), loginUser.getUserid());
} else { } else {
repairMapper.updateRepairedNum(bean.getId(), innerRepairNum.add(outerRepairNum) , loginUser.getUserid(), loginUser.getUserid()); // TODO 2024-12-12 阮世耀按逻辑来说 在审核之后才会PUT到真实的维修or报废数量那么这里统一只修改this值
repairMapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid()); // repairMapper.updateRepairedNum(bean.getId(), innerRepairNum.add(outerRepairNum) , loginUser.getUserid(), loginUser.getUserid());
// repairMapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid());
repairMapper.updateThisRepairedAndScrapNum(bean.getId(), innerRepairNum.add(outerRepairNum), scrapNum, loginUser.getUserid(), loginUser.getUserid()); repairMapper.updateThisRepairedAndScrapNum(bean.getId(), innerRepairNum.add(outerRepairNum), scrapNum, loginUser.getUserid(), loginUser.getUserid());
} }
} }

View File

@ -4,6 +4,7 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.bonus.common.log.enums.OperaType; import com.bonus.common.log.enums.OperaType;
import com.bonus.material.common.annotation.PreventRepeatSubmit; import com.bonus.material.common.annotation.PreventRepeatSubmit;
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -34,6 +35,7 @@ import com.bonus.common.core.web.page.TableDataInfo;
@RestController @RestController
@RequestMapping("/scrap_apply_details") @RequestMapping("/scrap_apply_details")
public class ScrapApplyDetailsController extends BaseController { public class ScrapApplyDetailsController extends BaseController {
@Autowired @Autowired
private IScrapApplyDetailsService scrapApplyDetailsService; private IScrapApplyDetailsService scrapApplyDetailsService;
@ -41,11 +43,11 @@ public class ScrapApplyDetailsController extends BaseController {
* 查询报废任务详细列表 * 查询报废任务详细列表
*/ */
@ApiOperation(value = "查询报废任务详细列表") @ApiOperation(value = "查询报废任务详细列表")
@RequiresPermissions("scrap:details:list") // @RequiresPermissions("scrap:details:list")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(ScrapApplyDetails scrapApplyDetails) { public TableDataInfo list(ScrapApplyDetails scrapApplyDetails) {
startPage(); startPage();
List<ScrapApplyDetails> list = scrapApplyDetailsService.selectScrapApplyDetailsList(scrapApplyDetails); List<ScrapTaskListVo> list = scrapApplyDetailsService.selectScrapApplyDetailsList(scrapApplyDetails);
return getDataTable(list); return getDataTable(list);
} }
@ -58,8 +60,8 @@ public class ScrapApplyDetailsController extends BaseController {
@SysLog(title = "报废任务详细", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出报废任务详细") @SysLog(title = "报废任务详细", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出报废任务详细")
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, ScrapApplyDetails scrapApplyDetails) { public void export(HttpServletResponse response, ScrapApplyDetails scrapApplyDetails) {
List<ScrapApplyDetails> list = scrapApplyDetailsService.selectScrapApplyDetailsList(scrapApplyDetails); List<ScrapTaskListVo> list = scrapApplyDetailsService.selectScrapApplyDetailsList(scrapApplyDetails);
ExcelUtil<ScrapApplyDetails> util = new ExcelUtil<ScrapApplyDetails>(ScrapApplyDetails.class); ExcelUtil<ScrapTaskListVo> util = new ExcelUtil<>(ScrapTaskListVo.class);
util.exportExcel(response, list, "报废任务详细数据"); util.exportExcel(response, list, "报废任务详细数据");
} }

View File

@ -30,6 +30,20 @@ public class ScrapApplyDetails extends BaseEntity {
@ApiModelProperty(value = "任务ID") @ApiModelProperty(value = "任务ID")
private Long taskId; private Long taskId;
@Excel(name = "任务编号")
@ApiModelProperty(value = "任务编号")
private String taskCode;
@Excel(name = "任务状态编码")
@ApiModelProperty(value = "任务状态Code")
private Byte taskStatusCode;
@Excel(name = "任务状态名称")
@ApiModelProperty(value = "任务状态名称")
private String taskStatusName;
private String status;
/** 上级ID */ /** 上级ID */
@Excel(name = "上级ID") @Excel(name = "上级ID")
@ApiModelProperty(value = "上级ID") @ApiModelProperty(value = "上级ID")
@ -59,10 +73,6 @@ public class ScrapApplyDetails extends BaseEntity {
@Excel(name = "", readConverterExp = "0=自然1人为") @Excel(name = "", readConverterExp = "0=自然1人为")
private String scrapType; private String scrapType;
/** 状态0进行中1已审核2驳回 */
@Excel(name = "状态", readConverterExp = "0=进行中1已审核2驳回")
private String status;
/** 审核人 */ /** 审核人 */
@Excel(name = "审核人") @Excel(name = "审核人")
@ApiModelProperty(value = "审核人") @ApiModelProperty(value = "审核人")
@ -94,5 +104,6 @@ public class ScrapApplyDetails extends BaseEntity {
@ApiModelProperty(value = "文件url") @ApiModelProperty(value = "文件url")
private String fileUrl; private String fileUrl;
/** 报废备注 */
private String scrapRemark;
} }

View File

@ -0,0 +1,77 @@
package com.bonus.material.scrap.domain.vo;
import com.bonus.common.core.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author : 阮世耀
* @version : 1.0
* @CreateTime: 2024-12-13 13:52
*/
@Data
public class ScrapTaskListVo {
@ApiModelProperty(value = "任务id")
private Long taskId;
@ApiModelProperty(value = "任务状态")
private Byte taskStatus;
@ApiModelProperty(value = "任务类型")
private Byte taskType;
@ApiModelProperty(value = "报废单号")
private String scrapCode;
@ApiModelProperty(value = "组织id")
private Long companyId;
@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)
private String backUnit;
@ApiModelProperty(value = "退料工程名称")
@Excel(name = "退料工程名称",sort = 3)
private String backPro;
@ApiModelProperty(value = "任务创建人")
private Long createBy;
@ApiModelProperty(value = "任务创建时间")
@Excel(name = "任务创建时间",sort = 5)
private String createTime;
@ApiModelProperty(value = "任务创建人昵称")
@Excel(name = "任务创建人",sort = 4)
private String createName;
@ApiModelProperty(value = "更新时间")
private String updateTime;
@ApiModelProperty(value = "开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String startTime;
@ApiModelProperty(value = "结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String endTime;
@ApiModelProperty(value = "备注")
private String remark;
private String keyWord;
}

View File

@ -5,6 +5,7 @@ import java.util.List;
import com.bonus.material.repair.domain.RepairAuditDetails; import com.bonus.material.repair.domain.RepairAuditDetails;
import com.bonus.material.repair.domain.RepairRecord; import com.bonus.material.repair.domain.RepairRecord;
import com.bonus.material.scrap.domain.ScrapApplyDetails; import com.bonus.material.scrap.domain.ScrapApplyDetails;
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
/** /**
* 报废任务详细Mapper接口 * 报废任务详细Mapper接口
@ -27,7 +28,7 @@ public interface ScrapApplyDetailsMapper {
* @param scrapApplyDetails 报废任务详细 * @param scrapApplyDetails 报废任务详细
* @return 报废任务详细集合 * @return 报废任务详细集合
*/ */
public List<ScrapApplyDetails> selectScrapApplyDetailsList(ScrapApplyDetails scrapApplyDetails); List<ScrapTaskListVo> selectScrapApplyDetailsList(ScrapApplyDetails scrapApplyDetails);
/** /**
* 新增报废任务详细 * 新增报废任务详细

View File

@ -2,6 +2,7 @@ package com.bonus.material.scrap.service;
import java.util.List; import java.util.List;
import com.bonus.material.scrap.domain.ScrapApplyDetails; import com.bonus.material.scrap.domain.ScrapApplyDetails;
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
/** /**
* 报废任务详细Service接口 * 报废任务详细Service接口
@ -24,7 +25,7 @@ public interface IScrapApplyDetailsService {
* @param scrapApplyDetails 报废任务详细 * @param scrapApplyDetails 报废任务详细
* @return 报废任务详细集合 * @return 报废任务详细集合
*/ */
public List<ScrapApplyDetails> selectScrapApplyDetailsList(ScrapApplyDetails scrapApplyDetails); public List<ScrapTaskListVo> selectScrapApplyDetailsList(ScrapApplyDetails scrapApplyDetails);
/** /**
* 新增报废任务详细 * 新增报废任务详细

View File

@ -3,6 +3,7 @@ package com.bonus.material.scrap.service.impl;
import java.util.List; import java.util.List;
import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.DateUtils;
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
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 com.bonus.material.scrap.mapper.ScrapApplyDetailsMapper; import com.bonus.material.scrap.mapper.ScrapApplyDetailsMapper;
@ -38,7 +39,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
* @return 报废任务详细 * @return 报废任务详细
*/ */
@Override @Override
public List<ScrapApplyDetails> selectScrapApplyDetailsList(ScrapApplyDetails scrapApplyDetails) { public List<ScrapTaskListVo> selectScrapApplyDetailsList(ScrapApplyDetails scrapApplyDetails) {
return scrapApplyDetailsMapper.selectScrapApplyDetailsList(scrapApplyDetails); return scrapApplyDetailsMapper.selectScrapApplyDetailsList(scrapApplyDetails);
} }

View File

@ -23,7 +23,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectRepairApplyDetailsVo"> <sql id="selectRepairApplyDetailsVo">
select id, task_id, ma_id, type_id, repair_num, repaired_num, scrap_num, status, create_by, create_time, update_by, update_time, remark, company_id, back_id, repairer from repair_apply_details select id, task_id, ma_id, type_id, repair_num, repaired_num, scrap_num, status, create_by, create_time,
update_by, update_time, remark, company_id, back_id, repairer
from repair_apply_details
</sql> </sql>
<select id="selectRepairApplyDetailsList" parameterType="com.bonus.material.repair.domain.RepairApplyDetails" resultMap="RepairApplyDetailsResult"> <select id="selectRepairApplyDetailsList" parameterType="com.bonus.material.repair.domain.RepairApplyDetails" resultMap="RepairApplyDetailsResult">

View File

@ -104,7 +104,7 @@
<update id="batchQualified"> <update id="batchQualified">
update repair_apply_details update repair_apply_details
set status = '1', set status = '1',
repaired_num = repair_num - scrap_num, repaired_num = repair_num - ifnull(scrap_num, 0),
update_by = #{userId}, update_by = #{userId},
update_time = now() update_time = now()
where id in where id in

View File

@ -32,24 +32,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from scrap_apply_details from scrap_apply_details
</sql> </sql>
<select id="selectScrapApplyDetailsList" parameterType="com.bonus.material.scrap.domain.ScrapApplyDetails" resultMap="ScrapApplyDetailsResult"> <select id="selectScrapApplyDetailsList" parameterType="com.bonus.material.scrap.domain.ScrapApplyDetails" resultType="com.bonus.material.scrap.domain.vo.ScrapTaskListVo">
<include refid="selectScrapApplyDetailsVo"/> SELECT
<where> sad.task_id, sad.create_by, sad.create_time,sad.update_time,sad.company_id,
<if test="taskId != null "> and task_id = #{taskId}</if> tt.`code` AS scrapCode,tt.task_status AS taskStatus,tt.task_type as taskType,tt.company_id AS companyId,tt.remark,
<if test="parentId != null "> and parent_id = #{parentId}</if> bui.unit_name AS backUnit,
<if test="maId != null "> and ma_id = #{maId}</if> bpi.pro_name AS backPro,
<if test="typeId != null "> and type_id = #{typeId}</if> su.nick_name AS createName,
<if test="scrapNum != null "> and scrap_num = #{scrapNum}</if> GROUP_CONCAT(DISTINCT mt2.type_name) as type
<if test="scrapSource != null and scrapSource != ''"> and scrap_source = #{scrapSource}</if> FROM
<if test="scrapType != null and scrapType != ''"> and scrap_type = #{scrapType}</if> scrap_apply_details sad
<if test="status != null and status != ''"> and status = #{status}</if> LEFT JOIN ma_type mt on sad.type_id = mt.type_id
<if test="auditBy != null "> and audit_by = #{auditBy}</if> LEFT JOIN ma_type mt2 on mt.parent_id = mt2.type_id
<if test="auditTime != null "> and audit_time = #{auditTime}</if> LEFT JOIN tm_task tt on sad.task_id = tt.task_id
<if test="auditRemark != null and auditRemark != ''"> and audit_remark = #{auditRemark}</if> LEFT JOIN tm_task_agreement tta ON sad.task_id = tta.task_id
<if test="companyId != null "> and company_id = #{companyId}</if> LEFT JOIN bm_agreement_info bai2 ON tta.agreement_id = bai2.agreement_id
<if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if> LEFT JOIN bm_unit bui ON bai2.unit_id = bui.unit_id
<if test="fileUrl != null and fileUrl != ''"> and file_url = #{fileUrl}</if> LEFT JOIN bm_project bpi ON bai2.project_id = bpi.pro_id and bpi.del_flag = '0'
</where> left join sys_user su on sad.create_by = su.user_id
<!-- <where> -->
<!-- <if test="taskId != null "> and task_id = #{taskId}</if>-->
<!-- <if test="parentId != null "> and parent_id = #{parentId}</if>-->
<!-- <if test="maId != null "> and ma_id = #{maId}</if>-->
<!-- <if test="typeId != null "> and type_id = #{typeId}</if>-->
<!-- <if test="scrapNum != null "> and scrap_num = #{scrapNum}</if>-->
<!-- <if test="scrapSource != null and scrapSource != ''"> and scrap_source = #{scrapSource}</if>-->
<!-- <if test="scrapType != null and scrapType != ''"> and scrap_type = #{scrapType}</if>-->
<!-- <if test="status != null and status != ''"> and status = #{status}</if>-->
<!-- <if test="auditBy != null "> and audit_by = #{auditBy}</if>-->
<!-- <if test="auditTime != null "> and audit_time = #{auditTime}</if>-->
<!-- <if test="auditRemark != null and auditRemark != ''"> and audit_remark = #{auditRemark}</if>-->
<!-- <if test="companyId != null "> and company_id = #{companyId}</if>-->
<!-- <if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>-->
<!-- <if test="fileUrl != null and fileUrl != ''"> and file_url = #{fileUrl}</if>-->
<!-- </where>-->
GROUP BY sad.task_id,bui.unit_name,bpi.pro_name,su.nick_name
order by tt.create_time desc
</select> </select>
<select id="selectScrapApplyDetailsById" parameterType="Long" resultMap="ScrapApplyDetailsResult"> <select id="selectScrapApplyDetailsById" parameterType="Long" resultMap="ScrapApplyDetailsResult">