根据vb.net中的库存输入/输出值更新库存值 [英] updating stock values based on the stock in/out value in vb.net

查看:84
本文介绍了根据vb.net中的库存输入/输出值更新库存值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


让我直接解决我的问题.这是说明.
我想根据存货和存货来更新存货水平的值.如果用户更新存货或存货的价值,则库存的当前数量应更改.目前,我只能基于1情况更新值,无论它是进货还是缺货的价值.我应该尝试任何可能的编码/方式吗?
这是我的更新代码:

Hi,
Let me go directly to my problem. Here is the explanation.
I want to update the value of stock level based on the stock in and stock out. the current quantity of the stock should change if user update the value of the stock in or stock out. Currently, i only can update the value based on the 1 situation whether it is value of stock in or stock out. Is there any possible coding/way that i should try?
this my coding for updating :

<asp:SqlDataSource ID="SqlDataSource1" runat="server"

            ConnectionString="<%$ ConnectionStrings:INVENTORY.MDFConnectionString %>"

            SelectCommand="SELECT Inventory.*, StokIn.QtyIn FROM Inventory INNER JOIN StokIn ON Inventory.MedicineId = StokIn.MedicineId"

            UpdateCommand="UPDATE Inventory SET CurrentQty = Inventory.CurrentQty + StokIn.QtyIn FROM Inventory INNER JOIN StokIn ON Inventory.MedicineId = StokIn.MedicineId">
        </asp:SqlDataSource>



用户更新缺货"值后,我是否有可能组合-"算法来计算当前数量?在此先感谢



Is there any possibility for me to combine the "-" arithmetic to calculate the current quantity once the user update the Stock out value? Thanks in advance

推荐答案

ConnectionStrings:INVENTORY.MDFConnectionString %> " span> =" 选择库存.*,StokIn.QtyIn从库存内部加入StokIn ON Inventory.MedicineId = StokIn.MedicineId" span> =" 更新库存SET CurrentQty = Inventory.CurrentQty + StokIn.QtyIn来自库存内部联接StokIn ON Inventory.MedicineId = StokIn.MedicineId" < /asp:SqlDataSource >
ConnectionStrings:INVENTORY.MDFConnectionString %>" SelectCommand="SELECT Inventory.*, StokIn.QtyIn FROM Inventory INNER JOIN StokIn ON Inventory.MedicineId = StokIn.MedicineId" UpdateCommand="UPDATE Inventory SET CurrentQty = Inventory.CurrentQty + StokIn.QtyIn FROM Inventory INNER JOIN StokIn ON Inventory.MedicineId = StokIn.MedicineId"> </asp:SqlDataSource>



用户更新缺货"值后,我是否有可能组合-"算法来计算当前数量?预先感谢



Is there any possibility for me to combine the "-" arithmetic to calculate the current quantity once the user update the Stock out value? Thanks in advance


所以要在单个SQL语句中添加in并减去out?

不确定您的模式,但是类似的东西会起作用
So you want to add the in and subtract the out in a single SQL statement?

Not sure of your schema, but something like this will work
UPDATE Inventory
SET CurrentQty = Inventory.CurrentQty + IsNull(StokIn.QtyIn, 0) - IsNull(StokOut.QtyOut, 0)
FROM Inventory
 LEFT JOIN StokIn ON Inventory.MedicineId = StokIn.MedicineId
 LEFT JOIN StokOut ON Inventory.MedicineId = StokIn.MedicineId


这篇关于根据vb.net中的库存输入/输出值更新库存值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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