二维码查询开发

This commit is contained in:
bonus 2025-06-25 15:40:06 +08:00
parent ed0cc6355d
commit 40543b9091
9 changed files with 200 additions and 25 deletions

View File

@ -34,7 +34,7 @@ import java.util.Map;
/**
* 领料任务Controller
*
*
* @author xsheng
* @date 2024-10-16
*/

View File

@ -16,7 +16,7 @@ import javax.servlet.http.HttpServletResponse;
/**
* 领料任务Service接口
*
*
* @author xsheng
* @date 2024-10-16
*/
@ -34,7 +34,7 @@ public interface ILeaseApplyInfoService {
/**
* 查询领料任务列表
*
*
* @param leaseApplyInfo 领料任务
* @return 领料任务集合
*/
@ -61,7 +61,7 @@ public interface ILeaseApplyInfoService {
/**
* 新增领料任务
*
*
* @param leaseApplyRequestVo 领料任务
* @return 结果
*/
@ -74,7 +74,7 @@ public interface ILeaseApplyInfoService {
/**
* 修改领料任务
*
*
* @param leaseApplyRequestVo 领料任务
* @return 结果
*/
@ -96,7 +96,7 @@ public interface ILeaseApplyInfoService {
/**
* 批量删除领料任务
*
*
* @param ids 需要删除的领料任务主键集合
* @return 结果
*/
@ -104,7 +104,7 @@ public interface ILeaseApplyInfoService {
/**
* 删除领料任务信息
*
*
* @param id 领料任务主键
* @return 结果
*/
@ -166,4 +166,6 @@ public interface ILeaseApplyInfoService {
* @return
*/
AjaxResult useExamine(LeaseApplyInfo leaseApplyInfo);
}

View File

@ -573,6 +573,8 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
}
}
/**
* 插入领料任务详情数据
* @param leaseApplyDetailsList

View File

@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
import com.bonus.common.log.enums.OperaType;
import com.bonus.material.basic.domain.BmQrcodeInfo;
import com.bonus.material.common.annotation.PreventRepeatSubmit;
import com.bonus.material.ma.domain.Type;
import com.bonus.material.ma.domain.vo.MachineVo;
@ -34,7 +35,7 @@ import org.springframework.web.client.RestTemplate;
/**
* 机具设备管理Controller
*
*
* @author xsheng
* @date 2024-09-27
*/
@ -265,4 +266,17 @@ public class MachineController extends BaseController {
{
return toAjax(machineService.editAssetsCode(machine));
}
/**
* 根据qrcode查询机具历史信息
* @param machine
* @return
*/
@GetMapping("/getHisByQrcode")
public AjaxResult getHisByQrcode(Machine machine) {
return machineService.getHisByQrcode(machine);
}
}

View File

@ -14,7 +14,7 @@ import com.bonus.common.core.web.domain.BaseEntity;
/**
* 机具设备管理对象 ma_machine
*
*
* @author xsheng
* @date 2024-09-27
*/
@ -210,4 +210,27 @@ public class Machine extends BaseEntity
@ApiModelProperty(value = "集合")
private List<SampleSync> samples;
@ApiModelProperty(value = "入库时间")
private String inTime;
@ApiModelProperty(value = "服务工程数")
private int serviceNum;
@ApiModelProperty(value = "检验次数")
private int checkNum;
@ApiModelProperty(value = "报废时间")
private String scrapTime;
@ApiModelProperty(value = "领料单位")
private String leaseUnit;
@ApiModelProperty(value = "领料工程")
private String leaseProject;
@ApiModelProperty(value = "领料时间")
private String leaseTime;
@ApiModelProperty(value = "退料单位")
private String backUnit;
@ApiModelProperty(value = "退料工程")
private String backProject;
@ApiModelProperty(value = "退料时间")
private String backTime;
@ApiModelProperty(value = "任务")
private Integer taskId;
}

View File

@ -152,4 +152,16 @@ public interface MachineMapper
Machine selectMachineByQrCode(Machine ma);
Machine getInfoByQrcode(Machine machine);
Machine getInTimeByQrcode(Machine machine);
Machine getServiceNumByQrcode(Machine machine);
Machine getCheckNumByQrcode(Machine machine);
Machine getScrapTimeByQrcode(Machine machine);
Machine getLeaseInfoByQrcode(Machine machine);
}

View File

@ -11,15 +11,15 @@ import com.bonus.material.ma.domain.vo.MachineVo;
/**
* 机具设备管理Service接口
*
*
* @author xsheng
* @date 2024-09-27
*/
public interface IMachineService
public interface IMachineService
{
/**
* 查询机具设备管理
*
*
* @param maId 机具设备管理主键
* @return 机具设备管理
*/
@ -27,7 +27,7 @@ public interface IMachineService
/**
* 查询机具设备管理列表
*
*
* @param machine 机具设备管理
* @return 机具设备管理集合
*/
@ -35,7 +35,7 @@ public interface IMachineService
/**
* 新增机具设备管理
*
*
* @param machine 机具设备管理
* @return 结果
*/
@ -43,7 +43,7 @@ public interface IMachineService
/**
* 修改机具设备管理
*
*
* @param machine 机具设备管理
* @return 结果
*/
@ -51,7 +51,7 @@ public interface IMachineService
/**
* 批量删除机具设备管理
*
*
* @param maIds 需要删除的机具设备管理主键集合
* @return 结果
*/
@ -59,7 +59,7 @@ public interface IMachineService
/**
* 删除机具设备管理信息
*
*
* @param maId 机具设备管理主键
* @return 结果
*/
@ -116,4 +116,5 @@ public interface IMachineService
*/
public int editAssetsCode(Machine machine);
AjaxResult getHisByQrcode(Machine machine);
}

View File

@ -34,13 +34,13 @@ import static com.bonus.common.core.web.domain.AjaxResult.success;
/**
* 机具设备管理Service业务层处理
*
*
* @author xsheng
* @date 2024-09-27
*/
@Service
@Slf4j
public class MachineServiceImpl implements IMachineService
public class MachineServiceImpl implements IMachineService
{
@Resource
private MachineMapper machineMapper;
@ -59,7 +59,7 @@ public class MachineServiceImpl implements IMachineService
/**
* 查询机具设备管理
*
*
* @param maId 机具设备管理主键
* @return 机具设备管理
*/
@ -76,7 +76,7 @@ public class MachineServiceImpl implements IMachineService
/**
* 查询机具设备管理列表
*
*
* @param machine 机具设备管理
* @return 机具设备管理
*/
@ -102,7 +102,7 @@ public class MachineServiceImpl implements IMachineService
/**
* 新增机具设备管理
*
*
* @param machine 机具设备管理
* @return 结果
*/
@ -115,7 +115,7 @@ public class MachineServiceImpl implements IMachineService
/**
* 修改机具设备管理
*
*
* @param machine 机具设备管理
* @return 结果
*/
@ -132,7 +132,7 @@ public class MachineServiceImpl implements IMachineService
/**
* 批量删除机具设备管理
*
*
* @param maIds 需要删除的机具设备管理主键
* @return 结果
*/
@ -144,7 +144,7 @@ public class MachineServiceImpl implements IMachineService
/**
* 删除机具设备管理信息
*
*
* @param maId 机具设备管理主键
* @return 结果
*/
@ -309,4 +309,58 @@ public class MachineServiceImpl implements IMachineService
return machineMapper.editAssetsCode(machine);
}
@Override
public AjaxResult getHisByQrcode(Machine machine) {
//1根据二维码查询基础信息
Machine baseInfo = machineMapper.getInfoByQrcode(machine);
machine.setMaId(baseInfo.getMaId());
//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());
}
return success(baseInfo);
}
}

