找回密码
 注册账号

QQ登录

只需一步,快速开始

手机号码,快捷登录

手机号码,快捷登录

初学者课程:T3自学|T6自学|U8自学软件下载课件下载工具下载资料:通资料|U8资料|NC|培训|年结积分规则 | 使用常见问题Q&A
知识库:U8 | | NC | U9 | OA | 政务U8|U9|NCC|NC65|NC65客开|NCC客开新手必读 | 任务 | 快速增金币用友QQ群[微信群]
查看: 11339|回复: 20

[求助] 可用量查询的问题

[复制链接]
发表于 2008-8-18 16:46:21 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册账号

×
请教一下,想写一段代码在Excel里将可用量查询出来(从CurrentStock里取)。现存量(iQuantity)是取出来了,但可用量(fAvaQuantity)取出来的都是0,请问可用量应该从哪里取才能够象ERP中“现存量查询”表取出来的一样(“现存量查询”表取出来的是有数量的,不是全为0)。
发表于 2023-3-29 13:27:04 | 显示全部楼层
谢谢了,正好遇到这个问题
回复 点赞 拍砖

使用道具 举报

发表于 2008-8-18 16:49:57 | 显示全部楼层
直接打开现存量表看,还要看看你可用量是怎样设置的.
 楼主| 发表于 2008-8-18 17:29:06 | 显示全部楼层
你指的是直接打开CurrentStock表是吗?打开后fAvaQuantity(就是可用量)这一列是为0的。我也没有怎么设置,语句是SUM(ISNULL(dbo.CurrentStock.fAvaQuantity, 0)) AS 可用数量。
 楼主| 发表于 2008-8-18 17:36:05 | 显示全部楼层
请注意我问的是:通过语句从哪里能够取出正确的“可用量”来。而不是说从ERP中如何查询可用量。
 楼主| 发表于 2008-8-18 17:37:31 | 显示全部楼层
我附上语句吧:
SELECT dbo.Warehouse.cWhName AS 仓库名称,dbo.CurrentStock.cInvCode AS 存货编码,
      dbo.Inventory.cInvName AS 存货名称, dbo.Inventory.cInvStd AS 规格型号,
      dbo.Inventory.cInvAddCode AS 存货代码, dbo.CurrentStock.cBatch AS 批号,
      dbo.CurrentStock.cFree1 AS 存货备注, SUM(ISNULL(dbo.CurrentStock.iQuantity, 0))
      AS 现存量, SUM(ISNULL(dbo.CurrentStock.fAvaQuantity, 0)) AS 可用数量,
      SUM(ISNULL(dbo.CurrentStock.fOutQuantity, 0)) AS 待发货数量,
      SUM(ISNULL(dbo.CurrentStock.fInQuantity, 0)) AS 待入库数量,
      SUM(ISNULL(dbo.CurrentStock.fTransInQuantity, 0)) AS 调拨在途数量,
      SUM(ISNULL(dbo.CurrentStock.fTransOutQuantity, 0)) AS 调拨待发数量
FROM dbo.CurrentStock INNER JOIN
      dbo.Inventory ON dbo.CurrentStock.cInvCode = dbo.Inventory.cInvCode INNER JOIN
      dbo.Warehouse ON
      dbo.Warehouse.cWhCode = dbo.CurrentStock.cWhCode INNER JOIN
      dbo.ComputationUnit Unit ON
      dbo.Inventory.cComUnitCode = Unit.cComunitCode
GROUP BY dbo.Warehouse.cWhName, dbo.CurrentStock.cInvCode,
      dbo.Inventory.cInvName, dbo.Inventory.cInvStd, dbo.Inventory.cInvAddCode,
      dbo.CurrentStock.cBatch, dbo.CurrentStock.cFree1
发表于 2008-8-18 17:49:35 | 显示全部楼层
语法没问题
 楼主| 发表于 2008-8-20 08:29:27 | 显示全部楼层
语法肯定没问题了,有问题就执行不出结果来了。我题目中问的是:如何取出正确的“可用量数”,各位兄弟怎么看问题就看个一知半解的?这么多回复,没一个正面回答俺的?哪怕说一句“没法取出”也算啊。
发表于 2008-8-21 21:38:55 | 显示全部楼层

可用量与现存量

