public ucStrorageDocQuery() { InitializeComponent(); dgv_SDocNoDetl.AutoGenerateColumns = false; dgv_SDoc_NO.AutoGenerateColumns = false; InitSDocType(); DataBindToLine(); dtp_CreateTimeMin.Value = DateTime.Now.AddDays(-1); //初始化物料数据源 BLL_MdcdatMaterial bll_Material = new BLL_MdcdatMaterial(); DataTable dt_Material = bll_Material.Select(string.Empty); foreach (DataRow dr in dt_Material.Rows) { lstInit.Add(dr["MaterialCode"].ToString()); } cbo_MaterialCode.Items.AddRange(lstInit.ToArray()); DataTable dt_storage = BLL.Bll_Bllb_Storage_tbs.GetListOfStorage(string.Empty); DataRow dr_storage = dt_storage.NewRow(); dr_storage["Storage_SN"] = string.Empty; dr_storage["Storage_Name"] = string.Empty; dt_storage.Rows.InsertAt(dr_storage, 0); cbo_StorageSN.DataSource = dt_storage; cbo_StorageSN.ValueMember = "Storage_SN"; cbo_StorageSN.DisplayMember = "Storage_Name"; }
private bool ValidateMaterialCode(out string msg) { if (string.IsNullOrEmpty(txtMaterialCode.Text.Trim())) { msg = "料号不能为空"; return(false); } DataTable dtMaterial = bll_material.Select(string.Format(" MaterialCode='{0}'", txtMaterialCode.Text.Trim())); if (dtMaterial.Rows.Count == 0) { msg = "料号错误"; return(false); } msg = "OK"; return(true); }
private bool ValidateInput(out string msg) { if (string.IsNullOrEmpty(txtLocalMaterial.Text.Trim())) { msg = "本厂料号必填"; return(false); } if (string.IsNullOrEmpty(txtSupplyMaterial.Text.Trim())) { msg = "供应商料号必填"; return(false); } //if (string.IsNullOrEmpty(txtSupply.Text.Trim())) //{ // msg = "供应商编码错误"; // return false; //} if (BLL_Material.Select(string.Format("MaterialCode='{0}'", txtLocalMaterial.Text.Trim())).Rows.Count == 0) { msg = "本厂料号错误"; return(false); } //if (Bll_MdcDatSuppliesManage.Query(string.Format(" where SupplierCode='{0}'", txtSupply.Text.Trim())).Rows.Count == 0) //{ // msg = "供应商代码错误"; // return false; //} if (BLL_Bllb_MaterialRelation_Tbmr.Query(string.Format("WHERE SupplyMaterialCode='{0}' {1}", txtSupplyMaterial.Text.Trim(), TBMR_ID == string.Empty ? string.Empty : string.Format("AND TBMR_ID<>'{0}'", TBMR_ID))).Rows.Count > 0) { msg = "供应商料号已存在"; return(false); } msg = "OK"; return(true); }
private void FrmMdcdatMaterial_Load(object sender, EventArgs e) { DataTable dt = mdcdatMaterial_BLL.Select(string.Empty); dgv_mdmt.DataSource = dt; }