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.
131 lines
10 KiB
Transact-SQL
131 lines
10 KiB
Transact-SQL
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
ALTER VIEW [dbo].[VW_Settlement]
|
|
AS
|
|
SELECT BSNO, OPLB, OPLBNAME, CUSTOMERNAME, CUSTNO, MBLNO, HBLNO, ETD, VESSEL, VOYNO, INPUTBY, CREATETIME, BSSTATUS, SALE, OP, DOC,
|
|
CUSTSERVICE, PORTLOAD, PORTDISCHARGE, CUSTOMNO, CUSTOMNO2, ACCDATE
|
|
FROM (SELECT BSNO, 'op_seae' AS OPLB, '海运出口' AS OPLBNAME, CUSTOMERNAME, CUSTNO, MBLNO, HBLNO, ETD, VESSEL, VOYNO, INPUTBY,
|
|
CREATETIME, BSSTATUS, SALE, OP, DOC, CUSTSERVICE, PORTLOAD, PORTDISCHARGE, '' AS CUSTOMNO, '' AS CUSTOMNO2,
|
|
ACCDATE
|
|
FROM dbo.op_seae
|
|
UNION ALL
|
|
SELECT BSNO, 'op_seai' AS OPLB, '海运进口' AS OPLBNAME, CUSTOMERNAME, CUSTNO, MBLNO, HBLNO, ETD, VESSEL, VOYNO, INPUTBY,
|
|
CREATETIME, BSSTATUS, SALE, OP, DOC, CUSTSERVICE, PORTLOAD, PORTDISCHARGE, ISNULL(CUSTOMNO, '') AS CUSTOMNO,
|
|
ISNULL
|
|
((SELECT TOP (1) CUSTOMNO
|
|
FROM dbo.wms_out
|
|
WHERE (ASSOCIATEDNO = dbo.op_seai.BSNO)), '') AS CUSTOMNO2, ACCDATE
|
|
FROM dbo.op_seai
|
|
UNION ALL
|
|
SELECT BSNO, 'op_sean' AS OPLB, '内贸海运' AS OPLBNAME, CUSTOMERNAME, CUSTNO, MBLNO, '' AS HBLNO, ETD, VESSEL, VOYNO, INPUTBY,
|
|
INPUTTIME AS CREATETIME, BSSTATUS, SALE, OP, '' AS DOC, '' AS CUSTSERVICE, PORTLOAD, PORTDISCHARGE, '' AS CUSTOMNO,
|
|
'' AS CUSTOMNO2, ACCDATE
|
|
FROM dbo.op_sean
|
|
UNION ALL
|
|
SELECT GID AS BSNO, 'wms_fee' AS OPLB, '仓储费' AS OPLBNAME, CLIENTNAME AS CUSTOMERNAME, '' AS CUSTNO, CONVERT(varchar,
|
|
FEEYEAR) + '-' + CONVERT(varchar, FEEMONTH) AS MBLNO, '' AS HBLNO, CAST(CAST(FEEYEAR AS varchar)
|
|
+ '-' + CAST(FEEMONTH AS varchar) + '-01' AS datetime) AS ETD, '' AS VESSEL, '' AS VOYNO,
|
|
(SELECT SHOWNAME
|
|
FROM dbo.[user]
|
|
WHERE (GID = dbo.wms_fee.CREATEUSER)) AS INPUTBY, CREATETIME, 1 AS BSSTATUS, '' AS SALE,
|
|
(SELECT SHOWNAME
|
|
FROM dbo.[user] AS user_10
|
|
WHERE (GID = dbo.wms_fee.MODIFIEDUSER)) AS OP, '' AS DOC, '' AS CUSTSERVICE, '' AS PORTLOAD, '' AS PORTDISCHARGE,
|
|
'' AS CUSTOMNO, '' AS CUSTOMNO2, '' AS ACCDATE
|
|
FROM dbo.wms_fee
|
|
UNION ALL
|
|
SELECT GID AS BSNO, 'wms' AS OPLB, '仓储入库' AS OPLBNAME, CUSTOMERNAME, '' AS CUSTNO, WMSNO AS MBLNO, '' AS HBLNO,
|
|
WMSDATE AS ETD, '' AS VESSEL, '' AS VOYNO, WMSOP AS INPUTBY, WMSDATE AS CREATETIME, 1 AS BSSTATUS, '' AS SALE,
|
|
(SELECT SHOWNAME
|
|
FROM dbo.[user] AS user_9
|
|
WHERE (GID = dbo.wms.MODIFIEDUSER)) AS OP, '' AS DOC, STOREMAN AS CUSTSERVICE, '' AS PORTLOAD, '' AS PORTDISCHARGE,
|
|
'' AS CUSTOMNO, '' AS CUSTOMNO2, '' AS ACCDATE
|
|
FROM dbo.wms
|
|
UNION ALL
|
|
SELECT GID AS BSNO, 'wms_out' AS OPLB, '仓储出库' AS OPLBNAME, CUSTOMERNAME, '' AS CUSTNO, BSNO AS MBLNO, '' AS HBLNO,
|
|
DODATE AS ETD, '' AS VESSEL, '' AS VOYNO, WMSOP AS INPUTBY, DODATE AS CREATETIME, 1 AS BSSTATUS,
|
|
(SELECT SHOWNAME
|
|
FROM dbo.[user] AS user_8
|
|
WHERE (GID = wms_out_1.CREATEUSER)) AS SALE,
|
|
(SELECT SHOWNAME
|
|
FROM dbo.[user] AS user_7
|
|
WHERE (GID = wms_out_1.MODIFIEDUSER)) AS OP, '' AS DOC, STOREMAN AS CUSTSERVICE, '' AS PORTLOAD,
|
|
'' AS PORTDISCHARGE, '' AS CUSTOMNO, '' AS CUSTOMNO2, '' AS ACCDATE
|
|
FROM dbo.wms_out AS wms_out_1
|
|
UNION ALL
|
|
SELECT GId AS BSNO, 'tMsWlBsHead' AS OPLB, '陆运托运' AS OPLBNAME, CustName AS CUSTOMERNAME, BillNo AS CUSTNO, MblNo,
|
|
'' AS HBLNO, EtDate AS ETD, VoyVeg AS VESSEL, '' AS VOYNO, UserName AS INPUTBY, LrDate AS CREATETIME, BillStatus AS BSSTATUS,
|
|
SalesName AS SALE, DispatchName AS OP, '' AS DOC, '' AS CUSTSERVICE, SendYardName AS PORTLOAD, DstArea AS PORTDISCHARGE,
|
|
'' AS CUSTOMNO, '' AS CUSTOMNO2, '' AS ACCDATE
|
|
FROM dbo.tMsWlBsHead
|
|
UNION ALL
|
|
SELECT p1.GId AS BSNO, 'tMsWlPcHead' AS OPLB, '陆运派车' AS OPLBNAME, b1.CustName AS CUSTOMERNAME, b1.BillNo AS CUSTNO,
|
|
b1.MblNo, p1.BillNo AS HBLNO, b1.EtDate AS ETD, b1.VoyVeg AS VESSEL, '' AS VOYNO,
|
|
(SELECT SHOWNAME
|
|
FROM dbo.[user] AS user_6
|
|
WHERE (CODENAME = b1.UserCode)) AS INPUTBY, b1.LrDate AS CREATETIME, b1.BillStatus AS BSSTATUS,
|
|
(SELECT SHOWNAME
|
|
FROM dbo.[user] AS user_5
|
|
WHERE (CODENAME = b1.SalesCode)) AS SALE,
|
|
(SELECT SHOWNAME
|
|
FROM dbo.[user] AS user_4
|
|
WHERE (CODENAME = b1.DispatchCode)) AS OP, '' AS DOC, '' AS CUSTSERVICE, b1.SendYardName AS PORTLOAD,
|
|
b1.DstArea AS PORTDISCHARGE, '' AS CUSTOMNO, '' AS CUSTOMNO2, '' AS ACCDATE
|
|
FROM dbo.tMsWlBsHead AS b1 INNER JOIN
|
|
dbo.tMsWlPcHead AS p1 ON b1.BillNo = p1.RefBillNo
|
|
UNION ALL
|
|
SELECT p2.GId AS BSNO, 'tMsWlPcHead' AS OPLB, '陆运派车' AS OPLBNAME,
|
|
(SELECT SHORTNAME
|
|
FROM dbo.info_client
|
|
WHERE (CODENAME = k2.CustCode)) AS CUSTOMERNAME, b2.BillNo AS CUSTNO, k2.BillNo AS MBLNO, p2.BillNo AS HBLNO,
|
|
b2.CustDate AS ETD, '' AS VESSEL, '' AS VOYNO,
|
|
(SELECT SHOWNAME
|
|
FROM dbo.[user] AS user_3
|
|
WHERE (CODENAME = b2.UserCode)) AS INPUTBY, b2.LrDate AS CREATETIME, b2.BillStatus AS BSSTATUS,
|
|
(SELECT SHOWNAME
|
|
FROM dbo.[user] AS user_2
|
|
WHERE (CODENAME = b2.SalesCode)) AS SALE,
|
|
(SELECT SHOWNAME
|
|
FROM dbo.[user] AS user_1
|
|
WHERE (CODENAME = b2.UserCode)) AS OP, '' AS DOC, '' AS CUSTSERVICE, b2.LoadPlace AS PORTLOAD,
|
|
b2.UnLoadPlace AS PORTDISCHARGE, '' AS CUSTOMNO, '' AS CUSTOMNO2, '' AS ACCDATE
|
|
FROM dbo.tMsWlBulkHead AS b2 INNER JOIN
|
|
dbo.tMsWlBulkPound AS k2 ON b2.BillNo = k2.BulkBillNo INNER JOIN
|
|
dbo.tMsWlPcHead AS p2 ON k2.BillNo = p2.BillNo) AS a
|
|
UNION ALL
|
|
SELECT ContractNo AS BSNO, 'import_main' AS OPLB, '进口贸易' AS OPLBNAME, buyer AS CUSTOMERNAME, HTH AS CUSTNO, billno as MblNo, '' AS HBLNO,
|
|
Arrivaldate AS ETD, VESSEL,voyage as VOYNO, creator AS INPUTBY,CREATTIME as CREATETIME, MainState AS BSSTATUS, '' AS SALE,
|
|
creator AS OP, '' AS DOC, '' AS CUSTSERVICE,' ' AS PORTLOAD,
|
|
(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) AS PORTDISCHARGE, '' AS CUSTOMNO,
|
|
'' AS CUSTOMNO2,'' AS ACCDATE
|
|
FROM dbo.import_main M
|
|
|
|
GO
|
|
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---创建表
|
|
INSERT INTO [t_sys_soft]([版本号],[系统],[版本1],[版本2],[版本3],[软件名称]) VALUES('7.13.0719',NULL,'7','13','0719','d7')
|
|
---
|
|
ALTER TABLE run_fee_settlement ADD CHEQUENOUSD varchar(200) default ''
|
|
---
|
|
update run_fee_settlement set CHEQUENOUSD=''
|
|
|
|
|
|
---
|
|
INSERT INTO [t_sys_soft]([版本号],[系统],[版本1],[版本2],[版本3],[软件名称]) VALUES('7.13.0817',NULL,'7','13','0817','d7')
|
|
---添加新字段
|
|
ALTER TABLE ch_fee_payapplication add CHEQUENUMREMARK varchar(100)
|
|
---
|
|
ALTER TABLE run_fee_settlement add CHEQUENUMREMARK varchar(100)
|
|
---
|
|
update ch_fee_payapplication set CHEQUENUMREMARK=''
|
|
---
|
|
update run_fee_settlement set CHEQUENUMREMARK='' |