可用量不准确,是不是你系统中本来就是0啊。
关于现存用量与可用量我也有相关的疑问困扰,我用的系统查出的可用量总是与现存量相等的。实际上,预计入库量与预计出库量都是有数据的,但在系统中的“现存量查询”报表中就是不显示的。所以现存量总与可用量相等,不知哪里参数设置不正确,请大侠们赐教!
发表于 2008-8-22 11:56:10 | 显示全部楼层
看不懂  楼主都说语法没问题还来这显摆  晕
发表于 2008-8-24 00:27:51 | 显示全部楼层
从“MRP计划维护”中可以查得。
 楼主| 发表于 2008-8-24 20:16:00 | 显示全部楼层


看不懂就不要乱放,连我问什么都没看清楚就在这里乱放,居心何在?
发表于 2008-8-26 10:39:20 | 显示全部楼层
“MRP计划维护?这个是什么呢?
 楼主| 发表于 2008-8-29 08:35:05 | 显示全部楼层
数据库里查出来的“可用量”始终为0,可能是因为程序本身没有对这个字段进行写入,而程序中显示出来的数字是通过计算得出的。
所以,没办法了,“可用量”只能自己计算吧。
如果哪位朋友在数据库中找到了“可用量”这个字段中数据不为0 的话回复一下。
发表于 2008-8-29 12:45:41 | 显示全部楼层
老兄,可用量是根据各种条件算出来的.不是在CurrentStock表里的静态数据.系统存在相应的视图和存储过程,你这样查当然显示不出来了.
如果你有兴趣的话,可以参照一下脚本,自己整理一下:
begin tran aa
rollback tran aa

