private void BtnOperate_Click(object sender, EventArgs e) { if (WPHbROWDGV.Rows.Count > 0) { Common.CommonForm comm = new Common.CommonForm("OrderCade='" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString() + "'", "CS_OutRuturnStorageOperate"); comm.ShowDialog(); } }
private void BtnOperate_Click(object sender, EventArgs e) { if (WPHbROWDGV.Rows.Count > 0) { Common.CommonForm comm = new Common.CommonForm("RID='" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["ID"].Value.ToString() + "'", "CS_ReturnMoneyOperate"); comm.ShowDialog(); } }
private void BtnNumber_Click(object sender, EventArgs e) { Button btn = (Button)sender; switch (btn.Name) { case "Excel": //数据参数新增 if (WPHbROWDGV.Rows.Count > 0) { //建立Excel对象 Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application(); excel.Application.Workbooks.Add(true); //生成字段名称 for (int i = 0; i < WPHbROWDGV.ColumnCount; i++) { if (WPHbROWDGV.Columns[i].Visible == true) { excel.Cells[1, i + 1] = WPHbROWDGV.Columns[i].HeaderText; } } //填充数据 for (int i = 0; i < WPHbROWDGV.RowCount; i++) { for (int j = 0; j < WPHbROWDGV.ColumnCount; j++) { if (WPHbROWDGV.Columns[j].Visible == true) { if (WPHbROWDGV[j, i].Value == typeof(string)) { excel.Cells[i + 2, j + 1] = "" + WPHbROWDGV[i, j].Value.ToString(); } else { excel.Cells[i + 2, j + 1] = WPHbROWDGV[j, i].Value.ToString(); } } } } excel.Visible = true; } else { MessageBox.Show("没有你要导的数据!!!"); } break; case "Operate": if (WPHbROWDGV.Rows.Count > 0) { Common.CommonForm comm = new Common.CommonForm("OrderCade like '" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString().Trim() + "'", "CS_OutRuturnStorageOperate"); comm.ShowDialog(); } break; } }
private void BtnNumber_Click(object sender, EventArgs e) { Button btn = (Button)sender; OutRuturnStorageEDIT ors; switch (btn.Name) { case "New": //数据参数新增 ors = new OutRuturnStorageEDIT("", 1); ors.ShowDialog(); break; case "Edit": //数据参数新增 if (WPHbROWDGV.Rows.Count > 0) { if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "等待寄回" || WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "确认收货" || WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "等待收货") //取状态为1的才能修改,0为作废,1为编辑,2为审核 { SqlConnection conn = sqlcon.getcon(""); conn.Open(); int ID_ = WPHbROWDGV.CurrentCell.RowIndex; SqlCommand sqlcom = new SqlCommand("insert into CS_OutRuturnStorageOperate (Operate,Operatedatetime,OrderCade,username)values('修改','" + DateTime.Now.ToString() + "','" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString() + "','" + frmlogin.userID + "');", conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); ors = new OutRuturnStorageEDIT(WPHbROWDGV[5, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString(), 2); ors.ShowDialog(); brows(); WPHbROWDGV.Rows[ID_].Selected = true; } else { MessageBox.Show("此状态不能修改单据!!"); } } else { MessageBox.Show("没有你要修改的数据!!"); } break; case "Select": //数据参数新增 if (WPHbROWDGV.Rows.Count > 0) { ors = new OutRuturnStorageEDIT(WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString(), 0); ors.ShowDialog(); BTNbROW_Click(sender, e); } break; case "ERPlook": //ERP审核 if (WPHbROWDGV.Rows.Count > 0) { if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "确认收货") //取状态为1的才能修改,0为作废,1为编辑,2为审核 { int ID_ = WPHbROWDGV.CurrentCell.RowIndex; SqlConnection conn = sqlcon.getcon(""); conn.Open(); SqlCommand sqlcom = new SqlCommand("insert into CS_OutRuturnStorageOperate (Operate,Operatedatetime,OrderCade,username)values('ERP审核','" + DateTime.Now.ToString() + "','" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString().Trim() + "','" + frmlogin.userID + "');update CS_OutRuturnStorage set Type='6' where OrderCade='" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString().Trim() + "' and type='3'", conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); WPHbROWDGV.Rows[ID_].Selected = true; brows(); } else { MessageBox.Show("要先确认收货才可以审核!!"); } } break; case "CK": //从新发货 if (WPHbROWDGV.Rows.Count > 0) { if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["CadeType"].Value.ToString() != "退货" && WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "ERP已审核") //取状态为1的才能修改,0为作废,1为编辑,2为审核 { OutStorageEdit orsE = new OutStorageEdit(WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString(), 1); orsE.ShowDialog(); brows(); } else { if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() != "ERP已审核") //取状态为1的才能修改,0为作废,1为编辑,2为审核 { MessageBox.Show("此单ERP未审核不能从新发货!!"); } else { MessageBox.Show("此单为退货不能从新发货!!"); } } } break; case "look": //退款审核 if (WPHbROWDGV.Rows.Count > 0) { if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["CadeType"].Value.ToString() == "退货" && WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "ERP已审核") //取状态为1的才能修改,0为作废,1为编辑,2为审核 { String PM = Interaction.InputBox("请输入金额", "输入金额", WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["SumMoney"].Value.ToString(), 70, 100); if (PM != string.Empty) { SqlConnection conn = sqlcon.getcon(""); conn.Open(); SqlCommand sqlcom = new SqlCommand("insert into CS_OutRuturnStorageOperate (Operate,Operatedatetime,OrderCade,username)values('退款审核','" + DateTime.Now.ToString() + "','" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString() + "','" + frmlogin.userID + "'); update CS_OutRuturnStorage set Type='5',sumMoney='" + PM + "' where OrderCade='" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString() + "'and BarCode='" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["BarCode"].Value.ToString() + "'", conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); brows(); } } else { if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() != "ERP已审核") //取状态为1的才能修改,0为作废,1为编辑,2为审核 { MessageBox.Show("此单ERP未审核不能退款!!"); } else { MessageBox.Show("此单不是退货不能退款!!"); } } } break; case "Canle": //作废 if (WPHbROWDGV.Rows.Count > 0) { if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "等待寄回" || WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "等待收货") //取状态为1的才能修改,0为作废,1为编辑,2为审核 { String PM = Interaction.InputBox("请输入原因", "输入原因", "", 70, 100); if (PM != string.Empty) { int ID_ = WPHbROWDGV.CurrentCell.RowIndex; SqlConnection conn = sqlcon.getcon(""); conn.Open(); SqlCommand sqlcom = new SqlCommand("insert into CS_OutRuturnStorageOperate (Operate,Operatedatetime,OrderCade,username)values('作废','" + DateTime.Now.ToString() + "','" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString() + "','" + frmlogin.userID + "');update CS_OutRuturnStorage set Type='0',Remarks='(" + PM + ")" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Remarks"].Value.ToString() + "' where OrderCade='" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString() + "'", conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); WPHbROWDGV.Rows[ID_].Selected = true; brows(); } } else { MessageBox.Show("要先确认收货才可以作废!!"); } } break; case "ReturnCanle": //取消作废 if (WPHbROWDGV.Rows.Count > 0) { if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "订单关闭") //取状态为1的才能修改,0为作废,1为编辑,2为审核 { int ID_ = WPHbROWDGV.CurrentCell.RowIndex; SqlConnection conn = sqlcon.getcon(""); conn.Open(); SqlCommand sqlcom = new SqlCommand("insert into CS_OutRuturnStorageOperate (Operate,Operatedatetime,OrderCade,username)values('取消作废','" + DateTime.Now.ToString() + "','" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString() + "','" + frmlogin.userID + "');update CS_OutRuturnStorage set Type='1' where OrderCade='" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString() + "'", conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); WPHbROWDGV.Rows[ID_].Selected = true; brows(); } else { MessageBox.Show("该订单没有关闭不能取消关闭!!"); } } break; case "Returnlook": //取消退款 if (WPHbROWDGV.Rows.Count > 0) { if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "退款完毕") //取状态为1的才能修改,0为作废,1为编辑,2为审核 { int ID_ = WPHbROWDGV.CurrentCell.RowIndex; SqlConnection conn = sqlcon.getcon(""); conn.Open(); SqlCommand sqlcom = new SqlCommand("insert into CS_OutRuturnStorageOperate (Operate,Operatedatetime,OrderCade,username)values('取消退款','" + DateTime.Now.ToString() + "','" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString() + "','" + frmlogin.userID + "');update CS_OutRuturnStorage set Type='6' where OrderCade='" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString() + "'", conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); WPHbROWDGV.Rows[ID_].Selected = true; brows(); } else { MessageBox.Show("要先确认收货才可以审核!!"); } } break; case "ReturnERPlook": //取消审核 if (WPHbROWDGV.Rows.Count > 0) { if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "ERP已审核") //取状态为1的才能修改,0为作废,1为编辑,2为审核 { int ID_ = WPHbROWDGV.CurrentCell.RowIndex; SqlConnection conn = sqlcon.getcon(""); conn.Open(); SqlCommand sqlcom = new SqlCommand("insert into CS_OutRuturnStorageOperate (Operate,Operatedatetime,OrderCade,username)values('取消审核','" + DateTime.Now.ToString() + "','" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString() + "','" + frmlogin.userID + "');update CS_OutRuturnStorage set Type='3' where OrderCade='" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString() + "'", conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); WPHbROWDGV.Rows[ID_].Selected = true; brows(); } else { MessageBox.Show("要先确认收货才可以取消审核!!"); } } break; case "Operate": if (WPHbROWDGV.Rows.Count > 0) { Common.CommonForm comm = new Common.CommonForm("OrderCade='" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString() + "'", "CS_OutRuturnStorageOperate"); comm.ShowDialog(); } break; } }
private void BtnNumber_Click(object sender, EventArgs e) { Button btn = (Button)sender; RefundDisputesNew rdn; switch (btn.Name) { case "New": //数据参数新增 rdn = new RefundDisputesNew("", 1); rdn.ShowDialog(); brows(); break; case "Edit": //数据参数新增 if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "处理中") { rdn = new RefundDisputesNew(WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["ID"].Value.ToString(), 2); rdn.ShowDialog(); brows(); } break; case "Handle": //数据参数审核 if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "处理中") { rdn = new RefundDisputesNew(WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["ID"].Value.ToString(), 3); rdn.ShowDialog(); brows(); } break; case "ReturnHandle": //反审核 if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "完结") { try { int ID_ = WPHbROWDGV.CurrentCell.RowIndex; SqlConnection conn = sqlcon.getcon(""); string strsql = "insert into CS_RefundDisputesOperate (Operate,Operatedatetime,RID,username)values('反审','" + DateTime.Now.ToString() + "','" + WPHbROWDGV[0, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString() + "','" + frmlogin.userID + "');update CS_RefundDisputes set type='1' where ID='" + WPHbROWDGV[0, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString() + "'"; conn.Open(); SqlCommand sqlcom = new SqlCommand(strsql, conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); brows(); WPHbROWDGV.Rows[ID_].Selected = true; MessageBox.Show("反审成功!!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show("反审失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("该状态不能反审!!"); } break; case "Delete": //作废 if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "处理中") { try { //int ID_ = WPHbROWDGV.CurrentCell.RowIndex; SqlConnection conn = sqlcon.getcon(""); string strsql = "insert into CS_RefundDisputesOperate (Operate,Operatedatetime,RID,username)values('删除','" + DateTime.Now.ToString() + "','" + WPHbROWDGV[0, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString() + "','" + frmlogin.userID + "');delete from CS_RefundDisputes where ID='" + WPHbROWDGV[0, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString() + "'"; conn.Open(); SqlCommand sqlcom = new SqlCommand(strsql, conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); brows(); //WPHbROWDGV.Rows[ID_].Selected = true; MessageBox.Show("已删除!!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show("删除失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("该状态不能删除!!"); } break; case "Excel": //作废 if (WPHbROWDGV.Rows.Count > 0) { //建立Excel对象 Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application(); excel.Application.Workbooks.Add(true); //生成字段名称 for (int i = 0; i < WPHbROWDGV.ColumnCount; i++) { excel.Cells[1, i + 1] = WPHbROWDGV.Columns[i].HeaderText; //if (y == 0) //{ // y = 1; // //toolStripStatusLabel6.Text = "数据导入中,请等待!"; //} } //填充数据 for (int i = 0; i < WPHbROWDGV.RowCount; i++) { for (int j = 0; j < WPHbROWDGV.ColumnCount; j++) { if (WPHbROWDGV[j, i].Visible == true) { if (WPHbROWDGV[j, i].Value == typeof(string)) { excel.Cells[i + 2, j + 1] = "" + WPHbROWDGV[i, j].Value.ToString(); } else { excel.Cells[i + 2, j + 1] = WPHbROWDGV[j, i].Value.ToString(); } } } } excel.Visible = true; } else { MessageBox.Show("没有你要导的数据!!!"); } break; case "ReturnCanle": //取消作废 if (WPHbROWDGV.Rows.Count > 0) { if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "订单关闭") //取状态为1的才能修改,0为作废,1为编辑,2为审核 { int ID_ = WPHbROWDGV.CurrentCell.RowIndex; SqlConnection conn = sqlcon.getcon(""); conn.Open(); SqlCommand sqlcom = new SqlCommand("insert into CS_OutRuturnStorageOperate (Operate,Operatedatetime,OrderCade,username)values('取消作废','" + DateTime.Now.ToString() + "','" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString() + "','" + frmlogin.userID + "');update CS_OutRuturnStorage set Type='1' where OrderCade='" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString() + "'", conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); WPHbROWDGV.Rows[ID_].Selected = true; brows(); } else { MessageBox.Show("该订单没有关闭不能取消关闭!!"); } } break; case "Operate": if (WPHbROWDGV.Rows.Count > 0) { Common.CommonForm comm = new Common.CommonForm("RID='" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["ID"].Value.ToString() + "'", "CS_RefundDisputesOperate"); comm.ShowDialog(); } break; } }
private void BtnNumber_Click(object sender, EventArgs e) { Button btn = (Button)sender; ExpressTypeEdit ete; switch (btn.Name) { case "New": ete = new ExpressTypeEdit("", 1); ete.ShowDialog(); brows(); break; case "Edit": if (WPHbROWDGV.Rows.Count > 0) { if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "待处理") { int ID_ = WPHbROWDGV.CurrentCell.RowIndex; ete = new ExpressTypeEdit(WPHbROWDGV[0, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString(), 2); ete.ShowDialog(); brows(); WPHbROWDGV.Rows[ID_].Selected = true; } else { MessageBox.Show("该状态不能修改!!"); } } break; case "Feedback": if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "待处理" || WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "处理中") { try { String PM = Interaction.InputBox("请输入问题", "输入问题", WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Feedback"].Value.ToString(), 70, 100); if (PM != string.Empty) { int ID_ = WPHbROWDGV.CurrentCell.RowIndex; SqlConnection conn = sqlcon.getcon(""); string strsql = "update CS_ExpressType set Feedback='" + PM + "',type='2' where ID='" + WPHbROWDGV[0, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString() + "'"; conn.Open(); SqlCommand sqlcom = new SqlCommand(strsql, conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); brows(); WPHbROWDGV.Rows[ID_].Selected = true; MessageBox.Show("反馈成功!!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch { MessageBox.Show("反馈失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("该状态不能反馈!!"); } break; case "Handle": if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "处理中") { int ID_ = WPHbROWDGV.CurrentCell.RowIndex; ete = new ExpressTypeEdit(WPHbROWDGV[0, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString(), 3); ete.ShowDialog(); brows(); WPHbROWDGV.Rows[ID_].Selected = true; } else { MessageBox.Show("该状态不能处理!!"); } break; case "ReturnHandle": if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "完结") { try { int ID_ = WPHbROWDGV.CurrentCell.RowIndex; SqlConnection conn = sqlcon.getcon(""); string strsql = "update CS_ExpressType set type='2' where ID='" + WPHbROWDGV[0, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString() + "'"; conn.Open(); SqlCommand sqlcom = new SqlCommand(strsql, conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); brows(); WPHbROWDGV.Rows[ID_].Selected = true; MessageBox.Show("反审成功!!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show("反审失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("该状态不能反审!!"); } break; case "Excel": if (WPHbROWDGV.Rows.Count > 0) { //建立Excel对象 Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application(); excel.Application.Workbooks.Add(true); //生成字段名称 for (int i = 0; i < WPHbROWDGV.ColumnCount; i++) { excel.Cells[1, i + 1] = WPHbROWDGV.Columns[i].HeaderText; //if (y == 0) //{ // y = 1; // //toolStripStatusLabel6.Text = "数据导入中,请等待!"; //} } //填充数据 for (int i = 0; i < WPHbROWDGV.RowCount; i++) { for (int j = 0; j < WPHbROWDGV.ColumnCount; j++) { if (WPHbROWDGV[j, i].Visible == true) { if (WPHbROWDGV[j, i].Value == typeof(string)) { excel.Cells[i + 2, j + 1] = "" + WPHbROWDGV[i, j].Value.ToString(); } else { excel.Cells[i + 2, j + 1] = WPHbROWDGV[j, i].Value.ToString(); } } } } excel.Visible = true; } else { MessageBox.Show("没有你要导的数据!!!"); } break; case "Canle": if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "待处理") { try { String PM = Interaction.InputBox("请输入原因", "输入原因", "", 70, 100); if (PM != string.Empty) { int ID_ = WPHbROWDGV.CurrentCell.RowIndex; SqlConnection conn = sqlcon.getcon(""); string strsql = "update CS_ExpressType set type='0',Remarks='(" + PM + ")" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Remarks"].Value.ToString() + "' where ID='" + WPHbROWDGV[0, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString() + "'"; conn.Open(); SqlCommand sqlcom = new SqlCommand(strsql, conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); brows(); WPHbROWDGV.Rows[ID_].Selected = true; MessageBox.Show("已作废!!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch { MessageBox.Show("作废失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("该状态不能作废!!"); } break; case "ReturnCanle": if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "关闭") { try { int ID_ = WPHbROWDGV.CurrentCell.RowIndex; SqlConnection conn = sqlcon.getcon(""); string strsql = "update CS_ExpressType set type='1' where ID='" + WPHbROWDGV[0, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString() + "'"; conn.Open(); SqlCommand sqlcom = new SqlCommand(strsql, conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); brows(); WPHbROWDGV.Rows[ID_].Selected = true; MessageBox.Show("可以编辑!!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show("编辑失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("该状态不能作废!!"); } break; case "Operate": if (WPHbROWDGV.Rows.Count > 0) { Common.CommonForm comm = new Common.CommonForm("OrderCade='" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString() + "'", "CS_OutRuturnStorageOperate"); comm.ShowDialog(); } break; } }
private void BtnNumber_Click(object sender, EventArgs e) { Button btn = (Button)sender; ActivityEditFrm Aef; switch (btn.Name) { case "New": //数据参数新增 Aef = new ActivityEditFrm(0, 1); Aef.ShowDialog(); brows(); break; case "Edit": //数据参数新增 if (WPHbROWDGV.Rows.Count > 0) { if (Convert.ToInt32(WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["listtype"].Value.ToString()) == 1) //取状态为1的才能修改,0为作废,1为编辑,2为审核 { Aef = new ActivityEditFrm(Convert.ToInt32(WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["ID"].Value.ToString()), 1); Aef.ShowDialog(); brows(); } else { MessageBox.Show("此单据不能修改!!"); } } break; case "Select": //数据参数新增 Aef = new ActivityEditFrm(Convert.ToInt32(WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["ID"].Value.ToString()), 0); Aef.ShowDialog(); brows(); break; case "ERPlook": //ERP审核 if (WPHbROWDGV.Rows.Count > 0) { if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Type"].Value.ToString() == "确认收货") //取状态为1的才能修改,0为作废,1为编辑,2为审核 { int ID_ = WPHbROWDGV.CurrentCell.RowIndex; SqlConnection conn = sqlcon.getcon(""); conn.Open(); SqlCommand sqlcom = new SqlCommand("insert into CS_OutRuturnStorageOperate (Operate,Operatedatetime,OrderCade,username)values('ERP审核','" + DateTime.Now.ToString() + "','" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString().Trim() + "','" + frmlogin.userID + "');update CS_OutRuturnStorage set Type='6' where OrderCade='" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["OrderCade"].Value.ToString().Trim() + "' and type='3'", conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); WPHbROWDGV.Rows[ID_].Selected = true; brows(); } else { MessageBox.Show("要先确认收货才可以审核!!"); } } break; case "look": //退款审核 if (WPHbROWDGV.Rows.Count > 0) { if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["listtype"].Value.ToString() == "1") //取状态为1的才能修改,0为作废,1为编辑,2为审核 { int ID_ = WPHbROWDGV.CurrentCell.RowIndex; SqlConnection conn = sqlcon.getcon(""); conn.Open(); SqlCommand sqlcom = new SqlCommand("insert into SS_ActivityOperateList (Operate,Operatedatetime,RID,username)values('审核','" + DateTime.Now.ToString() + "','" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["ID"].Value.ToString() + "','" + frmlogin.userID + "');update SS_ActivityList set listtype='2' where ID='" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["ID"].Value.ToString() + "'", conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); brows(); WPHbROWDGV.Rows[ID_].Selected = true; } else { MessageBox.Show("此单不可以审核!!"); } } break; case "Canle": //作废 if (WPHbROWDGV.Rows.Count > 0) { if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["listtype"].Value.ToString() == "1") //取状态为1的才能修改,0为作废,1为编辑,2为审核 { int ID_ = WPHbROWDGV.CurrentCell.RowIndex; SqlConnection conn = sqlcon.getcon(""); conn.Open(); SqlCommand sqlcom = new SqlCommand("insert into SS_ActivityOperateList (Operate,Operatedatetime,RID,username)values('作废','" + DateTime.Now.ToString() + "','" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["ID"].Value.ToString() + "','" + frmlogin.userID + "');update SS_ActivityList set listtype='0' where ID='" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["ID"].Value.ToString() + "'", conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); brows(); WPHbROWDGV.Rows[ID_].Selected = true; } else { MessageBox.Show("此单不可以作废!!"); } } break; case "Introduction": //取消作废 break; case "ReturnLook": //取消退款 if (WPHbROWDGV.Rows.Count > 0) { if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["listtype"].Value.ToString() == "2") //取状态为1的才能修改,0为作废,1为编辑,2为审核 { int ID_ = WPHbROWDGV.CurrentCell.RowIndex; SqlConnection conn = sqlcon.getcon(""); conn.Open(); SqlCommand sqlcom = new SqlCommand("insert into SS_ActivityOperateList (Operate,Operatedatetime,RID,username)values('反审','" + DateTime.Now.ToString() + "','" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["ID"].Value.ToString() + "','" + frmlogin.userID + "');update SS_ActivityList set listtype='1' where ID='" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["ID"].Value.ToString() + "'", conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); brows(); WPHbROWDGV.Rows[ID_].Selected = true; } else { MessageBox.Show("此单不可以作废!!"); } } break; case "ActivitiesEnd": //取消审核 if (WPHbROWDGV.Rows.Count > 0) { if (WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["listtype"].Value.ToString() == "2") //取状态为1的才能修改,0为作废,1为编辑,2为审核 { int ID_ = WPHbROWDGV.CurrentCell.RowIndex; SqlConnection conn = sqlcon.getcon(""); conn.Open(); SqlCommand sqlcom = new SqlCommand("insert into SS_ActivityOperateList (Operate,Operatedatetime,RID,username)values('活动结束','" + DateTime.Now.ToString() + "','" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["ID"].Value.ToString() + "','" + frmlogin.userID + "');update SS_ActivityList set listtype='3' where ID='" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["ID"].Value.ToString() + "'", conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); brows(); WPHbROWDGV.Rows[ID_].Selected = true; } else { MessageBox.Show("此单不可以结束!!"); } } break; case "Operate": if (WPHbROWDGV.Rows.Count > 0) { Common.CommonForm comm = new Common.CommonForm("RID='" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["ID"].Value.ToString() + "'", "SS_ActivityOperateList"); comm.ShowDialog(); } break; } }
private void BtnNumber_Click(object sender, EventArgs e) { Button btn = (Button)sender; rStorageNew ors; switch (btn.Name) { case "New": //数据参数新增 ors = new rStorageNew(0, 1); ors.ShowDialog(); brows(); break; case "Select": //数据参数查看 if (WPHbROWDGV.Rows.Count > 0) { rStorageNew rsn = new rStorageNew(Convert.ToInt32(WPHbROWDGV[0, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString()), 0); rsn.ShowDialog(); brows(); } break; case "Edit": //数据参数修改 if (WPHbROWDGV.Rows.Count > 0) { if (Convert.ToInt32(WPHbROWDGV[10, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString()) == 1) //取状态为1的才能修改,0为作废,1为编辑,2为审核 { ors = new rStorageNew(Convert.ToInt32(WPHbROWDGV[0, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString()), 1); ors.ShowDialog(); brows(); } else { MessageBox.Show("此单据不能修改!!"); } } else { MessageBox.Show("没有你要修改的数据!!"); } break; case "ToVoid": //作废 if (WPHbROWDGV.Rows.Count > 0) { if (Convert.ToInt32(WPHbROWDGV[10, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString()) == 1) { SqlConnection conn = sqlcon.getcon(""); string sql = "SELECT RID from BR_PassToStockReturn where Rid='" + Convert.ToInt32(WPHbROWDGV[0, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString()) + "' union all SELECT RID from BR_PassToStock where Rid='" + Convert.ToInt32(WPHbROWDGV[0, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString()) + "'"; SqlDataAdapter sqlDaper = new SqlDataAdapter(sql, conn); DataSet ds = new DataSet(); conn.Open(); sqlDaper.Fill(ds, "RID"); conn.Close(); if (ds.Tables["RID"].Rows.Count > 0) { MessageBox.Show("此单于生成入库(退货)不能作废!!"); return; } //SqlConnection conn = sqlcon.getcon(""); conn.Open(); string str = "insert into BR_RstorageOperateList (Operate,Operatedatetime,RID,username)values('作废','" + DateTime.Now.ToString() + "','" + Convert.ToInt32(WPHbROWDGV[0, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString()) + "','" + frmlogin.userID + "')" + "update BR_RStorageList set listtype=0 where id='" + Convert.ToInt32(WPHbROWDGV[0, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString()) + "'"; SqlCommand sqlcom = new SqlCommand(str, conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); BTNbROW_Click(sender, e); MessageBox.Show("此单作废!!"); } else { MessageBox.Show("此单已审核或已作废不能作废!!"); } } break; case "look": //审核 if (WPHbROWDGV.Rows.Count > 0) { if (Convert.ToInt32(WPHbROWDGV[10, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString()) == 1) { SqlConnection conn = sqlcon.getcon(""); string str = "insert into BR_RstorageOperateList (Operate,Operatedatetime,RID,username)values('审核','" + DateTime.Now.ToString() + "','" + Convert.ToInt32(WPHbROWDGV[0, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString()) + "','" + frmlogin.userID + "')" + "update BR_RStorageList set listtype=2 where id='" + Convert.ToInt32(WPHbROWDGV[0, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString()) + "'"; conn.Open(); SqlCommand sqlcom = new SqlCommand(str, conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); MessageBox.Show("审核成功!!"); string sql = "SELECT * from M_user where mobile !=''"; string sqlstr = "select item_no,s_color,mobile,sum(qty)qty from BR_PassToStock " + "left join M_DProductSubscribe on M_DProductSubscribe.pid=BR_PassToStock.pid " + "left join m_user on M_DProductSubscribe.username=m_user.username " + "left join M_product on M_product.id=BR_PassToStock.pid " + "left join M_productsub on M_productsub.id=BR_PassToStock.ColourID " + "where BR_PassToStock.rid='" + Convert.ToInt32(WPHbROWDGV[0, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString()) + "' group by item_no,s_color,mobile"; SqlDataAdapter sqldaper2 = new SqlDataAdapter("select * from M_ShortMessage", conn); SqlDataAdapter sqlDaper = new SqlDataAdapter(sql, conn); SqlDataAdapter sqlDaper1 = new SqlDataAdapter(sqlstr, conn); DataSet ds = new DataSet(); conn.Open(); sqlDaper1.Fill(ds, "Data"); sqldaper2.Fill(ds, "MSM"); sqlDaper.Fill(ds, "RID"); conn.Close(); if (ds.Tables["MSM"].Rows[0]["Type"].ToString() == "True") { for (int i = 0; i < ds.Tables["RID"].Rows.Count; i++) { string strs = ""; for (int j = 0; j < ds.Tables["Data"].Rows.Count; j++) { if (ds.Tables["RID"].Rows[i]["mobile"].ToString() == ds.Tables["Data"].Rows[j]["mobile"].ToString()) { strs += ds.Tables["Data"].Rows[j]["item_no"].ToString() + "." + ds.Tables["Data"].Rows[j]["s_color"].ToString() + "." + ds.Tables["Data"].Rows[j]["qty"].ToString() + "|"; } } if (strs != "" && ds.Tables["RID"].Rows[i]["mobile"].ToString() != "") { SMS.GETpost("ac=send&uid=" + ds.Tables["MSM"].Rows[0]["UserName"].ToString() + "&pwd=" + ds.Tables["MSM"].Rows[0]["PWD"].ToString() + "&mobile=" + ds.Tables["RID"].Rows[i]["mobile"].ToString() + "&content=", ds.Tables["MSM"].Rows[0]["IPAdd"].ToString(), strs + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["Cade"].Value.ToString() + "&encode=utf8"); ///http://api.cnsms.cn/?ac=send&uid=100860&pwd=fa246d0262c3925617b0c72bb20eeb1d&mobile=15102110086,18297974783&content=%D6%D0%B9%FA%B6%CC%D0%C5%CD%F8%B7%A2%CB%CD%B2%E2%CA%D4 } } } BTNbROW_Click(sender, e); } else { MessageBox.Show("此单已审核或已作废不能作废!!"); } } break; case "Returnlook": //反审核 if (WPHbROWDGV.Rows.Count > 0) { if (Convert.ToInt32(WPHbROWDGV[10, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString()) == 2) { SqlConnection conn = sqlcon.getcon(""); conn.Open(); string str = "insert into BR_RstorageOperateList (Operate,Operatedatetime,RID,username)values('反审','" + DateTime.Now.ToString() + "','" + Convert.ToInt32(WPHbROWDGV[0, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString()) + "','" + frmlogin.userID + "')" + "update BR_RStorageList set listtype=1 where id='" + Convert.ToInt32(WPHbROWDGV[0, WPHbROWDGV.CurrentCell.RowIndex].Value.ToString()) + "'"; SqlCommand sqlcom = new SqlCommand(str, conn); sqlcom.ExecuteNonQuery(); conn.Close(); sqlcom.Dispose(); BTNbROW_Click(sender, e); MessageBox.Show("此单可以修改!!"); } else { MessageBox.Show("此单没有审核不能反审!!"); } } break; case "Operate": //日志 if (WPHbROWDGV.Rows.Count > 0) { Common.CommonForm comm = new Common.CommonForm("RID='" + WPHbROWDGV.Rows[WPHbROWDGV.CurrentCell.RowIndex].Cells["ID"].Value.ToString() + "'", "BR_RstorageOperateList"); comm.ShowDialog(); } break; } }