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();
                }
            }
        }
Beispiel #2
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();
                }
            }
        }