标签查询

This commit is contained in:
mashuai 2025-03-05 13:27:10 +08:00
parent 914f0c7a03
commit 5e2309f412
8 changed files with 121 additions and 1 deletions

View File

@ -274,4 +274,10 @@ public class LeaseApplyInfo extends BaseEntity{
@ApiModelProperty(value = "所属记录") @ApiModelProperty(value = "所属记录")
private Integer recordId; private Integer recordId;
@ApiModelProperty(value = "设备编码")
private String maCode;
@ApiModelProperty(value = "设备id")
private Long maId;
} }

View File

@ -126,4 +126,11 @@ public interface LeaseApplyDetailsMapper {
* @return * @return
*/ */
int updateBackDetailsOutNum(LeaseOutDetails leaseOutDetails); int updateBackDetailsOutNum(LeaseOutDetails leaseOutDetails);
/**
* 根据机具id查询领料任务详细
* @param maId
* @return
*/
List<LeaseOutVo> selectByMaId(Long maId);
} }

View File

@ -157,4 +157,16 @@ public class MachineController extends BaseController {
return error("系统错误, " + e.getMessage()); return error("系统错误, " + e.getMessage());
} }
} }
/**
* 根据标签信息查询出库单
* @param leaseApplyInfo
* @return
*/
@ApiOperation(value = "获取领料出库单详细信息")
//@RequiresPermissions("lease:info:query")
@GetMapping(value = "/getInfoByMaId")
public AjaxResult getInfoByMaId(LeaseApplyInfo leaseApplyInfo) {
return success(machineService.getInfoByMaId(leaseApplyInfo));
}
} }

View File

@ -2,6 +2,7 @@ package com.bonus.material.ma.mapper;
import java.util.List; import java.util.List;
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
import com.bonus.common.biz.domain.lease.LeaseOutDetails; import com.bonus.common.biz.domain.lease.LeaseOutDetails;
import com.bonus.material.ma.domain.Machine; import com.bonus.material.ma.domain.Machine;
import com.bonus.material.ma.domain.Type; import com.bonus.material.ma.domain.Type;
@ -112,4 +113,11 @@ public interface MachineMapper
* @return * @return
*/ */
List<Machine> getElectronicLabel(Machine machine); List<Machine> getElectronicLabel(Machine machine);
/**
* 根据标签信息查询出库单
* @param leaseApplyInfo
* @return
*/
Long selectMaId(LeaseApplyInfo leaseApplyInfo);
} }

View File

@ -2,7 +2,9 @@ package com.bonus.material.ma.service;
import java.util.List; import java.util.List;
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo;
import com.bonus.material.ma.domain.Machine; import com.bonus.material.ma.domain.Machine;
import com.bonus.material.ma.domain.Type; import com.bonus.material.ma.domain.Type;
import com.bonus.material.ma.domain.vo.MachineVo; import com.bonus.material.ma.domain.vo.MachineVo;
@ -83,4 +85,11 @@ public interface IMachineService
* @return * @return
*/ */
List<Machine> getElectronicLabel(Machine machine); List<Machine> getElectronicLabel(Machine machine);
/**
* 根据标签信息查询出库单
* @param leaseApplyInfo
* @return
*/
LeaseApplyRequestVo getInfoByMaId(LeaseApplyInfo leaseApplyInfo);
} }

View File