View File

@ -530,4 +530,71 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
mm.qr_code = #{qrCode}
</select>
<select id="getInfoByQrcode" resultMap="MachineResult">
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.qr_code as qrCode,
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
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 mm.qr_code = #{qrCode}
</select>
<select id="getInTimeByQrcode" resultMap="MachineResult">
SELECT
bqi.qr_code as qrCode,
bqi.task_id as taskId,
LEFT(bqi.create_time,10) as inTime
FROM
bm_qrcode_info bqi
WHERE bqi.qr_code = #{qrCode}
</select>
<select id="getServiceNumByQrcode" resultMap="MachineResult">
SELECT
COUNT(DISTINCT sai.agreement_id) as serviceNum
FROM slt_agreement_info sai
WHERE sai.ma_id = #{maId}
</select>
<select id="getCheckNumByQrcode" resultMap="MachineResult">
SELECT
COUNT(rp.ma_id ) as checkNum
FROM
repair_part_details rp
WHERE rp.ma_id = #{maId} and rp.is_ds = 0
</select>
<select id="getScrapTimeByQrcode" resultMap="MachineResult">
SELECT
sd.ma_id,
sd.task_id,
sd.ledger_time
FROM
scrap_apply_details sd
WHERE sd.ma_id = #{maId}
</select>
<select id="getLeaseInfoByQrcode" resultMap="MachineResult">
</select>
</mapper>