//检索数据 private void btnOK_Click(object sender, EventArgs e) { string k = this.key.Text.Trim(); if (!valid.validateNull(k)) { MessageBoxEx.Show("检索关键字不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.key.Focus(); return; } switch (this.comboBoxClass.SelectedIndex) { case 0: string sql0 = "select s_ID,s_DID,s_CID,s_Supplier,s_Person,s_Class,s_Warehouse,s_XDate,s_DDate,s_PID,s_Pname,s_Origin,s_Specifications,s_Amount,s_Notes,s_WFDate,s_DWDate,s_WFSup,s_WFDateHot,s_DWDateHot,s_WFHotSup,s_WFDateBM,s_DWDateBM,s_WFSupBM from HY_Storage where s_CID like '%" + k + "%'"; requistionDate(sql0); break; case 1: string sql1 = "select s_ID,s_DID,s_CID,s_Supplier,s_Person,s_Class,s_Warehouse,s_XDate,s_DDate,s_PID,s_Pname,s_Origin,s_Specifications,s_Amount,s_Notes,s_WFDate,s_DWDate,s_WFSup,s_WFDateHot,s_DWDateHot,s_WFHotSup,s_WFDateBM,s_DWDateBM,s_WFSupBM from HY_Storage where s_Pname like '%" + k + "%'"; requistionDate(sql1); break; case 2: string sql2 = "select s_ID,s_DID,s_CID,s_Supplier,s_Person,s_Class,s_Warehouse,s_XDate,s_DDate,s_PID,s_Pname,s_Origin,s_Specifications,s_Amount,s_Notes,s_WFDate,s_DWDate,s_WFSup,s_WFDateHot,s_DWDateHot,s_WFHotSup,s_WFDateBM,s_DWDateBM,s_WFSupBM from HY_Storage where s_DID like '%" + k + "%'"; requistionDate(sql2); break; } }
private void toolStripSave_Click(object sender, EventArgs e) { hycustoomodel.O_Name = this.c_Name.Text.Trim(); hycustoomodel.C_FID = this.c_FID.Text.Trim(); if (!valid.validateNull(hycustoomodel.O_Name)) { MessageBoxEx.Show("提示信息:客户名不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.c_Name.Focus(); return; } if (!valid.validateNull(hycustoomodel.C_FID)) { MessageBoxEx.Show("提示信息:客户番号不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.c_FID.Focus(); return; } if (intFalg == 1) { string sql = "insert into HY_CustomerInfo(c_Name,c_FID) values('" + hycustoomodel.O_Name + "','" + hycustoomodel.C_FID + "')"; int res = hycustobll.com_HY_CustomerInfo(sql); if (res > 0) { MessageBoxEx.Show("客户信息添加成功,确定后可继续添加"); this.c_FID.Text = ""; this.c_Name.Text = ""; f_CustomerInfo(); } else { return; } } if (intFalg == 2) { string sql = "update HY_CustomerInfo set c_Name='" + hycustoomodel.O_Name + "',c_FID='" + hycustoomodel.C_FID + "' where c_ID='" + this.label3.Text + "'"; int res = hycustobll.com_HY_CustomerInfo(sql); if (res > 0) { MessageBoxEx.Show("客户信息更新成功,确定返回"); f_CustomerInfo(); } else { return; } } }
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明细 } } }
////自定义绑定请购部门 //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 toolStripSave_Click(object sender, EventArgs e) { string sid = this.dataGridViewDD[0, this.dataGridViewDD.CurrentCell.RowIndex].Value.ToString(); HY_Model.HY_CustomerInfo hycusmodel = new HY_Model.HY_CustomerInfo(); hycusmodel.O_Name = this.o_Name.Text; hycusmodel.C_FID = this.o_FID.Text; hycusmodel.O_CPName = this.o_CPName.Text.Trim(); hycusmodel.O_Person = this.o_Person.Text.Trim(); hycusmodel.O_Notes = this.o_Notes.Text.Trim(); hycusmodel.O_RDate = System.DateTime.Now.Date; hycusmodel.O_XDate = this.o_XDate.Value.Date; hycusmodel.O_JDate = this.o_JDate.Value.Date; hycusmodel.O_DID = this.label6.Text; hycusmodel.O_Amount = this.o_Amount.Text.Trim(); hycusmodel.O_Class = this.o_Class.Text.Trim(); if (!valid.validateNull(hycusmodel.O_Name)) { MessageBoxEx.Show("提示:客户名称不能为空", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!valid.validateNull(hycusmodel.O_CPName)) { MessageBoxEx.Show("提示:厂内编号不能为空", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error); this.o_CPName.Focus(); return; } if (!valid.validateNull(hycusmodel.O_Person)) { MessageBoxEx.Show("提示:录单人不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error); this.o_Person.Focus(); return; } if (!valid.validateNull(hycusmodel.O_Amount)) { MessageBoxEx.Show("提示:数量不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error); this.o_Amount.Focus(); return; } if (!valid.validateNull(hycusmodel.O_Class)) { MessageBoxEx.Show("提示:模具类型名称不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error); this.o_Class.Focus(); return; } //添加动作 if (intFalg == 1) { string sql = "insert into HY_CustomerOrder(o_DID,o_Name,o_FID,o_CPName,o_Person,o_RDate,o_Notes,o_XDate,o_JDate,o_Amount,o_Class) values('" + hycusmodel.O_DID + "','" + hycusmodel.O_Name + "','" + hycusmodel.C_FID + "','" + hycusmodel.O_CPName + "','" + hycusmodel.O_Person + "','" + hycusmodel.O_RDate + "','" + hycusmodel.O_Notes + "','" + hycusmodel.O_XDate + "','" + hycusmodel.O_JDate + "','" + hycusmodel.O_Amount + "','" + hycusmodel.O_Class + "')"; int res = hycustobll.com_HY_CustomerInfo(sql); if (res > 0) { MessageBoxEx.Show("客户订单添加成功"); f_CustomerInfo(); this.o_Name.Text = ""; this.o_FID.Text = ""; this.o_Person.Text = ""; this.o_CPName.Text = ""; this.o_Amount.Text = ""; this.o_Class.Text = ""; this.o_XDate.Text = ""; this.o_JDate.Text = ""; this.o_Notes.Text = ""; this.groupBox1.Enabled = false; this.groupBox2.Enabled = true; } } //修改动作 if (intFalg == 2) { string sql = "update HY_CustomerOrder set o_Name='" + hycusmodel.O_Name + "',o_FID='" + hycusmodel.C_FID + "',o_CPName='" + hycusmodel.O_CPName + "',o_Person='" + hycusmodel.O_Person + "',o_RDate='" + hycusmodel.O_RDate + "',o_Notes='" + hycusmodel.O_Notes + "',o_Amount='" + hycusmodel.O_Amount + "',o_Class='" + hycusmodel.O_Class + "',o_XDate='" + hycusmodel.O_XDate + "',o_JDate='" + hycusmodel.O_JDate + "' where o_DID='" + sid + "'"; int res = hycustobll.com_HY_CustomerInfo(sql); if (res > 0) { MessageBoxEx.Show("客户订单修改成功"); f_CustomerInfo(); this.o_Name.Text = ""; this.o_FID.Text = ""; this.o_Person.Text = ""; this.o_CPName.Text = ""; this.o_Amount.Text = ""; this.o_Class.Text = ""; this.o_XDate.Text = ""; this.o_JDate.Text = ""; this.o_Notes.Text = ""; this.groupBox1.Enabled = false; this.groupBox2.Enabled = true; } } }
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(); } } }
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(); } } } } }
private void toolStripSave_Click(object sender, EventArgs e) { if (!valid.validateNull(this.p_PID.Text.Trim())) { MessageBoxEx.Show("模号不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.p_PID.Focus(); return; } if (!valid.validateNull(this.p_PName.Text.Trim())) { MessageBoxEx.Show("品名不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.p_PName.Focus(); return; } if (!valid.validateNull(this.p_Price.Text.Trim())) { MessageBoxEx.Show("单价不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.p_Price.Focus(); return; } if (!valid.validateNull(this.p_Weight.Text.Trim())) { MessageBoxEx.Show("重量不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.p_Weight.Focus(); return; } //添加动作 if (intFalg == 1) { HY_Model.HY_SupplierPrice sup = new HY_Model.HY_SupplierPrice(); sup.P_DID = this.p_ID.Text.Trim(); sup.P_PID = this.p_PID.Text.Trim(); sup.P_PName = this.p_PName.Text.Trim(); sup.P_gyName = this.p_gyName.Text; sup.P_Date = (DateTime)(this.p_Date.Value.Date); sup.P_Price = int.Parse(this.p_Price.Text.Trim()); sup.P_Weight = this.p_Weight.Text.Trim(); sup.P_Vray = this.p_Vray.Text.Trim(); sup.P_SM = this.p_SM.Text.Trim(); sup.P_rPerson = this.p_rPerson.Text; int res = supbll.com_SupplierPrice(sup); if (res > 0) { MessageBoxEx.Show("提示信息:物料信息添加成功,您可以继续添加物料信息!", "操作提示信息"); this.p_PID.Text = ""; this.p_Weight.Text = ""; this.p_Vray.Text = ""; this.p_PName.Text = ""; this.p_Price.Text = ""; this.p_SM.Text = ""; string d = "DH"; this.p_ID.Text = hyNO.JhGoodsID(d); gyInfo(); } } //修改动作 if (intFalg == 2) { string id = this.dataGridViewSupplierPrice[0, this.dataGridViewSupplierPrice.CurrentCell.RowIndex].Value.ToString(); string sql = "update HY_SupplierPrice set p_DID='" + this.p_ID.Text.Trim() + "',p_PID='" + this.p_PID.Text.Trim() + "',p_gyName='" + this.p_gyName.Text + "',p_Date='" + this.p_Date.Value.Date + "',p_PName='" + this.p_PName.Text.Trim() + "',p_Price='" + this.p_Price.Text.Trim() + "',p_Weight='" + this.p_Weight.Text.Trim() + "',p_Vray='" + this.p_Vray.Text.Trim() + "',p_SM='" + this.p_SM.Text.Trim() + "',p_rPerson='" + this.p_rPerson.Text + "' where p_DID='" + id + "'"; int res = supbll.f_SupplierPrice(sql); if (res > 0) { MessageBoxEx.Show("请购信息更新修改成功!", "操作提示", MessageBoxButtons.OK); gyInfo();//绑定数据显示 } } }