产品添加批号后相应修改产品库存表中对应批次产品的数量:
 /// <summary>/// 产品添加批号后相应修改产品库存表中对应批次产品的数量/// </summary>/// <param name="stockproid">库存表主键编号</param>/// <param name="procount">发货的数量</param>/// <returns>int</returns>public static int BioProStockUpdateCount(int stockproid, int procount){SqlParameter[] pars = new SqlParameter[]{new SqlParameter("@ID",stockproid),new SqlParameter("@ProCout",procount)};return   DataBaseHelper.ExcuteSqlReturnInt("BioProStockUpdateCount", CommandType.StoredProcedure, pars);}

视图实现按发货单查询产品批次信息,将查询结果进行数据绑定:

CREATE VIEW [dbo].[ViewSendProBaths]
AS
SELECT a.ProBatchID,    a.SendProID, a.batchNum,a.boxNum,a.proCount,a.ProStockID,CONVERT(NVARCHAR(10),a.stockDate,121) AS stockDate,a.stockID,CONVERT(NVARCHAR(10),a.expirationDate,121) AS expirationDate,CONVERT(NVARCHAR(10),a.makeDate,121)AS makeDate,a.isprinted ,b.SendID,b.ProID,b.ProCount AS procounttotal
FROM dbo.BioSendProBatch AS a INNER JOIN dbo.BioSendGoodsPro
AS b ON b.SendProID = a.SendProID

当前产品批次的数量和库存表中的数量进行比较:(Ajax代码)

     //判断产品数量是否满足需求function isProBathCountFull(obj) {//库存表编号(主键)var prostockid = $($(obj).parent().parent().find("input[name='stockproid']")[0]).val();var procount=$(obj).val();if (prostockid != '' && prostockid !=undefined) {if (procount != '' && procount !=undefined && procount != '0') {$.ajax({type: "POST", //设置提交方式url: "getProBatchCount.aspx",data: "prostockid=" + prostockid + "&procount=" + procount, //提交数据success: function (msg) {if (msg == "OK") {                               } else {alert(msg);$(obj).attr("value", "");}}});}} else {alert("请先选择产品");$(obj).attr("value", "");}}

后台代码:

