|
|
|
|
/****** Object: Table [dbo].[Import_KC] Script Date: 10/07/2013 14:40:40 ******/
|
|
|
|
|
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Import_KC]') AND type in (N'U'))
|
|
|
|
|
DROP TABLE [dbo].[Import_KC]
|
|
|
|
|
GO
|
|
|
|
|
/****** Object: Table [dbo].[Import_KC] Script Date: 10/07/2013 14:40:40 ******/
|
|
|
|
|
SET ANSI_NULLS ON
|
|
|
|
|
GO
|
|
|
|
|
|
|
|
|
|
SET QUOTED_IDENTIFIER ON
|
|
|
|
|
GO
|
|
|
|
|
|
|
|
|
|
SET ANSI_PADDING ON
|
|
|
|
|
GO
|
|
|
|
|
|
|
|
|
|
CREATE TABLE [dbo].[Import_KC](
|
|
|
|
|
[id] [int] IDENTITY(1,1) NOT NULL,
|
|
|
|
|
[ContractNo] [varchar](50) NOT NULL,
|
|
|
|
|
[cargo_id] [int] NOT NULL,
|
|
|
|
|
[CZState] [tinyint] NOT NULL default 0,
|
|
|
|
|
[InNum] [numeric](8, 2) NOT NULL default 0,
|
|
|
|
|
[OutNum] [numeric](8, 2) NOT NULL default 0,
|
|
|
|
|
[KFstate] [tinyint] NOT NULL default 0,
|
|
|
|
|
[CZdate] datetime null,
|
|
|
|
|
[text] [varchar](150) NULL
|
|
|
|
|
) ON [PRIMARY]
|
|
|
|
|
|
|
|
|
|
GO
|
|
|
|
|
|
|
|
|
|
SET ANSI_PADDING OFF
|
|
|
|
|
GO
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
delete from [Import_KC] where cargo_id=1
|
|
|
|
|
insert into [Import_KC]
|
|
|
|
|
select
|
|
|
|
|
[ContractNo],id [cargo_id],0 [CZState] ,
|
|
|
|
|
boxcount as [InNum],0 [OutNum],
|
|
|
|
|
0 kcstate,(getdate()) kcdate,
|
|
|
|
|
'' [text]
|
|
|
|
|
from import_cargo where id=1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>ʾ<EFBFBD>б<EFBFBD>
|
|
|
|
|
select k.id,k.contractno,k.cargo_id,c.name,K.czstate,
|
|
|
|
|
k.innum,k.outnum,k.kfstate,k.czdate,k.[text],
|
|
|
|
|
t1.enumvaluename as czref,t2.enumvaluename as kfref
|
|
|
|
|
from [Import_KC] K
|
|
|
|
|
left join import_cargo c on c.id=k.cargo_id
|
|
|
|
|
left join tsysenumvalue t1 on t1.enumtypeid=8 and t1.enumvalueid=K.czstate
|
|
|
|
|
left join tsysenumvalue t2 on t2.enumtypeid=9 and t2.enumvalueid=K.kfstate
|