马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册账号
×
仓库等各部门需要及时查看ERP库存情况,此需求可以使用excel查询ERP数据库(Ms Query)的功能解决!
代码见下:
现存量表 SELECT TOP (100000) a.cWhCode AS 仓库编码, c.cWhName AS 仓库名称,a.cInvCode AS 物料编码, b.cInvName AS 存货名称, b.cInvStd AS 规格型号, a.cBatch AS 批号, SUM(a.iQuantity) AS 现存量, sum(a.fInQuantity) AS 待入库数量,sum(a.fOutQuantity) AS 待发货数量, sum(a.fDisableQuantity) AS 不合格数量, sum(a.fStopQuantity) AS 冻结数量, a.dMdate AS 生产日期,a.dVDate AS 失效日期, a.iMassDate AS 保质期天数, a.cMassUnit AS 保质期单位, a.bStopFlag AS 库存是否冻结, a.dLastCheckDate AS 最后检验日期, a.cCheckState AS 检验状态 FROM ufdata_001_2015.dbo.CurrentStock AS a INNER JOIN ufdata_001_2015.dbo.Inventory AS b ON a.cInvCode = b.cInvCode INNER JOIN ufdata_001_2015.dbo.Warehouse AS c ON a.cWhCode = c.cWhCode GROUP BY a.cInvCode, a.cWhCode, c.cWhName,b.cInvName, b.cInvStd,a.cBatch,a.dMdate,a.dVDate,a.iMassDate, a.cMassUnit,a.bStopFlag,a.dLastCheckDate,a.cCheckState HAVING (SUM(a.iQuantity) <> 0) or (sum(a.fInQuantity) <> 0) or (sum(a.fOutQuantity) <> 0) or (sum(a.fDisableQuantity)<> 0) or (sum(a.fStopQuantity) <> 0) ORDER BY a.cWhCode,a.cInvCode
|