查询销售出库明细表出现错误
金蝶云社区-云社区用户35dP2231
云社区用户35dP2231
0人赞赏了该文章 608次浏览 未经作者许可,禁止转载编辑于2017年07月26日 15:05:33


INSERT INTO TMP94301A2F71D011E7ABAD7CD30AC(
FBILLTYPENAME,
FID,
FENTRYID,
FBILLDATE,
FAPPROVEDATE,
FBILLNUMBER,
FBILLNAME,
FDEPTID,
FDEPTNUMBER,
FDEPTNAME,
FCUSTOMERNUMBER,
FCUSTOMERNAME,
FMATERIALNUMBER,
FMATERIALNAME,
FMATERIALMODEL,
FMATERIALAUXNAME,
FLOTID,
FLOTNAME,
FUNITID,
FUNITNAME,
FCURRENCYID,
FCURRENCYNAME,
FOUTSTOCKQTY,
FNOTAXOUTSTOCKPRICE,
FTAXOUTSTOCKPRICE,
FNOTAXOUTSTOCKAMOUNT,
FTAXOUTSTOCKAMOUNT,
FOUTSTOCKTATALCOSTAMOUNT,
FRECQTY,
FNOTAXRECAMOUNT,
FTAXRECAMOUNT,
FSTOCKORGNAME,
FSETTLEORGNAME,
FSALEORGNAME,
FSALEORGID,
FSTOCKNAME,
FSTOCKLOCID,
FLCCURRENCYNAME ,
FLCNOTAXOUTSTOCKPRICE,
FLCTAXOUTSTOCKPRICE,
FLCNOTAXOUTSTOCKAMOUNT,
FLCTAXOUTSTOCKAMOUNT,
FLCOUTSTOCKTATALCOSTAMOUNT ,
FLCNOTAXRECAMOUNT ,
FLCTAXRECAMOUNT,
FQTYPRECISION,
FAMOUNTPRECISION,
FPRICEPRECISION ,
FLCAMOUNTPRECISION,
FLCPRICEPRECISION ,
FCUSTOMERID,
FMATERIALID,
FMATERIALAUXID,
FSETTLETYPEID,
FSETTLETYPENAME,
FSALERID,
FSALERNAME,
FBASEUNITID,
FBASEUNITNAME,
FDELIVERYQTY,
FRECEIVEQTY,
FMATERIALGROUPFILTER,
FSALGROUPID,
FSALGROUPNAME
)
SELECT
BL.FNAME FBILLTYPENAME,
A.FID FID,
A.FENTRYID FENTRYID,
A.FBILLDATE FBILLDATE,
A.FAPPROVEDATE,
A.FBILLNUMBER FBILLNUMBER,
A.FBILLNAME FBILLNAME,
A.FDEPTID DEPTID,
A.FDEPTNUMBER FDEPTNUMBER,
A.FDEPTNAME FDEPTNAME,
A.FCUSTOMERNUMBER FCUSTOMERNUMBER,
A.FCUSTOMERNAME FCUSTOMERNAME,
A.FMATERIALNUMBER FMATERIALNUMBER,
A.FMATERIALNAME FMATERIALNAME,
A.FMATERIALMODEL FMATERIALMODEL,
N'' FMATERIALAUXNAME,
A.FLOTID FLOTID,
ISNULL(LOTL.FNAME,N'') FLOTNAME,
A.FUNITID FUNITID,
UNITL.FNAME FUNITNAME,
A.FCURRENCYID FCURRENCYID,
CURL.FNAME FCURRENCYNAME,
CASE WHEN MS.FSTOREURNUM=0 THEN A.FOUTSTOCKQTY*MS.FSTOREURNom ELSE A.FOUTSTOCKQTY*MS.FSTOREURNom/MS.FSTOREURNUM END FOUTSTOCKQTY,
0 FNOTAXOUTSTOCKPRICE,
0 FTAXOUTSTOCKPRICE,
A.FNOTAXOUTSTOCKAMOUNT FNOTAXOUTSTOCKAMOUNT,
A.FTAXOUTSTOCKAMOUNT FTAXOUTSTOCKAMOUNT,
A.FOUTSTOCKTATALCOSTAMOUNT FOUTSTOCKTATALCOSTAMOUNT,
CASE WHEN MS.FSTOREURNUM=0 THEN A.FRECQTY*MS.FSTOREURNom ELSE A.FRECQTY*MS.FSTOREURNom/MS.FSTOREURNUM END FRECQTY,
A.FNOTAXRECAMOUNT FNOTAXRECAMOUNT,
A.FTAXRECAMOUNT FTAXRECAMOUNT,
N'' FSTOCKORGNAME,
ORGL2.FNAME FSETTLEORGNAME,
ORGL.FNAME FSALEORGNAME,
A.FSALEORGID FSALEORGID,
A.FSTOCKNAME FSTOCKNAME,
ISNULL(A.FSTOCKLOCID,0) FSTOCKLOCID,
LCCURL.FNAME FLCCURRENCYNAME ,
0 FLCNOTAXOUTSTOCKPRICE,
0 FLCTAXOUTSTOCKPRICE,
A.FLCNOTAXOUTSTOCKAMOUNT FLCNOTAXOUTSTOCKAMOUNT,
A.FLCTAXOUTSTOCKAMOUNT FLCTAXOUTSTOCKAMOUNT,
A.FLCOUTSTOCKTATALCOSTAMOUNT FLCOUTSTOCKTATALCOSTAMOUNT ,
A.FLCNOTAXRECAMOUNT FLCNOTAXRECAMOUNT ,
A.FLCTAXRECAMOUNT FLCTAXRECAMOUNT,
UNITM.FPRECISION FQTYPRECISION, --数量精度
CURM.FAMOUNTDIGITS FAMOUNTPRECISION, --金额精度
CURM.FPRICEDIGITS FPRICEPRECISION , --价格精度
LCCURM.FAMOUNTDIGITS FLCAMOUNTPRECISION, --本位币金额精度
LCCURM.FPRICEDIGITS FLCPRICEPRECISION , --本位币价格精度
A.FCUSTOMERID FCUSTOMERID,
A.FMATERIALID FMATERIALID,
A.FMATERIALAUXID, --辅助属性ID
A.FSETTLETYPEID FSETTLETYPEID,
CASE WHEN SETL.FNAME IS NULL THEN N'' ELSE SETL.FNAME END FSETTLETYPENAME,
A.FSALERID FSALERID,
CASE WHEN SALERL.FNAME IS NULL THEN N'' ELSE SALERL.FNAME END FSALERNAME,
A.FBASEUNITID FBASEUNITID,
UNITL2.FNAME FBASEUNITNAME,
A.FDELIVERYQTY,
A.FRECEIVEQTY,
A.FMATERIALGROUPFILTER,
A.FSALGROUPID,
OGE.FNAME FSALGROUPNAME

