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 ...
随机推荐
- python 小程序,猜年龄
要求如下:
- 一个简单的"RPC框架"代码分析
0,服务接口定义---Echo.java /* * 定义了服务器提供的服务类型 */ public interface Echo { public String echo(String string) ...
- buildroot构建项目(八)--- u-boot 2017.11 适配开发板修改 5 ---- 系统启动初始化之五
执行完 board_init_f 后,跳回到 crt0.S中继续执行汇编语言 ldr r0, [r9, #GD_START_ADDR_SP] /* sp = gd->start_addr_sp, ...
- luogu 1314 欧拉回路
欧拉路径:一笔画的路径 欧拉回路:一笔画的回路 两者判断方法一样但是输出略有不同.并且还有Fleury(弗罗莱)算法,但是我不会.. 这里就用dfs就好 判断条件: 1)图的连通性(可用并查集判断) ...
- WPF GridView的列宽度设置为按比例分配
<Grid> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="3*" / ...
- python Twisted安装报错
系统 mac pro 错误信息: IOError: [Errno 63] File name too long: '/var/folders/72/byjy11cs0dj_z3rjtxnj_nn000 ...
- F - 回转寿司 (权值线段树)
题目链接:https://cn.vjudge.net/contest/281960#problem/F 题目大意:中文题目 具体思路:权值线段树,我们每次寻找的是满足 (i<j) L< ...
- java 多线程和并行程序设计
多线程使得程序中的多个任务可以同时执行 在一个程序中允许同时运行多个任务.在许多程序设计语言中,多线程都是通过调用依赖系统的过程或函数来实现的 为什么需要多线程?多个线程如何在单处理器系统中同时运行? ...
- SRS+flv.js打造兼容性较高的直播、点播平台
**************************************************************************************************** ...
- Python 的 six模块简介
Python 的 six模块简介 six : Six is a Python 2 and 3 compatibility library Six没有托管在Github上,而是托管在了Bitbucket ...