exec sp_reset_connection
go
Set TRANSACTION ISOLATION LEVEL READ COMMITTED
go
SELECT cScenarioID AS ScenarioID FROM UA_ScenarioEntry AS ScenarioEntry, UA_Scenario AS Scenario WHERE ScenarioEntry.cScenarioID = Scenario.cID AND ScenarioEntry.cMenu_Id = 'ST040201' AND cID IN ( SELECT cScenarioID FROM UA_ScenarioGroup WHERE cGroup_Id IN ( SELECT cGroup_Id FROM UA_Role WHERE cUser_Id = 'xushan') )
go
select ivalue  from SCM_SysTableTS  where ctablename =N'ua_account' and convert(money,tblufts) =221.8396
go
select ivalue  from SCM_SysTableTS  where ctablename =N'accinformation' and convert(money,tblufts) =6683.4274
go
select ivalue  from SCM_SysTableTS  where ctablename =N'UA_period' and convert(money,tblufts) =221.8397
go
select ivalue  from SCM_SysTableTS  where ctablename =N'gl_mend' and convert(money,tblufts) =6667.5124
go
exec sp_reset_connection
go
select [Name] from Rpt_GlbDEF_Base where [Name] = N'现存量查询'  and LocaleId='zh-CN' and SystemID='ST' and bNewRpt=0
go
select top 1 * from Rpt_GlbDEF_Base where [Name] = N'现存量查询' and SystemID = 'ST'
go
Select ID,Name,Title,DefaultTitle,Note,Relation,DatabaseEx,IsBaseTable  From Rpt_GlbDef Where SystemID='ST' and Name=N'现存量查询'
go
Select ClassName,IsBaseTable,Note From Rpt_GlbDef Where ID='1809'
go
Select ISNull(FilterClass,'') From Rpt_GlbDef Where ID='1809'
go
Select ISNull(FilterID,'') From Rpt_GlbDef Where ID='1809'
go
Select * From Rpt_FldDef WITH (NOLOCK) Where  ID = 1809
go
Select DataAuthObjID From Rpt_GlbDef Where ID = 1809 and DataAuthObjID is not null and ltrim(rtrim(DataAuthObjID))<>''
go
Select Name,Expression,Caption,Flag,IsSingle,Note,iTop  From Rpt_FltDef Where ID = 1809 AND ModeEx =20 Order by Name,Flag
go
Select Convert(money,Pubufts) from UFMeta_999.dbo.flt_DefineMeta_Cache with (nolock) where FilterID='ST[__]现存量查询' and LocaleID='zh-CN'
go
SET NO_BROWSETABLE ON
go
Select  * from flt_Solution with (nolock)  where [FilterID]='ST[__]现存量查询' And IsDefault=1 and LocaleID='zh-CN' and isPublic=0 and UserID='xushan'
go
Select  * from flt_Solution with (nolock)  where [FilterID]='ST[__]现存量查询' And IsDefault=1 and LocaleID='zh-CN' and IsPublic=1
go
select cAuth_id from ua_auth where cAuth_id='ST020107'
go
Select count(cAuth_Id) from UFSystem..UA_Auth_Base Where cAuth_Id='ST020107_01' Or cAuth_Id='ST020107_02' Or cAuth_Id='ST020107_03' Or cAuth_Id='ST020107_04'
go
Select count(cAuth_Id) from UFSystem..UA_Auth_Base Where cAuth_Id='ST020107_01' Or cAuth_Id='ST020107_02' Or cAuth_Id='ST020107_03' Or cAuth_Id='ST020107_04'
go
SELECT  top 1  1  FROM ua_Task_Common with(nolock) WHERE iLogId=1549520940.12015
go
INSERT INTO ua_Task_Common with(rowlock)(cAcc_Id,iYear,cUser_Id,cAuth_Id,cStation,cTaskId,iLogId,cSub_Id,cAppServer) VALUES(N'999',2008,N'xushan',N'ST020107_01',N'REDFLY',N'13146129',1549520940.12015,N'ST',N'{32D7EB99-36CE-4A82-902D-387428473C86}')
go
SELECT  TOP 1 cstation,cauth_id as cauth_id  FROM UA_Task_Special with(nolock) WHERE   (iAuthType =1 and  iyear=2008 or iAuthType=2)  AND cacc_id=N'999' AND  ilogid<>1549520940.12015
go
SELECT top 1 1 FROM UA_tasklog with(nolock) WHERE ctaskid=N'13146129'
go
INSERT INTO UA_log with(rowlock) VALUES(N'999',N'ST',N'xushan',N'ST020107_01',N'REDFLY',getdate(),NULL,1549520940.12015,'2008',0)
go
SELECT  top 1  1  FROM ua_Task_Common with(nolock) WHERE iLogId=3003185266.34731
go
INSERT INTO ua_Task_Common with(rowlock)(cAcc_Id,iYear,cUser_Id,cAuth_Id,cStation,cTaskId,iLogId,cSub_Id,cAppServer) VALUES(N'999',2008,N'xushan',N'ST020107_02',N'REDFLY',N'13146129',3003185266.34731,N'ST',N'{32D7EB99-36CE-4A82-902D-387428473C86}')
go
SELECT  TOP 1 cstation,cauth_id as cauth_id  FROM UA_Task_Special with(nolock) WHERE   (iAuthType =1 and  iyear=2008 or iAuthType=2)  AND cacc_id=N'999' AND  ilogid<>3003185266.34731
go
SELECT top 1 1 FROM UA_tasklog with(nolock) WHERE ctaskid=N'13146129'
go
INSERT INTO UA_log with(rowlock) VALUES(N'999',N'ST',N'xushan',N'ST020107_02',N'REDFLY',getdate(),NULL,3003185266.34731,'2008',0)
go
SELECT  top 1  1  FROM ua_Task_Common with(nolock) WHERE iLogId=126187679.284359
go
INSERT INTO ua_Task_Common with(rowlock)(cAcc_Id,iYear,cUser_Id,cAuth_Id,cStation,cTaskId,iLogId,cSub_Id,cAppServer) VALUES(N'999',2008,N'xushan',N'ST020107_03',N'REDFLY',N'13146129',126187679.284359,N'ST',N'{32D7EB99-36CE-4A82-902D-387428473C86}')
go
SELECT  TOP 1 cstation,cauth_id as cauth_id  FROM UA_Task_Special with(nolock) WHERE   (iAuthType =1 and  iyear=2008 or iAuthType=2)  AND cacc_id=N'999' AND  ilogid<>126187679.284359
go
SELECT top 1 1 FROM UA_tasklog with(nolock) WHERE ctaskid=N'13146129'
go
INSERT INTO UA_log with(rowlock) VALUES(N'999',N'ST',N'xushan',N'ST020107_03',N'REDFLY',getdate(),NULL,126187679.284359,'2008',0)
go
SELECT  top 1  1  FROM ua_Task_Common with(nolock) WHERE iLogId=3422088617.53647
go
INSERT INTO ua_Task_Common with(rowlock)(cAcc_Id,iYear,cUser_Id,cAuth_Id,cStation,cTaskId,iLogId,cSub_Id,cAppServer) VALUES(N'999',2008,N'xushan',N'ST020107_04',N'REDFLY',N'13146129',3422088617.53647,N'ST',N'{32D7EB99-36CE-4A82-902D-387428473C86}')
go
SELECT  TOP 1 cstation,cauth_id as cauth_id  FROM UA_Task_Special with(nolock) WHERE   (iAuthType =1 and  iyear=2008 or iAuthType=2)  AND cacc_id=N'999' AND  ilogid<>3422088617.53647
go
SELECT top 1 1 FROM UA_tasklog with(nolock) WHERE ctaskid=N'13146129'
go
INSERT INTO UA_log with(rowlock) VALUES(N'999',N'ST',N'xushan',N'ST020107_04',N'REDFLY',getdate(),NULL,3422088617.53647,'2008',0)
go
SELECT  top 1 ilogid   FROM ua_Task_Common with(nolock) WHERE ctaskid=N'13146129' AND cauth_id=N'ST020107_02'
go
DELETE FROM ua_Task_Common with(rowlock) WHERE   ilogid=3003185266.34731
go
UPDATE UA_log with(rowlock) SET Success=1,douttime= getdate() WHERE ilogid=3003185266.34731
go
SELECT  top 1 ilogid   FROM ua_Task_Common with(nolock) WHERE ctaskid=N'13146129' AND cauth_id=N'ST020107_03'
go
DELETE FROM ua_Task_Common with(rowlock) WHERE   ilogid=126187679.284359
go
UPDATE UA_log with(rowlock) SET Success=1,douttime= getdate() WHERE ilogid=126187679.284359
go
SELECT  top 1 ilogid   FROM ua_Task_Common with(nolock) WHERE ctaskid=N'13146129' AND cauth_id=N'ST020107_04'
go
DELETE FROM ua_Task_Common with(rowlock) WHERE   ilogid=3422088617.53647
go
UPDATE UA_log with(rowlock) SET Success=1,douttime= getdate() WHERE ilogid=3422088617.53647
go
Update Rpt_GlbDef_Base set WhereEx='ST020107' where ID= 1809
go
Select  * from Rpt_FldDef where ModeEx =27 and ID =1809
go
select * from Rpt_PrintSetting where id=1809 And LocaleID = 'zh-CN'
go
Select  * from Rpt_FldDef where ID =1809  and ModeEx =25 order by OrderEx
go
Select  * from Rpt_FldDef where ID =1809  and ModeEx =26 order by OrderEx
go
Select ActionClass,DoubleClick,ShowOnToolbar,Caption,Name,ToolTip From Rpt_CustomEvents Where ReportName='现存量查询' And cSub_id='ST'
go
SELECT * FROM UA_Account WHERE cAcc_Id = N'999'
go
drop table tempdb..TMPUF_13146129_heron597747400_REDFLY
go
Set lock_timeout 300000
go
Select * From ufsystem..UA_Account  Where cAcc_Id=N'999'
go
select convert(money,tblufts) as tblufts from SCM_SysTableTS where ctablename=N'ua_account'
go
Select cSysID,cID,cName,cCaption,cType,cValue,cDefault,bVisible,bEnable from AccInformation with (nolock)  Where cSysId In(N'AA',N'ST',N'SA',N'PU',N'IA',N'GS',N'CA',N'PM',N'QM',N'OM',N'MO',N'FC',N'EX',N'EQ',N'SR',N'IM')
go
select convert(money,tblufts) as tblufts from SCM_SysTableTS where ctablename=N'accinformation'
go
Select iId as [Month] ,dBegin as [BeginDate],dEnd as [EndDate]      From ufsystem..UA_period with (nolock)     Where iYear=2008      And cAcc_Id=N'999' Order By iId
go
select convert(money,tblufts) as tblufts from SCM_SysTableTS where ctablename=N'UA_period'
go
Select *     From  GL_mend  with (nolock)  order by iPeriod
go
select convert(money,tblufts) as tblufts from SCM_SysTableTS where ctablename=N'gl_mend'
go
select cclass, citemname,cdicdbname,ctype ,isnull(citemname,'') as  citemname from userdef with (nolock)  where cclass =N'存货'
go
select top 1 cname from accinformation where csysid=N'EX' and cname=N'bReduceExportWaitoutQty' and cValue ='True'
go
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
SELECT  W.cWhCode, W.cWhName, I.cInvCode, I.cInvAddCode,  I.cInvName, I.cInvStd, I.cInvCCode , IC.cInvCName,

