//采购中状态 private void btnCGZ_Click(object sender, EventArgs e) { string sqlcgz = "Update HY_ProcurementInfo set c_State=1 where c_DID='" + this.did.Text + "'"; int res = hyrepinfobll.com_ExecuteQuery(sqlcgz); if (res > 0) { MessageBoxEx.Show("采购状态确认成功", "错误提示", MessageBoxButtons.OK); this.paneStat.Visible = false; this.Close(); } }
private void btnTO_Click(object sender, EventArgs e) { string did = this.b_BID.Text.Trim(); if (did == string.Empty) { MessageBoxEx.Show("请输入物料单号!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error); this.b_BID.Focus(); return; } did = did.Replace("B", "QG"); HY_BLL.HY_BomDetailsBLL hybom = new HY_BomDetailsBLL(); string sql = "select b_HDate from HY_BomInfo where b_SKID='" + did + "'"; SqlDataReader sdr = hybom.f_SQLBom(sql); while (sdr.Read()) { if (sdr[0].ToString() == string.Empty) { MessageBoxEx.Show("此物料单还未审核,请部门经理审核后再抛单", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error); } } HY_BLL.HY_RequisitionInfoBLL hyrepinfobll = new HY_RequisitionInfoBLL(); string fsql = "select * from HY_RequisitionInfo where r_DID='" + did + "'"; DataTable f = hyrepinfobll.ExecuteQuery(fsql); if (f.Rows.Count > 0) { MessageBox.Show("此请购单已抛转成采购单无需重复抛单!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error); this.b_BID.Text = ""; } else { string sql2 = "insert into HY_RequisitionInfo(r_DID,r_CID,r_NameID,r_Name,r_Person,r_Origin,r_Specifications,r_Amount,r_Hot,r_Notes,r_QDate,r_ModClass) select REPLACE(d_SKID,'B','QG'),d_CID,d_PID,d_PName,d_SPerson,d_Model,d_Specifications,d_Amount,d_Heat,d_Notes,'" + DateTime.Now + "',d_ModClass from HY_BomDetails WHERE d_SKID='" + this.b_BID.Text.Trim() + "'"; int res = hyrepinfobll.com_ExecuteQuery(sql2); if (res > 0) { MessageBox.Show("恭喜:请购单抛转采购单成功!", "提示", MessageBoxButtons.OK); } } }
////自定义绑定请购部门 //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); } } }
private void btnTO_Click(object sender, EventArgs e) { string did = this.q_DID.Text.Trim(); if (did == string.Empty) { MessageBoxEx.Show("请输入请购单号后在执行抛单!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.q_DID.Focus(); return; } HY_BLL.HY_RequisitionInfoBLL hyrepinfobll = new HY_RequisitionInfoBLL(); did = did.Replace("QG", "CG"); string fsq0 = "select r_DID,r_Supplier,r_State from HY_RequisitionInfo where r_DID='" + this.q_DID.Text.Trim() + "'"; string fsql = "select c_DID from HY_ProcurementInfo where c_DID='" + did + "'"; DataTable fh = hyrepinfobll.ExecuteQuery(fsq0); DataTable f = hyrepinfobll.ExecuteQuery(fsql); if (fh.Rows.Count > 0) { if (fh.Rows[0][1].ToString() == string.Empty) { MessageBoxEx.Show("此请购单供应商等信息没有添加,请添加后抛单!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.q_DID.Text = ""; return; } if (fh.Rows[0][2].ToString() == "确认中") { MessageBoxEx.Show("此请购单等待确认中,确认后方可操作!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.q_DID.Text = ""; return; } } if (f.Rows.Count > 0) { MessageBoxEx.Show("此请购单已抛转成采购单无需重复抛单!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.q_DID.Text = ""; } else { string sql = "insert into HY_ProcurementInfo(c_DID,c_CID,c_Department,c_Person,c_Name,c_NameID,c_Supplier,c_Origin,c_QDate,c_XDate,c_Specifications,c_Units,c_Uses,c_Notes,c_Hot,c_Amount,c_ModClass) select REPLACE(r_DID,'QG','CG'),r_CID,r_Department,r_Person,r_Name,r_NameID,r_Supplier,r_Origin,r_QDate,r_XDate,r_Specifications,r_Units,r_Uses,r_Notes,r_Hot,r_Amount,r_ModClass from HY_RequisitionInfo WHERE r_DID='" + this.q_DID.Text.Trim() + "'"; int res = hyrepinfobll.com_ExecuteQuery(sql); if (res > 0) { MessageBoxEx.Show("恭喜:请购单抛转采购单成功!", "提示", MessageBoxButtons.OK); this.Close(); } } }