Merge remote-tracking branch 'origin/master'

This commit is contained in:
mashuai 2025-09-01 13:32:04 +08:00
commit 7a2a10372f
3 changed files with 63 additions and 31 deletions

View File

@ -249,4 +249,6 @@ public class Type extends BaseEntity {
@ApiModelProperty("机具类型1机具2安全工器具") @ApiModelProperty("机具类型1机具2安全工器具")
private int jiJuType; private int jiJuType;
@ApiModelProperty(value = "待出库数量")
private BigDecimal pendingOutNum;
} }

View File

@ -13,6 +13,8 @@ import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.StringUtils; import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils; import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.lease.domain.LeaseApplyDetails;
import com.bonus.material.lease.mapper.LeaseTaskMapper;
import com.bonus.material.ma.domain.MaTypeHistory; import com.bonus.material.ma.domain.MaTypeHistory;
import com.bonus.material.ma.domain.TypeKeeper; import com.bonus.material.ma.domain.TypeKeeper;
import com.bonus.material.ma.domain.TypeRepair; import com.bonus.material.ma.domain.TypeRepair;
@ -49,6 +51,9 @@ public class TypeServiceImpl implements ITypeService {
@Resource @Resource
private TypeMapper typeMapper; private TypeMapper typeMapper;
@Resource
private LeaseTaskMapper leaseTaskMapper;
@Resource @Resource
private ITypeKeeperService typeKeeperService; private ITypeKeeperService typeKeeperService;

View File

@ -1165,39 +1165,64 @@
</select> </select>
<select id="selectPendingOutNum" resultType="com.bonus.material.lease.domain.LeaseApplyDetails"> <select id="selectPendingOutNum" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
SELECT SELECT
a.typeId, #{typeId} as typeId,
SUM(a.preNum) as preNum, COALESCE(SUM(combined.pendingOutNum), 0) as pendingOutNum,
SUM(a.alNum) as alNum, COALESCE(mt.storage_num, 0) as storageNum,
SUM(a.preNum)-SUM(a.alNum) as pendingOutNum, CASE mt.manage_type
ifnull(mt.storage_num,0) as storageNum WHEN 0 THEN
FROM IFNULL(subquery0.num, 0)
( ELSE
SELECT IFNULL(mt.storage_num, 0)
type_id as typeId, END as storage_num
SUM(pre_num) as preNum, FROM (
SUM(al_num) as alNum SELECT
FROM lad.type_id as typeId,
lease_apply_details SUM(pre_num) - SUM(al_num) as pendingOutNum
WHERE FROM
type_id =#{typeId} lease_apply_info lai
and new_type is null LEFT JOIN lease_apply_details lad ON lad.parent_id = lai.id
GROUP BY type_id LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
WHERE
tt.task_status = '3'
AND tt.task_type = '2'
AND lad.type_id = #{typeId}
GROUP BY lad.type_id
UNION UNION ALL
SELECT SELECT
new_type as typeId, lpd.new_type as typeId,
SUM(pre_num) as preNum, SUM(lpd.num) - IFNULL(lod.alNum, 0) as pendingOutNum
SUM(al_num) as alNum FROM
FROM lease_publish_details lpd
lease_apply_details LEFT JOIN (
WHERE SELECT
new_type = #{typeId} lod.type_id as typeId,
and new_type is not null SUM(lod.out_num) as alNum
GROUP BY new_type FROM
) a lease_out_details lod
LEFT JOIN ma_type mt on mt.type_id=a.typeId WHERE
GROUP BY typeId publish_task is not null
AND lod.type_id = #{typeId}
GROUP BY lod.type_id
) lod ON lpd.new_type = lod.typeId
WHERE
lpd.new_type = #{typeId}
GROUP BY lpd.new_type
) combined
RIGHT JOIN (SELECT #{typeId} as type_id) param ON combined.typeId = param.type_id
LEFT JOIN ma_type mt ON mt.type_id = param.type_id
left join (SELECT mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
count(mm.ma_id) num
FROM ma_machine mm
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE mm.ma_code is not null and mm.ma_status in (1)
and mm.type_id=#{typeId}
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = param.type_id
GROUP BY param.type_id
</select> </select>
<select id="selectLeaseApplyDetailsCountByParentId" resultType="java.lang.Integer"> <select id="selectLeaseApplyDetailsCountByParentId" resultType="java.lang.Integer">
SELECT SELECT