public void BindWare(DropDownList ddlWare) { using (LWareBB wareBB = new LWareBB()) { DataSet ds = new DataSet(); ds = wareBB.GetList("isDel=0"); ddlWare.DataTextField = "wareNm"; ddlWare.DataValueField = "wareNo"; ddlWare.DataSource = ds.Tables[0]; ddlWare.DataBind(); ddlWare.Items.Insert(0, new ListItem("-请选择-", "")); } }
/// <summary> /// 数据保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { string strInfo = ""; if (!this.ValidateData(out strInfo)) { strInfo = strInfo.Replace("\"", "'").Replace("\n", ""); this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + strInfo + "');", true); return; } LWareData model = new LWareData(); LWareBB wareBB = new LWareBB(); try { if (this.State == "1") { this.SetModel(ref model); model.isrtDt = DateTime.Now.ToString(); model.isrtEmpId = this.currentUser.empId; this.IdValue = wareBB.AddRecord(model); } else if (this.State == "2") { model = wareBB.GetModel(this.IdValue); this.SetModel(ref model); model.updtDt = DateTime.Now.ToString(); model.updtEmpId = this.currentUser.empId; wareBB.ModifyRecord(model); } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { wareBB.Dispose(); } Response.Redirect("LWareList.aspx?&itemno=" + this.itemNo + "&pTypeNo=main", false); }
/// <summary> /// 绑定Grid /// </summary> protected void BindGrid() { LWareBB wareBB = new LWareBB(); DataSet ds = new DataSet(); try { string strWhere = this.StrWhere; //库区编码 if (this.tbWareNo.Text.Trim() != "") { strWhere += " and wareNo like '%" + this.tbWareNo.Text.Trim().Replace("'", "''") + "%'"; } //库区名称 if (this.tbWareNm.Text.Trim() != "") { strWhere += " and wareNm like '%" + this.tbWareNm.Text.Trim().Replace("'", "''") + "%'"; } //货位分类 if (this.ddlWareSort.SelectedValue != "") { strWhere += " and wareSortNo='"+this.ddlWareSort.SelectedValue +"'"; } ds = wareBB.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 { wareBB.Dispose(); } }
/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDel_Click(object sender, EventArgs e) { bool retChecked = false; LWareBB wareBB = new LWareBB(); try { //获取选中的数据Id foreach (GridViewRow gvrow in this.grid.Rows) { CheckBox chkId = (CheckBox)gvrow.FindControl("chkId"); if (chkId.Checked == true) { retChecked = true; int id = int.Parse(chkId.ValidationGroup); LWareData wareModel = new LWareData(); wareModel = wareBB.GetModel(id); wareModel.isDel = true; wareModel.updtDt = System.DateTime.Now.ToString(); wareModel.updtEmpId = this.currentUser.empId; wareBB.ModifyRecord(wareModel); } } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { wareBB.Dispose(); } if (retChecked) { this.BindGrid(); } }
/// <summary> /// 验证页面信息 /// </summary> /// <param name="strErrorInfo">错误提示信息</param> /// <returns></returns> private bool ValidateData(out string strErrorInfo) { LWareBB wareBB = new LWareBB(); try { strErrorInfo = ""; DataSet ds = new DataSet(); if (this.tbWareNo.Text.Trim() == "") { strErrorInfo = "请首先填写库区编码!"; this.tbWareNo.Focus(); return false; } //判断库区编码是否重复 ds = wareBB.GetList("wareNo='" + this.tbWareNo.Text.Trim().Replace("'", "''") + "' and id<>" + this.IdValue.ToString()); if (ds.Tables[0].Rows.Count > 0) { strErrorInfo = "库区编码重复!"; this.tbWareNo.Focus(); return false; } if (this.tbWareNm.Text.Trim() == "") { strErrorInfo = "请首先填写库区名称!"; this.tbWareNm.Focus(); return false; } if (this.ddlWareType.SelectedValue == "") { strErrorInfo = "请首先选择仓库类别!"; this.ddlWareType.Focus(); return false; } if (this.ddlWareSort.SelectedValue == "") { strErrorInfo = "请首先选择货位分类!"; this.ddlWareSort.Focus(); return false; } return true; } finally { wareBB.Dispose(); } }
/// <summary> /// 展示数据 /// </summary> /// <param name="id">记录Id</param> private void ShowInfo(int id) { LWareBB wareBB = new LWareBB(); vLWareData model = new vLWareData(); try { model = wareBB.GetVModel(id); this.tbWareNo.Text = model.wareNo; this.tbWareNm.Text = model.wareNm; this.ddlWareType.SelectedValue = model.wareType; this.ddlWareSort.SelectedValue = model.wareSortNo; } finally { wareBB.Dispose(); } }
/// <summary> /// 验证页面信息 /// </summary> /// <param name="strErrorInfo">错误提示信息</param> /// <returns></returns> private bool ValidateData(out string strErrorInfo) { LWareBB wareBB = new LWareBB(); try { strErrorInfo = ""; DataSet ds = new DataSet(); if (this.tbSystemWeight.Text.Trim() == "") { strErrorInfo = "请首先填写系统重量!"; this.tbSystemWeight.Focus(); return false; } if (!CommFunction.IsDouble(this.tbSystemWeight.Text.Trim())) { strErrorInfo = "系统重量格式错误!"; this.tbSystemWeight.Focus(); return false; } if (this.tbWeightDiffWaring.Text.Trim() == "") { strErrorInfo = "请首先填写单个称重差异预警值!"; this.tbWeightDiffWaring.Focus(); return false; } if (!CommFunction.IsDouble(this.tbWeightDiffWaring.Text.Trim())) { strErrorInfo = "单个称重差异预警值格式错误!"; this.tbWeightDiffWaring.Focus(); return false; } if (this.ddlWareSort.SelectedValue == "") { strErrorInfo = "请首先选择库位分类!"; this.ddlWareSort.Focus(); return false; } return true; } finally { wareBB.Dispose(); } }
public bool IsWareLocatorUsing(string strWareLocatorNo) { LWareLocatorBB wareLocatorBB = new LWareLocatorBB(); LWareBB wareBB = new LWareBB(); try { DataTable dtWare = new DataTable(); DataTable dtWareLocator = new DataTable(); dtWare = wareBB.GetList("wareNo='" + strWareLocatorNo + "'").Tables[0];//获取库区 dtWareLocator = wareLocatorBB.GetVList("wareLocatorNo='" + strWareLocatorNo + "'").Tables[0];//获取库位 //如果扫描的为库区,返回true if (dtWare.Rows.Count > 0) { return false; } //判断库位是否正在使用 if (dtWareLocator.Rows.Count == 0) { return true; } else if (dtWareLocator.Rows[0]["wareType"].ToString() == "07" || dtWareLocator.Rows[0]["isUsing"] == DBNull.Value || Convert.ToBoolean(dtWareLocator.Rows[0]["isUsing"]) == false) { return false; } else { return true; } } finally { wareLocatorBB.Dispose(); wareBB.Dispose(); } }
public DataTable GetWareByWareNo(string strWareNo) { using (LWareBB wareBB = new LWareBB()) { DataSet ds = new DataSet(); string strWhere = "wareNo='" + strWareNo + "'"; ds = wareBB.GetList(strWhere); return ds.Tables[0]; } }
public DataTable GetWare(string strWareType) { using (LWareBB wareBB = new LWareBB()) { DataSet ds = new DataSet(); string strWhere = "isDel=0"; if (strWareType != "") { strWhere += " and wareType='" + strWareType + "'"; } ds = wareBB.GetList(strWhere); return ds.Tables[0]; } }
public string GetPalletWareInfo(string strPalletNo) { string strWareLocatorNo = ""; BArrangeBillBoxBB arrangeBillBoxBB = new BArrangeBillBoxBB(); LWareBB wareBB = new LWareBB(); LWareLocatorBB wareLocatorBB = new LWareLocatorBB(); LMaterialBB materialBB = new LMaterialBB(); SCommBB commBB = new SCommBB(); try { DataTable dtArrangeBillBox = new DataTable(); DataTable dtWare = new DataTable(); DataTable dtWareLocator = new DataTable(); //获取托盘下的所有箱子 dtArrangeBillBox = arrangeBillBoxBB.GetVList("palletNo='" + strPalletNo + "' and isnull(wareNo,'')<>''").Tables[0]; if (dtArrangeBillBox.Rows.Count > 0) { string strFinanceBillSort = "", strFinanceBillNo = ""; strFinanceBillSort = dtArrangeBillBox.Rows[0]["financeBillSort"].ToString();//采购合同类型 strFinanceBillNo = dtArrangeBillBox.Rows[0]["financeBillNo"].ToString();//采购合同号 if (strFinanceBillSort == "按单" || strFinanceBillNo.IndexOf("EB16") == -1) { #region 按单 //按单的物料,放置在正式库的平面库区 dtWareLocator = wareLocatorBB.GetVList("wareSortNo='A' and wareType='03' and isUsing=0 and isDel=0").Tables[0]; if (dtWareLocator.Rows.Count > 0) { strWareLocatorNo = dtWareLocator.Rows[0]["wareNo"].ToString() + "," + dtWareLocator.Rows[0]["wareLocatorNo"].ToString();//库位 } #endregion 按单 } else if (strFinanceBillSort == "备货" || strFinanceBillNo.IndexOf("EB16") != -1) { #region 备货 string strMaterialNos = "", strUCodeNos = "", strWareSortNos = "B"; int materialNum = 1; DataTable dtMaterial = new DataTable(); //判断当前托盘是否存在多个物料 strMaterialNos = dtArrangeBillBox.Rows[0]["materialNo"].ToString();//物料编号 strUCodeNos = dtArrangeBillBox.Rows[0]["U_CodeNo"].ToString();//物料U_CodeNo foreach (DataRow row in dtArrangeBillBox.Rows) { if (strMaterialNos.IndexOf(row["materialNo"].ToString()) == -1) { materialNum++; strMaterialNos += "," + row["materialNo"].ToString();//物料编号 } if (strUCodeNos.IndexOf(row["U_CodeNo"].ToString()) == -1) { strUCodeNos += "," + row["U_CodeNo"].ToString();//物料U_CodeNo } } if (materialNum == 1)//托盘上只有一种物料 { dtMaterial = materialBB.GetList("materialNo='" + strMaterialNos + "'").Tables[0];//获取物料信息 strWareSortNos = dtMaterial.Rows[0]["wareSortNo"].ToString();//获取物料的货位分类 } else { foreach (DataRow row in dtArrangeBillBox.Rows) { dtMaterial = materialBB.GetList("materialNo='" + row["materialNo"].ToString() + "'").Tables[0];//获取物料信息 if (dtMaterial.Rows[0]["wareSortNo"].ToString() != "B")//查找货位分类为非高位货架所有类别 { if (strWareSortNos == "B")//如果当前类型为高位货架 { strWareSortNos = dtMaterial.Rows[0]["wareSortNo"].ToString();//货架分类赋新值 } else { if (strWareSortNos.IndexOf(dtMaterial.Rows[0]["wareSortNo"].ToString()) == -1) { strWareSortNos += "," + dtMaterial.Rows[0]["wareSortNo"].ToString(); } } } } } if (strWareSortNos == "D" || strWareSortNos == "E")//流利货架摆放不分库位,推荐到库区即可 { //获取推荐库区信息 dtWare = wareBB.GetVList("wareSortNo='" + strWareSortNos + "' and wareType='03' and isDel=0").Tables[0]; if (dtWare.Rows.Count > 0) { strWareLocatorNo = dtWare.Rows[0]["wareNo"].ToString() + ",";//库区 } } else//其他货架,推荐到库位 { //获取推荐库位信息 dtWareLocator = commBB.Query("exec Proc_GetSuggestWareLocator '" + strWareSortNos.Trim(',') + "','" + strUCodeNos.Trim(',') + "','" + strMaterialNos.Trim(',') + "'").Tables[0]; if (dtWareLocator.Rows.Count > 0) { strWareLocatorNo = dtWareLocator.Rows[0]["wareNo"].ToString() + "," + dtWareLocator.Rows[0]["wareLocatorNo"].ToString();//库位 } } #endregion 备货 } } } finally { arrangeBillBoxBB.Dispose(); wareBB.Dispose(); wareLocatorBB.Dispose(); materialBB.Dispose(); commBB.Dispose(); } return strWareLocatorNo; }