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.
745 lines
59 KiB
Transact-SQL
745 lines
59 KiB
Transact-SQL
|
|
alter table code_goods drop Column STORAGEUNIT_TYPE
|
|
GO
|
|
alter table code_goods add RULEUNIT varchar(20) null
|
|
GO
|
|
alter table code_goods add RULEUNIT2 varchar(20) null
|
|
GO
|
|
|
|
update code_goods set RULEUNIT='ǧ¿Ë'
|
|
|
|
|
|
update Sys_Dictionary set dbsql='SELECT GOODNAME as ''key'',isnull((select top 1 STORAGEUNIT_TYPE from OP_WMS_GOODSFEETYPE where GOODSFEETYPE=code_goods.GOODSFEETYPE),''ëÖØ'') as ''value'' FROM code_goods' where DicNo='codegoods_storageunit_type'
|
|
GO
|
|
|
|
alter table OP_WMS_LOGIC alter column [VALUE] varchar(max) 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 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
|
|
|
|
alter table OP_WMS_GOODSFEETYPE add STORAGEUNIT varchar(20) null
|
|
GO
|
|
|
|
update OP_WMS_GOODSFEETYPE set STORAGEUNIT='¶Ö'
|
|
go
|
|
|
|
alter table op_wms_in_do add TRUCKNO varchar(50) null
|
|
go
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_IN_DO] AS select D.[BSNO]
|
|
,[WMSDOID]
|
|
,[WMS_PLAN_BSNO]
|
|
,[BILLTYPE]
|
|
,[CUSTOMERNAME]
|
|
,[MATERIALNO]
|
|
,[GOODSCODE]
|
|
,[GOODSNAME]
|
|
,[GOODSHSCODE]
|
|
,[MBLNO]
|
|
,[PAYEDTAXES]
|
|
,[BSSTATUS]
|
|
,[CreateDate]
|
|
,[Creator]
|
|
,[CreateID]
|
|
,[REMARK]
|
|
,[FEESTATUS]
|
|
,[BILLSTATUS]
|
|
,[DODATE]
|
|
,[CORPID]
|
|
,[CUSTOMNO]
|
|
,[GOODSOWNER]
|
|
,[TRUCKNO],dbo.F_INDODETAIL_CNTRNO(d.WMSDOID) CNTRNO,(select top 1 GOODSFEETYPE from code_goods where GOODNAME=GOODSNAME)GOODSFEETYPE,
|
|
(select count(CNTRNO) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid) CTNNUM,
|
|
isnull((select sum(KGS) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) KGS,
|
|
isnull((select sum(NETWEIGHT) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) NETWEIGHT,
|
|
isnull((select sum(CBM) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) CBM,
|
|
isnull((select sum(PKGS) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) PKGS,
|
|
(select top 1 KINDPKGS from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid) KINDPKGS,
|
|
(select top 1 STORAGEUNIT from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid) STORAGEUNIT,
|
|
(select top 1 RULEUNIT from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid) RULEUNIT,
|
|
isnull((select sum(STORAGEUNITCOUNT) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) STORAGEUNITCOUNT,
|
|
isnull((select sum(RULEUNITCOUNT) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) RULEUNITCOUNT
|
|
from OP_WMS_IN_DO D
|
|
GO
|
|
|
|
|
|
|
|
/*
|
|
drop function [dbo].[F_MOVE_MBLNO]
|
|
GO
|
|
create function [dbo].[F_MOVE_MBLNO](@Contractno uniqueidentifier)
|
|
returns nvarchar(100)
|
|
as
|
|
begin
|
|
declare @S nvarchar(100)
|
|
select @S=isnull(@S,'')+MBLNO +' ' from(select distinct MBLNO from VW_OP_WMS_MOVE_DETAIL where WMSDOID=@Contractno )t
|
|
return @S
|
|
end
|
|
|
|
GO
|
|
drop function [dbo].[F_MOVE_CNTRNO]
|
|
GO
|
|
create function [dbo].[F_MOVE_CNTRNO](@Contractno uniqueidentifier)
|
|
returns nvarchar(100)
|
|
as
|
|
begin
|
|
declare @S nvarchar(100)
|
|
select @S=isnull(@S,'')+CNTRNO +' ' from(select distinct CNTRNO from VW_OP_WMS_MOVE_DETAIL where WMSDOID=@Contractno )t
|
|
return @S
|
|
end
|
|
|
|
GO
|
|
drop function [dbo].[F_MOVE_GOODSNAME]
|
|
GO
|
|
create function [dbo].[F_MOVE_GOODSNAME](@Contractno uniqueidentifier)
|
|
returns nvarchar(100)
|
|
as
|
|
begin
|
|
declare @S nvarchar(100)
|
|
select @S=isnull(@S,'')+GOODSNAME +' ' from(select distinct GOODSNAME from VW_OP_WMS_MOVE_DETAIL where WMSDOID=@Contractno )t
|
|
return @S
|
|
end
|
|
GO
|
|
|
|
insert into op_wms_logic select newid(),null,'MBLNO',dbo.[F_MOVE_MBLNO](WMSDOID),WMSDOID from OP_WMS_MOVE
|
|
insert into op_wms_logic select newid(),null,'CNTRNO',dbo.[F_MOVE_CNTRNO](WMSDOID),WMSDOID from OP_WMS_MOVE
|
|
insert into op_wms_logic select newid(),null,'GOODSNAME',dbo.[F_MOVE_GOODSNAME](WMSDOID),WMSDOID from OP_WMS_MOVE
|
|
|
|
--delete from op_wms_logic where [name] in ('MBLNO','CNTRNO','GOODSNAME')
|
|
|
|
--select * from vw_op_wms_move
|
|
*/
|
|
|
|
alter table OP_WMS_STOREHOUSE add ACCBOOKNO varchar(50) null
|
|
GO
|
|
alter table OP_WMS_IN_PLAN drop column ACCBOOKNO
|
|
|
|
GO
|
|
|
|
update OP_WMS_STOREHOUSE set ACCBOOKNO = (select top 1 ACCBOOKID from INFO_ACCBOOK where CORPID=OP_WMS_STOREHOUSE.CORPNAME )
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_IN_PLAN] AS select [WMSPLANID]
|
|
,[WMSNO]
|
|
,[MBLNO]
|
|
,[CONTRACTNO]
|
|
,[BILLTYPE]
|
|
,[PLANTIME]
|
|
,[ACCDATE]
|
|
,[CUSTOMERNAME]
|
|
,[CORPID]
|
|
,[KGS]
|
|
,[PKGS]
|
|
,[CBM]
|
|
,[GOODSNAME]
|
|
,[KINDPKGS]
|
|
,[STORAGEUNIT]
|
|
,[STORAGEUNITCOUNT]
|
|
,[RULEUNIT]
|
|
,[RULEUNITCOUNT]
|
|
,[REMARK]
|
|
,[BSSOURCE]
|
|
,[Creator]
|
|
,[CreateID]
|
|
,[CreateDate]
|
|
,[FEESTATUS]
|
|
,[BSSTATUS]
|
|
,[TIMEMARK]
|
|
,[ModifyDate]
|
|
,[ModifyID]
|
|
,[Modifier]
|
|
,[ISEND]
|
|
,[MASTERBSNO]
|
|
,[NETWEIGHT]
|
|
,[CUSTOMNO]
|
|
,[ETA]
|
|
,[CTNNUM]
|
|
,[JINJINGBEIANSHENBAORIQI]
|
|
,[JINGNEISHOUHUOREN]
|
|
,[INSPECTION_NO]
|
|
,[PLAN_GETTIME]
|
|
,[CUSTOMAMOUNT]
|
|
,(select top 1 GOODSFEETYPE from code_goods where GOODNAME=GOODSNAME)GOODSFEETYPE
|
|
,GOODSOWNER
|
|
,BILLSTATUS,ARCLIENTWMSOUT
|
|
FROM [OP_WMS_IN_PLAN]
|
|
GO
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_IN_PLAN_BEFORE] AS select [WMSPLANID]
|
|
,[WMSNO]
|
|
,[MBLNO]
|
|
,[CONTRACTNO]
|
|
,[BILLTYPE]
|
|
,[PLANTIME]
|
|
,[ACCDATE]
|
|
,[CUSTOMERNAME]
|
|
,[CORPID]
|
|
,[KGS]
|
|
,[PKGS]
|
|
,[CBM]
|
|
,[GOODSNAME]
|
|
,[KINDPKGS]
|
|
,[STORAGEUNIT]
|
|
,[STORAGEUNITCOUNT]
|
|
,[RULEUNIT]
|
|
,[RULEUNITCOUNT]
|
|
,[REMARK]
|
|
,[BSSOURCE]
|
|
,[Creator]
|
|
,[CreateID]
|
|
,[CreateDate]
|
|
,[FEESTATUS]
|
|
,[BSSTATUS]
|
|
,[TIMEMARK]
|
|
,[ModifyDate]
|
|
,[ModifyID]
|
|
,[Modifier]
|
|
,[ISEND]
|
|
,[MASTERBSNO]
|
|
,[NETWEIGHT]
|
|
,[CUSTOMNO]
|
|
,[ETA]
|
|
,[CTNNUM]
|
|
,[JINJINGBEIANSHENBAORIQI]
|
|
,[JINGNEISHOUHUOREN]
|
|
,[INSPECTION_NO]
|
|
,[PLAN_GETTIME]
|
|
,[CUSTOMAMOUNT]
|
|
,(select top 1 GOODSFEETYPE from code_goods where GOODNAME=GOODSNAME)GOODSFEETYPE
|
|
,GOODSOWNER
|
|
,BILLSTATUS
|
|
FROM [OP_WMS_IN_PLAN] where BSSOURCE='Èë¿â¼Æ»®'
|
|
GO
|
|
|
|
ALTER view [dbo].[VW_OP_REP_WMSINDO_BYPLAN] as
|
|
select p.[WMSPLANID]
|
|
,[WMSNO]
|
|
,[MBLNO]
|
|
,[CONTRACTNO]
|
|
,[BILLTYPE]
|
|
,[PLANTIME]
|
|
,[ACCDATE]
|
|
,[CUSTOMERNAME]
|
|
,P.[CORPID]
|
|
,[KGS]
|
|
,[PKGS]
|
|
,[CBM]
|
|
,[GOODSNAME]
|
|
,[KINDPKGS]
|
|
,[STORAGEUNIT]
|
|
,[STORAGEUNITCOUNT]
|
|
,P.[RULEUNIT]
|
|
,[RULEUNITCOUNT]
|
|
,[REMARK]
|
|
,[BSSOURCE]
|
|
,[Creator]
|
|
,[CreateID]
|
|
,[CreateDate]
|
|
,[FEESTATUS]
|
|
,[BSSTATUS]
|
|
,[TIMEMARK]
|
|
,[ModifyDate]
|
|
,[ModifyID]
|
|
,[Modifier]
|
|
,[ISEND]
|
|
,[MASTERBSNO]
|
|
,[NETWEIGHT]
|
|
,[CUSTOMNO]
|
|
,[ETA]
|
|
,[CTNNUM]
|
|
,[JINJINGBEIANSHENBAORIQI]
|
|
,[JINGNEISHOUHUOREN]
|
|
,[INSPECTION_NO]
|
|
,[PLAN_GETTIME]
|
|
,[CUSTOMAMOUNT]
|
|
,[GOODSOWNER]
|
|
,[BILLSTATUS]
|
|
,[ARCLIENTWMSOUT]
|
|
, (select count(distinct CNTRNO) from OP_WMS_IN_DO_GOODS where WMSPLANID=p.wmsplanid ) INDO_CTNNUM
|
|
,(select sum(PKGS) from OP_WMS_IN_DO_GOODS where WMSPLANID=p.wmsplanid) INDO_PKGS
|
|
,(select sum(KGS) from OP_WMS_IN_DO_GOODS where WMSPLANID=p.wmsplanid) INDO_KGS
|
|
,(select sum(CBM) from OP_WMS_IN_DO_GOODS where WMSPLANID=p.wmsplanid) INDO_CBM
|
|
,(select sum(NETWEIGHT) from OP_WMS_IN_DO_GOODS where WMSPLANID=p.wmsplanid) INDO_NETWEIGHT
|
|
,(select sum(STORAGEUNITCOUNT) from OP_WMS_IN_DO_GOODS where WMSPLANID=p.wmsplanid) INDO_STORAGEUNITCOUNT
|
|
,(select sum(RULEUNITCOUNT) from OP_WMS_IN_DO_GOODS where WMSPLANID=p.wmsplanid) INDO_RULEUNITCOUNT
|
|
,g.GOODSFEETYPE,g.GoodsTypeGID
|
|
from OP_WMS_IN_PLAN p
|
|
left join code_goods g on g.GOODNAME=p.GOODSNAME
|
|
GO
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_IN_DO] AS select D.[BSNO]
|
|
,[WMSDOID]
|
|
,[WMS_PLAN_BSNO]
|
|
,[BILLTYPE]
|
|
,[CUSTOMERNAME]
|
|
,[MATERIALNO]
|
|
,[GOODSCODE]
|
|
,[GOODSNAME]
|
|
,[GOODSHSCODE]
|
|
,[MBLNO]
|
|
,[PAYEDTAXES]
|
|
,[BSSTATUS]
|
|
,[CreateDate]
|
|
,[Creator]
|
|
,[CreateID]
|
|
,[REMARK]
|
|
,[FEESTATUS]
|
|
,[BILLSTATUS]
|
|
,[DODATE]
|
|
,[CORPID]
|
|
,[CUSTOMNO]
|
|
,[GOODSOWNER]
|
|
,[TRUCKNO],dbo.F_INDODETAIL_CNTRNO(d.WMSDOID) CNTRNO,(select top 1 GOODSFEETYPE from code_goods where GOODNAME=GOODSNAME)GOODSFEETYPE,
|
|
(select count(CNTRNO) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid) CTNNUM,
|
|
isnull((select sum(KGS) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) KGS,
|
|
isnull((select sum(NETWEIGHT) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) NETWEIGHT,
|
|
isnull((select sum(CBM) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) CBM,
|
|
isnull((select sum(PKGS) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) PKGS,
|
|
(select top 1 KINDPKGS from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid) KINDPKGS,
|
|
(select top 1 STORAGEUNIT from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid) STORAGEUNIT,
|
|
(select top 1 RULEUNIT from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid) RULEUNIT,
|
|
isnull((select sum(STORAGEUNITCOUNT) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) STORAGEUNITCOUNT,
|
|
isnull((select sum(RULEUNITCOUNT) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) RULEUNITCOUNT
|
|
from OP_WMS_IN_DO D
|
|
GO
|
|
|
|
ALTER view [dbo].[VW_OP_REP_WMSINDO_BYPLAN] as
|
|
select p.[WMSPLANID]
|
|
,[WMSNO]
|
|
,[MBLNO]
|
|
,[CONTRACTNO]
|
|
,[BILLTYPE]
|
|
,[PLANTIME]
|
|
,[ACCDATE]
|
|
,[CUSTOMERNAME]
|
|
,P.[CORPID]
|
|
,[KGS]
|
|
,[PKGS]
|
|
,[CBM]
|
|
,[GOODSNAME]
|
|
,[KINDPKGS]
|
|
,[STORAGEUNIT]
|
|
,[STORAGEUNITCOUNT]
|
|
,P.[RULEUNIT]
|
|
,[RULEUNITCOUNT]
|
|
,[REMARK]
|
|
,[BSSOURCE]
|
|
,[Creator]
|
|
,[CreateID]
|
|
,[CreateDate]
|
|
,[FEESTATUS]
|
|
,[BSSTATUS]
|
|
,[TIMEMARK]
|
|
,[ModifyDate]
|
|
,[ModifyID]
|
|
,[Modifier]
|
|
,[ISEND]
|
|
,[MASTERBSNO]
|
|
,[NETWEIGHT]
|
|
,[CUSTOMNO]
|
|
,[ETA]
|
|
,[CTNNUM]
|
|
,[JINJINGBEIANSHENBAORIQI]
|
|
,[JINGNEISHOUHUOREN]
|
|
,[INSPECTION_NO]
|
|
,[PLAN_GETTIME]
|
|
,[CUSTOMAMOUNT]
|
|
,[GOODSOWNER]
|
|
,[BILLSTATUS]
|
|
,[ARCLIENTWMSOUT]
|
|
, (select count(distinct CNTRNO) from OP_WMS_IN_DO_GOODS where WMSPLANID=p.wmsplanid ) INDO_CTNNUM
|
|
,(select sum(PKGS) from OP_WMS_IN_DO_GOODS where WMSPLANID=p.wmsplanid) INDO_PKGS
|
|
,(select sum(KGS) from OP_WMS_IN_DO_GOODS where WMSPLANID=p.wmsplanid) INDO_KGS
|
|
,(select sum(CBM) from OP_WMS_IN_DO_GOODS where WMSPLANID=p.wmsplanid) INDO_CBM
|
|
,(select sum(NETWEIGHT) from OP_WMS_IN_DO_GOODS where WMSPLANID=p.wmsplanid) INDO_NETWEIGHT
|
|
,(select sum(STORAGEUNITCOUNT) from OP_WMS_IN_DO_GOODS where WMSPLANID=p.wmsplanid) INDO_STORAGEUNITCOUNT
|
|
,(select sum(RULEUNITCOUNT) from OP_WMS_IN_DO_GOODS where WMSPLANID=p.wmsplanid) INDO_RULEUNITCOUNT
|
|
,g.GOODSFEETYPE,g.GoodsTypeGID
|
|
from OP_WMS_IN_PLAN p
|
|
left join code_goods g on g.GOODNAME=p.GOODSNAME
|
|
GO
|
|
|
|
|
|
|
|
create view [dbo].[VW_OP_WMS_CHANGE_BILL]
|
|
as
|
|
|
|
select mblno,CHANGETYPE,CUSTOMERNAME,ARCLIENTWMSOUT,DODATE,sum(PKGS) PKGS,sum(KGS) KGS,sum(CBM) CBM,sum(NETWEIGHT) NETWEIGHT ,sum(STORAGEUNITCOUNT) STORAGEUNITCOUNT ,sum(RULEUNITCOUNT) RULEUNITCOUNT
|
|
,sum(PKGS2) PKGS2,sum(KGS2) KGS2,sum(CBM2) CBM2,sum(NETWEIGHT2) NETWEIGHT2,sum(STORAGEUNITCOUNT2) STORAGEUNITCOUNT2 ,sum(RULEUNITCOUNT2) RULEUNITCOUNT2
|
|
,sum(PKGS3) PKGS3,sum(KGS3) KGS3,sum(CBM3) CBM3,sum(NETWEIGHT3) NETWEIGHT3 ,sum(STORAGEUNITCOUNT3) STORAGEUNITCOUNT3 ,sum(RULEUNITCOUNT3) RULEUNITCOUNT3
|
|
from(select mblno,CUSTOMERNAME, c.*,op_wms.ARCLIENTWMSOUT from OP_WMS_CHANGE c left join op_wms on op_wms.wmsid=c.wmsid) h
|
|
|
|
group by mblno,CHANGETYPE,CUSTOMERNAME,DODATE,ARCLIENTWMSOUT
|
|
GO
|
|
|
|
alter VIEW [dbo].[v_op_bs] AS SELECT BSNO,MASTERNO, 'op_seae' AS OPLB, 'º£Ô˳ö¿Ú' AS OPLBNAME,'º£Ô˳ö¿Ú' AS BSTYPE, CUSTOMERNAME, CUSTNO,ORDERNO,MBLNO, HBLNO,dbo.trimtime(ETD) ETD,dbo.trimtime(ETA) ETA
|
|
,dbo.trimdate(STLDATE) STLDATE, STLNAME, VESSEL, VOYNO, INPUTBY,BLTYPE,
|
|
CREATETIME, BSSTATUS, SALE , OP , DOC, CUSTSERVICE, PORTLOAD, PORTDISCHARGE,CUSTOMNO,
|
|
ACCDATE,CARRIER, BSSOURCE,BSSOURCEDETAIL, LANE, FORWARDER, 0 AS NETWEIGHT, KGS,CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN TEU ELSE 0 END TEU, CNTRTOTAL,
|
|
CORPID,CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN CNTR1 ELSE 0 END CNTR1,CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN CNTR2 ELSE 0 END CNTR2,
|
|
CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN CNTR3 ELSE 0 END CNTR3, CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN CNTR4 ELSE 0 END CNTR4,
|
|
CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN CNTR5 ELSE 0 END CNTR5,CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN CNTR6 ELSE 0 END CNTR6,
|
|
CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN CNTR7 ELSE 0 END CNTR7, CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN CNTR8 ELSE 0 END CNTR8,
|
|
CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN CNTR9 ELSE 0 END CNTR9,CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN CNTR10 ELSE 0 END CNTR10,
|
|
CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN OTCNTR ELSE 0 END OTCNTR, '' AS TRADETYPE, GOODSNAME,
|
|
FEESTATUS,ETD AS OPDATE,CUSTOMDATE,'' ENTERP,PKGS,CBM,BLFRT,SALEDEPT,CUSTOMSNUM,INVNO,'' BSCUSTOMNO,
|
|
INSPECTIONDATE,INSPECTIONNO,CONTRACTNO,''BOOKNO,AGENTID,ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,OPERATOR,SERVICECONTRACTNO,ISCANCEL
|
|
,APPLYNO,ISSUETYPE,BLISSUESTATUS,REMARK,TRADETERM,PLACERECEIPT,DESTINATION,CNTRSEALNO,BillFeeStatus,ISVOU,VOUNO,DESTINATIONID,SALECORPID,YARD,DELIVERYDATE,FRCUSTSERVICE,SERVICE,OPERATORFAX REMARK2,BILLFEESTATUSTIME,TRUCKER,CUSTOMSER,CLOSINGDATE,KINDPKGS,CARGOID,DCLASS
|
|
FROM dbo.op_seae WITH (NOLOCK)
|
|
UNION ALL
|
|
SELECT BSNO,MASTERNO, 'op_seai' AS OPLB, 'º£Ô˽ø¿Ú' AS OPLBNAME,'º£Ô˽ø¿Ú' AS BSTYPE,CUSTOMERNAME, CUSTNO,ORDERNO,MBLNO, HBLNO,dbo.trimtime(ETD) ETD,dbo.trimtime(ETA) ETA
|
|
,dbo.trimdate(STLDATE) STLDATE,STLNAME STLNAME, VESSEL, VOYNO, INPUTBY,BLTYPE,
|
|
CREATETIME, BSSTATUS, SALE ,OP , DOC, CUSTSERVICE, PORTLOAD, PORTDISCHARGE, CUSTOMNO,ACCDATE,
|
|
CARRIER, BSSOURCE,BSSOURCEDETAIL, LANE, FORWARDER, NETWEIGHT, KGS,CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN TEU ELSE 0 END TEU, CNTRTOTAL,
|
|
CORPID,CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN CNTR1 ELSE 0 END CNTR1,CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN CNTR2 ELSE 0 END CNTR2,
|
|
CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN CNTR3 ELSE 0 END CNTR3, CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN CNTR4 ELSE 0 END CNTR4,
|
|
CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN CNTR5 ELSE 0 END CNTR5,CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN CNTR6 ELSE 0 END CNTR6,
|
|
CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN CNTR7 ELSE 0 END CNTR7, CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN CNTR8 ELSE 0 END CNTR8,
|
|
CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN CNTR9 ELSE 0 END CNTR9,CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN CNTR10 ELSE 0 END CNTR10,
|
|
CASE WHEN (BLTYPE='ÕûÏä' OR BLTYPE='Æ´ÏäÖ÷Ʊ') THEN OTCNTR ELSE 0 END OTCNTR, TRADETYPE, GOODSNAME,
|
|
FEESTATUS,ETD AS OPDATE,CUSTOMDATE,ENTERP,PKGS,CBM,BLFRT,SALEDEPT,CUSTOMSNUM,INVNO,'' BSCUSTOMNO,
|
|
INSPECTIONDATE,INSPECTIONNO,CONTRACTNO,''BOOKNO,AGENTID,ISPRINTPR,NUMBERPLATE,0 FEEKGS,OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,APPLYNO,ISSUETYPE,BLISSUESTATUS,REMARK,TRADETERM,PLACERECEIPT,DESTINATION,CNTRSEALNO,BillFeeStatus,ISVOU,VOUNO,DESTINATIONID,SALECORPID,YARD,TIHUOTIME DELIVERYDATE,FRCUSTSERVICE,SERVICE,REMARK2,BILLFEESTATUSTIME,TRUCKER,CUSTOMSER,null CLOSINGDATE,KINDPKGS,CARGOID,DCLASS
|
|
FROM dbo.op_seai WITH (NOLOCK)
|
|
UNION ALL
|
|
SELECT BSNO,MASTERNO, 'op_aire' AS OPLB, '¿ÕÔ˳ö¿Ú' AS OPLBNAME,'¿ÕÔ˳ö¿Ú' AS BSTYPE, CUSTOMERNAME, CUSTNO,ORDERNO,MBLNO, HBLNO,dbo.trimtime(ETD) ETD,dbo.trimtime(ETA) ETA
|
|
,dbo.trimdate(STLDATE) STLDATE,STLNAME STLNAME, VESSEL,'' VOYNO, INPUTBY,BLTYPE,
|
|
CREATETIME, BSSTATUS, SALE , OP ,'' DOC, CUSTSERVICE, PORTLOAD, PORTDISCHARGE, CUSTOMNO,
|
|
ACCDATE,AIRLINES CARRIER, BSSOURCE,BSSOURCEDETAIL,LANE, FORWARDER, FEEKGS AS NETWEIGHT, KGS,0 TEU,'' CNTRTOTAL,
|
|
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE, GOODSNAME,
|
|
FEESTATUS,ETD AS OPDATE,CUSTOMDATE,'' ENTERP,PKGS,CBM ,BLFRT,SALEDEPT,CUSTOMSNUM,INVNO,'' BSCUSTOMNO,
|
|
INSPECTIONDATE,INSPECTIONNO,CONTRACTNO,'' BOOKNO,AGENTID,ISPRINTPR,'' as NUMBERPLATE,FEEKGS,OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,BillFeeStatus,ISVOU,VOUNO,PORTDISCHARGE DESTINATIONID,SALECORPID,'' YARD,DELIVERYDATE,FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,TRUCKER,CUSTOMSER,null CLOSINGDATE,KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.op_aire WITH (NOLOCK)
|
|
UNION ALL
|
|
SELECT BSNO, MASTERNO,'op_airi' AS OPLB, '¿ÕÔ˽ø¿Ú' AS OPLBNAME,'¿ÕÔ˽ø¿Ú' AS BSTYPE, CUSTOMERNAME, CUSTNO,ORDERNO,MBLNO, HBLNO,dbo.trimtime(ETA) ETD,dbo.trimtime(ETA) ETA
|
|
,dbo.trimdate(STLDATE) STLDATE,STLNAME STLNAME, VESSEL,'' VOYNO, INPUTBY,BLTYPE,
|
|
CREATETIME, BSSTATUS, SALE ,OP ,'' DOC, CUSTSERVICE, PORTLOAD, PORTDISCHARGE,CUSTOMNO,
|
|
ACCDATE,AIRLINES CARRIER, BSSOURCE,BSSOURCEDETAIL,LANE, FORWARDER, FEEKGS AS NETWEIGHT, KGS,0 TEU,'' CNTRTOTAL,
|
|
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE, GOODSNAME,
|
|
FEESTATUS,ETA AS OPDATE,CUSTOMDATE,'' ENTERP,PKGS,CBM,BLFRT,SALEDEPT,CUSTOMSNUM,INVNO,'' BSCUSTOMNO,
|
|
INSPECTIONDATE,INSPECTIONNO,CONTRACTNO,'' BOOKNO,AGENTID,ISPRINTPR,'' as NUMBERPLATE,FEEKGS,OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,BillFeeStatus,ISVOU,VOUNO,PORTDISCHARGE DESTINATIONID,SALECORPID ,'' YARD,DELIVERYDATE,FRCUSTSERVICE,SERVICE,'' REMARK2,BILLFEESTATUSTIME,TRUCKER,CUSTOMSER,null CLOSINGDATE,KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.op_airi WITH (NOLOCK)
|
|
UNION ALL
|
|
SELECT BSNO, MASTERNO,'op_apply' AS OPLB, '±¨¹ØÒµÎñ' AS OPLBNAME,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=96004 and EnumValueID=OP_APPLY.BsType) as BSTYPE,CUSTOMERNAME, CUSTNO,'' ORDERNO, MBLNO, HBLNO, CUSTOMDATE as ETD,'' ETA
|
|
,'' STLDATE,'' STLNAME, VESSEL, VOYNO, INPUTBY,CUSTOMTYPE BLTYPE,
|
|
BSDATE AS CREATETIME, BSSTATUS, SALE, OP, OP AS DOC,'' AS CUSTSERVICE, PORTLOAD, PORTDISCHARGE, CUSTOMNO,
|
|
ACCDATE,'' CARRIER, BSSOURCE,BSSOURCEDETAIL,'' LANE,'' FORWARDER, NETWEIGHT, KGS,TEU,'' CNTRTOTAL,
|
|
CORPID,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
|
|
FEESTATUS,OPDATE,CUSTOMDATE,ENTERP,PKGS,CBM,'' BLFRT,SALEDEPT,CUSTOMSNUM,INVNO,BSCUSTOMNO,
|
|
INSPECTIONDATE,INSPECTIONNO,CONTRACTNO,BOOKNO,'' AGENTID,ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,BillFeeStatus,ISVOU,VOUNO,PORTDISCHARGE DESTINATIONID,SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,CUSTOMSER,null CLOSINGDATE,KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.op_apply WITH (NOLOCK)
|
|
UNION ALL
|
|
SELECT BSNO, BSNO MASTERNO,'op_other' AS OPLB, '×ÛºÏÒµÎñ' AS OPLBNAME,TRANSTYPE as BSTYPE,CUSTOMERNAME, CUSTNO,ORDERNO, MBLNO, HBLNO, ETD,'' ETA
|
|
,dbo.trimdate(STLDATE) STLDATE,STLNAME STLNAME, VESSEL, VOYNO,OP AS INPUTBY,'' BLTYPE,
|
|
BSDATE AS CREATETIME, BSSTATUS, SALE, OP, OP AS DOC,'' AS CUSTSERVICE, PORTLOAD, PORTDISCHARGE,'' CUSTOMNO,
|
|
ACCDATE,'' CARRIER, BSSOURCE,BSSOURCEDETAIL,'' LANE,'' FORWARDER, NETWEIGHT, KGS,0 TEU,'' CNTRTOTAL,
|
|
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
|
|
FEESTATUS,ETD AS OPDATE,'' CUSTOMDATE,ENTERP,PKGS,CBM,'' BLFRT,SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
|
|
'' INSPECTIONDATE,'' INSPECTIONNO,CONTRACTNO,BOOKNO,'' AGENTID,ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,BillFeeStatus ,ISVOU,VOUNO,PORTDISCHARGE DESTINATIONID,SALECORPID,'' YARD,'' DELIVERYDATE,FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,CUSTOMSER,null CLOSINGDATE,KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.op_other WITH (NOLOCK)
|
|
UNION ALL
|
|
SELECT BSNO,BSNO MASTERNO, 'op_bulk' AS OPLB, '´ó×ÚÉ¢»õ' AS OPLBNAME,TRANSTYPE as BSTYPE,CUSTOMERNAME, CUSTNO,ORDERNO,'' MBLNO,'' HBLNO,dbo.trimtime(ETD) ETD,dbo.trimtime(ETA) ETA
|
|
,dbo.trimdate(STLDATE) STLDATE,STLNAME STLNAME,'' VESSEL,'' VOYNO,OP AS INPUTBY,'' BLTYPE,
|
|
BSDATE AS CREATETIME, BSSTATUS, SALE, OP, OP AS DOC,'' AS CUSTSERVICE, PORTLOAD, PORTDISCHARGE,'' CUSTOMNO,
|
|
ACCDATE,'' CARRIER, BSSOURCE,BSSOURCEDETAIL,'' LANE,'' FORWARDER, 0 AS NETWEIGHT, KGS,0 TEU,'' CNTRTOTAL,
|
|
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
|
|
FEESTATUS,ETD AS OPDATE,'' CUSTOMDATE,'' ENTERP,PKGS,CBM,'' BLFRT,SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
|
|
'' INSPECTIONDATE,'' INSPECTIONNO,'' CONTRACTNO,'' BOOKNO,'' AGENTID,ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO ,BillFeeStatus ,ISVOU,VOUNO,'' DESTINATIONID,'' SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.op_bulk WITH (NOLOCK)
|
|
UNION ALL
|
|
SELECT ContractNo AS BSNO, ContractNo MASTERNO,'import_main' AS OPLB, '½ø¿ÚóÒ×' AS OPLBNAME,'½ø¿ÚóÒ×' AS BSTYPE, buyer AS CUSTOMERNAME, HTH AS CUSTNO,Supplier_Billno+' '+Other_Billno ORDERNO, billno as MblNo, M.ContainerNo AS HBLNO, dbo.trimdate(Arrivaldate) AS ETD,dbo.trimtime(M.ArrivalDate) ETA
|
|
,'' STLDATE,'' STLNAME, VESSEL,voyage as VOYNO, (select showname from [user] where codename=creator) AS INPUTBY,'' BLTYPE,
|
|
CREATTIME as CREATETIME,isnull(BSSTATUS,0) AS BSSTATUS, (select showname from [user] where codename=creator) AS SALE, OP AS OP, 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,
|
|
case when isnull(ACCDATE,'')='' then '' else dbo.trimdate(ACCDATE) end ACCDATE ,
|
|
'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,'' LANE,'' FORWARDER, 0 AS NETWEIGHT,0 KGS,0 TEU,'' CNTRTOTAL,
|
|
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
|
|
isnull(FEESTATUS,0) FEESTATUS,Arrivaldate AS OPDATE,'' CUSTOMDATE,'' ENTERP,0 PKGS,0 CBM,'' BLFRT,'' SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
|
|
'' INSPECTIONDATE,'' INSPECTIONNO,CONTRACTNO,'' BOOKNO,'' AGENTID,'' ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,'',ISVOU,'' VOUNO ,'' DESTINATIONID,M.company SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,null BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.import_main M WITH (NOLOCK)
|
|
UNION ALL
|
|
SELECT BSNO,MASTERNO, 'op_railway' AS OPLB, 'Ìú·ÔËÊä' AS OPLBNAME,'Ìú·ÔËÊä' as BSTYPE,CUSTOMERNAME, CUSTNO,ORDERNO,MBLNO,HBLNO,SETOUTDATE ETD,'' ETA
|
|
,dbo.trimdate(STLDATE) STLDATE,STLNAME STLNAME,'' VESSEL,'' VOYNO,OP AS INPUTBY,'' BLTYPE,
|
|
BSDATE AS CREATETIME, BSSTATUS, SALE, OP,'' DOC,CUSTSERVICE, PLACELOAD,DESTINATIONENAME AS PORTDISCHARGE,'' CUSTOMNO,
|
|
ACCDATE,'' CARRIER, BSSOURCE,BSSOURCEDETAIL,'' LANE,'' FORWARDER, 0 AS NETWEIGHT, KGS,0 TEU,'' CNTRTOTAL,
|
|
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
|
|
FEESTATUS,SETOUTDATE AS OPDATE,'' CUSTOMDATE,'' ENTERP,PKGS,CBM,'' BLFRT,SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
|
|
'' INSPECTIONDATE,'' INSPECTIONNO,'' CONTRACTNO,'' BOOKNO ,'' AGENTID,ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,PLACERECEIPT,DESTINATION,'' CNTRSEALNO ,BillFeeStatus,ISVOU,VOUNO,DESTINATIONENAME DESTINATIONID,'' SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.op_railway WITH (NOLOCK)
|
|
UNION ALL
|
|
SELECT GId BSNO,GId MASTERNO, 'tMsWlPcHead' AS OPLB, '½ÔËÅɳµµ¥' AS OPLBNAME,'½ÔËÅɳµµ¥' as BSTYPE,CUSTOMERNAME,Billno CUSTNO,'' ORDERNO,MBLNO MBLNO,'' HBLNO,dbo.trimdate(ExpDate) ETD,dbo.trimdate(RtnDocTime) ETA
|
|
,'' STLDATE,'' STLNAME,TruckNo VESSEL,(select top 1 DrvName from tMsWlDriver where DrvCode=dbo.tMsWlPcHead.DrvCode) VOYNO,(select top 1 showname from [user] where CODENAME=DdCode) INPUTBY, BLTYPE,
|
|
'' CREATETIME,BillStatus BSSTATUS,SalesName SALE,case isnull(UserName,'') when '' then (select top 1 showname from [user] where CODENAME=DdCode) else UserName end OP,'' DOC,'' CUSTSERVICE,LoadPlace PLACELOAD,DstArea PORTDISCHARGE,'' CUSTOMNO,
|
|
case when dbo.trimdate(ExpDate)<>'' then LEFT(dbo.trimdate(ExpDate),7) else '' end ACCDATE ,'' CARRIER,'' BSSOURCE,'' BSSOURCEDETAIL,'' LANE,'' FORWARDER, 0 AS NETWEIGHT,0 KGS,0 TEU,
|
|
(select top 1 Ctn from code_ctn where CtnId=dbo.tMsWlPcHead.ContainerType)+'*'+convert(varchar(20),dbo.tMsWlPcHead.ContainerQty) CNTRTOTAL,
|
|
(select top 1 GID from company where codename=dbo.tMsWlPcHead.orgcode) CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
|
|
FEESTATUS,dbo.trimdate(ExpDate) OPDATE,'' CUSTOMDATE,'' ENTERP,0 PKGS,0 CBM,'' BLFRT,'' SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
|
|
'' INSPECTIONDATE,'' INSPECTIONNO,'' CONTRACTNO,'' BOOKNO,'' AGENTID,ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,RtnDocStatus BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO ,BillFeeStatus ,ISVOU,VOUNO,DstArea DESTINATIONID,'' SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.tMsWlPcHead WITH (NOLOCK)
|
|
UNION ALL
|
|
SELECT F_NO AS BSNO,F_NO MASTERNO, 'import_finance' AS OPLB, 'óÒ×ÈÚ×Ê' AS OPLBNAME,'óÒ×ÈÚ×Ê' AS BSTYPE, CUSTOMER AS CUSTOMERNAME, F_NO AS CUSTNO,f.HTH ORDERNO, F.Billno MblNo,'' HBLNO, STARTDATE AS ETD,'' ETA
|
|
,'' STLDATE,'' STLNAME,'' VESSEL,'' VOYNO, (select showname from [user] where gid=M.OP) AS INPUTBY,'' BLTYPE,
|
|
ENTERDATE as CREATETIME, 0 BSSTATUS, '' AS SALE, (select showname from [user] where gid=M.OP) AS OP, '' DOC, '' AS CUSTSERVICE,'' AS PORTLOAD, '' AS PORTDISCHARGE, '' AS CUSTOMNO,
|
|
case when isnull(STARTDATE,'')='' then '' else dbo.trimdate(STARTDATE) end ACCDATE ,
|
|
'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,'' LANE,'' FORWARDER, 0 AS NETWEIGHT,0 KGS,0 TEU,'' CNTRTOTAL,
|
|
'' CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
|
|
0 FEESTATUS,STARTDATE AS OPDATE,'' CUSTOMDATE,'' ENTERP,0 PKGS,0 CBM,'' BLFRT,'' SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
|
|
'' INSPECTIONDATE,'' INSPECTIONNO,CONTRACTNO,'' BOOKNO,'' AGENTID,'' ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,'' REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO ,'' ,M.ISVOU,'' VOUNO ,'' DESTINATIONID,'' SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,null BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.IMPORT_FINANCE M WITH (NOLOCK)
|
|
left join [dbo].[Import_main] f on (f.ContractNo=M.MAINNO)
|
|
UNION ALL
|
|
SELECT ASSOCIATEDNO AS BSNO,ASSOCIATEDNO MASTERNO, 'WMS' AS OPLB, '²Ö´¢ÒµÎñ' AS OPLBNAME,'²Ö´¢ÒµÎñ' AS BSTYPE, CUSTOMERNAME, WMSNO AS CUSTNO,WMSNO ORDERNO, BLNO MblNo,'' HBLNO, WMSDATE AS ETD,'' ETA
|
|
,'' STLDATE,'' STLNAME,'' VESSEL,'' VOYNO,(select top 1 showname from [user] where gid= createuser) AS INPUTBY,'' BLTYPE,
|
|
CREATETIME as CREATETIME, 0 BSSTATUS, '' AS SALE, (select top 1 showname from [user] where gid=MODIFIEDUSER) AS OP, '' DOC, '' AS CUSTSERVICE,'' AS PORTLOAD, '' AS PORTDISCHARGE, '' AS CUSTOMNO,
|
|
case when isnull(WMSDATE,'')='' then '' else dbo.trimdate(WMSDATE) end ACCDATE ,
|
|
'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,'' LANE,'' FORWARDER, 0 AS NETWEIGHT,0 KGS,0 TEU,'' CNTRTOTAL,
|
|
'' CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
|
|
FEESTATUS,WMSDATE AS OPDATE,'' CUSTOMDATE,'' ENTERP,0 PKGS,0 CBM,'' BLFRT,'' SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
|
|
'' INSPECTIONDATE,'' INSPECTIONNO,CONTRACTNO,'' BOOKNO,'' AGENTID,'' ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,'' REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO ,BillFeeStatus,ISVOU,VOUNO ,'' DESTINATIONID,'' SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.WMS WITH (NOLOCK) where ASSOCIATEDNO=gid
|
|
UNION ALL
|
|
SELECT GID AS BSNO, GID MASTERNO,'WMS_IN' AS OPLB, '²Ö´¢Èë¿â' AS OPLBNAME,'²Ö´¢Èë¿â' AS BSTYPE, CUSTOMERNAME, WMSNO AS CUSTNO,WMSNO ORDERNO, BLNO MblNo,'' HBLNO, WMSDATE AS ETD,'' ETA
|
|
,'' STLDATE,'' STLNAME,'' VESSEL,'' VOYNO,WMSOP AS INPUTBY,'' BLTYPE,
|
|
CREATETIME as CREATETIME, 0 BSSTATUS, '' AS SALE, (select top 1 showname from [user] where gid=WMS.MODIFIEDUSER) AS OP, '' DOC, '' AS CUSTSERVICE,'' AS PORTLOAD, '' AS PORTDISCHARGE, CUSTOMNO, ACCDATE ,
|
|
'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,'' LANE,'' FORWARDER, 0 AS NETWEIGHT,0 KGS,0 TEU,'' CNTRTOTAL,
|
|
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,GOODSNAME,
|
|
FEESTATUS,WMSDATE AS OPDATE,'' CUSTOMDATE,'' ENTERP,0 PKGS,0 CBM,'' BLFRT,'' SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
|
|
'' INSPECTIONDATE,'' INSPECTIONNO,CONTRACTNO,'' BOOKNO,'' AGENTID,'' ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO ,BillFeeStatus,ISVOU,VOUNO,'' DESTINATIONID,'' SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.WMS WITH (NOLOCK) where ASSOCIATEDNO<>gid
|
|
UNION ALL
|
|
SELECT GID AS BSNO,GID MASTERNO, 'WMS_OUT' AS OPLB, '²Ö´¢³ö¿â' AS OPLBNAME,'²Ö´¢³ö¿â' AS BSTYPE, CUSTOMERNAME, BSNO AS CUSTNO,BSNO as ORDERNO, ISNULL(
|
|
(select top 1 BLNO from wms where gid = (select top 1 inbsno from wms_out_detail where outbsno = wms_out.bsno)),
|
|
(select top 1 BLNO from wms where gid = (select top 1 ASSOCIATEDNO from wms_in where gid = (select top 1 inbsno from wms_out_detail where outbsno = wms_out.bsno)))) MblNo,'' HBLNO, DODATE AS ETD,'' ETA
|
|
,'' STLDATE,'' STLNAME,'' VESSEL,'' VOYNO,WMSOP AS INPUTBY,'' BLTYPE,
|
|
CREATETIME as CREATETIME, 0 BSSTATUS, '' AS SALE, (select top 1 showname from [user] where gid=wms_out.MODIFIEDUSER) AS OP, '' DOC, '' AS CUSTSERVICE,'' AS PORTLOAD, '' AS PORTDISCHARGE, CUSTOMNO, ACCDATE ,
|
|
'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,'' LANE,'' FORWARDER, 0 AS NETWEIGHT,0 KGS,0 TEU,'' CNTRTOTAL,
|
|
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,GOODSNAME,
|
|
FEESTATUS,DODATE AS OPDATE,'' CUSTOMDATE,'' ENTERP,0 PKGS,0 CBM,'' BLFRT,'' SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
|
|
'' INSPECTIONDATE,'' INSPECTIONNO,'' CONTRACTNO,'' BOOKNO,'' AGENTID,'' ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO ,BillFeeStatus ,ISVOU,VOUNO ,'' DESTINATIONID,'' SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.wms_out WITH (NOLOCK)
|
|
UNION ALL
|
|
SELECT b.BSNO,b.BSNO MASTERNO, 'op_airn' AS OPLB, '¹úÄÚ¿ÕÔË' AS OPLBNAME,'¹úÄÚ¿ÕÔË' AS BSTYPE, CUSTOMERNAME, CUSTNO,ORDERNO,MBLNO, HBLNO,dbo.trimtime(ETD) ETD,dbo.trimtime(ETA) ETA
|
|
,dbo.trimdate(STLDATE) STLDATE,STLNAME STLNAME, VESSEL,'' VOYNO, INPUTBY,BLTYPE,
|
|
CREATETIME, BSSTATUS, SALE , OP ,'' DOC, CUSTSERVICE, PORTLOAD, PORTDISCHARGE, '' AS CUSTOMNO,
|
|
ACCDATE,AIRLINES CARRIER, BSSOURCE,BSSOURCEDETAIL,'' LANE, FORWARDER
|
|
,(case b.BLTYPE when '¹úÄÚ·Öµ¥' then c.[WEIGHT] else d.[WEIGHT] end) AS NETWEIGHT
|
|
,(case b.BLTYPE when '¹úÄÚ·Öµ¥' then c.[WEIGHT] else d.[WEIGHT] end) KGS,0 TEU,'' CNTRTOTAL,
|
|
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE
|
|
,c.CARGONAME GOODSNAME,
|
|
FEESTATUS,ETD AS OPDATE,'' AS CUSTOMDATE,'' ENTERP
|
|
,(case b.BLTYPE when '¹úÄÚ·Öµ¥' then c.BOXCOUNT else d.BOXCOUNT end) PKGS
|
|
,(case b.BLTYPE when '¹úÄÚ·Öµ¥' then c.CBM else d.CBM end) CBM
|
|
,BLFRT,SALEDEPT,CUSTOMSNUM,INVNO,'' BSCUSTOMNO,
|
|
INSPECTIONDATE,INSPECTIONNO,CONTRACTNO,'' BOOKNO,AGENTID,ISPRINTPR,'' as NUMBERPLATE
|
|
,(case b.BLTYPE when '¹úÄÚ·Öµ¥' then c.[WEIGHT] else d.[WEIGHT] end) FEEKGS,OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO ,BillFeeStatus ,ISVOU,VOUNO,PORTDISCHARGE DESTINATIONID,'' SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,TRUCKER,CUSTOMSER,null CLOSINGDATE,KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.op_airn b WITH (NOLOCK)
|
|
left join OP_AIRN_CARGO C on b.BLTYPE='¹úÄÚ·Öµ¥' and c.bsno = B.bsno
|
|
left join OP_AIRN_CARGO D on b.BLTYPE='¹úÄÚÖ÷µ¥' and c.bsno =(select top 1 bsno from OP_AIRN where HBLNO=b.HBLNO and BLTYPE='¹úÄÚ·Öµ¥')
|
|
UNION ALL
|
|
SELECT BSNO, BSNO MASTERNO,'op_truck_bulk' AS OPLB, CASE WHEN TRANSTYPE='ÆÕÔË' THEN '½ÔËÆÕ»õ¶©µ¥' ELSE '½Ô˼¯Ô˶©µ¥' END AS OPLBNAME,CASE WHEN TRANSTYPE='ÆÕÔË' THEN '½ÔËÆÕ»õ¶©µ¥' ELSE '½Ô˼¯Ô˶©µ¥' END as BSTYPE,CUSTOMERNAME, CUSTNO,ORDERNO,ORDERNO MBLNO,ORDERNO HBLNO, ETD,ETA
|
|
,STLDATE,STLNAME,'' VESSEL,'' VOYNO,OP AS INPUTBY,'' BLTYPE,
|
|
CREATETIME, BSSTATUS, SALE, OP, DDOP AS DOC,CUSTSERVICE, PORTLOAD, PORTDISCHARGE,'' CUSTOMNO,
|
|
ACCDATE,'' CARRIER, BSSOURCE,BSSOURCEDETAIL,'' LANE,'' FORWARDER, NETWEIGHT, KGS,0 TEU,'' CNTRTOTAL,
|
|
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,GOODSNAME,
|
|
FEESTATUS,ETD AS OPDATE,'' CUSTOMDATE,'' ENTERP,PKGS,CBM,'' BLFRT,'' SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
|
|
'' INSPECTIONDATE,'' INSPECTIONNO,CONTRACTNO,'' BOOKNO,'' AGENTID,ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,BillFeeStatus ,ISVOU,VOUNO,PORTDISCHARGE DESTINATIONID,SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.op_truck_bulk WITH (NOLOCK)
|
|
UNION ALL
|
|
SELECT BSNO,BSNO MASTERNO, 'op_truck_bulk_pc' AS OPLB, CASE WHEN TRANSTYPE='ÆÕÔË' THEN '½ÔËÆÕ»õÅɳµ' ELSE '½Ô˼¯ÔËÅɳµ' END AS OPLBNAME,CASE WHEN TRANSTYPE='ÆÕÔË' THEN '½ÔËÆÕ»õÅɳµ' ELSE '½Ô˼¯ÔËÅɳµ' END as BSTYPE,CUSTOMERNAME, CUSTNO,'' ORDERNO,'' MBLNO,'' HBLNO, ETD,ETA
|
|
,STLDATE,STLNAME,'' VESSEL,'' VOYNO,OP AS INPUTBY,'' BLTYPE,
|
|
CREATETIME, BSSTATUS,'' SALE, OP, DDOP AS DOC,'' CUSTSERVICE, PORTLOAD, PORTDISCHARGE,'' CUSTOMNO,
|
|
ACCDATE,'' CARRIER, BSSOURCE,BSSOURCEDETAIL,'' LANE,'' FORWARDER, NETWEIGHT, KGS,0 TEU,'' CNTRTOTAL,
|
|
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
|
|
FEESTATUS,ETD AS OPDATE,'' CUSTOMDATE,'' ENTERP,PKGS,CBM,'' BLFRT,'' SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
|
|
'' INSPECTIONDATE,'' INSPECTIONNO,CONTRACTNO,'' BOOKNO,'' AGENTID,ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,BillFeeStatus ,ISVOU,VOUNO,PORTDISCHARGE DESTINATIONID,SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.op_truck_bulk_pc WITH (NOLOCK)
|
|
UNION ALL
|
|
SELECT BSNO,BSNO MASTERNO, 'op_ctnmng' AS OPLB, '¼¯×°Ïä¹ÜÀí' AS OPLBNAME,BLTYPE as BSTYPE,CUSTOMERNAME,CUSTNO,'' ORDERNO, MBLNO,'' HBLNO,BSDATE ETD,ETD ETA
|
|
,'' STLDATE,'' STLNAME, VESSEL, VOYNO,OP AS INPUTBY,BLTYPE BLTYPE,
|
|
BSDATE AS CREATETIME, BSSTATUS, SALE, OP, OP AS DOC,'' AS CUSTSERVICE, PORTLOAD, PORTDISCHARGE,'' CUSTOMNO,
|
|
ACCDATE,'' CARRIER, BSSOURCE,BSSOURCEDETAIL,'' LANE,'' FORWARDER,0 NETWEIGHT,0 KGS,TEU, CNTRTOTAL,
|
|
CORPID,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
|
|
FEESTATUS,ETD AS OPDATE,'' CUSTOMDATE,'' ENTERP,0 PKGS,0 CBM,'' BLFRT,'' SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
|
|
'' INSPECTIONDATE,'' INSPECTIONNO,'' CONTRACTNO,'' BOOKNO,'' AGENTID,'' ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,BillFeeStatus ,0 ISVOU,'' VOUNO,PORTDISCHARGE DESTINATIONID,SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.op_ctnmng WITH (NOLOCK)
|
|
UNION ALL
|
|
|
|
SELECT BSNO,BSNO MASTERNO, 'op_InternalTrade' AS OPLB, 'ÄÚóº£Ô˹ÜÀí' AS OPLBNAME,'ÕûÏä' as BSTYPE,CUSTOMERNAME,CUSTNO,'' ORDERNO, MBLNO,'' HBLNO,dbo.trimdate(ETD) ETD,dbo.trimdate(ETA) ETA
|
|
,dbo.trimdate( STLDATE) STLDATE,STLNAME, VESSEL, VOYNO,OP AS INPUTBY,'ÕûÏä' BLTYPE,
|
|
BSDATE AS CREATETIME, BSSTATUS, (select showname from [user] where gid=SALE ) SALE, OP, OP AS DOC, CUSTSERVICE, PORTLOADID+'_'+PORTLOAD PORTLOAD, PORTDISCHARGEID+'_'+PORTDISCHARGE PORTDISCHARGE,'' CUSTOMNO,
|
|
ACCDATE,CARRIER, BSSOURCE,BSSOURCEDETAIL,'' LANE,'' FORWARDER,0 NETWEIGHT,0 KGS,0 TEU,'' CNTRTOTAL,
|
|
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
|
|
FEESTATUS,ETD AS OPDATE,'' CUSTOMDATE,'' ENTERP,0 PKGS,0 CBM,'' BLFRT, SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
|
|
'' INSPECTIONDATE,'' INSPECTIONNO,'' CONTRACTNO,'' BOOKNO,'' AGENTID,'' ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS, OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,isnull(PORTLOADREMARK,'')+';;'+isnull(VIA_MARK,'') remark,'' TRADETERM,'' PLACERECEIPT,PlACERECEIPT DESTINATION,SEALNO CNTRSEALNO
|
|
,BillFeeStatus ,0 ISVOU,'' VOUNO,PORTDISCHARGE DESTINATIONID,CORPID SALECORPID,'' YARD,dbo.trimtime(DELIVERYDATE) DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.op_InternalTrade WITH (NOLOCK)
|
|
union all
|
|
SELECT Convert(varchar(36),WMSDOID) BSNO,Convert(varchar(36),WMSDOID) MASTERNO, 'OP_WMS_IN_DO' AS OPLB, 'Èë¿âÖ´ÐÐ' AS OPLBNAME,'²Ö´¢ÒµÎñ' AS BSTYPE, CUSTOMERNAME,BSNO CUSTNO,BSNO ORDERNO,MBLNO,'' HBLNO,dbo.trimtime(DODATE) ETD,dbo.trimtime(DODATE) ETA
|
|
,null STLDATE,null STLNAME,'' VESSEL,'' VOYNO, Creator,'Èë¿âÖ´ÐÐ' BLTYPE,
|
|
CreateDate CREATETIME, BSSTATUS,'' SALE ,(select SHOWNAME from vw_user where USERID=CreateID ) OP ,'' DOC,'' CUSTSERVICE,'' PORTLOAD,'' PORTDISCHARGE,'' CUSTOMNO,
|
|
CONVERT(VARCHAR(7),DODATE,120) ACCDATE,'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,''LANE,'' FORWARDER, KGS AS NETWEIGHT, KGS,0 TEU,'' CNTRTOTAL,
|
|
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE, GOODSNAME,
|
|
FEESTATUS,DODATE AS OPDATE,DODATE CUSTOMDATE,'' ENTERP,PKGS,CBM ,''BLFRT,''SALEDEPT,''CUSTOMSNUM,''INVNO,'' BSCUSTOMNO,
|
|
''INSPECTIONDATE,''INSPECTIONNO,''CONTRACTNO,'' BOOKNO,''AGENTID,''ISPRINTPR,'' as NUMBERPLATE,KGS FEEKGS,Creator OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,FEESTATUS BillFeeStatus,0 ISVOU, '' VOUNO,'' DESTINATIONID,CORPID SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,'' BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.VW_OP_WMS_IN_DO
|
|
union all
|
|
SELECT Convert(varchar(36),OP_WMS_OUT_DO_BSNO.GID) BSNO,Convert(varchar(36),WMSDOID) MASTERNO, 'OP_WMS_OUT_DO' AS OPLB, '³ö¿âÃ÷ϸ' AS OPLBNAME,'²Ö´¢ÒµÎñ' AS BSTYPE, CUSTOMERNAME,WMSNO CUSTNO,WMSNO ORDERNO,OP_WMS_OUT_DO.MBLNO,'' HBLNO,dbo.trimtime(DODATE) ETD,dbo.trimtime(DODATE) ETA
|
|
,null STLDATE,null STLNAME,'' VESSEL,OP_WMS_OUT_DO.TRUCKNO VOYNO, Creator,'³ö¿âÃ÷ϸ' BLTYPE,
|
|
CreateDate CREATETIME, BSSTATUS,'' SALE ,Creator OP ,'' DOC,'' CUSTSERVICE,'' PORTLOAD,'' PORTDISCHARGE,'' CUSTOMNO,
|
|
CONVERT(VARCHAR(7),DODATE,120) ACCDATE,'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,''LANE,'' FORWARDER, isnull((select sum(kgs) from OP_WMS_OUT_DO_GOODS where WMSDOID=OP_WMS_OUT_DO.WMSDOID),0) AS NETWEIGHT, isnull((select sum(kgs) from OP_WMS_OUT_DO_GOODS where WMSDOID=OP_WMS_OUT_DO.WMSDOID),0) KGS,0 TEU,'' CNTRTOTAL,
|
|
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
|
|
FEESTATUS,DODATE AS OPDATE,DODATE CUSTOMDATE,'' ENTERP, isnull((select sum(PKGS) from OP_WMS_OUT_DO_GOODS where WMSDOID=OP_WMS_OUT_DO.WMSDOID),0)PKGS, isnull((select sum(CBM) from OP_WMS_OUT_DO_GOODS where WMSDOID=OP_WMS_OUT_DO.WMSDOID),0) CBM ,''BLFRT,''SALEDEPT,''CUSTOMSNUM,''INVNO,'' BSCUSTOMNO,
|
|
''INSPECTIONDATE,''INSPECTIONNO,''CONTRACTNO,'' BOOKNO,''AGENTID,''ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,Creator OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,FEESTATUS BillFeeStatus,0 ISVOU, '' VOUNO,'' DESTINATIONID,CORPID SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,'' BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.OP_WMS_OUT_DO_BSNO left join dbo.OP_WMS_OUT_DO on OP_WMS_OUT_DO.WMSDOID=OP_WMS_OUT_DO_BSNO.BSNO
|
|
|
|
union all
|
|
SELECT Convert(varchar(36),WMSDOID) BSNO,Convert(varchar(36),WMSDOID) MASTERNO, 'OP_WMS_OUT_DO' AS OPLB, '³ö¿â×÷Òµ' AS OPLBNAME,'²Ö´¢ÒµÎñ' AS BSTYPE, CUSTOMERNAME,WMSNO CUSTNO,WMSNO ORDERNO,OP_WMS_OUT_DO.MBLNO,'' HBLNO,dbo.trimtime(DODATE) ETD,dbo.trimtime(DODATE) ETA
|
|
,null STLDATE,null STLNAME,'' VESSEL,TRUCKNO VOYNO, Creator,'³ö¿â×÷Òµ' BLTYPE,
|
|
CreateDate CREATETIME, BSSTATUS,'' SALE ,Creator OP ,'' DOC,'' CUSTSERVICE,'' PORTLOAD,'' PORTDISCHARGE,'' CUSTOMNO,
|
|
CONVERT(VARCHAR(7),DODATE,120) ACCDATE,'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,''LANE,'' FORWARDER, isnull((select sum(kgs) from OP_WMS_OUT_DO_GOODS where WMSDOID=OP_WMS_OUT_DO.WMSDOID),0) AS NETWEIGHT, isnull((select sum(kgs) from OP_WMS_OUT_DO_GOODS where WMSDOID=OP_WMS_OUT_DO.WMSDOID),0) KGS,0 TEU,'' CNTRTOTAL,
|
|
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
|
|
FEESTATUS,DODATE AS OPDATE,DODATE CUSTOMDATE,'' ENTERP, isnull((select sum(PKGS) from OP_WMS_OUT_DO_GOODS where WMSDOID=OP_WMS_OUT_DO.WMSDOID),0)PKGS, isnull((select sum(CBM) from OP_WMS_OUT_DO_GOODS where WMSDOID=OP_WMS_OUT_DO.WMSDOID),0) CBM ,''BLFRT,''SALEDEPT,''CUSTOMSNUM,''INVNO,'' BSCUSTOMNO,
|
|
''INSPECTIONDATE,''INSPECTIONNO,''CONTRACTNO,'' BOOKNO,''AGENTID,''ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,Creator OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,FEESTATUS BillFeeStatus,0 ISVOU, '' VOUNO,'' DESTINATIONID,CORPID SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,'' BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.OP_WMS_OUT_DO
|
|
|
|
union all
|
|
SELECT Convert(varchar(36),D.WMSDUIDETAILID) BSNO,Convert(varchar(36),D.WMSDUIID) MASTERNO, 'OP_WMS_FEEDUI' AS OPLB, '²Ö´¢Ô½áÕ˵¥' AS OPLBNAME,'²Ö´¢ÒµÎñ' AS BSTYPE, D.CUSTOMERNAME,BSNO CUSTNO,BSNO ORDERNO,MBLNO,'' HBLNO,dbo.trimtime(D.STARTDATE) ETD,dbo.trimtime(D.ENDDATE) ETA
|
|
,null STLDATE,null STLNAME,'' VESSEL,'' VOYNO, Creator,'²Ö´¢Ô½á' BLTYPE,
|
|
CreateDate CREATETIME, BSSTATUS,'' SALE ,Creator OP ,'' DOC,'' CUSTSERVICE,'' PORTLOAD,'' PORTDISCHARGE,'' CUSTOMNO,
|
|
CONVERT(VARCHAR(7),D.ACCDATE,120) ACCDATE,'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,''LANE,'' FORWARDER,0 AS NETWEIGHT, 0 KGS,0 TEU,'' CNTRTOTAL,
|
|
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
|
|
FEESTATUS,D.ACCDATE AS OPDATE,D.ACCDATE CUSTOMDATE,'' ENTERP, 0 PKGS,0 CBM ,''BLFRT,''SALEDEPT,''CUSTOMSNUM,''INVNO,'' BSCUSTOMNO,
|
|
''INSPECTIONDATE,''INSPECTIONNO,''CONTRACTNO,'' BOOKNO,''AGENTID,''ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,h.REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,FEESTATUS BillFeeStatus,0 ISVOU, '' VOUNO,'' DESTINATIONID,CORPID SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,'' BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.OP_WMS_FEEDUI_STORAGE_DETAIL D left join OP_WMS_FEEDUI_STORAGE h on D.WMSDUIID=h.WMSDUIID
|
|
|
|
union all
|
|
SELECT Convert(varchar(36),WMSWEIGHID) BSNO,Convert(varchar(36),WMSWEIGHID) MASTERNO, 'OP_WMS_WEIGH' AS OPLB, '¹ý°õÒµÎñ' AS OPLBNAME,'²Ö´¢ÒµÎñ' AS BSTYPE, CUSTOMERNAME,BSNO CUSTNO,BSNO ORDERNO,MBLNO,'' HBLNO,DODATE ETD,DODATE ETA
|
|
,null STLDATE,null STLNAME,'' VESSEL,'' VOYNO, Creator,'¹ý°õÒµÎñ' BLTYPE,
|
|
CreateDate CREATETIME,'' BSSTATUS,'' SALE ,Creator OP ,'' DOC,'' CUSTSERVICE,'' PORTLOAD,'' PORTDISCHARGE,'' CUSTOMNO,
|
|
CONVERT(VARCHAR(7),DODATE,120) ACCDATE,'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,''LANE,'' FORWARDER,0 AS NETWEIGHT, 0 KGS,0 TEU,'' CNTRTOTAL,
|
|
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
|
|
'' FEESTATUS,DODATE AS OPDATE,DODATE CUSTOMDATE,'' ENTERP, 0 PKGS,0 CBM ,''BLFRT,''SALEDEPT,''CUSTOMSNUM,''INVNO,'' BSCUSTOMNO,
|
|
''INSPECTIONDATE,''INSPECTIONNO,''CONTRACTNO,'' BOOKNO,''AGENTID,''ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,'' BillFeeStatus,0 ISVOU, '' VOUNO,'' DESTINATIONID,CORPID SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,'' BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.OP_WMS_WEIGH
|
|
union all
|
|
SELECT Convert(varchar(36),WMSTRANSFERGOODSID) BSNO,Convert(varchar(36),WMSTRANSFERGOODSID) MASTERNO, 'OP_WMS_TRANSFERGOODS' AS OPLB, '»õתҵÎñ' AS OPLBNAME,'²Ö´¢ÒµÎñ' AS BSTYPE, NEWCUSTOMERNAME CUSTOMERNAME,BSNO CUSTNO,BSNO ORDERNO,(select MBLNO from op_wms where wmsid=(select top 1 WMSID from OP_WMS_TRANSFERGOODS_DETAIL where WMSTRANSFERGOODSID=OP_WMS_TRANSFERGOODS.WMSTRANSFERGOODSID))MBLNO,'' HBLNO,TRANSFERDATE ETD,TRANSFERDATE ETA
|
|
,null STLDATE,null STLNAME,'' VESSEL,'' VOYNO, Creator,'»õתҵÎñ' BLTYPE,
|
|
CreateDate CREATETIME,'' BSSTATUS,'' SALE ,Creator OP ,'' DOC,'' CUSTSERVICE,'' PORTLOAD,'' PORTDISCHARGE,'' CUSTOMNO,
|
|
CONVERT(VARCHAR(7),TRANSFERDATE,120) ACCDATE,'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,''LANE,'' FORWARDER,0 AS NETWEIGHT, 0 KGS,0 TEU,'' CNTRTOTAL,
|
|
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
|
|
'' FEESTATUS,TRANSFERDATE AS OPDATE,TRANSFERDATE CUSTOMDATE,'' ENTERP, 0 PKGS,0 CBM ,''BLFRT,''SALEDEPT,''CUSTOMSNUM,''INVNO,'' BSCUSTOMNO,
|
|
''INSPECTIONDATE,''INSPECTIONNO,''CONTRACTNO,'' BOOKNO,''AGENTID,''ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,'' BillFeeStatus,0 ISVOU, '' VOUNO,'' DESTINATIONID,CORPID SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,'' BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.OP_WMS_TRANSFERGOODS
|
|
union all
|
|
SELECT Convert(varchar(36),WMSDOID) BSNO,Convert(varchar(36),WMSDOID) MASTERNO, 'OP_WMS_MOVE' AS OPLB, 'ÒÆ¿âÒµÎñ' AS OPLBNAME,'²Ö´¢ÒµÎñ' AS BSTYPE, CUSTOMERNAME,BSNO CUSTNO,BSNO ORDERNO,(select MBLNO from OP_WMS where WMSID=OP_WMS_MOVE.WMSID) MBLNO,'' HBLNO,DODATE ETD,DODATE ETA
|
|
,null STLDATE,null STLNAME,'' VESSEL,'' VOYNO, Creator,'ÒÆ¿âÒµÎñ' BLTYPE,
|
|
CreateDate CREATETIME,'' BSSTATUS,'' SALE ,Creator OP ,'' DOC,'' CUSTSERVICE,'' PORTLOAD,'' PORTDISCHARGE,'' CUSTOMNO,
|
|
CONVERT(VARCHAR(7),DODATE,120) ACCDATE,'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,''LANE,'' FORWARDER,0 AS NETWEIGHT, 0 KGS,0 TEU,'' CNTRTOTAL,
|
|
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
|
|
'' FEESTATUS,DODATE AS OPDATE,DODATE CUSTOMDATE,'' ENTERP, 0 PKGS,0 CBM ,''BLFRT,''SALEDEPT,''CUSTOMSNUM,''INVNO,'' BSCUSTOMNO,
|
|
''INSPECTIONDATE,''INSPECTIONNO,''CONTRACTNO,'' BOOKNO,''AGENTID,''ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
|
|
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,'' BillFeeStatus,0 ISVOU, '' VOUNO,'' DESTINATIONID,CORPID SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,'' BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
|
|
FROM dbo.OP_WMS_MOVE
|
|
|
|
|
|
----------------------
|
|
GO
|
|
alter table OP_WMS_OUT_PLAN add ISOUTTRANSFER bit null default 'false'
|
|
GO
|
|
alter table OP_WMS_OUT_PLAN add STOREHOUSEENDDATE datetime null
|
|
GO
|
|
|
|
alter table OP_WMS_OUT_PLAN add PICKUPNAME varchar(50) null
|
|
GO
|
|
|
|
update OP_WMS_OUT_PLAN set ISOUTTRANSFER='false'
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_OUT_PLAN] AS SELECT [WMSPLANID]
|
|
,[WMSNO]
|
|
,[PLANTIME]
|
|
,[CUSTOMERNAME]
|
|
,[CORPID]
|
|
,[REMARK]
|
|
,[Creator]
|
|
,[CreateID]
|
|
,[CreateDate]
|
|
,[FEESTATUS]
|
|
,[BSSTATUS]
|
|
,[TIMEMARK]
|
|
,[ModifyDate]
|
|
,[ModifyID]
|
|
,[Modifier]
|
|
,[ISEND]
|
|
,[CUSTOMNO]
|
|
,GOODSNAME,GOODSFEETYPE
|
|
,dbo.[F_OUTPLANDETAIL_MBLNO](WMSPLANID) MBLNO,dbo.[F_OUTPLANDETAIL_CNTRNO](WMSPLANID) CNTRNO
|
|
,GOODSOWNER,ISOUTTRANSFER,STOREHOUSEENDDATE,PICKUPNAME
|
|
,(select sum(PKGS) from OP_WMS_OUT_PLAN_DETAIL where WMSPLANID=[OP_WMS_OUT_PLAN].WMSPLANID) PKGS
|
|
FROM [dbo].[OP_WMS_OUT_PLAN]
|
|
GO
|
|
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_OUT_DO] AS SELECT D.[WMSDOID]
|
|
,D.[WMSNO]
|
|
,D.[DODATE]
|
|
,D.[CUSTOMERNAME]
|
|
,D.[CORPID]
|
|
,D.[REMARK]
|
|
,D.[Creator]
|
|
,D.[CreateID]
|
|
,D.[CreateDate]
|
|
,D.[ModifyDate]
|
|
,D.[ModifyID]
|
|
,D.[Modifier]
|
|
,D.[ISEND]
|
|
,D.[FEESTATUS]
|
|
,D.[BSSTATUS]
|
|
,D.[BSSOURCE]
|
|
,D.[BILLSTATUS]
|
|
,D.[MBLNO]
|
|
,D.[CUSTOMNO_IMPORT]
|
|
,D.[PICKUPNAME]
|
|
,D.[TRUCKNO]
|
|
,D.[TRUCKMODEL]
|
|
,D.[WMSPLANID]
|
|
,D.[CUSTOMNO],dbo.F_OUTDODETAIL_CNTRNO(d.WMSDOID) CNTRNO
|
|
,D.GOODSNAME,D.GOODSFEETYPE,WEIGHING
|
|
,(select sum(PKGS) from OP_WMS_OUT_DO_GOODS where WMSDOID=D.WMSDOID) PKGS
|
|
,D.STLMODE
|
|
,P.ISOUTTRANSFER,P.STOREHOUSEENDDATE
|
|
FROM [dbo].[OP_WMS_OUT_DO] D left join OP_WMS_OUT_PLAN p on P.WMSPLANID=d.WMSPLANID
|
|
GO
|
|
|