|
|
|
|
|
--drop table [OP_WMS_PROJECT]
|
|
|
CREATE TABLE [dbo].[OP_WMS_PROJECT](
|
|
|
[WMSPROJECTID] [uniqueidentifier] NOT NULL,
|
|
|
[BSNO] [varchar](50) NULL,
|
|
|
[PROJECTNAME] [varchar](50) NULL,
|
|
|
[INDATE] [datetime] NULL,
|
|
|
[GOODSNAME] [varchar](200) NULL,
|
|
|
[BILLSTATUS] [varchar](50) NULL,
|
|
|
[REMARK] [varchar](50) NULL,
|
|
|
[CORPID] [varchar](50) NULL,
|
|
|
[CreateID] [uniqueidentifier] NULL,
|
|
|
[Creator] [varchar](50) NULL,
|
|
|
[CreateDate] [datetime] NULL,
|
|
|
[STORAGEUNITCOUNT] [numeric](22, 6) NULL,
|
|
|
[COUNTRY] [varchar](100) NULL,
|
|
|
CONSTRAINT [PK_OP_WMS_PROJECT] PRIMARY KEY CLUSTERED
|
|
|
(
|
|
|
[WMSPROJECTID] ASC
|
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
|
) ON [PRIMARY]
|
|
|
GO
|
|
|
|
|
|
alter table OP_WMS_IN_DO add WMSPROJECTID uniqueidentifier null
|
|
|
GO
|
|
|
|
|
|
Create VIEW [dbo].[VW_OP_WMS_IN_DO_PROJECT] AS select
|
|
|
D.[BSNO]
|
|
|
,[WMSDOID]
|
|
|
,D.WMSPROJECTID
|
|
|
,J.PROJECTNAME
|
|
|
,[CUSTOMERNAME]
|
|
|
,[MATERIALNO]
|
|
|
,[GOODSCODE]
|
|
|
,D.GOODSNAME
|
|
|
,[GOODSHSCODE]
|
|
|
,D.MBLNO
|
|
|
,[PAYEDTAXES]
|
|
|
,[BSSTATUS]
|
|
|
,D.CreateDate
|
|
|
,D.Creator
|
|
|
,D.CreateID
|
|
|
,D.REMARK
|
|
|
,[FEESTATUS]
|
|
|
,D.BILLSTATUS
|
|
|
,[DODATE]
|
|
|
,D.CORPID
|
|
|
,[CUSTOMNO]
|
|
|
,[GOODSOWNER]
|
|
|
,(select top 1 GOODSFEETYPE from code_goods where GOODNAME=D.GOODSNAME)GOODSFEETYPE
|
|
|
,ARCLIENTWMSOUT,APCLIENTWMSOUT,
|
|
|
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
|
|
|
left join OP_WMS_PROJECT J on J.WMSPROJECTID=D.WMSPROJECTID
|
|
|
where EXISTS (select 1 from OP_WMS_PROJECT where WMSPROJECTID=D.WMSPROJECTID)
|
|
|
GO
|
|
|
|
|
|
|
|
|
--select * from tSysBillType
|
|
|
insert into tSysBillType(BillCode,BillName,BillGrp,IsRule,NoLength,IsPrefix,PrefixLen,PrefixNo,IsDate,DateFmt,SerialLen,YearNo,MonthNo,DayNo,MaxSerial,BillHeadTbl,IsOrgPrefix,GID,IsEmpPrefix)values('WM15','<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD>Ŀ','<EFBFBD>ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','1',18,'1',4,'WMPO','1','YYYYMMDD',4,'2020','01','01',57,'OP_WMS_PROJECT','0','AE4B3FCC-B8C9-4526-BB30-6096824F26A9',NULL)
|
|
|
|
|
|
--delete from sys_billno_set where gid= 'C0778808-BFE9-4C39-9501-54A86950C212'
|
|
|
insert sys_billno_set(GID,OPLBNAME,RULEBLNO,RULEDATETYPE,BILLTYPE,COMPANYID,CREATEUSER,CREATETIME,ISEDIT,ISAUTO,CUSTOMHEAD) values( 'AE4B3FCC-B8C9-4526-BB30-6096824F26A9' , '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD>Ŀ' , 'ί<EFBFBD>б<EFBFBD><EFBFBD><EFBFBD>' , 'ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' , 'WM15' , 'Comcab2d43f60454327af30a131fc1d3abd' , NULL , NULL , '1' , NULL , NULL )
|
|
|
|
|
|
alter table OP_WMS_OUT_DO_GOODS add TRUCKNO varchar(50) null
|
|
|
go
|
|
|
|
|
|
alter table OP_WMS_OUT_DO add WMSPROJECTID uniqueidentifier null
|
|
|
GO
|
|
|
|
|
|
alter table OP_WMS add WMSPROJECTID uniqueidentifier null
|
|
|
GO
|
|
|
|
|
|
--drop view [VW_OP_WMS_OUT_DO_PROJECT]
|
|
|
CREATE VIEW [dbo].[VW_OP_WMS_OUT_DO_PROJECT] AS SELECT D.[WMSDOID]
|
|
|
,D.[WMSNO]
|
|
|
,D.[DODATE]
|
|
|
,D.[CUSTOMERNAME]
|
|
|
,D.[CORPID]
|
|
|
,D.[REMARK]
|
|
|
,D.[Creator]
|
|
|
,D.[CreateID]
|
|
|
,D.[CreateDate]
|
|
|
,D.[ModifyDate]
|
|
|
,D.[ModifyID]
|
|
|
,D.[Modifier]
|
|
|
,D.[ISEND]
|
|
|
,D.[FEESTATUS]
|
|
|
,D.[BSSTATUS]
|
|
|
,D.[BSSOURCE]
|
|
|
,D.[BILLSTATUS]
|
|
|
,D.[MBLNO]
|
|
|
,D.[CUSTOMNO_IMPORT]
|
|
|
,D.[PICKUPNAME]
|
|
|
,D.[TRUCKNO]
|
|
|
,D.[TRUCKMODEL]
|
|
|
,D.[WMSPLANID]
|
|
|
,D.[CUSTOMNO],dbo.F_OUTDODETAIL_CNTRNO(d.WMSDOID) CNTRNO
|
|
|
,D.GOODSNAME,D.GOODSFEETYPE,WEIGHING
|
|
|
,(select sum(PKGS) from OP_WMS_OUT_DO_GOODS where WMSDOID=D.WMSDOID) PKGS
|
|
|
,(select sum(PKGS) from OP_WMS_OUT_DO_GOODS where WMSDOID=D.WMSDOID) KGS
|
|
|
,D.STLMODE,D.WMSPROJECTID
|
|
|
|
|
|
FROM [dbo].[OP_WMS_OUT_DO] D
|
|
|
where D.WMSPROJECTID is not null
|
|
|
GO
|
|
|
|
|
|
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_OUT_DO_GOODS]
|
|
|
AS
|
|
|
SELECT odg.WMSDODETAILID, odg.WMSDOID,
|
|
|
odg.WMSPLANDETAILID, odg.MATERIALNO,
|
|
|
odg.GOODSCODE, odg.GOODSNAME,
|
|
|
odg.GOODSHSCODE, odg.MBLNO,
|
|
|
odg.CNTRNO, odg.STOREHOUSE,
|
|
|
odg.AREACODE, odg.KGS, odg.NETWEIGHT,
|
|
|
odg.CBM, odg.PKGS,
|
|
|
odg.KINDPKGS, odg.STORAGEUNIT,
|
|
|
odg.STORAGEUNITCOUNT, odg.RULEUNIT,
|
|
|
odg.RULEUNITCOUNT, odg.WMSID,
|
|
|
od.CUSTOMERNAME, od.WMSNO, od.ISEND,
|
|
|
od.FEESTATUS, od.BSSTATUS, od.BILLSTATUS,
|
|
|
od.CORPID, od.DODATE, od.BSSOURCE,
|
|
|
odg.MBLNO AS Expr1, od.CUSTOMNO_IMPORT,
|
|
|
od.CUSTOMNO, od.PICKUPNAME, od.TRUCKNO DO_TRUCKNO,
|
|
|
od.TRUCKMODEL, od.WMSPLANID,w.ARCLIENTWMSOUT
|
|
|
,opd.KGS PLAN_KGS,opd.PKGS PLAN_PKGS,opd.CBM PLAN_CBM,opd.NETWEIGHT PLAN_NETWEIGHT
|
|
|
,opd.STORAGEUNITCOUNT PLAN_STORAGEUNITCOUNT
|
|
|
,opd.RULEUNITCOUNT PLAN_RULEUNITCOUNT,odg.TRUCKNO
|
|
|
FROM OP_WMS_OUT_DO_GOODS odg
|
|
|
left join dbo.OP_WMS_OUT_DO od ON od.WMSDOID = odg.WMSDOID
|
|
|
left join OP_WMS w on w.WMSID= odg.WMSID
|
|
|
left join OP_WMS_OUT_PLAN_DETAIL opd on opd.WMSOUTDETAILID=odg.WMSPLANDETAILID
|
|
|
GO
|
|
|
|
|
|
|
|
|
ALTER VIEW [dbo].[Vw_Op_Wms_Need] AS
|
|
|
|
|
|
select w.[WMSID],w.WMSBASEID,w.WMSPROJECTID,w.BSNO,w.CUSTOMERNAME,w.CORPID
|
|
|
,w.MBLNO,w.CUSTOMNO,w.CNTRNO,w.GOODSNAME,w.INDATE,w.OP
|
|
|
,w.KGS-isnull(td.KGS,0)-isnull(opd_0.KGS,0)-isnull(opd.KGS,0)+isnull(odg.KGS,0)-isnull(odg_noplan.KGS,0) [KGS]
|
|
|
,w.NETWEIGHT-isnull(td.NETWEIGHT,0)-isnull(opd_0.NETWEIGHT,0)-isnull(opd.NETWEIGHT,0)+isnull(odg.NETWEIGHT,0)-isnull(odg_noplan.NETWEIGHT,0) [NETWEIGHT]
|
|
|
,w.CBM-isnull(td.CBM,0)-isnull(opd_0.CBM,0)-isnull(opd.CBM,0)+isnull(odg.CBM,0)-isnull(odg_noplan.CBM,0) [CBM]
|
|
|
,w.PKGS-isnull(td.PKGS,0)-isnull(opd_0.PKGS,0)-isnull(opd.PKGS,0)+isnull(odg.PKGS,0)-isnull(odg_noplan.PKGS,0) [PKGS]
|
|
|
,w.[KINDPKGS]
|
|
|
,w.[STORAGEUNIT]
|
|
|
,w.STORAGEUNITCOUNT-isnull(td.STORAGEUNITCOUNT,0)-isnull(opd_0.STORAGEUNITCOUNT,0)-isnull(opd.STORAGEUNITCOUNT,0)+isnull(odg.STORAGEUNITCOUNT,0)-isnull(odg_noplan.STORAGEUNITCOUNT,0)[STORAGEUNITCOUNT]
|
|
|
,w.[RULEUNIT]
|
|
|
,-isnull(odg_noplan.KGS,0) KGS_odg_noplan
|
|
|
,w.RULEUNITCOUNT-isnull(td.RULEUNITCOUNT,0)-isnull(opd_0.RULEUNITCOUNT,0)-isnull(opd.RULEUNITCOUNT,0)+isnull(odg.RULEUNITCOUNT,0)-isnull(odg_noplan.RULEUNITCOUNT,0)[RULEUNITCOUNT]
|
|
|
,w.[FEESTARTDATE]
|
|
|
,w.[FEEENDDATE],w.[FEERATESTARTDATE]
|
|
|
,w.WMSINDATE
|
|
|
,isnull(w.MBLNO,'')+'_'+isnull(w.CNTRNO,'') MBLNOCNTRNO
|
|
|
,w.KGS-isnull(td.KGS,0)-isnull(opd_0.KGS,0)-isnull(opd.KGS,0)-isnull(odg_noplan.KGS,0)+
|
|
|
w.NETWEIGHT-isnull(td.NETWEIGHT,0)-isnull(opd.NETWEIGHT,0)-isnull(odg_noplan.NETWEIGHT,0)+
|
|
|
w.CBM-isnull(td.CBM,0)-isnull(opd_0.CBM,0)-isnull(opd.CBM,0)-isnull(odg_noplan.CBM,0)+
|
|
|
w.PKGS-isnull(td.PKGS,0)-isnull(opd_0.PKGS,0)-isnull(opd.PKGS,0)-isnull(odg_noplan.PKGS,0) ALLSTORAGECOUNT
|
|
|
,w.GOODSOWNER,w.ARCLIENTWMSOUT
|
|
|
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_0
|
|
|
where exists (select 1 from OP_WMS_OUT_PLAN_BEFORE where WMSOUTPLANBEFOREID=opd_0.WMSPLANID and isnull(OP_WMS_OUT_PLAN_BEFORE.isend,0)=0)
|
|
|
group by wmsid)opd_0 on opd_0.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 exists (select 1 from OP_WMS_OUT_PLAN where WMSPLANID=_opd.WMSPLANID) and
|
|
|
(select isnull(isend,0) from OP_WMS_OUT_PLAN where WMSPLANID=_opd.WMSPLANID)=0
|
|
|
and isnull(_opd.PLAN_BEFORE_DETAIL_GID,'00000000-0000-0000-0000-000000000000')='00000000-0000-0000-0000-000000000000'
|
|
|
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 )
|
|
|
or exists (select 1 from OP_WMS_OUT_PLAN_BEFORE where isnull(isend,0)=0 and WMSOUTPLANBEFOREID in (select wmsplanid from OP_WMS_OUT_PLAN_DETAIL where PLAN_BEFORE_DETAIL_GID in (select WMSOUTDETAILID from OP_WMS_OUT_PLAN_DETAIL where WMSPLANDETAILID=_odg.WMSPLANDETAILID)))
|
|
|
group by wmsid)odg on odg.WMSID=w.WMSID
|
|
|
|
|
|
--<2D><>ȥ<EFBFBD>ƻ<DEBC><C6BB><EFBFBD> δ<><CEB4><EFBFBD>ɵ<EFBFBD> <20><><EFBFBD><EFBFBD>ִ<EFBFBD>е<EFBFBD> ִ<><D6B4><EFBFBD><EFBFBD>ϸ
|
|
|
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 _odg.WMSPLANDETAILID is null
|
|
|
|
|
|
group by wmsid)odg_noplan on odg_noplan.WMSID=w.WMSID
|
|
|
|
|
|
GO
|
|
|
|
|
|
|
|
|
Create View [dbo].[Vw_Op_Wms_Need_Project] as
|
|
|
select vwn.*,
|
|
|
p.STOREHOUSE,p.AREACODE from Vw_Op_Wms_Need vwn
|
|
|
left join OP_WMS_PROJECT wb on wb.WMSPROJECTID=vwn.WMSPROJECTID
|
|
|
left join OP_WMS_PHYSICS p on p.WMSID=vwn.WMSID and (p.PKGS>0 and (p.KGS>0 or p.CBM>0))
|
|
|
where vwn.WMSPROJECTID is not null and vwn.ALLSTORAGECOUNT>0
|
|
|
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
|
|
|
,ARCLIENTWMSOUT,WMSBASEID,WMSPROJECTID
|
|
|
from OP_WMS
|
|
|
GO
|
|
|
|
|
|
alter VIEW [dbo].[VW_OP_WMS_TRUCKINFO_DRIVER] AS select isnull( D.GID,newid()) GID, D.PID,isnull(DRIVERNAME,'') DRIVERNAME,isnull(DRIVERTEL,'')DRIVERTEL,isnull(D.LICENSENUM,'')LICENSENUM
|
|
|
,TRUCKNO ,isnull(TRUCKTEAM,'')TRUCKTEAM,TRUCKMODEL
|
|
|
from OP_WMS_TRUCKINFO T left join OP_WMS_TRUCKINFO_DRIVER D on T.GID=D.PID
|
|
|
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
|
|
|
|
|
|
CREATE TABLE [dbo].[OP_WMS_TRUCKDETAIL] (
|
|
|
[GID] uniqueidentifier NOT NULL,
|
|
|
[PID] uniqueidentifier NOT NULL,
|
|
|
[PARENTTYPE] varchar(20) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[TRUCKNO] varchar(20) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[TRUCKMODEL] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[DRIVERNAME] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[DRIVERTEL] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
[REMARK] varchar(200) COLLATE Chinese_PRC_CI_AS NULL,
|
|
|
CONSTRAINT [PK_OP_WMS_TRUCKDETAIL] 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_TRUCKDETAIL] SET (LOCK_ESCALATION = TABLE)
|
|
|
|
|
|
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
|
|
|
|
|
|
go
|
|
|
|
|
|
CREATE VIEW [dbo].[VW_OP_WMS_IN_PLAN_GOODS_IMPORT] AS select inplan.MBLNO,inplangoods.CNTRNO,inplangoods.KGS,inplangoods.CBM,inplangoods.NETWEIGHT,inplangoods.PKGS,inplangoods.GOODSNAME,inplangoods.GOODSMODEL from OP_WMS_IN_PLAN inplan left join OP_WMS_IN_PLAN_GOODS inplangoods on inplan.WMSPLANID=inplangoods.WMSPLANID
|
|
|
go
|
|
|
|