예제 #1
0
        ////自定义绑定请购部门
        //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);
                }
            }
        }
예제 #2
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明细
         }
     }
 }
예제 #3
0
        private void toolStripSave_Click(object sender, EventArgs e)
        {
            if (!valid.validateNull(this.s_Pname.Text.Trim()))
            {
                MessageBox.Show("领取物料品名不能为空", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.s_Pname.Focus();
                return;
            }
            if (!valid.validateNull(this.s_Person.Text.Trim()))
            {
                MessageBox.Show("领料人姓名不能为空", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.s_Person.Focus();
                return;
            }

            if (!valid.validateNull(this.s_Amount.Text.Trim()))
            {
                MessageBox.Show("领取物料数量不能为空", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.s_Amount.Focus();
                return;
            }
            else if (!valid.validateNum(this.s_Amount.Text.Trim()))
            {
                MessageBox.Show("领取物料数量只能是数字类型", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.s_Amount.Focus();
                return;
            }

            HY_Model.HY_Requisitioned hyreqmodel = new HY_Model.HY_Requisitioned();
            hyreqmodel.R_DID            = this.label1.Text;
            hyreqmodel.R_CID            = this.s_CID.Text.Trim();
            hyreqmodel.R_Person         = this.s_Person.Text.Trim();
            hyreqmodel.R_PID            = this.s_PID.Text.Trim();
            hyreqmodel.R_Pname          = this.s_Pname.Text.Trim();
            hyreqmodel.R_LDate          = Convert.ToDateTime(this.s_DDate.Value);
            hyreqmodel.R_Specifications = this.s_Specifications.Text.Trim();
            hyreqmodel.R_Price          = this.s_Price.Text.Trim();
            hyreqmodel.R_Class          = this.s_Class.Text;
            hyreqmodel.R_Amount         = int.Parse(this.s_Amount.Text);
            hyreqmodel.R_Warehouse      = this.s_Warehouse.Text;
            hyreqmodel.R_Notes          = this.s_Notes.Text.Trim();

            if (intFalg == 1)
            {
                string sql = "insert into HY_Receiving(r_DID,r_CID,r_Person,r_Class,r_Warehouse,r_LDate,r_PID,r_Pname,r_Specifications,r_Amount,r_Price,r_Notes) values('" + hyreqmodel.R_DID + "','" + hyreqmodel.R_CID + "','" + hyreqmodel.R_Person + "','" + hyreqmodel.R_Class + "','" + hyreqmodel.R_Warehouse + "','" + hyreqmodel.R_LDate + "','" + hyreqmodel.R_PID + "','" + hyreqmodel.R_Pname + "','" + hyreqmodel.R_Specifications + "','" + hyreqmodel.R_Amount + "','" + hyreqmodel.R_Price + "','" + hyreqmodel.R_Notes + "')";
                int    res = hyreqbll.com_HY_ProductionPlanninglist(sql);
                if (res > 0)
                {
                    //更新库存数量
                    string sql1 = "update HY_Storage set s_Amount=s_Amount-'" + hyreqmodel.R_Amount + "' where s_PID='" + hyreqmodel.R_PID + "'";
                    hyreqbll.com_HY_ProductionPlanninglist(sql1);
                    //写入log库存表
                    string sqllog = "insert into HY_StorageLog(s_DID,s_CID,s_Person,s_Class,s_Warehouse,s_XDate,s_DDate,s_PID,s_Pname,s_Specifications,s_Amount,s_Price,s_Notes,s_State) values('" + hyreqmodel.R_DID + "','" + hyreqmodel.R_CID + "','" + hyreqmodel.R_Person + "','" + hyreqmodel.R_Class + "','" + hyreqmodel.R_Warehouse + "','" + hyreqmodel.R_LDate + "','" + hyreqmodel.R_LDate + "','" + hyreqmodel.R_PID + "','" + hyreqmodel.R_Pname + "','" + hyreqmodel.R_Specifications + "','" + hyreqmodel.R_Amount + "','" + hyreqmodel.R_Price + "','" + hyreqmodel.R_Notes + "','仓库领料')";
                    hyreqbll.com_HY_ProductionPlanninglist(sqllog);
                    MessageBox.Show("领料单添加成功,确定后可以继续添加", "操作提示", MessageBoxButtons.OK);
                    requistionDate();
                }
            }
            if (intFalg == 2)
            {
                string sql = "update HY_Receiving set r_DID='" + hyreqmodel.R_DID + "',r_Person='" + hyreqmodel.R_Person + "',r_Class='" + hyreqmodel.R_Class + "',r_Warehouse='" + hyreqmodel.R_Warehouse + "',r_LDate='" + hyreqmodel.R_LDate + "',r_Pname='" + hyreqmodel.R_Pname + "',r_Specifications='" + hyreqmodel.R_Specifications + "',r_Amount='" + hyreqmodel.R_Amount + "',r_Price='" + hyreqmodel.R_Price + "',r_Notes='" + hyreqmodel.R_Notes + "' where r_PID='" + hyreqmodel.R_PID + "'";
                int    res = hyreqbll.com_HY_ProductionPlanninglist(sql);
                if (res > 0)
                {
                    //更新库存数量
                    //string sql1 = "update HY_Storage set s_Amount=s_Amount-'" + hyreqmodel.R_Amount + "' where s_PID='" + hyreqmodel.R_PID + "'";
                    //hyreqbll.com_HY_ProductionPlanninglist(sql1);
                    MessageBox.Show("领料单信息修改成功,确定后可以继续操作", "操作提示", MessageBoxButtons.OK);
                    requistionDate();
                }
            }
        }