问题修改

This commit is contained in:
hayu 2025-08-13 19:02:01 +08:00
parent 1fef75868b
commit aeb6f957e0
4 changed files with 117 additions and 21 deletions

View File

@ -321,4 +321,12 @@ public class Machine extends BaseEntity {
* 1-工器具2-安全工器具 * 1-工器具2-安全工器具
*/ */
private int jiJuType; private int jiJuType;
/**
* 数据来源设备类型
* 1-工器具2-安全工器具
*/
private int devType;
private String type;
} }

View File

@ -195,4 +195,13 @@ public interface MachineMapper
* @return * @return
*/ */
List<Machine> getHisByCodeNew(Machine machine); List<Machine> getHisByCodeNew(Machine machine);
/**
* 根据数据
* @param machine
* @return
*/
List<Machine> getElectronicLabelByWsMaInfo(Machine machine);
List<Machine> getHisByCodeNewByWsMaInfo(Machine machine);
} }

View File

@ -21,6 +21,7 @@ import com.bonus.material.purchase.config.RemoteConfig;
import com.bonus.material.scrap.domain.ScrapApplyDetails; import com.bonus.material.scrap.domain.ScrapApplyDetails;
import com.bonus.material.scrap.mapper.ScrapApplyDetailsMapper; import com.bonus.material.scrap.mapper.ScrapApplyDetailsMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.hibernate.validator.internal.util.StringHelper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.bonus.material.ma.mapper.MachineMapper; import com.bonus.material.ma.mapper.MachineMapper;
import com.bonus.material.ma.domain.Machine; import com.bonus.material.ma.domain.Machine;
@ -207,27 +208,39 @@ public class MachineServiceImpl implements IMachineService
*/ */
@Override @Override
public List<Machine> getElectronicLabel(Machine machine) { public List<Machine> getElectronicLabel(Machine machine) {
List<Machine> list = machineMapper.getElectronicLabel(machine); List<Machine> list = new ArrayList<>();
if (CollectionUtils.isNotEmpty(list)) { try {
for (Machine dto : list) { if (machine.getDevType()==1){
// 根据typeId查询信息 //查询ws_ma_info,工器具
Machine info = machineMapper.selectHouse(dto); list = machineMapper.getElectronicLabelByWsMaInfo(machine);
if (info != null) { } else {
if ("机具库".equals(info.getOwnHouse())) { //查询ma_machine表安全工器具
dto.setIsJj(0); list = machineMapper.getElectronicLabel(machine);
} else { }
dto.setIsJj(1);
if (CollectionUtils.isNotEmpty(list)) {
for (Machine dto : list) {
// 根据typeId查询信息
Machine info = machineMapper.selectHouse(dto);
if (info != null) {
if ("机具库".equals(info.getOwnHouse())) {
dto.setIsJj(0);
} else {
dto.setIsJj(1);
}
}
// 获取领料单详情
List<LeaseOutVo> details = leaseApplyDetailsMapper.selectByMaId(dto.getMaId());
if (CollectionUtils.isNotEmpty(details)) {
Long id = details.get(0).getId();
dto.setId(id);
} }
} }
// 获取领料单详情
List<LeaseOutVo> details = leaseApplyDetailsMapper.selectByMaId(dto.getMaId());
if (CollectionUtils.isNotEmpty(details)) {
Long id = details.get(0).getId();
dto.setId(id);
}
} }
return list;
} catch (Exception e){
return new ArrayList<>();
} }
return list;
} }
/** /**
@ -437,7 +450,15 @@ public class MachineServiceImpl implements IMachineService
public AjaxResult getHisByCodeNew(Machine machine) { public AjaxResult getHisByCodeNew(Machine machine) {
try { try {
List<Machine> result = new ArrayList<>(); List<Machine> result = new ArrayList<>();
List<Machine> maList = machineMapper.getHisByCodeNew(machine); List<Machine> maList=new ArrayList<>();
if (machine.getDevType()==0){
maList = machineMapper.getHisByCodeNew(machine);
} else if (machine.getDevType()==1){
maList = machineMapper.getHisByCodeNewByWsMaInfo(machine);
} else if (machine.getDevType()==2){
maList = machineMapper.getListByCode(machine);
}
if (CollectionUtils.isNotEmpty(maList)){ if (CollectionUtils.isNotEmpty(maList)){
if(maList.size() == 1){ if(maList.size() == 1){
Machine baseInfo = maList.get(0); Machine baseInfo = maList.get(0);

View File

@ -585,7 +585,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mm.check_man as checkMan, mm.check_man as checkMan,
mm.this_check_time as thisCheckTime, mm.this_check_time as thisCheckTime,
mm.next_check_time as nextCheckTime, mm.next_check_time as nextCheckTime,
mm.in_out_num as inOutNum mm.in_out_num as inOutNum,
mt.jiju_type as devType
FROM FROM
ma_machine mm ma_machine mm
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
@ -806,7 +807,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mm.next_check_time as nextCheckTime, mm.next_check_time as nextCheckTime,
mm.in_out_num as inOutNum, mm.in_out_num as inOutNum,
mt.jiju_type as jiJuType, mt.jiju_type as jiJuType,
mt.is_check as isCheck mt.is_check as isCheck,
'2' as devType
FROM ma_machine mm FROM ma_machine mm
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 mt.parent_id = mt2.type_id LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
@ -836,7 +838,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wmi.next_check_time as nextCheckTime, wmi.next_check_time as nextCheckTime,
'' as inOutNum, '' as inOutNum,
mt.jiju_type as jiJuType, mt.jiju_type as jiJuType,
mt.is_check as isCheck mt.is_check as isCheck,
'1' as devType
FROM ws_ma_info wmi FROM ws_ma_info wmi
LEFT JOIN ma_type mt ON mt.type_id = wmi.model_id LEFT JOIN ma_type mt ON mt.type_id = wmi.model_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
@ -847,4 +850,59 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LIMIT 100 LIMIT 100
) )
</select> </select>
<select id="getElectronicLabelByWsMaInfo" resultType="com.bonus.material.ma.domain.Machine">
SELECT
wmi.id as maId,
mt2.type_name AS materialName,
mt.type_name AS materialModel,
wmi.ma_code as maCode,
wmi.this_check_time as thisCheckTime,
wmi.next_check_time as nextCheckTime,
wmi.check_man as inspectMan,
wmi.repair_man as checkMan,
wmi.phone,
'合格' AS inspectStatus,
wmi.supplier as maVender,
'0' as isJj,
wmi.model_id as typeId
FROM
ws_ma_info wmi
LEFT JOIN ma_type mt ON mt.type_id = wmi.model_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE
wmi.ma_code like concat('%', #{maCode}, '%')
<if test="maId != null">
and wmi.id = #{maId}
</if>
</select>
<select id="getHisByCodeNewByWsMaInfo" resultType="com.bonus.material.ma.domain.Machine">
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,
'1' as devType
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> </mapper>