/// <summary> /// 展示数据 /// </summary> /// <param name="id">记录Id</param> private void ShowInfo(int id) { BTallyBillBB tallyBillBB = new BTallyBillBB(); vBTallyBillData model = new vBTallyBillData(); BTallyBillDetailBB detailBB=new BTallyBillDetailBB(); try { //获取理货单实例 model = tallyBillBB.GetVModel(id); this.palletNo.Text = model.palletNo; this.wareLocatorNm.Text = model.wareLocatorNm; this.wareNm.Text = model.wareNm; this.isInStock.Text = model.isInStock ? "已入库" : "未入库"; this.instantState.Text = model.instantState == "01" ? "理货中" : model.instantState == "02" ? "理货已完成" : "已入库"; DataSet ds = detailBB.GetVList(" mainid=" + id); this.grid.DataSource = ds; this.grid.DataBind(); } finally { tallyBillBB.Dispose(); } }
/// <summary> /// 绑定Grid /// </summary> protected void BindGrid() { BTallyBillBB tTallyBillBB = new BTallyBillBB(); DataSet ds = new DataSet(); try { string strWhere = this.StrWhere; if (!string.IsNullOrEmpty(this.txtPtNo.Text)) { strWhere += " and palletNo like '%" + txtPtNo.Text.Trim() + "%' "; } //限制状态为“已理货完成” strWhere += " and instantState='02'"; ds = tTallyBillBB.GetList(strWhere); this.grid.DataSource = ds.Tables[0]; this.grid.DataBind(); //赋值记录条数、页面总数 this.Label3.Text = ds.Tables[0].Rows.Count.ToString(); this.Label2.Text = this.grid.PageCount.ToString(); this.currPage.Text = (this.grid.PageIndex + 1).ToString(); } finally { tTallyBillBB.Dispose(); } }
/// <summary> /// 数据保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { BTallyBillData model = new BTallyBillData(); BTallyBillBB tallyBillBB = new BTallyBillBB(); try { if (this.State == "1") { this.SetModel(ref model); model.isrtDt = DateTime.Now.ToString(); model.isrtEmpId = this.currentUser.empId; this.IdValue = tallyBillBB.AddRecord(model); } else if (this.State == "2") { model = tallyBillBB.GetModel(this.IdValue); this.SetModel(ref model); model.updtDt = DateTime.Now.ToString(); model.updtEmpId = this.currentUser.empId; tallyBillBB.ModifyRecord(model); } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { tallyBillBB.Dispose(); } Response.Redirect("BTallyBillList.aspx?&itemno=" + this.itemNo + "&pTypeNo=main", false); }
/// <summary> /// 绑定Grid /// </summary> protected void BindGrid() { BTallyBillBB tallyBillBB = new BTallyBillBB(); DataSet ds = new DataSet(); string strwhere = " 1=1 "; if (!string.IsNullOrEmpty(this.ddlWare.SelectedValue)) { strwhere += " and wareNo='" + this.ddlWare.SelectedValue + "'"; } if (!string.IsNullOrEmpty(this.ddlWarelocater.SelectedValue)) { strwhere += " and wareLocatorNo='" + this.ddlWarelocater.SelectedValue + "'"; } if (!string.IsNullOrEmpty(this.txtPllateno.Text.Trim())) { strwhere += " and palletNo like '%" + this.txtPllateno.Text.Trim().Replace("'","''") + "%'"; } try { ds = tallyBillBB.GetVList(strwhere); this.grid.DataSource = ds.Tables[0]; this.grid.DataBind(); //赋值记录条数、页面总数 this.Label3.Text = ds.Tables[0].Rows.Count.ToString(); this.Label2.Text = this.grid.PageCount.ToString(); this.currPage.Text = (this.grid.PageIndex + 1).ToString(); } finally { tallyBillBB.Dispose(); } }
/// <summary> /// 展示数据 /// </summary> /// <param name="id">记录Id</param> private void ShowInfo(int id) { BTallyBillBB tallyBillBB = new BTallyBillBB(); vBTallyBillData model = new vBTallyBillData(); try { model = tallyBillBB.GetVModel(id); this.id.Text = model.id.ToString(); this.palletNo.Text = model.palletNo; this.wareLocatorNo.Text = model.wareLocatorNo; this.isInStock.Checked = model.isInStock; this.instantState.Text = model.instantState; } finally { tallyBillBB.Dispose(); } }
/// <summary> /// 指定入库 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnInput_Click(object sender, EventArgs e) { bool retChecked = false;//是否选择 foreach (GridViewRow gvrow in this.grid.Rows) { CheckBox chkId = (CheckBox)gvrow.FindControl("chkId"); if (chkId.Checked == true) { UStockBB stockBB = new UStockBB(); BTallyBillBB tallyBillBB = new BTallyBillBB(); UStockBC stockBC = new UStockBC(); try { BTallyBillData tallyBillModel = tallyBillBB.GetModel(this.IdValue); if (tallyBillModel.instantState != "02")//状态不是“已理货完成” { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"当前托盘已经指定了库位!\");", true); return; } else { string strwhere = "wareLocatorNo='" + chkId.ValidationGroup + "'"; DataSet ds = stockBB.GetList(strwhere); if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"当前库位已经被占用!\");", true); return; } else { tallyBillModel.instantState = "03";//指定状态为“已入库” tallyBillModel.isInStock = true;// 入库状态 tallyBillModel.wareLocatorNo = chkId.ValidationGroup;//库位 retChecked = stockBC.SetPalletWarelocator(tallyBillModel,this.ddlWare.SelectedValue); } } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { tallyBillBB.Dispose(); stockBB.Dispose(); stockBC.Dispose(); } } } if (retChecked) { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"库位指定成功!\"); location.replace('UStockList.aspx?itemNo=" + this.itemNo + "&pTypeNo=main');", true); return; } this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"请选择一个库位!\");", true); return; }
public int SaveTallyBill(string strPalletNo, int isrtEmpId, string strInstantState) { BTallyBillBB tallyBillBB = new BTallyBillBB(); try { int mainId = 0; DataSet ds = new DataSet(); BTallyBillData tallyBillModel = new BTallyBillData(); //判断当前托盘是否已经理货 ds = tallyBillBB.GetList("palletNo='" + strPalletNo + "' and isInStock=0"); if (ds.Tables[0].Rows.Count == 0) { tallyBillModel.palletNo = strPalletNo;//托盘条码号 tallyBillModel.isInStock = false;//是否入库 tallyBillModel.isrtDt = System.DateTime.Now.ToString();//添加时间 tallyBillModel.isrtEmpId = isrtEmpId;//添加人 tallyBillModel.instantState = "01";//理货中 mainId = tallyBillBB.AddRecord(tallyBillModel);//称重理货单ID赋值 } else { mainId = Convert.ToInt32(ds.Tables[0].Rows[0]["id"]);//称重理货单ID赋值 if (strInstantState == "02")//理货已完成 { tallyBillModel = tallyBillBB.GetModel(mainId); tallyBillModel.instantState = "02";//理货已完成 tallyBillBB.ModifyRecord(tallyBillModel); } } return mainId; } finally { tallyBillBB.Dispose(); } }
public DataTable GetTallyBill(string strPalletNo) { BTallyBillBB tallyBillBB = new BTallyBillBB(); try { DataTable dt = new DataTable(); dt = tallyBillBB.GetVList("palletNo='" + strPalletNo + "' and isInStock=0").Tables[0]; return dt; } finally { tallyBillBB.Dispose(); } }