资源描述:
《产成品入库产出明细表(仓库)su》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、产成品入库产出明细表(仓库)suUSE[UFDATA_001_2010]GO/******对象:StoredProcedure[dbo].[SP_CCCP_MX_su]脚本日期:04/29/201010:52:38******/SETANSI_NULLSONGOSETQUOTED_IDENTIFIERONGO--------------------------产成品入库产出明细按仓库su---------------------ALTERPROCEDURE[dbo].[SP_CCCP_MX_su](--条件参数@chrWherevarchar(1000))ASdeclare@cbDate
2、nvarchar(10)--开始日期declare@ceDatenvarchar(10)--结束日期declare@cbrkdnvarchar(30)--起始入库单号declare@cerkdnvarchar(30)--结束入库单号Declare@cbdepcodevarchar(20)--起始部门编码Declare@cedepcodevarchar(20)--结束部门编码Declare@cbcWhCodevarchar(20)--起始仓库编码cbcWhCodeDeclare@cecWhCodevarchar(20)--结束仓库编码cecWhCodeDeclare@cbinvvarcha
3、r(20)--起始存货编码Declare@ceinvvarchar(20)--结束存货编码Declare@cbclcodevarchar(20)--起始材料编码Declare@ceclcodevarchar(20)--结束材料编码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