如何根据销售点数据库架构中的属性区分产品

发布于 2024-10-12 14:38:47 字数 680 浏览 10 评论 0原文

这是我的困境,我正在为一家相当大的零售商构建 POS 系统,他们有不同的产品,这些产品具有不同的属性(尺寸、颜色等)。

当他们从供应商处收到商品时,他们希望使用自己的 UPC 条形码进行自己的标签,但他们也希望使用商品上的代码来区分不同的尺寸。

假设他们收到了有 S、M、L、XL 4 种尺码的 A 品牌衬衫,那么每种尺码应该有不同的条形码。

所以我想到为文章制定一个基本代码,然后根据属性连接数字以获得不同的代码?如果没有可用的属性,只需添加 0,

我会将尺寸和颜色作为属性存储在数据库中(实体-属性-值)。除了必须开始连接属性中的数字以得出完整的代码之外,还有更好的方法吗?

感谢您的帮助!

编辑---------------------------------------------- ---------

我正在使示例更清晰一些 所以衬衫的基本代码是:9 123456 那么蓝色的颜色是:789 然后是 S 号:012 完整代码是 9 123456 789012

因此,另一篇没有尺寸、颜色或实际上任何属性的文章的 基本代码为 9 654321 在属性部分加上 000000

这只是为了简单起见,因为每个属性只能使用一位数字。

另一个问题是,当链接到 OrderDetails 表时,我需要引用所有属性才能知道客户实际上购买了蓝色 S 号

Here is my dilemma, I am building a POS system for a pretty large retailer, they have different products which have different attributes (size, color, etc...).

When they receive the merchandise from the supplier they want to do their own labeling with their own UPC Bar Codes but they also want to differentiate between the different sizes using the code on the article.

Say they received Brand A shirts with 4 sizes S,M,L,XL then they should have different bar codes for each size.

So I thought of having a base code for the article and then concatenating numbers depending on the attributes to have different codes? and if no attributes are available just add 0s

I am storing the sizes and colors as attributes in the database as an (Entity-Attribute-Value). Is their a better way other than having to start concatenating numbers from the attributes to come up with the full code?

Thanks for your help!

edit-------------------------------------------------------

I am making the example a bit clearer
so the base code for the shirts is: 9 123456
Then for Color blue is: 789
and then for size S: 012
so the full code is 9 123456 789012

for another article that doesn't have size or color or actually any attribute
the base code would be 9 654321
plus 000000 for the attributes part

this is just for simplicity sake as I can use only one digit per attribute.

The other issue is when linking to the OrderDetails table I need to reference all the attributes to know that the customer actually bought Size S in Blue

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

多彩岁月 2024-10-19 14:38:47

一种可能的选择是创建一个将条形码存储为密钥的表。然后有一个尺寸和颜色的属性。

One possible option is to create a table that stores the bar code as the key. Then have an attribute for the size and the color.

番薯 2024-10-19 14:38:47

实际上@jzd,你的答案非常接近,但我想将属性保留为键值对。

这个想法是使用一个属性集并具有与每个集相关联的条形码。这是一个粗略的架构

AttributeSet Table:
 AttributeSetId
 ProductId
 AttributeSetName
 BarCode


AttributeUse Table:
 AttributeSetId
 AttributeId

AttributeSetInstance Table: 
 AttributeSetId
 AttributeId
 AttributeValueId

Actually @jzd your answer is pretty close but I would like to keep the attributes as key value pair.

The idea is to use and an attribute set and have a bar code associated with each set. here is a rough schema

AttributeSet Table:
 AttributeSetId
 ProductId
 AttributeSetName
 BarCode


AttributeUse Table:
 AttributeSetId
 AttributeId

AttributeSetInstance Table: 
 AttributeSetId
 AttributeId
 AttributeValueId
你穿错了嫁妆 2024-10-19 14:38:47

如果您暂时忘记了条形码...

您有数据库来跟踪该库存吗?

这些项目是否离散存储在该数据库中?

如果是这样,那么只需向该物品添加一个唯一的编号,称为 UPC 值 - 我建议不要尝试制作智能钥匙,正如您所描述的那样

if you forget the barcode for a minute...

do you have a database to track this inventory?

are the items stored discretely in this database?

if so, then just add a unique number to the item, called the UPC vale - i recommend not trying to make an intelligent key s\as you are describing

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文