/// <summary> /// 新增BOM物料 /// </summary> /// <param name="model">BOM物料MODEL实体类</param> /// <returns></returns> public int com_HY_Bomlist(HY_Model.HY_Bomlist model) { try { string sql = "insert into HY_BomInfo(b_SKID,b_CID,b_CustomerID,b_No,b_Material,b_BomSize,b_Notes,b_Height,b_Tonnage,b_Name,b_ModClass,b_SPerson,b_Department,b_SDate) values('" + model.B_SKID + "','" + model.B_CID + "','" + model.B_CustomerID + "','" + model.B_No + "','" + model.B_Material + "','" + model.B_BomSize + "','" + model.B_Notes + "','" + model.B_Height + "','" + model.B_Tonnage + "','" + model.B_Name + "','" + model.B_ModClass + "','" + model.B_SPerson + "','" + model.B_Department + "','" + model.B_SDate + "')"; HY_DbSqlHelp.DBsqlHelp hy_help = new DBsqlHelp(); int res = hy_help.insertEx(sql); return(res); } catch (Exception EX) { throw EX; } }
private void toolStripSave_Click(object sender, EventArgs e) { if (!valid.validateNull(this.b_SPerson.Text.Trim())) { MessageBoxEx.Show("设计人不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.b_SPerson.Focus(); return; } if (!valid.validateNull(this.b_CID.Text.Trim())) { MessageBoxEx.Show("厂内编号不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.b_CID.Focus(); return; } if (!valid.validateNull(this.b_CustomerID.Text.Trim())) { MessageBoxEx.Show("客户编号不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.b_CustomerID.Focus(); return; } if (!valid.validateNull(this.b_No.Text.Trim())) { MessageBoxEx.Show("工程数不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.b_No.Focus(); return; } if (!valid.validateNull(this.b_Material.Text.Trim())) { MessageBoxEx.Show("料件材质不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.b_Material.Focus(); return; } if (!valid.validateNull(this.b_Height.Text.Trim())) { MessageBoxEx.Show("闭合高度不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.b_Height.Focus(); return; } if (!valid.validateNull(this.b_Tonnage.Text.Trim())) { MessageBoxEx.Show("冲床吨位不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.b_Tonnage.Focus(); return; } if (!valid.validateNull(this.b_BomSize.Text.Trim())) { MessageBoxEx.Show("用料尺寸不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.b_BomSize.Focus(); return; } if (!valid.validateNull(this.b_Name.Text.Trim())) { MessageBoxEx.Show("模具名称不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.b_Name.Focus(); return; } if (!valid.validateNull(this.b_ModClass.Text.Trim())) { MessageBoxEx.Show("模具类型不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.b_ModClass.Focus(); return; } HY_Model.HY_Bomlist hybomodel = new HY_Model.HY_Bomlist(); hybomodel.B_SKID = this.b_SKID.Text.Trim(); hybomodel.B_SPerson = this.b_SPerson.Text.Trim(); hybomodel.B_Department = this.b_Department.Text.Trim(); hybomodel.B_SDate = this.b_SDate.Value.Date; hybomodel.B_CID = this.b_CID.Text.Trim(); hybomodel.B_CustomerID = this.b_CustomerID.Text.Trim(); hybomodel.B_No = this.b_No.Text.Trim(); hybomodel.B_Material = this.b_Material.Text.Trim(); hybomodel.B_Height = this.b_Height.Text.Trim(); hybomodel.B_Tonnage = this.b_Tonnage.Text.Trim(); hybomodel.B_BomSize = this.b_BomSize.Text.Trim(); hybomodel.B_Notes = this.b_Notes.Text.Trim(); hybomodel.B_Name = this.b_Name.Text.Trim(); hybomodel.B_ModClass = this.b_ModClass.Text.Trim(); if (intFalg == 1) { int res = hybombll.com_HY_Bomlist(hybomodel); if (res > 0) { MessageBoxEx.Show("BOM单添加成功,确定后继续添加物料明细"); requistionDate(); } } if (intFalg == 2) { string did = this.dataGridViewBOM[0, this.dataGridViewBOM.CurrentCell.RowIndex].Value.ToString(); string sql1 = "Select b_SKID,b_Audit from HY_BomInfo where b_SKID='" + did + "'"; SqlDataReader dr = hybomdel.f_SQLBom(sql1); while (dr.Read()) { if (dr[1].ToString() == string.Empty) { string sql = "Update HY_BomInfo set b_SKID='" + hybomodel.B_SKID + "',b_CID='" + hybomodel.B_CID + "',b_CustomerID='" + hybomodel.B_CustomerID + "',b_No='" + hybomodel.B_No + "',b_Material='" + hybomodel.B_Material + "',b_BomSize='" + hybomodel.B_BomSize + "',b_Notes='" + hybomodel.B_Notes + "',b_Height='" + hybomodel.B_Height + "',b_Tonnage='" + hybomodel.B_Tonnage + "',b_Name='" + hybomodel.B_Name + "',b_SPerson='" + hybomodel.B_SPerson + "',b_Department='" + hybomodel.B_Department + "',b_SDate='" + hybomodel.B_SDate + "' where b_SKID='" + this.b_SKID.Text + "'"; int res = hybombll.com_HY_BomlistX(sql); if (res > 0) { MessageBoxEx.Show("BOM单修改修改成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); requistionDate(); } } } } }
/// <summary> /// 新增BOM物料 /// </summary> /// <param name="model">BOM物料MODEL实体类</param> /// <returns></returns> public int com_HY_Bomlist(HY_Model.HY_Bomlist model) { return(hybom.com_HY_Bomlist(model)); }