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