FROM
TMP94301A3171D011E7ABAD7CD30AC A
inner join T_BD_CURRENCY CURM on CURM.FCURRENCYID=A.FCURRENCYID
LEFT JOIN T_BD_CURRENCY_L CURL ON A.FCURRENCYID=CURL.FCURRENCYID AND CURL.FLOCALEID=2052
INNER JOIN T_BD_CURRENCY LCCURM ON A.FLCCURRENCYID=LCCURM.FCURRENCYID
LEFT JOIN T_BD_CURRENCY_L LCCURL ON A.FLCCURRENCYID=LCCURL.FCURRENCYID AND LCCURL.FLOCALEID=2052
LEFT JOIN T_BD_LOTMASTER LOTM ON LOTM.FLOTID = A.FLOTID
LEFT JOIN T_BD_LOTMASTER_L LOTL ON A.FLOTID=LOTL.FLOTID AND LOTL.FLOCALEID=2052
--INNER JOIN T_BD_MATERIALSALE MS ON A.FMATERIALID=MS.FMATERIALID
INNER JOIN T_BD_MATERIALSTOCK MS ON A.FMATERIALID=MS.FMATERIALID
--LEFT JOIN T_BD_STOCK_L STOCKL ON STOCKL.FSTOCKID=STOCKM.FSTOCKID AND STOCKL.FLOCALEID=2052
INNER JOIN T_BD_UNIT UNITM ON MS.FSTOREUNITID=UNITM.FUNITID
LEFT JOIN T_BD_UNIT_L UNITL ON MS.FSTOREUNITID=UNITL.FUNITID AND UNITL.FLOCALEID=2052
LEFT JOIN T_BD_UNIT_L UNITL2 ON A.FBASEUNITID=UNITL2.FUNITID AND UNITL2.FLOCALEID=2052
LEFT JOIN T_BD_OPERATORGROUPENTRY_L OGE ON OGE.FENTRYID=A.FSALGROUPID AND OGE.FLOCALEID=2052
INNER JOIN T_ORG_ORGANIZATIONS ORGM ON ORGM.FORGID=A.FSALEORGID
LEFT JOIN T_ORG_ORGANIZATIONS_L ORGL ON A.FSALEORGID=ORGL.FORGID AND ORGL.FLOCALEID=2052

