sql 蒙特塞拉特 - Criação手册Inventário#tags:monteserrat

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 蒙特塞拉特 - Criação手册Inventário#tags:monteserrat相关的知识,希望对你有一定的参考价值。

--BEGIN TRAN

/*
InventoryAlert => http://54.94.177.227:8081/MRS.Services/CoreService/InventoryAlert
CreateScheduledTasks => http://54.94.177.227:8081/MRS.Services/TaskJobService/CreateScheduledTasks
*/

/* Declaration of variables */
declare @CycleCount as int, @SeqNo as int, @QtyCountZones as int
declare @StoreId as varchar(5)
declare @inventoryName as varchar(40)
declare @stockTakeDate as datetime
 
/* Setting the parameters */
set @CycleCount = ( select isnull(max(cast(CycleCount as int))+1, 1) from [stin].[st_in_inventory] )
set @SeqNo = ( select isnull(max(cast(seqno as int))+1, 1) from [stin].[st_in_inventory] )
set @StoreId = 'S0002'
set @QtyCountZones = 6
set @inventoryName = 'Inv 19/07/2017 - Refrescos em Pó'
set @stockTakeDate = '2017-07-19'
 
 
/* Creating inventory */
insert into [stin].[st_in_inventory]
values (@SeqNo, 'StaCtnCre', @CycleCount, @inventoryName, @stockTakeDate, 'A', getdate())
 
/* Creating the items */
insert into [stin].[st_in_inventoryItem]
select @SeqNo, @CycleCount, i.ItemId, 'A', getdate()
from ra.Item i
	inner join ra.HierarchicalStructure hs on hs.HierarchicalStructureId = substring(i.HierarchicalStructureId,0, 6)
	inner join ra.ItemRetailStore irs on irs.ItemId = i.ItemId and irs.RetailStoreId = @StoreId
where 
   i.HierarchicalStructureId like '1.021.040.070%'
OR i.HierarchicalStructureId like '1.021.040.018%'
 
/* Creating count zones */
declare @QtyCountZone as int
set @QtyCountZone = 1
 
WHILE (@QtyCountZone <= @QtyCountZones)
BEGIN
 
        insert into [stin].[st_in_inventoryStoreWhZone]
        -- Com a nomeclatura dos departamentos
        -- select @SeqNo, @CycleCount, @StoreId, null, substring(i.HierarchicalStructureId, 0, 6), 'Count Zone ' + substring(replace(hs.Name, '/', ''), 0, 25), 'N', 'N', 'A', getdate()
 
        -- Com a nomeclatura das zonas incremental
        select @SeqNo, @CycleCount, @StoreId, null, REPLACE(STR(@QtyCountZone, 3), SPACE(1), '0'), @inventoryName, 'N', 'N', 'A', getdate()
                from ra.Item i
                inner join ra.HierarchicalStructure hs on hs.HierarchicalStructureId = substring(i.HierarchicalStructureId,0, 6)
                inner join ra.ItemRetailStore irs on irs.ItemId = i.ItemId and irs.RetailStoreId = @StoreId
                where 
   i.HierarchicalStructureId like '1.021.040.070%'
OR i.HierarchicalStructureId like '1.021.040.018%'
				group by substring(i.HierarchicalStructureId,0, 6), hs.Name
 
        --values (@SeqNo, @CycleCount, @StoreId, null, REPLACE(STR(@QtyCountZone, 3), SPACE(1), '0'), 'Count Zone ' + cast(@QtyCountZone as varchar), 'N', 'N', 'A', getdate())
 
        set @QtyCountZone = @QtyCountZone + 1
END
 
/*
List data inventory created
select * from [stin].[st_in_inventory] where CycleCount in (@CycleCount)
select * from [stin].[st_in_inventoryItem] where CycleCount  in (@CycleCount)
select * from [stin].[st_in_inventoryStoreWhZone] where CycleCount  in (@CycleCount)
select top 100 * from [tm].[Task] with(nolock) order by 1 desc
--ROLLBACK
--COMMIT
*/

以上是关于sql 蒙特塞拉特 - Criação手册Inventário#tags:monteserrat的主要内容,如果未能解决你的问题,请参考以下文章

css 老蒙特塞拉特字体家庭文件

scss GoogleFonts - 蒙特塞拉特

Andersen Global新增蒙特塞拉特合作公司

sql Criaçãoauditoriaagendada MonteSerrat

sql Criaçãoauditorias MonteSerrat V2

sql Criação手册议程清单#tags:清单