/// <summary> /// 基本信息--新建按钮操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolBaseReg_Click(object sender, EventArgs e) { //1.判断产品编号是否为空 if (string.IsNullOrEmpty(this.tb_productNo.Text.Trim())) { MessageBox.Show("编号不能为空"); return; } DataTable dt = m_MaterailService.GetListByNoDetail(this.tb_productNo.Text.Trim()); //1.判断产品是否存在,如果存在是否生产新版本 if (dt.Rows.Count > 0) { if (MessageBox.Show("该编号材料已存在,是否生成新版本?\n如果不是请更改产品编号!", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } } //3.保存新的产品记录 HYPDM.Entities.PDM_MATERAIL temp_product = new HYPDM.Entities.PDM_MATERAIL(); temp_product.MATERIALID = Guid.NewGuid().ToString(); temp_product.MATERIALNO = this.tb_productNo.Text; temp_product.MODELTYPE = this.tb_modelType.Text; temp_product.MATERIALTYPE = this.tb_productType.Text; temp_product.RAWMATERIAL = this.tb_rawMaterail.Text; temp_product.MATERIALSRC = this.tb_materailSrc.Text; temp_product.VERSION = "V" + DateTime.Now.ToString("yyyyMMddHHmmss"); temp_product.CREATER = LoginInfo.LoginID; // CommonVar.userName; //temp_product.MODIFIER = ""; temp_product.CTREATETIME = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); //temp_product.MODIFYTIME ; temp_product.MEMO_ZH = this.tb_memoZh.Text; temp_product.MEMO_EN = this.tb_memoEn.Text; temp_product.MEMO = this.rtbMemo.Text; temp_product.DEL_FLAG = "N"; temp_product.Save(); MessageBox.Show("保存成功"); //4. 判断显示状态 if (this.opStatus) { //a.显示(派生历史记录,ERC,文档,图纸,技术任务单,产品结构,版本)等tab页面 this.tabControl.TabPages.Add(tab_Doc); this.tabControl.TabPages.Add(tab_Drawing); this.tabControl.TabPages.Add(tab_ExtPro); //b.改变显示属性(产品清空状态 ,产品配置状态) this.opStatus = false; } //5.更新(派生历史记录,ERC,文档,图纸,技术任务单,产品结构,版本)等tab页面列表显示,更新基本属性信息 this.m_product = temp_product; allinit(); }
//保存按钮操作 private void bt_save_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.tb_materailNo.Text)) { MessageBox.Show("请填写编号"); return; } DataTable dt = m_MaterailService.GetListByNoDetail(this.tb_materailNo.Text.Trim()); //1.判断产品是否存在,如果存在是否生产新版本 if (dt.Rows.Count > 0) { if (MessageBox.Show("该编号材料已存在,是否生成新版本?\n如果不是请更改产品编号!", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } } HYPDM.Entities.PDM_MATERAIL temp_materail = new Entities.PDM_MATERAIL(); temp_materail.MATERIALID = Guid.NewGuid().ToString(); temp_materail.MATERIALNO = this.tb_materailNo.Text; temp_materail.MODELTYPE = this.tb_modelType.Text; temp_materail.MATERIALTYPE = this.tb_materailType.Text; temp_materail.RAWMATERIAL = this.tb_rawMaterail.Text; temp_materail.MATERIALSRC = this.tb_materailSrc.Text; temp_materail.VERSION = "V" + DateTime.Now.ToString("yyyyMMddHHmmss"); temp_materail.CREATER = LoginInfo.LoginID;// CommonVar.userName; // temp_materail.MODIFIER= temp_materail.CTREATETIME = DateTime.Now.ToString(); //temp_materail.MODIFYTIME; temp_materail.MEMO_ZH = this.tb_memoZh.Text; temp_materail.MEMO_EN = this.tb_memoEn.Text; temp_materail.MEMO = this.rtb_Memo.Text; temp_materail.Save(); this.m_materail = temp_materail; this.DialogResult = DialogResult.OK; }