LEFT JOIN T_ORG_ORGANIZATIONS_L ORGL2 ON A.FSETTLEORGID=ORGL2.FORGID AND ORGL2.FLOCALEID=2052
LEFT JOIN T_BD_SETTLETYPE_L SETL ON SETL.FID=A.FSETTLETYPEID AND SETL.FLOCALEID=2052
LEFT JOIN V_BD_SALESMAN_L SALERL ON SALERL.FID=A.FSALERID AND SALERL.FLOCALEID=2052
LEFT JOIN T_BAS_BILLTYPE_L BL ON BL.FBILLTYPEID=A.FBILLTYPENAME AND BL.FLOCALEID=2052

Server stack trace:
at Kingdee.BOS.App.Data.Sql.SqlDatabase.ExecuteBatch(List`1 sqlArray, Int32 batchSize, Int32 commandTimeout)
at Kingdee.BOS.App.Data.DBUtils.ExecuteBatchWithTime(Context ctx, List`1 sqlArray, Int32 batchSize, Int32 commandTimeout)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Kingdee.BOS.Contracts.IDBService.ExecuteBatchWithTime(Context ctx, List`1 sqlArray, Int32 commandTimeout)
at Kingdee.K3.SCM.App.Sal.Report.SaleOutStockDetailRpt.BuilderReportSqlAndTempTable(IRptParams filter, String tableName)
at Kingdee.BOS.Core.Report.PlugIn.AbstractSysReportServicePlugIn.CreateTempTable(IRptParams filter, String tablename)
at Kingdee.BOS.Core.Report.PlugIn.AbstractSysReportServicePlugIn.GetDataForVirtual(IRptParams filter)
at Kingdee.BOS.Core.Report.PlugIn.AbstractSysReportServicePlugIn.GetData(IRptParams filter)
at Kingdee.BOS.App.Core.PlugInProxy.SysReportServicePlugInProxy.GetReportData(ReportServiceParameter parameter)
at Kingdee.BOS.App.Core.SysReportService.GetReportData(ReportServiceParameter parameter)

Exception rethrown at [1]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Kingdee.BOS.Contracts.ISysReportService.GetReportData(ReportServiceParameter parameter)
at Kingdee.BOS.ServiceHelper.SysReportServiceHelper.GetReportData(ReportServiceParameter parameter)
at Kingdee.BOS.Model.Report.SysReportModel.GetData(Int32 start, Int32 rows)
at Kingdee.BOS.Web.Report.SysReportView.GetListData()
at Kingdee.BOS.Web.Report.SysReportView.<>c__DisplayClass55.b__51()