See scripts on https://advancedretail.freshdesk.com/a/tickets/142601 and https://docs.google.com/document/d/1cYmHSV89QY-2YAp9-vWtRdxJI_LcJAiNkfZSzmuCmbE/edit
SELECT * FROM vw_WarehouseLocationBox_Live WHERE location = 'GZ190101' SELECT * FROM vw_WarehouseLocationBox_Live WHERE location = 'GZ180102'
So if we needed to add GZ190103 GZ190104 GZ180103 -- check whats there currently to get the level_id SELECT level_id, * FROM vw_WarehouseLocationBox_Live WHERE location = 'GZ190101' SELECT level_id, * FROM vw_WarehouseLocationBox_Live WHERE location = 'GZ180102' --take the highest last number of the box needing adding as that will be the total number of boxes GZ190104 - 4 GZ180103 - 3 -- don't need to do anything with GZ190103 begin transaction EXEC [dbo].[traxs_Locations_AddAdditionalBoxes] @is_sky = 0, -- no this is a primary pic location, so not sky @bay_level_id = 1993, -- get from existing location next to new ones requested SELECT * FROM vw_WarehouseLocationBox_Live WHERE location = 'GZ190101' @max_boxes = 4, -- Total number of boxes required @pad = 2 -- always 2 EXEC [dbo].[traxs_Locations_AddAdditionalBoxes] @is_sky = 0, -- no this is a primary pic location, so not sky @bay_level_id = 1989, -- get from existing location next to new ones requested SELECT * FROM vw_WarehouseLocationBox_Live WHERE location = 'GZ190101' @max_boxes = 3, -- Total number of boxes required @pad = 2 -- always 2 commit transaction --rollback transaction
This assumes that you are adding the same location type or that the missing ones are after the sequence of the existing one. i.e. Box 1 exists and you need to add Box 2 and Box 3.