You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DSWMS/DB/SQL_banben/13 裕龙 核注清单.sql

258 lines
7.4 KiB
Transact-SQL

CREATE TABLE [dbo].[CHECKLIST_IMPORT](
[GID] [uniqueidentifier] NOT NULL,
[YLRTYBH] [varchar](50) NULL,
[QDBH] [varchar](50) NULL,
[ACCBOOKNO] [varchar](50) NULL,
[JYQY_CODE] [varchar](50) NULL,
[JYQY_TAXNO] [varchar](50) NULL,
[JYQY_NAME] [varchar](50) NULL,
[JGQY_CODE] [varchar](50) NULL,
[JGQY_TAXNO] [varchar](50) NULL,
[JGQY_NAME] [varchar](50) NULL,
[SBDW_CODE] [varchar](50) NULL,
[SBDW_TAXNO] [varchar](50) NULL,
[SBDW_NAME] [varchar](50) NULL,
[LRDW_CODE] [varchar](50) NULL,
[LRDW_TAXNO] [varchar](50) NULL,
[LRDW_NAME] [varchar](50) NULL,
[CUSTNO] [varchar](50) NULL,
[LRDATE] [varchar](50) NULL,
[QDSBDATE] [varchar](50) NULL,
[LJCPBZ] [varchar](50) NULL,
[JGFS] [varchar](50) NULL,
[YSFS] [varchar](50) NULL,
[JJGB] [varchar](50) NULL,
[ZGHG] [varchar](50) NULL,
[QYG] [varchar](50) NULL,
[QDLB] [varchar](50) NULL,
[HKBZ] [varchar](50) NULL,
[QDJCKKZT] [varchar](50) NULL,
[SBBBH] [varchar](50) NULL,
[LZLX] [varchar](50) NULL,
[BGBZ] [varchar](50) NULL,
[BGLX] [varchar](50) NULL,
[BGDLX] [varchar](50) NULL,
[GLQDBH] [varchar](50) NULL,
[GLZCBAH] [varchar](50) NULL,
[DYBGDBH] [varchar](50) NULL,
[DYBGSBDW_CODE] [varchar](50) NULL,
[DYBGSBDW_TAXNO] [varchar](50) NULL,
[DYBGSBDW_NAME] [varchar](50) NULL,
[REMARK] [varchar](50) NULL,
[OPCARDNO] [varchar](50) NULL,
CONSTRAINT [PK_CHECKLIST_IMPORT] PRIMARY KEY CLUSTERED
(
[GID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[CHECKLIST_EXIT](
[GID] [uniqueidentifier] NOT NULL,
[YLRTYBH] [varchar](50) NULL,
[QDBH] [varchar](50) NULL,
[ACCBOOKNO] [varchar](50) NULL,
[JYQY_CODE] [varchar](50) NULL,
[JYQY_TAXNO] [varchar](50) NULL,
[JYQY_NAME] [varchar](50) NULL,
[JGQY_CODE] [varchar](50) NULL,
[JGQY_TAXNO] [varchar](50) NULL,
[JGQY_NAME] [varchar](50) NULL,
[SBDW_CODE] [varchar](50) NULL,
[SBDW_TAXNO] [varchar](50) NULL,
[SBDW_NAME] [varchar](50) NULL,
[LRDW_CODE] [varchar](50) NULL,
[LRDW_TAXNO] [varchar](50) NULL,
[LRDW_NAME] [varchar](50) NULL,
[CUSTNO] [varchar](50) NULL,
[LRDATE] [varchar](50) NULL,
[QDSBDATE] [varchar](50) NULL,
[LJCPBZ] [varchar](50) NULL,
[JGFS] [varchar](50) NULL,
[YSFS] [varchar](50) NULL,
[CJGB] [varchar](50) NULL,
[ZGHG] [varchar](50) NULL,
[YDG] [varchar](50) NULL,
[QDLB] [varchar](50) NULL,
[HKBZ] [varchar](50) NULL,
[QDJCKKZT] [varchar](50) NULL,
[SBBBH] [varchar](50) NULL,
[LZLX] [varchar](50) NULL,
[BGBZ] [varchar](50) NULL,
[BGLX] [varchar](50) NULL,
[BGDLX] [varchar](50) NULL,
[GLQDBH] [varchar](50) NULL,
[GLZCBAH] [varchar](50) NULL,
[GLBGD_CODE] [varchar](50) NULL,
[GLBGD_SBRQ] [varchar](50) NULL,
[GLBGD_SFHR_CODE] [varchar](50) NULL,
[GLBGD_SHXYDM_1] [varchar](50) NULL,
[GLBGD_SFHR_NAME] [varchar](50) NULL,
[GLBGD_XFSYDW_CODE] [varchar](50) NULL,
[GLBGD_SHXYDM_2] [varchar](50) NULL,
[GLBGD_DWNAME] [varchar](50) NULL,
[GLBGD_SBDW_CODE] [varchar](50) NULL,
[GLBGD_SHXYDM_3] [varchar](50) NULL,
[GLBGD_SBDW_NAME] [varchar](50) NULL,
[REMARK] [varchar](50) NULL,
[OPCARDNO] [varchar](50) NULL,
CONSTRAINT [PK_CHECKLIST_EXIT] PRIMARY KEY CLUSTERED
(
[GID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[CHECKLIST_DETAIL_1](
[GID] [uniqueidentifier] NOT NULL,
[HEADID] [uniqueidentifier] NOT NULL,
[ORDERNO] [int] NULL,
[BILLORDER] [int] NULL,
[FILINGLISTORDER] [varchar](50) NULL,
[MATERIALNO] [varchar](50) NULL,
[HSCODE] [varchar](50) NULL,
[GOODSNAME] [varchar](50) NULL,
[GOODSMODEL] [varchar](50) NULL,
[FROMCOUNTRY] [varchar](50) NULL,
[TOCOUNTRY] [varchar](50) NULL,
[CURRENCY] [varchar](20) NULL,
[REPORT_PRICE] [numeric](18, 4) NULL,
[REPORT_COUNT] [numeric](18, 4) NULL,
[REPORT_UNIT] [varchar](20) NULL,
[REPORT_AMOUNT] [numeric](18, 4) NULL,
[RULE1_COUNT] [numeric](18, 4) NULL,
[RULE1_UNIT] [varchar](20) NULL,
[RULE2_COUNT] [numeric](18, 4) NULL,
[RULE2_UNIT] [varchar](20) NULL,
[KGS] [numeric](18, 3) NULL,
[NETWEIGHT] [numeric](18, 3) NULL,
[ZMFS] [varchar](50) NULL,
[DHBB] [varchar](50) NULL,
CONSTRAINT [PK_CHECKLIST_DETAIL_1] PRIMARY KEY CLUSTERED
(
[GID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[CHECKLIST_DETAIL_2](
[GID] [uniqueidentifier] NOT NULL,
[HEADID] [uniqueidentifier] NOT NULL,
[TYBH] [varchar](50) NULL,
[ORDERNO] [int] NULL,
[HSCODE] [varchar](50) NULL,
[GOODSNAME] [varchar](50) NULL,
[GOODSMODEL] [varchar](50) NULL,
[REPORT_PRICE] [numeric](18, 4) NULL,
[REPORT_COUNT] [numeric](18, 4) NULL,
[REPORT_UNIT] [varchar](20) NULL,
[REPORT_AMOUNT] [numeric](18, 4) NULL,
[CURRENCY] [varchar](20) NULL,
[FROMCOUNTRY] [varchar](50) NULL,
[TOCOUNTRY] [varchar](50) NULL,
CONSTRAINT [PK_CHECKLIST_DETAIL_2] PRIMARY KEY CLUSTERED
(
[GID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
alter table CHECKLIST_EXIT add OPSTATUS varchar(20) null
GO
alter table CHECKLIST_IMPORT add OPSTATUS varchar(20) null
GO
alter table CHECKLIST_EXIT add CreateDate datetime null
GO
alter table CHECKLIST_EXIT add Creator varchar(50) null
GO
alter table CHECKLIST_EXIT add CreateID uniqueidentifier null
GO
alter table CHECKLIST_IMPORT add CreateDate datetime null
GO
alter table CHECKLIST_IMPORT add Creator varchar(50) null
GO
alter table CHECKLIST_IMPORT add CreateID uniqueidentifier null
GO
alter table op_wms_move add [OP] [uniqueidentifier] NULL
GO
ALTER VIEW [dbo].[VW_OP_WMS_MOVE] AS select m.WMSDOID, m.BSNO,m.CUSTOMERNAME,m.DODATE,m.REMARK,m.BILLSTATUS
,a.[VALUE] MBLNO,b.[VALUE] CNTRNO,c.[VALUE] GOODSNAME,m.CORPID,m.CreateID,m.OP from OP_WMS_MOVE m
left join OP_WMS_LOGIC a on a.PID = m.WMSDOID and a.NAME='MBLNO'
left join OP_WMS_LOGIC b on b.PID = m.WMSDOID and b.NAME='CNTRNO'
left join OP_WMS_LOGIC c on c.PID = m.WMSDOID and c.NAME='GOODSNAME'
GO
insert into code_fee_group values(
'032F3249-8F14-4BCF-98B1-6DF429719251','hzxj','<EFBFBD><EFBFBD>ת<EFBFBD>ֽ<EFBFBD>',''
)
insert into code_fee_group values(
'4F21779E-1854-46D2-A02B-8959FC24E487','ykxj','<EFBFBD>ƿ<EFBFBD><EFBFBD>ֽ<EFBFBD>',''
)
insert into code_fee_group values(
'7A2CDB87-8EEE-4360-AF26-3220D7F95FFF','jbf','<EFBFBD>Ӱ<EFBFBD><EFBFBD><EFBFBD>',''
)
GO
ALTER view [dbo].[VW_OP_WMS_REPORT_TIMEZONES_DETAIL] as
SELECT [ID]
,[REPORTID]
,d.[WMSID]
,w.MBLNO,w.CNTRNO,w.GOODSNAME,w.CUSTOMERNAME,isnull(w.GOODSOWNER,'') GOODSOWNER,isnull(w.CUSTOMNO,'')CUSTOMNO
,isnull(w.OP,'00000000-0000-0000-0000-000000000000') OP
,isnull(cg.GOODSFEETYPE,'')GOODSFEETYPE
,isnull(cgt.GoodsTypeName,'')GoodsTypeName
,w.INDATE
,d.[PKGS]
,d.[KGS]
,d.[CBM]
,d.[NETWEIGHT]
,d.[STORAGEUNITCOUNT]
,d.[RULEUNITCOUNT]
,[PKGS2_1]
,[KGS2_1]
,[CBM2_1]
,[NETWEIGHT2_1]
,[STORAGEUNITCOUNT2_1]
,[RULEUNITCOUNT2_1]
,[PKGS2_2]
,[KGS2_2]
,[CBM2_2]
,[NETWEIGHT2_2]
,[STORAGEUNITCOUNT2_2]
,[RULEUNITCOUNT2_2]
,[PKGS3]
,[KGS3]
,[CBM3]
,[NETWEIGHT3]
,[STORAGEUNITCOUNT3]
,[RULEUNITCOUNT3]
,[CUSTOMNO_OUT]
,[STOREHOUSE]
,[AREACODE]
,w.COUNTRY
FROM [dbo].[OP_WMS_REPORT_TIMEZONES_DETAIL] d
left join OP_WMS w on w.WMSID=d.WMSID
left join code_goods cg on cg.GOODNAME=w.GOODSNAME
left join code_goodsType cgt on cgt.GID=cg.GoodsTypeGID
GO