这实际上不是一个关于“编程”(不是特定于任何语言或数据库)的问题,而是更多关于设计和体系结构的问题。这也是一个类型为“什么是做 X 的最好方式”的问题。我希望不会引起太多的“宗教”争议。
In the past I have developed systems that in one way or another, keep some form of inventory of items (not relevant what items). Some using languages/DB's that do not support transactions. In those cases I opted not to save item 手头数量 in a field in the item record. Instead the 手头数量 is calculated totaling inventory received - total of inventory sold. This has resulted in almost no discrepancies in inventory because of software. The tables are properly indexed and the performance is good. There is a archiving process in case the amount of record start to affect performance.
几年前,我开始在这家公司工作,我继承了一套跟踪库存的系统。但是这个数量在田地里被保存了下来。注册条目时,接收到的数量将添加到该项的数量字段中。当一个商品被出售时,数量被减去。这导致了差异。在我看来,这不是正确的方法,但这里以前的程序员对此深信不疑。
我想知道是否有一个共识,什么是正确的方式是设计这样的制度。还有什么资源可用,印刷或在线,以寻求这方面的指导。
谢谢