|  | @@ -962,35 +962,8 @@
 | 
	
		
			
				|  |  |              <if test="beginDate != null and beginDate != ''">and ts.f_bsdate >= #{beginDate}</if>
 | 
	
		
			
				|  |  |              <if test="endDate != null and endDate != ''">and ts.f_bsdate <= #{endDate}</if>
 | 
	
		
			
				|  |  |              <if test="external != null and external != ''">
 | 
	
		
			
				|  |  | -                and tb.f_warehouseid in (
 | 
	
		
			
				|  |  | -                select distinct f_warehouseid
 | 
	
		
			
				|  |  | -                from t_customer_contact t1 left join t_whgenleg t2 on t1.f_pid = t2.f_corpid
 | 
	
		
			
				|  |  | -                where f_tel = #{external})
 | 
	
		
			
				|  |  | +                and tb.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    <select id="inAndOutStockMonthList" resultType="map">
 | 
	
		
			
				|  |  | -        select
 | 
	
		
			
				|  |  | -            ts.f_mblno as fMblno,
 | 
	
		
			
				|  |  | -            tg.f_name as goodsName,
 | 
	
		
			
				|  |  | -            ts.f_bsdate as fBsdate,
 | 
	
		
			
				|  |  | -            round(ts.f_grossweight / 1000, 2) as fGrossweight,
 | 
	
		
			
				|  |  | -            case tb.f_billtype when 'SJRK' then '入库' when 'SJCK' then '出库' end as fBilltype,
 | 
	
		
			
				|  |  | -            ts.create_by as createBy
 | 
	
		
			
				|  |  | -        from t_warehousebillsitems ts
 | 
	
		
			
				|  |  | -        left join t_warehousebills tb on ts.f_mblno = tb.f_mblno and ts.f_billno = tb.f_billno
 | 
	
		
			
				|  |  | -        left join t_goods tg ON tg.f_id = ts.f_goodsid
 | 
	
		
			
				|  |  | -        where
 | 
	
		
			
				|  |  | -            ts.f_billstatus = '40'
 | 
	
		
			
				|  |  | -            and tb.f_billtype in ('SJRK', 'SJCK')
 | 
	
		
			
				|  |  | -            <if test="beginDate != null and beginDate != ''">and ts.f_bsdate >= #{beginDate}</if>
 | 
	
		
			
				|  |  | -            <if test="endDate != null and endDate != ''">and ts.f_bsdate <= #{endDate}</if>
 | 
	
		
			
				|  |  | -            <if test="external != null and external != ''">
 | 
	
		
			
				|  |  | -                and tb.f_warehouseid in (
 | 
	
		
			
				|  |  | -                select distinct f_warehouseid
 | 
	
		
			
				|  |  | -                from t_customer_contact t1 left join t_whgenleg t2 on t1.f_pid = t2.f_corpid
 | 
	
		
			
				|  |  | -                where f_tel = #{external})
 | 
	
		
			
				|  |  | -            </if>
 | 
	
		
			
				|  |  | -        order by ts.f_bsdate desc
 | 
	
		
			
				|  |  | -    </select>
 | 
	
		
			
				|  |  |  </mapper>
 |