From 1fb377de607d6e1c3da023488e62072bbc079a43 Mon Sep 17 00:00:00 2001 From: mashuai Date: Fri, 6 Jun 2025 18:02:02 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=86=E9=80=80=E6=96=99=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biz/domain/lease/LeaseMaCodeDto.java | 2 + .../controller/BackApplyInfoController.java | 12 ++ .../back/domain/BackApplyDetails.java | 2 +- .../material/back/domain/BackApplyInfo.java | 3 + .../back/domain/vo/BackApplyInfoVo.java | 3 + .../back/mapper/BackApplyInfoMapper.java | 2 +- .../back/service/IBackApplyInfoService.java | 7 + .../impl/BackApplyInfoServiceImpl.java | 192 ++++++++++++++---- .../controller/ComplexQueryController.java | 11 + .../basic/domain/RetainedEquipmentInfo.java | 24 ++- .../basic/mapper/ComplexQueryMapper.java | 7 + .../basic/service/ComplexQueryService.java | 7 + .../service/impl/ComplexQueryServiceImpl.java | 52 +++++ .../service/impl/SelectServiceImpl.java | 2 - .../controller/LeaseApplyInfoController.java | 2 +- .../lease/domain/vo/LeaseTotalInfo.java | 2 - .../lease/service/ILeaseApplyInfoService.java | 2 +- .../impl/LeaseApplyInfoServiceImpl.java | 117 +++++------ .../material/back/BackApplyInfoMapper.xml | 36 ++-- .../material/basic/ComplexQueryMapper.xml | 18 ++ .../lease/LeaseApplyDetailsMapper.xml | 3 +- .../material/lease/LeaseApplyInfoMapper.xml | 30 ++- 22 files changed, 379 insertions(+), 157 deletions(-) diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseMaCodeDto.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseMaCodeDto.java index 65bd3709..5cef91b6 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseMaCodeDto.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseMaCodeDto.java @@ -41,4 +41,6 @@ public class LeaseMaCodeDto { @ApiModelProperty(value = "出库方式 0 编码,1 数量,2 二维码,3 RFID, 4 OCR") private Integer outType; + + private String status; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/controller/BackApplyInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/controller/BackApplyInfoController.java index 465cc313..7886738c 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/controller/BackApplyInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/controller/BackApplyInfoController.java @@ -247,6 +247,18 @@ public class BackApplyInfoController extends BaseController { } } + @ApiOperation(value = "单个退料") + @PreventRepeatSubmit + //@SysLog(title = "单个退料", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改退料任务") + @PostMapping("/backOne") + public AjaxResult backOne(@Valid @RequestBody BackApplyRequestVo dto) { + try { + return backApplyInfoService.backOne(dto); + } catch (Exception e) { + return error("系统错误, " + e.getMessage()); + } + } + @ApiOperation(value = "修改退料任务打印状态") @PreventRepeatSubmit // @RequiresPermissions("back:info:edit") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyDetails.java index fdb7d401..30782af4 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyDetails.java @@ -102,7 +102,7 @@ public class BackApplyDetails extends BaseEntity { private BigDecimal num; /** 状态(0待审批,1进行中,2已出库,3已驳回) */ - @ApiModelProperty(value = "状态(0待审批,1进行中,2已出库,3已驳回)") + @ApiModelProperty(value = "状态(0待退料,1进行中,2已退料,3已驳回)") private String status; @ApiModelProperty(value = "机具外观判断") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyInfo.java index ee532619..cd603f13 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyInfo.java @@ -27,6 +27,9 @@ public class BackApplyInfo implements Serializable { private Boolean isExport; + @ApiModelProperty(value = "是否退料 0 否,1 是") + private Integer isBack; + /** ID */ private Long id; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/vo/BackApplyInfoVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/vo/BackApplyInfoVo.java index e8a133c3..477dbfed 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/vo/BackApplyInfoVo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/vo/BackApplyInfoVo.java @@ -57,4 +57,7 @@ public class BackApplyInfoVo { @ApiModelProperty(value = "不合格图片") private List fileInfoList; + + @ApiModelProperty(value = "是否完成 (0:未完成 1:已完成)") + private Integer isFinished; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java index c2f6e70d..5a51b1f5 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java @@ -360,7 +360,7 @@ public interface BackApplyInfoMapper { BackApplyInfoVo selectIdList(BackApplyInfoVo dto); - BackApplyInfoVo selectDetails(BackApplyInfoVo dto); + List selectDetails(BackApplyInfoVo dto); /** * 查询总站点退料记录数据 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/IBackApplyInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/IBackApplyInfoService.java index 026a0af4..4e9fef70 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/IBackApplyInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/IBackApplyInfoService.java @@ -185,5 +185,12 @@ public interface IBackApplyInfoService { * @return */ AjaxResult deleteDetailsById(Long id); + + /** + * 单个退料 + * @param dto + * @return + */ + AjaxResult backOne(BackApplyRequestVo dto); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java index 0cc778f1..d8bfd7fa 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java @@ -10,7 +10,6 @@ import cn.hutool.core.util.PhoneUtil; import com.alibaba.nacos.common.utils.CollectionUtils; import com.bonus.common.biz.constant.MaterialConstants; import com.bonus.common.biz.domain.TypeTreeNode; -import com.bonus.common.biz.domain.lease.LeaseApplyInfo; import com.bonus.common.biz.domain.lease.LeaseOutDetails; import com.bonus.common.biz.enums.*; import com.bonus.common.core.exception.ServiceException; @@ -25,7 +24,6 @@ import com.bonus.material.basic.mapper.BmFileInfoMapper; import com.bonus.material.common.domain.dto.SelectDto; import com.bonus.material.common.domain.vo.AgreementVo; import com.bonus.material.common.mapper.SelectMapper; -import com.bonus.material.lease.domain.vo.LeaseTotalInfo; import com.bonus.material.ma.mapper.MachineMapper; import com.bonus.material.purchase.config.RemoteConfig; import com.bonus.material.settlement.domain.SltAgreementInfo; @@ -76,6 +74,9 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { @Resource private SelectMapper mapper; + @Resource + private TmTaskMapper tmTaskMapper; + /** * 查询退料任务 * @@ -343,9 +344,13 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { @Override @Transactional(rollbackFor = Exception.class) public AjaxResult insertBackApplyInfo(BackApplyRequestVo dto) { + String createBy = ""; if (dto == null || dto.getBackApplyInfo() == null || CollectionUtils.isEmpty(dto.getBackApplyDetailsList())) { return AjaxResult.error("参数为空,请重新选择后上传!"); } + if (StringUtils.isBlank(dto.getBackApplyInfo().getCreateBy())) { + dto.getBackApplyInfo().setCreateBy(createBy); + } //对传入的手机号进行校验 if (StringUtils.isNotBlank(dto.getBackApplyInfo().getPhone()) && !PhoneUtil.isMobile(dto.getBackApplyInfo().getPhone())) { return AjaxResult.error("手机号格式不正确,请重新填写!"); @@ -368,37 +373,46 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { } } } + for (BackApplyDetails backApplyDetails : dto.getBackApplyDetailsList()) { + if (backApplyDetails.getNum() != null && backApplyDetails.getPreNum() != null) { + if (backApplyDetails.getNum().compareTo(backApplyDetails.getPreNum())<0 ) { + return AjaxResult.error(backApplyDetails.getTypeName() + "退料数量不能大于预退数量,请重新填写!"); + } + } + } int result = 0; try { int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId()); String code = genderTaskCode(thisMonthMaxOrder); - TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId(), - BackTaskStatusEnum.BACK_TASK_NO_FINISHED.getStatus(), - null,thisMonthMaxOrder + 1, code); + TmTask tmTask = new TmTask(); + if (dto.getBackApplyInfo().getIsBack() == 1) { + tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId(), + BackTaskStatusEnum.BACK_TASK_IN_FINISHED.getStatus(), + null, thisMonthMaxOrder + 1, code); + } else { + tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId(), + BackTaskStatusEnum.BACK_TASK_NO_FINISHED.getStatus(), + null, thisMonthMaxOrder + 1, code); + } tmTask.setCreateTime(DateUtils.getNowDate()); - tmTask.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName()); + tmTask.setCreateBy(createBy); BackApplyInfo backApplyInfo = dto.getBackApplyInfo(); backApplyInfo.setCode(code); - backApplyInfo.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName()); + backApplyInfo.setCreateBy(createBy); backApplyInfo.setCreateTime(DateUtils.getNowDate()); // 保存退料信息到 tm_task 表中 result += taskMapper.insertTmTask(tmTask); if (result > 0) { TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), dto.getBackApplyInfo().getAgreementId()); tmTaskAgreement.setCreateTime(DateUtils.getNowDate()); - tmTaskAgreement.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName()); + tmTaskAgreement.setCreateBy(createBy); taskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement); backApplyInfo.setTaskId(tmTask.getTaskId()); - /** 设置审批人为默认的李勇 --防止代码冲突 **/ - Long peopleId = backApplyInfoMapper.getDirectAuditBy(); - backApplyInfo.setDirectAuditBy(peopleId); - /** 设置审批人为默认的李勇 --防止代码冲突 **/ - result += backApplyInfoMapper.insertBackApplyInfo(backApplyInfo); } // 保存退料详情 - result = saveBackApplyDetails(dto, backApplyInfo, result); + result = saveBackApplyDetails(createBy, dto, backApplyInfo, result); } catch (Exception e) { log.error("保存退料信息时发生异常: ", e); } @@ -425,7 +439,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { * @param result * @return */ - private int saveBackApplyDetails(BackApplyRequestVo dto, BackApplyInfo backApplyInfo, int result) { + private int saveBackApplyDetails(String createBy, BackApplyRequestVo dto, BackApplyInfo backApplyInfo, int result) { List listL4 = new ArrayList<>(); // 针对app二维码扫描时,需要根据单位id和工程id获取协议id,然后根据协议id获取退料在用数量 if (backApplyInfo.getUnitId() != null && backApplyInfo.getProId() != null) { @@ -452,21 +466,49 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { details.setParentId(backApplyInfo.getId()); details.setAuditNum(details.getPreNum()); details.setStatus(String.valueOf(BackTaskStatusEnum.BACK_TASK_NO_FINISHED.getStatus())); - details.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName()); + details.setCreateBy(createBy); details.setCreateTime(DateUtils.getNowDate()); // 保存退料详情 - // 先根据typeId和parentId查询该类型是否存在 - BackApplyDetails backApplyDetails = backApplyInfoMapper.getBackApplyDetailsByTypeIdAndParentId(details); - if (backApplyDetails != null) { - backApplyDetails.setPreNum(details.getPreNum()); - result += backApplyInfoMapper.updateDetails(backApplyDetails); - } else { - result += backApplyInfoMapper.insertBackApplyDetails(details); - } + result += backApplyInfoMapper.insertBackApplyDetails(details); // 处理附件 result = saveBmFileInfo(details, backApplyInfo.getId(), result); // 判断是否为编码设备并处理附件 - result = saveMaCodeBmFileInfo(details, backApplyInfo.getId(), result); + Integer isBack = dto.getBackApplyInfo().getIsBack(); + details.setIsFinished(isBack); + result = saveMaCodeBmFileInfo(isBack, details, backApplyInfo.getId(), result); + if (isBack == 1) { + // 更新任务表及退料申请表状态 + result += updateTaskAndBackInfo(backApplyInfo); + // 更新结算表 + backApplyInfo.setTypeId(details.getTypeId().toString()); + List allList = backApplyInfoMapper.selectBackDetails(backApplyInfo); + if (CollectionUtils.isNotEmpty(allList)) { + List newList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(details.getMaCodeList())) { + // 将allList和details.getMaCodeList()进行比较,如果allList中的typeId和maId与details.getMaCodeList()中的相同, + //则进行保留 + for (BackApplyInfo applyInfo : allList) { + for (MaCodeDto maCodeDto : details.getMaCodeList()) { + if (applyInfo.getMaId().equals(maCodeDto.getMaId()) && applyInfo.getTypeId().equals(details.getTypeId().toString())) { + newList.add(applyInfo); + } + } + } + } else { + for (BackApplyInfo applyInfo : allList) { + if (applyInfo.getTypeId().equals(details.getTypeId().toString()) + && applyInfo.getBackNum().toString().equals(details.getPreNum().toString())) { + newList.add(applyInfo); + } + } + } + int res = updateSlt4Bean(backApplyInfo, newList); + // 检查机具是否领料 + if (res == 0) { + throw new RuntimeException("该机具未被领料使用"); + } + } + } } return result; } @@ -499,7 +541,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { * @param result * @return */ - private int saveMaCodeBmFileInfo(BackApplyDetails details, Long id, int result) { + private int saveMaCodeBmFileInfo(Integer isBack, BackApplyDetails details, Long id, int result) { // 设置公共字段 setCommonFields(details, id); if (CollectionUtils.isNotEmpty(details.getMaCodeList())) { @@ -508,16 +550,6 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { details.setMaId(maCodeDto.getMaId()); details.setPreNum(BigDecimal.valueOf(1)); details.setApDetection(maCodeDto.getApDetection()); - /*if ("1".equals(maCodeDto.getApDetection())) { - details.setGoodNum(BigDecimal.valueOf(1)); - } else { - details.setGoodNum(BigDecimal.valueOf(0)); - } - if ("0".equals(maCodeDto.getApDetection())) { - details.setBadNum(BigDecimal.valueOf(1)); - } else { - details.setBadNum(BigDecimal.valueOf(0)); - }*/ // 插入 CheckDetails result += backApplyInfoMapper.insertCheckDetails(details); if (CollectionUtils.isNotEmpty(maCodeDto.getBmFileInfos())) { @@ -530,6 +562,9 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { result += bmFileInfoMapper.insertBmFileInfo(bmFileInfo); } } + if (isBack == 1) { + result += machineMapper.updateStatus(maCodeDto.getMaId(), MaMachineStatusEnum.IN_STORE.getStatus()); + } } } else { // 如果 MaCodeList 为空,只插入 CheckDetails @@ -548,10 +583,8 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { details.setCreateBy(SecurityUtils.getUsername()); details.setCreateTime(DateUtils.getNowDate()); details.setStatus("0"); - // 默认为 0,表示未完成 - details.setIsFinished(0); - // 默认返回状态 1 - details.setBackStatus("1"); + // 默认返回状态 0 + details.setBackStatus("0"); } /** @@ -565,6 +598,10 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { if (dto == null || dto.getBackApplyInfo() == null || dto.getBackApplyInfo().getId() == null || CollectionUtils.isEmpty(dto.getBackApplyDetailsList())) { return AjaxResult.error("参数为空,请重新选择后上传!"); } + String createBy = ""; + if (StringUtils.isBlank(dto.getBackApplyInfo().getCreateBy())) { + dto.getBackApplyInfo().setCreateBy(createBy); + } //对提交的退料详情数量进行校验 for (BackApplyDetails backApplyDetails : dto.getBackApplyDetailsList()) { if (backApplyDetails.getNum() != null && backApplyDetails.getPreNum() != null) { @@ -596,11 +633,15 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { //执行新增操作 BackApplyInfo info = dto.getBackApplyInfo(); info.setUpdateTime(DateUtils.getNowDate()); - info.setUpdateBy(SecurityUtils.getLoginUser().getSysUser().getNickName()); + info.setUpdateBy(createBy); info.setCode(backApplyInfo.getCode()); result += backApplyInfoMapper.updateBackApplyInfo(info); // 保存退料详情 - result = saveBackApplyDetails(dto, info, result); + result = saveBackApplyDetails(createBy, dto, info, result); + // 根据任务id修改任务状态 + if (dto.getBackApplyInfo().getIsBack() == 1) { + tmTaskMapper.updateTaskStatus(dto.getBackApplyInfo().getTaskId().toString(), BackTaskStatusEnum.BACK_TASK_IN_FINISHED.getStatus()); + } return AjaxResult.success(result); } } catch (Exception e) { @@ -649,6 +690,66 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg()); } + /** + * 单个退料 + * @param dto + * @return + */ + @Override + public AjaxResult backOne(BackApplyRequestVo dto) { + //对提交的退料详情数量进行校验 + for (BackApplyDetails backApplyDetails : dto.getBackApplyDetailsList()) { + if (backApplyDetails.getNum() != null && backApplyDetails.getPreNum() != null) { + if (backApplyDetails.getNum().compareTo(backApplyDetails.getPreNum())<0 ) { + return AjaxResult.error(backApplyDetails.getTypeName() + "退料数量不能大于预退数量,请重新填写!"); + } + } + } + try { + BackApplyInfo backApplyInfo = dto.getBackApplyInfo(); + int result = 0; + for (BackApplyDetails details : dto.getBackApplyDetailsList()) { + if (CollectionUtils.isNotEmpty(details.getMaCodeList())) { + for (MaCodeDto maCodeDto : details.getMaCodeList()) { + backApplyInfo.setTypeId(details.getTypeId().toString()); + backApplyInfo.setMaId(maCodeDto.getMaId()); + backApplyInfoMapper.updateCheckDetails(backApplyInfo); + } + } else { + backApplyInfo.setTypeId(details.getTypeId().toString()); + backApplyInfoMapper.updateCheckDetails(backApplyInfo); + } + // 查询退料相关信息 + BackApplyInfoVo vo = new BackApplyInfoVo(); + vo.setId(backApplyInfo.getId()); + List list = backApplyInfoMapper.selectDetails(vo); + if (CollectionUtils.isNotEmpty(list)) { + // 判断list中的isFinished状态是否都为1 + boolean allFinished = list.stream() + .allMatch(item -> item.getIsFinished() != null && item.getIsFinished() == 1); + if (allFinished) { + // 更新任务表及退料申请表状态 + result += updateTaskAndBackInfo(backApplyInfo); + tmTaskMapper.updateTaskStatus(dto.getBackApplyInfo().getTaskId().toString(), BackTaskStatusEnum.BACK_TASK_IN_FINISHED.getStatus()); + } + } + // 更新结算表 + backApplyInfo.setTypeId(details.getTypeId().toString()); + List allList = backApplyInfoMapper.selectBackDetails(backApplyInfo); + if (CollectionUtils.isNotEmpty(allList)) { + int res = updateSlt4Bean(backApplyInfo, allList); + // 检查机具是否领料 + if (res == 0) { + throw new RuntimeException("该机具未被领料使用"); + } + } + } + } catch (Exception e) { + throw new ServiceException("修改失败,请联系管理员"); + } + return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg()); + } + /** * 删除任务信息 * @param backApplyInfo @@ -1408,7 +1509,8 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { // 根据id以及typeId以及maId查询相关信息 BackApplyInfoVo info = backApplyInfoMapper.selectIdList(dto); // 查询退料相关信息 - BackApplyInfoVo vo = backApplyInfoMapper.selectDetails(dto); + List list = backApplyInfoMapper.selectDetails(dto); + BackApplyInfoVo vo = list.get(0); BmFileInfo bmFileInfo = new BmFileInfo(); if (dto != null && dto.getTypeId() != null) { bmFileInfo.setTaskId(dto.getId()); @@ -1533,8 +1635,8 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { * @return */ private int updateTaskAndBackInfo(BackApplyInfo backApplyInfo) { - int result = backApplyInfoMapper.updateTaskStatus(backApplyInfo); - result += backApplyInfoMapper.updateBack(backApplyInfo); + backApplyInfo.setTaskStatus(2); + int result = backApplyInfoMapper.updateBack(backApplyInfo); result += backApplyInfoMapper.updateBackDetails(backApplyInfo); return result; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/ComplexQueryController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/ComplexQueryController.java index 53de4ff3..56f39110 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/ComplexQueryController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/ComplexQueryController.java @@ -70,6 +70,17 @@ public class ComplexQueryController extends BaseController { return AjaxResult.success(complexQueryService.getToolsLedgerDetailsList(bean)); } + /** + * 工器具台账--APP详情查询 + * @param bean + * @return + */ + @ApiOperation(value = "工器具台账详情查询") + @GetMapping("/getToolsDetailsList") + public AjaxResult getToolsDetailsList(RetainedEquipmentInfo bean) { + return AjaxResult.success(complexQueryService.getToolsDetailsList(bean)); + } + /** * 保有设备总量查询不带分页 * @param bean diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/RetainedEquipmentInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/RetainedEquipmentInfo.java index eeb830f9..3b8ce14c 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/RetainedEquipmentInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/RetainedEquipmentInfo.java @@ -164,17 +164,25 @@ public class RetainedEquipmentInfo { * 是否伸展(APP) */ private boolean expanded = false; - /** - * 编码 - */ - private String maCode; - /** - * 下次检验时间 - */ - private String nextCheckTime; + /** * 检验状态 */ private String checkStatus; + private String maCode; + + /** 本次检验日期 */ + @ApiModelProperty(value = "本次检验日期") + private String thisCheckTime; + + /** 下次检验日期 */ + @ApiModelProperty(value = "下次检验日期") + private String nextCheckTime; + + /** + * 状态(0 =正常,1= 3个月检测到期,2= 1个月检测到期,3= 已过期) + */ + private String status; + } \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/ComplexQueryMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/ComplexQueryMapper.java index 0c698797..2dcb32d7 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/ComplexQueryMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/ComplexQueryMapper.java @@ -153,6 +153,13 @@ public interface ComplexQueryMapper { */ List getToolsLedgerList(RetainedEquipmentInfo bean); + /** + * 工器具台账详情查询 + * @param bean + * @return + */ + List getToolsDetailsList(RetainedEquipmentInfo bean); + /** * 工器具台账详情查询 * @param bean diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/ComplexQueryService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/ComplexQueryService.java index 514b311d..3a12cd34 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/ComplexQueryService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/ComplexQueryService.java @@ -117,6 +117,13 @@ public interface ComplexQueryService { */ List getToolsLedgerList(RetainedEquipmentInfo bean); + /** + * 工器具台账详情查询 + * @param bean + * @return + */ + List getToolsDetailsList(RetainedEquipmentInfo bean); + /** * 工器具台账详情查询 * @param bean diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/ComplexQueryServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/ComplexQueryServiceImpl.java index 6dda1b3e..bada29d4 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/ComplexQueryServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/ComplexQueryServiceImpl.java @@ -17,6 +17,9 @@ import javax.annotation.Resource; import java.math.BigDecimal; import java.math.RoundingMode; import java.time.LocalDate; +import java.time.Period; +import java.time.format.DateTimeFormatter; +import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; @@ -533,6 +536,55 @@ public class ComplexQueryServiceImpl implements ComplexQueryService { } } + /** + * 工器具台账详情查询 + * @param bean + * @return + */ + @Override + public List getToolsDetailsList(RetainedEquipmentInfo bean) { + List list = complexQueryMapper.getToolsDetailsList(bean); + if (!CollectionUtil.isEmpty(list)) { + for (RetainedEquipmentInfo retainedEquipmentInfo : list) { + if (StringUtils.isNotBlank(retainedEquipmentInfo.getNextCheckTime())) { + String nextCheckTime = retainedEquipmentInfo.getNextCheckTime(); + // 解析字符串日期(格式:yyyy-MM-dd) + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + LocalDate targetDate = LocalDate.parse(nextCheckTime, formatter); + LocalDate currentDate = LocalDate.now(); // 当前日期 + boolean isFuture = targetDate.isAfter(currentDate); + if (!isFuture) { + // 已过期 + retainedEquipmentInfo.setStatus("3"); + continue; + } + Period period = Period.between(currentDate, targetDate); + int years = period.getYears(); + int months = period.getMonths(); + int days = period.getDays(); + // 计算累计月份差(向上取整) + int totalMonths = years * 12 + months; + if (days > 0 || targetDate.getDayOfMonth() > currentDate.getDayOfMonth()) { + totalMonths++; + } + if (totalMonths <= 1) { + retainedEquipmentInfo.setStatus("2"); + } else if (totalMonths <= 3) { + retainedEquipmentInfo.setStatus("1"); + } else { + retainedEquipmentInfo.setStatus("0"); + } + } + } + if (StringUtils.isNotBlank(bean.getStatus())) { + return list.stream().filter(item -> { + return item.getStatus().equals(bean.getStatus()); + }).collect(Collectors.toList()); + } + } + return list; + } + @Override public List getToolsLedgerDetailsList(RetainedEquipmentInfo bean) { List list =new ArrayList<>(); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java index 42a573b4..ccbb0b8e 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java @@ -410,8 +410,6 @@ public class SelectServiceImpl implements SelectService { List list = mapper.getAgreementInfoById(dto); if (CollectionUtils.isNotEmpty(list)) { vo = list.get(0); - } else { - return AjaxResult.error("未找到匹配的协议信息"); } } catch (Exception e) { log.error("班组id和标段工程id获取协议信息", e); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java index 90963d25..4eb86488 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java @@ -107,7 +107,7 @@ public class LeaseApplyInfoController extends BaseController { public AjaxResult getInfo(@NotNull(message = "领料任务ID不能为空") @PathVariable("id") Long id, @RequestParam(value = "keyWord", required = false) String keyWord, @RequestParam(value = "publishTask", required = false) String publishTask) { - return success(leaseApplyInfoService.selectLeaseApplyInfoById(id, keyWord, publishTask)); + return leaseApplyInfoService.selectLeaseApplyInfoById(id, keyWord, publishTask); } @ApiOperation(value = "获取领料任务详细信息") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/vo/LeaseTotalInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/vo/LeaseTotalInfo.java index 9d530963..3430846b 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/vo/LeaseTotalInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/vo/LeaseTotalInfo.java @@ -36,7 +36,6 @@ public class LeaseTotalInfo { @Excel(name = "计量单位") private String unitName; - @Excel(name = "预领数量") @ApiModelProperty(value = "预领料数") private BigDecimal preNum; @@ -45,7 +44,6 @@ public class LeaseTotalInfo { private BigDecimal outNum; @ApiModelProperty(value = "待出库数量") - @Excel(name = "待出库数量") private BigDecimal pendingNum; @ApiModelProperty(value = "领料日期") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseApplyInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseApplyInfoService.java index fc762fd8..6996b353 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseApplyInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseApplyInfoService.java @@ -32,7 +32,7 @@ public interface ILeaseApplyInfoService { * @param publishTask 发布批次 * @return 领料任务 */ - LeaseApplyRequestVo selectLeaseApplyInfoById(Long id, String keyword, String publishTask); + AjaxResult selectLeaseApplyInfoById(Long id, String keyword, String publishTask); /** * 查询领料任务列表 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java index 133842d9..531a4552 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java @@ -26,7 +26,6 @@ import com.bonus.common.security.utils.SecurityUtils; import com.bonus.material.back.domain.vo.MaCodeVo; import com.bonus.material.basic.domain.BmAgreementInfo; import com.bonus.material.basic.domain.BmQrcodeInfo; -import com.bonus.material.basic.domain.RetainedEquipmentInfo; import com.bonus.material.basic.mapper.BmAgreementInfoMapper; import com.bonus.material.basic.mapper.BmFileInfoMapper; import com.bonus.material.lease.domain.LeaseApplyDetails; @@ -52,7 +51,6 @@ import com.bonus.material.task.mapper.TmTaskAgreementMapper; import com.bonus.material.task.mapper.TmTaskMapper; import lombok.extern.slf4j.Slf4j; import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; import org.springframework.stereotype.Service; import com.bonus.material.lease.mapper.LeaseApplyInfoMapper; @@ -113,8 +111,9 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { * @return 领料任务 */ @Override - public LeaseApplyRequestVo selectLeaseApplyInfoById(Long id, String keyword, String publishTask) { + public AjaxResult selectLeaseApplyInfoById(Long id, String keyword, String publishTask) { try { + List newCodeList = new ArrayList<>(); LeaseApplyInfo leaseApplyInfo = new LeaseApplyInfo(); leaseApplyInfo.setId(id); Optional optionalInfo = Optional.ofNullable(leaseApplyInfoMapper.selectLeaseApplyInfoById(leaseApplyInfo)); @@ -147,9 +146,20 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { detail.setUseNum(BigDecimal.ZERO); } // 获取编码详情 + // 移出maCodeList集合中状态不为在库的数据 List maCodeVoList = leaseApplyDetailsMapper.getCodeList(id, detail.getTypeId()); if (!CollectionUtils.isEmpty(maCodeVoList)) { + if (!CollectionUtils.isEmpty(maCodeVoList)) { + // 将maCodeList不等于2的收集到新集合中 + for (LeaseMaCodeDto maCodeVo : maCodeVoList) { + if (StringUtils.isNotBlank(maCodeVo.getStatus()) && !"1".equals(maCodeVo.getStatus())) { + newCodeList.add(maCodeVo); + } + } + } + maCodeVoList = maCodeVoList.stream().filter(maCodeVo -> "1".equals(maCodeVo.getStatus())).collect(Collectors.toList()); detail.setMaCodeList(maCodeVoList); + detail.setPreNum(BigDecimal.valueOf(maCodeVoList.size())); } } } @@ -162,9 +172,25 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { } } } - }); - return leaseApplyRequestVo; + AjaxResult ajaxResult = AjaxResult.success(); + ajaxResult.put("data", leaseApplyRequestVo); + if (!CollectionUtils.isEmpty(newCodeList)) { + // 拼接消息内容 + StringBuffer msgBuilder = new StringBuffer("您所选择的编码设备编号"); + for (int i = 0; i < newCodeList.size(); i++) { + String code = newCodeList.get(i).getMaCode(); + msgBuilder.append(code); + if (i < newCodeList.size() - 1) { + msgBuilder.append(", "); + } + } + msgBuilder.append("已被他人完成出库,请注意查看!"); + String msg = msgBuilder.toString(); + msg = msg.replaceAll("\n",""); + ajaxResult.put("msg", msg); + } + return ajaxResult; } catch (Exception e) { // 记录异常日志 System.err.println("Error occurred while selecting lease apply info by ID: " + id + e.getMessage()); @@ -245,8 +271,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { @Override @Transactional(rollbackFor = Exception.class) public AjaxResult insertLeaseApplyInfo(LeaseApplyRequestVo leaseApplyRequestVo) { - String nickName = SecurityUtils.getLoginUser().getSysUser().getNickName(); - System.err.println("nickName:" + nickName); + log.info("新增接口传参:{}", leaseApplyRequestVo); if (null == leaseApplyRequestVo.getLeaseApplyInfo()) { return AjaxResult.error("请先填写领料任务信息"); } @@ -258,7 +283,10 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { return AjaxResult.error("领料出库数量不能大于库存数量"); } leaseApplyRequestVo.getLeaseApplyInfo().setCreateTime(DateUtils.getNowDate()); - leaseApplyRequestVo.getLeaseApplyInfo().setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName()); + String createBy = ""; + if (StringUtils.isBlank(leaseApplyRequestVo.getLeaseApplyInfo().getCreateBy())) { + leaseApplyRequestVo.getLeaseApplyInfo().setCreateBy(createBy); + } try { int thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId()); String taskCode = genderTaskCode(thisMonthMaxOrder); @@ -273,13 +301,13 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { leaseApplyRequestVo.getLeaseApplyInfo().getCompanyId(),thisMonthMaxOrder + 1, taskCode); } tmTask.setCreateTime(DateUtils.getNowDate()); - tmTask.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName()); + tmTask.setCreateBy(createBy); tmTaskMapper.insertTmTask(tmTask); BmAgreementInfo bmAgreementInfo = new BmAgreementInfo(); bmAgreementInfo.setProjectId(leaseApplyRequestVo.getLeaseApplyInfo().getProjectId()); bmAgreementInfo.setTeamId(leaseApplyRequestVo.getLeaseApplyInfo().getTeamId()); bmAgreementInfo.setCreateTime(DateUtils.getNowDate()); - bmAgreementInfo.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName()); + bmAgreementInfo.setCreateBy(createBy); // 先根据班组和工程id查询,若存在则直接返回,不存在则新增 BmAgreementInfo info = bmAgreementInfoMapper.queryByTeamIdAndProjectId(bmAgreementInfo); if (info != null) { @@ -320,7 +348,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { }); } if (count > 0) { - return insertPurchaseCheckDetails(tmTask.getTaskId(),leaseApplyRequestVo.getLeaseApplyDetailsList(), leaseApplyRequestVo.getLeaseApplyInfo().getId(), leaseApplyRequestVo.getLeaseApplyInfo().getIsOut()); + return insertPurchaseCheckDetails(createBy, tmTask.getTaskId(),leaseApplyRequestVo.getLeaseApplyDetailsList(), leaseApplyRequestVo.getLeaseApplyInfo().getId(), leaseApplyRequestVo.getLeaseApplyInfo().getIsOut()); } else { return AjaxResult.error("新增任务失败,lease_apply_info表插入0条"); } @@ -615,6 +643,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { LeaseTotalInfo totalInfo = leaseApplyInfoMapper.getTotalInfo(leaseTotalInfo); if (totalInfo != null) { leaseTotalInfo.setPreNum(totalInfo.getPreNum()); + leaseTotalInfo.setPendingNum(leaseTotalInfo.getPreNum().subtract(leaseTotalInfo.getOutNum())); } preNum = preNum.add(leaseTotalInfo.getPreNum()); outNum = outNum.add(leaseTotalInfo.getOutNum()); @@ -804,14 +833,14 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { * @param parentId * @return */ - private AjaxResult insertPurchaseCheckDetails(Long taskId, List leaseApplyDetailsList, Long parentId, Integer isOut) { + private AjaxResult insertPurchaseCheckDetails(String createBy, Long taskId, List leaseApplyDetailsList, Long parentId, Integer isOut) { if (!CollectionUtils.isEmpty(leaseApplyDetailsList)) { for (LeaseApplyDetails details : leaseApplyDetailsList) { details.setParentId(parentId); // 设置info.parentId details.setCreateTime(DateUtils.getNowDate()); - details.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName()); + details.setCreateBy(createBy); LeaseOutDetails record = new LeaseOutDetails(); - record.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName()); + record.setCreateBy(createBy); record.setIsFinished(isOut == 1 ? 1 : 0); // 领料出库 if (isOut == 1) { @@ -866,7 +895,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { record.setTypeId(Long.parseLong(leaseMaCodeDto.getTypeId())); int res = leaseOutDetailsMapper.insertLeaseOutDetails(record); // 更新 (ma_machine 设备表)的状态 - machineMapper.updateMaMachineStatus(record, MaMachineStatusEnum.RETURNED_MATERIAL.getStatus()); + //machineMapper.updateMaMachineStatus(record, MaMachineStatusEnum.RETURNED_MATERIAL.getStatus()); } } else { record.setTypeId(details.getTypeId()); @@ -946,11 +975,15 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { @Transactional(rollbackFor = Exception.class) public boolean updateLeaseApplyInfo(LeaseApplyRequestVo leaseApplyRequestVo) { try { + String createBy = ""; + if (StringUtils.isBlank(leaseApplyRequestVo.getLeaseApplyInfo().getCreateBy())) { + leaseApplyRequestVo.getLeaseApplyInfo().setCreateBy(createBy); + } // 提取到局部变量中,减少重复代码 LeaseApplyInfo leaseApplyInfo = leaseApplyRequestVo.getLeaseApplyInfo(); if (leaseApplyInfo != null && leaseApplyInfo.getId() != null) { leaseApplyInfo.setUpdateTime(DateUtils.getNowDate()); - leaseApplyInfo.setUpdateBy(SecurityUtils.getLoginUser().getSysUser().getNickName()); + leaseApplyInfo.setUpdateBy(createBy); // 去除创建一个新的数组对象,直接复用 Long[] ids = {leaseApplyInfo.getId()}; @@ -967,7 +1000,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { fileInfo.setModelId(leaseApplyInfo.getId()); fileInfo.setTaskType(2); fileInfo.setFileType(5L); - fileInfo.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName()); + fileInfo.setCreateBy(createBy); fileInfo.setCreateTime(DateUtils.getNowDate()); bmFileInfoMapper.insertBmFileInfo(fileInfo); } @@ -985,7 +1018,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { } } } - insertPurchaseCheckDetails(leaseApplyInfo.getTaskId(), leaseApplyRequestVo.getLeaseApplyDetailsList(), leaseApplyInfo.getId(), leaseApplyRequestVo.getLeaseApplyInfo().getIsOut()); + insertPurchaseCheckDetails(createBy, leaseApplyInfo.getTaskId(), leaseApplyRequestVo.getLeaseApplyDetailsList(), leaseApplyInfo.getId(), leaseApplyRequestVo.getLeaseApplyInfo().getIsOut()); } // 修改外层info leaseApplyInfoMapper.updateLeaseApplyInfo(leaseApplyInfo); @@ -1003,54 +1036,6 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { } catch (Exception e) { throw new ServiceException("未知异常: " + e.getMessage()); } - /*try { - int result = 0; - // 提取到局部变量中,减少重复代码 - LeaseApplyInfo leaseApplyInfo = leaseApplyRequestVo.getLeaseApplyInfo(); - if (leaseApplyInfo != null && leaseApplyInfo.getId() != null) { - // 去除创建一个新的数组对象,直接复用 - Long[] ids = {leaseApplyInfo.getId()}; - result = leaseApplyInfoMapper.deleteLeaseApplyInfoByIds(ids); - if (result == 0) { - throw new RuntimeException("删除主要任务失败"); - } - if (CollectionUtil.isNotEmpty(leaseApplyRequestVo.getLeaseApplyDetailsList())) { - // 业务逻辑代码 - result = leaseApplyDetailsMapper.deleteLeaseApplyDetailsByParentIds(ids); - if (result == 0) { - throw new RuntimeException("删除详情任务失败"); - } - } - // 查询是否存在文件 - BmFileInfo fileInfo = new BmFileInfo(); - fileInfo.setTaskId(leaseApplyInfo.getTaskId()); - fileInfo.setModelId(leaseApplyInfo.getId()); - fileInfo.setTaskType(2); - fileInfo.setFileType(5L); - List bmFileInfos = bmFileInfoMapper.selectBmFileInfoList(fileInfo); - // 删除原有数据 - if (!CollectionUtils.isEmpty(bmFileInfos)) { - result = bmFileInfoMapper.deleteBmFileInfoByBizInfo(fileInfo); - if (result == 0) { - throw new RuntimeException("删除文件失败"); - } - } - // 重新走新增逻辑 - AjaxResult ajaxResult = insertLeaseApplyInfo(leaseApplyRequestVo); - if (!ajaxResult.isSuccess()) { - System.err.println(ajaxResult.get("msg")); - throw new RuntimeException("修改新增数据异常"); - } - return true; - } - return false; - } catch (DataAccessException dae) { - throw new ServiceException("数据访问异常: " + dae.getMessage()); - } catch (IllegalArgumentException iae) { - throw new ServiceException("非法参数异常: " + iae.getMessage()); - } catch (Exception e) { - throw new ServiceException("未知异常: " + e.getMessage()); - }*/ } /** diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml index 9c36b3f0..debe973e 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml @@ -99,10 +99,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" SELECT mm.ma_id AS maId, mm.ma_code AS maCode, + sd.dict_label AS maStatusName, mm.ma_status AS maStatus, - mt1.type_name AS typeName, + mt1.type_name AS materialName, mm.type_id AS typeId, - mt.type_name AS materialName, + mt.type_name AS typeName, mt2.type_name AS materialType FROM lease_out_details lod @@ -116,6 +117,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN slt_agreement_info sai on lod.type_id = sai.type_id and sai.ma_id = lod.ma_id LEFT JOIN bm_agreement_info ba ON sai.agreement_id = ba.agreement_id + LEFT JOIN sys_dict_data sd ON mm.ma_status = sd.dict_value + and sd.dict_type = 'ma_machine_status' WHERE 1 = 1 and mm.ma_status = '2' and mm.type_id = #{typeId} AND ba.team_id = #{teamId} @@ -163,8 +166,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ba.parent_id AS parentId, ba.type_id AS typeId, mt2.type_name AS materialType, - mt.type_name AS typeModel, - mt1.type_name AS typeName, + mt.type_name AS typeName, + mt1.type_name AS materialName, mt.unit_name AS unitName, mt.unit_value AS unitValue, mt.manage_type AS manageType, @@ -178,7 +181,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ba.remark AS remark, ba.ap_detection AS apDetection, ba.bad_num AS badNum, - ba.good_num AS goodNum + ba.good_num AS goodNum, + ba.status AS status FROM back_apply_details ba LEFT JOIN ma_type mt ON mt.type_id = ba.type_id and mt.del_flag = 0 @@ -200,18 +204,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mm.ma_code as maCode, bcd.type_id AS typeId, mt2.type_name AS materialType, - mt.type_name AS materialName, - mt1.type_name AS typeName, + mt.type_name AS typeName, + mt1.type_name AS materialName, bcd.ap_detection AS apDetection, - mm.ma_status AS maStatus, + sd.dict_label AS maStatusName, bcd.bad_num AS badNum, - bcd.good_num AS goodNum + bcd.good_num AS goodNum, + mm.ma_status AS maStatus FROM back_check_details bcd left join ma_machine mm on bcd.ma_id = mm.ma_id left join ma_type mt ON mt.type_id = mm.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 ma_type mt2 ON mt1.parent_id = mt2.type_id and mt2.del_flag = 0 + LEFT JOIN sys_dict_data sd ON mm.ma_status = sd.dict_value + and sd.dict_type = 'ma_machine_status' where bcd.parent_id = #{id} @@ -233,7 +240,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN tm_task_agreement tta ON tta.task_id = bai.task_id LEFT JOIN ma_machine mm ON bcd.ma_id = mm.ma_id WHERE - bcd.parent_id = #{id} and (bcd.is_finished is null or bcd.is_finished != 1) + bcd.parent_id = #{id} and bcd.type_id = #{typeId} @@ -667,7 +674,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - update back_check_details set is_finished = '1', update_time = now() where parent_id = #{id} and type_id = #{typeId} and (is_finished is null or is_finished != 1) + update back_check_details set is_finished = '1', update_time = now() + where parent_id = #{id} and type_id = #{typeId} and (is_finished is null or is_finished != 1) + + and ma_id = #{maId} + @@ -925,7 +936,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" bcd.back_num AS backNum, bcd.good_num AS passNum, bcd.bad_num AS unPassNum, - bcd.remark AS unPassReason + bcd.remark AS unPassReason, + bcd.is_finished AS isFinished FROM back_check_details bcd LEFT JOIN ma_type mt ON bcd.type_id = mt.type_id diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/ComplexQueryMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/ComplexQueryMapper.xml index 13a4f304..f702ae6a 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/ComplexQueryMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/ComplexQueryMapper.xml @@ -1198,4 +1198,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and mm.ma_status='1' + + diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml index e1c14594..b442faf7 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml @@ -745,7 +745,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mt.type_name as materialModel, mm.ma_id as maId, mm.ma_code as maCode, - sd.dict_label as maStatus + sd.dict_label as maStatus, + mm.ma_status as status FROM lease_out_details lod LEFT JOIN ma_machine mm ON lod.ma_id = mm.ma_id diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyInfoMapper.xml index 760bb88a..5c36faac 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyInfoMapper.xml @@ -350,39 +350,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"