/// <summary>
 /// 新增BOM物料明细
 /// </summary>
 /// <param name="model">BOM物料明细MODEL实体类</param>
 /// <returns></returns>
 public int com_HY_BomDetailslist(HY_Model.HY_BomDetails model)
 {
     try
     {
         string sql = "insert into HY_BomDetails(d_SKID,d_CID,d_PID,d_PName,d_Model,d_Specifications,d_Amount,d_Heat,d_Notes,d_SPerson,d_ModClass) values('" + model.D_SKID + "','" + model.D_CID + "','" + model.D_PID + "','" + model.D_PName + "','" + model.D_Model + "','" + model.D_Specifications + "','" + model.D_Amount + "','" + model.D_Heat + "','" + model.D_Notes + "','" + model.D_SPerson + "','" + model.ModClass + "')";
         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)
 {
     #region 数据验证部分
     if (!valid.validateNull(this.d_SKID.Text.Trim()))
     {
         MessageBoxEx.Show("所属物料单号不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.d_SKID.Focus();
         return;
     }
     if (!valid.validateNull(this.d_Name.Text.Trim()))
     {
         MessageBoxEx.Show("品名不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.d_Name.Focus();
         return;
     }
     if (!valid.validateNull(this.d_Model.Text.Trim()))
     {
         MessageBoxEx.Show("材料型号不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.d_Model.Focus();
         return;
     }
     if (!valid.validateNull(this.d_Model.Text.Trim()))
     {
         MessageBoxEx.Show("材料规格不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.d_Model.Focus();
         return;
     }
     if (!valid.validateNull(this.d_Amount.Text.Trim()))
     {
         MessageBoxEx.Show("材料数量不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.d_Amount.Focus();
         return;
     }
     else if (!valid.validateNum(this.d_Amount.Text.Trim()))
     {
         MessageBoxEx.Show("材料数量只能填写数字类型!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.d_Amount.Focus();
         return;
     }
     if (!valid.validateNull(this.d_Heat.Text.Trim()))
     {
         MessageBoxEx.Show("热处理不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.d_Heat.Focus();
         return;
     }
     #endregion
     #region 实体类
     HY_Model.HY_BomDetails hybommodel = new HY_Model.HY_BomDetails();
     hybommodel.D_SKID           = this.d_SKID.Text.Trim();
     hybommodel.D_CID            = this.d_CID.Text.Trim();
     hybommodel.D_PID            = this.d_PID.Text.Trim();
     hybommodel.D_PName          = this.d_Name.Text.Trim();
     hybommodel.D_Model          = this.d_Model.Text.Trim();
     hybommodel.D_Specifications = this.d_Specifications.Text.Trim();
     hybommodel.D_Amount         = this.d_Amount.Text.Trim();
     hybommodel.D_Heat           = this.d_Heat.Text.Trim();
     hybommodel.D_Notes          = this.d_Notes.Text.Trim();
     hybommodel.D_SPerson        = this.d_SPerson.Text.Trim();
     hybommodel.ModClass         = this.label1.Text;
     #endregion
     //保存动作
     if (intFalg == 1)
     {
         //实例化BOM明细
         int res = hybombll.com_HY_BomDetailslist(hybommodel);
         if (res > 0)
         {
             MessageBoxEx.Show("BOM明细添加成功,确定后可继续添加明细", "操作提示", MessageBoxButtons.OK);
             b_PID();//绑定品号
             this.d_Name.Text           = "";
             this.d_Model.Text          = "";
             this.d_Specifications.Text = "";
             this.d_Amount.Text         = "";
             this.d_Heat.Text           = "";
             this.d_Notes.Text          = "";
             requistionDate();//绑定BOM明细
         }
     }
     //修改动作
     if (intFalg == 2)
     {
         //实例化BOM明细
         string sql = "Update HY_BomDetails set d_PID='" + hybommodel.D_PID + "',d_PName='" + hybommodel.D_PName + "',d_Model='" + hybommodel.D_Model + "',d_Specifications='" + hybommodel.D_Specifications + "',d_Amount='" + hybommodel.D_Amount + "',d_Heat='" + hybommodel.D_Heat + "',d_Notes='" + hybommodel.D_Notes + "',d_SPerson='" + hybommodel.D_SPerson + "',d_ModClass='" + hybommodel.ModClass + "' where d_PID='" + hybommodel.D_PID + "'";
         int    res = hybombll.f_HYBomDetailslist(sql);
         if (res > 0)
         {
             MessageBoxEx.Show("BOM明细信息修改成功!", "操作提示", MessageBoxButtons.OK);
             this.groupBoxA.Enabled     = false;
             this.groupBoxB.Enabled     = false;
             this.groupBoxC.Enabled     = true;
             this.d_Name.Text           = "";
             this.d_Model.Text          = "";
             this.d_Specifications.Text = "";
             this.d_Amount.Text         = "";
             this.d_Heat.Text           = "";
             this.d_Notes.Text          = "";
             requistionDate();//绑定BOM明细
         }
     }
 }
Example #3
0
        private void toolStripSave_Click(object sender, EventArgs e)
        {
            #region 数据验证部分
            if (!valid.validateNull(this.d_SKID.Text.Trim()))
            {
                MessageBoxEx.Show("所属物料单号不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.d_SKID.Focus();
                return;
            }
            if (!valid.validateNull(this.d_Name.Text.Trim()))
            {
                MessageBoxEx.Show("品名不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.d_Name.Focus();
                return;
            }
            if (!valid.validateNull(this.d_Model.Text.Trim()))
            {
                MessageBoxEx.Show("材料型号不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.d_Model.Focus();
                return;
            }
            if (!valid.validateNull(this.d_Model.Text.Trim()))
            {
                MessageBoxEx.Show("材料规格不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.d_Model.Focus();
                return;
            }
            if (!valid.validateNull(this.d_Amount.Text.Trim()))
            {
                MessageBoxEx.Show("材料数量不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.d_Amount.Focus();
                return;
            }
            else if (!valid.validateNum(this.d_Amount.Text.Trim()))
            {
                MessageBoxEx.Show("材料数量只能填写数字类型!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.d_Amount.Focus();
                return;
            }
            if (!valid.validateNull(this.d_Heat.Text.Trim()))
            {
                MessageBoxEx.Show("热处理不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.d_Heat.Focus();
                return;
            }
            #endregion
            #region 实体类
            HY_Model.HY_BomDetails hybommodel = new HY_Model.HY_BomDetails();
            hybommodel.D_SKID = this.d_SKID.Text.Trim();
            hybommodel.D_CID = this.d_CID.Text.Trim();
            hybommodel.D_PID = this.d_PID.Text.Trim();
            hybommodel.D_PName = this.d_Name.Text.Trim();
            hybommodel.D_Model = this.d_Model.Text.Trim();
            hybommodel.D_Specifications = this.d_Specifications.Text.Trim();
            hybommodel.D_Amount = this.d_Amount.Text.Trim();
            hybommodel.D_Heat = this.d_Heat.Text.Trim();
            hybommodel.D_Notes = this.d_Notes.Text.Trim();
            hybommodel.D_SPerson = this.d_SPerson.Text.Trim();
            hybommodel.ModClass = this.label1.Text;
            #endregion
            //保存动作
            if (intFalg==1)
            {
                //实例化BOM明细
                int res = hybombll.com_HY_BomDetailslist(hybommodel);
                if (res > 0)
                {
                    MessageBoxEx.Show("BOM明细添加成功,确定后可继续添加明细","操作提示",MessageBoxButtons.OK);
                    b_PID();//绑定品号
                    this.d_Name.Text = "";
                    this.d_Model.Text = "";
                    this.d_Specifications.Text = "";
                    this.d_Amount.Text = "";
                    this.d_Heat.Text = "";
                    this.d_Notes.Text = "";
                    requistionDate();//绑定BOM明细
                }
            }
            //修改动作
            if (intFalg == 2)
            {

                //实例化BOM明细
                string sql = "Update HY_BomDetails set d_PID='" + hybommodel.D_PID + "',d_PName='" + hybommodel.D_PName + "',d_Model='" + hybommodel.D_Model + "',d_Specifications='" + hybommodel.D_Specifications + "',d_Amount='" + hybommodel.D_Amount + "',d_Heat='" + hybommodel.D_Heat + "',d_Notes='" + hybommodel.D_Notes + "',d_SPerson='" + hybommodel.D_SPerson + "',d_ModClass='" + hybommodel.ModClass + "' where d_PID='" + hybommodel.D_PID + "'";
                int res = hybombll.f_HYBomDetailslist(sql);
                if (res > 0)
                {
                    MessageBoxEx.Show("BOM明细信息修改成功!", "操作提示", MessageBoxButtons.OK);
                    this.groupBoxA.Enabled = false;
                    this.groupBoxB.Enabled = false;
                    this.groupBoxC.Enabled = true;
                    this.d_Name.Text = "";
                    this.d_Model.Text = "";
                    this.d_Specifications.Text = "";
                    this.d_Amount.Text = "";
                    this.d_Heat.Text = "";
                    this.d_Notes.Text = "";
                    requistionDate();//绑定BOM明细
                }
            }
        }
 /// <summary>
 /// 新增BOM物料明细
 /// </summary>
 /// <param name="model">BOM物料明细MODEL实体类</param>
 /// <returns></returns>
 public int com_HY_BomDetailslist(HY_Model.HY_BomDetails model)
 {
     return(hybomdetal.com_HY_BomDetailslist(model));
 }