資源描述:
《產(chǎn)成品入庫產(chǎn)出明細表(倉庫)su》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。
1、產(chǎn)成品入庫產(chǎn)出明細表(倉庫)suUSE[UFDATA_001_2010]GO/******對象:StoredProcedure[dbo].[SP_CCCP_MX_su]腳本日期:04/29/201010:52:38******/SETANSI_NULLSONGOSETQUOTED_IDENTIFIERONGO--------------------------產(chǎn)成品入庫產(chǎn)出明細按倉庫su---------------------ALTERPROCEDURE[dbo].[SP_CCCP_MX_su
2、](--條件參數(shù)@chrWherevarchar(1000))ASdeclare@cbDatenvarchar(10)--開始日期declare@ceDatenvarchar(10)--結(jié)束日期declare@cbrkdnvarchar(30)--起始入庫單號declare@cerkdnvarchar(30)--結(jié)束入庫單號Declare@cbdepcodevarchar(20)--起始部門編碼Declare@cedepcodevarchar(20)--結(jié)束部門編碼Declare@cbcWhCo
3、devarchar(20)--起始倉庫編碼cbcWhCodeDeclare@cecWhCodevarchar(20)--結(jié)束倉庫編碼cecWhCodeDeclare@cbinvvarchar(20)--起始存貨編碼Declare@ceinvvarchar(20)--結(jié)束存貨編碼Declare@cbclcodevarchar(20)--起始材料編碼Declare@ceclcodevarchar(20)--結(jié)束材料編碼declare@chrSqlvarchar(8000)declare@A1int,
4、@A2int,@B1int,@B2int,@C1int,@C2int,@D1int,@D2int,@E1int,@E2int,@F1int,@F2intIF@cbdateisnullSET@cbdate='2005-10-01'IF@cedateisnullSET@cedate='2099-12-31'IF@cbrkdisnullSET@cbrkd=''IF@cerkdisnullSET@cerkd='zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'IF@cbdepcodeisnu
5、llSET@cbdepcode=''IF@cedepcodeisnullSET@cedepcode='zzzzzzzzzzzzzzzzzzzz'IF@cbcWhCodeisnullSET@cbcWhCode=''IF@cecWhCodeisnullSET@cecWhCode='zzzzzzzzzzzzzzzzzzzz'IF@cbinvisnullSET@cbinv=''IF@ceinvisnullSET@ceinv='zzzzzzzzzzzzzzzzzzzz'IF@cbclcodeisnullS
6、ET@cbclcode=''IF@ceclcodeisnullSET@ceclcode='zzzzzzzzzzzzzzzzzzzz'--獲取條件IfLtrim(Rtrim(@chrwhere))<>''beginset@chrWhere=replace(@chrWhere,'cdate>=N','cdate>=')set@chrWhere=replace(@chrWhere,'cdate<=N','cdate<=')set@chrWhere=replace(@chrWhere,'crkd>=N'
7、,'crkd>=')set@chrWhere=replace(@chrWhere,'crkd<=N','crkd<=')set@chrWhere=replace(@chrWhere,'cdep>=N','cdep>=')set@chrWhere=replace(@chrWhere,'cdep<=N','cdep<=')set@chrWhere=replace(@chrWhere,'cWhCode>=N','cWhCode>=')set@chrWhere=replace(@chrWhere,'cW
8、hCode<=N','cWhCode<=')set@chrWhere=replace(@chrWhere,'cinv>=N','cinv>=')set@chrWhere=replace(@chrWhere,'cinv<=N','cinv<=')set@chrWhere=replace(@chrWhere,'cclcode>=N','cclcode>=')set@chrWhere=replace(@chrWhere,'cclcode<=N','cclcode<=')SET@A1=charindex