|  | @@ -289,34 +289,98 @@
 | 
	
		
			
				|  |  |              it.f_business_type AS fBusinessType,
 | 
	
		
			
				|  |  |              dict.dict_label AS fBusinessTypes,
 | 
	
		
			
				|  |  |              it.f_marks AS fMarks ,
 | 
	
		
			
				|  |  | -            go.f_name AS fGoodsName,
 | 
	
		
			
				|  |  | -            area.f_name AS fWarehouseLocationids,
 | 
	
		
			
				|  |  | -            leg.f_trademodeid AS fTrademodeid,
 | 
	
		
			
				|  |  | +            goo.f_name AS fGoodsName,
 | 
	
		
			
				|  |  | +            it.f_warehouse_information AS fWarehouseLocationids,
 | 
	
		
			
				|  |  | +            dicttr.dict_label AS fTrademodeid,
 | 
	
		
			
				|  |  |              it.f_qty AS fQty,
 | 
	
		
			
				|  |  |              it.f_grossweight AS fGrossweight,
 | 
	
		
			
				|  |  |              it.f_netweight AS fNetweight
 | 
	
		
			
				|  |  |          FROM
 | 
	
		
			
				|  |  |              t_warehousebills leg
 | 
	
		
			
				|  |  |                  LEFT JOIN t_warehousebillsitems it ON leg.f_id = it.f_pid
 | 
	
		
			
				|  |  | -                LEFT JOIN t_goods go ON it.f_goodsid = go.f_id
 | 
	
		
			
				|  |  | +                LEFT JOIN t_goods goo ON it.f_goodsid = goo.f_id
 | 
	
		
			
				|  |  |                  LEFT JOIN t_corps co ON leg.f_corpid = co.f_id
 | 
	
		
			
				|  |  |                  LEFT JOIN sys_dict_data dict ON dict.dict_value = it.f_business_type
 | 
	
		
			
				|  |  | -                LEFT JOIN t_warehouse_area area ON area.f_id = it.f_warehouselocid
 | 
	
		
			
				|  |  | +                LEFT JOIN t_warehouse ware ON ware.f_id = it.f_warehouselocid
 | 
	
		
			
				|  |  | +                LEFT JOIN sys_dict_data dicttr ON dicttr.dict_value = leg.f_trademodeid
 | 
	
		
			
				|  |  |          <where>
 | 
	
		
			
				|  |  |              dict.status = '0'
 | 
	
		
			
				|  |  |              AND dict.dict_type = 'storage_type'
 | 
	
		
			
				|  |  | +            AND dicttr.STATUS = '0'
 | 
	
		
			
				|  |  | +            AND dicttr.dict_type = 'data_trademodes'
 | 
	
		
			
				|  |  |              AND leg.f_billtype in ('SJRk','SJCK')
 | 
	
		
			
				|  |  |              <if test="fBilltype != null">AND leg.f_billtype = #{fBilltype}</if>
 | 
	
		
			
				|  |  | -            <if test="fWarehouseid != null ">and leg.f_warehouseid = #{fWarehouseid}</if>
 | 
	
		
			
				|  |  | -            <if test="fWarehouseid != null ">and it.f_warehouselocid = #{fWarehouseid}</if>
 | 
	
		
			
				|  |  |              <if test="fGoodsid != null ">and it.f_goodsid = #{fGoodsid}</if>
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |              <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
 | 
	
		
			
				|  |  |              <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
 | 
	
		
			
				|  |  |              <if test="fMblno != null ">and leg.f_mblno = #{fMblno}</if>
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +            <if test="fLocation != null  and fLocation ==1 ">
 | 
	
		
			
				|  |  | +                and it.f_warehouselocid = #{fWarehouseid}
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="fLocation != null  and fLocation ==0 ">
 | 
	
		
			
				|  |  | +                and ware.ancestors  LIKE  concat('%', #{fWarehouseid}, '%')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
 | 
	
		
			
				|  |  | +                and it.f_bsdate >= #{timeInterval[0]}
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
 | 
	
		
			
				|  |  | +                and it.f_bsdate <= #{timeInterval[1]}
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  |          </where>
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  | +    <select id="selectTWarehousebillsItemList"
 | 
	
		
			
				|  |  | +            resultType="com.ruoyi.reportManagement.domain.TWareHouseItemsExcel">
 | 
	
		
			
				|  |  | +        SELECT
 | 
	
		
			
				|  |  | +            ( @ii := @ii + 1 ) AS fId,
 | 
	
		
			
				|  |  | +            co.f_name AS fCorpid,
 | 
	
		
			
				|  |  | +            it.f_bsdate AS fBsdate,
 | 
	
		
			
				|  |  | +            leg.f_mblno AS fMblno,
 | 
	
		
			
				|  |  | +            dict.dict_label AS fBusinessType,
 | 
	
		
			
				|  |  | +            it.f_marks AS fMarks,
 | 
	
		
			
				|  |  | +            go.f_name AS fGoodsid,
 | 
	
		
			
				|  |  | +            it.f_warehouse_information AS fWarehouseInformation,
 | 
	
		
			
				|  |  | +            dicttr.dict_label AS fTrademodeid,
 | 
	
		
			
				|  |  | +            it.f_qty AS fQty,
 | 
	
		
			
				|  |  | +            it.f_grossweight AS fGrossweight,
 | 
	
		
			
				|  |  | +            it.f_netweight AS fNetweight
 | 
	
		
			
				|  |  | +        FROM
 | 
	
		
			
				|  |  | +            t_warehousebills leg
 | 
	
		
			
				|  |  | +                LEFT JOIN t_warehousebillsitems it ON leg.f_id = it.f_pid
 | 
	
		
			
				|  |  | +                LEFT JOIN t_goods go ON it.f_goodsid = go.f_id
 | 
	
		
			
				|  |  | +                LEFT JOIN t_corps co ON leg.f_corpid = co.f_id
 | 
	
		
			
				|  |  | +                LEFT JOIN sys_dict_data dict ON dict.dict_value = it.f_business_type
 | 
	
		
			
				|  |  | +                LEFT JOIN t_warehouse_area area ON area.f_id = it.f_warehouselocid
 | 
	
		
			
				|  |  | +                LEFT JOIN sys_dict_data dicttr ON dicttr.dict_value = leg.f_trademodeid,(
 | 
	
		
			
				|  |  | +                SELECT
 | 
	
		
			
				|  |  | +                @ii := 0
 | 
	
		
			
				|  |  | +                ) AS ii
 | 
	
		
			
				|  |  | +        WHERE
 | 
	
		
			
				|  |  | +              dict.STATUS = '0'
 | 
	
		
			
				|  |  | +              AND dict.dict_type = 'storage_type'
 | 
	
		
			
				|  |  | +              AND dicttr.STATUS = '0'
 | 
	
		
			
				|  |  | +              AND dicttr.dict_type = 'data_trademodes'
 | 
	
		
			
				|  |  | +              AND leg.f_billtype IN (
 | 
	
		
			
				|  |  | +                'SJRk',
 | 
	
		
			
				|  |  | +                'SJCK'
 | 
	
		
			
				|  |  | +                )
 | 
	
		
			
				|  |  | +        <if test="fBilltype != null">AND leg.f_billtype = #{fBilltype}</if>
 | 
	
		
			
				|  |  | +        <if test="fGoodsid != null ">and it.f_goodsid = #{fGoodsid}</if>
 | 
	
		
			
				|  |  | +        <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
 | 
	
		
			
				|  |  | +        <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
 | 
	
		
			
				|  |  | +        <if test="fMblno != null ">and leg.f_mblno = #{fMblno}</if>
 | 
	
		
			
				|  |  | +        <if test="fLocation != null  and fLocation ==1 ">
 | 
	
		
			
				|  |  | +            and it.f_warehouselocid = #{fWarehouseid}
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="fLocation != null  and fLocation ==0 ">
 | 
	
		
			
				|  |  | +            and ware.ancestors  LIKE  concat('%', #{fWarehouseid}, '%')
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
 | 
	
		
			
				|  |  | +            and it.f_bsdate >= #{timeInterval[0]}
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
 | 
	
		
			
				|  |  | +            and it.f_bsdate <= #{timeInterval[1]}
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <insert id="insertTWarehousebills" parameterType="TWarehousebills" useGeneratedKeys="true" keyProperty="fId">
 | 
	
		
			
				|  |  |          insert into t_warehousebills
 |