Select Convert(nvarchar(50),'采购退料单') As FBillTypeName,v1.FStockOrgID,v1.FDate,v1.FID As FInterID,v1.FBillNo,'' As FCodeNo,'' As FShiftType,
t2.FShortName As FSupplyShortName,t2.FName As FSupplyName,'' As FCustShortName,'' As FCustName,t3.FName As FEmpName,'' As FSenderName,v1.FDescription As FNote,
Convert(nvarchar(50),Case When v1.FDocumentStatus = 'Z' then '暂存' When v1.FDocumentStatus = 'A' then '创建' When v1.FDocumentStatus = 'B' then '审核中' When v1.FDocumentStatus = 'C' then '已审核' When v1.FDocumentStatus = 'D' then '重新审核' End) As FStatus,
u1.FEntryID,u1.FSeq,t4.FNumber,t4.FMaterialName,t4.FSpecification,'' As FWorkShopName,'' As FSrcStockName,'' As FDestStockName,t9.FStockName,'' As FDataValue,u1.FExtAuxUnitQty As FExtAuxUnitQty,u1.FRMRealQty As FStockQty,u1.F_PAEZ_DECIMAL As FOtherQty,v1.FCreateDate,v1.FModifyDate,st226_L.FName As FExtUnitName,st27_L.FName As FStockUnitName
From t_PUR_MRB v1 Inner Join t_PUR_MRBEntry u1 On v1.FID = u1.FID
Left Join V_GetK3CloudSupplier t2 On v1.FSupplierID = t2.FItemID
Left Join V_GetK3CloudPOMan t3 On v1.FPurchaserID = t3.FItemID
Left Join V_GetK3CloudMaterial t4 On u1.FMaterialID = t4.FMaterialID
Left Join V_GetK3CloudUnitData t5 On u1.FExtAuxUnitID = t5.FUnitID
Left Join V_GetK3CloudUnitData t6 On u1.FUnitID = t6.FUnitID
Left Join t_PUR_MRBEntry_F u1_F On u1.FEntryID = u1_F.FEntryID
Left Join t_PUR_MRBFin v1_F On u1.FID = v1_F.FID
Left Join V_GetK3CloudUnitData t7 On u1_F.FPriceUnitID = t7.FUnitID
Left Join V_GetK3CloudDepartment t8 On v1.FPurchaseDeptID = t8.FItemID
Left Join V_GetK3CloudStockData t9 On u1.FStockID = t9.FStockID
LEFT OUTER JOIN T_BD_UNIT_L st226_L ON (u1.FEXTAUXUNITID = st226_L.FUNITID AND st226_L.FLocaleId = 2052)
LEFT OUTER JOIN T_BD_UNIT_L st27_L ON (u1.FUNITID = st27_L.FUNITID AND st27_L.FLocaleId = 2052)
推荐阅读