使用存储过程实现进销存系统中的先进先出算法(2)——存储过程调用
2014-12-25 17:16
561 查看
本文是我在前一篇文章提到的关于先进先出存储过程的调用演示.
有关数据库和存储过程的设计,请参阅使用存储过程实现进销存系统中的先进先出算法(1)——数据库与存储过程设计
本文共用了9个测试用例 下载
数据库初始化
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/221852250.gif" />
调用存储过程
--no.1进行入货操作,商品编号为1004191104,(售出价0,售出量0),成本价12.5,进货量100
EXEC pro_ProductSM @SorM='S',@pId='1004191104',@marketPrice=0, @marketNum=0, @stockPrice=12.5, @stockNum=100650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/222306279.gif" />
数据库更新
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/222437904.gif" />
注解:第一次进货,stockNo=>2, num1和cost1都变化了.
--no.2进行入货操作,商品编号为1004191104,(售出价0,售出量0),成本价13,进货量100
EXEC pro_ProductSM @SorM='S',@pId='1004191104',@marketPrice=0, @marketNum=0, @stockPrice=13, @stockNum=100
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/222634202.gif" />
数据库更新
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/222714968.gif" />
--no.3进行入货操作,商品编号为1004191104,(售出价0,售出量0),成本价13.5,进货量85
EXEC pro_ProductSM @SorM='S',@pId='1004191104',@marketPrice=0, @marketNum=0, @stockPrice=13.5, @stockNum=8
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/222816651.gif" />
数据库更新
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' height="114" alt="" width="893" border="0" src="http://img1.51cto.com/attachment/201004/222939649.gif" />
--no.4进行入货操作,商品编号为1004191104,(售出价0,售出量0),成本价14,进货量60
EXEC pro_ProductSM @SorM='S',@pId='1004191104',@marketPrice=0, @marketNum=0,@stockPrice=14, @stockNum=60
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/223320159.gif" />
数据库更新
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/223401978.gif" />
--no.5进行入货操作,商品编号为1004191104,(售出价0,售出量0),成本价12,进货量80
EXEC pro_ProductSM @SorM='S',@pId='1004191104',@marketPrice=0, @marketNum=0, @stockPrice=12, @stockNum=80
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/223459629.gif" />
数据库更新
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/223600592.gif" />
--no.6进行入货操作,商品编号为1004191104,(售出价0,售出量0),成本价20,进货量10
EXEC pro_ProductSM @SorM='S',@pId='1004191104',@marketPrice=0, @marketNum=0, @stockPrice=20, @stockNum=10
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/223657171.gif" />
数据库更新
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/223733509.gif" />
注解,至此,所有仓库已满.
--no.7进行入货操作,商品编号为1004191104,(售出价0,售出量0),成本价75,进货量85
EXEC pro_ProductSM @SorM='S',@pId='1004191104',@marketPrice=0, @marketNum=0, @stockPrice=75, @stockNum=85
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/230018202.gif" />
数据库没有更新
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/223939489.gif" />
注解,此时不能继续进货了.
--no.8进行售货操作,商品编号为1004191104,售出价13,售出量90,(成本价0,进货量0)
EXEC pro_ProductSM @SorM='M',@pId='1004191104',@marketPrice=13, @marketNum=90, @stockPrice=0, @stockNum=0
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/224251974.gif" />
数据库更新
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/230114625.gif" />
这是一个出售操作,由于第一个仓库中已经可以满足需求,所以第一个仓库拿出90件,剩余10件,
利润计算 (13-12.5)*90 = 45.00
--no.9进行售货操作,商品编号为1004191104,售出价13.5,售出量20,(成本价0,进货量0)
EXEC pro_ProductSM @SorM='M',@pId='1004191104',@marketPrice=13.5, @marketNum=20, @stockPrice=0, @stockNum=0
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/224743489.gif" />
数据库更新
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/224845993.gif" />
这次由于第一个仓库中只有10个了,没有满足所需的20件,所以先把第一个仓库中的10件卖掉,然后第二个仓库在卖10件,并且marketNo=>2
利润计算 (13.5-12)*10 +(13.5-13)*10 = 10.00+5.00
本文出自 “专栏:Paxos与ZooKeeper” 博客,请务必保留此出处http://nileader.blog.51cto.com/1381108/304224
有关数据库和存储过程的设计,请参阅使用存储过程实现进销存系统中的先进先出算法(1)——数据库与存储过程设计
本文共用了9个测试用例 下载
数据库初始化
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/221852250.gif" />
调用存储过程
--no.1进行入货操作,商品编号为1004191104,(售出价0,售出量0),成本价12.5,进货量100
EXEC pro_ProductSM @SorM='S',@pId='1004191104',@marketPrice=0, @marketNum=0, @stockPrice=12.5, @stockNum=100650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/222306279.gif" />
数据库更新
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/222437904.gif" />
注解:第一次进货,stockNo=>2, num1和cost1都变化了.
--no.2进行入货操作,商品编号为1004191104,(售出价0,售出量0),成本价13,进货量100
EXEC pro_ProductSM @SorM='S',@pId='1004191104',@marketPrice=0, @marketNum=0, @stockPrice=13, @stockNum=100
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/222634202.gif" />
数据库更新
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/222714968.gif" />
--no.3进行入货操作,商品编号为1004191104,(售出价0,售出量0),成本价13.5,进货量85
EXEC pro_ProductSM @SorM='S',@pId='1004191104',@marketPrice=0, @marketNum=0, @stockPrice=13.5, @stockNum=8
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/222816651.gif" />
数据库更新
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' height="114" alt="" width="893" border="0" src="http://img1.51cto.com/attachment/201004/222939649.gif" />
--no.4进行入货操作,商品编号为1004191104,(售出价0,售出量0),成本价14,进货量60
EXEC pro_ProductSM @SorM='S',@pId='1004191104',@marketPrice=0, @marketNum=0,@stockPrice=14, @stockNum=60
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/223320159.gif" />
数据库更新
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/223401978.gif" />
--no.5进行入货操作,商品编号为1004191104,(售出价0,售出量0),成本价12,进货量80
EXEC pro_ProductSM @SorM='S',@pId='1004191104',@marketPrice=0, @marketNum=0, @stockPrice=12, @stockNum=80
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/223459629.gif" />
数据库更新
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/223600592.gif" />
--no.6进行入货操作,商品编号为1004191104,(售出价0,售出量0),成本价20,进货量10
EXEC pro_ProductSM @SorM='S',@pId='1004191104',@marketPrice=0, @marketNum=0, @stockPrice=20, @stockNum=10
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/223657171.gif" />
数据库更新
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/223733509.gif" />
注解,至此,所有仓库已满.
--no.7进行入货操作,商品编号为1004191104,(售出价0,售出量0),成本价75,进货量85
EXEC pro_ProductSM @SorM='S',@pId='1004191104',@marketPrice=0, @marketNum=0, @stockPrice=75, @stockNum=85
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/230018202.gif" />
数据库没有更新
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/223939489.gif" />
注解,此时不能继续进货了.
--no.8进行售货操作,商品编号为1004191104,售出价13,售出量90,(成本价0,进货量0)
EXEC pro_ProductSM @SorM='M',@pId='1004191104',@marketPrice=13, @marketNum=90, @stockPrice=0, @stockNum=0
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/224251974.gif" />
数据库更新
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/230114625.gif" />
这是一个出售操作,由于第一个仓库中已经可以满足需求,所以第一个仓库拿出90件,剩余10件,
利润计算 (13-12.5)*90 = 45.00
--no.9进行售货操作,商品编号为1004191104,售出价13.5,售出量20,(成本价0,进货量0)
EXEC pro_ProductSM @SorM='M',@pId='1004191104',@marketPrice=13.5, @marketNum=20, @stockPrice=0, @stockNum=0
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/224743489.gif" />
数据库更新
650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" border="0" src="http://img1.51cto.com/attachment/201004/224845993.gif" />
这次由于第一个仓库中只有10个了,没有满足所需的20件,所以先把第一个仓库中的10件卖掉,然后第二个仓库在卖10件,并且marketNo=>2
利润计算 (13.5-12)*10 +(13.5-13)*10 = 10.00+5.00
本文出自 “专栏:Paxos与ZooKeeper” 博客,请务必保留此出处http://nileader.blog.51cto.com/1381108/304224
相关文章推荐
- 使用存储过程实现进销存系统中的先进先出算法(2)――存储过程调用
- 使用存储过程实现进销存系统中的先进先出算法(3)——Oracle9i版
- 使用存储过程实现进销存系统中的先进先出算法(1)——数据库与存储过程设计
- 使用存储过程实现进销存系统中的先进先出算法(1)――数据库与存储过程设计
- 使用存储过程实现进销存系统中的先进先出算法(3)――Oracle9i版
- 使用系统存储过程实现的通用分页存储过程
- linux下使用系统调用编程实现dir命令功能
- 使用ioctl“实现”自定义的系统调用
- IE下使用js调用系统activex实现文件下载
- 使用C#调用系统API实现内存注入
- VC中使用ADO调用存储过程实现方法
- 如何实现使用C/C++直接调用系统默认浏览器?
- linux下使用系统调用实现进程后台运行
- B/S(WEB)系统中使用Activex插件调用扫描仪实现连续扫描并上传图像(IE文件扫描并自动上传)
- [转]VC中使用ADO调用存储过程实现方法
- linux下使用系统调用编程实现copy命令功能
- SQL 使用系统存储过程实现的通用分页存储过程
- VC中使用ADO调用存储过程实现方法
- 如果系统要使用超大整数(超过long长度范围),请你设计一个数据结构来存储这种超大型数字以及设计一种算法来实现超大整数加法运算
- 使用nhibernate调用存储过程实现多返回值