@ -3,11 +3,17 @@ package com.bonus.material.ma.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.alibaba.nacos.common.utils.CollectionUtils; import com.alibaba.nacos.common.utils.CollectionUtils;
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
import com.bonus.common.biz.enums.HttpCodeEnum; import com.bonus.common.biz.enums.HttpCodeEnum;
import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.StringUtils; import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo;
import com.bonus.material.lease.domain.vo.LeaseOutVo;
import com.bonus.material.lease.mapper.LeaseApplyDetailsMapper;
import com.bonus.material.lease.mapper.LeaseApplyInfoMapper;
import com.bonus.material.ma.domain.Type; import com.bonus.material.ma.domain.Type;
import com.bonus.material.ma.domain.vo.MachineVo; import com.bonus.material.ma.domain.vo.MachineVo;
import com.bonus.material.purchase.config.RemoteConfig; import com.bonus.material.purchase.config.RemoteConfig;
@ -40,6 +46,12 @@ public class MachineServiceImpl implements IMachineService
@Resource @Resource
private ScrapApplyDetailsMapper scrapApplyDetailsMapper; private ScrapApplyDetailsMapper scrapApplyDetailsMapper;
@Resource
private LeaseApplyInfoMapper leaseApplyInfoMapper;
@Resource
private LeaseApplyDetailsMapper leaseApplyDetailsMapper;
/** /**
* 查询机具设备管理 * 查询机具设备管理
* *
@ -187,4 +199,33 @@ public class MachineServiceImpl implements IMachineService
public List<Machine> getElectronicLabel(Machine machine) { public List<Machine> getElectronicLabel(Machine machine) {
return machineMapper.getElectronicLabel(machine); return machineMapper.getElectronicLabel(machine);
} }
/**
* 根据标签信息查询出库单
* @param leaseApplyInfo
* @return
*/
@Override
public LeaseApplyRequestVo getInfoByMaId(LeaseApplyInfo leaseApplyInfo) {
try {
LeaseApplyRequestVo leaseApplyRequestVo = new LeaseApplyRequestVo();
// 根据maCode查询maId
Long maId = machineMapper.selectMaId(leaseApplyInfo);
// 获取领料单详情
List<LeaseOutVo> details = leaseApplyDetailsMapper.selectByMaId(maId);
if (CollectionUtils.isNotEmpty(details)) {
leaseApplyRequestVo.setLeaseOutVoList(details);
Long id = details.get(0).getId();
leaseApplyInfo.setId(id);
}
LeaseApplyInfo optionalInfo = leaseApplyInfoMapper.selectLeaseApplyInfoById(leaseApplyInfo);
if (optionalInfo != null) {
leaseApplyRequestVo.setLeaseApplyInfo(optionalInfo);
}
return leaseApplyRequestVo;
} catch (Exception e) {
// 记录异常日志
throw new RuntimeException("Failed to select lease apply info", e);
}
}
} }

View File

@ -383,4 +383,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY ORDER BY
lod.create_time DESC lod.create_time DESC
</select> </select>
<select id="selectByMaId" resultType="com.bonus.material.lease.domain.vo.LeaseOutVo">
SELECT
lod.parent_id AS id,
mt1.type_name AS typeName,
mt.type_name AS typeModelName,
mt.unit_name AS unit,
lod.out_num AS num,
mm.ma_code AS maCode,
mt.rated_load AS ratedLoad,
mt.test_load AS testLoad,
mt.holding_time AS holdingTime,
DATE(lod.create_time) AS testTime,
'合格' AS checkResult,
lad.remark AS remark,
DATE(DATE_SUB(DATE_ADD(lod.create_time, INTERVAL 1 YEAR), INTERVAL 1 DAY)) AS nextTestTime -- 计算 nextTestTime
FROM
lease_out_details lod
LEFT JOIN ma_type mt ON lod.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 ma_machine mm ON lod.ma_id = mm.ma_id
LEFT JOIN lease_apply_details lad ON lod.type_id = lad.type_id
LEFT JOIN purchase_check_details pcd ON lod.type_id = pcd.type_id
<if test="userId != null">
JOIN ma_type_keeper mtk ON mtk.type_id = lod.type_id AND mtk.user_id = #{userId}
</if>
WHERE lod.ma_id = #{maId}
GROUP BY lod.type_id, mm.ma_code
ORDER BY lod.create_time DESC
</select>
</mapper> </mapper>

View File

@ -421,7 +421,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mm.check_man as checkMan, mm.check_man as checkMan,
mm.inspect_man as inspectMan, mm.inspect_man as inspectMan,
mm.phone, mm.phone,
mm.inspect_status as inspectStatus, '合格' as inspectStatus,
mm.ma_vender as maVender, mm.ma_vender as maVender,
mm.ex_code as exCode, mm.ex_code as exCode,
mm.ex_url as exUrl, mm.ex_url as exUrl,
@ -431,9 +431,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt on mt.type_id=mm.type_id LEFT JOIN ma_type mt on mt.type_id=mm.type_id
LEFT JOIN ma_type mt2 on mt2.type_id=mt.parent_id LEFT JOIN ma_type mt2 on mt2.type_id=mt.parent_id
WHERE WHERE
mm.ma_status = '2' and
mm.ma_code like concat('%', #{maCode}, '%') mm.ma_code like concat('%', #{maCode}, '%')
</select> </select>
<select id="selectMaId" resultType="java.lang.Long">
select ma_id
from ma_machine
WHERE ma_code = #{maCode}
</select>
<delete id="deleteMachineByMaCodeAndTypeId"> <delete id="deleteMachineByMaCodeAndTypeId">
delete from ma_machine where ma_code = #{maCode} and type_id = #{typeId} delete from ma_machine where ma_code = #{maCode} and type_id = #{typeId}
and ma_status = '0' and ma_status = '0'