USE [deiniuWMS] GO /****** Object: Trigger [dbo].[logOutRequestt_update] Script Date: 2018/4/13 10:18:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Batch submitted through debugger: SQLQuery46.sql|7|0|C:\Users\wm\AppData\Local\Temp\~vsDC32.sql CREATE trigger [dbo].[logOutRequestt_update] on [dbo].[t_wmsOutRequest] for update as begin if((select count(*) from inserted a inner join deleted b on a.id = b.id and (a.state != b.state ))>0) begin insert into t_wmsOutLog( [pickOrderNo],[orderNo] ,[orderState] ,[operater]) select inserted.[pickOrderNo] ,inserted.[orderNo],inserted.[state] ,inserted.[operater] from inserted end; end; GO USE [deiniuWMS] GO /****** Object: Trigger [dbo].[logtOutRequest_add] Script Date: 2018/4/13 10:19:07 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE trigger [dbo].[logtOutRequest_add] on [dbo].[t_wmsOutRequest] for insert as insert into t_wmsOutLog( [pickOrderNo],[orderNo] ,[orderState] ,[operater]) select inserted.[pickOrderNo], inserted.[orderNo],inserted.[state] ,inserted.[operater] from inserted GO USE [deiniuWMS] GO /****** Object: Trigger [dbo].[logOutPickRequest_add] Script Date: 2018/4/13 10:19:29 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE trigger [dbo].[logOutPickRequest_add] on [dbo].[t_wmsOutPickRequest] for insert as insert into t_wmsOutLog( [pickOrderNo] ,[orderState] ,[bulkPickState] ,[batchPickState] ,[operater]) select inserted.[pickOrderNo],inserted.[state] ,inserted.[bulkPickState] ,inserted.[batchPickState] ,inserted.[operater] from inserted GO USE [deiniuWMS] GO /****** Object: Trigger [dbo].[logOutPickRequest_update] Script Date: 2018/4/13 10:19:41 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE trigger [dbo].[logOutPickRequest_update] on [dbo].[t_wmsOutPickRequest] for update as begin if((select count(*) from inserted a inner join deleted b on a.id = b.id and (a.state != b.state or a.bulkPickState != b.bulkPickState or a.batchPickState != b.batchPickState))>0) begin insert into t_wmsOutLog( [pickOrderNo] ,[orderState],[bulkPickState] ,[batchPickState] ,[operater]) select inserted.[pickOrderNo],inserted.[state] ,inserted.[bulkPickState] ,inserted.[batchPickState] ,inserted.[operater] from inserted end; end; GO USE [deiniuWMS] GO USE [deiniuWMS] GO /****** Object: Sequence [dbo].[seqOrderNo] Script Date: 2018/4/13 10:20:46 ******/ CREATE SEQUENCE [dbo].[seqOrderNo] AS [bigint] START WITH 0 INCREMENT BY 1 MINVALUE -9223372036854775808 MAXVALUE 9223372036854775807 CACHE GO USE [deiniuWMS] GO ALTER TABLE [dbo].[t_wmsStockMaintain] WITH CHECK ADD CONSTRAINT [FK_t_wmsStockMaintain_t_wmsLocation] FOREIGN KEY([locationId]) REFERENCES [dbo].[t_wmsLocation] ([locationId]) GO ALTER TABLE [dbo].[t_wmsStockMaintain] CHECK CONSTRAINT [FK_t_wmsStockMaintain_t_wmsLocation] GO USE [deiniuWMS] GO ALTER TABLE [dbo].[t_wmsStock] WITH CHECK ADD CONSTRAINT [FK_t_wmsStock_t_wmsLocation] FOREIGN KEY([locationId]) REFERENCES [dbo].[t_wmsLocation] ([locationId]) GO ALTER TABLE [dbo].[t_wmsStock] CHECK CONSTRAINT [FK_t_wmsStock_t_wmsLocation] GO