|
|
|
@ -97,4 +97,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
where mmb.ancestors like concat(#{ancestors}, '%') and mmcr.plan_id = #{planId} and mmcr.plan_detail_id = #{planDetailId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectMaterialInstallationCircumstance" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
|
|
|
|
select mmcr.material_check_result_id materialCheckResultId,
|
|
|
|
|
mmcr.plan_id planId,
|
|
|
|
|
mmcr.plan_detail_id planDetailId,
|
|
|
|
|
mmcr.material_id materialId,
|
|
|
|
|
mmcr.standard_amount standardAmount,
|
|
|
|
|
mmcr.check_amount checkAmount,
|
|
|
|
|
mbmi.material_code materialCode,
|
|
|
|
|
mbmi.material_name materialName
|
|
|
|
|
from mes_material_check_result mmcr
|
|
|
|
|
left join mes_product_plan mpp on mpp.plan_id = mmcr.plan_id
|
|
|
|
|
left join mes_product_plan_detail mppd on mppd.plan_detail_id = mmcr.plan_detail_id
|
|
|
|
|
left join mes_base_material_info mbmi on mbmi.material_id = mmcr.material_id
|
|
|
|
|
<where>
|
|
|
|
|
<if test="planId != null "> and mmcr.plan_id = #{planId}</if>
|
|
|
|
|
<if test="planDetailId != null "> and mmcr.plan_detail_id = #{planDetailId}</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectMaterialUnInstallationCircumstance" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
|
|
|
|
select sd.materialId, sd.materialCode, sd.materialName, needAmount
|
|
|
|
|
from (
|
|
|
|
|
select mbmi.material_id materialId,
|
|
|
|
|
mbmi.material_code materialCode,
|
|
|
|
|
mbmi.material_name materialName,
|
|
|
|
|
mmb.standard_amount standardAmount,
|
|
|
|
|
ifnull(mmcr.check_amount, 0) checkAmount,
|
|
|
|
|
mmb.standard_amount - ifnull(mmcr.check_amount, 0) needAmount
|
|
|
|
|
from mes_material_bom mmb
|
|
|
|
|
left join mes_base_material_info mbmi on mmb.material_id = mbmi.material_id
|
|
|
|
|
left join mes_material_check_result mmcr on plan_detail_id = #{planDetailId} and mbmi.material_id = mmcr.material_id
|
|
|
|
|
where mmb.ancestors like concat('%', concat(#{materialBomId}, '%'))
|
|
|
|
|
) sd
|
|
|
|
|
where sd.needAmount > 0
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
</mapper>
|
|
|
|
|