protected void Page_Load(object sender, EventArgs e){string returnResult = "";//定义返回状态this.Response.Clear();string prostockid = Request.Form["prostockid"].ToString();string procount = Request.Form["procount"].ToString();returnResult = prostockid + "  " + procount;object obj = SqlComm.GetObjectByCondition("dbo.BioProStock", "isnull(ProCout,0)", " ID=" + prostockid);if (obj != null){if (int.Parse(obj.ToString()) < int.Parse(procount)){returnResult = "此产品此批次库存不足,最多发货数据" + obj.ToString();}else{returnResult = "OK";}}this.Response.Write(returnResult);this.Response.End();}

修改的前台代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SendGoodsEdit.aspx.cs"  Transaction="Required"   Inherits="BioErpWeb.SendGoods.SendGoodsEdit" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  charset="UTF-8"  "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/ERPBaseStyle.css" rel="stylesheet" type="text/css" />  <script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script><script src="../Scripts/jquery.validate.js" type="text/javascript"></script><link href="../Styles/SharpRound.css" rel="stylesheet" type="text/css" /><script src="../Scripts/validateExtender.js" type="text/javascript"></script><script src="../Scripts/ValidateMessage_ZW.js" type="text/javascript"></script>  <script src="../Scripts/jquery.metadata.js" type="text/javascript"></script><link href="../Styles/InputStyle1.css" rel="stylesheet" type="text/css" /><script src="../JS/CheckDepartMent.js" type="text/javascript"></script><script src="../Scripts/jquery-ui-1.7.custom.min.js" type="text/javascript"></script><link href="../Scripts/jquery-ui-1.7.custom.css" rel="stylesheet" type="text/css" /><script src="../JS/CheckUserName.js" type="text/javascript"></script><script src="../JS/CustomerName.js" type="text/javascript"></script> <script src="../JS/ProNameChoose.js" type="text/javascript"></script><script src="../Scripts/Comm.js" type="text/javascript"></script><script type="text/javascript">$(document).ready(function () {$("#form1").validate();var loginuserid=<%=Session["Userid"]%>;//判断当前登录用户是否是表单制表人本人if(loginuserid!=$("#hf_applayUserid").val()){$(document).find("input[type='text']").each(function(){if($(this).attr("id")!="txtRemark"){$(this).attr("readonly","true");}              });     $(document).find(".btnchoose").each(function(){$(this).hide();              });$(document).find("span[name='lbShow']").each(function(){$(this).append("暂无操作");});            }//下次审核人员需要设置可用$("#btnUser0").show();//是否具备财务审核权限var isisfinance= <%=isfinance %>;if(isisfinance==true){$("#trfinance").show();}//是否具备质量审核权限var isisquality= <%=isquality %>;if(isisquality==true){$("#spanquality").show();}//是否具备仓库审核条件var isstock1=<%=isstock %>if(isstock1==true){$("#spanstock").show();}else{$("#spanstock").hide();}//是否具备产品批号添加权限var isprobatch= <%=isprobatch %>;//判断当前用户是否具备产品批号添加权限,并且财务已经审核,并且产品质量已经审核//显示相应操作按钮if(isprobatch==true&&$("#cbisfinance").attr("checked")==true&&$("#cbquality").attr("checked")==true){//显示添加批号的按钮$(document).find("input[name='btnaddbatch']").each(function(){$(this).show();})//隐藏添加行的按钮$(document).find("input[name='btnaddrow']").each(function(){           $(this).hide();});//隐藏删除当前行的按按钮$(document).find("input[name='btndeleterow']").each(function(){$(this).hide();});}else{//隐藏添加批号的按钮$(document).find("input[name='btnaddbatch']").each(function(){$(this).hide();})//显示添加行的按钮$(document).find("input[name='btnaddrow']").each(function(){           $(this).show();});//显示删除当前行的按按钮$(document).find("input[name='btndeleterow']").each(function(){$(this).show();});}//如果已经添加产品批号,则此表单不能在进行添加产品数据,删除原来数据var count=<%=probaths %>if(count>0){//显示添加行的按钮$(document).find("input[name='btnaddrow']").each(function(){  $(this).hide();});//显示删除当前行的按按钮$(document).find("input[name='btndeleterow']").each(function(){$(this).hide();});}//如果库存审核已经通过,则所有选择按钮不可用if($("#cbISstock").attr("checked")==true){$(".btnchoose").each(function(){$(this).hide();});$("#trpostinfo").show();$(document).find("input[type='text']").each(function(){$(this).attr("readonly","true");});$(document).find("span[name='lbShow']").each(function(){$(this).append("暂无操作");});}});function addrow() {var tr = '<tr><td><input  type="text" name="proName" class="required" style=" width:200px"/><input type="hidden" name="proID" /><input value="选择" type="button" οnclick="showProName()" class="btnchoose"/></td><td><input  type="text" name="proCount" class="{required:true,min:1,digits:true}" style=" width:100px"/></td><td><input οnkeyup="setvalue(this)" οnchange="setvalue(this)"  type="text" name="proPrice" class="{required:true,min:0.1,number:true}" style=" width:100px"/></td><td><input  type="text" name="invoiceProPice" class="{required:true,min:0.1,number:true}" style=" width:100px"/></td><td  style="width:150px;"><input  type="button"  value="添加行" οnclick="addrow()" class="btnchoose"/> <input  type="button"  value="删除行" οnclick="deleterow()" class="btnchoose"/></td></tr>';var obj = window.event.srcElement;var parenttr = obj.parentNode.parentNode;$(parenttr).after(tr);}function deleterow() {if ($("input[name='proname']").length > 1) {var obj = window.event.srcElement;var parenttr = obj.parentNode.parentNode;$(parenttr).remove();}else{alert("至少要有一行数据");}}function deleterow1() {if ($("input[name='proname0']").length > 1) {var obj = window.event.srcElement;var parenttr = obj.parentNode.parentNode;$(parenttr).remove();}else{alert("至少要有一行数据");}}function setbatch() {var procount = 0;var boxnum = 1;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();}}})if(!isprocount){//2011年11月29日22:28:00//新添加一个控件<input type="hidden" name="PurchaseProID2"/>//去掉所有复合验证中的";"号var trbatch = '<tr> <td id="td2"><input id="txtProName0" name="proname0" value="' + inputs[0].value + '" readonly="readonly" name="txtProName0"  style="width: 200px" type="text" class="input" size="50" /><input type="hidden" name="proIds" value="' + inputs[1].value + '"/> </td>';trbatch += '<td><input id="txtProCount0" name="txtProCount0" οnkeyup="isProBathCountFull(this)"  class="{required:true,min:1,digits:true}" type="text" size="5" /><input type="hidden" name="oldprobatchcount" value="0"/></td><td><input id="txtProBatch0"  readonly="readonly" name="txtProBatch0" type="text" size="11" /> </td>';trbatch += '<td><input id="txtProBoxNum0" name="txtProBoxNum0" value="' + boxnum + '" readonly="readonly"  type="text" size="11" /> </td>';trbatch += '<td><input id="txtMarkDate0" name="txtMarkDate0"    size="11" class="{required:true,dateISO:true}"  type="text" readonly="readonly" /></td>';trbatch += '<td><input id="txtExPirationDate0" name="txtExPirationDate0"   class="{required:true,dateISO:true}"  size="11" type="text" readonly="readonly" />';trbatch += '</td> <td><input id="txtStockDate0" name="txtStockDate0"   class="{required:true,dateISO:true}"  size="11" type="text" readonly="readonly" /></td><td><input type="hidden" value="'+inputs[6].value+'" name="SendProID2"/><input type="button" class="btnchoose2" value="选择" οnclick="showProstock(this)" /><span>  </span> <input type="button" class="btnchoose2" value="删除" οnclick="deleterow1()"/><input id="Hidden2" name="stockproid" type="hidden" /><input id="Hidden2" name="stockid" type="hidden" /><input  name="ProBatchID" value="0" type="hidden" />';trbatch += '</td></tr>';$("#probatchtr").after(trbatch);}$(document).find("input[name='txtMarkDate0']").each(function(){$(this).datepicker({dateFormat:'yy-mm-dd'});});$(document).find("input[name='txtExPirationDate0']").each(function(){$(this).datepicker({dateFormat:'yy-mm-dd'});});}function showProstock(obj){var proid=  $($($($(obj).parent()).parent()).find("input[name='proIds']")[0]).val();var url='SendGoodsSelectProStock.aspx?proID='+proid;var winFeatures="dialogHeight:500px;dialogwidth:800px;depended=no;scroll:auto;center:yes;";var re= window.showModalDialog(url,null, winFeatures);if(re!=undefined){var stockproid=$($($(obj).parent()).parent()).find("input[name='stockproid']");stockproid[0].value=re[0];var txtProBatch0=$($($(obj).parent()).parent()).find("input[name='txtProBatch0']");txtProBatch0[0].value=re[1];      var txtProCount=$($($(obj).parent()).parent()).find("input[name='txtProCount0']");txtProCount[0].value=re[2];var txtExPirationDate=$($($(obj).parent()).parent()).find("input[name='txtExPirationDate0']");txtExPirationDate[0].value=re[3];var txtStockDate=$($($(obj).parent()).parent()).find("input[name='txtStockDate0']");txtStockDate[0].value=re[4];var txtMarkDate=$($($(obj).parent()).parent()).find("input[name='txtMarkDate0']");txtMarkDate[0].value=re[5];var  stockid=$($($(obj).parent()).parent()).find("input[name='stockid']");stockid[0].value=re[6];}}//判断产品数量是否满足需求function isProBathCountFull(obj) {//库存表编号(主键)var prostockid = $($(obj).parent().parent().find("input[name='stockproid']")[0]).val();var procount=$(obj).val();if (prostockid != '' && prostockid !=undefined) {if (procount != '' && procount !=undefined && procount != '0') {$.ajax({type: "POST", //设置提交方式url: "getProBatchCount.aspx",data: "prostockid=" + prostockid + "&procount=" + procount, //提交数据success: function (msg) {if (msg == "OK") {                               } else {alert(msg);$(obj).attr("value", "");}}});}} else {alert("请先选择产品");$(obj).attr("value", "");}}</script><style type="text/css">.trbar{ background-color:#eeeeee;}.w80{ width:80px;}.w100{ width:100px;}.w150{ width:150px;}.style1{width: 150px;}.style2{width: 85px;}.style3{width: 128px;}.style15{width: 235px;}.style20{width: 157px;}.style24{width: 304px;}.style29{width: 90px;}#trpostinfo{}#trpostinfo span{ margin:0px 20px;}</style></head>
<body><form id="form1" runat="server"><asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><div><table class="maintable Inupttable" style=" width:900px;"><tr><td colspan="8" class="titlebar">商品销售发货审核</td></tr><tr><td class="w80">申请部门</td><td class="style1"><asp:DropDownList ID="ddlDepartMent" runat="server"></asp:DropDownList></td><td class="style2" colspan="2">制表人<asp:Label ID="lbApplayUser" runat="server" ></asp:Label></td><td>经手人</td><td class="style15"><asp:TextBox ID="txtRealUserID" CssClass="{required:true,digits:true, min:1}" runat="server" Width="78px"></asp:TextBox><input id="btnUser"    type="button"  value="选择"  class="btnchoose"   οnclick="showDialog3()" /><asp:LabelID="lbRealUserName" runat="server" Text=""></asp:Label></td>  <td>制表时间</td><td><asp:Label ID="lbTime" runat="server" Text="Label"></asp:Label></td>          </tr></table><asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><table class="maintable Inupttable" style=" width:900px;"><tr><td class="w80">订货客户</td><td class="w150"><asp:TextBox ID="txtSendCom" runat="server" Width="59px" CssClass="{required:true,digits:true, min:1}" ontextchanged="txtSendCom_TextChanged"></asp:TextBox><asp:Button ID="Button1" Text="选择" runat="server"  UseSubmitBehavior="false"  class="btnchoose"   OnClientClick="showCustomerDialog3()"/><asp:Label ID="lbCustomer" runat="server" Text=""></asp:Label></td><td class="style20">发货单位</td><td class="style24"><asp:DropDownList ID="ddlOuserCom" runat="server"><asp:ListItem>上海某某公司</asp:ListItem><asp:ListItem>成都某某公司</asp:ListItem><asp:ListItem>北京某某公司</asp:ListItem><asp:ListItem>雅安某某公司</asp:ListItem></asp:DropDownList></td><td class="style29">发货类型</td><td><asp:DropDownList ID="ddlTypes" runat="server"><asp:ListItem>调拨</asp:ListItem><asp:ListItem>医院</asp:ListItem><asp:ListItem>OTC</asp:ListItem><asp:ListItem>其它</asp:ListItem></asp:DropDownList></td>          </tr><tr><td>客户联系人</td><td><asp:DropDownList ID="ddlLinkMan" runat="server" AutoPostBack="True"  Width="80px"onselectedindexchanged="ddlLinkMan_SelectedIndexChanged"><asp:ListItem Value="0">--请选择--</asp:ListItem></asp:DropDownList><asp:TextBox ID="txtLinkman" Width="60px" runat="server"></asp:TextBox></td><td class="style20">手机号码</td><td class="style24"><asp:TextBox ID="txtMobile" runat="server"></asp:TextBox></td><td class="style29">工作电话</td><td><asp:TextBox ID="txtTelphone" runat="server"></asp:TextBox></td>          </tr></table></ContentTemplate></asp:UpdatePanel><table class="maintable Inupttable" style="width: 900px;"><tr class="trbar"><td>产品名称及规格</td><td>数量</td><td>单价</td><td class="style3">开票价格</td><td  style="width:150px;">操作</td></tr><%if (!IsPostBack){int count = this.dt.Rows.Count;if (count == 0){return;}decimal totalprice = 0;decimal totalinvoiceprice = 0;for (int i = 0; i < count; i++){totalprice += (decimal.Parse(dt.Rows[i]["ProPrice"].ToString()) * int.Parse(dt.Rows[i]["ProCount"].ToString()));totalinvoiceprice += (decimal.Parse(dt.Rows[i]["invoiceProPice"].ToString()) * int.Parse(dt.Rows[i]["ProCount"].ToString()));%><tr><td><input type="text" name="proName" class="required" value="<%=dt.Rows[i]["ProName"] %>" style="width: 200px" /><inputtype="hidden" name="proID" value="<%=dt.Rows[i]["ProID"] %>" /><input value="选择" type="button" οnclick="showProName()"class="btnchoose" /></td><td><input type="text" name="proCount"  value="<%=dt.Rows[i]["ProCount"] %>" class="{required:true,min:1,digits:true}" style="width: 100px" /></td><td><input type="text" name="proPrice" οnkeyup="setvalue(this)"  value="<%=decimal.Parse(dt.Rows[i]["ProPrice"].ToString()).ToString("0.00") %>" οnchange="setvalue(this)"class="{required:true,min:0.1,number:true}" style="width: 100px" /></td><td><input type="text" name="invoiceProPice"  value="<%=decimal.Parse(dt.Rows[i]["invoiceProPice"].ToString()).ToString("0.00") %>" class="{required:true,min:0.1,number:true}"style="width: 100px" /></td><td  style="width:150px;"><input  type="hidden" name="SendproID" value="<%=dt.Rows[i]["SendProID"] %>" /><input name="btnaddrow" type="button" value="添加一行" style="font-size: 11px;" οnclick="addrow()" class="btnchoose" /><input name="btndeleterow"  type="button"  value="删除行" οnclick="deleterow()" class="btnchoose"/><input name="btnaddbatch"  type="button"  value="添加批号" οnclick="setbatch()" style=" display:none;" class="btnchoose"/><asp:Label  name="lbShow" runat="server" Text=""></asp:Label></td></tr><%}%><tr><td  colspan="5" class="bottomtd"><span>总金额:</span><span class="money"><%=totalprice.ToString("0.00")%></span>  <span>总开票金额:</span><span class="money"><%=totalinvoiceprice.ToString("0.00")%></span></td></tr><%}   %><tr id="trprobatch" style="display:none;"><td colspan="5"><div id="divprobatch"><table id="tb2" align="left" cellpadding="0" border="0" cellspacing="0" style=" width=99%;"><tr id="probatchtr" class="trbar"><td style="width: 200px;">订货产品名称及规格(只读)</td><td style="width: 70px;">数量</td><td style="width: 95px;">批号(只读)</td><td style="width: 95px;">货号(只读)</td><td style="width: 120px;">生产日期(只读)</td><td style="width: 120px;">有效期(只读)</td><td style="width: 120px;">入库日期(只读)</td><td style="width: 150px;">操作</td></tr><%if (!IsPostBack){int probathscount = this.probathsdt.Rows.Count;if (probathscount > 0){for (int i = 0; i < probathscount; i++){ %><tr><td id="td2"><input  name="proname0" value='<%=this.probathsdt.Rows[i]["ProName"] %>' readonly="readonly" style="width: 200px" type="text" class="input" size="50" /><input type="hidden" name="proIds" value='<%=this.probathsdt.Rows[i]["ProID"] %>' /></td><td><input name="txtProCount0"  class="{required:true,min:1,digits:true}"   οnkeyup="isProBathCountFull(this)"  type="text" size="5" value='<%=this.probathsdt.Rows[i]["proCount"] %>' /><input type="hidden" name="oldprobatchcount" value='<%=this.probathsdt.Rows[i]["proCount"] %>' /></td><td><input  name="txtProBatch0" type="text" readonly="readonly"  value='<%=this.probathsdt.Rows[i]["batchNum"] %>' size="11" /></td><td><input name="txtProBoxNum0" readonly="readonly" value='<%=this.probathsdt.Rows[i]["boxNum"] %>'type="text" size="11" /></td><td><input  name="txtMarkDate0" size="11" readonly="readonly" class="{required:true,dateISO:true}" value='<%=this.probathsdt.Rows[i]["makeDate"] %>'type="text"  /></td><td><input  name="txtExPirationDate0" readonly="readonly" value='<%=this.probathsdt.Rows[i]["expirationDate"] %>' class="{required:true,dateISO:true}"size="11" type="text" /></td><td><input  name="txtStockDate0"  class="{required:true,dateISO:true}" value='<%=this.probathsdt.Rows[i]["stockDate"] %>'size="11" type="text" readonly="readonly" /></td><td>暂无操作<input type="hidden" value='<%=this.probathsdt.Rows[i]["SendProID"] %>' name="SendProID2" /><span> </span><input name="stockproid" value='<%=this.probathsdt.Rows[i]["ProStockID"] %>' type="hidden" /><input  name="stockid" value='<%=this.probathsdt.Rows[i]["stockID"] %>' type="hidden" /><input  name="ProBatchID" value='<%=this.probathsdt.Rows[i]["ProBatchID"] %>' type="hidden" /></td></tr><%}}}%></table></div></td></tr><tr id="trfinance" style="display:none;"><td colspan="5"><asp:UpdatePanel ID="UpdatePanel2" runat="server"><ContentTemplate><span>财务审核:</span><span><asp:CheckBox ID="cbisfinance" runat="server"  Text="已付款" AutoPostBack="True" oncheckedchanged="cbisfinance_CheckedChanged"/>    <asp:LabelID="Label1" runat="server" Text="账单编号:"></asp:Label><asp:Label ID="lbBillNo" runat="server" Text="未生成"></asp:Label></span><span id="spanquality" style=" margin-left:100px; display:none;">质量审核:<span><asp:CheckBox ID="cbquality" runat="server"  Text="审核通过"/></span></span><span id="spanstock" style=" margin-left:100px;">仓库审核:<span><input type="checkbox" id="cbISstock" runat="server"   οnchange="{if(this.checked){$('#trpostinfo').show();}else{$('#trpostinfo').hide();}}" value="可以出库"/></span></span></ContentTemplate></asp:UpdatePanel></td></tr><tr id="trpostinfo" style="display:none;"><td colspan="5"><span>物流单位:<asp:TextBox ID="txtPostUnit" runat="server"></asp:TextBox></span><span>联系方式(电话):<asp:TextBox ID="txtPhone" runat="server"></asp:TextBox></span><span>物流方式:<asp:DropDownList ID="ddlPostWay" runat="server" Height="17px"><asp:ListItem>邮政EMS</asp:ListItem><asp:ListItem>申通快递</asp:ListItem><asp:ListItem Selected="True">自定义</asp:ListItem></asp:DropDownList><asp:TextBox ID="txtPostWay" runat="server"></asp:TextBox></span><span>备注:<asp:TextBox ID="txtpostRemark" runat="server"></asp:TextBox></span></td></tr></table><table class="maintable Inupttable" style=" width:900px;"><tr><td>历史审批意见:</td><td  colspan="3"><asp:Label ID="lbHistory" runat="server" Text=""></asp:Label></td></tr><tr><td>备注:</td><td><asp:TextBox ID="txtRemark"  runat="server"  Width="523px"></asp:TextBox></td>                        <td>下次审批人</td><td><asp:TextBox ID="txtNetUserId" CssClass="{required:true,digits:true, min:1}"runat="server" Width="70px"></asp:TextBox><input id="btnUser0"  type="button"  value="选择"  class="btnchoose"   οnclick="showDialog3()" /></td></tr><tr><td colspan="8" class="bottomtd">             <asp:HiddenField ID="hf_applayUserid" runat="server" /><asp:HiddenField ID="hf_subject" runat="server" /><asp:HiddenField ID="hf_FirstAccepter" runat="server" /><asp:HiddenField ID="hf_FirstTransmitter" runat="server" /><asp:Button ID="btnReject" runat="server" CssClass="btnorange" Text="拒绝审核" οnclick="btnReject_Click"  />         <asp:Button ID="btnRun" runat="server"  OnClientClick="{if(!$('#cbISstock').attr('checked')){alert('请先选择出库审核并填写相关数据后才能点击此按钮');return false;}}" UseSubmitBehavior="false" CssClass="btnorange" Text="执行发货" οnclick="btnRun_Click" />    <asp:Button ID="btnSubmit" runat="server" CssClass="btngreen" Text="提交审核" οnclick="btnSubmit_Click" />         </td></tr></table></div></form>
</body>
</html>

后台代码:

 public partial class SendGoodsEdit: BasePage{protected void Page_Load(object sender, EventArgs e){if (!IsPostBack){DepartMentBand();pageinfobind();}}public  DataTable dt;public DataTable probathsdt;string taskid = "8";string listid = "75";/// <summary>/// 是否具备财务权限,默认为Fasle/// </summary>public static  string isfinance = "false";public static string isquality = "false";public static string isprobatch = "false";public static string isstock = "false";public static int probaths = 0;/// <summary>/// 页面信息加载/// </summary>protected void pageinfobind(){//是否具有财务权限isfinance = SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains("," + ((int)RightEmun.finance).ToString() + ",") ? "true" : "false";//是否具备质量审核权限isquality = SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains("," + ((int)RightEmun.quality).ToString() + ",")?"true":"false";//是否具备添加产品批号的权限isprobatch= SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains("," + ((int)RightEmun.probatch).ToString() + ",") ? "true" : "false";//是否具备仓库审核权限isstock = SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains("," + ((int)RightEmun.stock).ToString() + ",") ? "true" : "false";BioSendGoodsBLL sendgoodsview = new BioSendGoodsBLL();ViewBioSendAppInfo viewsendinfo= sendgoodsview.GetModel(int.Parse(taskid));ddlDepartMent.SelectedValue= viewsendinfo.DepartMentID.ToString();this.lbApplayUser.Text = viewsendinfo.AppUserName;this.hf_applayUserid.Value = viewsendinfo.AppUserId.ToString();this.txtRealUserID.Text = viewsendinfo.RealUserID.ToString();this.lbRealUserName.Text = viewsendinfo.RealUser;this.lbTime.Text = Convert.ToDateTime(viewsendinfo.submitTime).ToString("yyyy-MM-dd");this.txtSendCom.Text = viewsendinfo.ReceiveComID.ToString();getLinkMan();this.ddlOuserCom.SelectedItem.Text = viewsendinfo.OurCom;this.ddlTypes.SelectedItem.Text = viewsendinfo.sendType;this.ddlLinkMan.SelectedValue = viewsendinfo.Receiver;this.txtTelphone.Text = viewsendinfo.telephone;this.txtMobile.Text = viewsendinfo.mobile;if (viewsendinfo.BillNo != null && viewsendinfo.BillNo != ""){this.lbBillNo.Text = viewsendinfo.BillNo;this.cbisfinance.Checked = true;if (bool.Parse(isfinance)){this.cbisfinance.Enabled = false;}}if (viewsendinfo.QualityUserid != null && viewsendinfo.QualityUserid != 0 && viewsendinfo.isQualityCheck != false){this.cbquality.Checked = true;this.cbquality.Enabled = false;}//是否仓库审核if (viewsendinfo.isOutStockCheck == true){this.cbISstock.Checked = true;this.cbISstock.Disabled = true;this.txtPostUnit.Text = viewsendinfo.postUnit.ToString();this.txtPhone.Text = viewsendinfo.postPhone.ToString();this.txtPostWay.Text = viewsendinfo.postWay;this.ddlPostWay.SelectedValue = viewsendinfo.postWay;this.txtpostRemark.Text = viewsendinfo.postRemak;//ScriptManager.RegisterStartupScript(this,this.GetType(), "trpostinfoshow", "$('#trpostinfo').show()", true);}//if (this.cbisfinance.Checked == true && this.cbquality.Checked == true && bool.Parse(isprobatch))//{//    ClientScript.RegisterStartupScript(this.GetType(), "test", "showobjbyName('btnaddbatch')", true);//}dt=SqlComm.GetDataByCondition("dbo.BioSendGoodsPro", "*,ProName=dbo.FN_getProNameByProID(ProID)", " SendID=" + taskid).Tables[0];probathsdt= SqlComm.GetDataByCondition("dbo.ViewSendProBaths", "*,ProName=dbo.FN_getProNameByProID(ProID)", " SendID=" + taskid).Tables[0];probaths = probathsdt.Rows.Count;if (probathsdt.Rows.Count > 0){ClientScript.RegisterStartupScript(this.GetType(), "showprobatchs", "$('#trprobatch').show()", true);}//加载历史审批记录this.lbHistory.Text=  SqlComm.getTaskListRecordsMindsByCondition(taskid, ((int)TaskNavigateEmun.ProSend).ToString());this.hf_subject.Value = SqlComm.getTaskListSubjectByCondition(listid);this.hf_FirstTransmitter.Value = SqlComm.getFirstTransmitterByCondition(listid);this.hf_FirstAccepter.Value = SqlComm.getFirstAccpterByCondition(listid);//string rights=     SqlComm.getUserRightsByUserId(Session["Userid"].ToString());//判断是否具有财务权限和部门经理角色,如果是,则显示“拒绝审核按钮”,否则不显示if ((Web.UserLogin.user.RoleId == 3 && Web.UserLogin.user.DepartmentId == int.Parse(this.ddlDepartMent.SelectedValue.ToString())) || bool.Parse(isfinance)){this.btnReject.Visible = true;}else{this.btnReject.Visible = false;}}/// <summary>/// 绑定部门信息/// </summary>private void DepartMentBand(){ddlDepartMent.DataSource = SqlComm.getDepartMent();ddlDepartMent.DataTextField = "DepartmentName";ddlDepartMent.DataValueField = "DepartmentId";ddlDepartMent.DataBind();//ddlDepartMent.Items.Add(new ListItem("--请选择部门--", "0"));//ddlDepartMent.SelectedValue = "0";}protected void btnSubmit_Click(object sender, EventArgs e){//部门经理角色 并且当前用户所属部门为表单所选部门try{//判断是否具备财务权限 并且当前财务审核通过if (bool.Parse(isfinance) && this.cbisfinance.Checked == true){SqlComm.UpdateTableByCondition("dbo.BioSendAppInfo", "BillNo='" + this.lbBillNo.Text + "',BillUserID='" + Session["Userid"] + "'", " SendId=" + taskid);}//判断是否具备质量申请权限,并且当前的财务审核通过之后才能提交质量审核if (bool.Parse(isquality) && this.cbisfinance.Checked == true && this.cbquality.Checked == true){SqlComm.UpdateTableByCondition("dbo.BioSendAppInfo", "QualityUserid='" + Session["Userid"].ToString() + "',isQualityCheck=" + 1, " SendId=" + taskid);}if (this.cbisfinance.Checked == true && this.cbquality.Checked == true && bool.Parse(isprobatch)==true){string proname = Request["proname0"].ToString();string proId = Request["proIds"].ToString();string txtProCount = Request["txtProCount0"].ToString();string txtProBatch=Request["txtProBatch0"].ToString();string txtProBoxNum = Request["txtProBoxNum0"].ToString();string txtMarkDate = Request["txtMarkDate0"].ToString();string txtExPirationDate = Request["txtExPirationDate0"].ToString();string SendProID = Request["SendProID2"].ToString();string stockproid = Request["stockproid"].ToString();string stockDate = Request["txtStockDate0"].ToString();string stockid = Request["stockid"].ToString();//默认产品批次,如果为新添加产品批次则初始值为0,如果是修改数据则为数据库中绑定的产品批次数据string oldprobatchcount = Request["oldprobatchcount"].ToString();string ProBatchID=Request["ProBatchID"].ToString();//string[] pronamess = proname.Split(',');//string[] proIdss = proId.Split(',');string[] txtProCounts = txtProCount.Split(',');string[] txtProBatchs=txtProBatch.Split(',');string[] txtProBoxNums = txtProBoxNum.Split(',');string[] txtMarkDates = txtMarkDate.Split(',');string[] txtExPirationDates = txtExPirationDate.Split(',');string[] SendProIDs = SendProID.Split(',');string[] stockproids = stockproid.Split(',');string[] stockDates = stockDate.Split(',');string[] stockids = stockid.Split(',');string[] oldprobatchcounts = oldprobatchcount.Split(',');string []ProBatchIDs=ProBatchID.Split(',');BioSendProBatch probacth = new BioSendProBatch();BioSendGoodsBLL sendbll = new BioSendGoodsBLL();for (int i = 0; i < SendProIDs.Length; i++){//probacth.ProStockIDprobacth.SendProID = int.Parse(SendProIDs[i]);//1:old 10 new 8 2:old 10 new 12probacth.proCount = int.Parse(txtProCounts[i]);probacth.ProStockID = int.Parse(stockproids[i]);probacth.stockDate = DateTime.Parse(stockDates[i]);probacth.stockID = int.Parse(stockids[i]);probacth.batchNum = txtProBatchs[i];probacth.boxNum = txtProBoxNums[i];probacth.makeDate = DateTime.Parse(txtMarkDates[i]);probacth.expirationDate = DateTime.Parse(txtExPirationDates[i]);if (oldprobatchcounts[i] == "0"){   //添加产品批次sendbll.BioSendProBatchADD(probacth);//修改产品库存数据(出库)SqlComm.BioProStockUpdateCount(int.Parse(probacth.ProStockID.ToString()), int.Parse(probacth.proCount.ToString()));}else{if (oldprobatchcounts[i] != txtProCounts[i]){//修改当前批次表中相应产品数据SqlComm.UpdateTableByCondition("dbo.BioSendProBatch", "proCount=" + int.Parse(txtProCounts[i]), "ProBatchID=" + ProBatchIDs[i]);int batchcount = int.Parse(txtProCounts[i]) - int.Parse(oldprobatchcounts[i]);//修改产品库存表中对应批次的数据SqlComm.UpdateTableByCondition("dbo.BioProStock", "ProCout=(ProCout-(" + batchcount + "))", "ID=" + stockproids[i]);}}}}TaskListInsert();   ContextUtil.SetComplete();}catch (Exception ex){ContextUtil.SetAbort();ClientScript.RegisterStartupScript(this.GetType(),"test","alert('提交失败,数据回滚')",true);}}/// <summary>/// 添加新的流行表数据并修改之前的数据/// </summary>private void TaskListInsert(){TaskListRecord tasklistRecord = new TaskListRecord(){Subject = this.hf_subject.Value,Accepter = int.Parse(txtNetUserId.Text),AuditingSate = 0,DepartMentId = int.Parse(this.ddlDepartMent.SelectedValue.ToString()),FirstAccepter = int.Parse(hf_FirstAccepter.Value),FirstSumitTime = Convert.ToDateTime(this.lbTime.Text),FirstTransmitter = int.Parse(hf_FirstTransmitter.Value),Mind = this.txtRemark.Text,Pass = 1,SumitTime = DateTime.Now,TaskID = int.Parse(taskid),TaskTableID = (int)TaskNavigateEmun.ProSend,Transmitter = int.Parse(Session["Userid"].ToString())};SqlComm.TaskListRecordAdd(tasklistRecord);SqlComm.UpdateTableByCondition("dbo.TaskListRecord", " AuditingSate=1", " ListID=" + listid);}static DataSet ds;protected void txtSendCom_TextChanged(object sender, EventArgs e){getLinkMan();}private void getLinkMan(){ds = null;this.txtTelphone.Text = "";this.txtMobile.Text = "";this.txtLinkman.Text = "";if (this.txtSendCom.Text.Trim() != "" && this.txtSendCom.Text.Trim() != "请选择"){ds = SqlComm.GetDataByCondition("BioCrmLinkmanInfo", "LinkmanID,LinkmanName,WorkPhone,Mobile", " CustomerID=" + this.txtSendCom.Text);this.ddlLinkMan.DataSource = ds.Tables[0];this.ddlLinkMan.DataTextField = "LinkmanName";this.ddlLinkMan.DataValueField = "LinkmanID";this.ddlLinkMan.DataBind();if (ds.Tables[0].Rows.Count == 0){this.ddlLinkMan.Visible = false;}else{this.ddlLinkMan.Visible = true;DataTable dt = ds.Tables[0];DataRow[] dr = dt.Select("LinkmanID=" + this.ddlLinkMan.SelectedValue.ToString());this.txtTelphone.Text = dr[0]["WorkPhone"].ToString();this.txtMobile.Text = dr[0]["Mobile"].ToString();this.txtLinkman.Text = this.ddlLinkMan.SelectedValue.ToString();}}}protected void ddlLinkMan_SelectedIndexChanged(object sender, EventArgs e){if (ds.Tables[0].Rows.Count > 0){DataTable dt = ds.Tables[0];DataRow[] dr=dt.Select("LinkmanID=" + this.ddlLinkMan.SelectedValue.ToString());this.txtTelphone.Text= dr[0]["WorkPhone"].ToString();this.txtMobile.Text = dr[0]["Mobile"].ToString();this.txtLinkman.Text = this.ddlLinkMan.SelectedValue.ToString();}}/// <summary>/// 拒绝审核/// </summary>/// <param name="sender"></param>/// <param name="e"></param>protected void btnReject_Click(object sender, EventArgs e){TaskListRecord tasklistRecord = new TaskListRecord(){Subject = this.hf_subject.Value,Accepter = int.Parse(this.hf_FirstTransmitter.Value),AuditingSate = 0,DepartMentId = int.Parse(this.ddlDepartMent.SelectedValue.ToString()),FirstAccepter = int.Parse(hf_FirstAccepter.Value),FirstSumitTime = Convert.ToDateTime(this.lbTime.Text),FirstTransmitter = int.Parse(hf_FirstTransmitter.Value),Mind = this.txtRemark.Text,Pass = 1,SumitTime = DateTime.Now,TaskID = int.Parse(taskid),TaskTableID = (int)TaskNavigateEmun.ProSend,Transmitter = int.Parse(Session["Userid"].ToString())};SqlComm.TaskListRecordAdd(tasklistRecord);SqlComm.UpdateTableByCondition("dbo.TaskListRecord", " AuditingSate=1", " ListID=" + listid);}protected void cbisfinance_CheckedChanged(object sender, EventArgs e){if (this.cbisfinance.Checked){this.lbBillNo.Text = SqlComm.SPGetBillNo(taskid);}else{this.lbBillNo.Text = "未生成";}if(bool.Parse(isquality)){ScriptManager.RegisterStartupScript(this, this.GetType(), "test", "$('#spanquality').show();", true);}}protected void btnRun_Click(object sender, EventArgs e){try{if (this.cbISstock.Checked == false){ClientScript.RegisterStartupScript(this.GetType(), "test", "alert('如果没有选择出库审核,则不能发货执行')", true);return;}string postway = "";if (this.ddlPostWay.SelectedItem.Text == "自定义"){postway = this.txtPostWay.Text;}else{postway = this.ddlPostWay.SelectedItem.Text;}bool isok= SqlComm.UpdateTableByCondition("BioSendAppInfo", "Stockuserid='" + Session["Userid"] + "',isOutStockCheck=1,postUnit='" + this.txtPostUnit.Text + "',postPhone='" + this.txtPhone.Text + "',postWay='" + postway + "',postRemak='" + this.txtpostRemark.Text + "',isSend=1", "SendId=" + taskid);TaskListRecord tasklistRecord = new TaskListRecord(){Subject = this.hf_subject.Value,Accepter = int.Parse(hf_FirstTransmitter.Value),AuditingSate = 2,DepartMentId = int.Parse(this.ddlDepartMent.SelectedValue.ToString()),FirstAccepter = int.Parse(hf_FirstAccepter.Value),FirstSumitTime = Convert.ToDateTime(this.lbTime.Text),FirstTransmitter = int.Parse(hf_FirstTransmitter.Value),Mind = this.txtRemark.Text,Pass = 1,SumitTime = DateTime.Now,TaskID = int.Parse(taskid),TaskTableID = (int)TaskNavigateEmun.ProSend,Transmitter = int.Parse(Session["Userid"].ToString())};if (isok){SqlComm.TaskListRecordAdd(tasklistRecord);SqlComm.UpdateTableByCondition("dbo.TaskListRecord", " AuditingSate=1", " ListID=" + listid);}else{ //提示错误信息}ContextUtil.SetComplete();//提交事务}catch (Exception ex){ContextUtil.SetAbort();//撤销事务}}}

详细页面:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SendGoodsShow.aspx.cs"  Transaction="Required"   Inherits="BioErpWeb.SendGoods.SendGoodsShow" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  charset="UTF-8"  "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/ERPBaseStyle.css" rel="stylesheet" type="text/css" />  <script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script><script src="../Scripts/jquery.validate.js" type="text/javascript"></script>    <link href="../Styles/InputStyle1.css" rel="stylesheet" type="text/css" /><script type="text/javascript">$(document).ready(function () {$("#form1").validate();});</script><style type="text/css">.trbar{ background-color:#eeeeee;}.w80{ width:80px;}.w100{ width:100px;}.w150{ width:150px;}.style1{width: 150px;}.style2{width: 85px;}.style3{width: 128px;}.style15{width: 235px;}.style20{width: 157px;}.style24{width: 304px;}.style29{width: 90px;}#trpostinfo{}#trpostinfo span{ margin:0px 20px;}.style30{width: 283px;}.style31{width: 285px;}</style></head>
<body><form id="form1" runat="server"><asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><div><table class="maintable Inupttable" style=" width:900px;"><tr><td colspan="8" class="titlebar">商品销售发货审核</td></tr><tr><td class="w80">申请部门</td><td class="style1"><asp:Label ID="ddlDepartMent" runat="server" Text=""></asp:Label></td><td class="style2" colspan="2">制表人<asp:Label ID="lbApplayUser" runat="server" ></asp:Label></td><td>经手人</td><td class="style15"><asp:TextBox ID="txtRealUserID" CssClass="{required:true,digits:true, min:1}" runat="server" Width="78px"></asp:TextBox><asp:LabelID="lbRealUserName" runat="server" Text=""></asp:Label></td>  <td>制表时间</td><td><asp:Label ID="lbTime" runat="server" Text="Label"></asp:Label></td>          </tr></table><asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><table class="maintable Inupttable" style=" width:900px;"><tr><td class="w80">订货客户</td><td class="w150"><asp:TextBox ID="txtSendCom" runat="server" Width="59px" CssClass="{required:true,digits:true, min:1}" ontextchanged="txtSendCom_TextChanged"></asp:TextBox><asp:Label ID="lbCustomer" runat="server" Text=""></asp:Label></td><td class="style20">发货单位</td><td class="style24"><asp:DropDownList ID="ddlOuserCom" runat="server"><asp:ListItem>上海某某公司</asp:ListItem><asp:ListItem>成都某某公司</asp:ListItem><asp:ListItem>北京某某公司</asp:ListItem><asp:ListItem>雅安某某公司</asp:ListItem></asp:DropDownList></td><td class="style29">发货类型</td><td><asp:DropDownList ID="ddlTypes" runat="server"><asp:ListItem>调拨</asp:ListItem><asp:ListItem>医院</asp:ListItem><asp:ListItem>OTC</asp:ListItem><asp:ListItem>其它</asp:ListItem></asp:DropDownList></td>          </tr><tr><td>客户联系人</td><td><asp:DropDownList ID="ddlLinkMan" runat="server" AutoPostBack="True"  Width="80px"onselectedindexchanged="ddlLinkMan_SelectedIndexChanged"><asp:ListItem Value="0">--请选择--</asp:ListItem></asp:DropDownList><asp:TextBox ID="txtLinkman" Width="60px" runat="server"></asp:TextBox></td><td class="style20">手机号码</td><td class="style24"><asp:TextBox ID="txtMobile" runat="server"></asp:TextBox></td><td class="style29">工作电话</td><td><asp:TextBox ID="txtTelphone" runat="server"></asp:TextBox></td>          </tr></table></ContentTemplate></asp:UpdatePanel><table class="maintable Inupttable" style="width: 900px;"><tr class="trbar"><td class="style31">产品名称及规格</td><td>数量</td><td>单价</td><td class="style3">开票价格</td></tr><%if (!IsPostBack){int count = this.dt.Rows.Count;if (count == 0){return;}decimal totalprice = 0;decimal totalinvoiceprice = 0;for (int i = 0; i < count; i++){totalprice += (decimal.Parse(dt.Rows[i]["ProPrice"].ToString()) * int.Parse(dt.Rows[i]["ProCount"].ToString()));totalinvoiceprice += (decimal.Parse(dt.Rows[i]["invoiceProPice"].ToString()) * int.Parse(dt.Rows[i]["ProCount"].ToString()));%><tr><td class="style31"><input type="text" name="proName" class="required" value="<%=dt.Rows[i]["ProName"] %>" style="width: 200px" /><inputtype="hidden" name="proID" value="<%=dt.Rows[i]["ProID"] %>" /></td><td><input type="text" name="proCount"  value="<%=dt.Rows[i]["ProCount"] %>" class="{required:true,min:1,digits:true}" style="width: 100px" /></td><td><input type="text" name="proPrice" οnkeyup="setvalue(this)"  value="<%=decimal.Parse(dt.Rows[i]["ProPrice"].ToString()).ToString("0.00") %>" οnchange="setvalue(this)"class="{required:true,min:0.1,number:true}" style="width: 100px" /></td><td><input type="text" name="invoiceProPice"  value="<%=decimal.Parse(dt.Rows[i]["invoiceProPice"].ToString()).ToString("0.00") %>" class="{required:true,min:0.1,number:true}"style="width: 100px" /></td></tr><%}%><tr><td  colspan="5" class="bottomtd"><span>总金额:</span><span class="money"><%=totalprice.ToString("0.00")%></span>  <span>总开票金额:</span><span class="money"><%=totalinvoiceprice.ToString("0.00")%></span></td></tr><%}   %><tr id="trprobatch" style="display:none;"><td colspan="5"><div id="divprobatch"><table id="tb2" align="left" cellpadding="0" border="0" cellspacing="0" style=" width=99%;"><tr id="probatchtr" class="trbar"><td style="width: 300px;">订货产品名称及规格(只读)</td><td style="width: 70px;">数量</td><td style="width: 95px;">批号(只读)</td><td style="width: 95px;">货号(只读)</td><td style="width: 120px;">生产日期(只读)</td><td style="width: 120px;">有效期(只读)</td><td style="width: 120px;">入库日期(只读)</td></tr><%if (!IsPostBack){int probathscount = this.probathsdt.Rows.Count;if (probathscount > 0){for (int i = 0; i < probathscount; i++){ %><tr><td id="td2"><input  name="proname0" value='<%=this.probathsdt.Rows[i]["ProName"] %>' readonly="readonly" style="width: 200px" type="text" class="input" size="50" /><input type="hidden" name="proIds" value='<%=this.probathsdt.Rows[i]["ProID"] %>' /></td><td><input name="txtProCount0"  class="{required:true,min:1,digits:true}"   οnkeyup="isProBathCountFull(this)"  type="text" size="5" value='<%=this.probathsdt.Rows[i]["proCount"] %>' /><input type="hidden" name="oldprobatchcount" value='<%=this.probathsdt.Rows[i]["proCount"] %>' /></td><td><input  name="txtProBatch0" type="text" readonly="readonly"  value='<%=this.probathsdt.Rows[i]["batchNum"] %>' size="11" /></td><td><input name="txtProBoxNum0" readonly="readonly" value='<%=this.probathsdt.Rows[i]["boxNum"] %>'type="text" size="11" /></td><td><input  name="txtMarkDate0" size="11" readonly="readonly" class="{required:true,dateISO:true}" value='<%=this.probathsdt.Rows[i]["makeDate"] %>'type="text"  /></td><td><input  name="txtExPirationDate0" readonly="readonly" value='<%=this.probathsdt.Rows[i]["expirationDate"] %>' class="{required:true,dateISO:true}"size="11" type="text" /></td><td><input  name="txtStockDate0"  class="{required:true,dateISO:true}" value='<%=this.probathsdt.Rows[i]["stockDate"] %>'size="11" type="text" readonly="readonly" /></td></tr><%}}}%></table></div></td></tr><tr id="trfinance" style="display:none;"><td colspan="5"><asp:UpdatePanel ID="UpdatePanel2" runat="server"><ContentTemplate><span>财务审核:</span><span><asp:CheckBox ID="cbisfinance" runat="server"  Text="已付款" AutoPostBack="True" oncheckedchanged="cbisfinance_CheckedChanged"/>    <asp:LabelID="Label1" runat="server" Text="账单编号:"></asp:Label><asp:Label ID="lbBillNo" runat="server" Text="未生成"></asp:Label></span><span id="spanquality" style=" margin-left:100px; display:none;">质量审核:<span><asp:CheckBox ID="cbquality" runat="server"  Text="审核通过"/></span></span><span id="spanstock" style=" margin-left:100px;">仓库审核:<span><input type="checkbox" id="cbISstock" runat="server"  οnchange="{if(this.checked){$('#trpostinfo').show();}else{$('#trpostinfo').hide();}}" value="可以出库"/></span></span></ContentTemplate></asp:UpdatePanel></td></tr><tr id="trpostinfo" style="display:none;"><td colspan="5"><span>物流单位:<asp:TextBox ID="txtPostUnit" runat="server"></asp:TextBox></span><span>联系方式(电话):<asp:TextBox ID="txtPhone" runat="server"></asp:TextBox></span><span>物流方式:<asp:DropDownList ID="ddlPostWay" runat="server" Height="17px"><asp:ListItem>邮政EMS</asp:ListItem><asp:ListItem>申通快递</asp:ListItem><asp:ListItem Selected="True">自定义</asp:ListItem></asp:DropDownList><asp:TextBox ID="txtPostWay" runat="server"></asp:TextBox></span><span>备注:<asp:TextBox ID="txtpostRemark" runat="server"></asp:TextBox></span></td></tr></table><table class="maintable Inupttable" style=" width:900px;"><tr><td class="style30">历史审批意见:</td><td><asp:Label ID="lbHistory" runat="server" Text=""></asp:Label></td></tr></table></div></form>
</body>
</html>

后台代码:

public partial class SendGoodsShow : BasePage{protected void Page_Load(object sender, EventArgs e){if (!IsPostBack){pageinfobind();}}public  DataTable dt;public DataTable probathsdt;string taskid = "8";string listid = "75";/// <summary>/// 是否具备财务权限,默认为Fasle/// </summary>public static  string isfinance = "false";public static string isquality = "false";public static string isprobatch = "false";public static string isstock = "false";public static int probaths = 0;/// <summary>/// 页面信息加载/// </summary>protected void pageinfobind(){//是否具有财务权限isfinance = SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains("," + ((int)RightEmun.finance).ToString() + ",") ? "true" : "false";//是否具备质量审核权限isquality = SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains("," + ((int)RightEmun.quality).ToString() + ",")?"true":"false";//是否具备添加产品批号的权限isprobatch= SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains("," + ((int)RightEmun.probatch).ToString() + ",") ? "true" : "false";//是否具备仓库审核权限isstock = SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains("," + ((int)RightEmun.stock).ToString() + ",") ? "true" : "false";BioSendGoodsBLL sendgoodsview = new BioSendGoodsBLL();ViewBioSendAppInfo viewsendinfo= sendgoodsview.GetModel(int.Parse(taskid));ddlDepartMent.Text= viewsendinfo.Departname.ToString();this.lbApplayUser.Text = viewsendinfo.AppUserName;this.txtRealUserID.Text = viewsendinfo.RealUserID.ToString();this.lbRealUserName.Text = viewsendinfo.RealUser;this.lbTime.Text = Convert.ToDateTime(viewsendinfo.submitTime).ToString("yyyy-MM-dd");this.txtSendCom.Text = viewsendinfo.ReceiveComID.ToString();getLinkMan();this.ddlOuserCom.SelectedItem.Text = viewsendinfo.OurCom;this.ddlTypes.SelectedItem.Text = viewsendinfo.sendType;this.ddlLinkMan.SelectedValue = viewsendinfo.Receiver;this.txtTelphone.Text = viewsendinfo.telephone;this.txtMobile.Text = viewsendinfo.mobile;if (viewsendinfo.BillNo != null && viewsendinfo.BillNo != ""){this.lbBillNo.Text = viewsendinfo.BillNo;this.cbisfinance.Checked = true;if (bool.Parse(isfinance)){this.cbisfinance.Enabled = false;}}if (viewsendinfo.QualityUserid != null && viewsendinfo.QualityUserid != 0 && viewsendinfo.isQualityCheck != false){this.cbquality.Checked = true;this.cbquality.Enabled = false;}//if (this.cbisfinance.Checked == true && this.cbquality.Checked == true && bool.Parse(isprobatch))//{//    ClientScript.RegisterStartupScript(this.GetType(), "test", "showobjbyName('btnaddbatch')", true);//}dt=SqlComm.GetDataByCondition("dbo.BioSendGoodsPro", "*,ProName=dbo.FN_getProNameByProID(ProID)", " SendID=" + taskid).Tables[0];probathsdt= SqlComm.GetDataByCondition("dbo.ViewSendProBaths", "*,ProName=dbo.FN_getProNameByProID(ProID)", " SendID=" + taskid).Tables[0];probaths = probathsdt.Rows.Count;if (probathsdt.Rows.Count > 0){ClientScript.RegisterStartupScript(this.GetType(), "showprobatchs", "$('#trprobatch').show()", true);}//加载历史审批记录this.lbHistory.Text=  SqlComm.getTaskListRecordsMindsByCondition(taskid, ((int)TaskNavigateEmun.ProSend).ToString());//string rights=     SqlComm.getUserRightsByUserId(Session["Userid"].ToString());}static DataSet ds;protected void txtSendCom_TextChanged(object sender, EventArgs e){getLinkMan();}private void getLinkMan(){ds = null;this.txtTelphone.Text = "";this.txtMobile.Text = "";this.txtLinkman.Text = "";if (this.txtSendCom.Text.Trim() != "" && this.txtSendCom.Text.Trim() != "请选择"){ds = SqlComm.GetDataByCondition("BioCrmLinkmanInfo", "LinkmanID,LinkmanName,WorkPhone,Mobile", " CustomerID=" + this.txtSendCom.Text);this.ddlLinkMan.DataSource = ds.Tables[0];this.ddlLinkMan.DataTextField = "LinkmanName";this.ddlLinkMan.DataValueField = "LinkmanID";this.ddlLinkMan.DataBind();if (ds.Tables[0].Rows.Count == 0){this.ddlLinkMan.Visible = false;}else{this.ddlLinkMan.Visible = true;DataTable dt = ds.Tables[0];DataRow[] dr = dt.Select("LinkmanID=" + this.ddlLinkMan.SelectedValue.ToString());this.txtTelphone.Text = dr[0]["WorkPhone"].ToString();this.txtMobile.Text = dr[0]["Mobile"].ToString();this.txtLinkman.Text = this.ddlLinkMan.SelectedValue.ToString();}}}protected void ddlLinkMan_SelectedIndexChanged(object sender, EventArgs e){if (ds.Tables[0].Rows.Count > 0){DataTable dt = ds.Tables[0];DataRow[] dr=dt.Select("LinkmanID=" + this.ddlLinkMan.SelectedValue.ToString());this.txtTelphone.Text= dr[0]["WorkPhone"].ToString();this.txtMobile.Text = dr[0]["Mobile"].ToString();this.txtLinkman.Text = this.ddlLinkMan.SelectedValue.ToString();}}protected void cbisfinance_CheckedChanged(object sender, EventArgs e){if (this.cbisfinance.Checked){this.lbBillNo.Text = SqlComm.SPGetBillNo(taskid);}else{this.lbBillNo.Text = "未生成";}if(bool.Parse(isquality)){ScriptManager.RegisterStartupScript(this, this.GetType(), "test", "$('#spanquality').show();", true);}}}
}

转载于:https://www.cnblogs.com/sunliyuan/p/7668731.html

ERP发货系统的修改(四十三)相关推荐

  1. 【正点原子MP157连载】第四十三章 外置RTC芯片PCF8563实验-摘自【正点原子】STM32MP1嵌入式Linux驱动开发指南V1.7

    1)实验平台:正点原子STM32MP157开发板 2)购买链接:https://item.taobao.com/item.htm?&id=629270721801 3)全套实验源码+手册+视频 ...

  2. 【Visual C++】游戏开发笔记四十三 浅墨DirectX教程十一 为三维世界添彩:纹理映射技术(二)...

    本系列文章由zhmxy555(毛星云)编写,转载请注明出处. 作者:毛星云(浅墨)    邮箱: happylifemxy@163.com 本篇文章里,我们首先对Direct3D之中固定功能流水线中的 ...

  3. 【正点原子FPGA连载】第四十三章MT9V034摄像头RGB-LCD显示实验 -摘自【正点原子】新起点之FPGA开发指南_V2.1

    1)实验平台:正点原子新起点V2开发板 2)平台购买地址:https://detail.tmall.com/item.htm?id=609758951113 2)全套实验源码+手册+视频下载地址:ht ...

  4. 【正点原子Linux连载】第四十三章 Linux设备树 -摘自【正点原子】I.MX6U嵌入式Linux驱动开发指南V1.0

    1)实验平台:正点原子阿尔法Linux开发板 2)平台购买地址:https://item.taobao.com/item.htm?id=603672744434 2)全套实验源码+手册+视频下载地址: ...

  5. IOS音视频(四十三)AVFoundation 之 Audio Session

    IOS音视频(四十三)AVFoundation 之 Audio Session 1.音频会话概述 2. 配置音频会话 2.1 音频会话默认行为 2.2 配置音频会话 2.3 使用多路由类别扩展选项 2 ...

  6. 【Visual C++】游戏开发笔记四十三 浅墨DirectX教程十一 为三维世界添彩 纹理映射技术 二

    分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow 也欢迎大家转载本篇文章.分享知识,造福人民,实现我们中华民族伟大复兴! 本系列文 ...

  7. 2021年春季学期-信号与系统-第十四次作业参考答案

    ▓ 第十四次作业各小题参考答案: 2021年春季学期-信号与系统-第十四次作业参考答案-第一小题参考答案 2021年春季学期-信号与系统-第十四次作业参考答案-第二小题参考答案 2021年春季学期-信 ...

  8. OpenCV学习笔记(四十一)——再看基础数据结构core OpenCV学习笔记(四十二)——Mat数据操作之普通青年、文艺青年、暴力青年 OpenCV学习笔记(四十三)——存取像素值操作汇总co

    OpenCV学习笔记(四十一)--再看基础数据结构core 记得我在OpenCV学习笔记(四)--新版本的数据结构core里面讲过新版本的数据结构了,可是我再看这部分的时候,我发现我当时实在是看得太马 ...

  9. 第四十三篇 面向对象进阶2

    目录 第四十三篇 面向对象进阶2 一.类的封装 1.封装分为两个层面 2.应用 二.类的property特性 1. BMI(Body Mass Index):身体体质指数 2.装饰器用法(只在Pyth ...

最新文章

  1. android eclipse 报error loading /system/media/audio/ xxx 错的解决办法。
  2. android6.0源码分析之Camera API2.0下的Capture流程分析
  3. Java多线程例子讲解
  4. 码牛安卓移动互联网高级开发正式课
  5. k8s的pod资源管理与配置使用凭证的harbor仓库
  6. python基础===八大排序算法的 Python 实现
  7. 边缘计算和网络切片,为何成为5G的“技术网红”
  8. php查找顶级分类,php 无限级分类 获取顶级分类ID,php顶级_PHP教程
  9. vue 监听渲染变化
  10. encodeURIComponent与encodeURI的区别
  11. 作为window对象属性的元素 多窗口和窗体
  12. SIGIR2021@Elliot | 一个全新且全面的推荐系统Benchmark
  13. 随机获取数据库的数据
  14. UVa10047 BFS
  15. [redis]redis五种数据类型和应用场景
  16. 微信公众号如何绑定运营者的微信号
  17. 身体健康才是福报!41岁蚂蚁金服总裁助理毛军华因病去世
  18. zookeeper系列(二)实战master选举 1
  19. elk替代_记一次关于elk收集的日志中把手机号码用***代替遇到的问题以及解决
  20. Unity动画☀️四、动画导入的三种模式:Legacy、Generic 与 Humanoid

热门文章

  1. 关于Linux的rear命令
  2. 如何将linux编译过程中的警告及错误信息输出到文件中
  3. vs2010学习版loadimage();函数载入图片无法加载的问题
  4. pro、pre、test、dev环境
  5. 中国电信天翼空间发布移动应用开发运营平台
  6. Pairing heap
  7. 计算机打字键盘怎么控制,电脑键盘打字技巧
  8. 小程序发布上线-微信小程序开发-视频教程17
  9. 小程序中getUserProfile使用async和await时fail,提示:can only be invoked by user TAP gesture
  10. Client<unknown> disconnected, not authorised