根据物料清单计算数量
我正在尝试根据物料清单计算挑选的产品数量。我已经设法让它与循环一起工作,但它又乱又慢,我确信一定有一种方法可以用 SQL 查询来完成它。 我有两张桌子。 1 包含物料清单,因此它具有父库存代码和所有子库存代码 + 每个物料清单的物料清单数量。 例如,第二个表包含订单数量和挑选的数量。 ABOM 包含 Item1 和 item2,每个物料的物料数量均为 1。
下达了 2 x ABOM 订单,因此我的程序将物料子项添加到订单中。所以我有两行: Item1 需要选择 2 个 项目 2 需要选取 2 个
在此示例中,项目 1 已选取 2 个,但项目 2 仅选取了 1 个,我想将 ABOM 选取的数量更新为 1。 是否可以通过始终根据子级的订单/提货数量返回父级库存代码的正确提货数量的查询来实现此目的?
非常感谢您提供的任何帮助:)
I am trying to calculate the quantity of product picked based on a bill of materials. I have managed to make it work with a loop but its messy and slow and i'm sure there must be a way to do it with an SQL query.
I have two tables. 1 contains the BOM so it has parent stock code and all child stock code + bom qty's for each bom.
The second table contains the order quantity and the quantity picked, for example.
ABOM contains Item1 and item2 each have a bom qty of 1.
An order is placed for 2 x ABOM so my program adds the bom children to the order. So i have 2 lines:
Item1 requires 2 to be picked
Item2 required 2 to be picked
In this example is Item 1 has 2 picked but item 2 only has 1 picked i want to update the quantity picked for ABOM to 1.
Is it possible to achieve this with a query that always returns the correct picked quantity for the parent stock code based on the order / picked quantities of the children?
Many thanks in advance for any help available :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论