产品数量的前端(键盘抬起的事件):

  1. <td>
  2. <input type="text" name="proCount" onkeyup="isProCountFull(this)" class="{required:true,min:1,digits:true}" style="width: 100px" />
  3. </td>

js代码:

  1. <script type="text/javascript">
  2. function isProCountFull(obj) {
  3. var proid = $($(obj).parent().parent().find("input[name='proID']")[0]).val();
  4. var procount=$(obj).val();
  5. if (proid != '' && proid != null) {
  6. if (procount != '' && procount != null && procount != '0') {
  7. $.ajax({
  8. type: "POST", //设置提交方式
  9. url: "getProCount.aspx",
  10. data: "proid=" + proid + "&procount=" + procount, //提交数据
  11. success: function (msg) {
  12. if (msg == "OK") {
  13. } else {
  14. alert(msg);
  15. $(obj).attr("value", "");
  16. }
  17. }
  18. });
  19. }
  20. } else {
  21. alert("请先选择产品");
  22. $(obj).attr("value", "");
  23.  
  24. }
  25. }
  26. //判断是否有重复名称的产品
  27. function issameproid(obj) {
  28. var proidcount = 0;
  29. // proidscount = $(document).find("input[name='proID']").length;
  30. var proid = $($(obj).parent().find("input[name='proID']")[0]).val();
  31. $(document).find("input[name='proID']").each(function () {
  32. if ($(this).val() == proid) {
  33. proidcount++;
  34. if (proidcount >= 2) {
  35. alert("选择产品有重复,请重新选择");
  36. $($(obj).parent().find("input[name='proName']")[0]).attr("value", "");
  37. $($(obj).parent().find("input[name='proId']")[0]).attr("value", "");
  38. }
  39. }
  40. });
  41.  
  42. }
  43. </script>

