维修报废功能修改

This commit is contained in:
mashuai 2025-01-17 13:01:14 +08:00
parent 26c6415877
commit 30bf793f34
12 changed files with 66 additions and 25 deletions

View File

@ -152,6 +152,28 @@ public class ArchivesServiceImpl implements ArchivesService {
@Override
public List<ArchivesDetails> getDetailsList(ArchivesDetails archivesDetails) {
List<ArchivesDetails> list = archivesMapper.selectDetailsList(archivesDetails);
if (CollectionUtils.isNotEmpty(list)) {
for (ArchivesDetails details : list) {
if ((StringUtils.isNotBlank(details.getDocUrl()) && details.getDocUrl().startsWith("http")) && StringUtils.isNotBlank(details.getDocName())) {
String originalPath = details.getDocName();
// 找到最后一个 '/' 字符的位置
int lastSlashIndex = originalPath.lastIndexOf('/');
// 从最后一个 '/' 字符之后提取文件名
String fileName = originalPath.substring(lastSlashIndex + 1);
// 找到 '.png' 的位置
int dotIndex = fileName.lastIndexOf('.');
// 找到倒数第二个 '_' 的位置
int underscoreIndex = fileName.lastIndexOf('_', dotIndex - 1);
// 截取文件名部分不包含后缀和多余部分
String namePart = fileName.substring(0, underscoreIndex);
// 截取后缀部分
String suffix = fileName.substring(dotIndex);
// 拼接最终的文件名
String extractedFileName = namePart + suffix;
details.setDocName(extractedFileName);
}
}
}
return list;
}

View File

@ -14,12 +14,7 @@ import com.bonus.material.common.annotation.PreventRepeatSubmit;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.security.annotation.RequiresPermissions;
import com.bonus.material.back.domain.BackApplyInfo;
@ -99,8 +94,9 @@ public class BackApplyInfoController extends BaseController {
@ApiOperation(value = "获取退料任务详细信息")
// @RequiresPermissions("back:info:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(backApplyInfoService.selectBackApplyInfoById(id));
public AjaxResult getInfo(@PathVariable("id") Long id,
@RequestParam(value = "keyWord", required = false) String keyWord) {
return success(backApplyInfoService.selectBackApplyInfoById(id, keyWord));
}
/**

View File

@ -81,10 +81,10 @@ public interface BackApplyInfoMapper {
/**
* 根据任务id查询详情
* @param id
* @param backApplyInfo
* @return
*/
List<BackApplyDetails> selectBackApplyDetailsListByTaskId(Long id);
List<BackApplyDetails> selectBackApplyDetailsListByTaskId(BackApplyInfo backApplyInfo);
/**
* 根据设备编码查询设备信息

View File

@ -22,7 +22,7 @@ public interface IBackApplyInfoService {
* @param id 退料任务主键
* @return 退料任务
*/
public BackApplyRequestVo selectBackApplyInfoById(Long id);
public BackApplyRequestVo selectBackApplyInfoById(Long id, String keyWord);
/**
* 查询退料任务列表

View File

@ -79,13 +79,14 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
* @return 退料任务
*/
@Override
public BackApplyRequestVo selectBackApplyInfoById(Long id) {
public BackApplyRequestVo selectBackApplyInfoById(Long id, String keyWord) {
BackApplyRequestVo backApplyRequestVo = new BackApplyRequestVo();
//先根据外层id查询上层信息
BackApplyInfo backApplyInfo = backApplyInfoMapper.selectBackApplyInfoById(id);
backApplyRequestVo.setBackApplyInfo(backApplyInfo);
//查询退料详情信息
List<BackApplyDetails> backApplyDetailsList = backApplyInfoMapper.selectBackApplyDetailsListByTaskId(id);
backApplyInfo.setKeyWord(keyWord);
List<BackApplyDetails> backApplyDetailsList = backApplyInfoMapper.selectBackApplyDetailsListByTaskId(backApplyInfo);
if (CollectionUtils.isNotEmpty(backApplyDetailsList)) {
// 批量查询附件信息减少数据库访问次数
List<BmFileInfo> bmFileInfos = fetchBmFileInfos(id, backApplyDetailsList);
@ -431,7 +432,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
// 查询信息
Long id = dto.getBackApplyInfo().getId();
BackApplyInfo backApplyInfo = backApplyInfoMapper.selectBackApplyInfoById(id);
List<BackApplyDetails> backApplyDetailsList = backApplyInfoMapper.selectBackApplyDetailsListByTaskId(id);
List<BackApplyDetails> backApplyDetailsList = backApplyInfoMapper.selectBackApplyDetailsListByTaskId(dto.getBackApplyInfo());
List<MaCodeVo> maCodeList = backApplyInfoMapper.selectByCode(id);
int result = 0;
if (CollectionUtils.isNotEmpty(maCodeList)) {
@ -475,7 +476,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
try {
// 查询信息
BackApplyInfo backApplyInfo = backApplyInfoMapper.selectBackApplyInfoById(id);
List<BackApplyDetails> backApplyDetailsList = backApplyInfoMapper.selectBackApplyDetailsListByTaskId(id);
List<BackApplyDetails> backApplyDetailsList = backApplyInfoMapper.selectBackApplyDetailsListByTaskId(backApplyInfo);
List<MaCodeVo> maCodeList = backApplyInfoMapper.selectByCode(id);
// 删除相关任务信息
int result = deleteTaskInfo(backApplyInfo);
@ -591,7 +592,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
public AjaxResult submitBackApply(BackApplyInfo backApplyInfo) {
int result = 0;
//先查询退料详情信息
List<BackApplyDetails> applyDetails = backApplyInfoMapper.selectBackApplyDetailsListByTaskId(backApplyInfo.getId());
List<BackApplyDetails> applyDetails = backApplyInfoMapper.selectBackApplyDetailsListByTaskId(backApplyInfo);
if (CollectionUtils.isNotEmpty(applyDetails)) {
for (BackApplyDetails applyDetail : applyDetails) {
if (applyDetail.getPreNum().compareTo(applyDetail.getNum())>0) {

View File

@ -1,12 +1,10 @@
package com.bonus.material.repair.controller;
import com.bonus.common.biz.utils.HttpHelper;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.common.security.annotation.RequiresPermissions;
import com.bonus.material.repair.domain.*;
import com.bonus.material.repair.domain.vo.OCRBean;
import com.bonus.material.repair.domain.vo.RepairDeviceSummaryVo;
@ -21,11 +19,9 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Arrays;

View File

@ -88,7 +88,7 @@ public class RepairAuditDetails extends BaseEntity {
/** 审核时间 */
@ApiModelProperty(value = "审核时间")
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
@Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd hh:mm:ss")
private Date auditTime;

View File

@ -127,6 +127,9 @@ public class ScrapApplyDetails extends BaseEntity {
@Excel(name = "报废类型", readConverterExp = "0=自然1人为")
private String scrapType;
@ApiModelProperty(value = "报废原因")
private String scrapReason;
@ApiModelProperty(value = "报废人")
private String scraper;

View File

@ -22,6 +22,11 @@ public interface ScrapApplyDetailsMapper {
*/
public ScrapApplyDetails selectScrapApplyDetailsById(Long id);
/**
* 根据任务id查询报废详情
* @param scrapApplyDetails
* @return
*/
List<ScrapApplyDetails> selectRepairQuestListByTaskId(ScrapApplyDetails scrapApplyDetails);
/**

View File

@ -185,6 +185,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = 0
LEFT JOIN ma_type mt2 ON mt1.parent_id = mt2.type_id and mt2.del_flag = 0
WHERE ba.parent_id = #{id}
<if test="keyWord != null and keyWord != ''">
and (
mt1.type_name like concat('%', #{keyWord}, '%') or
mt.type_name like concat('%', #{keyWord}, '%') or
mt2.type_name like concat('%', #{keyWord}, '%')
)
</if>
</select>
<select id="selectByCode" resultType="com.bonus.material.back.domain.vo.MaCodeVo">

View File

@ -36,18 +36,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select
rad.* ,mt.type_name as specification_type, mt1.type_name as machine_type_name, mma.ma_code as maCode,
rad.ma_id as maId
,mt.manage_type as manageType
,mt.manage_type as manageType,
su.nick_name as auditName
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
left join ma_machine mma on rad.ma_id= mma.ma_id
LEFT JOIN sys_user su on rad.audit_by = su.user_id
where
rad.task_id = #{taskId}
<if test="keyword != null and keyword != ''">
AND (locate(#{keyword}, mma.ma_code) > 0
or locate(#{keyword}, mt.type_name) > 0
or locate(#{keyword}, mt1.type_name) > 0)
or locate(#{keyword}, mt1.type_name) > 0
or locate(#{keyword}, su.nick_name) > 0
)
</if>
<if test="type != null and type != ''">
AND mt.type_id = #{type}

View File

@ -94,7 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select
sad.id as id,sad.task_id as taskId,sad.parent_id as parentId,sad.ma_id as maId,
sad.status as status,rad.repair_id as repairId,
sad.scrap_source as scrapSource, sad.scrap_type as scrapType, ifnull(sad.scrap_num,0) as scrapNum,
sad.scrap_source as scrapSource, 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,
@ -110,7 +110,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
END as statusName,
ifnull(rad.repair_num,0) as repairNum,
ifnull(rad.repaired_num,0) as repairedNum,
mt.buy_price as buyPrice
mt.buy_price as buyPrice,
rar.scrap_reason as scrapReason,
rar.scrap_type as scrapType
from
scrap_apply_details sad
left join ma_type mt on sad.type_id = mt.type_id
@ -118,6 +120,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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
LEFT JOIN repair_apply_details ra on rad.repair_id = ra.id
LEFT JOIN repair_apply_record rar on rar.task_id = ra.task_id
and (case when mt.manage_type = 0 then rar.ma_id = ra.ma_id
when mt.manage_type = 1 then rar.type_id = ra.type_id
else false end)
where
sad.task_id = #{taskId}
GROUP BY sad.id