问题修改

This commit is contained in:
hayu 2025-08-12 18:20:35 +08:00
parent 2a91ea8e48
commit 4ba06551dc
6 changed files with 164 additions and 1 deletions

View File

@ -303,6 +303,16 @@ public class MachineController extends BaseController {
return machineService.getHisByCode(machine);
}
/**
* 根据qrcode查询机具历史信息-New查询安全工器具和工器具
* @param machine
* @return
*/
@GetMapping("/getHisByCodeNew")
public AjaxResult getHisByCodeNew(Machine machine) {
return machineService.getHisByCodeNew(machine);
}
/**
* 根据类型id获取编码
* @param machine

View File

@ -316,4 +316,9 @@ public class Machine extends BaseEntity {
private List<String> projectIdList;
private String supplierId;
/**
* 1-工器具2-安全工器具
*/
private int jiJuType;
}

View File

@ -188,4 +188,11 @@ public interface MachineMapper
* @return
*/
List<Machine> getInfoByTypeId(Machine machine);
/**
* 根据编码查询机具信息
* @param machine
* @return
*/
List<Machine> getHisByCodeNew(Machine machine);
}

View File

@ -133,4 +133,11 @@ public interface IMachineService
* @return
*/
List<Machine> getInfoByTypeId(Machine machine);
/**
* 根据编码查询机具历史信息-New查询安全工器具和工器具
* @param machine
* @return
*/
AjaxResult getHisByCodeNew(Machine machine);
}

View File

@ -433,6 +433,79 @@ public class MachineServiceImpl implements IMachineService
}
@Override
public AjaxResult getHisByCodeNew(Machine machine) {
try {
List<Machine> result = new ArrayList<>();
List<Machine> maList = machineMapper.getHisByCodeNew(machine);
if (CollectionUtils.isNotEmpty(maList)){
if(maList.size() == 1){
Machine baseInfo = maList.get(0);
if (baseInfo.getJiJuType()==2){
machine.setMaId(baseInfo.getMaId());
machine.setMaCode(baseInfo.getMaCode());
//2根据二维码查询初次入库时间
Machine inTime = machineMapper.getInTimeByQrcode(machine);
//服务工程次数检验次数
Machine serviceNum = machineMapper.getServiceNumByQrcode(machine);
//更换配件次数
Machine checkNum = machineMapper.getCheckNumByQrcode(machine);
//报废时间
Machine scrapTime = machineMapper.getScrapTimeByQrcode(machine);
//3根据机具id查询领退工程
Machine leaseInfo = machineMapper.getLeaseInfoByQrcode(machine);
if (inTime != null){
Integer taskId = inTime.getTaskId();
if(taskId != null){
baseInfo.setInTime(inTime.getInTime()+"(新购)");
}else{
baseInfo.setInTime(inTime.getInTime());
}
}
if(serviceNum != null){
baseInfo.setServiceNum(serviceNum.getServiceNum());
}else{
baseInfo.setServiceNum(0);
}
if(checkNum != null){
baseInfo.setCheckNum(checkNum.getCheckNum());
}else{
baseInfo.setCheckNum(0);
}
if (scrapTime != null){
baseInfo.setScrapTime(scrapTime.getScrapTime());
}else{
baseInfo.setScrapTime("暂无");
}
if(leaseInfo != null){
baseInfo.setLeaseTime(leaseInfo.getLeaseTime());
baseInfo.setLeaseUnit(leaseInfo.getLeaseUnit());
baseInfo.setLeaseProject(leaseInfo.getLeaseProject());
baseInfo.setBackTime(leaseInfo.getBackTime());
baseInfo.setBackUnit(leaseInfo.getBackUnit());
baseInfo.setBackProject(leaseInfo.getBackProject());
}
result.add(baseInfo);
return success(result);
} else {
result.add(baseInfo);
return success(result);
}
} else {
return success(maList);
}
}else{
return error("暂无该设备信息");
}
} catch (Exception e) {
e.printStackTrace();
return error("暂无该设备信息");
}
}
/**
* 编码铭牌信息
* @param machine
@ -454,4 +527,5 @@ public class MachineServiceImpl implements IMachineService
return machineMapper.getInfoByTypeId(machine);
}
}

View File

@ -75,7 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ma.inspect_man as inspectMan,
ma.inspect_status as inspectStatus,
ma.phone as phone,
mt.jiju_type as jijuType,
mt.jiju_type as jiJuType,
mt.is_check as isCheck,
CASE
WHEN RIGHT(ma.ma_code, 4) REGEXP '^[0-9]{4}$' THEN CAST(RIGHT(ma.ma_code, 4) AS UNSIGNED)
@ -787,4 +787,64 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and wsi.ma_code LIKE CONCAT('%',#{maCode},'%')
</if>
</select>
<select id="getHisByCodeNew" resultType="com.bonus.material.ma.domain.Machine">
(
SELECT
mm.ma_id as maId,
mt2.type_name as maName,
mt.type_name as maModel,
mm.ma_code as maCode,
mm.qr_code as qrCode,
mm.type_id as typeId,
sd.dict_label as maStatus,
mm.ma_vender as maVender,
mm.out_fac_time as outFacTime,
mm.out_fac_code as outFacCode,
mm.assets_code as assetsCode,
mm.check_man as checkMan,
mm.this_check_time as thisCheckTime,
mm.next_check_time as nextCheckTime,
mm.in_out_num as inOutNum,
mt.jiju_type as jiJuType,
mt.is_check as isCheck
FROM ma_machine mm
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN sys_dict_data sd ON mm.ma_status = sd.dict_value AND sd.dict_type = 'ma_machine_status'
WHERE
1=1
<if test="maCode != null"> and mm.ma_code LIKE CONCAT('%',#{maCode}, '%') </if>
<if test="maId != null">and mm.ma_id = #{maId}</if>
LIMIT 100
)
UNION ALL
(
SELECT
wmi.id as maId,
mt2.type_name as maName,
mt.type_name as maModel,
wmi.ma_code as maCode,
wmi.qr_code as qrCode,
wmi.model_id as typeId,
'' as maStatus,
wmi.supplier as maVender,
'' as outFacTime,
'' as outFacCode,
'' as assetsCode,
wmi.check_man as checkMan,
wmi.this_check_time as thisCheckTime,
wmi.next_check_time as nextCheckTime,
'' as inOutNum,
mt.jiju_type as jiJuType,
mt.is_check as isCheck
FROM ws_ma_info wmi
LEFT JOIN ma_type mt ON mt.type_id = wmi.model_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
WHERE
1=1
<if test="maCode != null"> and wmi.ma_code LIKE CONCAT('%',#{maCode}, '%')</if>
<if test="maId != null">and wmi.id = #{maId}</if>
LIMIT 100
)
</select>
</mapper>