判断产品的总量是否到达:

  1. var isprocount=false;
  2. $("#trprobatch").show();
  3. var obj = window.event.srcElement;
  4. var tr = obj.parentNode.parentNode;
  5. var inputs = tr.getElementsByTagName("input");
  6. $("#divprobatch").find("input[name='proIds']").each(function () {
  7. if (inputs[1].value == $(this).val()) {
  8. boxnum++;
  9. procount += parseInt($(this).parent().parent().find("input[name='txtProCount0']").val());
  10. if (procount > parseInt(inputs[3].value)) {
  11.  
  12. isprocount=true;
  13. if(isprocount)
  14. {
  15. $(this).parent().parent().find("input[name='txtProCount0']").attr("value", "0");
  16. alert("产品总数已经达到,不能为此产品添加批号");
  17. }
  18. // event.stopPropagation();
  19.  
  20. }
  21. }

后端代码(getProCount.aspx):

  1. protected void Page_Load(object sender, EventArgs e)
  2. {
  3. string returnResult = "";//定义返回状态
  4. this.Response.Clear();
  5. //获取前端的数据
  6. string proid = Request.Form["proid"].ToString();
  7. string procount = Request.Form["procount"].ToString();
  8. returnResult = proid + " " + procount;
  9.  
  10. object obj= SqlComm.GetObjectByCondition("dbo.BioProStock", "isnull(sum(ProCout),0)", " ProID=" + proid);
  11. if (obj != null)
  12. {
  13. if (int.Parse(obj.ToString()) < int.Parse(procount))
  14. {
  15. returnResult = "此产品库存不足,最多发货数据" + obj.ToString();
  16. }
  17. else
  18. {
  19. returnResult = "OK";
  20. }
  21. }
  22. this.Response.Write(returnResult);
  23.  
  24. this.Response.End();
  25. }

根据产品的编号获取产品的名称:

  1. -- Description: 根据产品的编号获取产品的名称
  2. -- =============================================
  3. CREATE FUNCTION FN_getProNameByProID
  4. (
  5. @ProID int
  6. )
  7. RETURNS nvarchar(100)
  8. AS
  9. BEGIN
  10. DECLARE @ProName nvarchar(50)
  11. SELECT @ProName= ProName FROM BiotbProduct WHERE ProID=@ProID
  12. RETURN @ProName
  13. END

选择发货产品批次的页面:

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SendGoodsSelectProStock.aspx.cs" Inherits="BioErpWeb.SendGoods.SendGoodsSelectProStock" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head runat="server">
  7. <title></title>
  8. <link href="../Styles/Style.css" rel="stylesheet" type="text/css" />
  9. <style type="text/css">
  10. #form1
  11. {
  12. text-align: center;
  13. }
  14. .style10
  15. {
  16. height: 30px;
  17. width: 763px;
  18. }
  19. .style2
  20. {
  21. width: 100%;
  22. }
  23. .style11
  24. {
  25. width: 74px;
  26. }
  27. .style12
  28. {
  29. width: 217px;
  30. }
  31. .style13
  32. {
  33. width: 91px;
  34. }
  35. .style14
  36. {
  37. width: 47px;
  38. }
  39. .style15
  40. {
  41. width: 70px;
  42. }
  43. .style18
  44. {
  45. height: 44px;
  46. width: 763px;
  47. }
  48. .style19
  49. {
  50. width: 763px;
  51. }
  52. #tb1
  53. {
  54. width: 767px;
  55. }
  56. </style>
  57. <script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
  58. <script type="text/javascript">
  59. var procount = 0;
  60. function stockClick(control) {
  61. var tr = control.parentNode.parentNode;
  62. var txts = tr.getElementsByTagName('td');
  63. var rowIndex = control.parentNode.parentNode.rowIndex;
  64. var input = control.parentNode;
  65. var inputhf = input.getElementsByTagName('input');
  66. document.getElementById('lbproStockID').innerText = txts[1].innerHTML;
  67. document.getElementById('Label2').innerText = txts[2].innerHTML;
  68. document.getElementById('lbProBatch').innerText = txts[3].innerHTML;
  69. procount= parseInt(txts[4].innerHTML);
  70.  
  71. document.getElementById('lbExpDate').innerText = txts[5].innerHTML;
  72. document.getElementById('lbStockDate').innerText = txts[6].innerHTML;
  73. document.getElementById('lbMakeDate').innerText = txts[7].innerHTML;
  74. document.getElementById('lbMakeDate').innerText = txts[7].innerHTML;
  75. document.getElementById('lbstockid').innerText = txts[8].innerHTML;
  76. }
  77.  
  78. function returnSendEdit() {
  79. if ($("#lbStockID").html() == "" || $("#txtCount").val() == "" || $("#txtCount").val() == "0") {
  80. alert("请选择产品批次信息,并填写数量");
  81. } else {
  82. var returnbacklist = new Array($("#lbproStockID").html(), $("#lbProBatch").html(), $("#txtCount").val(), $("#lbExpDate").html(), $("#lbStockDate").html(), $("#lbMakeDate").html(), $("#lbstockid").html());
  83.  
  84. window.returnValue = returnbacklist;
  85. window.close();
  86. }
  87. }
  88.  
  89. //判断填写产品数量是否超出当前产品库存
  90. function isOvercount() {
  91. if (parseInt($("#txtCount").val()) > procount) {
  92. alert("填写产品数量越界,请重新填写");
  93. $("#txtCount").attr("value", "0");
  94. }
  95. }
  96.  
  97. </script>
  98. </head>
  99. <body>
  100. <form id="form1" runat="server">
  101. <div >
  102. <div style="margin:0px auto; width:762px;">
  103. <br />
  104. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
  105. Width="765px" CssClass="gray2">
  106. <Columns>
  107. <asp:TemplateField>
  108. <ItemTemplate>
  109. <input id= "Radio1" onclick="stockClick(this)" value="<%#DataBinder.Eval(Container.DataItem,"id")%>" name= "stock" type= "radio" />
  110. </ItemTemplate>
  111. <HeaderStyle CssClass="blue6" />
  112. <ItemStyle Width="1%" />
  113. </asp:TemplateField>
  114. <asp:BoundField DataField="ID" HeaderText="库存号" >
  115. <HeaderStyle CssClass="blue6" />
  116. <ItemStyle Width="3%" />
  117. </asp:BoundField>
  118. <asp:BoundField DataField="proName" HeaderText="产品全名" >
  119. <HeaderStyle CssClass="blue6" />
  120. <ItemStyle Width="14%" />
  121. </asp:BoundField>
  122. <asp:BoundField DataField="BathNum" HeaderText="批号" >
  123. <HeaderStyle CssClass="blue6" />
  124. <ItemStyle Width="6%" />
  125. </asp:BoundField>
  126. <asp:BoundField DataField="ProCout" HeaderText="数量" >
  127. <HeaderStyle CssClass="blue6" />
  128. <ItemStyle Width="3%" />
  129. </asp:BoundField>
  130. <asp:BoundField DataField="ExpirateDate" HeaderText="有效期" DataFormatString="{0:yyyy-MM-dd}" HtmlEncode="false" >
  131. <HeaderStyle CssClass="blue6" />
  132. <ItemStyle Width="4%" />
  133. </asp:BoundField>
  134. <asp:BoundField DataField="StockDate" HeaderText="入库日期" DataFormatString="{0:yyyy-MM-dd}" HtmlEncode="false" >
  135. <HeaderStyle CssClass="blue6" />
  136. <ItemStyle Width="4%" />
  137. </asp:BoundField>
  138. <asp:BoundField DataField="makeDate" HeaderText="生产日期" DataFormatString="{0:yyyy-MM-dd}" HtmlEncode="false" >
  139. <HeaderStyle CssClass="blue6" />
  140. <ItemStyle Width="4%" />
  141. </asp:BoundField>
  142. <asp:BoundField DataField="StockID" HeaderText="仓库编号" HtmlEncode="false" >
  143. <HeaderStyle CssClass="blue6" />
  144. <ItemStyle Width="4%" />
  145. </asp:BoundField>
  146. </Columns>
  147. </asp:GridView>
  148. </div>
  149. <div style="margin:0px auto; width:751px;">
  150. <table id="tb1" cellpadding="0" cellspacing="0">
  151. <tr>
  152. <td id="tdNoData" style="display:none; color: #FF0000; font-size: 25px; font-weight: inherit;line-height: 30px;"
  153. class="style18">
  154. 这个产品现在没有库存!</td>
  155. </tr>
  156. <tr id="tr1">
  157. <td style="text-align:left;" class="style10">
  158. 注意:你填写的数量请不要超过你选择的库存的数量!</td>
  159. </tr>
  160. <tr id="tr2">
  161. <td class="style19">
  162. <table class="style2" border="1" style="border-collapse:collapse;" >
  163. <tr class="blue6">
  164. <td class="style11">
  165. 库存号</td>
  166. <td class="style12">
  167. 产品全名</td>
  168. <td class="style13">
  169. 批号</td>
  170. <td class="style14">
  171. 数量</td>
  172. <td class="style11">
  173. 有效期</td>
  174. <td class="style15">
  175. 入库日期</td>
  176. <td>
  177. 生产日期</td>
  178. <td>仓库编号</td>
  179. </tr>
  180. <tr>
  181. <td class="style11">
  182. <asp:Label ID="lbproStockID" runat="server" CssClass="gray2"></asp:Label>
  183. </td>
  184. <td class="style12">
  185. <asp:Label ID="Label2" runat="server" CssClass="gray2"></asp:Label>
  186. </td>
  187. <td class="style13">
  188. <asp:Label ID="lbProBatch" runat="server" CssClass="gray2"></asp:Label>
  189. </td>
  190. <td class="style14">
  191. <asp:TextBox ID="txtCount" onkeyup="isOvercount()" runat="server" CssClass="input" Width="41px"></asp:TextBox>
  192. </td>
  193. <td class="style11">
  194. <asp:Label ID="lbExpDate" runat="server" CssClass="gray2"></asp:Label>
  195. </td>
  196. <td class="style15">
  197. <asp:Label ID="lbStockDate" runat="server" CssClass="gray2"></asp:Label>
  198. </td>
  199. <td>
  200. <asp:Label ID="lbMakeDate" runat="server" CssClass="gray2"></asp:Label>
  201. </td>
  202. <td>
  203. <asp:Label ID="lbstockid" runat="server" CssClass="gray2"></asp:Label>
  204. </td>
  205. </tr>
  206. </table>
  207. </td>
  208. </tr>
  209. <tr>
  210. <td class="style19">
  211. <table cellpadding="0" cellspacing="0" style=" width:99%; margin:10px;" >
  212. <tr>
  213. <td style=" text-align:right;">
  214. <span><input id="Button1" class="btn1" onclick="returnSendEdit()" style=" width:80px;" type="button" value="确定" /></span>
  215.  
  216. <span><input id="Button2" class="btn2" style=" width:80px;" onclick="{window.close()}" type="button" value="关闭" /></span></td>
  217. </tr>
  218. </table>
  219. </td>
  220. </tr>
  221. <tr>
  222. <td class="style19">
  223.  </td>
  224. </tr>
  225. </table>
  226. </div>
  227.  
  228. </div>
  229. </form>
  230. </body>
  231. </html>

后台的代码:

  1. protected void Page_Load(object sender, EventArgs e)
  2. {
  3. if (Request.QueryString["proID"] != null && Request.QueryString["proID"] != "")
  4. {
  5. this.GridView1.DataSource = SqlComm.GetDataByCondition("dbo.BioProStock", "*,ProName=dbo.FN_getProNameByProID(proid)", "ProId=" + Request.QueryString["proID"]);
  6. this.GridView1.DataBind();
  7. }
  8. }

发货产品添加批号,对应修改产品库存数量:

  1. --发货产品添加批号,对应修改产品库存数量
  2. --======================================
  3. CREATE PROC [dbo].[BioProStockUpdateCount]
  4. (
  5. @ID INT,
  6. @ProCout INT --此产品批次的数量
  7. )
  8. AS
  9. DECLARE @realCount INT
  10. SELECT @realCount= ProCout FROM dbo.BioProStock WHERE ID=@ID
  11. IF(@realCount>@ProCout)
  12. BEGIN
  13. UPDATE dbo.BioProStock SET ProCout=@realCount-@ProCout
  14. WHERE ID=@ID
  15. END
  16. ELSE
  17. BEGIN
  18. DELETE FROM dbo.BioProStock WHERE ID=@ID
  19. END

ERP产品销售发货判断库存功能(四十二)的更多相关文章

  1. ERP产品销售发货--发货管理(四十一)

    发货详细信息的业务实体视图: CREATE VIEW [dbo].[View_BioSendAppInfo] AS SELECT SendId, BillNo, Subject, DepartMent ...

  2. NeHe OpenGL教程 第四十二课:多重视口

    转自[翻译]NeHe OpenGL 教程 前言 声明,此 NeHe OpenGL教程系列文章由51博客yarin翻译(2010-08-19),本博客为转载并稍加整理与修改.对NeHe的OpenGL管线 ...

  3. Gradle 1.12用户指南翻译——第四十二章. Announce插件

    本文由CSDN博客万一博主翻译,其他章节的翻译请参见: http://blog.csdn.net/column/details/gradle-translation.html 翻译项目请关注Githu ...

  4. 网站开发进阶(四十二)巧用clear:both

    网站开发进阶(四十二)巧用clear:both 前言 我们在制作网页中用div+css或者称xhtml+css都会遇到一些很诡异的情况,明明布局正确,但是整个画面却混乱起来了,有时候在IE6下看的很正 ...

  5. SQL注入之Sqli-labs系列第四十一关(基于堆叠注入的盲注)和四十二关四十三关四十四关四十五关

    0x1普通测试方式 (1)输入and1=1和and1=2测试,返回错误,证明存在注入 (2)union select联合查询 (3)查询表名 (4)其他 payload: ,( ,( 0x2 堆叠注入 ...

  6. “全栈2019”Java第四十二章:静态代码块与初始化顺序

    难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java第 ...

  7. 第四十二个知识点:看看你的C代码为蒙哥马利乘法,你能确定它可能在哪里泄漏侧信道路吗?

    第四十二个知识点:看看你的C代码为蒙哥马利乘法,你能确定它可能在哪里泄漏侧信道路吗? 几个月前(回到3月份),您可能还记得我在这个系列的52件东西中发布了第23件(可以在这里找到).这篇文章的标题是& ...

  8. abp(net core)+easyui+efcore实现仓储管理系统——入库管理之六(四十二)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  9. ERP产品购进批量提交文件(三十六)

    商品录入前端的代码: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Pro ...

随机推荐

  1. python 小程序,猜年龄

    要求如下:

  2. 一个简单的"RPC框架"代码分析

    0,服务接口定义---Echo.java /* * 定义了服务器提供的服务类型 */ public interface Echo { public String echo(String string) ...

  3. buildroot构建项目(八)--- u-boot 2017.11 适配开发板修改 5 ---- 系统启动初始化之五

    执行完 board_init_f 后,跳回到 crt0.S中继续执行汇编语言 ldr r0, [r9, #GD_START_ADDR_SP] /* sp = gd->start_addr_sp, ...

  4. luogu 1314 欧拉回路

    欧拉路径:一笔画的路径 欧拉回路:一笔画的回路 两者判断方法一样但是输出略有不同.并且还有Fleury(弗罗莱)算法,但是我不会.. 这里就用dfs就好 判断条件: 1)图的连通性(可用并查集判断) ...

  5. WPF GridView的列宽度设置为按比例分配

    <Grid> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="3*" / ...

  6. python Twisted安装报错

    系统 mac pro 错误信息: IOError: [Errno 63] File name too long: '/var/folders/72/byjy11cs0dj_z3rjtxnj_nn000 ...

  7. F - 回转寿司 (权值线段树)

    题目链接:https://cn.vjudge.net/contest/281960#problem/F 题目大意:中文题目 具体思路:权值线段树,我们每次寻找的是满足 (i<j)   L< ...

  8. java 多线程和并行程序设计

    多线程使得程序中的多个任务可以同时执行 在一个程序中允许同时运行多个任务.在许多程序设计语言中,多线程都是通过调用依赖系统的过程或函数来实现的 为什么需要多线程?多个线程如何在单处理器系统中同时运行? ...

  9. SRS+flv.js打造兼容性较高的直播、点播平台

    **************************************************************************************************** ...

  10. Python 的 six模块简介

    Python 的 six模块简介 six : Six is a Python 2 and 3 compatibility library Six没有托管在Github上,而是托管在了Bitbucket ...