/// <summary> /// 绑定退货明细列表 /// </summary> private void BindGridDetail() { BBackDetailBB backDetailBB = new BBackDetailBB(); try { DataTable dtDetail = new DataTable(); //获取退货明细数据源 dtDetail = backDetailBB.GetListCheck("backBillNo='" + this.lbBackBillNo.Text + "'").Tables[0]; this.gridDetail.DataSource = dtDetail; this.gridDetail.DataBind(); } finally { backDetailBB.Dispose(); } }
/// <summary> /// 提交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnCommit_Click(object sender, EventArgs e) { bool retChecked = false; BBackBillBB backBillBB = new BBackBillBB(); try { foreach (GridViewRow gvrow in this.grid.Rows) { CheckBox chkId = (CheckBox)gvrow.FindControl("chkId"); if (chkId.Checked == true) { int id = int.Parse(chkId.ValidationGroup); BBackBillData backBillModel = backBillBB.GetModel(Convert.ToInt32(id)); if (backBillModel.instantState != "03") { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"请选择一条未提交退货单记录!\");", true); return; } else { retChecked = true; backBillModel.commitDt = System.DateTime.Now.ToString(); backBillModel.commitEmpId = this.currentUser.empId; backBillModel.instantState = "02"; backBillBB.ModifyRecord(backBillModel); } DataTable dtDetail = new DataTable(); BBackDetailBB backDetailBB = new BBackDetailBB(); //获取退货明细数据源 dtDetail = backDetailBB.GetList("backBillNo='" + backBillModel.backBillNo + "'").Tables[0]; string commadPallet = ""; for (int i = 0; i < dtDetail.Rows.Count; i++) { if (i == dtDetail.Rows.Count - 1) { commadPallet += "BoxNO = '" + dtDetail.Rows[i]["BoxNo"].ToString().ToUpper().Trim() + "'"; } else { commadPallet += "BoxNO = '" + dtDetail.Rows[i]["BoxNo"].ToString().ToUpper().Trim() + "' or "; } } string command = "select distinct palletNo from BArrangeBillBox where " + commadPallet;//获取订单下的托盘号码 SCommBB bb = new SCommBB(); DataTable dt = bb.Query(command).Tables[0]; bb.Dispose(); //BForkliftTaskBC bforkTaskBC = new BForkliftTaskBC(); //for (int j = 0; j < dt.Rows.Count; j++) //{ // bforkTaskBC.SaveForkliftTaskWithTHD(dt.Rows[j][0].ToString(), "YCQ", "N01.01", "30", this.currentUser.empId,backBillModel.backBillNo); //} } } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { backBillBB.Dispose(); } if (retChecked) { this.BindGrid(); } }
/// <summary> /// 删除 /// 2015-07-28 新增删除退货单明细的功能 删除备货单的时候 重新处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDel_Click(object sender, EventArgs e) { bool retChecked = false; BBackBillBB backBillBB = new BBackBillBB(); BBackBillBC backBillBC = new BBackBillBC(); BBackDetailBB backDetailBB = new BBackDetailBB(); try { foreach (GridViewRow gvrow in this.grid.Rows) { CheckBox chkId = (CheckBox)gvrow.FindControl("chkId"); if (chkId.Checked == true) { int id = int.Parse(chkId.ValidationGroup); string strBackBillNo = this.grid.DataKeys[gvrow.RowIndex]["backBillNo"].ToString(); BBackBillData backBillModel = backBillBB.GetModel(Convert.ToInt32(id)); if (backBillModel.instantState != "01") { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"请选择一条未提交退货单记录!\");", true); return; } else { retChecked = true; backBillBC.DeleteRecord(id, ""); backDetailBB.DeleteRecord(strBackBillNo); } } } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { backBillBB.Dispose(); backBillBC.Dispose(); } if (retChecked) { this.BindGrid(); } }
/// <summary> /// 提交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnCommit_Click(object sender, EventArgs e) { //bool retChecked = false; //BBackBillBB backBillBB = new BBackBillBB(); //try //{ // foreach (GridViewRow gvrow in this.grid.Rows) // { // CheckBox chkId = (CheckBox)gvrow.FindControl("chkId"); // if (chkId.Checked == true) // { // int id = int.Parse(chkId.ValidationGroup); // BBackBillData backBillModel = backBillBB.GetModel(Convert.ToInt32(id)); // if (backBillModel.instantState != "01") // { // this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"请选择一条未提交退货单记录!\");", true); // return; // } // else // { // retChecked = true; // backBillModel.commitDt = System.DateTime.Now.ToString(); // backBillModel.commitEmpId = this.currentUser.empId; // backBillModel.instantState = "02"; // backBillBB.ModifyRecord(backBillModel); // } // DataTable dtDetail = new DataTable(); // BBackDetailBB backDetailBB = new BBackDetailBB(); // //获取退货明细数据源 // dtDetail = backDetailBB.GetList("backBillNo='" + backBillModel.backBillNo + "'").Tables[0]; // string commadPallet = ""; // for (int i = 0; i < dtDetail.Rows.Count; i++) // { // if (i == dtDetail.Rows.Count - 1) // { // commadPallet += "BoxNO = '" + dtDetail.Rows[i]["BoxNo"].ToString().ToUpper().Trim() + "'"; // } // else // { // commadPallet += "BoxNO = '" + dtDetail.Rows[i]["BoxNo"].ToString().ToUpper().Trim() + "' or "; // } // } // string command = "select distinct palletNo from BArrangeBillBox where " + commadPallet;//获取订单下的托盘号码 // SCommBB bb = new SCommBB(); // DataTable dt = bb.Query(command).Tables[0]; // bb.Dispose(); // //BForkliftTaskBC bforkTaskBC = new BForkliftTaskBC(); // //for (int j = 0; j < dt.Rows.Count; j++) // //{ // // bforkTaskBC.SaveForkliftTaskWithTHD(dt.Rows[j][0].ToString(), "YCQ", "N01.01", "30", this.currentUser.empId,backBillModel.backBillNo); // //} // } // } //} //catch (Exception ex) //{ // this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); // return; //} //finally //{ // backBillBB.Dispose(); //} //if (retChecked) //{ // this.BindGrid(); //} bool retChecked = false; BBackBillBB backBillBB = new BBackBillBB(); try { foreach (GridViewRow gvrow in this.grid.Rows) { CheckBox chkId = (CheckBox)gvrow.FindControl("chkId"); if (chkId.Checked == true) { int id = int.Parse(chkId.ValidationGroup); BBackBillData backBillModel = backBillBB.GetModel(Convert.ToInt32(id)); if (backBillModel.instantState != "01") { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"请选择一条未提交退货单记录!\");", true); return; } else { DataTable dtDetail = new DataTable(); BBackDetailBB backDetailBB = new BBackDetailBB(); //获取退货明细数据源 dtDetail = backDetailBB.GetList("backBillNo='" + backBillModel.backBillNo + "'").Tables[0]; string commadPallet = ""; for (int i = 0; i < dtDetail.Rows.Count; i++) { if (i == dtDetail.Rows.Count - 1) { commadPallet += "BoxNO = '" + dtDetail.Rows[i]["BoxNo"].ToString().ToUpper().Trim() + "'"; } else { commadPallet += "BoxNO = '" + dtDetail.Rows[i]["BoxNo"].ToString().ToUpper().Trim() + "' or "; } } string command = "select distinct palletNo from BArrangeBillBox where " + commadPallet;//获取订单下的托盘号码 SCommBB bb = new SCommBB(); DataTable dt = bb.Query(command).Tables[0]; //发现即便是没有数据 if (dt.Rows.Count > 0) { if (string.IsNullOrEmpty(dt.Rows[0][0].ToString())) { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"箱没有在托盘上请确定!\");", true); return; } } if (dt.Rows.Count > 1) { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"托盘不唯一!\");", true); return; } command = @"select checkResult from BArrangeBillBox where palletNo in ( select distinct palletNo from BArrangeBillBox where " + commadPallet + ") and checkResult = 1 "; DataTable noPass = bb.Query(command).Tables[0]; bb.Dispose(); if (noPass.Rows.Count > 0) { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"托盘上有合格的产品需要不能进行退货!\");", true); return; } //2015-08-07 修改到异常区的叉车任务的功能 BForkliftTaskBC bforkTaskBC = new BForkliftTaskBC(); if ( bforkTaskBC.SaveForkliftTaskWithTHD(dt.Rows[0][0].ToString(), "", "", "30", this.currentUser.empId, backBillModel.backBillNo)) { retChecked = true; backBillModel.commitDt = System.DateTime.Now.ToString(); backBillModel.commitEmpId = this.currentUser.empId; backBillModel.instantState = "02"; backBillBB.ModifyRecord(backBillModel); } else { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"生成叉车任务失败!\");", true); return; } } } } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { backBillBB.Dispose(); } if (retChecked) { this.BindGrid(); } }
/// <summary> /// 初始化退货明细数据源 /// </summary> private void InitDetail() { BBackDetailBB backDetailBB = new BBackDetailBB(); try { //获取退货明细数据源 this.dtDetail = backDetailBB.GetListBuyer("backBillNo='" + this.lbBackBillNo.Text + "'").Tables[0]; this.dtDetail.Columns.Add("isDel", typeof(bool)); //退货明细数据源添加是否删除标志 foreach (DataRow row in this.dtDetail.Rows) { row["isDel"] = false; } } finally { backDetailBB.Dispose(); } }
/// <summary> /// 绑定退货明细列表 /// </summary> private void BindGridDetail() { BBackDetailBB backDetailBB = new BBackDetailBB(); try { DataTable dtDetail = new DataTable(); //获取退货明细数据源 dtDetail = backDetailBB.GetListTHWareHouse("backBillNo='" + this.lblBackBillNo.Text + "'").Tables[0]; lblBoxNum.Text = dtDetail.Rows.Count.ToString(); this.gridDetail.DataSource = dtDetail; this.gridDetail.DataBind(); } finally { backDetailBB.Dispose(); } }