|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE [dbo].[info_files] ADD [CORPID] varchar(50) COLLATE Chinese_PRC_CI_AS NULL
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[op_other] ADD [STLMODE] tinyint NULL
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS] ADD [FEERATESTARTDATE] datetime NULL
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS] ADD [WMSINDATE] datetime NULL
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_FEECALENDAR] DROP CONSTRAINT [PK_OP_WMS_FEECALENDAR]
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_FEECALENDAR] ALTER COLUMN [QUANTITY] numeric(22,6) NULL
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_FEECALENDAR] ADD [FEECALENDARID] uniqueidentifier NOT NULL
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_FEECALENDAR] DROP COLUMN [FEECALENDERID]
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_FEECALENDAR] ADD CONSTRAINT [PK_OP_WMS_FEECALENDAR] PRIMARY KEY CLUSTERED ([FEECALENDARID])
|
|
|
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
|
|
|
ON [PRIMARY]
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_FEEDUI_CUST_DETAIL] ALTER COLUMN [QUANTITY_DAY] numeric(22,6) NULL
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_FEEDUI_CUST_DETAIL] ALTER COLUMN [QUANTITY] numeric(22,6) NULL
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_FEEDUI_STORAGE_DETAIL] ALTER COLUMN [QUANTITY] numeric(22,6) NULL
|
|
|
GO
|
|
|
|
|
|
CREATE TABLE [dbo].[OP_WMS_GOODSFEETYPE] (
|
|
|
[GID] uniqueidentifier NOT NULL,
|
|
|
[GOODSFEETYPE] varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[STORAGEUNIT_TYPE] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[BILLBSNONAME] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[STORAGEBSNONAME] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[HIDEFIELD] varchar(1000) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[STORAGEBSNO_FIELDS] varchar(1000) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[MATERIALNO_NAME] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[GOODSCODE_NAME] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[GOODSHSCODE_NAME] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
CONSTRAINT [PK_OP_WMS_GOODSFEETYPE] PRIMARY KEY CLUSTERED ([GID])
|
|
|
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
|
|
|
ON [PRIMARY]
|
|
|
)
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_GOODSFEETYPE] SET (LOCK_ESCALATION = TABLE)
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_IN_PLAN] ADD [BILLSTATUS] varchar(20) COLLATE Chinese_PRC_CI_AS NULL
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_LOGIC] ADD [PID] uniqueidentifier NULL
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_MOVE] ADD [MBLNO] varchar(500) COLLATE Chinese_PRC_CI_AS NULL
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_MOVE] ADD [GOODSNAME] varchar(500) COLLATE Chinese_PRC_CI_AS NULL
|
|
|
GO
|
|
|
|
|
|
CREATE TABLE [dbo].[OP_WMS_MOVE_DETAIL] (
|
|
|
[WMSMOVEDETAILID] uniqueidentifier NOT NULL,
|
|
|
[WMSDOID] uniqueidentifier NOT NULL,
|
|
|
[WMSID] uniqueidentifier NULL,
|
|
|
[WMSPHYSICSID] uniqueidentifier NULL,
|
|
|
[WMSPHYSICSID_NEW] uniqueidentifier NULL,
|
|
|
[STOREHOUSE] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[AREACODE] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[STOREHOUSE_NEW] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[AREACODE_NEW] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[KGS] numeric(18,3) NULL,
|
|
|
[NETWEIGHT] decimal(18,3) NULL,
|
|
|
[CBM] numeric(18,3) NULL,
|
|
|
[PKGS] numeric(18,3) NULL,
|
|
|
[KINDPKGS] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[STORAGEUNIT] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[STORAGEUNITCOUNT] numeric(18,6) NULL,
|
|
|
[RULEUNIT] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[RULEUNITCOUNT] numeric(18,6) NULL,
|
|
|
[ModifyID] uniqueidentifier NULL,
|
|
|
[Modifier] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[ModifyDate] datetime NULL,
|
|
|
[CreateID] uniqueidentifier NULL,
|
|
|
[Creator] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[CreateDate] datetime NULL,
|
|
|
[OP] uniqueidentifier NULL,
|
|
|
CONSTRAINT [PK_OP_WMS_MOVE_DETAIL] PRIMARY KEY CLUSTERED ([WMSMOVEDETAILID])
|
|
|
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
|
|
|
ON [PRIMARY]
|
|
|
)
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_MOVE_DETAIL] SET (LOCK_ESCALATION = TABLE)
|
|
|
GO
|
|
|
|
|
|
EXEC sp_addextendedproperty
|
|
|
'MS_Description', N'<EFBFBD>ƿ<EFBFBD><EFBFBD><EFBFBD>ϸ
|
|
|
|
|
|
<20><><EFBFBD>ƿ<EFBFBD><C6BF>ķ<EFBFBD><C4B7>ʲ<EFBFBD>Ϊ<EFBFBD><CEAA> <20><>ʹ<EFBFBD><CAB9><EFBFBD>µķ<C2B5><C4B7>ʡ<EFBFBD>
|
|
|
|
|
|
',
|
|
|
'SCHEMA', N'dbo',
|
|
|
'TABLE', N'OP_WMS_MOVE_DETAIL'
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_OUT_DO] ADD [STLMODE] tinyint NULL
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_OUT_DO] DROP COLUMN [GOODSOWNER]
|
|
|
GO
|
|
|
|
|
|
CREATE TABLE [dbo].[OP_WMS_OUT_DO_BSNO] (
|
|
|
[GID] uniqueidentifier NOT NULL,
|
|
|
[BSNO] uniqueidentifier NOT NULL,
|
|
|
[MBLNO] varchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL,
|
|
|
CONSTRAINT [PK_OP_WMS_OUT_DO_BSNO] PRIMARY KEY CLUSTERED ([GID])
|
|
|
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
|
|
|
ON [PRIMARY]
|
|
|
)
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_OUT_DO_BSNO] SET (LOCK_ESCALATION = TABLE)
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_OUT_PLAN] ALTER COLUMN [WMSPLANID] uniqueidentifier NOT NULL
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_OUT_PLAN] ADD [BILLSTATUS] varchar(20) COLLATE Chinese_PRC_CI_AS NULL
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_OUT_PLAN] ADD CONSTRAINT [PK_OP_WMS_OUT_PLAN] PRIMARY KEY CLUSTERED ([WMSPLANID])
|
|
|
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
|
|
|
ON [PRIMARY]
|
|
|
GO
|
|
|
|
|
|
CREATE TABLE [dbo].[OP_WMS_OUT_PLAN_BEFORE] (
|
|
|
[WMSOUTPLANBEFOREID] uniqueidentifier NOT NULL,
|
|
|
[WMSNO] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[PLANTIME] date NULL,
|
|
|
[CUSTOMERNAME] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[CORPID] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[REMARK] varchar(400) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[Creator] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[CreateID] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[CreateDate] datetime NULL,
|
|
|
[FEESTATUS] bit NULL,
|
|
|
[BSSTATUS] bit NULL,
|
|
|
[ModifyDate] datetime NULL,
|
|
|
[ModifyID] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[Modifier] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[ISEND] bit NULL,
|
|
|
[CUSTOMNO] varchar(200) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[GOODSNAME] varchar(200) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[GOODSFEETYPE] varchar(200) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[GOODSOWNER] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[BILLSTATUS] varchar(20) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
CONSTRAINT [PK_OP_WMS_OUT_PLAN_BEFORE] PRIMARY KEY CLUSTERED ([WMSOUTPLANBEFOREID])
|
|
|
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
|
|
|
ON [PRIMARY]
|
|
|
)
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_OUT_PLAN_BEFORE] SET (LOCK_ESCALATION = TABLE)
|
|
|
GO
|
|
|
|
|
|
CREATE TABLE [dbo].[OP_WMS_REPORT_TIMEZONES] (
|
|
|
[REPORTID] uniqueidentifier NOT NULL,
|
|
|
[BSNO] varchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL,
|
|
|
[REPORTNAME] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[REPORTDATE] date NULL,
|
|
|
[CORPID] varchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL,
|
|
|
[STARTDATE] datetime NULL,
|
|
|
[ENDDATE] datetime NOT NULL,
|
|
|
[Creator] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[CreateDate] datetime NULL,
|
|
|
[CreateID] uniqueidentifier NULL,
|
|
|
[REMARK] varchar(500) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[REPORTTYPE] varchar(10) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[ISCHANGE] varchar(10) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[ISCLEAR] varchar(10) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[CUSTOMNO] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[MBLNO] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[GOODSFEETYPE] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[GOODSNAME] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[CUSTOMERNAME] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[GOODSOWNER] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[STOREHOUSE] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[AREACODE] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[GOODSTYPEGID] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
CONSTRAINT [PK_OP_WMS_REPORT_TIMEZONES] PRIMARY KEY CLUSTERED ([REPORTID])
|
|
|
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
|
|
|
ON [PRIMARY]
|
|
|
)
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_REPORT_TIMEZONES] SET (LOCK_ESCALATION = TABLE)
|
|
|
GO
|
|
|
|
|
|
CREATE TABLE [dbo].[OP_WMS_REPORT_TIMEZONES_DETAIL] (
|
|
|
[ID] int IDENTITY(1,1) NOT NULL,
|
|
|
[REPORTID] uniqueidentifier NOT NULL,
|
|
|
[WMSID] uniqueidentifier NOT NULL,
|
|
|
[PKGS] numeric(18,3) NULL,
|
|
|
[KGS] numeric(18,3) NULL,
|
|
|
[CBM] numeric(18,3) NULL,
|
|
|
[NETWEIGHT] numeric(18,3) NULL,
|
|
|
[STORAGEUNITCOUNT] numeric(22,6) NULL,
|
|
|
[RULEUNITCOUNT] numeric(18,3) NULL,
|
|
|
[PKGS2_1] numeric(18,3) NULL,
|
|
|
[KGS2_1] numeric(18,3) NULL,
|
|
|
[CBM2_1] numeric(18,3) NULL,
|
|
|
[NETWEIGHT2_1] numeric(18,3) NULL,
|
|
|
[STORAGEUNITCOUNT2_1] numeric(22,6) NULL,
|
|
|
[RULEUNITCOUNT2_1] numeric(18,3) NULL,
|
|
|
[PKGS2_2] numeric(18,3) NULL,
|
|
|
[KGS2_2] numeric(18,3) NULL,
|
|
|
[CBM2_2] numeric(18,3) NULL,
|
|
|
[NETWEIGHT2_2] numeric(18,3) NULL,
|
|
|
[STORAGEUNITCOUNT2_2] numeric(22,6) NULL,
|
|
|
[RULEUNITCOUNT2_2] numeric(18,3) NULL,
|
|
|
[PKGS3] numeric(18,3) NULL,
|
|
|
[KGS3] numeric(18,3) NULL,
|
|
|
[CBM3] numeric(18,3) NULL,
|
|
|
[NETWEIGHT3] numeric(18,3) NULL,
|
|
|
[STORAGEUNITCOUNT3] numeric(22,6) NULL,
|
|
|
[RULEUNITCOUNT3] numeric(18,3) NULL,
|
|
|
[CUSTOMNO_OUT] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[STOREHOUSE] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[AREACODE] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[OPID] uniqueidentifier NULL,
|
|
|
CONSTRAINT [PK_OP_WMS_REPORT_DETAIL] PRIMARY KEY CLUSTERED ([ID])
|
|
|
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
|
|
|
ON [PRIMARY]
|
|
|
)
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_REPORT_TIMEZONES_DETAIL] SET (LOCK_ESCALATION = TABLE)
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_TRANSFERGOODS] ALTER COLUMN [STOREHOUSEDAYS] int NULL
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_TRANSFERGOODS] ADD [USENEWFEERATEDATE] bit NULL
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_TRANSFERGOODS] ADD [NEWFEERATEDATE] datetime NULL
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_WORKDETAIL] ADD [CORPID] varchar(50) COLLATE Chinese_PRC_CI_AS NULL
|
|
|
GO
|
|
|
|
|
|
ALTER view [dbo].[VW_OP_WMS_WORKDETAIL]
|
|
|
as select [WORKDETAILID]
|
|
|
,[WMSDOID]
|
|
|
,[WORKER]
|
|
|
,[WORKDATE]
|
|
|
,[WORKNAME]
|
|
|
,[WORKLOADCOUNT]
|
|
|
,[SCALE]
|
|
|
,[WORKLOAD]
|
|
|
,[REMARK]
|
|
|
,[CORPID] from OP_WMS_WORKDETAIL
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[OP_WMS_WORKNAME] ADD [CORPID] varchar(50) COLLATE Chinese_PRC_CI_AS NULL
|
|
|
GO
|
|
|
|
|
|
ALTER TABLE [dbo].[Sys_Log_Core] ADD [PubType] bit DEFAULT ('false') NULL
|
|
|
GO
|
|
|
|
|
|
CREATE VIEW [dbo].[v_code_country] AS select countryid,country,substring(country,0,(charindex('(',country)) ) cncountry
|
|
|
from code_country
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[v_op_bs] AS SELECT BSNO,MASTERNO, 'op_seae' AS OPLB, '<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD>' 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='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN TEU ELSE 0 END TEU, CNTRTOTAL,
|
|
|
CORPID,CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR1 ELSE 0 END CNTR1,CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR2 ELSE 0 END CNTR2,
|
|
|
CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR3 ELSE 0 END CNTR3, CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR4 ELSE 0 END CNTR4,
|
|
|
CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR5 ELSE 0 END CNTR5,CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR6 ELSE 0 END CNTR6,
|
|
|
CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR7 ELSE 0 END CNTR7, CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR8 ELSE 0 END CNTR8,
|
|
|
CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR9 ELSE 0 END CNTR9,CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR10 ELSE 0 END CNTR10,
|
|
|
CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') 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, '<EFBFBD><EFBFBD><EFBFBD>˽<EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD><EFBFBD><EFBFBD>˽<EFBFBD><EFBFBD><EFBFBD>' 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='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN TEU ELSE 0 END TEU, CNTRTOTAL,
|
|
|
CORPID,CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR1 ELSE 0 END CNTR1,CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR2 ELSE 0 END CNTR2,
|
|
|
CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR3 ELSE 0 END CNTR3, CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR4 ELSE 0 END CNTR4,
|
|
|
CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR5 ELSE 0 END CNTR5,CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR6 ELSE 0 END CNTR6,
|
|
|
CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR7 ELSE 0 END CNTR7, CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR8 ELSE 0 END CNTR8,
|
|
|
CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR9 ELSE 0 END CNTR9,CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR10 ELSE 0 END CNTR10,
|
|
|
CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') 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, '<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD>' 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, '<EFBFBD><EFBFBD><EFBFBD>˽<EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD><EFBFBD><EFBFBD>˽<EFBFBD><EFBFBD><EFBFBD>' 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, '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>' 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, '<EFBFBD>ۺ<EFBFBD>ҵ<EFBFBD><EFBFBD>' 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, '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɢ<EFBFBD><EFBFBD>' 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, '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD><EFBFBD>' 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, '<EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' 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, '½<EFBFBD><EFBFBD><EFBFBD>ɳ<EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'½<EFBFBD><EFBFBD><EFBFBD>ɳ<EFBFBD><EFBFBD><EFBFBD>' 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, 'ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' 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, '<EFBFBD>ִ<EFBFBD>ҵ<EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD>ִ<EFBFBD>ҵ<EFBFBD><EFBFBD>' 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, '<EFBFBD>ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD>ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' 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, '<EFBFBD>ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD>ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' 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, '<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD>' 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 '<EFBFBD><EFBFBD><EFBFBD>ڷֵ<EFBFBD>' then c.[WEIGHT] else d.[WEIGHT] end) AS NETWEIGHT
|
|
|
,(case b.BLTYPE when '<EFBFBD><EFBFBD><EFBFBD>ڷֵ<EFBFBD>' 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 '<EFBFBD><EFBFBD><EFBFBD>ڷֵ<EFBFBD>' then c.BOXCOUNT else d.BOXCOUNT end) PKGS
|
|
|
,(case b.BLTYPE when '<EFBFBD><EFBFBD><EFBFBD>ڷֵ<EFBFBD>' 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 '<EFBFBD><EFBFBD><EFBFBD>ڷֵ<EFBFBD>' 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='<EFBFBD><EFBFBD><EFBFBD>ڷֵ<EFBFBD>' and c.bsno = B.bsno
|
|
|
left join OP_AIRN_CARGO D on b.BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' and c.bsno =(select top 1 bsno from OP_AIRN where HBLNO=b.HBLNO and BLTYPE='<EFBFBD><EFBFBD><EFBFBD>ڷֵ<EFBFBD>')
|
|
|
UNION ALL
|
|
|
SELECT BSNO, BSNO MASTERNO,'op_truck_bulk' AS OPLB, CASE WHEN TRANSTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' THEN '½<EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' ELSE '½<EFBFBD>˼<EFBFBD><EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD>' END AS OPLBNAME,CASE WHEN TRANSTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' THEN '½<EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' ELSE '½<EFBFBD>˼<EFBFBD><EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD>' 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='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' THEN '½<EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><EFBFBD>ɳ<EFBFBD>' ELSE '½<EFBFBD>˼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɳ<EFBFBD>' END AS OPLBNAME,CASE WHEN TRANSTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' THEN '½<EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><EFBFBD>ɳ<EFBFBD>' ELSE '½<EFBFBD>˼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɳ<EFBFBD>' 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, '<EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' 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, '<EFBFBD><EFBFBD>ó<EFBFBD><EFBFBD><EFBFBD>˹<EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' 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,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' BLTYPE,
|
|
|
BSDATE AS CREATETIME, BSSTATUS, 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, '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD>ִ<EFBFBD>ҵ<EFBFBD><EFBFBD>' AS BSTYPE, CUSTOMERNAME,BSNO CUSTNO,BSNO ORDERNO,MBLNO,'' HBLNO,dbo.trimtime(DODATE) ETD,dbo.trimtime(DODATE) ETA
|
|
|
,null STLDATE,null STLNAME,'' VESSEL,'' VOYNO, Creator,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><EFBFBD>' 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, '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ' AS OPLBNAME,'<EFBFBD>ִ<EFBFBD>ҵ<EFBFBD><EFBFBD>' 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,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ' 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, '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ' AS OPLBNAME,'<EFBFBD>ִ<EFBFBD>ҵ<EFBFBD><EFBFBD>' 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,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ' 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, '<EFBFBD>ִ<EFBFBD><EFBFBD>½<EFBFBD><EFBFBD>˵<EFBFBD>' AS OPLBNAME,'<EFBFBD>ִ<EFBFBD>ҵ<EFBFBD><EFBFBD>' 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,'<EFBFBD>ִ<EFBFBD><EFBFBD>½<EFBFBD>' 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, '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD>ִ<EFBFBD>ҵ<EFBFBD><EFBFBD>' AS BSTYPE, CUSTOMERNAME,BSNO CUSTNO,BSNO ORDERNO,MBLNO,'' HBLNO,DODATE ETD,DODATE ETA
|
|
|
,null STLDATE,null STLNAME,'' VESSEL,'' VOYNO, Creator,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>' 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, '<EFBFBD><EFBFBD>תҵ<EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD>ִ<EFBFBD>ҵ<EFBFBD><EFBFBD>' 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,'<EFBFBD><EFBFBD>תҵ<EFBFBD><EFBFBD>' 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, '<EFBFBD>ƿ<EFBFBD>ҵ<EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD>ִ<EFBFBD>ҵ<EFBFBD><EFBFBD>' 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,'<EFBFBD>ƿ<EFBFBD>ҵ<EFBFBD><EFBFBD>' 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 VIEW [dbo].[VW_INFO_FILES] AS select GID,PID,[FILENAME],FILETYPE,IMGFILE,UPLOADEMPLY,UPLOADDATE,FILEPATH,IMGPATH,PWORKTYPE,CreateID
|
|
|
,CreateDate,Creator,ModifyID,ModifyDate,Modifier,PBSNO,MBLNO,CNTRNO,CORPID
|
|
|
from INFO_FILES
|
|
|
union all
|
|
|
select WMSWEIGHDETAILID GID,D.WMSWEIGHID PID,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' [FILENAME],'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>' FILETYPE,null IMGFILE
|
|
|
,creator UPLOADEMPLY,CreateDate UPLOADDATE, FILEPATH,PICPATH IMGPATH,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>' PWORKTYPE,CreateID,CreateDate,Creator
|
|
|
, ModifyID, ModifyDate, Modifier,wh.MBLNO PBSNO,wh.MBLNO MBLNO,D.CNTRNO,wh.CORPID
|
|
|
from OP_WMS_WEIGH_DETAIL D
|
|
|
left join OP_WMS_WEIGH wh on wh.WMSWEIGHID=D.WMSWEIGHID
|
|
|
GO
|
|
|
|
|
|
CREATE VIEW [dbo].[VW_OP_OTHER] AS select BSNO,OPLB,OPLBNAME,BSSTATUS,FEESTATUS,CUSTNO,MBLNO,HBLNO,CONTRACTNO,CUSTOMERNAME,BSDATE,ACCDATE,BSSOURCE,BSSOURCEDETAIL,
|
|
|
OP,CUSTSERVICE,SALE,CORPID,TRANSTYPE,VESSEL,VOYNO,ETD,PORTLOAD,PORTDISCHARGE,TRADETYPE,GOODSNAME,KGS,NETWEIGHT,PKGS,KINDPKGS,
|
|
|
CBM,ISVOU,VOUNO,REMARK,CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME,orderno,STLNAME,STLDATE,CTNALL,CTNNUM,
|
|
|
IsService1,IsService2,IsService3,IsService4,IsService5,IsService6,IsService7,IsService8,IsService9,IsService10,
|
|
|
IsServiceFee1,IsServiceFee2,IsServiceFee3,IsServiceFee4,IsServiceFee5,IsServiceFee6,IsServiceFee7,IsServiceFee8,IsServiceFee9,IsServiceFee10,
|
|
|
IsService11,IsService12,IsServiceFee11,IsServiceFee12,
|
|
|
ENTERP,IsService13,IsService14,IsService15,IsService16,IsServiceFee13,IsServiceFee14,IsServiceFee15,IsServiceFee16,
|
|
|
BOOKNO,ISPRINTPR,BillFeeStatus,OPERATOR,SALECORPID,FRCUSTSERVICE,CLOSINGDATE,CLOSEDOCDATE,SALEDEPT,
|
|
|
CUSTOMSER,WAREHOUSE,COUNTRYOFORIGIN,BILLFEESTATUSTIME
|
|
|
from op_other
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_AREAGOODS] AS select w.WMSID,w.BSNO, w.CORPID, p.MBLNO,w.CUSTOMNO,p.CNTRNO,p.CUSTOMERNAME,(select codename from info_client where shortname=p.CUSTOMERNAME)CUSTOMERCODE,p.KGS,p.PKGS,p.CBM,p.NETWEIGHT,p.STORAGEUNITCOUNT,p.RULEUNITCOUNT,p.STORAGEUNIT,p.RULEUNIT,p.GOODSNAME,h.AREANAME STOREHOUSENAME,a.AREANAME,w.INDATE,w.FEERATESTARTDATE,w.WMSINDATE
|
|
|
,p.AREACODE,p.STOREHOUSE,(select top 1 PKGS from OP_WMS_CHANGE where CHANGETYPE in('<EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD>') and wmsid=p.WMSID) PKGS_FIRST,w.BILLTYPE,LOWER(w.ACCBOOKNO) ACCBOOKNO
|
|
|
,(select top 1 GOODSFEETYPE from code_goods where GOODNAME=p.GOODSNAME)GOODSFEETYPE,w.GOODSOWNER
|
|
|
,(select top 1 goodstypegid from code_goods where GOODNAME=p.GOODSNAME)GOODSTYPEGID
|
|
|
from Vw_Op_Wms_Physics_Need p
|
|
|
left join op_wms w on w.WMSID=p.WMSID
|
|
|
left join OP_WMS_STOREHOUSE h on h.AREACODE=p.STOREHOUSE
|
|
|
left join OP_WMS_STOREHOUSE_AREA a on a.AREACODE= p.AREACODE
|
|
|
where (p.PKGS>0 or p.KGS>0 or p.CBM>0)
|
|
|
GO
|
|
|
|
|
|
CREATE VIEW [dbo].[VW_OP_REP_BILLWMS] AS select Convert(varchar(10), row_number() over (order by INDATE)) as indexid,* from(
|
|
|
select CORPID,MBLNO,CUSTOMNO,CUSTOMERNAME,SUM(KGS)KGS,SUM(PKGS)PKGS,SUM(CBM)CBM,SUM(NETWEIGHT)NETWEIGHT
|
|
|
,SUM(STORAGEUNITCOUNT)STORAGEUNITCOUNT,SUM(RULEUNITCOUNT)RULEUNITCOUNT,STORAGEUNIT,RULEUNIT
|
|
|
,GOODSNAME, min(INDATE) INDATE,ACCBOOKNO,GOODSFEETYPE,GOODSOWNER,GOODSTYPEGID,sum(1) CTNNUM
|
|
|
from [VW_OP_WMS_AREAGOODS] group by CORPID,MBLNO,CUSTOMNO,CUSTOMERNAME,STORAGEUNIT,RULEUNIT
|
|
|
,GOODSNAME,ACCBOOKNO,GOODSFEETYPE,GOODSOWNER,GOODSTYPEGID)t
|
|
|
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_REP_FEEQuery] AS select f.GID, b.OPLBNAME,isnull(b.CORPID,'') CORPID, b.CUSTNO,b.MBLNO, f.CUSTOMERNAME,f.FEENAME,f.FEETYPE,f.AMOUNT,f.FEESTATUS,f.ENTERDATE,f.INPUTMODE from ch_fee F left join v_op_bs b on b.BSNO=f.BSNO
|
|
|
GO
|
|
|
|
|
|
CREATE VIEW [dbo].[VW_OP_REP_HISTORYSTORAGE] AS select b.WMSLOGID,b.CHANGETYPE,b.PKGS3,b.KGS3,b.CBM3,b.NETWEIGHT3,b.STORAGEUNITCOUNT3,w.STORAGEUNIT,b.RULEUNITCOUNT3,w.RULEUNIT,b.DODATE
|
|
|
,w.INDATE,w.BSNO,w.CUSTOMERNAME,w.GOODSNAME,cg.GOODSFEETYPE,cg.GoodsTypeGID,w.MBLNO,w.CNTRNO,w.CORPID ,w.WMSID,w.FEERATESTARTDATE,w.WMSINDATE
|
|
|
,'' STOREHOUSE,'' AREACODE,(select top 1 CUSTOMNO from OP_WMS_IN_DO where mblno=w.MBLNO) CUSTOMNO
|
|
|
from op_wms_change b
|
|
|
left join op_wms w on w.wmsid=b.wmsid
|
|
|
left join code_goods cg on cg.GOODNAME=w.GOODSNAME
|
|
|
where dodate=(select max(dodate) from op_wms_change c where wmsid=b.wmsid)
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_REP_QIANFEITONGJI_1] AS SELECT *,dbo.F_FeeStatusStr(DRFEESTATUS) DRFEESTATUSREF,dbo.F_FeeStatusStr(CRFEESTATUS) CRFEESTATUSREF ,case OPDATE when '' then 0 else case when BALTTLDR<>0 OR BALTTLCR<>0 then DATEDIFF([day],CASE WHEN STLDATE IS NULL THEN OPDATE ELSE STLDATE END,GETDATE()) else (DATEDIFF([day],CASE WHEN STLDATE IS NULL THEN OPDATE ELSE STLDATE END,SETTLETIME)) end end AS NODAY FROM (SELECT B.BSNO,B.OPTYPE, B.OPLBNAME, B.BSTYPE,B.CUSTOMERNAME, B.CUSTNO, B.MBLNO, B.HBLNO,B.VESSEL, B.VOYNO, B.INPUTBY, B.CREATETIME, B.BSSTATUS, B.SALE, B.OP,
|
|
|
B.DOC,B.YARD,B.BLISSUESTATUS,B.BLTYPE,case B.ETD when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar(100), B.ETD,23) end as ETD,B.STLNAME,case B.OPDATE when '1900-01-01 00:00:00.000'
|
|
|
then '' else CONVERT(varchar(100), B.OPDATE,23) end as OPDATE,B.ENTERP,B.DELIVERYDATE,case B.CUSTOMDATE when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar(100), B.CUSTOMDATE,23) end
|
|
|
as CUSTOMDATE,B.CUSTSERVICE, B.PORTLOAD, B.PORTDISCHARGE,B.DESTINATION, B.CUSTOMNO, B.ACCDATE,B.CARRIER, B.BSSOURCE, B.LANE,
|
|
|
B.FORWARDER,B.NETWEIGHT,B.KGS,B.TEU,B.CNTRTOTAL,B.CORPID,B.CNTR1,B.CNTR2,B.CNTR3,B.CNTR4,B.CNTR5,B.CNTR6,B.CNTR7,B.CNTR8,B.CNTR9,B.CNTR10,B.OTCNTR,B.TRADETYPE,B.GOODSNAME,B.FEESTATUS,B.PKGS,B.CBM,B.ORDERNO,B.SALECORPID,(select
|
|
|
[NAME] from [company] where GID=B.SALECORPID) as SALECORP,(CASE B.FEESTATUS WHEN 1 THEN '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' else 'δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' end) as FEESTATUSREF ,F.CUSTOMERNAME AS CUSTNAME ,C.[DESCRIPTION] AS CUSTFULLNAME
|
|
|
,isnull(SUM(CASE FEETYPE WHEN 1 THEN (CASE CURRENCY WHEN 'RMB' THEN ISNULL(AMOUNT,0) ELSE 0 END) ELSE 0 END),0) AS RMBDR,isnull(SUM(CASE FEETYPE WHEN 2 THEN (CASE CURRENCY WHEN 'RMB' THEN
|
|
|
ISNULL(AMOUNT,0) ELSE 0 END) ELSE 0 END),0) AS RMBCR,isnull(SUM(CASE FEETYPE WHEN 1 THEN (CASE CURRENCY WHEN 'RMB' THEN ISNULL(SETTLEMENT,0) ELSE 0 END) ELSE 0 END),0) AS STLRMBDR,isnull(SUM(CASE
|
|
|
FEETYPE WHEN 2 THEN (CASE CURRENCY WHEN 'RMB' THEN ISNULL(SETTLEMENT,0) ELSE 0 END)ELSE 0 END),0) AS STLRMBCR,isnull(SUM(CASE FEETYPE WHEN 1 THEN (CASE CURRENCY WHEN 'RMB' THEN
|
|
|
ISNULL(AMOUNT-SETTLEMENT,0) ELSE 0 END) ELSE 0 END),0) AS BALRMBDR,isnull(SUM(CASE FEETYPE WHEN 2 THEN (CASE CURRENCY WHEN 'RMB' THEN ISNULL(AMOUNT-SETTLEMENT,0) ELSE 0 END) ELSE 0 END),0) AS
|
|
|
BALRMBCR,isnull(SUM(CASE FEETYPE WHEN 1 THEN (CASE CURRENCY WHEN 'RMB' THEN ISNULL(ORDERAMOUNT,0) ELSE 0 END) ELSE 0 END),0) AS ORDERRMBDR,isnull(SUM(CASE FEETYPE WHEN 2 THEN (CASE CURRENCY WHEN 'RMB' THEN ISNULL(ORDERAMOUNT,0) ELSE 0 END) ELSE 0 END),0) AS ORDERRMBCR,isnull(SUM(CASE FEETYPE WHEN 1 THEN (CASE CURRENCY WHEN 'USD' THEN ISNULL(AMOUNT,0) ELSE 0 END)ELSE 0 END),0) AS USDDR,isnull(SUM(CASE FEETYPE WHEN 2 THEN (CASE CURRENCY WHEN 'USD' THEN ISNULL(AMOUNT,0) ELSE 0 END)ELSE 0 END),0) AS USDCR,isnull(SUM(CASE FEETYPE WHEN 1 THEN (CASE CURRENCY WHEN 'USD' THEN ISNULL(SETTLEMENT,0) ELSE 0 END)ELSE 0 END),0) AS STLUSDDR,isnull(SUM(CASE FEETYPE WHEN 2 THEN (CASE CURRENCY WHEN 'USD' THEN ISNULL(SETTLEMENT,0) ELSE 0 END)ELSE 0 END),0) AS STLUSDCR,isnull(SUM(CASE FEETYPE WHEN 1 THEN (CASE CURRENCY WHEN 'USD' THEN ISNULL(AMOUNT-SETTLEMENT,0) ELSE 0 END)ELSE 0 END),0) AS BALUSDDR,isnull(SUM(CASE FEETYPE WHEN 2 THEN (CASE CURRENCY WHEN 'USD' THEN ISNULL(AMOUNT-SETTLEMENT,0) ELSE 0 END)ELSE 0 END),0) AS BALUSDCR,isnull(SUM(CASE FEETYPE WHEN 1 THEN (CASE CURRENCY WHEN 'USD' THEN ISNULL(ORDERAMOUNT,0) ELSE 0 END)ELSE 0 END),0) AS ORDERUSDDR,isnull(SUM(CASE FEETYPE WHEN 2 THEN (CASE CURRENCY WHEN 'USD' THEN ISNULL(ORDERAMOUNT,0) ELSE 0 END)ELSE 0 END),0) AS ORDERUSDCR,isnull(SUM(CASE FEETYPE WHEN 1 THEN (CASE CURRENCY WHEN 'USD' THEN 0 ELSE (CASE CURRENCY WHEN 'RMB' THEN 0 ELSE ISNULL(AMOUNT,0) END) END)ELSE 0 END),0) AS OTDR,isnull(SUM(CASE FEETYPE WHEN 2 THEN (CASE CURRENCY WHEN 'USD' THEN 0 ELSE (CASE CURRENCY WHEN 'RMB' THEN 0 ELSE ISNULL(AMOUNT,0) END) END)ELSE 0 END),0) AS OTCR,isnull(SUM(CASE FEETYPE WHEN 1 THEN (CASE CURRENCY WHEN 'USD' THEN 0 ELSE (CASE CURRENCY WHEN 'RMB' THEN 0 ELSE ISNULL(SETTLEMENT,0) END) END)ELSE 0 END),0) AS STLOTDR,isnull(SUM(CASE FEETYPE WHEN 2 THEN (CASE CURRENCY WHEN 'USD' THEN 0 ELSE (CASE CURRENCY WHEN 'RMB' THEN 0 ELSE ISNULL(SETTLEMENT,0) END) END)ELSE 0 END),0) AS STLOTCR,isnull(SUM(CASE FEETYPE WHEN 1 THEN (CASE CURRENCY WHEN 'USD' THEN 0 ELSE (CASE CURRENCY WHEN 'RMB' THEN 0 ELSE ISNULL(AMOUNT-SETTLEMENT,0) END) END) ELSE 0 END),0) AS BALOTDR,isnull(SUM(CASE FEETYPE WHEN 2 THEN (CASE CURRENCY WHEN 'USD' THEN 0 ELSE (CASE CURRENCY WHEN 'RMB' THEN 0 ELSE
|
|
|
ISNULL(AMOUNT-SETTLEMENT,0) END) END) ELSE 0 END),0) AS BALOTCR,isnull(SUM(CASE FEETYPE WHEN 1 THEN (CASE CURRENCY WHEN 'USD' THEN 0 ELSE (CASE CURRENCY WHEN 'RMB' THEN 0 ELSE
|
|
|
ISNULL(ORDERAMOUNT,0) END) END)ELSE 0 END),0) AS ORDEROTDR,isnull(SUM(CASE FEETYPE WHEN 2 THEN (CASE CURRENCY WHEN 'USD' THEN 0 ELSE (CASE CURRENCY WHEN 'RMB' THEN 0 ELSE ISNULL(ORDERAMOUNT,0)
|
|
|
END) END)ELSE 0 END),0) AS ORDEROTCR,isnull(SUM(CASE CURRENCY WHEN 'RMB' THEN ISNULL(INVOICE,0) ELSE 0 END),0) AS INVRMB,isnull(SUM(CASE CURRENCY WHEN 'USD' THEN ISNULL(INVOICE,0) ELSE 0
|
|
|
END),0) AS INVUSD,isnull(SUM(CASE FEETYPE WHEN 1 THEN cast(round(ISNULL(AMOUNT,0) * ISNULL(EXCHANGERATE,0),2) as numeric(20,2)) ELSE 0 END),0) AS TTLDR,isnull(SUM(CASE FEETYPE WHEN 2 THEN
|
|
|
cast(round(ISNULL(AMOUNT,0) *ISNULL( EXCHANGERATE,0),2) as numeric(20,2)) ELSE 0 END),0) AS TTLCR,isnull(SUM(CASE FEETYPE WHEN 1 THEN cast(round(ISNULL(SETTLEMENT,0) * ISNULL(EXCHANGERATE,0),2) as
|
|
|
numeric(20,2)) ELSE 0 END),0) AS STLTTLDR,isnull(SUM(CASE FEETYPE WHEN 2 THEN cast(round(ISNULL(SETTLEMENT,0) *ISNULL( EXCHANGERATE,0),2) as numeric(20,2)) ELSE 0 END),0) AS
|
|
|
STLTTLCR,isnull(SUM(CASE FEETYPE WHEN 1 THEN cast(round(ISNULL(AMOUNT-SETTLEMENT,0) * ISNULL(EXCHANGERATE,0),2) as numeric(20,2)) ELSE 0 END),0) AS BALTTLDR,isnull(SUM(CASE FEETYPE WHEN 2 THEN
|
|
|
cast(round(ISNULL(AMOUNT-SETTLEMENT,0) *ISNULL( EXCHANGERATE,0),2) as numeric(20,2)) ELSE 0 END),0) AS BALTTLCR,isnull(SUM(CASE FEETYPE WHEN 1 THEN cast(round(ISNULL(ORDERAMOUNT,0) *
|
|
|
ISNULL(EXCHANGERATE,0),2) as numeric(20,2)) ELSE 0 END),0) AS ORDERTTLDR,isnull(SUM(CASE FEETYPE WHEN 2 THEN cast(round(ISNULL(ORDERAMOUNT,0) *ISNULL( EXCHANGERATE,0),2) as numeric(20,2)) ELSE 0
|
|
|
END),0) AS ORDERTTLCR,case when isnull(SUM(F.AMOUNT),0)<>isnull(SUM(F.SETTLEMENT),0) then (case B.OPDATE when '1900-01-01 00:00:00.000' then 0 else DATEDIFF([day],B.OPDATE, GETDATE()) end) else
|
|
|
(case B.OPDATE when '1900-01-01 00:00:00.000' then 0 else DATEDIFF([day],B.OPDATE, S.SETTLETIME) end) end AS ACTUALDAY,S.SETTLETIME,CASE WHEN B.STLDATE IS NULL THEN B.OPDATE ELSE B.STLDATE END STLDATE
|
|
|
,isnull((select top 1 case ACCTYPE WHEN '<EFBFBD>½<EFBFBD>' then accmonth*30 + accdays WHEN '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then accmonth*90 + accdays else accdays end from Info_Client_ACCDATE where LINKGID = (select top 1 GID from info_client where shortname =B.CUSTOMERNAME ) AND ((ISNULL(SALE,'')='') or (ISNULL(SALE,'')=B.SALE)) and BGNDATE<=B.OPDATE AND ENDDATE>=B.OPDATE),0) CONTRACTDAY
|
|
|
|
|
|
, (CASE WHEN (SUM(G.TTLDR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLDR)) * 100, 10, 2))) END) AS PROFITRATE,'' INVOICENO,dbo.F_GetBillDrFeeStatus(B.BSNO) DRFEESTATUS,dbo.F_GetBillCrFeeStatus(B.BSNO) CRFEESTATUS
|
|
|
,F.INPUTMODE
|
|
|
FROM CH_FEE F INNER JOIN V_OP_BILL B ON (F.BSNO=B.BSNO)
|
|
|
LEFT JOIN v_op_gain_sum G ON (G.BSNO=B.BSNO)
|
|
|
LEFT JOIN info_client C ON (C.SHORTNAME=F.CUSTOMERNAME)
|
|
|
LEFT JOIN V_MAX_SETTLEMENTTIME S ON (S.CUSTOMERNAME=F.CUSTOMERNAME AND S.BSNO=B.BSNO)
|
|
|
Where 1=1
|
|
|
GROUP BY B.BSNO,B.OPTYPE,B.OPLBNAME, B.BSTYPE,B.CUSTOMERNAME, B.CUSTNO, B.MBLNO, B.HBLNO,B.VESSEL, B.VOYNO, B.INPUTBY
|
|
|
, B.CREATETIME, B.BSSTATUS, B.SALE, B.OP, B.DOC,B.YARD,B.BLISSUESTATUS,B.BLTYPE, B.ETD ,B.OPDATE,B.ENTERP,B.DELIVERYDATE ,B.CUSTOMDATE
|
|
|
,B.CUSTSERVICE, B.PORTLOAD, B.PORTDISCHARGE,B.DESTINATION, B.CUSTOMNO, B.ACCDATE,B.CARRIER, B.BSSOURCE, B.LANE, B.FORWARDER,B.NETWEIGHT
|
|
|
,B.KGS,B.TEU,B.CNTRTOTAL,B.CORPID ,B.CNTR1,B.CNTR2,B.CNTR3,B.CNTR4,B.CNTR5,B.CNTR6,B.CNTR7,B.CNTR8,B.CNTR9,B.CNTR10,B.OTCNTR,B.TRADETYPE
|
|
|
,B.GOODSNAME,B.FEESTATUS,B.PKGS,B.CBM,B.ORDERNO,B.SALECORPID,B.STLDATE,F.CUSTOMERNAME,C.[DESCRIPTION] ,B.STLNAME, S.SETTLETIME,F.INPUTMODE) AS T
|
|
|
--order by CUSTNAME,OPDATE,MBLNO
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_TRANSFERGOODS] AS
|
|
|
select G.*,(select top 1 MBLNO from OP_WMS where exists (select 1 from OP_WMS_TRANSFERGOODS_DETAIL d where d.WMSID=op_wms.WMSID and d.WMSTRANSFERGOODSID=g.WMSTRANSFERGOODSID)) MBLNO,(select name from company where GID=CORPID) COMPANYNAME
|
|
|
,isnull((select sum(KGS) from OP_WMS_TRANSFERGOODS_DETAIL where WMSTRANSFERGOODSID=G.WMSTRANSFERGOODSID),0) KGS
|
|
|
,isnull((select sum(CBM) from OP_WMS_TRANSFERGOODS_DETAIL where WMSTRANSFERGOODSID=G.WMSTRANSFERGOODSID),0) CBM
|
|
|
,isnull((select sum(PKGS) from OP_WMS_TRANSFERGOODS_DETAIL where WMSTRANSFERGOODSID=G.WMSTRANSFERGOODSID),0) PKGS
|
|
|
,isnull((select sum(NETWEIGHT) from OP_WMS_TRANSFERGOODS_DETAIL where WMSTRANSFERGOODSID=G.WMSTRANSFERGOODSID),0) NETWEIGHT
|
|
|
,isnull((select sum(STORAGEUNITCOUNT) from OP_WMS_TRANSFERGOODS_DETAIL where WMSTRANSFERGOODSID=G.WMSTRANSFERGOODSID),0) STORAGEUNITCOUNT
|
|
|
,isnull((select sum(RULEUNITCOUNT) from OP_WMS_TRANSFERGOODS_DETAIL where WMSTRANSFERGOODSID=G.WMSTRANSFERGOODSID),0) RULEUNITCOUNT
|
|
|
from OP_WMS_TRANSFERGOODS G
|
|
|
GO
|
|
|
|
|
|
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_REP_TRANSFERGOODSDETAIL] AS select c.*,t.BSNO,t.TRANSFERDATE,t.STOREHOUSEDAYS,t.STOREHOUSEENDDATE,t.WMSINFEE_OLDCUST,t.WMSOUTFEE_OLDCUST,t.OLDCUSTOMERNAME,t.NEWCUSTOMERNAME
|
|
|
,t.OLD_GOODSOWNER,t.NEW_GOODSOWNER,w.MBLNO,w.CNTRNO,w.GOODSNAME,w.CORPID,t.USENEWFEERATEDATE,t.NEWFEERATEDATE
|
|
|
from OP_WMS_CHANGE c
|
|
|
left join VW_OP_WMS_TRANSFERGOODS t on t.WMSTRANSFERGOODSID=c.dobsno
|
|
|
left join OP_WMS w on w.WMSID = c.WMSID
|
|
|
where CHANGETYPE in('<EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD>')
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_REP_WMSINDO] AS select wc.WMSLOGID,id.DODATE,w.CORPID, w.CUSTOMERNAME,w.GOODSNAME,w.MBLNO,w.CUSTOMNO,w.CNTRNO,wc.PKGS,wc.KGS,wc.NETWEIGHT,wc.CBM,wc.PKGS3,wc.KGS3,wc.NETWEIGHT3,wc.CBM3,idg.STOREHOUSE ,idg.AREACODE,w.OP
|
|
|
,wc.CHANGETYPE,id.BSNO,GOODSFEETYPE,GoodsTypeGID,w.GOODSOWNER
|
|
|
,inplan.INSPECTION_NO,inplan.CONTRACTNO,inplan.JINGNEISHOUHUOREN
|
|
|
,inplan.JINJINGBEIANSHENBAORIQI,inplan.CUSTOMAMOUNT
|
|
|
,inplan.CUSTOMAMOUNT/(select sum(kgs) from OP_WMS_in_DO_GOODS where WMSPLANID=inplan.WMSPLANID) CUSTOMAMOUNT_KGS
|
|
|
,inplan.CUSTOMAMOUNT*idg.KGS/(select sum(kgs) from OP_WMS_in_DO_GOODS where WMSPLANID=inplan.WMSPLANID) CUSTOMAMOUNT_SINGLE
|
|
|
from OP_WMS_CHANGE wc
|
|
|
left join op_wms w on w.WMSID=wc.WMSID
|
|
|
left join op_wms_in_do id on id.WMSDOID=wc.DOBSNO
|
|
|
left join OP_WMS_in_DO_GOODS idg on idg.WMSDODETAILID=wc.DOGID
|
|
|
left join OP_WMS_IN_PLAN inplan on inplan.WMSPLANID=idg.WMSPLANID
|
|
|
left join code_goods cg on cg.GOODNAME=w.GOODSNAME
|
|
|
where wc.CHANGETYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
GO
|
|
|
|
|
|
CREATE VIEW [dbo].[VW_OP_REP_WMSINDO_BYPLAN] AS select p.*
|
|
|
, (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_REP_WMSOUTDO] AS select wc.WMSLOGID,od.DODATE,w.CORPID, w.CUSTOMERNAME,w.GOODSNAME,w.MBLNO,w.CUSTOMNO,w.CNTRNO,-wc.PKGS PKGS,-wc.KGS KGS,-wc.NETWEIGHT NETWEIGHT,-wc.CBM CBM,wc.PKGS3,wc.KGS3,wc.NETWEIGHT3,wc.CBM3,-wc.STORAGEUNITCOUNT STORAGEUNITCOUNT,wc.STORAGEUNITCOUNT3,p.STOREHOUSE ,p.AREACODE,w.OP
|
|
|
,wc.CHANGETYPE,od.WMSNO,cg.GOODSFEETYPE,cg.GoodsTypeGID,w.GOODSOWNER
|
|
|
,od.TRUCKNO,w.INDATE,w.WMSINDATE,w.FEESTARTDATE,od.CUSTOMNO CUSTOMNO_OUT
|
|
|
from OP_WMS_CHANGE wc
|
|
|
left join op_wms w on w.WMSID=wc.WMSID
|
|
|
left join op_wms_OUT_do od on od.WMSDOID=wc.DOBSNO
|
|
|
left join OP_WMS_OUT_DO_GOODS odg on odg.WMSDOID=wc.DOBSNO and odg.WMSDODETAILID=wc.DOGID
|
|
|
left join OP_WMS_PHYSICS p on p.WMSPHYSICSID=odg.WMSPHYSICSID
|
|
|
left join code_goods cg on cg.GOODNAME=w.GOODSNAME
|
|
|
where wc.CHANGETYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[Vw_Op_Wms] AS select [WMSID]
|
|
|
,[BSNO]
|
|
|
,[BILLTYPE]
|
|
|
,[REMARK]
|
|
|
,[CORPID]
|
|
|
,[ModifyID]
|
|
|
,[Modifier]
|
|
|
,[ModifyDate]
|
|
|
,[CreateID]
|
|
|
,[Creator]
|
|
|
,[CreateDate]
|
|
|
,[CUSTOMERNAME]
|
|
|
,[MATERIALNO]
|
|
|
,[GOODSCODE]
|
|
|
,[GOODSNAME]
|
|
|
,[GOODSHSCODE]
|
|
|
,[MBLNO]
|
|
|
,[CNTRNO]
|
|
|
,[KGS]
|
|
|
,NETWEIGHT
|
|
|
,[CBM]
|
|
|
,[PKGS]
|
|
|
,[KINDPKGS]
|
|
|
,[STORAGEUNIT]
|
|
|
,[STORAGEUNITCOUNT]
|
|
|
,[RULEUNIT]
|
|
|
,[RULEUNITCOUNT]
|
|
|
,[ISCLEAR]
|
|
|
,[BSSTATUS]
|
|
|
,[FEESTATUS]
|
|
|
,[INDATE]
|
|
|
,[FEESTARTDATE]
|
|
|
,[FEEENDDATE]
|
|
|
,[FEERATESTARTDATE]
|
|
|
,[WMSINDATE]
|
|
|
,KGS_SINGLE,CBM_SINGLE,STORAGEUNITCOUNT_SINGLE,RULEUNITCOUNT_SINGLE,OP,CUSTOMNO,ACCBOOKNO,GOODSOWNER
|
|
|
from OP_WMS
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_AREAGOODS] AS select w.WMSID,w.BSNO, w.CORPID, p.MBLNO,w.CUSTOMNO,p.CNTRNO,p.CUSTOMERNAME,(select codename from info_client where shortname=p.CUSTOMERNAME)CUSTOMERCODE,p.KGS,p.PKGS,p.CBM,p.NETWEIGHT,p.STORAGEUNITCOUNT,p.RULEUNITCOUNT,p.STORAGEUNIT,p.RULEUNIT,p.GOODSNAME,h.AREANAME STOREHOUSENAME,a.AREANAME,w.INDATE,w.FEERATESTARTDATE,w.WMSINDATE
|
|
|
,p.AREACODE,p.STOREHOUSE,(select top 1 PKGS from OP_WMS_CHANGE where CHANGETYPE in('<EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD>') and wmsid=p.WMSID) PKGS_FIRST,w.BILLTYPE,LOWER(w.ACCBOOKNO) ACCBOOKNO
|
|
|
,(select top 1 GOODSFEETYPE from code_goods where GOODNAME=p.GOODSNAME)GOODSFEETYPE,w.GOODSOWNER
|
|
|
,(select top 1 goodstypegid from code_goods where GOODNAME=p.GOODSNAME)GOODSTYPEGID
|
|
|
from Vw_Op_Wms_Physics_Need p
|
|
|
left join op_wms w on w.WMSID=p.WMSID
|
|
|
left join OP_WMS_STOREHOUSE h on h.AREACODE=p.STOREHOUSE
|
|
|
left join OP_WMS_STOREHOUSE_AREA a on a.AREACODE= p.AREACODE
|
|
|
where (p.PKGS>0 or p.KGS>0 or p.CBM>0)
|
|
|
GO
|
|
|
|
|
|
CREATE VIEW [dbo].[VW_OP_WMS_CHANGE] AS select c.*,w.MBLNO,(select top 1 CUSTOMNO from OP_WMS_IN_DO where mblno=w.MBLNO) CUSTOMNO,cg.GOODSFEETYPE,cg.GoodsTypeGID,w.GOODSNAME
|
|
|
,w.CUSTOMERNAME,w.GOODSOWNER,pc.STOREHOUSE,pc.AREACODE,w.CORPID
|
|
|
from Op_Wms_Change c
|
|
|
|
|
|
left join op_wms w on w.WMSID=c.WMSID
|
|
|
left join OP_WMS_PHYSICS_CHANGE pc on pc.DOGID=c.DOGID
|
|
|
left join code_goods cg on cg.GOODNAME=w.GOODSNAME
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_CHECK_DETAIL] AS select D.*,w.CUSTOMERNAME,w.MBLNO,w.CNTRNO,w.MBLNO+';'+w.CNTRNO MBLNOCNTRNO,w.GOODSNAME,p.AREACODE,p.STOREHOUSE from OP_WMS_CHECK_DETAIL D
|
|
|
left join op_wms w on w.wmsid=d.wmsid
|
|
|
left join OP_WMS_PHYSICS p on p.WMSPHYSICSID=d.WMSPHYSICSID
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[Vw_Op_Wms_FeeBase] AS select [WMSID]
|
|
|
,[BSNO]
|
|
|
,[BILLTYPE]
|
|
|
,[REMARK]
|
|
|
,[CORPID]
|
|
|
,[ModifyID]
|
|
|
,[Modifier]
|
|
|
,[ModifyDate]
|
|
|
,[CreateID]
|
|
|
,[Creator]
|
|
|
,[CreateDate]
|
|
|
,[CUSTOMERNAME]
|
|
|
,[MATERIALNO]
|
|
|
,[GOODSCODE]
|
|
|
,[GOODSNAME]
|
|
|
,[GOODSHSCODE]
|
|
|
,[MBLNO]
|
|
|
,[CNTRNO]
|
|
|
,[KGS]
|
|
|
,NETWEIGHT
|
|
|
,[CBM]
|
|
|
,[PKGS]
|
|
|
,[KINDPKGS]
|
|
|
,[STORAGEUNIT]
|
|
|
,[STORAGEUNITCOUNT]
|
|
|
,[RULEUNIT]
|
|
|
,[RULEUNITCOUNT]
|
|
|
,[ISCLEAR]
|
|
|
,[BSSTATUS]
|
|
|
,[FEESTATUS]
|
|
|
,[INDATE]
|
|
|
,[FEESTARTDATE],FEERATESTARTDATE,WMSINDATE
|
|
|
,isnull([FEEENDDATE],'3000-12-12') [FEEENDDATE]
|
|
|
,[MBLNO]+[CNTRNO] MBLNOCNTRNO
|
|
|
,KGS_SINGLE,CBM_SINGLE,STORAGEUNITCOUNT_SINGLE,RULEUNITCOUNT_SINGLE,OP,CUSTOMNO,ACCBOOKNO,GOODSOWNER
|
|
|
from OP_WMS
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_FEEDUI_STORAGE_CUST] AS SELECT [WMSDUIID]
|
|
|
,[BSNO]
|
|
|
,[CUSTOMERNAME]
|
|
|
,[ACCDATE]
|
|
|
,(select sum(QUANTITY) from OP_WMS_FEEDUI_STORAGE_DETAIL where WMSDUIID=[OP_WMS_FEEDUI_STORAGE].WMSDUIID)[QUANTITY]
|
|
|
,(select sum(AMOUNT) from CH_Fee where BXGID=CONVERT(varchar(50), [OP_WMS_FEEDUI_STORAGE].WMSDUIID))[AMOUNT]
|
|
|
,[STARTDATE]
|
|
|
,[ENDDATE]
|
|
|
,[BILLSTATUS]
|
|
|
,[REMARK]
|
|
|
,[FEESTATUS]
|
|
|
,[BSSTATUS]
|
|
|
,[CORPID]
|
|
|
,[Creator]
|
|
|
,[CreateID]
|
|
|
,[CreateDate]
|
|
|
FROM [dbo].[OP_WMS_FEEDUI_STORAGE]
|
|
|
GO
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
create function [dbo].[F_INDODETAIL_CNTRNO](@WMSDOID uniqueidentifier)
|
|
|
returns nvarchar(100)
|
|
|
as
|
|
|
begin
|
|
|
declare @S nvarchar(100)
|
|
|
select @S=isnull(@S,'')+CNTRNO+',' from(select distinct CNTRNO from OP_WMS_IN_DO_GOODS where WMSDOID=@WMSDOID )t
|
|
|
if( LEN(@S)>0)
|
|
|
set @S=substring(@S,1,len(@S)-1)
|
|
|
return @S
|
|
|
end
|
|
|
|
|
|
GO
|
|
|
|
|
|
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_IN_DO] AS select D.*,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_WMS_IN_PLAN] AS select [WMSPLANID]
|
|
|
,[WMSNO]
|
|
|
,[MBLNO]
|
|
|
,[CONTRACTNO]
|
|
|
,[BILLTYPE]
|
|
|
,[PLANTIME]
|
|
|
,[ACCDATE]
|
|
|
,[CUSTOMERNAME]
|
|
|
,[CORPID]
|
|
|
,[ACCBOOKNO]
|
|
|
,[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]
|
|
|
GO
|
|
|
|
|
|
CREATE VIEW [dbo].[VW_OP_WMS_IN_PLAN_BEFORE] AS select [WMSPLANID]
|
|
|
,[WMSNO]
|
|
|
,[MBLNO]
|
|
|
,[CONTRACTNO]
|
|
|
,[BILLTYPE]
|
|
|
,[PLANTIME]
|
|
|
,[ACCDATE]
|
|
|
,[CUSTOMERNAME]
|
|
|
,[CORPID]
|
|
|
,[ACCBOOKNO]
|
|
|
,[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='<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD>'
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_MOVE] AS select m.WMSDOID, m.BSNO,m.CUSTOMERNAME,m.DODATE,m.REMARK,m.BILLSTATUS
|
|
|
|
|
|
,w.MBLNO,w.CNTRNO,w.GOODSNAME,m.CORPID,m.CreateID from OP_WMS_MOVE m left join op_wms w on w.WMSID=m.WMSID
|
|
|
GO
|
|
|
|
|
|
CREATE VIEW [dbo].[VW_OP_WMS_MOVE_DETAIL] AS select w.CUSTOMERNAME,w.GOODSOWNER,w.GOODSNAME,w.MBLNO,w.CNTRNO, d.* from [OP_WMS_MOVE_DETAIL] D
|
|
|
left join op_wms w on w.WMSID=d.WMSID
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[Vw_Op_Wms_Need] AS select w.[WMSID],w.CUSTOMERNAME,w.CORPID
|
|
|
,w.MBLNO,w.CUSTOMNO,w.CNTRNO,w.GOODSNAME,w.INDATE,w.OP
|
|
|
,w.KGS-isnull(td.KGS,0)-isnull(opd.KGS,0)+isnull(odg.KGS,0) [KGS]
|
|
|
,w.NETWEIGHT-isnull(td.NETWEIGHT,0)-isnull(opd.NETWEIGHT,0)+isnull(odg.NETWEIGHT,0) [NETWEIGHT]
|
|
|
,w.CBM-isnull(td.CBM,0)-isnull(opd.CBM,0)+isnull(odg.CBM,0) [CBM]
|
|
|
,w.PKGS-isnull(td.PKGS,0)-isnull(opd.PKGS,0)+isnull(odg.PKGS,0) [PKGS]
|
|
|
,w.[KINDPKGS]
|
|
|
,w.[STORAGEUNIT]
|
|
|
,w.STORAGEUNITCOUNT-isnull(td.STORAGEUNITCOUNT,0)-isnull(opd.STORAGEUNITCOUNT,0)+isnull(odg.STORAGEUNITCOUNT,0)[STORAGEUNITCOUNT]
|
|
|
,w.[RULEUNIT]
|
|
|
,w.RULEUNITCOUNT-isnull(td.RULEUNITCOUNT,0)-isnull(opd.RULEUNITCOUNT,0)+isnull(odg.RULEUNITCOUNT,0)[RULEUNITCOUNT]
|
|
|
,w.[FEESTARTDATE]
|
|
|
,w.[FEEENDDATE],w.[FEERATESTARTDATE],w.WMSINDATE
|
|
|
,w.MBLNO+'_'+w.CNTRNO MBLNOCNTRNO
|
|
|
,w.KGS-isnull(td.KGS,0)-isnull(opd.KGS,0)+
|
|
|
w.NETWEIGHT-isnull(td.NETWEIGHT,0)-isnull(opd.NETWEIGHT,0)+
|
|
|
w.CBM-isnull(td.CBM,0)-isnull(opd.CBM,0)+
|
|
|
w.PKGS-isnull(td.PKGS,0)-isnull(opd.PKGS,0) ALLSTORAGECOUNT
|
|
|
,w.GOODSOWNER
|
|
|
from Op_Wms w
|
|
|
|
|
|
left join(select wmsid,sum(KGS) KGS,sum(NETWEIGHT) NETWEIGHT,sum(CBM) CBM,sum(PKGS) PKGS,sum(STORAGEUNITCOUNT) STORAGEUNITCOUNT,sum(RULEUNITCOUNT) RULEUNITCOUNT from OP_WMS_TRANSFERGOODS_DETAIL _td
|
|
|
where exists (select 1 from OP_WMS_Transfergoods where WMSTRANSFERGOODSID=_td.WMSTRANSFERGOODSID and BILLSTATUS='1000' )
|
|
|
group by wmsid) td on td.WMSID=w.wmsid
|
|
|
|
|
|
left join (select wmsid,sum(KGS) KGS,sum(NETWEIGHT) NETWEIGHT,sum(CBM) CBM,sum(PKGS) PKGS,sum(STORAGEUNITCOUNT) STORAGEUNITCOUNT,sum(RULEUNITCOUNT) RULEUNITCOUNT from OP_WMS_OUT_PLAN_DETAIL _opd
|
|
|
where (select isnull(isend,0) from OP_WMS_OUT_PLAN where WMSPLANID=_opd.WMSPLANID)=0
|
|
|
group by wmsid)opd on opd.WMSID=w.WMSID
|
|
|
|
|
|
left join (select wmsid,sum(KGS) KGS,sum(NETWEIGHT) NETWEIGHT,sum(CBM) CBM,sum(PKGS) PKGS,sum(STORAGEUNITCOUNT) STORAGEUNITCOUNT,sum(RULEUNITCOUNT) RULEUNITCOUNT from OP_WMS_OUT_DO_GOODS _odg
|
|
|
where exists (select 1 from OP_WMS_OUT_DO od where od.WMSDOID=_odg.WMSDOID and od.billstatus='1012' and (select isnull(isend,0) from OP_WMS_OUT_PLAN where WMSPLANID=od.WMSPLANID)=0 )
|
|
|
group by wmsid)odg on odg.WMSID=w.WMSID
|
|
|
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
|
|
|
,GOODSNAME,GOODSFEETYPE,WEIGHING
|
|
|
,(select sum(PKGS) from OP_WMS_OUT_DO_GOODS where WMSDOID=D.WMSDOID) PKGS
|
|
|
,D.STLMODE
|
|
|
FROM [dbo].[OP_WMS_OUT_DO] D
|
|
|
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
|
|
|
,(select sum(PKGS) from OP_WMS_OUT_PLAN_DETAIL where WMSPLANID=[OP_WMS_OUT_PLAN].WMSPLANID) PKGS
|
|
|
FROM [dbo].[OP_WMS_OUT_PLAN]
|
|
|
GO
|
|
|
|
|
|
CREATE VIEW [dbo].[VW_OP_WMS_OUT_PLAN_BEFORE] AS SELECT [WMSOUTPLANBEFOREID]
|
|
|
,[WMSNO]
|
|
|
,[PLANTIME]
|
|
|
,[CUSTOMERNAME]
|
|
|
,[CORPID]
|
|
|
,[REMARK]
|
|
|
,[Creator]
|
|
|
,[CreateID]
|
|
|
,[CreateDate]
|
|
|
,[FEESTATUS]
|
|
|
,[BSSTATUS]
|
|
|
,[ModifyDate]
|
|
|
,[ModifyID]
|
|
|
,[Modifier]
|
|
|
,[ISEND]
|
|
|
,[CUSTOMNO]
|
|
|
,GOODSNAME,GOODSFEETYPE
|
|
|
,dbo.[F_OUTPLANDETAIL_MBLNO]([WMSOUTPLANBEFOREID]) MBLNO,dbo.[F_OUTPLANDETAIL_CNTRNO]([WMSOUTPLANBEFOREID]) CNTRNO
|
|
|
,GOODSOWNER
|
|
|
,(select sum(PKGS) from OP_WMS_OUT_PLAN_DETAIL where WMSPLANID=[OP_WMS_OUT_PLAN_BEFORE].[WMSOUTPLANBEFOREID]) PKGS
|
|
|
FROM [dbo].[OP_WMS_OUT_PLAN_BEFORE]
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_OUT_PLAN_DETAIL] AS select opd.[WMSOUTDETAILID]
|
|
|
,opd.[WMSPLANID]
|
|
|
,opd.[WMSID]
|
|
|
,opd.[MBLNO]
|
|
|
,opd.[CNTRNO]
|
|
|
,opd.[MATERIALNO]
|
|
|
,opd.[GOODSCODE]
|
|
|
,opd.[GOODSNAME]
|
|
|
,opd.[GOODSHSCODE]
|
|
|
,opd.[KGS]
|
|
|
,opd.[PKGS]
|
|
|
,opd.[CBM]
|
|
|
,opd.[KINDPKGS]
|
|
|
,opd.[STORAGEUNIT]
|
|
|
,opd.[STORAGEUNITCOUNT]
|
|
|
,opd.[RULEUNIT]
|
|
|
,opd.[RULEUNITCOUNT]
|
|
|
,opd.[WMSPHYSICSID]
|
|
|
,opd.[NETWEIGHT]
|
|
|
,[CUSTOMNO],p.AREACODE,p.STOREHOUSE from OP_WMS_OUT_PLAN_DETAIL opd left join OP_WMS_PHYSICS p on opd.WMSPHYSICSID=p.WMSPHYSICSID
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_OUT_PLANDETAIL_PHYSICS] AS SELECT D.WMSOUTDETAILID, D.WMSPLANID,
|
|
|
D.WMSID, D.MBLNO,
|
|
|
D.CNTRNO, D.MATERIALNO,
|
|
|
D.GOODSCODE, D.GOODSNAME,
|
|
|
D.GOODSHSCODE, D.KGS, D.NETWEIGHT,
|
|
|
D.PKGS, D.CBM,
|
|
|
D.KINDPKGS, D.STORAGEUNIT,
|
|
|
D.STORAGEUNITCOUNT, D.RULEUNIT,
|
|
|
D.RULEUNITCOUNT, pc.STOREHOUSE,
|
|
|
pc.AREACODE, pc.PKGS AS PKGS1,pc.WMSPHYSICSID
|
|
|
FROM OP_WMS_OUT_PLAN_DETAIL D
|
|
|
left JOIN dbo.OP_WMS_PHYSICS pc ON
|
|
|
(D.WMSID = pc.WMSID and pc.STORAGEUNITCOUNT>0) or (D.WMSPHYSICSID=pc.WMSPHYSICSID)
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[Vw_Op_Wms_Physics_Need] AS select p.[WMSPHYSICSID]
|
|
|
,p.[WMSID]
|
|
|
,p.[STOREHOUSE]
|
|
|
,p.[AREACODE]
|
|
|
,p.KGS-isnull(d.KGS,0)-isnull(od.KGS,0) [KGS]
|
|
|
,p.NETWEIGHT-isnull(d.NETWEIGHT,0)-isnull(od.NETWEIGHT,0) [NETWEIGHT]
|
|
|
,p.CBM-isnull(d.CBM,0)-isnull(od.CBM,0) [CBM]
|
|
|
,p.PKGS-isnull(d.PKGS,0)-isnull(od.PKGS,0) [PKGS]
|
|
|
,p.[KINDPKGS]
|
|
|
,p.[STORAGEUNIT]
|
|
|
,p.STORAGEUNITCOUNT-isnull(d.STORAGEUNITCOUNT,0)-isnull(od.STORAGEUNITCOUNT,0)[STORAGEUNITCOUNT]
|
|
|
,p.[RULEUNIT]
|
|
|
,p.RULEUNITCOUNT-isnull(d.RULEUNITCOUNT,0)-isnull(od.RULEUNITCOUNT,0)[RULEUNITCOUNT]
|
|
|
,p.[STARTDATE]
|
|
|
,p.[FEEENDDATE]
|
|
|
,w.MBLNO,w.CNTRNO,w.MBLNO+'_'+w.CNTRNO MBLNOCNTRNO,w.GOODSNAME,w.INDATE,w.CUSTOMERNAME,w.GOODSOWNER,w.OP
|
|
|
,convert(numeric(18,6) ,p.KGS/1000)TONS
|
|
|
,w.WMSINDATE
|
|
|
from Op_Wms_Physics p
|
|
|
left join op_wms w on w.WMSID=p.WMSID
|
|
|
left join OP_WMS_PHYSICS_DODETAIL d on d.WMSPHYSICSID=p.WMSPHYSICSID
|
|
|
and (select billstatus from OP_WMS_Transfergoods where WMSTRANSFERGOODSID=d.WMSDOID )='1000'
|
|
|
left join OP_WMS_PHYSICS_DODETAIL od on od.WMSPHYSICSID=p.WMSPHYSICSID
|
|
|
and (select BSSTATUS from OP_WMS_OUT_DO where WMSDOID=d.WMSDOID )='false'
|
|
|
GO
|
|
|
|
|
|
CREATE VIEW [dbo].[VW_OP_WMS_REPORT_TIMEZONES_DETAIL] AS SELECT [ID]
|
|
|
,[REPORTID]
|
|
|
,d.[WMSID]
|
|
|
,w.MBLNO,w.CNTRNO,w.GOODSNAME,w.CUSTOMERNAME,w.GOODSOWNER,w.CUSTOMNO,w.OP
|
|
|
,cg.GOODSFEETYPE,cgt.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]
|
|
|
|
|
|
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
|
|
|
|
|
|
CREATE VIEW [dbo].[VW_OP_WMS_REPORT_TIMEZONES_DETAIL_BYCLIENT] AS select D.REPORTID
|
|
|
,sum(d.PKGS) PKGS,sum(d.KGS) KGS,sum(d.CBM) CBM,sum(d.NETWEIGHT) NETWEIGHT,sum(d.STORAGEUNITCOUNT) STORAGEUNITCOUNT,sum(d.RULEUNITCOUNT) RULEUNITCOUNT
|
|
|
,sum(d.PKGS2_1) PKGS2_1,sum(d.KGS2_1) KGS2_1,sum(d.CBM2_1) CBM2_1,sum(d.NETWEIGHT2_1) NETWEIGHT2_1,sum(d.STORAGEUNITCOUNT2_1) STORAGEUNITCOUNT2_1,sum(d.RULEUNITCOUNT2_1) RULEUNITCOUNT2_1
|
|
|
,sum(d.PKGS2_2) PKGS2_2,sum(d.KGS2_2) KGS2_2,sum(d.CBM2_2) CBM2_2,sum(d.NETWEIGHT2_2) NETWEIGHT2_2,sum(d.STORAGEUNITCOUNT2_2) STORAGEUNITCOUNT2_2,sum(d.RULEUNITCOUNT2_2) RULEUNITCOUNT2_2
|
|
|
,sum(d.PKGS3) PKGS3,sum(d.KGS3) KGS3,sum(d.CBM3) CBM3,sum(d.NETWEIGHT3) NETWEIGHT3,sum(d.STORAGEUNITCOUNT3) STORAGEUNITCOUNT3,sum(d.RULEUNITCOUNT3) RULEUNITCOUNT3
|
|
|
|
|
|
,w.CUSTOMERNAME,w.GOODSOWNER
|
|
|
|
|
|
from OP_WMS_REPORT_TIMEZONES_DETAIL D
|
|
|
|
|
|
left join op_wms w on w.wmsid=d.WMSID
|
|
|
|
|
|
|
|
|
group by D.REPORTID,w.CUSTOMERNAME,w.GOODSOWNER
|
|
|
GO
|
|
|
|
|
|
CREATE VIEW [dbo].[VW_OP_WMS_REPORT_TIMEZONES_DETAIL_BYMBLNO] AS select D.REPORTID
|
|
|
,sum(d.PKGS) PKGS,sum(d.KGS) KGS,sum(d.CBM) CBM,sum(d.NETWEIGHT) NETWEIGHT,sum(d.STORAGEUNITCOUNT) STORAGEUNITCOUNT,sum(d.RULEUNITCOUNT) RULEUNITCOUNT
|
|
|
,sum(d.PKGS2_1) PKGS2_1,sum(d.KGS2_1) KGS2_1,sum(d.CBM2_1) CBM2_1,sum(d.NETWEIGHT2_1) NETWEIGHT2_1,sum(d.STORAGEUNITCOUNT2_1) STORAGEUNITCOUNT2_1,sum(d.RULEUNITCOUNT2_1) RULEUNITCOUNT2_1
|
|
|
,sum(d.PKGS2_2) PKGS2_2,sum(d.KGS2_2) KGS2_2,sum(d.CBM2_2) CBM2_2,sum(d.NETWEIGHT2_2) NETWEIGHT2_2,sum(d.STORAGEUNITCOUNT2_2) STORAGEUNITCOUNT2_2,sum(d.RULEUNITCOUNT2_2) RULEUNITCOUNT2_2
|
|
|
,sum(d.PKGS3) PKGS3,sum(d.KGS3) KGS3,sum(d.CBM3) CBM3,sum(d.NETWEIGHT3) NETWEIGHT3,sum(d.STORAGEUNITCOUNT3) STORAGEUNITCOUNT3,sum(d.RULEUNITCOUNT3) RULEUNITCOUNT3
|
|
|
|
|
|
,w.MBLNO ,w.CUSTOMERNAME,w.GOODSOWNER
|
|
|
,w.GOODSNAME,cg.GOODSFEETYPE,cg.GoodsTypeGID
|
|
|
from 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
|
|
|
|
|
|
group by D.REPORTID,w.MBLNO,w.GOODSNAME,w.CUSTOMERNAME,w.GOODSOWNER,cg.GOODSFEETYPE,cg.GoodsTypeGID
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_TRANSFERGOODS] AS select G.*,(select top 1 MBLNO from OP_WMS where exists (select 1 from OP_WMS_TRANSFERGOODS_DETAIL d where d.WMSID=op_wms.WMSID and d.WMSTRANSFERGOODSID=g.WMSTRANSFERGOODSID)) MBLNO,(select name from company where GID=CORPID) COMPANYNAME
|
|
|
,isnull((select sum(KGS) from OP_WMS_TRANSFERGOODS_DETAIL where WMSTRANSFERGOODSID=G.WMSTRANSFERGOODSID),0) KGS
|
|
|
,isnull((select sum(CBM) from OP_WMS_TRANSFERGOODS_DETAIL where WMSTRANSFERGOODSID=G.WMSTRANSFERGOODSID),0) CBM
|
|
|
,isnull((select sum(PKGS) from OP_WMS_TRANSFERGOODS_DETAIL where WMSTRANSFERGOODSID=G.WMSTRANSFERGOODSID),0) PKGS
|
|
|
,isnull((select sum(NETWEIGHT) from OP_WMS_TRANSFERGOODS_DETAIL where WMSTRANSFERGOODSID=G.WMSTRANSFERGOODSID),0) NETWEIGHT
|
|
|
,isnull((select sum(STORAGEUNITCOUNT) from OP_WMS_TRANSFERGOODS_DETAIL where WMSTRANSFERGOODSID=G.WMSTRANSFERGOODSID),0) STORAGEUNITCOUNT
|
|
|
,isnull((select sum(RULEUNITCOUNT) from OP_WMS_TRANSFERGOODS_DETAIL where WMSTRANSFERGOODSID=G.WMSTRANSFERGOODSID),0) RULEUNITCOUNT
|
|
|
from OP_WMS_TRANSFERGOODS G
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_TRANSFERGOODS_DETAIL] AS select d.*,w.GOODSNAME,w.MBLNO,w.CNTRNO,w.INDATE,w.WMSINDATE,w.FEESTARTDATE,w.FEERATESTARTDATE
|
|
|
from OP_WMS_TRANSFERGOODS_DETAIL d
|
|
|
left join op_wms w on w.WMSID=d.WMSID
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_WORKTOTAL] AS select
|
|
|
wd.WORKDETAILID
|
|
|
,wd.WMSDOID
|
|
|
,wd.WORKER
|
|
|
,wd.WORKDATE
|
|
|
,wd.WORKNAME
|
|
|
,wd.WORKLOADCOUNT
|
|
|
,wd.SCALE
|
|
|
,wd.WORKLOAD
|
|
|
,wd.REMARK
|
|
|
,wd.CORPID
|
|
|
,wh.WORKTYPE,wh.BSNO from OP_WMS_WORKDETAIL wd left join VW_OP_WMS_WORKHEAD wh
|
|
|
on wh.wmsdoid=wd.WMSDOID
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_user] AS SELECT ub.USERID, u.CODENAME, u.SHOWNAME, uc.COMPANYID, c.NAME AS companyname, sd.GID AS deptgid, sd.DEPTNAME, sd.DEPTNO, ub.EMAIL1, ub.mailsign,
|
|
|
u.WeChatAccount,u.Role_Id
|
|
|
FROM dbo.user_baseinfo AS ub LEFT OUTER JOIN
|
|
|
dbo.user_company AS uc ON uc.USERID = ub.USERID LEFT OUTER JOIN
|
|
|
dbo.sys_dept AS sd ON sd.DEPTNAME = ub.DEPTNAME AND sd.LINKID = uc.COMPANYID LEFT OUTER JOIN
|
|
|
dbo.[user] AS u ON u.GID = ub.USERID LEFT OUTER JOIN
|
|
|
dbo.company AS c ON c.GID = uc.COMPANYID
|
|
|
WHERE (u.ISDISABLE = 0) AND (u.ISDELETED = 0)
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_WMS_DETAIL_NULL] AS SELECT i.GID AS NID, i.GID, w.ASSOCIATEDNO, w.ASSOCIATEDNO AS BSNO, i.BLNO, i.CONTRACTNO, i.STORAGENAME, GOODSNAME=isnull((select top 1 GOODNAME from code_goods where GID=i.GOODSNAMEID),i.GOODSNAME),
|
|
|
i.GOODSMODEL, i.GOODSPACK, i.CHARGEUNIT, i.GOODSRKSL, isnull(i.GOODSSTOCK,0) as GOODSSTOCK, isnull(i.FREESTORAGEPERIOD,0) as FREESTORAGEPERIOD, i.ISLOCK, i.LOCKTIME,
|
|
|
(SELECT top 1 SHOWNAME
|
|
|
FROM dbo.[user]
|
|
|
WHERE (GID = i.LOCKUSER)) AS LOCKUSER, i.ISDELETE, i.DELETETIME,
|
|
|
(SELECT top 1 SHOWNAME
|
|
|
FROM dbo.[user] AS user_3
|
|
|
WHERE (GID = i.DELETEUSER)) AS DELETEUSER,
|
|
|
(SELECT top 1 SHOWNAME
|
|
|
FROM dbo.[user] AS user_2
|
|
|
WHERE (GID = i.MODIFIEDUSER)) AS MODIFIEDUSER, i.MODIFIEDTIME, '' AS GID_OUT, '' AS ASSOCIATEDNO_OUT,
|
|
|
'' AS INBSNO_OUT, '' AS OUTBSNO_OUT, '' AS BSNO_OUT, '' AS CLIENTGID_OUT,
|
|
|
'' AS CLIENTCODE_OUT, '' AS CUSTOMERNAME_OUT, null AS DODATE_OUT,
|
|
|
'' AS STORAGECODE_OUT, '' AS STORAGENAME_OUT, '' AS AREACODE_OUT,
|
|
|
'' AS AREANAME_OUT, '' AS GOODSCODE_OUT, '' AS GOODSNAME_OUT,
|
|
|
'' AS GOODSTYPE_OUT, '' AS GOODSMODEL_OUT, '' AS GOODSSTANDARD_OUT,
|
|
|
0 AS GOODSPACK_OUT, '' AS CHARGEUNIT_OUT, 0 AS GOODSPFSL_OUT, '' AS TRUCKNO_OUT,
|
|
|
'' AS CREATEUSER_OUT, null AS CREATETIME_OUT, '' AS REMARK_OUT,
|
|
|
0 as GOODSPACKPFSL_OUT, isnull(i.ARFEE,0) as ARFEE, isnull(i.APFEE,0) as APFEE, 0 AS ARFEE_OUT, 0 AS APFEE_OUT, 0 AS GOODSOUTFEE_OUT,
|
|
|
0 AS GOODSOUTFEEAP_OUT, w.WMSNO, CONVERT(char(10), w.WMSDATE, 20) AS WMSDATE, w.CUSTOMERNAME, w.WMSOP,
|
|
|
w.STOREMAN, isnull(i.GOODSPACKSTOCK,0) as GOODSPACKSTOCK, w.TRUCKNAME, w.STARTBILLINGDATE, w.CUSTOMNO, w.CUSTNO, i.GOODSSTANDARD, i.CORPID,
|
|
|
isnull(i.GOODSPACKACTUAL,0) as GOODSPACKACTUAL, isnull(i.GOODSRKSLACTUAL,0) as GOODSRKSLACTUAL,'' as CLIENTNAMEOLD,i.ISCHANGE,0 as ISCHANGE_OUT
|
|
|
,0 as GOODSPACKSTOCK_2, w.GID as WMSGID, '' AS OUTGID, '' AS OUTREMARK
|
|
|
,GOODSNUM=isnull((select SUM(oad.[Pkgs]) GOODSNUM from op_apply_detail as oad left join op_apply p on (p.BSNO=oad.BSNO) where p.ISCLEAR='1' and p.CUSTOMTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AND oad.WMSIN_GID=i.GID),0)-ISNULL((select SUM(GOODSPACKPFSL) as GOODSPACKPFSL from [wms_out_detail] where INBSNO=i.GID),0)
|
|
|
,w.WHS_CODE,i.GOODSNAMEID,i.AREANAME,w.BZTCHNO
|
|
|
,GOODNO=(select top 1 GOODNO from code_goods where GID=i.GOODSNAMEID)
|
|
|
,w.ACCDATE,FEESTATUSREF=(case when w.FEESTATUS='True' then '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' else 'δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' end)
|
|
|
,'' as ACCDATE_OUT,0 as FEESTATUS,'δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' as FEESTATUSREF_OUT
|
|
|
,i.GOODSSLICE,i.ISLOCK2
|
|
|
,ISBONDED=isnull((select top 1 ISBONDED from op_seai where BSNO=w.ASSOCIATEDNO),0)
|
|
|
,WeiWanShui=isnull(i.GOODSPACK,0)-isnull((select SUM(oad.[Pkgs]) GOODSNUM from op_apply_detail as oad left join op_apply p on (p.BSNO=oad.BSNO) where p.ISCLEAR='1' and p.CUSTOMTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AND oad.WMSIN_GID=i.GID),0)
|
|
|
,0 as GOODSSLICE_OUT,'' as TRUCKTYPE_OUT,'' as ZHUANGXIEGONGID_OUT,0 as TRUCKKGS_OUT, 0 AS ARFEE_2_OUT,'' as QianFengNO,GETDATE() as OLDCUSTFEEDATE,'' as ARCLIENTWMSOUT,'' as ARCLIENT,'' as TRUCKNAME_OUT,w.STARTBILLINGDATEAP,0 as ISLOCK_OUT
|
|
|
,i.PICIHAO,i.CHIMA1,i.CHIMA2,i.GOODSKGS,i.ZHONGLIANG2,i.COUNTRYID,i.CNTRNO
|
|
|
,IsNull((select substring(country,0,(charindex('(',country)) ) as country from code_country where COUNTRYID=i.countryid),'') as COUNTRY
|
|
|
FROM dbo.wms_in AS i LEFT OUTER JOIN dbo.wms AS w ON w.GID = i.ASSOCIATEDNO
|
|
|
WHERE (i.ISDELETE = 0) AND (i.CHARGEUNIT = 'CBM')
|
|
|
UNION ALL
|
|
|
SELECT i.GID AS NID, i.GID, i.ASSOCIATEDNO, i.ASSOCIATEDNO AS BSNO, i.BLNO, i.CONTRACTNO, i.STORAGENAME, GOODSNAME=isnull((select top 1 GOODNAME from code_goods where GID=i.GOODSNAMEID),i.GOODSNAME),
|
|
|
i.GOODSMODEL, i.GOODSPACK, i.CHARGEUNIT, i.GOODSRKSL, isnull(i.GOODSSTOCK,0) as GOODSSTOCK, isnull(i.FREESTORAGEPERIOD,0) as FREESTORAGEPERIOD, i.ISLOCK, i.LOCKTIME,
|
|
|
(SELECT top 1 SHOWNAME
|
|
|
FROM dbo.[user] AS user_4
|
|
|
WHERE (GID = i.LOCKUSER)) AS LOCKUSER, i.ISDELETE, i.DELETETIME,
|
|
|
(SELECT top 1 SHOWNAME
|
|
|
FROM dbo.[user] AS user_3
|
|
|
WHERE (GID = i.DELETEUSER)) AS DELETEUSER,
|
|
|
(SELECT top 1 SHOWNAME
|
|
|
FROM dbo.[user] AS user_2
|
|
|
WHERE (GID = i.MODIFIEDUSER)) AS MODIFIEDUSER, i.MODIFIEDTIME, '' AS GID_OUT, '' AS ASSOCIATEDNO_OUT,
|
|
|
'' AS INBSNO_OUT, '' AS OUTBSNO_OUT, '' AS BSNO_OUT, '' AS CLIENTGID_OUT,
|
|
|
'' AS CLIENTCODE_OUT, '' AS CUSTOMERNAME_OUT, null AS DODATE_OUT,
|
|
|
'' AS STORAGECODE_OUT, '' AS STORAGENAME_OUT, '' AS AREACODE_OUT,
|
|
|
'' AS AREANAME_OUT, '' AS GOODSCODE_OUT, '' AS GOODSNAME_OUT,
|
|
|
'' AS GOODSTYPE_OUT, '' AS GOODSMODEL_OUT, '' AS GOODSSTANDARD_OUT,
|
|
|
0 AS GOODSPACK_OUT, '' AS CHARGEUNIT_OUT, 0 AS GOODSPFSL_OUT, '' AS TRUCKNO_OUT,
|
|
|
'' AS CREATEUSER_OUT, null AS CREATETIME_OUT, '' AS REMARK_OUT,
|
|
|
0 as GOODSPACKPFSL_OUT, isnull(i.ARFEE,0) as ARFEE, isnull(i.APFEE,0) as APFEE, 0 AS ARFEE_OUT, 0 AS APFEE_OUT, 0 AS GOODSOUTFEE_OUT,
|
|
|
0 AS GOODSOUTFEEAP_OUT, i.WMSNO, CONVERT(char(10), i.WMSDATE, 20) AS WMSDATE, i.CUSTOMERNAME, i.WMSOP,
|
|
|
i.STOREMAN, isnull(i.GOODSPACKSTOCK,0) AS GOODSPACKSTOCK, i.TRUCKNAME, i.STARTBILLINGDATE, i.CUSTOMNO, i.CUSTNO, i.GOODSSTANDARD, i.CORPID,
|
|
|
isnull(i.GOODSPACKACTUAL,0) AS GOODSPACKACTUAL, isnull(i.GOODSRKSLACTUAL,0) AS GOODSRKSLACTUAL,'' as CLIENTNAMEOLD,i.ISCHANGE,0 as ISCHANGE_OUT
|
|
|
,0 as GOODSPACKSTOCK_2, i.GID as WMSGID, '' AS OUTGID, '' AS OUTREMARK
|
|
|
,GOODSNUM=isnull((select SUM(oad.[Pkgs]) GOODSNUM from op_apply_detail as oad left join op_apply p on (p.BSNO=oad.BSNO) where p.ISCLEAR='1' and p.CUSTOMTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AND oad.WMSIN_GID=i.GID),0)-ISNULL((select SUM(GOODSPACKPFSL) as GOODSPACKPFSL from [wms_out_detail] where INBSNO=i.GID),0)
|
|
|
,i.WHS_CODE,i.GOODSNAMEID,i.AREANAME,i.BZTCHNO
|
|
|
,GOODNO=(select top 1 GOODNO from code_goods where GID=i.GOODSNAMEID)
|
|
|
,i.ACCDATE,FEESTATUSREF=(case when i.FEESTATUS='True' then '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' else 'δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' end)
|
|
|
,'' as ACCDATE_OUT,0 as FEESTATUS,'δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' as FEESTATUSREF_OUT
|
|
|
,GOODSSLICE=ISNULL((select top 1 ISNULL(GOODSSLICE,0) AS GOODSSLICE FROM wms_in WHERE ASSOCIATEDNO=I.GID),0),i.ISLOCK2
|
|
|
,ISBONDED=ISNULL((select top 1 ISBONDED from op_seai where BSNO=i.ASSOCIATEDNO),0)
|
|
|
,WeiWanShui=isnull(i.GOODSPACK,0)-isnull((select SUM(oad.[Pkgs]) GOODSNUM from op_apply_detail as oad left join op_apply p on (p.BSNO=oad.BSNO) where p.ISCLEAR='1' and p.CUSTOMTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AND oad.WMSIN_GID=i.GID),0)
|
|
|
,0 as GOODSSLICE_OUT,'' as TRUCKTYPE_OUT,'' as ZHUANGXIEGONGID_OUT,0 as TRUCKKGS_OUT, 0 AS ARFEE_2_OUT,'' as QianFengNO,GETDATE() as OLDCUSTFEEDATE,'' as ARCLIENTWMSOUT,'' as ARCLIENT,'' as TRUCKNAME_OUT,i.STARTBILLINGDATEAP,0 as ISLOCK_OUT
|
|
|
,wi.PICIHAO,wi.CHIMA1,wi.CHIMA2,wi.GOODSKGS,wi.ZHONGLIANG2,wi.COUNTRYID,Wi.CNTRNO
|
|
|
,IsNull((select substring(country,0,(charindex('(',country)) ) as country from code_country where COUNTRYID=wi.countryid),'') as COUNTRY
|
|
|
FROM dbo.wms AS i left join wms_in wi on i.GID = wi.ASSOCIATEDNO
|
|
|
WHERE (i.ISDELETE = 0) AND (i.CHARGEUNIT <> 'CBM')
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_WMS_OUT_TOTAL] AS SELECT ISNULL(d.GID, i.GID) AS NID, d.CUSTOMERNAME, i.GOODSNAME, i.GOODSSTANDARD, '' AS GOODSGRADE, 0 AS GOODSSLICE, d.DODATE,
|
|
|
d.GOODSPACKPFSL, d.GOODSPFSL, i.CHARGEUNIT
|
|
|
FROM dbo.wms_out_detail AS d LEFT OUTER JOIN
|
|
|
dbo.wms AS i ON i.GID = d.INBSNO
|
|
|
LEFT OUTER JOIN
|
|
|
dbo.wms_out AS o ON d.OUTBSNO = o.BSNO
|
|
|
WHERE (i.ISDELETE = 0) AND ((i.CHARGEUNIT <> 'CBM') OR (o.ISDETAIL = '0'))
|
|
|
UNION ALL
|
|
|
SELECT ISNULL(d.GID, i.GID) AS NID, (CASE ISNULL(i.REMARK, '') WHEN '' THEN ISNULL(d .CUSTOMERNAME, '') ELSE ISNULL(i.REMARK, '') END)
|
|
|
AS CUSTOMERNAME, i.GOODSNAME, i.GOODSSTANDARD, i.GOODSGRADE, i.GOODSSLICE, d.DODATE, d.GOODSPACKPFSL, d.GOODSPFSL,
|
|
|
i.CHARGEUNIT
|
|
|
FROM dbo.wms_out_detail AS d LEFT OUTER JOIN
|
|
|
dbo.wms_in AS i ON i.GID = d.INBSNO
|
|
|
LEFT OUTER JOIN
|
|
|
dbo.wms_out AS o ON d.OUTBSNO = o.BSNO
|
|
|
WHERE (i.ISDELETE = 0) AND ((i.CHARGEUNIT = 'CBM') OR (o.ISDETAIL = '1'))
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_WMS_STOCKTAKE_2] AS SELECT i.CUSTOMERNAME + i.GOODSNAME + i.GOODSSTANDARD + i.CHARGEUNIT AS NID, i.CUSTOMERNAME AS REMARK, i.GOODSNAME,
|
|
|
i.GOODSSTANDARD, i.CHARGEUNIT, isnull(d .GOODSSLICE, 0) AS GOODSSLICE, ISNULL(sum(i.GOODSRKSL), 0) AS hj_GOODSRKSL,
|
|
|
ISNULL(SUM(d .GOODSPFSL), 0) AS hj_GOODSPFSL_OUT, ISNULL(sum(i.GOODSSTOCK), 0) AS hj_GOODSSTOCK, ISNULL(sum(i.GOODSPACK), 0)
|
|
|
AS hj_GOODSPACK, ISNULL(SUM(d .GOODSPACKPFSL), 0) AS hj_GOODSPACKPFSL, ISNULL(sum(i.GOODSPACKSTOCK), 0) AS hj_GOODSPACKSTOCK,
|
|
|
ISNULL(SUM(i.GOODSPACKACTUAL), 0) AS hj_GOODSPACKACTUAL, ISNULL(SUM(i.GOODSRKSLACTUAL), 0) AS hj_GOODSRKSLACTUAL
|
|
|
FROM wms AS i LEFT OUTER JOIN
|
|
|
(SELECT INBSNO, GOODSSLICE,ISDETAIL,ISNULL(SUM(wms_out_detail.GOODSPFSL), 0) AS GOODSPFSL, ISNULL(SUM(wms_out_detail.GOODSPACKPFSL), 0) AS GOODSPACKPFSL
|
|
|
FROM wms_out_detail LEFT OUTER JOIN
|
|
|
wms_out ON wms_out.BSNO = wms_out_detail.OUTBSNO
|
|
|
GROUP BY INBSNO, GOODSSLICE,ISDETAIL) AS d ON i.GID = d .INBSNO
|
|
|
WHERE ((i.CHARGEUNIT <> 'CBM') OR (d.ISDETAIL = '0')) AND i.ISDELETE = 0
|
|
|
GROUP BY i.CUSTOMERNAME, i.GOODSNAME, i.GOODSSTANDARD, i.CHARGEUNIT, isnull(d .GOODSSLICE, 0)
|
|
|
UNION ALL
|
|
|
SELECT i.REMARK + i.GOODSNAME + i.GOODSSTANDARD + i.CHARGEUNIT + CONVERT(varchar, i.GOODSSLICE) AS NID, i.REMARK, i.GOODSNAME,
|
|
|
i.GOODSSTANDARD, i.CHARGEUNIT, isnull(i.GOODSSLICE, 0) AS GOODSSLICE, ISNULL(SUM(i.GOODSRKSL), 0) AS hj_GOODSRKSL,
|
|
|
ISNULL(SUM(d .GOODSPFSL), 0) AS hj_GOODSPFSL_OUT, ISNULL(SUM(i.GOODSSTOCK), 0) AS hj_GOODSSTOCK, ISNULL(SUM(i.GOODSPACK), 0)
|
|
|
AS hj_GOODSPACK, ISNULL(SUM(d .GOODSPACKPFSL), 0) AS hj_GOODSPACKPFSL, ISNULL(SUM(i.GOODSPACKSTOCK), 0) AS hj_GOODSPACKSTOCK,
|
|
|
ISNULL(SUM(i.GOODSPACKACTUAL), 0) AS hj_GOODSPACKACTUAL, ISNULL(SUM(i.GOODSRKSLACTUAL), 0) AS hj_GOODSRKSLACTUAL
|
|
|
FROM wms_in AS i LEFT OUTER JOIN
|
|
|
(SELECT INBSNO,ISDETAIL, ISNULL(SUM(wms_out_detail.GOODSPFSL), 0) AS GOODSPFSL, ISNULL(SUM(wms_out_detail.GOODSPACKPFSL), 0) AS GOODSPACKPFSL
|
|
|
FROM wms_out_detail LEFT OUTER JOIN
|
|
|
wms_out ON wms_out.BSNO = wms_out_detail.OUTBSNO
|
|
|
GROUP BY INBSNO,ISDETAIL) AS d ON i.GID = d .INBSNO
|
|
|
WHERE ((i.CHARGEUNIT = 'CBM') OR (d.ISDETAIL = '1'))AND i.ISDELETE = 0
|
|
|
GROUP BY i.REMARK, i.GOODSNAME, i.GOODSSTANDARD, i.CHARGEUNIT, i.GOODSSLICE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_REP_WMSINDO] AS select wc.WMSLOGID,id.DODATE,w.CORPID, w.CUSTOMERNAME,w.GOODSNAME,w.MBLNO,w.CUSTOMNO,w.CNTRNO,wc.PKGS,wc.KGS,wc.NETWEIGHT,wc.CBM,wc.PKGS3,wc.KGS3,wc.NETWEIGHT3,wc.CBM3,idg.STOREHOUSE ,idg.AREACODE,w.OP
|
|
|
,wc.CHANGETYPE,id.BSNO,GOODSFEETYPE,GoodsTypeGID,w.GOODSOWNER
|
|
|
,inplan.INSPECTION_NO,inplan.CONTRACTNO,inplan.JINGNEISHOUHUOREN
|
|
|
,inplan.JINJINGBEIANSHENBAORIQI,inplan.CUSTOMAMOUNT
|
|
|
,inplan.CUSTOMAMOUNT/(select sum(kgs) from OP_WMS_in_DO_GOODS where WMSPLANID=inplan.WMSPLANID) CUSTOMAMOUNT_KGS
|
|
|
,inplan.CUSTOMAMOUNT*idg.KGS/(select sum(kgs) from OP_WMS_in_DO_GOODS where WMSPLANID=inplan.WMSPLANID) CUSTOMAMOUNT_SINGLE
|
|
|
,id.CreateID DO_CreateID,inplan.CreateID PLAN_CreateID
|
|
|
from OP_WMS_CHANGE wc
|
|
|
left join op_wms w on w.WMSID=wc.WMSID
|
|
|
left join op_wms_in_do id on id.WMSDOID=wc.DOBSNO
|
|
|
left join OP_WMS_in_DO_GOODS idg on idg.WMSDODETAILID=wc.DOGID
|
|
|
left join OP_WMS_IN_PLAN inplan on inplan.WMSPLANID=idg.WMSPLANID
|
|
|
left join code_goods cg on cg.GOODNAME=w.GOODSNAME
|
|
|
where wc.CHANGETYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
GO
|
|
|
|
|
|
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_REP_WMSOUTDO] AS select wc.WMSLOGID,od.DODATE,w.CORPID, w.CUSTOMERNAME,w.GOODSNAME,w.MBLNO,w.CUSTOMNO,w.CNTRNO,-wc.PKGS PKGS,-wc.KGS KGS,-wc.NETWEIGHT NETWEIGHT,-wc.CBM CBM,wc.PKGS3,wc.KGS3,wc.NETWEIGHT3,wc.CBM3,-wc.STORAGEUNITCOUNT STORAGEUNITCOUNT,wc.STORAGEUNITCOUNT3,p.STOREHOUSE ,p.AREACODE,w.OP
|
|
|
,wc.CHANGETYPE,od.WMSNO,cg.GOODSFEETYPE,cg.GoodsTypeGID,w.GOODSOWNER
|
|
|
,od.TRUCKNO,w.INDATE,w.WMSINDATE,w.FEESTARTDATE,od.CUSTOMNO CUSTOMNO_OUT
|
|
|
,od.CreateID DO_CreateID
|
|
|
from OP_WMS_CHANGE wc
|
|
|
left join op_wms w on w.WMSID=wc.WMSID
|
|
|
left join op_wms_OUT_do od on od.WMSDOID=wc.DOBSNO
|
|
|
left join OP_WMS_OUT_DO_GOODS odg on odg.WMSDOID=wc.DOBSNO and odg.WMSDODETAILID=wc.DOGID
|
|
|
left join OP_WMS_PHYSICS p on p.WMSPHYSICSID=odg.WMSPHYSICSID
|
|
|
left join code_goods cg on cg.GOODNAME=w.GOODSNAME
|
|
|
where wc.CHANGETYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
GO
|
|
|
|
|
|
|
|
|
|
|
|
|