CU_M.cComUnitName AS cInvM_Unit, CASE WHEN I.iGroupType = 0 THEN NULL  WHEN I.iGrouptype = 2 THEN CU_A.cComUnitName  WHEN I.iGrouptype = 1 THEN CU_G.cComUnitName END  AS cInvA_Unit,CASE WHEN I.iGroupType = 0 THEN NULL      WHEN I.iGroupType = 2 THEN (CASE WHEN CS.iQuantity = 0.0 OR CS.iNum = 0.0 THEN NULL ELSE CS.iQuantity/CS.iNum END)      WHEN I.iGroupType = 1 THEN CU_G.iChangRate END AS iExchRate,
Null as cInvDefine1, Null as cInvDefine2, Null as cInvDefine3, Null as cFree1, Null as cFree2, Null as cFree3, Null as cFree4, Null as cFree5, Null as cFree6, Null as cFree7, Null as cFree8, Null as cFree9, Null as cFree10, Null as cInvDefine4, Null as cInvDefine5, Null as cInvDefine6, Null as cInvDefine7, Null as cInvDefine8, Null as cInvDefine9, Null as cInvDefine10, Null as cInvDefine11, Null as cInvDefine12, Null as cInvDefine13, Null as cInvDefine14, Null as cInvDefine15, Null as cInvDefine16,cs.cBatch, cs.EnumName As iSoTypeName, cs.csocode as SOCode, convert(nvarchar,cs.isoseq) as iRowNo,
cs.cvmivencode,v1.cvenabbname as cvmivenname , isnull(E.enumname,N'') as cMassUnitName,CS.dVDate, CS.dMdate,CS.iMassDate,
(iQuantity) AS iQtty,( CASE WHEN iGroupType = 0 THEN 0 WHEN iGroupType = 2 THEN ISNULL(iNum,0) WHEN iGroupType = 1 THEN iQuantity/ CU_G.iChangRate END) AS iNum,
  CASE WHEN CS.bStopFlag = 1 OR CS.bGspStop = 1 THEN iQuantity ELSE IsNull(fStopQuantity,0) END AS iStopQtty,
  CASE WHEN CS.bStopFlag = 1 OR CS.bGspStop = 1 THEN (CASE WHEN iGroupType = 0 THEN 0 WHEN iGroupType = 2 THEN ISNULL(iNum,0) WHEN iGroupType = 1 THEN iQuantity/ CU_G.iChangRate END)
