dongyong9224 2016-03-28 20:49
浏览 80

条形码范围的数据库设计

I’m working on a shipping system for our warehouse. Basically what I’m trying to accomplish is, taking a number from a barcode range, and assigning it to a shipping order.

The ranges are given by our partner couriers periodically and they are usually not consecutive, e.g. 9000000-9009999, 9020000-9029999. Each number in a range should be used only once.

Currently the range is hardcoded in the script and the current index is stored in a file. (legacy implementation)

But I feel it's proper to have an interface where even non-programmers can manage ranges, monitor the status of each range (e.g. which one is currently “active”, what’s the current index, etc). And when the current range runs out, it should automatically switch to the next range available. Below is the UI design I came up with. barcode ranges management interface

Do you think it's a good idea to store the range data in the database? If so, how should I design the database table?

Some other things to be taken into considerations are:

  • Some ranges are recycled by the courier, so there is a chance we receive the same range twice. (Well, maybe some years later)
  • Most of the time a range can last 4 months to 6 months, so there won’t be many ranges. (If we use a table to store the ranges, we're looking at 2 to 4 new range records a year)
  • When a range is finished, it’s basically useless?
  • 写回答

2条回答 默认 最新

  • doudou8081 2016-03-28 21:22
    关注

    If non-adjacent ranges belong to the same Entity, then one table would have Entities, including an entity_id. The other table would contain barcode ranges (start and end), plus the entity_id.

    You would need code to verify that you don't create overlapping ranges. And to deal with deleting a sub-range.

    If you expect to have millions of ranges, then I suggest you adapt my IP-address blocks code.

    评论
  • douqianrou9079 2016-03-28 22:06
    关注

    I believe you need to take a higher-level view of matters.

    Key is the GS1 system, previously known as EAN (which I use as I've used it for 20+ years.)

    Important issue is that you should not allow YOUR shipment number to be dictated by an outside agency. If you decide to keep shipment details for 7 years say, and they decide to recycle numbers after 3, then you have a data problem. Equally, if you have more than one shipping agency (or take another on in the future, of the existing agency gets split into parts or sold or whatever) then again you can get a data problem when THEIR system changes.

    (and that applies to ALL data not directly controlled by your organisation)

    The EAN way is by using a SSCC - Serial Shipping Container Code. This is an 18-digit code assigned to an object and uniquely identifies that object. It has a nominal life of three years, so it should not be re-issued more frequently.

    The SSCC is produced according to an internationally-recognised structure and encoded in a "code 128" barcode (hence it is often referred to as GS1-128 or EAN-128) which has a lead character of [fnc1] - internationally accepted to signify "This is a barcode following the EAN-128 format". The remaining characters are:

    00 - AI for an SSCC (there is a whole slough of codes for various uses. "00" means "SSCC". It is actually an Application Identifier - though even barcode-printer manufacturers have been known to believe it forms part of a "20-digit code".

    1 digit - In former times, "3" was an "internal pallet" and "4" and "external pallet". Since the one often became the other, this system was quickly abandoned, but the legend persists - some will incorrectly insist that the leading digit must be a "3".

    7-9 digits - country code + organisation code. Allotted by the controlling organisation and licensed to the using member organisation.

    9-7 digits - individual shipment number issued by the using member organisation.

    1 digit - check digit produced according to the published algorithm and usually calculated by the printer firmware.

    So the first and penultimate group of digits are allocated by the GS1-member organisation (ie your organisation) at their own discretion.

    This system can be used for shipping your goods outside of your organisation and also for tracking the goods within your organisation.

    In all probability, your shipper has allotted a subset of their numbers to you as they commonly do with small organisations that are not GS1 members. Unfortunately, the clerks performing this task prefer to treat all of their customers the same way, so the legend arises that you have to use their system. If this idea has taken root in the fertile minds of their IT monkeys, they may have set their system up on that assumption.

    If their IT system has been set up by a professional, then they will be able to accept any complying SSCC - you simply send then your list of shipments issued with your numbers and their software will validate it against the label produced by your printer when the goods are picked up.

    You'd really need to talk to their IT department on what their requirements are.

    This would mean that you simply don't need to use their number at all - you can use the system as it was designed, using your numbers over which you have control.

    展开全部

    评论
编辑
预览

报告相同问题?

悬赏问题

  • ¥80 有偿!!请懂注册表的翻译解析一下一小段注册表的调整内容
  • ¥15 基于52单片机 交通灯系统
  • ¥15 根据访客ip显示城市名称
  • ¥20 对文档进行操作,有偿 有意向的可以加我v
  • ¥15 brainstorm进行致痫指数分析
  • ¥30 beeline连接hive集群会卡住
  • ¥15 julia语言画表面图
  • ¥15 前端css轮播图效果优化
  • ¥15 如何在已有的土地利用类型图中加入新的地类呢
  • ¥20 TCIA数据库下载报错,请问如何解决
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部