資源描述:
《產(chǎn)成品入庫(kù)產(chǎn)出明細(xì)表(倉(cāng)庫(kù))su》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫(kù)。
1、產(chǎn)成品入庫(kù)產(chǎn)出明細(xì)表(倉(cāng)庫(kù))suUSE[UFDATA_001_2010]GO/******對(duì)象:StoredProcedure[dbo].[SP_CCCP_MX_su]腳本日期:04/29/201010:52:38******/SETANSI_NULLSONGOSETQUOTED_IDENTIFIERONGO--------------------------產(chǎn)成品入庫(kù)產(chǎn)出明細(xì)按倉(cāng)庫(kù)su---------------------ALTERPROCEDURE[dbo].[SP_CCCP_MX_su](--條件參數(shù)@chrWherevarchar(1000))ASdeclare@cbDate
2、nvarchar(10)--開始日期declare@ceDatenvarchar(10)--結(jié)束日期declare@cbrkdnvarchar(30)--起始入庫(kù)單號(hào)declare@cerkdnvarchar(30)--結(jié)束入庫(kù)單號(hào)Declare@cbdepcodevarchar(20)--起始部門編碼Declare@cedepcodevarchar(20)--結(jié)束部門編碼Declare@cbcWhCodevarchar(20)--起始倉(cāng)庫(kù)編碼cbcWhCodeDeclare@cecWhCodevarchar(20)--結(jié)束倉(cāng)庫(kù)編碼cecWhCodeDeclare@cbinvvarcha
3、r(20)--起始存貨編碼Declare@ceinvvarchar(20)--結(jié)束存貨編碼Declare@cbclcodevarchar(20)--起始材料編碼Declare@ceclcodevarchar(20)--結(jié)束材料編碼declare@chrSqlvarchar(8000)declare@A1int,@A2int,@B1int,@B2int,@C1int,@C2int,@D1int,@D2int,@E1int,@E2int,@F1int,@F2intIF@cbdateisnullSET@cbdate='2005-10-01'IF@cedateisnullSET@cedate='
4、2099-12-31'IF@cbrkdisnullSET@cbrkd=''IF@cerkdisnullSET@cerkd='zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'IF@cbdepcodeisnullSET@cbdepcode=''IF@cedepcodeisnullSET@cedepcode='zzzzzzzzzzzzzzzzzzzz'IF@cbcWhCodeisnullSET@cbcWhCode=''IF@cecWhCodeisnullSET@cecWhCode='zzzzzzzzzzzzzzzzzzzz'IF@cbinvisnullSET@cbinv=''IF
5、@ceinvisnullSET@ceinv='zzzzzzzzzzzzzzzzzzzz'IF@cbclcodeisnullSET@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(@chr
6、Where,'crkd>=N','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,'cWhCode<=N','cWhCode<=')set@chrWhe
7、re=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