维修报废功能修改
This commit is contained in:
parent
a649d4f520
commit
f986162a4c
|
|
@ -162,6 +162,16 @@ public class RepairInputDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "操作后库存数量")
|
||||
private BigDecimal postStoreNum;
|
||||
|
||||
@ApiModelProperty(value = "审核人id")
|
||||
private Long auditBy;
|
||||
|
||||
@ApiModelProperty(value = "审核人")
|
||||
private String auditByName;
|
||||
|
||||
@ApiModelProperty(value = "审核时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date auditTime;
|
||||
|
||||
@ApiModelProperty(value = "编码列表")
|
||||
private List<RepairInputDetails> maCodeList;
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public class ArchivesController extends BaseController {
|
|||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "新增电子档案右侧类型")
|
||||
//@PreventRepeatSubmit
|
||||
@PreventRepeatSubmit
|
||||
//@RequiresPermissions("archives:type:add")
|
||||
@PostMapping("/addDetails")
|
||||
public AjaxResult addDetails(@RequestBody ArchivesVo archivesVo)
|
||||
|
|
|
|||
|
|
@ -338,7 +338,7 @@ public class ArchivesServiceImpl implements ArchivesService {
|
|||
String suffix = fileName.substring(dotIndex);
|
||||
// 拼接最终的文件名
|
||||
String extractedFileName = namePart + suffix;
|
||||
String savePath = System.getProperty("user.home") + File.separator + extractedFileName;
|
||||
String savePath = "D:/" + extractedFileName;
|
||||
// 检查文件保存路径是否可写
|
||||
Path path = Paths.get(savePath);
|
||||
if (Files.isWritable(path.getParent())) {
|
||||
|
|
@ -347,7 +347,7 @@ public class ArchivesServiceImpl implements ArchivesService {
|
|||
// 将文件添加到压缩包
|
||||
fileToZip(savePath, fileName, zipOut);
|
||||
// 将临时文件删除
|
||||
//new File(savePath).delete();
|
||||
new File(savePath).delete();
|
||||
} else {
|
||||
System.err.println("保存文件的路径不可写: " + savePath);
|
||||
}
|
||||
|
|
@ -366,7 +366,7 @@ public class ArchivesServiceImpl implements ArchivesService {
|
|||
inputStream.close();
|
||||
//下载完成之后,删掉这个zip包
|
||||
File fileTempZip = new File(zipSavePath);
|
||||
//fileTempZip.delete();
|
||||
fileTempZip.delete();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
@ -379,7 +379,11 @@ public class ArchivesServiceImpl implements ArchivesService {
|
|||
* @param savePath
|
||||
*/
|
||||
private void downloadFile(String fileUrl, String savePath) throws IOException {
|
||||
URL url = new URL(fileUrl);
|
||||
//处理中文文件名的问题
|
||||
String fileName = fileUrl.substring(fileUrl.lastIndexOf('/') + 1);
|
||||
String encodedFileName = URLEncoder.encode(fileName, "UTF-8");
|
||||
String newPath = fileUrl.substring(0, fileUrl.lastIndexOf('/') + 1) + encodedFileName;
|
||||
URL url = new URL(newPath);
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
// 设置请求方法为 GET
|
||||
connection.setRequestMethod("GET");
|
||||
|
|
@ -393,8 +397,8 @@ public class ArchivesServiceImpl implements ArchivesService {
|
|||
// 假设需要添加认证信息,添加 Authorization 头,根据实际情况修改
|
||||
connection.setRequestProperty("Authorization", "Bearer your_access_token");
|
||||
// 延长连接超时和读取超时时间
|
||||
connection.setConnectTimeout(50000);
|
||||
connection.setReadTimeout(50000);
|
||||
connection.setConnectTimeout(10000);
|
||||
connection.setReadTimeout(10000);
|
||||
try {
|
||||
int responseCode = connection.getResponseCode();
|
||||
if (responseCode == 200) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
|
|
@ -61,4 +62,14 @@ public class MaCodeVo {
|
|||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "审核人")
|
||||
private String auditByName;
|
||||
|
||||
@ApiModelProperty(value = "审核时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date auditTime;
|
||||
|
||||
@ApiModelProperty(value = "驳回数量")
|
||||
private BigDecimal rejectNum;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -578,10 +578,20 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
List<Integer> statusList = repairAuditDetailsByTaskId.stream()
|
||||
.map(scrapApplyDetail -> Integer.parseInt(scrapApplyDetail.getStatus()))
|
||||
.collect(Collectors.toList());
|
||||
if (!statusList.contains(RepairTaskStatusEnum.TASK_STATUS_PROCESSING.getStatus())) {
|
||||
result += taskMapper.updateTaskStatus(auditDetails1.getTaskId().toString(), RepairTaskStatusEnum.TASK_STATUS_REVIEW.getStatus());
|
||||
} else if (statusList.stream().allMatch(newStatus -> newStatus.equals(RepairTaskStatusEnum.TASK_STATUS_NO_REVIEW.getStatus()))){
|
||||
result += taskMapper.updateTaskStatus(auditDetails1.getTaskId().toString(), RepairTaskStatusEnum.TASK_STATUS_NO_REVIEW.getStatus());
|
||||
if (!CollectionUtils.isEmpty(statusList)) {
|
||||
boolean notContainsNoFinished =!statusList.contains(RepairTaskStatusEnum.TASK_STATUS_PROCESSING.getStatus());
|
||||
boolean allReject = true;
|
||||
for (Integer newStatus : statusList) {
|
||||
if (!newStatus.equals(RepairTaskStatusEnum.TASK_STATUS_NO_REVIEW.getStatus())) {
|
||||
allReject = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (notContainsNoFinished && !allReject) {
|
||||
taskMapper.updateTaskStatus(auditDetails1.getTaskId().toString(), RepairTaskStatusEnum.TASK_STATUS_REVIEW.getStatus());
|
||||
} else if (notContainsNoFinished && allReject) {
|
||||
taskMapper.updateTaskStatus(auditDetails1.getTaskId().toString(), RepairTaskStatusEnum.TASK_STATUS_NO_REVIEW.getStatus());
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
@ -609,6 +619,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
if (null != details.getMaId()) {
|
||||
repairAuditDetailsMapper.updateMachine(details);
|
||||
}
|
||||
if (details.getRepairedNum().compareTo(BigDecimal.ZERO) > 0) {
|
||||
final RepairInputDetails inputVo = new RepairInputDetails();
|
||||
BeanUtils.copyProperties(details, inputVo);
|
||||
inputVo.setRepairNum(details.getRepairedNum());
|
||||
|
|
@ -617,6 +628,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
inputVo.setTaskId(newTaskId);
|
||||
inputVo.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
||||
inputList.add(inputVo);
|
||||
}
|
||||
if (details.getScrapNum().compareTo(BigDecimal.ZERO) > 0) {
|
||||
ScrapApplyDetails scrapApplyDetails = new ScrapApplyDetails();
|
||||
scrapApplyDetails.setTaskId(newScrapTaskId);
|
||||
|
|
@ -632,8 +644,10 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
}
|
||||
}
|
||||
// 插入维修入库明细
|
||||
if (!CollectionUtils.isEmpty(inputList)) {
|
||||
repairInputDetailsMapper.batchInsertRepairInputDetails(inputList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入报废任务表
|
||||
|
|
|
|||
|
|
@ -333,8 +333,10 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
|
|||
inputDetails.setMaId(repairInputInfo.getMaId() == null ? null : repairInputInfo.getMaId());
|
||||
inputDetails.setTaskId(repairInputInfo.getTaskId());
|
||||
inputDetails.setTypeId(repairInputInfo.getTypeId());
|
||||
inputDetails.setUpdateBy(SecurityUtils.getUsername());
|
||||
inputDetails.setUpdateBy(SecurityUtils.getUserId().toString());
|
||||
inputDetails.setUpdateTime(DateUtils.getNowDate());
|
||||
inputDetails.setAuditBy(SecurityUtils.getUserId());
|
||||
inputDetails.setAuditTime(DateUtils.getNowDate());
|
||||
result += repairInputDetailsMapper.updateRepairInputDetails(inputDetails);
|
||||
|
||||
if ("0".equals(repairInputInfo.getManageType())) {
|
||||
|
|
@ -360,7 +362,7 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
|
|||
//根据任务id查询退料id
|
||||
Long backId = repairInputDetailsMapper.selectBackIdByTaskId(repairInputDetails.getTaskId());
|
||||
repairInputDetails.setCreateBy(SecurityUtils.getUsername());
|
||||
repairInputDetails.setUpdateBy(SecurityUtils.getUsername());
|
||||
repairInputDetails.setUpdateBy(SecurityUtils.getUserId().toString());
|
||||
repairInputDetails.setUpdateTime(DateUtils.getNowDate());
|
||||
repairInputDetails.setBackId(backId);
|
||||
// 编码类型驳回
|
||||
|
|
@ -389,11 +391,13 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
|
|||
inputDetails.setTaskId(repairInputDetails.getTaskId());
|
||||
inputDetails.setTypeId(repairInputDetails.getTypeId());
|
||||
inputDetails.setRejectNum(BigDecimal.valueOf(1));
|
||||
inputDetails.setUpdateBy(SecurityUtils.getUsername());
|
||||
inputDetails.setUpdateBy(SecurityUtils.getUserId().toString());
|
||||
inputDetails.setUpdateTime(DateUtils.getNowDate());
|
||||
inputDetails.setCreateBy(SecurityUtils.getUsername());
|
||||
inputDetails.setRejectReason(repairInputDetails.getRejectReason());
|
||||
inputDetails.setBackId(repairInputDetails.getBackId());
|
||||
inputDetails.setAuditBy(SecurityUtils.getUserId());
|
||||
inputDetails.setAuditTime(DateUtils.getNowDate());
|
||||
result += repairInputDetailsMapper.updateRepairInputDetails(inputDetails);
|
||||
inputDetails.setStatus(MaMachineStatusEnum.BACK_REPAIR.getStatus().toString());
|
||||
updateRepairInputInfo(inputDetails);
|
||||
|
|
@ -413,6 +417,8 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
|
|||
private int processQuantityTypeReject(RepairInputDetails repairInputDetails) {
|
||||
int result = 0;
|
||||
repairInputDetails.setStatus(repairInputDetails.getRejectNum().equals(repairInputDetails.getPendingInputNum()) ? "2" : "0");
|
||||
repairInputDetails.setAuditBy(SecurityUtils.getUserId());
|
||||
repairInputDetails.setAuditTime(DateUtils.getNowDate());
|
||||
result += repairInputDetailsMapper.updateRepairInputDetails(repairInputDetails);
|
||||
if (result > 0) {
|
||||
updateTaskStatus(repairInputDetails);
|
||||
|
|
@ -505,7 +511,7 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
|
|||
throw new ServiceException("入库数量不能大于预入库数量");
|
||||
}
|
||||
}
|
||||
repairInputDetails.setUpdateBy(SecurityUtils.getUsername());
|
||||
repairInputDetails.setUpdateBy(SecurityUtils.getUserId().toString());
|
||||
repairInputDetails.setUpdateTime(DateUtils.getNowDate());
|
||||
|
||||
// 编码类型入库
|
||||
|
|
@ -554,8 +560,10 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
|
|||
inputDetails.setTaskId(repairInputDetails.getTaskId());
|
||||
inputDetails.setTypeId(repairInputDetails.getTypeId());
|
||||
inputDetails.setInputNum(BigDecimal.valueOf(1));
|
||||
inputDetails.setUpdateBy(SecurityUtils.getUsername());
|
||||
inputDetails.setUpdateBy(SecurityUtils.getUserId().toString());
|
||||
inputDetails.setUpdateTime(DateUtils.getNowDate());
|
||||
inputDetails.setAuditBy(SecurityUtils.getUserId());
|
||||
inputDetails.setAuditTime(DateUtils.getNowDate());
|
||||
result += repairInputDetailsMapper.updateRepairInputDetails(inputDetails);
|
||||
inputDetails.setStatus(MaMachineStatusEnum.IN_STORE.getStatus().toString());
|
||||
updateRepairInputInfo(inputDetails);
|
||||
|
|
@ -574,6 +582,8 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
|
|||
private int processQuantityTypeStorage(RepairInputDetails repairInputDetails) {
|
||||
int result = 0;
|
||||
repairInputDetails.setStatus(repairInputDetails.getInputNum().equals(repairInputDetails.getPendingInputNum()) ? "1" : "0");
|
||||
repairInputDetails.setAuditBy(SecurityUtils.getUserId());
|
||||
repairInputDetails.setAuditTime(DateUtils.getNowDate());
|
||||
result += repairInputDetailsMapper.updateRepairInputDetails(repairInputDetails);
|
||||
if (result > 0) {
|
||||
updateTaskStatus(repairInputDetails);
|
||||
|
|
@ -668,6 +678,8 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
|
|||
inputDetails.setMaId(repairInputInfo.getMaId() == null ? null : repairInputInfo.getMaId());
|
||||
inputDetails.setTaskId(repairInputInfo.getTaskId());
|
||||
inputDetails.setTypeId(repairInputInfo.getTypeId());
|
||||
inputDetails.setAuditBy(SecurityUtils.getUserId());
|
||||
inputDetails.setAuditTime(DateUtils.getNowDate());
|
||||
result += repairInputDetailsMapper.updateRepairInputDetails(inputDetails);
|
||||
|
||||
if ("1".equals(repairInputInfo.getManageType())) {
|
||||
|
|
|
|||
|
|
@ -159,15 +159,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
|||
// TODO: 报废审核二级页面通过
|
||||
int result = 0;
|
||||
if (scrapApplyDetails != null) {
|
||||
/*if (scrapApplyDetails.getId() != null) {
|
||||
scrapApplyDetails.setStatus("1");
|
||||
scrapApplyDetails.setAuditBy(SecurityUtils.getUserId());
|
||||
scrapApplyDetails.setAuditTime(DateUtils.getNowDate());
|
||||
result = scrapApplyDetailsMapper.updateStatus(scrapApplyDetails);
|
||||
if (result > 0) {
|
||||
updateTaskStatus(scrapApplyDetails);
|
||||
}
|
||||
} else */if (CollectionUtils.isNotEmpty(scrapApplyDetails.getScrapApplyDetailsList())) {
|
||||
if (CollectionUtils.isNotEmpty(scrapApplyDetails.getScrapApplyDetailsList())) {
|
||||
for (ScrapApplyDetails applyDetails : scrapApplyDetails.getScrapApplyDetailsList()) {
|
||||
applyDetails.setStatus("1");
|
||||
applyDetails.setAuditBy(SecurityUtils.getUserId());
|
||||
|
|
|
|||
|
|
@ -94,8 +94,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
(SUM(IFNULL(rid.repair_num, 0)) - SUM(IFNULL(rid.input_num, 0)) - SUM(IFNULL(rid.reject_num, 0)))
|
||||
AS pendingInputNum,
|
||||
SUM(IFNULL(rid.reject_num, 0)) as rejectNum,
|
||||
rid.create_by as createBy,
|
||||
su.nick_name as createBy,
|
||||
rid.create_time as createTime,
|
||||
su1.nick_name as auditBy,
|
||||
rid.audit_time as auditTime,
|
||||
rid.remark as remark,
|
||||
mt1.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
|
|
@ -108,6 +110,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN ma_type mt on rid.type_id = mt.type_id and mt.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 on mt.parent_id = mt1.type_id and mt1.del_flag = '0'
|
||||
LEFT JOIN tm_task_agreement tta ON rid.task_id = tta.task_id
|
||||
LEFT JOIN sys_user su on rid.create_by = su.user_id
|
||||
LEFT JOIN sys_user su1 on rid.audit_by = su1.user_id
|
||||
where rid.task_id = #{taskId}
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND (
|
||||
|
|
@ -130,7 +134,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt.type_name as materialName,
|
||||
mm.ma_code as maCode,
|
||||
mm.ma_status as maStatus,
|
||||
rid.reject_reason as rejectReason
|
||||
rid.reject_reason as rejectReason,
|
||||
su.nick_name as auditByName,
|
||||
rid.audit_time as auditTime,
|
||||
rid.reject_num as rejectNum
|
||||
FROM
|
||||
repair_input_details rid
|
||||
LEFT JOIN ma_machine mm ON rid.ma_id = mm.ma_id
|
||||
|
|
@ -138,6 +145,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND mt.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
AND mt1.del_flag = '0'
|
||||
LEFT JOIN sys_user su on rid.audit_by = su.user_id
|
||||
WHERE
|
||||
rid.task_id = #{taskId}
|
||||
AND rid.type_id = #{typeId}
|
||||
|
|
@ -370,6 +378,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="rejectReason != null and rejectReason != ''">reject_reason = #{rejectReason},</if>
|
||||
update_by = #{updateBy},
|
||||
update_time = #{updateTime},
|
||||
audit_by = #{auditBy},
|
||||
audit_time = #{auditTime},
|
||||
status = #{status}
|
||||
WHERE task_id = #{taskId}
|
||||
and type_id = #{typeId}
|
||||
|
|
|
|||
Loading…
Reference in New Issue