ELSE (CASE WHEN iGroupType = 0 THEN 0 WHEN iGroupType = 2 THEN ISNULL(fStopNum,0) WHEN iGroupType = 1 THEN fStopQuantity/ CU_G.iChangRate END) END AS iStopNum,
(fInQuantity) AS fInQtty,
(CASE WHEN iGroupType = 0 THEN NULL WHEN iGroupType=2 THEN ISNULL(fInNum,0) WHEN iGroupType = 1 THEN fInQuantity/ CU_G.iChangRate END) AS fInNum,
(fTransInQuantity) AS fTransInQtty,
(CASE WHEN iGroupType = 0 THEN NULL WHEN iGroupType=2 THEN ISNULL(fTransInNum,0) WHEN iGroupType = 1 THEN fTransInQuantity/ CU_G.iChangRate END) AS fTransInNum,
(ISNULL(fInQuantity,0) + ISNULL(fTransInQuantity,0)) AS fInQttySum,
(CASE WHEN iGroupType = 0 THEN NULL WHEN iGroupType=2 THEN ISNULL(fInNum,0) + ISNULL(fTransInNum,0) WHEN iGroupType = 1 THEN (ISNULL(fInQuantity,0) + ISNULL(fTransInNum,0))/ CU_G.iChangRate END) AS fInNumSum,
(fOutQuantity) AS fOutQtty,
(CASE WHEN iGroupType = 0 THEN NULL WHEN iGroupType=2 THEN ISNULL(fOutNum,0) WHEN iGroupType = 1 THEN fOutQuantity/ CU_G.iChangRate END) AS fOutNum,
(fTransOutQuantity) AS fTransOutQtty,
(CASE WHEN iGroupType = 0 THEN NULL WHEN iGroupType=2 THEN ISNULL(fTransOutNum,0) WHEN iGroupType = 1 THEN fTransOutQuantity/ CU_G.iChangRate END) AS fTransOutNum,
(ISNULL(fOutQuantity,0) + ISNULL(fTransOutQuantity,0)) AS fOutQttySum ,
(CASE WHEN iGroupType = 0 THEN NULL WHEN iGroupType=2 THEN ISNULL(fOutNum,0) + ISNULL(fTransOutNum,0) WHEN iGroupType = 1 THEN (ISNULL(fOutQuantity,0) + ISNULL(fTransOutNum,0))/ CU_G.iChangRate END) AS fOutNumSum,
(fDisableQuantity) AS fDisableQtty,
(CASE WHEN iGroupType = 0 THEN NULL WHEN iGroupType=2 THEN ISNULL(fDisableNum,0) WHEN iGroupType = 1 THEN fDisableQuantity/ CU_G.iChangRate END) AS fDisableNum,
(CASE WHEN bInvBatch=1 THEN  CASE WHEN bStopFlag =1 OR bGSPStop= 1 THEN 0 ELSE ISNULL(iQuantity,0) - IsNull(fStopQuantity,0) END  + ISNULL(fInQuantity,0) - ISNULL(fOutQuantity,0) ELSE  CASE WHEN bStopFlag =1 OR bGSPStop= 1 THEN 0 ELSE ISNULL(iQuantity,0) - IsNull(fStopQuantity,0) END  + ISNULL(fInQuantity,0) - ISNULL(fOutQuantity,0) END) AS fAvailQtty,
(CASE WHEN iGroupType = 0 THEN 0  WHEN iGroupType = 2 THEN  CASE WHEN bInvBatch=1 THEN  CASE WHEN bStopFlag =1 OR bGSPStop= 1 THEN 0 ELSE ISNULL(iNum,0) - IsNull(fStopNum,0) END  + ISNULL(fInNum,0) - ISNULL(fOutNum,0) ELSE  CASE WHEN bStopFlag =1 OR bGSPStop= 1 THEN 0 ELSE ISNULL(iNum,0) - IsNull(fStopNum,0) END  + ISNULL(fInNum,0) - ISNULL(fOutNum,0) END WHEN iGroupType = 1 THEN  (CASE WHEN bInvBatch=1 THEN  CASE WHEN bStopFlag =1 OR bGSPStop= 1 THEN 0 ELSE ISNULL(iQuantity,0) - IsNull(fStopQuantity,0) END  + ISNULL(fInQuantity,0) - ISNULL(fOutQuantity,0) ELSE  CASE WHEN bStopFlag =1 OR bGSPStop= 1 THEN 0 ELSE ISNULL(iQuantity,0) - IsNull(fStopQuantity,0) END  + ISNULL(fInQuantity,0) - ISNULL(fOutQuantity,0) END)/CU_G.iChangRate ELSE NULL END) AS fAvailNum
INTO tempdb..TMPUF_13146129_heron597747400_REDFLY
FROM v_CurrentStock CS inner join dbo.Inventory I ON I.cInvCode = CS.cInvCode   
left join dbo.InventoryClass IC ON IC.cInvCCode = I.cInvCCode LEFT OUTER JOIN dbo.ComputationUnit CU_G ON
I.cSTComUnitCode =CU_G.cComUnitCode
LEFT OUTER JOIN dbo.ComputationUnit CU_A ON I.cAssComUnitCode = CU_A.cComunitCode
LEFT OUTER JOIN dbo.ComputationUnit CU_M ON I.cComUnitCode = CU_M.cComunitCode
LEFT OUTER JOIN dbo.Warehouse W ON CS.cWhCode = W.cWhCode
left join vendor v1 on v1.cvencode = cs.cvmivencode
LEFT OUTER JOIN dbo.v_aa_enum E with (nolock) on E.enumcode=convert(nchar,CS.cMassUnit) and E.enumType=N'ST.MassUnit'


