|  | @@ -236,11 +236,10 @@
 | 
	
		
			
				|  |  |              <if test="fBankcorpid != null ">and bill.f_bankcorpid = #{fBankcorpid}</if>
 | 
	
		
			
				|  |  |              <if test="fBilltype != null  and fBilltype != ''">and bill.f_billtype = #{fBilltype}</if>
 | 
	
		
			
				|  |  |              <if test="fBillstatus != null  and fBillstatus != ''">and bill.f_billstatus = #{fBillstatus}</if>
 | 
	
		
			
				|  |  | -            <if test="fBillstatus == null ">and bill.f_billstatus != 6 </if>
 | 
	
		
			
				|  |  |              <if test="fItemsStatus != null  and fItemsStatus != ''">and bill.f_items_status = #{fItemsStatus}</if>
 | 
	
		
			
				|  |  |              <if test="createBy != null and createBy != ''">and bill.create_by = #{createBy}</if>
 | 
	
		
			
				|  |  |          </where>
 | 
	
		
			
				|  |  | -            ORDER BY bill.f_bsdate  DESC
 | 
	
		
			
				|  |  | +            ORDER BY  bill.f_billstatus , bill.f_bsdate  DESC
 | 
	
		
			
				|  |  |          ${params.dataScope}
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -287,7 +286,7 @@
 | 
	
		
			
				|  |  |              w.f_id = #{fId}
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    <select id="selectInventoryList" parameterType="TWarehousebills"  resultType="java.util.Map">
 | 
	
		
			
				|  |  | +    <select id="selectInventorySJRKList" parameterType="TWarehousebills"  resultType="java.util.Map">
 | 
	
		
			
				|  |  |          SELECT
 | 
	
		
			
				|  |  |              co.f_name AS fName,
 | 
	
		
			
				|  |  |              it.f_bsdate AS fBsdate,
 | 
	
	
		
			
				|  | @@ -300,7 +299,16 @@
 | 
	
		
			
				|  |  |              dicttr.dict_label AS fTrademodeid,
 | 
	
		
			
				|  |  |              it.f_qty AS fQty,
 | 
	
		
			
				|  |  |              it.f_grossweight AS fGrossweight,
 | 
	
		
			
				|  |  | -            it.f_netweight AS fNetweight
 | 
	
		
			
				|  |  | +            it.f_netweight AS fNetweight,
 | 
	
		
			
				|  |  | +            CASE
 | 
	
		
			
				|  |  | +            it.f_billtype
 | 
	
		
			
				|  |  | +            WHEN 'SJRK' THEN
 | 
	
		
			
				|  |  | +            '入库'
 | 
	
		
			
				|  |  | +            WHEN 'SJCK' THEN
 | 
	
		
			
				|  |  | +            '出库'
 | 
	
		
			
				|  |  | +            WHEN 'CKDB' THEN
 | 
	
		
			
				|  |  | +            '调拨'
 | 
	
		
			
				|  |  | +            END AS fBilltype
 | 
	
		
			
				|  |  |          FROM
 | 
	
		
			
				|  |  |              t_warehousebills leg
 | 
	
		
			
				|  |  |                  LEFT JOIN t_warehousebillsitems it ON leg.f_id = it.f_pid
 | 
	
	
		
			
				|  | @@ -314,8 +322,70 @@
 | 
	
		
			
				|  |  |              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>
 | 
	
		
			
				|  |  | +            AND leg.f_billtype in ('SJRK','CKDB')
 | 
	
		
			
				|  |  | +            <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="selectInventorySJCKList" parameterType="TWarehousebills"  resultType="java.util.Map">
 | 
	
		
			
				|  |  | +        SELECT
 | 
	
		
			
				|  |  | +        co.f_name AS fName,
 | 
	
		
			
				|  |  | +        it.f_bsdate AS fBsdate,
 | 
	
		
			
				|  |  | +        leg.f_mblno AS fMblno,
 | 
	
		
			
				|  |  | +        it.f_business_type AS fBusinessType,
 | 
	
		
			
				|  |  | +        dict.dict_label AS fBusinessTypes,
 | 
	
		
			
				|  |  | +        it.f_marks AS fMarks ,
 | 
	
		
			
				|  |  | +        goo.f_name AS fGoodsName,
 | 
	
		
			
				|  |  | +        dicttr.dict_label AS fTrademodeid,
 | 
	
		
			
				|  |  | +        it.f_qty AS fQty,
 | 
	
		
			
				|  |  | +        it.f_grossweight AS fGrossweight,
 | 
	
		
			
				|  |  | +        it.f_netweight AS fNetweight,
 | 
	
		
			
				|  |  | +        CASE
 | 
	
		
			
				|  |  | +        it.f_billtype
 | 
	
		
			
				|  |  | +        WHEN 'SJRK' THEN
 | 
	
		
			
				|  |  | +        '入库'
 | 
	
		
			
				|  |  | +        WHEN 'SJCK' THEN
 | 
	
		
			
				|  |  | +        '出库'
 | 
	
		
			
				|  |  | +        WHEN 'CKDB' THEN
 | 
	
		
			
				|  |  | +        '调拨'
 | 
	
		
			
				|  |  | +        END AS fBilltype ,
 | 
	
		
			
				|  |  | +        CASE
 | 
	
		
			
				|  |  | +        it.f_billtype
 | 
	
		
			
				|  |  | +        WHEN 'SJRK' THEN
 | 
	
		
			
				|  |  | +        it.f_warehouse_information
 | 
	
		
			
				|  |  | +        WHEN 'SJCK' THEN
 | 
	
		
			
				|  |  | +        it.f_warehouse_information
 | 
	
		
			
				|  |  | +        WHEN 'CKDB' THEN
 | 
	
		
			
				|  |  | +        it.f_orgwarehouse_information
 | 
	
		
			
				|  |  | +        END AS fWarehouseLocationids
 | 
	
		
			
				|  |  | +        FROM
 | 
	
		
			
				|  |  | +        t_warehousebills leg
 | 
	
		
			
				|  |  | +        LEFT JOIN t_warehousebillsitems it ON leg.f_id = it.f_pid
 | 
	
		
			
				|  |  | +        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 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 ('SJCK','CKDB')
 | 
	
		
			
				|  |  |              <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>
 |