dongyong9224 2016-03-29 04: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-29 05: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.

    评论

报告相同问题?

悬赏问题

  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)