IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_save_warehouse]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_save_warehouse]
GO
create procedure [dbo].[mps_save_warehouse](
@whid int,
@cmpid int,
@wh_code nvarchar(50),
@wh_caption nvarchar(50),
@wh_bcid int,
@wh_dpid int,
@wh_location nvarchar(50),
@wh_longitude decimal(18,9) ,
@wh_latitude decimal(18,9) ,
@wh_outstyle int,
@wh_feestyle int
)
as
begin

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
update mps_warehouse set 
wh_caption = case when @wh_caption IS null or @wh_caption='_none_' then wh_caption else @wh_caption end ,
wh_code = case when @wh_code IS null or @wh_code='_none_' then wh_code else @wh_code end ,
wh_location = case when @wh_location IS null or @wh_location='_none_' then wh_location else @wh_location end ,
wh_bcid = case when @wh_bcid IS null or @wh_bcid=-999999999 then wh_bcid else @wh_bcid end ,
wh_dpid = case when @wh_dpid IS null or @wh_dpid=-999999999 then wh_dpid else @wh_dpid end ,
wh_longitude = case when @wh_longitude IS null or @wh_longitude=-999999999 then wh_longitude else @wh_longitude end ,
wh_latitude = case when @wh_latitude IS null or @wh_latitude=-999999999 then wh_latitude else @wh_latitude end ,
wh_outstyle = case when @wh_outstyle IS null or @wh_outstyle=-999999999 then wh_outstyle else @wh_outstyle end ,
wh_feestyle = case when @wh_feestyle IS null or @wh_feestyle=-999999999 then wh_feestyle else @wh_feestyle end  
where wh_cmpid=@cmpid and wh_id=@whid 

exec mps_sys_calc_barnpower_all @cmpid  

end