ERP产品销售发货判断库存功能(四十二)
产品数量的前端(键盘抬起的事件):
<td>
<input type="text" name="proCount" onkeyup="isProCountFull(this)" class="{required:true,min:1,digits:true}" style="width: 100px" />
</td>
js代码:
<script type="text/javascript">
function isProCountFull(obj) {
var proid = $($(obj).parent().parent().find("input[name='proID']")[0]).val();
var procount=$(obj).val();
if (proid != '' && proid != null) {
if (procount != '' && procount != null && procount != '0') {
$.ajax({
type: "POST", //设置提交方式
url: "getProCount.aspx",
data: "proid=" + proid + "&procount=" + procount, //提交数据
success: function (msg) {
if (msg == "OK") {
} else {
alert(msg);
$(obj).attr("value", "");
}
}
});
}
} else {
alert("请先选择产品");
$(obj).attr("value", ""); }
}
//判断是否有重复名称的产品
function issameproid(obj) {
var proidcount = 0;
// proidscount = $(document).find("input[name='proID']").length;
var proid = $($(obj).parent().find("input[name='proID']")[0]).val();
$(document).find("input[name='proID']").each(function () {
if ($(this).val() == proid) {
proidcount++;
if (proidcount >= 2) {
alert("选择产品有重复,请重新选择");
$($(obj).parent().find("input[name='proName']")[0]).attr("value", "");
$($(obj).parent().find("input[name='proId']")[0]).attr("value", "");
}
}
}); }
</script>
判断产品的总量是否到达:
var isprocount=false;
$("#trprobatch").show();
var obj = window.event.srcElement;
var tr = obj.parentNode.parentNode;
var inputs = tr.getElementsByTagName("input");
$("#divprobatch").find("input[name='proIds']").each(function () {
if (inputs[1].value == $(this).val()) {
boxnum++;
procount += parseInt($(this).parent().parent().find("input[name='txtProCount0']").val());
if (procount > parseInt(inputs[3].value)) { isprocount=true;
if(isprocount)
{
$(this).parent().parent().find("input[name='txtProCount0']").attr("value", "0");
alert("产品总数已经达到,不能为此产品添加批号");
}
// event.stopPropagation(); }
}
后端代码(getProCount.aspx):
protected void Page_Load(object sender, EventArgs e)
{
string returnResult = "";//定义返回状态
this.Response.Clear();
//获取前端的数据
string proid = Request.Form["proid"].ToString();
string procount = Request.Form["procount"].ToString();
returnResult = proid + " " + procount; object obj= SqlComm.GetObjectByCondition("dbo.BioProStock", "isnull(sum(ProCout),0)", " ProID=" + proid);
if (obj != null)
{
if (int.Parse(obj.ToString()) < int.Parse(procount))
{
returnResult = "此产品库存不足,最多发货数据" + obj.ToString();
}
else
{
returnResult = "OK";
}
}
this.Response.Write(returnResult); this.Response.End();
}
根据产品的编号获取产品的名称:
-- Description: 根据产品的编号获取产品的名称
-- =============================================
CREATE FUNCTION FN_getProNameByProID
(
@ProID int
)
RETURNS nvarchar(100)
AS
BEGIN
DECLARE @ProName nvarchar(50)
SELECT @ProName= ProName FROM BiotbProduct WHERE ProID=@ProID
RETURN @ProName
END
选择发货产品批次的页面:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SendGoodsSelectProStock.aspx.cs" Inherits="BioErpWeb.SendGoods.SendGoodsSelectProStock" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../Styles/Style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#form1
{
text-align: center;
}
.style10
{
height: 30px;
width: 763px;
}
.style2
{
width: 100%;
}
.style11
{
width: 74px;
}
.style12
{
width: 217px;
}
.style13
{
width: 91px;
}
.style14
{
width: 47px;
}
.style15
{
width: 70px;
}
.style18
{
height: 44px;
width: 763px;
}
.style19
{
width: 763px;
}
#tb1
{
width: 767px;
}
</style>
<script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript">
var procount = 0;
function stockClick(control) {
var tr = control.parentNode.parentNode;
var txts = tr.getElementsByTagName('td');
var rowIndex = control.parentNode.parentNode.rowIndex;
var input = control.parentNode;
var inputhf = input.getElementsByTagName('input');
document.getElementById('lbproStockID').innerText = txts[1].innerHTML;
document.getElementById('Label2').innerText = txts[2].innerHTML;
document.getElementById('lbProBatch').innerText = txts[3].innerHTML;
procount= parseInt(txts[4].innerHTML); document.getElementById('lbExpDate').innerText = txts[5].innerHTML;
document.getElementById('lbStockDate').innerText = txts[6].innerHTML;
document.getElementById('lbMakeDate').innerText = txts[7].innerHTML;
document.getElementById('lbMakeDate').innerText = txts[7].innerHTML;
document.getElementById('lbstockid').innerText = txts[8].innerHTML;
} function returnSendEdit() {
if ($("#lbStockID").html() == "" || $("#txtCount").val() == "" || $("#txtCount").val() == "0") {
alert("请选择产品批次信息,并填写数量");
} else {
var returnbacklist = new Array($("#lbproStockID").html(), $("#lbProBatch").html(), $("#txtCount").val(), $("#lbExpDate").html(), $("#lbStockDate").html(), $("#lbMakeDate").html(), $("#lbstockid").html()); window.returnValue = returnbacklist;
window.close();
}
} //判断填写产品数量是否超出当前产品库存
function isOvercount() {
if (parseInt($("#txtCount").val()) > procount) {
alert("填写产品数量越界,请重新填写");
$("#txtCount").attr("value", "0");
}
} </script>
</head>
<body>
<form id="form1" runat="server">
<div >
<div style="margin:0px auto; width:762px;">
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
Width="765px" CssClass="gray2">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<input id= "Radio1" onclick="stockClick(this)" value="<%#DataBinder.Eval(Container.DataItem,"id")%>" name= "stock" type= "radio" />
</ItemTemplate>
<HeaderStyle CssClass="blue6" />
<ItemStyle Width="1%" />
</asp:TemplateField>
<asp:BoundField DataField="ID" HeaderText="库存号" >
<HeaderStyle CssClass="blue6" />
<ItemStyle Width="3%" />
</asp:BoundField>
<asp:BoundField DataField="proName" HeaderText="产品全名" >
<HeaderStyle CssClass="blue6" />
<ItemStyle Width="14%" />
</asp:BoundField>
<asp:BoundField DataField="BathNum" HeaderText="批号" >
<HeaderStyle CssClass="blue6" />
<ItemStyle Width="6%" />
</asp:BoundField>
<asp:BoundField DataField="ProCout" HeaderText="数量" >
<HeaderStyle CssClass="blue6" />
<ItemStyle Width="3%" />
</asp:BoundField>
<asp:BoundField DataField="ExpirateDate" HeaderText="有效期" DataFormatString="{0:yyyy-MM-dd}" HtmlEncode="false" >
<HeaderStyle CssClass="blue6" />
<ItemStyle Width="4%" />
</asp:BoundField>
<asp:BoundField DataField="StockDate" HeaderText="入库日期" DataFormatString="{0:yyyy-MM-dd}" HtmlEncode="false" >
<HeaderStyle CssClass="blue6" />
<ItemStyle Width="4%" />
</asp:BoundField>
<asp:BoundField DataField="makeDate" HeaderText="生产日期" DataFormatString="{0:yyyy-MM-dd}" HtmlEncode="false" >
<HeaderStyle CssClass="blue6" />
<ItemStyle Width="4%" />
</asp:BoundField>
<asp:BoundField DataField="StockID" HeaderText="仓库编号" HtmlEncode="false" >
<HeaderStyle CssClass="blue6" />
<ItemStyle Width="4%" />
</asp:BoundField>
</Columns>
</asp:GridView>
</div>
<div style="margin:0px auto; width:751px;">
<table id="tb1" cellpadding="0" cellspacing="0">
<tr>
<td id="tdNoData" style="display:none; color: #FF0000; font-size: 25px; font-weight: inherit;line-height: 30px;"
class="style18">
这个产品现在没有库存!</td>
</tr>
<tr id="tr1">
<td style="text-align:left;" class="style10">
注意:你填写的数量请不要超过你选择的库存的数量!</td>
</tr>
<tr id="tr2">
<td class="style19">
<table class="style2" border="1" style="border-collapse:collapse;" >
<tr class="blue6">
<td class="style11">
库存号</td>
<td class="style12">
产品全名</td>
<td class="style13">
批号</td>
<td class="style14">
数量</td>
<td class="style11">
有效期</td>
<td class="style15">
入库日期</td>
<td>
生产日期</td>
<td>仓库编号</td>
</tr>
<tr>
<td class="style11">
<asp:Label ID="lbproStockID" runat="server" CssClass="gray2"></asp:Label>
</td>
<td class="style12">
<asp:Label ID="Label2" runat="server" CssClass="gray2"></asp:Label>
</td>
<td class="style13">
<asp:Label ID="lbProBatch" runat="server" CssClass="gray2"></asp:Label>
</td>
<td class="style14">
<asp:TextBox ID="txtCount" onkeyup="isOvercount()" runat="server" CssClass="input" Width="41px"></asp:TextBox>
</td>
<td class="style11">
<asp:Label ID="lbExpDate" runat="server" CssClass="gray2"></asp:Label>
</td>
<td class="style15">
<asp:Label ID="lbStockDate" runat="server" CssClass="gray2"></asp:Label>
</td>
<td>
<asp:Label ID="lbMakeDate" runat="server" CssClass="gray2"></asp:Label>
</td>
<td>
<asp:Label ID="lbstockid" runat="server" CssClass="gray2"></asp:Label>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="style19">
<table cellpadding="0" cellspacing="0" style=" width:99%; margin:10px;" >
<tr>
<td style=" text-align:right;">
<span><input id="Button1" class="btn1" onclick="returnSendEdit()" style=" width:80px;" type="button" value="确定" /></span> <span><input id="Button2" class="btn2" style=" width:80px;" onclick="{window.close()}" type="button" value="关闭" /></span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="style19">
</td>
</tr>
</table>
</div> </div>
</form>
</body>
</html>
后台的代码:
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["proID"] != null && Request.QueryString["proID"] != "")
{
this.GridView1.DataSource = SqlComm.GetDataByCondition("dbo.BioProStock", "*,ProName=dbo.FN_getProNameByProID(proid)", "ProId=" + Request.QueryString["proID"]);
this.GridView1.DataBind();
}
}
发货产品添加批号,对应修改产品库存数量:
--发货产品添加批号,对应修改产品库存数量
--======================================
CREATE PROC [dbo].[BioProStockUpdateCount]
(
@ID INT,
@ProCout INT --此产品批次的数量
)
AS
DECLARE @realCount INT
SELECT @realCount= ProCout FROM dbo.BioProStock WHERE ID=@ID
IF(@realCount>@ProCout)
BEGIN
UPDATE dbo.BioProStock SET ProCout=@realCount-@ProCout
WHERE ID=@ID
END
ELSE
BEGIN
DELETE FROM dbo.BioProStock WHERE ID=@ID
END
ERP产品销售发货判断库存功能(四十二)的更多相关文章
- ERP产品销售发货--发货管理(四十一)
发货详细信息的业务实体视图: CREATE VIEW [dbo].[View_BioSendAppInfo] AS SELECT SendId, BillNo, Subject, DepartMent ...
- NeHe OpenGL教程 第四十二课:多重视口
转自[翻译]NeHe OpenGL 教程 前言 声明,此 NeHe OpenGL教程系列文章由51博客yarin翻译(2010-08-19),本博客为转载并稍加整理与修改.对NeHe的OpenGL管线 ...
- Gradle 1.12用户指南翻译——第四十二章. Announce插件
本文由CSDN博客万一博主翻译,其他章节的翻译请参见: http://blog.csdn.net/column/details/gradle-translation.html 翻译项目请关注Githu ...
- 网站开发进阶(四十二)巧用clear:both
网站开发进阶(四十二)巧用clear:both 前言 我们在制作网页中用div+css或者称xhtml+css都会遇到一些很诡异的情况,明明布局正确,但是整个画面却混乱起来了,有时候在IE6下看的很正 ...
- SQL注入之Sqli-labs系列第四十一关(基于堆叠注入的盲注)和四十二关四十三关四十四关四十五关
0x1普通测试方式 (1)输入and1=1和and1=2测试,返回错误,证明存在注入 (2)union select联合查询 (3)查询表名 (4)其他 payload: ,( ,( 0x2 堆叠注入 ...
- “全栈2019”Java第四十二章:静态代码块与初始化顺序
难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java第 ...
- 第四十二个知识点:看看你的C代码为蒙哥马利乘法,你能确定它可能在哪里泄漏侧信道路吗?
第四十二个知识点:看看你的C代码为蒙哥马利乘法,你能确定它可能在哪里泄漏侧信道路吗? 几个月前(回到3月份),您可能还记得我在这个系列的52件东西中发布了第23件(可以在这里找到).这篇文章的标题是& ...
- abp(net core)+easyui+efcore实现仓储管理系统——入库管理之六(四十二)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- ERP产品购进批量提交文件(三十六)
商品录入前端的代码: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Pro ...
随机推荐
- javascript 模拟日历
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 词典的实现(3)--使用JAVA类库ArrayList实现Map数据结构
1,在词典的实现(2)-借助顺序表(数组)实现词典文章中使用了自定义的数组代替ArrayList,并实现了Map数据结构的基本功能.而借助JAVA类库ArrayList类的一些方法可以更加容易地实现M ...
- Python入门系列教程(一)基础
基础知识 1.变量及类型 2.换行\n 3.输入 password = raw_input("请输入密码:") print '您刚刚输入的密码是:', password 4.格式化 ...
- WIN10下安装USB转串口驱动出现“文件的哈希值不在指定的目录”的解决办法
今天安装openJTAG驱动时出现“文件的哈希值不在指定的目录”,系统为WIN10专业版. 原因是驱动无数字签名,在WIN10中是不安全的驱动,所以显示哈希值不在范围内不能安装. 经查阅已经解决,发放 ...
- 字体选择框QFontComboBox
self.combobox_2 = QFontComboBox(self) # 实例化字体列表框 combobox.currentFont() 返回字体选择框中当前的字体 self.combobo ...
- Linux之Ubuntu安装Sublime
0.控制台下开启并使用: 为什么先说这一步呢?确实很尴尬,对不对.但确实,当初就是安装好了都不知道咋个用,就是这么蠢...hahahahahahahha 命令行:subl 注意:不是sub,也不是su ...
- Python3之网络爬虫<0>初级
由于Python3合并URLib与URLlib2统一为URLlib,Python3将urlopen方法放在了urllib.request对象下. 官方文档:https://docs.python.or ...
- “微信小程序商城构建全栈应用”开发小记
注意事项: 1.application\api\extra下的wx.php记得填写小程序的app_id.app_secret: 2.API测试小工具需要APPID:
- 字符加密 Valentino 函数 (伪分治)
题面 \(solution:\) 这一题重点不在字符串加密,而是我们最后的求值:\(K^{s}\mod M\)(\(s\leq36^{100000}\)) 而我们发现它的指数十分巨大,但众所周知的指数 ...
- LaTeX 对齐问题
一.一行文本对齐 \leftline{左对齐} \centerline{居中} \rightline{右对齐} 二.多行文本或段落对齐 左对齐 \begin{flushleft}...\end{flu ...