/// <summary> /// 删除提货单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDel_Click(object sender, EventArgs e) { bool retChecked = false; CStockUpBillBC stockUpBillBC = new CStockUpBillBC(); CSaleBillBB saleBillBB = new CSaleBillBB(); try { //获取选中的数据Id foreach (GridViewRow gvrow in this.grid.Rows) { CheckBox chkId = (CheckBox)gvrow.FindControl("chkId"); if (chkId.Checked == true) { retChecked = true; int absEntry = 0; CSaleBillData saleBillModel = new CSaleBillData(); saleBillModel = saleBillBB.GetModel(Convert.ToInt32(chkId.ValidationGroup)); if (saleBillModel != null && saleBillModel.instantState != "01") { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"销售订单已生成备货单,不允许删除!\");", true); return; } //删除提货单信息 absEntry = Convert.ToInt32(this.grid.DataKeys[gvrow.RowIndex]["absEntry"]); stockUpBillBC.DeleteSaleBill(absEntry); } } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { stockUpBillBC.Dispose(); saleBillBB.Dispose(); } if (retChecked) { this.BindGrid(); } else { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"请选择一条记录!\");", true); } }
/// <summary> /// 生成备货单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnNewBill_Click(object sender, EventArgs e) { string strPreCustNo = "", strSaleBillNos = "", strAbsEntrys = "", strFinanceBillNos = "", strLineNums = ""; //获取选中的数据Id foreach (GridViewRow gvrow in this.grid.Rows) { CheckBox chkId = (CheckBox)gvrow.FindControl("chkId"); if (chkId.Checked == true) { string id = this.grid.DataKeys[gvrow.RowIndex].Values["id"].ToString(); string custNo = this.grid.DataKeys[gvrow.RowIndex].Values["custNo"].ToString(); string strSaleBillNo = this.grid.DataKeys[gvrow.RowIndex].Values["saleBillNo"].ToString(); string strAbsEntry = this.grid.DataKeys[gvrow.RowIndex].Values["absEntry"].ToString(); string strFinanceBillNo = this.grid.DataKeys[gvrow.RowIndex].Values["financeBillNo"].ToString(); string strLineNum = this.grid.DataKeys[gvrow.RowIndex].Values["lineNum"].ToString(); //判断选择的是否是同一客户 if (strPreCustNo == "") { strPreCustNo = custNo; } if (custNo != strPreCustNo) { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"只能选择同一客户的销售订单!\");", true); return; } //实时获取订单状态 using (CSaleBillBB billBB = new CSaleBillBB()) { CSaleBillData data = billBB.GetModel(Convert.ToInt32(id)); if (data.instantState == "01") { strSaleBillNos += ",'" + strSaleBillNo + "'"; strAbsEntrys += "," + strAbsEntry; strLineNums += "," + strLineNum; //采购合同号组合 if (strFinanceBillNo != "") { strFinanceBillNos += "," + strFinanceBillNo; } } else { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"销售订单【" + strSaleBillNo + "】已生成备货单,不允许再生成备货单!\");", true); return; } } } } if (strSaleBillNos.Trim(',') != "") { string strCurrUrl = "", strBackUrl = ""; strCurrUrl = HttpContext.Current.Request.Url.OriginalString; strBackUrl = Server.UrlEncode(strCurrUrl); Response.Redirect("~/Page/Operation/CStockUpBill/CStockUpBill.aspx?id=&custNo=" + strPreCustNo + "&saleBillNos=" + Server.UrlEncode(strSaleBillNos.Trim(',')) + "&absEntrys=" + strAbsEntrys.Trim(',') + "&financeBillNos=" + Server.UrlEncode(strFinanceBillNos.Trim(',')) + "&lineNums=" + Server.UrlEncode(strLineNums.Trim(',')) + "&itemNo=" + this.itemNo + "&pTypeNo=main&backUrl=" + strBackUrl); } this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"请选择一条记录!\");", true); return; }