private void InitTreeView(InputMaterialInfoDef rootModelPartInfo) { //取得的顺序 //public string id; //public string parent; //public string curent; //public string desc; //public bool isPart; //public bool isModel; //public int level; try { this.dTree.Nodes.Clear(); myTreeNode root = GetTreeNodeByData(rootModelPartInfo.PartNo); root.IsModel = rootModelPartInfo.IsModel; root.IsPart = rootModelPartInfo.IsPart; root.Desc = rootModelPartInfo.Description; ////// this.dTree.Nodes.Add(root); this.dTree.ExpandAll(); SaveTreeIdIndex(); } catch (FisException ex) { showErrorMessage(ex.mErrmsg); } catch (Exception ex) { showErrorMessage(ex.Message); } }
//for new ModelBOM/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// /////////// /// </summary> /// <param name="pn"></param> /// <returns></returns> /// //SELECT [Model] AS PartNo, ‘’ AS Descr, // 0 AS WHERETYPE // ,[BOMApproveDate] AS [BOMApproveDate] // ,[Editor] // ,[Cdt] // ,[Udt] // FROM [IMES_GetData_Datamaintain].[dbo].[Model] //WHERE [Model]= 'pn' //union //SELECT [PartNo] AS PartNo, // Descr AS Descr, // 1 AS WHERETYPE, // GetDate() AS [BOMApproveDate] // ,[Editor] // ,[Cdt] // ,[Udt] // FROM [IMES_GetData_Datamaintain].[dbo].[Part] //WHERE [PartNo]='pn' AND Flag=1 //order by WHERETYPE public InputMaterialInfoDef GetMaterialInfo(string pn) { InputMaterialInfoDef info = new InputMaterialInfoDef(); try { IModelBOMRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IModelBOMRepository, BOMNodeData>(); DataTable getData = new DataTable(); getData = itemRepository.GetMaterialInfo(pn); if (getData.Rows.Count > 0) { info.PartNo = Null2String(getData.Rows[0][0]).Trim(); //如果part表中有description,在后面,所以取最后的description info.Description = Null2String(getData.Rows[getData.Rows.Count - 1][1]).Trim(); string type = Null2String(getData.Rows[0][2]).Trim(); if (getData.Rows.Count > 1) { info.IsModel = "True"; info.IsPart = "True"; } else if (type == "0") { info.IsModel = "True"; info.IsPart = "False"; } else { info.IsPart = "True"; info.IsModel = "False"; } info.BOMApproveDate = Null2String(getData.Rows[0][3]).Trim(); if (info.BOMApproveDate != "") { info.BOMApproveDate = ((DateTime)getData.Rows[0][3]).ToString("yyyy-MM-dd"); } info.Editor = Null2String(getData.Rows[0][4]).Trim(); info.Cdt = ((DateTime)getData.Rows[0][5]).ToString("yyyy-MM-dd"); info.Udt = ((DateTime)getData.Rows[0][6]).ToString("yyyy-MM-dd"); } else { List<string> erpara = new List<string>(); FisException ex; //!!!need change //输入的[Model/PN]不是合法的Model或Part ex = new FisException("DMT013", erpara); throw ex; } } catch (Exception) { throw; } return info; }
private void SetApproveState(InputMaterialInfoDef modelPartInfo) { if (modelPartInfo.IsModel == "True") { if (modelPartInfo.BOMApproveDate == "") { this.btnApproveModel.Disabled = false; this.lblApprove.Text = ""; } else { this.btnApproveModel.Disabled = true; this.lblApprove.Text = this.GetLocalResourceObject(Pre + "_pmtModel1").ToString() + " " + modelPartInfo.Editor + " " + this.GetLocalResourceObject(Pre + "_pmtModel2").ToString() + " " + modelPartInfo.BOMApproveDate + "."; } } else { this.btnApproveModel.Disabled = true; this.lblApprove.Text = ""; } }