private void tvMType_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { #region 根据不同材料设置不同的材料属性 if (e.Node.Name == "activity") { activity = e.Node.Tag.ToString(); int specnum = PartParameter.GetSpecCou(activity); if (specnum != 0) { if (specnum > 0) { lspec1.Visible = true; tb_spec1.Visible = true; lspec2.Visible = false; tb_spec2.Visible = false; lspec3.Visible = false; tb_spec3.Visible = false; lspec4.Visible = false; tb_spec4.Visible = false; lspec1.Text = PartParameter.GetSpecName(activity, "1").Trim(); //relocation(); } if (specnum > 1) { lspec2.Visible = true; tb_spec2.Visible = true; lspec3.Visible = false; tb_spec3.Visible = false; lspec4.Visible = false; tb_spec4.Visible = false; lspec2.Text = PartParameter.GetSpecName(activity, "2").Trim(); //relocation(); } if (specnum > 2) { lspec3.Visible = true; tb_spec3.Visible = true; lspec4.Visible = false; tb_spec4.Visible = false; lspec3.Text = PartParameter.GetSpecName(activity, "3").Trim(); //relocation(); } if (specnum > 3) { lspec4.Visible = true; tb_spec4.Visible = true; lspec4.Text = PartParameter.GetSpecName(activity, "4").Trim(); } } else { lspec1.Visible = false; tb_spec1.Visible = false; lspec2.Visible = false; tb_spec2.Visible = false; lspec3.Visible = false; tb_spec3.Visible = false; lspec4.Visible = false; tb_spec4.Visible = false; //relocation(); } //BindPartNobyAct(); //cmb_partno.Text = site; //if (sub2pro == "") //{ // sub2pro = "03"; //} //cmb_site.SelectedValue = sub2pro; //QuerydataBind(); } #endregion }
/// <summary> /// 查找材料以及库存 /// </summary> public void QuerydataBind() { //string ProjectId = cmb_project.SelectedValue.ToString(); site = cmb_site.SelectedValue.ToString(); string partno = cmb_partno.Text.Trim().ToString(); string PartName = cmb_partname.Text.Trim().ToString(); string parttype = tb_type.Text.Trim().ToString(); string partmat = tb_mat.Text.Trim().ToString(); string partlevel = tb_level.Text.Trim().ToString(); string partcert = tb_cert.Text.Trim().ToString(); //string spec4 = tb_spec4.Text.Trim().ToString(); string spec1 = tb_spec1.Text.Trim().ToString(); string spec2 = tb_spec2.Text.Trim().ToString(); string spec3 = tb_spec3.Text.Trim().ToString(); string spec4 = tb_spec4.Text.Trim().ToString(); StringBuilder sb = new StringBuilder(); string spec_namestr = PartParameter.GetSpecName(activity); string pluscolum = string.Empty; //if (cb_showqty.Checked == true) // pluscolum = ",'' 项目可用库存量,'' 项目采购数量,'' 项目预留数量"; //if (ProjectId != string.Empty) sb.Append(" AND PROJECTID = '" + ProjectId + "'"); if (site != string.Empty) { sb.Append(" AND CONTRACT = '" + site + "'"); } if (partno != string.Empty) { sb.Append(" AND part_no like '%" + partno + "%'"); } if (PartName != string.Empty) { sb.Append(" AND part_spec like'%" + PartName + "%'"); } if (parttype != string.Empty) { sb.Append(" AND part_type like'%" + parttype + "%'"); } if (spec1 != string.Empty) { sb.Append(" AND part_spec1 like '%" + spec1 + "%'"); } if (spec2 != string.Empty) { sb.Append(" AND part_spec2 like '%" + spec2 + "%'"); } if (spec3 != string.Empty) { sb.Append(" AND part_spec3 like'%" + spec3 + "%'"); } if (spec4 != string.Empty) { sb.Append(" AND part_spec4 like'%" + spec4 + "%'"); } if (partmat != string.Empty) { sb.Append(" AND part_mat like '%" + partmat + "%'"); } if (partcert != string.Empty) { sb.Append(" AND part_cert like'%" + partcert + "%'"); } if (partlevel != string.Empty) { sb.Append(" AND part_level like'%" + partlevel + "%'"); } //string sqlSelect = "SELECT '','',pp.*,'' FROM PLM.MM_PART_TAB pp WHERE 1=1 and parentid= " + activity; string sqlSelect = "select t.ID 序号,t.part_no 零件号,t.part_type 零件类别,t.part_spec 零件规格," + spec_namestr + "t.part_mat 材质,t.part_cert 证书,t.part_unit 单位,t.part_unitdensity 单位密度,t.part_densityunit 密度单位,t.part_level 等级,t.parentid,t.contract 域" + ",t.supplycircle 采购周期,t.replace_code 替代码" + pluscolum + " from mm_part_tab t WHERE 1=1 and parentid= " + activity; string wheresql = sb.ToString(); sqlSelect = sqlSelect + wheresql + " order by t.parentid,t.part_type"; listviewBind(sqlSelect); }