找回密码
 注册账号

QQ登录

只需一步,快速开始

手机号码,快捷登录

手机号码,快捷登录

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

[求助] 现存量查时所用到的SQL语句是怎样的?

[复制链接]
发表于 2008-6-2 15:38:58 | 显示全部楼层 |阅读模式

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

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

×
现存量查时所用到的SQL语句是怎样的??关系到那几个表?现存量中的待发货数量是怎样的SQL语句查询到的?求助,在线等。

[ 本帖最后由 stonys 于 2008-6-2 16:46 编辑 ]
发表于 2018-12-7 14:37:29 | 显示全部楼层
我是来混积分的。。。。。
回复 点赞 拍砖

使用道具 举报

发表于 2016-7-20 15:14:20 | 显示全部楼层
怎样可以看到呀
回复 点赞 拍砖

使用道具 举报

发表于 2018-12-13 10:43:57 | 显示全部楼层
进来学习下
回复 点赞 拍砖

使用道具 举报

发表于 2008-6-2 15:46:27 | 显示全部楼层
SQL语句:
SELECT '002' as 帐套, 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,
i.cInvDefine1,i.cInvDefine2,i.cInvDefine3,i.cInvDefine4,i.cInvDefine5,i.cInvDefine6,i.cInvDefine7,i.cInvDefine8,CS.cFree1,CS.cFree2,CS.cFree3, Null as cFree4, Null as cFree5, Null as cFree6, Null as cFree7, Null as cFree8, Null as cFree9, Null as cFree10, 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_171085006_heron525795190_WZUF
FROM v_CurrentStock CS inner join ufdata_002_2008..Inventory I ON I.cInvCode = CS.cInvCode   
left join ufdata_002_2008..InventoryClass IC ON IC.cInvCCode = I.cInvCCode LEFT OUTER JOIN ufdata_002_2008..ComputationUnit CU_G ON
I.cSTComUnitCode =CU_G.cComUnitCode
LEFT OUTER JOIN ufdata_002_2008..ComputationUnit CU_A ON I.cAssComUnitCode = CU_A.cComunitCode
LEFT OUTER JOIN ufdata_002_2008..ComputationUnit CU_M ON I.cComUnitCode = CU_M.cComunitCode
LEFT OUTER JOIN ufdata_002_2008..Warehouse W ON CS.cWhCode = W.cWhCode
left join  ufdata_002_2008..vendor v1 on v1.cvencode = cs.cvmivencode
LEFT OUTER JOIN ufdata_002_2008..v_aa_enum E with (nolock) on E.enumcode=convert(nchar,CS.cMassUnit) and E.enumType=N'ST.MassUnit'
 楼主| 发表于 2008-6-2 15:53:16 | 显示全部楼层
待发货数量是那一项?
 楼主| 发表于 2008-6-2 16:03:54 | 显示全部楼层
这一句太复杂了,可否分解一下?
发表于 2008-6-2 17:22:37 | 显示全部楼层
CurrentStock表的
foutquantity
字段
就是待发数量
 楼主| 发表于 2008-6-2 18:01:06 | 显示全部楼层

回复 5# 断壁残阳 的帖子

非常感谢!
发表于 2008-6-2 18:22:57 | 显示全部楼层
先收藏,再慢慢研究
发表于 2008-6-2 21:50:01 | 显示全部楼层
收藏一下,估计以后我也会用到的;
发表于 2008-6-3 08:32:01 | 显示全部楼层
一米兄弟真是强啊。
特别说明:一米兄弟是开发高手,有个性化开发方面的需求找他没错。
发表于 2008-6-3 08:57:15 | 显示全部楼层
二楼真牛!
发表于 2008-6-3 08:58:54 | 显示全部楼层
楼主为什么要在SQL里查询呢?在用友前台不是可以查询吗?
呵呵
发表于 2008-6-3 09:10:13 | 显示全部楼层
高手就是高手,整的东西都看不懂啊  
呵呵
 楼主| 发表于 2008-6-3 09:15:32 | 显示全部楼层

回复 11# wanyaxiong 的帖子

发现前台查询出错了。待发数量出错,引起了可用数量也错了。但现存量没有错。所以相搞清楚待发数量的来源。
发表于 2008-6-3 09:48:01 | 显示全部楼层
太多了,看着晕
发表于 2008-6-4 08:52:24 | 显示全部楼层
好东西 研究研究
您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

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

GMT+8, 2024-11-25 23:32 , Processed in 0.066549 second(s), 11 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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