订单与生产之间的关系(业务逻辑) [英] the relation between the order and the production (business logic)

查看:126
本文介绍了订单与生产之间的关系(业务逻辑)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个订单和生产数据库

我会详细解释一切:

数据库包含4个表

1- tbl_order (OrderID PK,OrderNo,Employee_ID,Customer_ID,OrderDate)

2- tbl_Orderdetails(OrderDetailID,OrderID FK,ProductID,Quantity,Date Required,UnitPrice)

3- tbl_Production( BatchNo,Employee_ID,DateEntered)

4- tbl_ProductionDetail(BatchNO,Date,Machine_ID,Employee_ID,Product_ID,Quantity,Defective,OvertimeQuantity,OvertimeDefective)


in the第二个表(tbl_Orderdetails)我将字段orderdetailID作为PK,以便允许复制产品

,因为订单将是这样的:

产品产品数量daterequired

所以我可以多次使用相同的产品但是需要的日期会有所不同。

假设我有这个订单

I have a database for orders and production
I will explain everything in detail:
The database contains 4 tables
1- tbl_order (OrderID PK , OrderNo, Employee_ID, Customer_ID, OrderDate)
2- tbl_Orderdetails( OrderDetailID, OrderID FK, ProductID, Quantity , Date Required, UnitPrice)
3- tbl_Production (BatchNo, Employee_ID, DateEntered)
4- tbl_ProductionDetail ( BatchNO, Date, Machine_ID, Employee_ID, Product_ID, Quantity, Defective, OvertimeQuantity, OvertimeDefective)

in the second table (tbl_Orderdetails) I made the field orderdetailID as PK in order to allow duplicating the product
because the order will be like that:
Product Product quantity daterequired
So I can have the same product more than one time but the daterequired will be different.
Assume that I have this order

展开 | 选择 | Wrap | 行号

推荐答案

所以,如果我理解正确,你有一个名为[tbl_Order Details]的表,但现在是[tbl_OrderDetails],它包含所有订购商品的详细信息([ProductID])以及它们何时是需要([需要日期]),你还有一个名为[tbl_Production detail]的表,但现在是[tbl_ProductionDetail],它包含所有项目([Product_ID])的详细信息以及它们的时间(是[日期]制作],但现在显然只是[日期]。


似乎没有删除表tr中的任何这些记录由于它们的相关性到期(例如订单完成时等),所以从开始时间开始的所有订单都可用。


您希望能够设计一个显示总计的查询所有已订购但尚未生产的产品的产品,但这些总数应按[需要的日期]分组显示。


这是对的,还是有我的误解了某个地方?
So, if I understand you correctly, you have a table that was called [tbl_Order Details], but is now [tbl_OrderDetails], that has details of all ordered items ([ProductID]) and when they are required by ([Date Required]), and you also have a table that was called [tbl_Production detail], but is now [tbl_ProductionDetail], that has details of all items ([Product_ID]) produced and when they were (Was [Date Produced], but is now apparently just [Date]).

There appears to be no deleting of any of these records from the table triggered by their relevance expiring (such as when orders are completed etc), so all orders from the beginning of time are available.

You want to be able to design a query that shows totals of all the products where there are quantities that have been ordered but not yet produced, but these totals should be shown grouped by [Date Required].

Is that about right, or have I misunderstood somewhere?




你非常清楚地了解我,但你引起我的注意,非常重要的一点,如(删除记录从相关的过期触发的表中,例如订单完成时等)

但是我该怎么办?因为这是我第一次知道我可以做那样的事情

如果你有任何有用的建议会对你很好,但不删除任何表因为我设计了很多表格,取决于orderdetail和productiondetail的表格

非常感谢

You understood me very clearly, but you drew my attention to very important points such as (the deleting of the records from the table triggered by their relevance expireing such as when orders are completed etc)
but how can I do so? because it is the first time I know that I can do something like that
If you have any useful advices that would be nice from you, but without deleting any tables because I designed a lot of forms depending on the tables of orderdetail and productiondetail
thank you very much


作为一般规则,我建议删除这些记录。我只想创建一个标志,这将指示完成哪些记录。这样,历史数据和当前数据可以保持在一起(没有额外的复杂性设计新表到结构中),只需要一个简单的值来指示哪个是哪个。


如果你考虑这是必要的,然后您可以将过期的记录复制到单独的表并删除原件。有时候(非常罕见但确实发生),要处理的记录数量使得这种方法更加明智。


那就是说,你没有真正回答我在上一篇文章中提出的问题所以我现在很难提供进一步的帮助。
As a general rule, I would not recommend deleting these records. I would simply create a flag instead, which would indicate which records are done with. That way the historical data and the current data can be maintained together (No extra complication of designing new tables into the structure) with a simple value to indicate which is which.

If you consider this necessary, then you can copy expired records to a separate table and delete the originals. Sometimes (quite rare but does happen), the number of records to process makes this approach more sensible.

That said, you didn''t really answer my question from the previous post so it''s hard for me to give further help at this time.


这篇关于订单与生产之间的关系(业务逻辑)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