/// <summary> /// 新增请购单信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public int com_RequisitionInfo(HY_Model.HY_RequisitionInfo model) { try { string sql = "insert into HY_RequisitionInfo(r_DID,r_CID,r_NameID,r_Department,r_Person,r_Name,r_Supplier,r_Origin,r_QDate,r_XDate,r_Specifications,r_Units,r_Amount,r_Uses,r_Notes,r_Hot) values('" + model.R_DID + "','" + model.R_CID + "','" + model.R_NameID + "','" + model.R_Department + "','" + model.R_Person + "','" + model.R_Name + "','" + model.R_Supplier + "','" + model.R_Origin + "','" + model.R_QDate + "','" + model.R_XDate + "','" + model.R_Specifications + "','" + model.R_Units + "','" + model.R_Amount + "','" + model.R_Uses + "','" + model.R_Notes + "','" + model.R_Hot + "')"; HY_DbSqlHelp.DBsqlHelp hy_help = new DBsqlHelp(); int res = hy_help.insertEx(sql); return(res); } catch (Exception EX) { throw EX; } }
/// <summary> /// 新增请购单信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public int com_RequisitionInfo(HY_Model.HY_RequisitionInfo model) { return(hyrepinfo.com_RequisitionInfo(model)); }
////自定义绑定请购部门 //private void hy_Department() //{ // HY_BLL.HY_DepartmentBLL hydep = new HY_DepartmentBLL(); // string sql = "select * from HY_Department"; // this.r_Department.DataSource = hydep.ExecuteQuery(sql); // this.r_Department.DisplayMember = "d_Name"; //} //保存请购单 private void toolStripSave_Click(object sender, EventArgs e) { if (!valid.validateNull(this.r_Person.Text.Trim())) { MessageBoxEx.Show("请购人不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.r_Person.Focus(); return; } if (!valid.validateNull(this.r_Name.Text.Trim())) { MessageBoxEx.Show("品名不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.r_Name.Focus(); return; } if (!valid.validateNull(this.r_Supplier.Text)) { MessageBoxEx.Show("供应商不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.r_Supplier.Focus(); return; } if (!valid.validateNull(this.r_Origin.Text.Trim())) { MessageBoxEx.Show("产品型号不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.r_Origin.Focus(); return; } if (!valid.validateNull(this.r_XDate.Text.Trim())) { MessageBoxEx.Show("需要日期不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.r_XDate.Focus(); return; } if (!valid.validateNull(this.r_Specifications.Text.Trim())) { MessageBoxEx.Show("产品规格不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.r_Specifications.Focus(); return; } if (!valid.validateNull(this.r_Units.Text)) { MessageBoxEx.Show("产品单位不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.r_Units.Focus(); return; } if (!valid.validateNull(this.r_Amount.Text.Trim())) { MessageBoxEx.Show("产品数量不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.r_Amount.Focus(); return; } else if (!valid.validateNum(this.r_Amount.Text.Trim())) { MessageBoxEx.Show("产品数量只能输入数字类型!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.r_Amount.Focus(); return; } HY_Model.HY_RequisitionInfo hyrepinfo = new HY_RequisitionInfo(); hyrepinfo.R_DID = this.r_ID.Text; hyrepinfo.R_CID = this.r_CID.Text.Trim(); hyrepinfo.R_NameID = this.r_NameID.Text; hyrepinfo.R_Department = this.r_Department.Text; hyrepinfo.R_Person = this.r_Person.Text; hyrepinfo.R_Name = this.r_Name.Text.Trim(); hyrepinfo.R_Supplier = this.r_Supplier.Text.Trim(); hyrepinfo.R_Origin = this.r_Origin.Text.Trim(); hyrepinfo.R_QDate = this.r_QDate.Value.Date; hyrepinfo.R_XDate = this.r_XDate.Value.Date; hyrepinfo.R_Specifications = this.r_Specifications.Text.Trim(); hyrepinfo.R_Units = this.r_Units.Text.Trim(); hyrepinfo.R_Amount = int.Parse(this.r_Amount.Text); hyrepinfo.R_Uses = this.r_Uses.Text.Trim(); hyrepinfo.R_Notes = this.r_Notes.Text.Trim(); hyrepinfo.R_Hot = this.r_Hot.Text.Trim(); //添加动作 if (intFalg == 1) { int res = hyrepinfobll.com_RequisitionInfo(hyrepinfo); if (res > 0) { MessageBoxEx.Show("请购信息添加成功! 确定后可继续添加", "操作提示", MessageBoxButtons.OK); this.r_NameID.Text = ""; this.r_Name.Text = ""; this.r_Supplier.Text = ""; this.r_Origin.Text = ""; this.r_Specifications.Text = ""; this.r_Units.Text = ""; this.r_Amount.Text = ""; this.r_Uses.Text = ""; this.r_Notes.Text = ""; this.r_Hot.Text = ""; q_PID();//更新品号 this.listView1.Items.Clear(); listViewDate(sql); } } //修改动作 if (intFalg == 2) { string sql = "update HY_RequisitionInfo set r_DID='" + hyrepinfo.R_DID + "',r_Department='" + hyrepinfo.R_Department + "',r_Person='" + hyrepinfo.R_Person + "',r_Name='" + hyrepinfo.R_Name + "',r_Supplier='" + hyrepinfo.R_Supplier + "',r_Origin='" + hyrepinfo.R_Origin + "',r_QDate='" + hyrepinfo.R_QDate + "',r_XDate='" + hyrepinfo.R_XDate + "',r_Specifications='" + hyrepinfo.R_Specifications + "',r_Units='" + hyrepinfo.R_Units + "',r_Amount='" + hyrepinfo.R_Amount + "',r_Uses='" + hyrepinfo.R_Uses + "',r_Hot='" + hyrepinfo.R_Hot + "' where r_NameID='" + this.r_NameID.Text + "'"; int res = hyrepinfobll.com_ExecuteQuery(sql); if (res > 0) { MessageBoxEx.Show("请购信息更新修改成功! 确定后可继续操作", "操作提示", MessageBoxButtons.OK); this.r_ID.Text = ""; this.r_NameID.Text = ""; this.r_Department.Text = ""; this.r_Person.Text = ""; this.r_Name.Text = ""; this.r_Supplier.Text = ""; this.r_Origin.Text = ""; this.r_Specifications.Text = ""; this.r_Units.Text = ""; this.r_Amount.Text = ""; this.r_Uses.Text = ""; this.r_Notes.Text = ""; this.r_Hot.Text = ""; this.groupA.Enabled = false; this.groupB.Enabled = false; this.groupPaneA.Enabled = true; this.groupPaneB.Enabled = true; this.groupPaneC.Enabled = true; this.toolStripADD.Enabled = true; this.toolStripCEL.Enabled = false; this.toolStripSave.Enabled = false; this.toolStripDEL.Enabled = false; this.toolStripUPD.Enabled = false; this.toolStripSave.Enabled = false; this.listView1.Items.Clear(); string sqlupdate = "select distinct r_DID,r_State,r_CID from HY_RequisitionInfo"; listViewDate(sqlupdate); } } }