|
|
|
|
|
|
|
|
|
|
|
alter table OP_WMS_STOREHOUSE_AREA add GoodsTypeGID varchar(50) null
|
|
|
GO
|
|
|
|
|
|
alter table code_goods add RULEUNIT1 varchar(50) null
|
|
|
GO
|
|
|
|
|
|
|
|
|
alter table OP_WMS_IN_PLAN add COUNTRY varchar(100) null
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_IN_DO_GOODS]
|
|
|
AS
|
|
|
SELECT WMSDODETAILID, WMSDOID, STOREHOUSE, AREACODE,WIG.KGS, WIG.CBM, WIG.PKGS, WIG.KINDPKGS, WIG.STORAGEUNIT,
|
|
|
WIG.STORAGEUNITCOUNT, WIG.RULEUNIT, WIG.RULEUNITCOUNT, WIG.WMSPLANID, WMSPLANDETAILID, WIG.MBLNO, WIG.CNTRNO, WIG.REMARK, WIG.ARCLIENTWMSOUT,
|
|
|
OP, WIG.NETWEIGHT, REMARK2,ipg.SEALNO SEALNO,ipg.CTNALL,ISNULL(ipg.CUSTOMSINSPECTION, 0) CUSTOMSINSPECTION,
|
|
|
ISNULL(ipg.STOREHOUSEINSPECTION, 0) STOREHOUSEINSPECTION,ipg.GOODSNAME,inplan.COUNTRY
|
|
|
|
|
|
FROM dbo.OP_WMS_IN_DO_GOODS AS WIG left join OP_WMS_IN_PLAN_GOODS ipg on ipg.GID=wig.WMSPLANDETAILID
|
|
|
left join op_wms_in_plan inplan on inplan.WMSPLANID=ipg.WMSPLANID
|
|
|
GO
|
|
|
|
|
|
alter table OP_WMS add COUNTRY varchar(100) null
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_IN_PLAN] AS select [WMSPLANID]
|
|
|
,[WMSNO]
|
|
|
,[MBLNO]
|
|
|
,[CONTRACTNO]
|
|
|
,[BILLTYPE]
|
|
|
,[PLANTIME]
|
|
|
,[ACCDATE]
|
|
|
,[CUSTOMERNAME]
|
|
|
,[CORPID]
|
|
|
,[KGS]
|
|
|
,[PKGS]
|
|
|
,[CBM]
|
|
|
,[GOODSNAME]
|
|
|
,[KINDPKGS]
|
|
|
,[STORAGEUNIT]
|
|
|
,[STORAGEUNITCOUNT]
|
|
|
,[RULEUNIT]
|
|
|
,[RULEUNITCOUNT]
|
|
|
,[REMARK]
|
|
|
,[BSSOURCE]
|
|
|
,[Creator]
|
|
|
,[CreateID]
|
|
|
,[CreateDate]
|
|
|
,[FEESTATUS]
|
|
|
,[BSSTATUS]
|
|
|
,[TIMEMARK]
|
|
|
,[ModifyDate]
|
|
|
,[ModifyID]
|
|
|
,[Modifier]
|
|
|
,[ISEND]
|
|
|
,[MASTERBSNO]
|
|
|
,[NETWEIGHT]
|
|
|
,[CUSTOMNO]
|
|
|
,[ETA]
|
|
|
,[CTNNUM]
|
|
|
,[JINJINGBEIANSHENBAORIQI]
|
|
|
,[JINGNEISHOUHUOREN]
|
|
|
,[INSPECTION_NO]
|
|
|
,[PLAN_GETTIME]
|
|
|
,[CUSTOMAMOUNT]
|
|
|
,(select top 1 GOODSFEETYPE from code_goods where GOODNAME=GOODSNAME)GOODSFEETYPE
|
|
|
,GOODSOWNER
|
|
|
,BILLSTATUS,ARCLIENTWMSOUT,COUNTRY
|
|
|
FROM [OP_WMS_IN_PLAN]
|
|
|
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,w.ARCLIENTWMSOUT
|
|
|
,(select top 1 goodstypegid from code_goods where GOODNAME=p.GOODSNAME)GOODSTYPEGID
|
|
|
,w.COUNTRY
|
|
|
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
|
|
|
|
|
|
|
|
|
ALTER view [dbo].[VW_OP_WMS_REPORT_TIMEZONES_DETAIL] as
|
|
|
|
|
|
SELECT [ID]
|
|
|
,[REPORTID]
|
|
|
,d.[WMSID]
|
|
|
,w.MBLNO,w.CNTRNO,w.GOODSNAME,w.CUSTOMERNAME,isnull(w.GOODSOWNER,'') GOODSOWNER,isnull(w.CUSTOMNO,'')CUSTOMNO,isnull(w.OP,'') OP
|
|
|
,isnull(cg.GOODSFEETYPE,'')GOODSFEETYPE,isnull(cgt.GoodsTypeName,'')GoodsTypeName,w.INDATE
|
|
|
,d.[PKGS]
|
|
|
,d.[KGS]
|
|
|
,d.[CBM]
|
|
|
,d.[NETWEIGHT]
|
|
|
,d.[STORAGEUNITCOUNT]
|
|
|
,d.[RULEUNITCOUNT]
|
|
|
,[PKGS2_1]
|
|
|
,[KGS2_1]
|
|
|
,[CBM2_1]
|
|
|
,[NETWEIGHT2_1]
|
|
|
,[STORAGEUNITCOUNT2_1]
|
|
|
,[RULEUNITCOUNT2_1]
|
|
|
,[PKGS2_2]
|
|
|
,[KGS2_2]
|
|
|
,[CBM2_2]
|
|
|
,[NETWEIGHT2_2]
|
|
|
,[STORAGEUNITCOUNT2_2]
|
|
|
,[RULEUNITCOUNT2_2]
|
|
|
,[PKGS3]
|
|
|
,[KGS3]
|
|
|
,[CBM3]
|
|
|
,[NETWEIGHT3]
|
|
|
,[STORAGEUNITCOUNT3]
|
|
|
,[RULEUNITCOUNT3]
|
|
|
,[CUSTOMNO_OUT]
|
|
|
,[STOREHOUSE]
|
|
|
,[AREACODE]
|
|
|
,w.COUNTRY
|
|
|
FROM [dbo].[OP_WMS_REPORT_TIMEZONES_DETAIL] d
|
|
|
left join OP_WMS w on w.WMSID=d.WMSID
|
|
|
left join code_goods cg on cg.GOODNAME=w.GOODSNAME
|
|
|
left join code_goodsType cgt on cgt.GID=cg.GoodsTypeGID
|
|
|
GO
|
|
|
|
|
|
ALTER 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,w.GOODSOWNER,w.ARCLIENTWMSOUT,w.COUNTRY
|
|
|
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_WMS_IN_PLAN_GOODS_NEEDDO] AS SELECT * from (
|
|
|
select g.CBM,g.CNTRNO,g.SEALNO,g.CUSTOMSINSPECTION,g.GID,g.GOODSCODE,p.GOODSNAME,g.GOODSHSCODE,g.KGS,g.NETWEIGHT,g.PKGS,g.KINDPKGS,g.MATERIALNO
|
|
|
,g.REMARK,g.RULEUNIT,g.RULEUNITCOUNT,g.STORAGEUNIT,g.STORAGEUNITCOUNT,g.STOREHOUSEINSPECTION,g.WMSPLANID,p.CUSTOMNO,
|
|
|
--g.*
|
|
|
--,
|
|
|
p.mblno MBLNO ,p.mblno+'-'+g.CNTRNO MBLNOCNTRNO,isnull(p.ISEND,'false') ISEND,p.PLANTIME,p.CUSTOMERNAME,p.BSSTATUS planbsstatus
|
|
|
,p.ETA,p.CTNNUM,p.JINJINGBEIANSHENBAORIQI,p.JINGNEISHOUHUOREN,p.INSPECTION_NO,p.PLAN_GETTIME
|
|
|
,isnull((select sum(pkgs) from OP_WMS_IN_DO_GOODS where WMSPLANDETAILID=g.GID),0) DONEPKGS
|
|
|
,isnull((select sum(kgs) from OP_WMS_IN_DO_GOODS where WMSPLANDETAILID=g.GID),0) DONEKGS
|
|
|
,p.GOODSOWNER,g.CTNALL,p.ARCLIENTWMSOUT
|
|
|
from OP_WMS_IN_PLAN_GOODS g
|
|
|
left join OP_WMS_IN_PLAN p on p.WMSPLANID=g.WMSPLANID)t
|
|
|
where ISEND='false' and planbsstatus='true' and (PKGS>DONEPKGS AND KGS>DONEKGS)
|
|
|
GO
|
|
|
|
|
|
alter table OP_WMS_MOVE add OP uniqueidentifier null
|
|
|
GO
|
|
|
|
|
|
ALTER VIEW [dbo].[VW_OP_WMS_MOVE] AS select m.WMSDOID, m.BSNO,m.CUSTOMERNAME,m.DODATE,m.REMARK,m.BILLSTATUS
|
|
|
,a.[VALUE] MBLNO,b.[VALUE] CNTRNO,c.[VALUE] GOODSNAME,m.CORPID,m.CreateID,m.OP from OP_WMS_MOVE m
|
|
|
left join OP_WMS_LOGIC a on a.PID = m.WMSDOID and a.NAME='MBLNO'
|
|
|
left join OP_WMS_LOGIC b on b.PID = m.WMSDOID and b.NAME='CNTRNO'
|
|
|
left join OP_WMS_LOGIC c on c.PID = m.WMSDOID and c.NAME='GOODSNAME'
|
|
|
GO
|
|
|
|
|
|
|
|
|
Create view [dbo].[VW_OP_REP_WORKDETAIL_AVG] as
|
|
|
|
|
|
select wd.*,b.BSTYPE,b.OPLBNAME,b.CUSTOMERNAME,b.mblno,b.KGS/1000 KGS_TOTAL,
|
|
|
(select sum(1) from OP_WMS_WORKDETAIL where convert(varchar(50), WMSDOID)=b.BSNO) WORKERCOUNT,
|
|
|
b.KGS/1000/(select sum(1) from OP_WMS_WORKDETAIL where convert(varchar(50),WMSDOID)=b.BSNO) KGS from OP_WMS_WORKDETAIL wd left join v_op_bs b on convert(varchar(50), wd.WMSDOID)=b.BSNO
|
|
|
|
|
|
|
|
|
GO
|
|
|
|