综合查询--工程在用查询

This commit is contained in:
bns_han 2024-02-18 17:31:32 +08:00
parent ac5f82ea3f
commit 82a3371114
6 changed files with 132 additions and 7 deletions

View File

@ -1,8 +1,6 @@
package com.bonus.sgzb.app.controller;
import com.bonus.sgzb.app.domain.BackApplyInfo;
import com.bonus.sgzb.app.domain.LeaseApplyDetails;
import com.bonus.sgzb.app.domain.TmTask;
import com.bonus.sgzb.app.service.LeaseOutDetailsService;
import com.bonus.sgzb.base.api.domain.LeaseOutDetails;
import com.bonus.sgzb.common.core.web.controller.BaseController;
@ -95,4 +93,19 @@ public class LeaseOutDetailsController extends BaseController {
}
}
/**
* 综合查询--工程在用查询
* @param bean
*/
@Log(title = "综合查询--工程在用查询", businessType = BusinessType.UPDATE)
@PostMapping("/proUseRecord")
public AjaxResult proUseRecord(@RequestBody LeaseApplyDetails bean){
try {
List<LeaseApplyDetails> list = leaseOutDetailsService.proUseRecord(bean);
return success(list);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

View File

@ -1,6 +1,5 @@
package com.bonus.sgzb.app.domain;
import com.bonus.sgzb.base.domain.MaintenanceGang;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -118,7 +117,7 @@ public class LeaseApplyDetails implements Serializable {
/**
* 计量单位
*/
@ApiModelProperty(value = "计量单位")
@ApiModelProperty(value = "单位")
private String unitName;
/**

View File

@ -60,4 +60,11 @@ public interface LeaseOutDetailsMapper {
* @return List<LeaseApplyDetails>
*/
List<LeaseApplyDetails> leaseOutRecord(LeaseApplyDetails bean);
/**
* 综合查询--工程在用查询
* @param bean
* @return List<LeaseApplyDetails>
*/
List<LeaseApplyDetails> proUseRecord(LeaseApplyDetails bean);
}

View File

@ -17,20 +17,50 @@ import java.util.List;
*/
public interface LeaseOutDetailsService {
/**
* 获取领料出库详情表
* @param parentId
* @return 领料出库详情表
*/
List<LeaseOutDetails> selectListByParentId(String parentId);
/**
* 领料出库对库存处理
* @param record 出库内容
* @return 结果
*/
AjaxResult submitOut(LeaseOutDetails record);
/**
* 根据code编码查询设备信息
* @param maCode 机具编码
* @return 设备信息
*/
List<MaMachine> getMaMachineByCode(String maCode);
/**
* 根据QrCode编码查询设备信息
* @param qrCode 二维码编码
* @return 设备信息
*/
List<MaMachine> getMaMachineByQrCode(String qrCode);
/**
* 根据RFID编码查询设备信息
* @param rfidCode RFID编码
* @return 设备信息
*/
List<MaMachine> getMaMachineByRfidCode(String rfidCode);
/**
* 综合查询--领用记录查询
* @param bean
* @return List<TmTask>
* @return List<LeaseApplyDetails>
*/
List<LeaseApplyDetails> leaseOutRecord(LeaseApplyDetails bean);
/**
* 综合查询--工程在用查询
* @param bean
* @return List<LeaseApplyDetails>
*/
List<LeaseApplyDetails> proUseRecord(LeaseApplyDetails bean);
}

View File

@ -129,6 +129,11 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
return leaseOutDetailsMapper.leaseOutRecord(bean);
}
@Override
public List<LeaseApplyDetails> proUseRecord(LeaseApplyDetails bean) {
return leaseOutDetailsMapper.proUseRecord(bean);
}
@Override
public List<MaMachine> getMaMachineByRfidCode(String rfidCode) {
return maMachineMapper.getMaMachineByRfidCode(rfidCode);

View File

@ -59,6 +59,77 @@
ORDER BY lod.create_time DESC
</select>
<select id="proUseRecord" resultType="com.bonus.sgzb.app.domain.LeaseApplyDetails">
SELECT
t1.unitName,
t1.lotName as proName,
t1.typeName,
t1.typeCode as typeModelName,
t1.outNum as alNum,
IFNULL(t1.outNum,0) - IFNULL(t2.backNum,0) as num
FROM
(SELECT
bui.unit_name as unitName,
bpl.lot_name as lotName,
mt2.type_name as typeName,
mt.type_name as typeCode,
SUM(lod.out_num) as outNum,
bai.unit_id,
bai.project_id,
lod.type_id
FROM
lease_out_details lod
LEFT JOIN lease_apply_info lai on lai.id=lod.parent_id
LEFT JOIN tm_task_agreement tta on tta.task_id=lai.task_id
LEFT JOIN bm_agreement_info bai on bai.agreement_id=tta.agreement_id
LEFT JOIN bm_project_lot bpl on bpl.lot_id=bai.project_id
LEFT JOIN bm_unit_info bui on bui.unit_id=bai.unit_id
LEFT JOIN ma_type mt on mt.type_id=lod.type_id
LEFT JOIN ma_type mt2 on mt2.type_id=mt.parent_id
where 1=1
<if test="keyWord != null and keyWord != ''">
and (bui.unit_name like concat('%', #{keyWord}, '%') or
bpl.lot_name like concat('%', #{keyWord}, '%') or
mt2.type_name like concat('%', #{keyWord}, '%') or
mt.type_name like concat('%', #{keyWord}, '%')
)
</if>
GROUP BY bai.unit_id,bai.project_id,lod.type_id) t1
LEFT JOIN
(SELECT
bui.unit_name as unitName,
bpl.lot_name as lotName,
mt2.type_name as typeName,
mt.type_name as typeCode,
SUM(bcd.back_num) as backNum,
bai.unit_id,
bai.project_id,
bcd.type_id
FROM
back_check_details bcd
LEFT JOIN back_apply_info bapi on bapi.id=bcd.parent_id
LEFT JOIN tm_task_agreement tta on tta.task_id=bapi.task_id
LEFT JOIN bm_agreement_info bai on bai.agreement_id=tta.agreement_id
LEFT JOIN bm_project_lot bpl on bpl.lot_id=bai.project_id
LEFT JOIN bm_unit_info bui on bui.unit_id=bai.unit_id
LEFT JOIN ma_type mt on mt.type_id=bcd.type_id
LEFT JOIN ma_type mt2 on mt2.type_id=mt.parent_id
where 1=1
<if test="keyWord != null and keyWord != ''">
and (bui.unit_name like concat('%', #{keyWord}, '%') or
bpl.lot_name like concat('%', #{keyWord}, '%') or
mt2.type_name like concat('%', #{keyWord}, '%') or
mt.type_name like concat('%', #{keyWord}, '%')
)
</if>
GROUP BY bai.unit_id,bai.project_id,bcd.type_id) t2
ON
t1.unit_id = t2.unit_id
AND t1.project_id = t2.project_id
AND t1.type_id = t2.type_id
</select>
<update id="updateLeaseApplyDetailsOutNum">
UPDATE
lease_apply_details