从ASP.NET MVC中的库存减去订单数量 [英] To minus order quantity from inventory in ASP.NET MVC

查看:420
本文介绍了从ASP.NET MVC中的库存减去订单数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Here is my problem:

For example, there are 10 quantity in hand of ProductId = 1

InventoryId | ProductId | QuantityInHand
1 | 1 | 10

Whenever a new inventory comes in, a new entry is made in PRODUCT_INVENTORY table. For example, another 15 quantity has come in, so the table would look like as follows:

InventoryId | ProductId | QuantityInHand
1 | 1 | 10
2 | 1 | 15

Now, there are 10 + 15 = 25 quantity in stock. Let's assume customer has ordered for 20 items of ProductId = 1. Since we have more quantity in stock than ordered quantity, items can be sold.

Now the question is how we should adjust the Sold Items from the table. 

Option 1 - Should we deduct 10 from the first record and 10 from the second record?
OR
Option 2 - Should we deduct 15 from the second record and 5 from the first record?

Please someone should help me solve this problem in asp.net mvc

What I have tried:

I have tried it but it giving me errors

推荐答案

Quote:

我试过但它给了我错误



要获得这方面的帮助,请显示有关位置的代码和错误消息,或描述错误。


To get help on this, show code and error messages with position, or describes errors.

Quote:

现在的问题是我们应该如何调整表中的已售商品。



选项1 - 我们应该从第一张唱片中扣除10张,从第二张唱片中扣除10张吗?



选项2 - 我们应该从第二条记录中扣除15条,从第一条记录中扣除5条吗?

Now the question is how we should adjust the Sold Items from the table.

Option 1 - Should we deduct 10 from the first record and 10 from the second record?
OR
Option 2 - Should we deduct 15 from the second record and 5 from the first record?



这是您的设计选择。两种选择都是可能的,这只是你的设计选择,我们不能为你做。

第一种选择是FIFO。


It is your design choice. Both options are possible, it is just your design choice, we can't do it for you.
The fist option is something known as "FIFO".


这篇关于从ASP.NET MVC中的库存减去订单数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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