编码查询、二维码查询领料单位查询优化

This commit is contained in:
hayu 2026-02-09 17:25:19 +08:00
parent 2687a26327
commit 074d9d7a81
4 changed files with 36 additions and 11 deletions

View File

@ -310,4 +310,11 @@ public interface MachineMapper
* @return
*/
LeaseApplyInfo getBackUnitAndProjectBySlt(LeaseApplyInfo leaseInfoBack);
/**
* 根据maId查询最新的领料数据
* @param machine
* @return
*/
LeaseApplyInfo getLeaseDataByMaId(Machine machine);
}

View File

@ -555,17 +555,21 @@ public class MachineServiceImpl implements IMachineService
Machine scrapTime = machineMapper.getScrapTimeByQrcode(machine);
baseInfo.setScrapTime(scrapTime != null ? scrapTime.getScrapTime() : "暂无");
// 查询领料任务
LeaseApplyInfo leaseInfo = machineMapper.getLeaseParentId(machine);
if (leaseInfo == null || leaseInfo.getParentId() == null) {
baseInfo.setLeaseTime(null);
baseInfo.setLeaseUnit(null);
baseInfo.setLeaseProject(null);
} else {
LeaseApplyInfo leaseDetail = machineMapper.getLeaseUnitAndProject(leaseInfo);
baseInfo.setLeaseTime(String.valueOf(leaseInfo.getLeaseTime()));
baseInfo.setLeaseUnit(leaseDetail.getUnitName());
baseInfo.setLeaseProject(leaseDetail.getProjectName());
}
LeaseApplyInfo leaseInfo = machineMapper.getLeaseDataByMaId(machine);
baseInfo.setLeaseTime(leaseInfo.getLeaseTime());
baseInfo.setLeaseUnit(leaseInfo.getUnitName());
baseInfo.setLeaseProject(leaseInfo.getProjectName());
// LeaseApplyInfo leaseInfo = machineMapper.getLeaseParentId(machine);
// if (leaseInfo == null || leaseInfo.getParentId() == null) {
// baseInfo.setLeaseTime(null);
// baseInfo.setLeaseUnit(null);
// baseInfo.setLeaseProject(null);
// } else {
// LeaseApplyInfo leaseDetail = machineMapper.getLeaseUnitAndProject(leaseInfo);
// baseInfo.setLeaseTime(String.valueOf(leaseInfo.getLeaseTime()));
// baseInfo.setLeaseUnit(leaseDetail.getUnitName());
// baseInfo.setLeaseProject(leaseDetail.getProjectName());
// }
// 查询退料任务
LeaseApplyInfo leaseInfoBack = machineMapper.getBackParentId(machine);
if (leaseInfoBack == null || leaseInfoBack.getParentId() == null) {

View File

@ -478,6 +478,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND bu.del_flag = '0'
WHERE
sai.`status`= 0 and mm.qr_code = #{qrCode} and sai.is_slt = '0'
and sai.source='1'
and mtr.user_id = #{userId}
<if test="unitId != null">
AND ba.unit_id = #{unitId}
@ -2199,6 +2200,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_unit bu on bu.unit_id = ba.unit_id
AND bu.del_flag = '0'
WHERE sai.`status`=0
and sai.source='1'
and mm.ma_id = #{maId}
limit 1
</select>

View File

@ -1363,6 +1363,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY sai.end_time DESC
LIMIT 1
</select>
<select id="getLeaseDataByMaId" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
SELECT bu.unit_name AS unitName,
bp.pro_name AS projectName,
DATE_FORMAT(sai.start_time, '%Y-%m-%d') AS leaseTime
FROM slt_agreement_info sai
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = sai.agreement_id
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id
WHERE sai.source = '1'
AND sai.ma_id = #{maId}
ORDER BY sai.start_time DESC LIMIT 1
</select>
<insert id="insertMaStatusLog">
insert into update_ma_status_log