优化维修逻辑
This commit is contained in:
parent
7b1f0f2291
commit
5198fea5d4
|
|
@ -169,7 +169,7 @@ public class BackApplyInfoController extends BaseController {
|
||||||
* 退料申请提交
|
* 退料申请提交
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "退料申请提交")
|
@ApiOperation(value = "退料申请提交")
|
||||||
@PreventRepeatSubmit
|
@PreventRepeatSubmit(interval = 2)
|
||||||
// @RequiresPermissions("back:info:submit")
|
// @RequiresPermissions("back:info:submit")
|
||||||
@SysLog(title = "退料任务", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->退料申请提交")
|
@SysLog(title = "退料任务", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->退料申请提交")
|
||||||
@PostMapping("/submitBackApply")
|
@PostMapping("/submitBackApply")
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,8 @@ public interface RepairMapper {
|
||||||
|
|
||||||
int updateThisRepairedAndScrapNum(@Param("id") Long id, @Param("thisRepairedNum") BigDecimal repairNum, @Param("thisScrapNum") BigDecimal thisScrapNum,@Param("repairer") Long repairer, @Param("userId") Long userId);
|
int updateThisRepairedAndScrapNum(@Param("id") Long id, @Param("thisRepairedNum") BigDecimal repairNum, @Param("thisScrapNum") BigDecimal thisScrapNum,@Param("repairer") Long repairer, @Param("userId") Long userId);
|
||||||
|
|
||||||
|
int updateRepairedAndScrapNum(@Param("id") Long id, @Param("thisRepairedNum") BigDecimal repairNum, @Param("thisScrapNum") BigDecimal thisScrapNum,@Param("repairer") Long repairer, @Param("userId") Long userId);
|
||||||
|
|
||||||
int updateRepairedNumAndStatus(@Param("id") Long id, @Param("repairNum") BigDecimal repairNum, @Param("status") int status, @Param("repairer") String repairer, @Param("userId") Long userId);
|
int updateRepairedNumAndStatus(@Param("id") Long id, @Param("repairNum") BigDecimal repairNum, @Param("status") int status, @Param("repairer") String repairer, @Param("userId") Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
||||||
@Override
|
@Override
|
||||||
public void queryTimeCope(@NotNull RepairAuditDetails repairAuditDetails) {
|
public void queryTimeCope(@NotNull RepairAuditDetails repairAuditDetails) {
|
||||||
Map<String, Object> params = repairAuditDetails.getParams();
|
Map<String, Object> params = repairAuditDetails.getParams();
|
||||||
if (params != null && !params.isEmpty()) {
|
if (null != params && !params.isEmpty()) {
|
||||||
formatTimeParam(params, "beginTime", " 00:00:00");
|
formatTimeParam(params, "beginTime", " 00:00:00");
|
||||||
formatTimeParam(params, "endTime", " 23:59:59");
|
formatTimeParam(params, "endTime", " 23:59:59");
|
||||||
repairAuditDetails.setParams(params);
|
repairAuditDetails.setParams(params);
|
||||||
|
|
@ -234,7 +234,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isNotEmpty(scrapNumList)) {
|
if (CollectionUtil.isNotEmpty(scrapNumList)) {
|
||||||
if (scrapNumList.get(0).getCompanyId() != null) {
|
if (null != scrapNumList.get(0).getCompanyId()) {
|
||||||
companyId = scrapNumList.get(0).getCompanyId();
|
companyId = scrapNumList.get(0).getCompanyId();
|
||||||
}
|
}
|
||||||
taskCode = purchaseCodeRule(SCRAP_TASK_TYPE_LABEL, TmTaskTypeEnum.TM_TASK_SCRAP.getTaskTypeId());
|
taskCode = purchaseCodeRule(SCRAP_TASK_TYPE_LABEL, TmTaskTypeEnum.TM_TASK_SCRAP.getTaskTypeId());
|
||||||
|
|
@ -247,7 +247,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
||||||
Long maId = scrapDetails.getMaId();
|
Long maId = scrapDetails.getMaId();
|
||||||
// 创建报废任务
|
// 创建报废任务
|
||||||
BigDecimal scrapNum = scrapDetails.getScrapNum();
|
BigDecimal scrapNum = scrapDetails.getScrapNum();
|
||||||
if (scrapNum.compareTo(b) > 0) {
|
if (0 < scrapNum.compareTo(b)) {
|
||||||
for (RepairRecord bean : repairRecord){
|
for (RepairRecord bean : repairRecord){
|
||||||
ScrapApplyDetails scrapApplyDetails = new ScrapApplyDetails();
|
ScrapApplyDetails scrapApplyDetails = new ScrapApplyDetails();
|
||||||
scrapApplyDetails.setTaskId(scrapTaskId);
|
scrapApplyDetails.setTaskId(scrapTaskId);
|
||||||
|
|
@ -268,11 +268,11 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
||||||
|
|
||||||
}
|
}
|
||||||
// 修饰审核通过时改修任务为已通过审核
|
// 修饰审核通过时改修任务为已通过审核
|
||||||
if (auditDetailList != null) {
|
if (null != auditDetailList) {
|
||||||
if (auditDetailList.size() == notAuditList.size()) {
|
if (auditDetailList.size() == notAuditList.size()) {
|
||||||
tmTask.setTaskStatus(47);
|
tmTask.setTaskStatus(47);
|
||||||
}
|
}
|
||||||
} else if (auditAllList != null) {
|
} else if (null != auditAllList) {
|
||||||
if (auditAllList.size() == notAuditList.size()) {
|
if (auditAllList.size() == notAuditList.size()) {
|
||||||
tmTask.setTaskStatus(47);
|
tmTask.setTaskStatus(47);
|
||||||
}
|
}
|
||||||
|
|
@ -289,7 +289,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
||||||
repairDetailList.addAll(auditAllList);
|
repairDetailList.addAll(auditAllList);
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isNotEmpty(repairDetailList)) {
|
if (CollectionUtil.isNotEmpty(repairDetailList)) {
|
||||||
if (repairDetailList.get(0).getCompanyId() != null) {
|
if (null != repairDetailList.get(0).getCompanyId()) {
|
||||||
companyId = repairDetailList.get(0).getCompanyId();
|
companyId = repairDetailList.get(0).getCompanyId();
|
||||||
}
|
}
|
||||||
taskCode = purchaseCodeRule(MaterialConstants.REPAIR_TASK_TYPE_LABEL, 4);
|
taskCode = purchaseCodeRule(MaterialConstants.REPAIR_TASK_TYPE_LABEL, 4);
|
||||||
|
|
@ -335,7 +335,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (auditAllList != null) {
|
if (null != auditAllList) {
|
||||||
for (RepairAuditDetails bean : auditAllList) {
|
for (RepairAuditDetails bean : auditAllList) {
|
||||||
bean.setAuditBy(SecurityUtils.getLoginUser().getUserid());
|
bean.setAuditBy(SecurityUtils.getLoginUser().getUserid());
|
||||||
bean.setStatus(String.valueOf(status));
|
bean.setStatus(String.valueOf(status));
|
||||||
|
|
@ -363,8 +363,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
||||||
}else {
|
}else {
|
||||||
taskNum = "001";
|
taskNum = "001";
|
||||||
}
|
}
|
||||||
String codeNum = code + format + "-" + taskNum;
|
return code + format + "-" + taskNum;
|
||||||
return codeNum;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -462,10 +462,10 @@ public class RepairServiceImpl implements RepairService {
|
||||||
|
|
||||||
} else if (Objects.equals(MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId(), bean.getManageType())) {
|
} else if (Objects.equals(MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId(), bean.getManageType())) {
|
||||||
// 物资管理方式--数量管理
|
// 物资管理方式--数量管理
|
||||||
if (bean.getId() == null) {
|
if (null == bean.getId()) {
|
||||||
throw new ServiceException("请完善参数,维修详情ID为空!");
|
throw new ServiceException("请完善参数,维修详情ID为空!");
|
||||||
}
|
}
|
||||||
if (bean.getRepairType() == null) {
|
if (null == bean.getRepairType()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -476,7 +476,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
// 处理配件--数量管理--内部维修
|
// 处理配件--数量管理--内部维修
|
||||||
if (CollectionUtil.isNotEmpty(bean.getNumberInRepairPartList())) {
|
if (CollectionUtil.isNotEmpty(bean.getNumberInRepairPartList())) {
|
||||||
partList = bean.getNumberInRepairPartList();
|
partList = bean.getNumberInRepairPartList();
|
||||||
if (partList.get(0).getRepairNum() != null && partList.get(0).getRepairNum().compareTo(BigDecimal.ZERO) > 0 ) {
|
if (null != partList.get(0).getRepairNum() && 0 < partList.get(0).getRepairNum().compareTo(BigDecimal.ZERO)) {
|
||||||
// 获取维修详情表中的维修详情记录:待维修、已维修、已报废的数量
|
// 获取维修详情表中的维修详情记录:待维修、已维修、已报废的数量
|
||||||
RepairTaskDetails details = repairMapper.getById(bean.getId());
|
RepairTaskDetails details = repairMapper.getById(bean.getId());
|
||||||
if (Objects.isNull(details)) {
|
if (Objects.isNull(details)) {
|
||||||
|
|
@ -502,11 +502,11 @@ public class RepairServiceImpl implements RepairService {
|
||||||
details = repairMapper.getById(bean.getId());
|
details = repairMapper.getById(bean.getId());
|
||||||
|
|
||||||
// 判断外部维修配件数量是否为空
|
// 判断外部维修配件数量是否为空
|
||||||
if (partList.get(0).getRepairNum() != null && partList.get(0).getRepairNum().compareTo(BigDecimal.ZERO) > 0) {
|
if (null != partList.get(0).getRepairNum() && partList.get(0).getRepairNum().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
// 分拆维修单, 准备数据
|
// 分拆维修单, 准备数据
|
||||||
outerRepairNum = partList.get(0).getRepairNum();
|
outerRepairNum = partList.get(0).getRepairNum();
|
||||||
|
|
||||||
if (partList.get(0).getSupplierId() == null) {throw new ServiceException("请选择返厂厂家");}
|
if (null == partList.get(0).getSupplierId()) {throw new ServiceException("请选择返厂厂家");}
|
||||||
|
|
||||||
// 数量管理--外部返厂维修 -- 记录表插入数据
|
// 数量管理--外部返厂维修 -- 记录表插入数据
|
||||||
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
|
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
|
||||||
|
|
@ -616,12 +616,12 @@ public class RepairServiceImpl implements RepairService {
|
||||||
// TODO 2024-12-12 阮世耀:按逻辑来说 在审核之后才会PUT到真实的维修or报废数量,那么这里统一只修改this值
|
// TODO 2024-12-12 阮世耀:按逻辑来说 在审核之后才会PUT到真实的维修or报废数量,那么这里统一只修改this值
|
||||||
// repairMapper.updateRepairedNum(bean.getId(), innerRepairNum.add(outerRepairNum) , loginUser.getUserid(), loginUser.getUserid());
|
// repairMapper.updateRepairedNum(bean.getId(), innerRepairNum.add(outerRepairNum) , loginUser.getUserid(), loginUser.getUserid());
|
||||||
// repairMapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid());
|
// repairMapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid());
|
||||||
repairMapper.updateThisRepairedAndScrapNum(bean.getId(), innerRepairNum.add(outerRepairNum), scrapNum, loginUser.getUserid(), loginUser.getUserid());
|
repairMapper.updateRepairedAndScrapNum(bean.getId(), innerRepairNum.add(outerRepairNum), scrapNum, loginUser.getUserid(), loginUser.getUserid());
|
||||||
} else {
|
} else {
|
||||||
// TODO 2024-12-12 阮世耀:按逻辑来说 在审核之后才会PUT到真实的维修or报废数量,那么这里统一只修改this值
|
// TODO 2024-12-12 阮世耀:按逻辑来说 在审核之后才会PUT到真实的维修or报废数量,那么这里统一只修改this值
|
||||||
// repairMapper.updateRepairedNum(bean.getId(), innerRepairNum.add(outerRepairNum) , loginUser.getUserid(), loginUser.getUserid());
|
// repairMapper.updateRepairedNum(bean.getId(), innerRepairNum.add(outerRepairNum) , loginUser.getUserid(), loginUser.getUserid());
|
||||||
// repairMapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid());
|
// repairMapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid());
|
||||||
repairMapper.updateThisRepairedAndScrapNum(bean.getId(), innerRepairNum.add(outerRepairNum), scrapNum, loginUser.getUserid(), loginUser.getUserid());
|
repairMapper.updateRepairedAndScrapNum(bean.getId(), innerRepairNum.add(outerRepairNum), scrapNum, loginUser.getUserid(), loginUser.getUserid());
|
||||||
}
|
}
|
||||||
repairMapper.updateStatusByRepairScrapNum(bean.getId());
|
repairMapper.updateStatusByRepairScrapNum(bean.getId());
|
||||||
}
|
}
|
||||||
|
|
@ -635,7 +635,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
*/
|
*/
|
||||||
private static BigDecimal countPartCosts(List<RepairPartDetails> partList, BigDecimal sfCosts) {
|
private static BigDecimal countPartCosts(List<RepairPartDetails> partList, BigDecimal sfCosts) {
|
||||||
for (RepairPartDetails partDetails : partList) {
|
for (RepairPartDetails partDetails : partList) {
|
||||||
if (partDetails.getPartPrice() != null && partDetails.getPartNum() != null) {
|
if (null != partDetails.getPartPrice() && null != partDetails.getPartNum()) {
|
||||||
BigDecimal partPrice = partDetails.getPartPrice();
|
BigDecimal partPrice = partDetails.getPartPrice();
|
||||||
BigDecimal partNumber = new BigDecimal(partDetails.getPartNum());
|
BigDecimal partNumber = new BigDecimal(partDetails.getPartNum());
|
||||||
sfCosts = sfCosts.add(partPrice.multiply(partNumber));
|
sfCosts = sfCosts.add(partPrice.multiply(partNumber));
|
||||||
|
|
@ -653,15 +653,15 @@ public class RepairServiceImpl implements RepairService {
|
||||||
*/
|
*/
|
||||||
private void copeNumberManageInList(RepairDeviceVO bean, List<RepairPartDetails> partList, LoginUser loginUser, Integer manageType) {
|
private void copeNumberManageInList(RepairDeviceVO bean, List<RepairPartDetails> partList, LoginUser loginUser, Integer manageType) {
|
||||||
if (CollectionUtil.isNotEmpty(partList)) {
|
if (CollectionUtil.isNotEmpty(partList)) {
|
||||||
if (bean.getManageType() == null) {
|
if (null == bean.getManageType()) {
|
||||||
throw new ServiceException("请选择物资管理方式");
|
throw new ServiceException("请选择物资管理方式");
|
||||||
}
|
}
|
||||||
// 如果是数量管理,那么默认为内部维修
|
// 如果是数量管理,那么默认为内部维修
|
||||||
if (bean.getRepairType() == null && MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(manageType)) {
|
if (null == bean.getRepairType() && MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(manageType)) {
|
||||||
bean.setRepairType(RepairTypeEnum.INNER_REPAIR.getTypeId());
|
bean.setRepairType(RepairTypeEnum.INNER_REPAIR.getTypeId());
|
||||||
}
|
}
|
||||||
// 再检查还是null的话直接结束任务
|
// 再检查还是null的话直接结束任务
|
||||||
if (bean.getRepairType() == null) {
|
if (null == bean.getRepairType()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -682,9 +682,9 @@ public class RepairServiceImpl implements RepairService {
|
||||||
repairApplyRecord.setCreateBy(loginUser.getUsername());
|
repairApplyRecord.setCreateBy(loginUser.getUsername());
|
||||||
repairApplyRecord.setStatus(0L);
|
repairApplyRecord.setStatus(0L);
|
||||||
|
|
||||||
if (partDetails.getPartId() != null && partDetails.getPartNum() != null) {
|
if (null != partDetails.getPartId() && null != partDetails.getPartNum()) {
|
||||||
// 有维修配件时,如果价格为空,设置为0
|
// 有维修配件时,如果价格为空,设置为0
|
||||||
if (partDetails.getPartCost() == null) {partDetails.setPartCost(BigDecimal.ZERO);}
|
if (null == partDetails.getPartCost()) {partDetails.setPartCost(BigDecimal.ZERO);}
|
||||||
|
|
||||||
partDetails.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()).setCompanyId(null);
|
partDetails.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()).setCompanyId(null);
|
||||||
partDetails.setCreateBy(String.valueOf(loginUser.getUserid()));
|
partDetails.setCreateBy(String.valueOf(loginUser.getUserid()));
|
||||||
|
|
@ -737,7 +737,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
.setPartType(partList.get(0).getPartType())
|
.setPartType(partList.get(0).getPartType())
|
||||||
.setRepairContent(partList.get(0).getRepairContent()).setPartNum(partList.get(0).getPartNum());
|
.setRepairContent(partList.get(0).getRepairContent()).setPartNum(partList.get(0).getPartNum());
|
||||||
|
|
||||||
if (partList.get(0).getSupplierId() == null) {
|
if (null == partList.get(0).getSupplierId()) {
|
||||||
throw new ServiceException("请选择返厂厂家");
|
throw new ServiceException("请选择返厂厂家");
|
||||||
}
|
}
|
||||||
repairApplyRecord.setSupplierId(partList.get(0).getSupplierId());
|
repairApplyRecord.setSupplierId(partList.get(0).getSupplierId());
|
||||||
|
|
@ -808,8 +808,10 @@ public class RepairServiceImpl implements RepairService {
|
||||||
|
|
||||||
// 1.查询选择任务是否还有未完成维修的数据
|
// 1.查询选择任务是否还有未完成维修的数据
|
||||||
for (RepairTask task : taskList) {
|
for (RepairTask task : taskList) {
|
||||||
if (repairMapper.getUnFinish(task) == 0) {
|
if (0 == repairMapper.getUnFinish(task)) {
|
||||||
repairMapper.updateSingleTaskStatus(task, loginUser.getUserid(), RepairTaskStatusEnum.TASK_STATUS_COMPLETE.getStatus());
|
repairMapper.updateSingleTaskStatus(task, loginUser.getUserid(), RepairTaskStatusEnum.TASK_STATUS_COMPLETE.getStatus());
|
||||||
|
} else {
|
||||||
|
throw new ServiceException("任务" + task.getTaskId() + "还有未完成维修的数据,请先完成维修");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -521,4 +521,15 @@
|
||||||
WHERE
|
WHERE
|
||||||
task_id = #{taskId}
|
task_id = #{taskId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<update id="updateRepairedAndScrapNum">
|
||||||
|
update
|
||||||
|
repair_apply_details
|
||||||
|
set
|
||||||
|
repaired_num = ifnull(repaired_num,0) + #{thisRepairedNum},
|
||||||
|
scrap_num = ifnull(scrap_num,0) + #{thisScrapNum},
|
||||||
|
update_time = now()
|
||||||
|
where
|
||||||
|
id = #{id}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue