/// <summary> /// 生成排拖单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnPaiFact_Click(object sender, EventArgs e) { //获取选中的数据Id foreach (GridViewRow gvrow in this.grid.Rows) { CheckBox chkId = (CheckBox)gvrow.FindControl("chkId"); if (chkId.Checked == true) { string strBillNo = "", strCustNm = "", strArriveDt = "", strSate = ""; strBillNo = chkId.ValidationGroup; strCustNm = this.grid.DataKeys[gvrow.RowIndex].Values["custNm"].ToString(); strArriveDt = this.grid.DataKeys[gvrow.RowIndex].Values["arriveDt"].ToString(); //实时获取订单状态 using (BArriveBillBB billBB = new BArriveBillBB()) { DataSet ds = billBB.GetVList(" billNo='" + strBillNo + "'"); if (ds.Tables[0].Rows.Count > 0) { strSate = ds.Tables[0].Rows[0]["instantState"].ToString(); } } //判断到货单明细是否全部完成 using (BArriveDetailBB arriveDetailBB = new BArriveDetailBB()) { DataTable dtArriveDetail = arriveDetailBB.GetList("arriveBillNo='" + strBillNo + "'").Tables[0]; foreach (DataRow row in dtArriveDetail.Rows) { if (Convert.ToBoolean(row["isFinishReceive"]) == false) { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"当前到货单未收货完成!\");", true); return; } } } if (strSate != "03" && strSate != "04" && strSate != "05") { Response.Redirect("../BArriveDetail/BArriveDetailList.aspx?billNo=" + strBillNo + "&custnm=" + Server.UrlEncode(strCustNm) + "&arriveDt=" + Server.UrlEncode(strArriveDt) + "&itemNo=" + this.itemNo + "&pTypeNo=edit", false); return; } else { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"订单流程已提交或已收货状态,不能修改信息!\");", true); return; } } } this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"请选择一条记录!\");", true); return; }