WHERE  1=1



SET TRANSACTION ISOLATION LEVEL READ COMMITTED

go
Select top 1 * from tempdb..TMPUF_13146129_heron597747400_REDFLY
go
Drop table  tempdb..TMPUF_13146129_heronGroup607607240_REDFLY
go
SELECT [cWhCode],max([cWhName]) as [cWhName],[cInvCode],max([cInvAddCode]) as [cInvAddCode],max([cInvName]) as [cInvName],max([cInvStd]) as [cInvStd],max([cInvCCode]) as [cInvCCode],max([cInvCName]) as [cInvCName],max([cInvM_Unit]) as [cInvM_Unit],max([cInvA_Unit]) as [cInvA_Unit],sum([iExchRate]) as [iExchRate],sum([cInvDefine1]) as [cInvDefine1],sum([cInvDefine2]) as [cInvDefine2],sum([cInvDefine3]) as [cInvDefine3],sum([cInvDefine4]) as [cInvDefine4],sum([cInvDefine5]) as [cInvDefine5],sum([cInvDefine6]) as [cInvDefine6],sum([cInvDefine7]) as [cInvDefine7],sum([cInvDefine8]) as [cInvDefine8],sum([cInvDefine9]) as [cInvDefine9],sum([cInvDefine10]) as [cInvDefine10],sum([cInvDefine11]) as [cInvDefine11],sum([cInvDefine12]) as [cInvDefine12],sum([cInvDefine13]) as [cInvDefine13],sum([cInvDefine14]) as [cInvDefine14],sum([cInvDefine15]) as [cInvDefine15],sum([cInvDefine16]) as [cInvDefine16],sum([cFree1]) as [cFree1],sum([cFree2]) as [cFree2],sum([cFree3]) as [cFree3],sum([cFree4]) as [cFree4],sum([cFree5]) as [cFree5],sum([cFree6]) as [cFree6],sum([cFree7]) as [cFree7],sum([cFree8]) as [cFree8],sum([cFree9]) as [cFree9],sum([cFree10]) as [cFree10],max([cBatch]) as [cBatch],max([iSoTypeName]) as [iSoTypeName],max([cvmivencode]) as [cvmivencode],max([SOCode]) as [SOCode],max([iRowNo]) as [iRowNo],sum([iQtty]) as [iQtty],sum([iNum]) as [iNum],sum([iStopQtty]) as [iStopQtty],sum([iStopNum]) as [iStopNum],sum([fInQtty]) as [fInQtty],sum([fInNum]) as [fInNum],sum([fTransInQtty]) as [fTransInQtty],sum([fTransInNum]) as [fTransInNum],sum([fInQttySum]) as [fInQttySum],sum([fInNumSum]) as [fInNumSum],sum([fOutQtty]) as [fOutQtty],sum([fOutNum]) as [fOutNum],sum([fTransOutQtty]) as [fTransOutQtty],sum([fTransOutNum]) as [fTransOutNum],sum([fOutQttySum]) as [fOutQttySum],sum([fOutNumSum]) as [fOutNumSum],sum([fDisableQtty]) as [fDisableQtty],sum([fDisableNum]) as [fDisableNum],sum([fAvailQtty]) as [fAvailQtty],sum([fAvailNum]) as [fAvailNum],max([cvmivenname]) as [cvmivenname],max([dMdate]) as [dMdate],sum([iMassDate]) as [iMassDate],max([cMassUnitName]) as [cMassUnitName],max([dVDate]) as [dVDate] Into tempdb..TMPUF_13146129_heronGroup607607240_REDFLY FROM tempdb..TMPUF_13146129_heron597747400_REDFLY GROUP BY [cWhCode], [cInvCode]
go
SELECT * FROM tempdb..TMPUF_13146129_heronGroup607607240_REDFLY WHERE (1 = 1) ORDER BY [cWhCode], [cInvCode]
go
 楼主| 发表于 2008-9-1 13:48:15 | 显示全部楼层
原来如此,我说怎么找不到呢。
这段代码也太长了吧。看不懂啊。
是存储过程的直接内容还是你跟踪出来内容?
您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

QQ|站长微信|Archiver|手机版|小黑屋|用友之家 ( 蜀ICP备07505338号|51072502110008 )

GMT+8, 2024-11-23 22:16 , Processed in 0.081556 second(s), 11 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表