将 SKU 从字母数字更改为数字,如何!
我们公司有数千个 SKU,目前有 1-6 位数字后跟 10 个字母,代表各种颜色选项,即 1550-B= 产品 1550 为黑色。 B 代表黑色。 165334-W = 产品为白色等。
我们的新系统将只允许数字代码(这对于我们的员工来说也更容易使用 10 个键来输入所有内容)。
我们需要建议如何以数字方式输入库存编号以及与颜色相同的数字代码。 我们正在尝试找出如何从产品和颜色上进行区分。 目前,SKU 以数字 1-9 + 0 结尾,因此我们对此一无所知。 不确定我们是否可以使用句号。 在数字之间,因为这可能有效,即。 1665.2,其中2代表黑色。 数字系统中可以使用句点或任何其他字符吗? 我倾向于认为不会 - 所以如果你有任何想法,你将成为救星! 谢谢!!
Our company has thousands of SKUs that currently have 1-6 digits followed by 10 letters that represent various color options, ie. 1550-B= Product 1550 is Black. B for Black. 165334-W = Product is White etc.
Our new system will only allow numeric codes (and this will be easier also for our staff to 10-key everything).
We need advice how to numerically enter an inventory number plus a numeric code that equates to the color. We're trying to figure out how to differentiate from product and color. SKUs currently end in digits 1-9 + 0 so we're at a loss on this. Not sure if we could use a period . in between numbers as that might have worked, ie. 1665.2 with 2 representing black. Can periods or any other characters be used in a numeric system? I'd tend to think not - so if you have any ideas, you would be a lifesaver! Thanks!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您需要列出字母后缀代表的所有选项,并查看使用了多少种组合。 (是的,这将是一项艰巨的任务。)然后您就知道后续新 SKU 之间需要多少“空间”,并使用它来转换旧 SKU 的数字部分,方法是将其乘以 10 的倍数以适应该间隙。
示例:产品 165534 可能有四种颜色:黑色、白色、绿色和棕色。 例如,B、W、GR 和 N。 但 1550 有六种颜色:黑、白、灰、蓝红条纹、蓝黄条纹和蓝白条纹。 B、W、G、BR、BY 和 BW。 好的,这有八种变化。 因此,您可以按如下方式转换它们:
请注意,我已将数字部分乘以 10,然后将字母后缀转换为唯一的数字前缀。 这样做的第一个优点是 SKU
xxxx1
始终为白色。 第二个优点是产品 165534 仍然是 165534。You need to map out all the options that your letter suffixes represent and see how many combinations are used. (Yes, it will be a big task.) Then you know how much 'room' you need between subsequent new SKUs and use that to convert the numeric part of the old one by multiplying it by a multiple of 10 to fit that gap.
Example: product 165534 might come in four colours, Black, White, Green and Brown. B, W, GR and N, for instance. But 1550 comes in six colours: Black, White, Grey, Blue with Red stripes, Blue with Yellow stripes and Blue with White stripes. B, W, G, BR, BY and BW. Okay, that makes eight variations. So you can convert them as follows:
Notice that I've multiplied the numeric part by 10 and then converted the alphabetic suffix to a unique numeric prefix. The first advantage of this is that SKU
xxxx1
is always going to be White. The second advantage is that product 165534 is still going to be 165534.如果您的系统允许浮点值,则使用小数位应该没问题。
如果不是,则要求数字中的最后一位(或两位、三位等)数字表示颜色。 这样,您所需要做的就是查看最后 n 位数字来确定颜色。
If your system allows a floating point value, using a decimal place should be fine.
If not, require that the last one (or two, or three, etc.) digits in the number signify the color. That way all you need to do is look at the last n-digits to determine the color.
如果它类似于杂货店的水果或蔬菜系统(这是我能立即想到的最接近的东西),那么句点和特殊字符将不起作用 - 并且它会增加操作员错误的可能性,如果他们必须开始记住事物的十进制编码。 这很大程度上取决于您构建系统的产品。
是否可以将产品编号与颜色编号合并并仅创建一个长数字 SKU? 即:
1554643 是 x 产品 -- 白色
1554644 是 x 产品 -- 黑色
If it's anything like the system for fruit or vegetables at a grocery store (that's the closest thing I can think of off the top of my head) then periods and special characters won't work--and it increases the probability of operator error if they have to start remember decimal coding for things. A large part of this depends on what products you are building the system for.
Would it be possible to merge the product number with color numbers and just create one long numeric SKU? ie:
1554643 is x product -- white
1554644 is x product -- black
如果您的 sku 系统使用“小数”作为 sku 类型,则可以使用小数,但我怀疑它确实如此。
看起来最明智的方法是
1) 获取 sku 中的所有字母,将它们大写
2)转换为ascii
3)总结一下
4) 使用它作为 sku 的最后 4 位数字,并带有前导零,
因此 1555-WB => w=87, b=66, = 153
由于您前面有 6 位数字,因此您将始终将最后 4 位数字作为“子产品”代码,直到您管理超过 6^10 个产品!
除非你非常不幸并找到它们发生冲突的地方,否则你总是可以通过再次执行相同的数学来匹配旧的 sku,而无需在某个地方手动维护映射。
You can use decimals if your sku system uses "decimal" as the sku type, but I doubt it does.
What seems like the sanest way is to
1) take all the letters in the sku, upper case them
2) convert to ascii
3) sum them all up
4) use that as the last 4 digits of the sku, with a leading zero
So 1555-WB => w=87, b=66, = 153
Since you have 6 digits in front, you will always have the last 4 digits as the "sub product" code, until you gov over 6^10 products!
Unless you are pretty unlucky and find places where they collide, then you could always match to the old sku by doing the same math again, without needing to manually maintain a mapping somwhere.
哎哟,有什么问题啊! 如果你的颜色相对较少,像 staticsan 这样的方法应该可以正常工作。 如果您有一组丰富的颜色,则可以将每种颜色映射到其 12 位或 24 位 RGB 颜色代码。 这些颜色代码与您在网页设计(例如 CSS 样式表)中使用的颜色代码相同。
例如,要在网页上显示红色,您可以将红色调至最大,并将绿色和蓝色保留为零:#FF0000(24 位)或#F00(12 位)。 白色是每种颜色都变亮或#FFFFFF (#FFF)。 黑色关闭了红色、绿色和蓝色灯:#000000(或#000)
因此您可以将颜色名称映射到 RGB 值,如下所示,然后将它们转换为十进制并将它们附加到现有的数字代码中。
您可以将这些颜色值映射为单个十进制数,也可以将它们映射为单独的 R、G 和 B 十进制数并将它们连接起来(更易读,但会消耗更多数字)。 我想我会推荐一个四位数的值,它是 12 位 RGB 值的十进制等效值。
如果您使用 Firefox,则可以下载 ColorZilla 插件,然后用它来挑选网页上的颜色,看看它们映射的内容。 另请参阅此 CSS 颜色图表。
Ouch, what a problem! If you have relatively few colors, and approach like staticsan's should work fine. If you have a rich set of colors you could map each onto its 12-bit or 24-bit RGB color code. These are the same color codes you would use in web page design, eg, in CSS style sheets.
So for instance, to make something red on a web page you turn up the red color to max and leave green and blue at zero: #FF0000 (24-bits) or #F00 (12-bits). White is every color turned up bright or #FFFFFF (#FFF). Black has the red, green, and blue lights turned off: #000000 (or #000)
So you could map your color names onto RGB values like this, then convert them to decimal and append them to the existing numeric code.
You can map these color values into a single decimal number, or you can map them into individual R, G, and B decimal numbers and concatenate them (more readable, but chews up more digits). Guess I'd recommend a four digit value which is the decimal equivalent of the 12-bit RGB values.
If you use Firefox, you can download the ColorZilla add-on, then use it to pick out colors on web pages to see what they map too. Also see this CSS color chart.