2021-09-16 10.11.sql 1.8 KB

1234567891011121314151617181920212223242526272829303132333435
  1. USE [befri_Goldhoo]
  2. GO
  3. /****** Object: View [shop_order].[V_CombtItemMember] Script Date: 2021/9/16 10:11:23 ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8. ALTER VIEW [shop_order].[V_CombtItemMember]
  9. AS
  10. SELECT cim.CombtItemId AS InventoryId, i.InventoryTypeId AS ItemType, i.InventoryId AS ItemId, i.InventoryCategoryId,
  11. i.InventoryNumber AS ItemNumber, i.InventoryName AS ItemName, i.Spec, i.SearchCode, i.IsSalable, i.IsCustomizable,
  12. i.CostPrice, i.SalesPrice, cim.Quantity, i.Added, i.Status, i.Description, i.PriceType, i.DeliveryCycle,
  13. i.DeliveryCycleStr, i.ProductionProperty, vtm.Text AS ProductionPropertyText, i.Price
  14. FROM basedata.Inventory i INNER JOIN
  15. basedata.CombtItemMember cim ON i.InventoryId = cim.SuitId LEFT OUTER JOIN
  16. dbo.ValueTextMap AS vtm ON vtm.TableName = 'basedata.Inventory' AND vtm.FieldName = 'ProductionProperty' AND
  17. i.ProductionProperty = vtm.Value
  18. UNION ALL
  19. SELECT cim.CustomItemId AS InventoryId, i.InventoryTypeId AS ItemType, i.InventoryId AS ItemId, i.InventoryCategoryId,
  20. i.InventoryNumber AS ItemNumber, i.InventoryName AS ItemName, i.Spec, i.SearchCode, i.IsSalable, i.IsCustomizable,
  21. i.CostPrice, i.SalesPrice, cim.Quantity, i.Added, i.Status, i.Description, i.PriceType, i.DeliveryCycle,
  22. i.DeliveryCycleStr, i.ProductionProperty, vtm.Text AS ProductionPropertyText, i.Price
  23. FROM basedata.Inventory i INNER JOIN
  24. basedata.CustomItemMember cim ON i.InventoryId = cim.MemberItemId LEFT OUTER JOIN
  25. dbo.ValueTextMap AS vtm ON vtm.TableName = 'basedata.Inventory' AND vtm.FieldName = 'ProductionProperty' AND
  26. i.ProductionProperty = vtm.Value
  27. GO