update transfer_order set ORDER_STATUS= #{orderStatus},MODIFIED_TIME=sysdate,PK_MODIFIED=#{pkMember} where pk_id in(
select pk_transfer from(
select pk_transfer, sum(case when NNUM>total_trans_in_num then 1 else 0 end) as NACCUMSTORENUM from transfer_order_items
where del_flag=0 and pk_id in
(select pk_transfer_items from ic_transout_b where del_flag=0 and pk_id in
#{item.pkTransferOutB}
)
group by pk_transfer
)
where NACCUMSTORENUM =0)
select tr.*,ti.pk_id pk_items,ti.pk_product_bas,ti.pk_storehouse,ti.plan_date,ti.pk_unit,
ti.nnum,ti.norigprice,ti.ntaxrate,ti.norigtaxprice,ti.norigmny,ti.ntax,ti.norigtaxmny,
ti.pk_creator item_pk_creator from transfer_order tr
inner join transfer_order_items ti
on tr.pk_id=ti.pk_transfer
where tr.del_flag=0 and ti.del_flag=0
and tr.pk_id=#{pkTransfer}
and tr.order_status = #{orderStatus}
select tr.*,sd.dept_name,su.nick_name manager_name,sc.corp_name,
ti.pk_id pk_items,ti.pk_unit,ti.pk_product_bas,ti.pk_storehouse,ti.nnum,
ti.norigprice,ti.ntaxrate,ti.norigtaxprice,ti.norigmny,ti.ntax,ti.norigtaxmny,
bn.name unit_name,bh.name storehouse_name,ti.plan_date,
bp.product_code,bp.product_name,sp.specs_name,ti.pk_cubasdoc,bc.cust_name cubasdoc_name,
bct.name country_in_name,bcp.corp_name corp_in_name,bcs.name in_storehouse_name from transfer_order tr
inner join transfer_order_items ti
on tr.pk_id=ti.pk_transfer
left join sys_dept sd
on tr.pk_dept=sd.dept_id
left join sys_user su
on tr.pk_whsmanager=su.user_id
left join sys_corp sc
on tr.pk_corp=sc.pk_id
left join bd_unit bn
on ti.pk_unit = bn.pk_id
left join bd_storehouse bh
on ti.pk_storehouse=bh.pk_id
left join bd_product_bas bp
on ti.pk_product_bas=bp.pk_id
left join bd_cubasdoc bc
on bc.pk_id=ti.pk_cubasdoc and bc.del_flag=0
left join bd_country bct
on bct.pk_id=tr.pk_in_country
left join sys_corp bcp
on bcp.pk_id=tr.pk_in_corp
left join bd_storehouse bcs
on bcs.pk_id =ti.pk_in_storehouse
left join (
select pk_order,pk_order_items,wm_concat(specs_name) specs_name from scm_item_specs
where del_flag=0 and order_type=7
group by pk_order,pk_order_items) sp
on ti.pk_id=sp.pk_order_items
where tr.del_flag=0 and ti.del_flag=0
and tr.pk_country=#{pkCountry}
and tr.pk_id=#{pkId}
and tr.order_code = #{orderCode}
and tr.order_status = #{orderStatus}
and tr.pk_corp = #{pkCorp}
and tr.order_date >= #{startDate, jdbcType=DATE}
and tr.order_date < #{endDate, jdbcType=DATE}
and bp.product_name=#{productName}
order by tr.order_date desc
select tr.*,ti.pk_id pk_items,ti.pk_product_bas,ti.pk_storehouse,ti.plan_date,ti.pk_unit,
ti.nnum,ti.norigprice,ti.ntaxrate,ti.norigtaxprice,ti.norigmny,ti.ntax,ti.norigtaxmny,
ti.pk_creator item_pk_creator from transfer_order tr
inner join transfer_order_items ti
on tr.pk_id=ti.pk_transfer
where tr.del_flag=0 and ti.del_flag=0
and tr.pk_id=#{item.pkTransfer} and ti.pk_id=#{item.pkTransferItems}
and ti.pk_product_bas=#{item.pkProductBas}
and tr.order_status =3
select tr.*,bn.name unit_name,
sd.dept_name,su.nick_name manager_name,sc.corp_name,
ti.pk_id pk_items,ti.pk_transfer,ti.pk_product_bas,ti.pk_storehouse,bh.name storehouse_name,ti.plan_date,ti.pk_unit,
ti.nnum,ti.norigprice,ti.ntaxrate,ti.norigtaxprice,ti.norigmny,ti.ntax,ti.norigtaxmny,ti.pk_in_storehouse,
bd.pk_id pk_product,bd.product_code,bd.product_name,sp.specs_name,
bct.name country_in_name,bcp.corp_name corp_in_name,bcs.name in_storehouse_name from transfer_order tr
inner join transfer_order_items ti
on tr.pk_id=ti.pk_transfer
inner join bd_product_bas bp
on ti.pk_product_bas=bp.pk_id
inner join bd_product bd
on ti.pk_product_bas=bd.pk_product_bas and bd.pk_country=ti.pk_country and bd.del_flag=0
left join sys_dept sd
on tr.pk_dept=sd.dept_id
left join sys_user su
on tr.pk_whsmanager=su.user_id
left join bd_storehouse bh
on ti.pk_storehouse=bh.pk_id
left join bd_country bct
on bct.pk_id=tr.pk_in_country
left join sys_corp sc
on tr.pk_corp=sc.pk_id
left join bd_unit bn
on ti.pk_unit = bn.pk_id
left join sys_corp bcp
on bcp.pk_id=tr.pk_in_corp
left join bd_storehouse bcs
on bcs.pk_id =ti.pk_in_storehouse
left join (select pk_order_items,wm_concat(specs_name) specs_name from scm_item_specs where del_flag=0
and order_type=7
group by pk_order_items) sp
on sp.pk_order_items=ti.pk_id
where ti.del_flag=0 and tr.del_flag=0 and bp.del_flag=0
and tr.pk_country=#{pkCountry}
and 0 < ti.nnum-ti.total_trans_out_num
and tr.pk_corp = #{pkCorp}
and tr.order_date >= #{startDate, jdbcType=DATE}
and tr.order_date < #{endDate, jdbcType=DATE}
and tr.order_code = #{orderCode}
and tr.order_status =3