//清料 private void kbtnxl_Click(object sender, EventArgs e) { int m = 0; for (int i = 0; i < this.kryptonDataGridView1.Rows.Count; i++) { if ((bool)this.kryptonDataGridView1.Rows[i].Cells[0].EditedFormattedValue) { m++; } } if (m > 0) { DialogResult result = KryptonMessageBox.Show("确定清除当前选择的物料吗?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == System.Windows.Forms.DialogResult.No) { return; } for (int i = 0; i < this.kryptonDataGridView1.Rows.Count; i++) { if ((bool)this.kryptonDataGridView1.Rows[i].Cells[0].EditedFormattedValue) { LEDAO.V_WIP_Seed wip = (LEDAO.V_WIP_Seed)(this.kryptonDataGridView1.Rows[i]).DataBoundItem; string str = Tools.ServiceReferenceManager.GetClient().RunServerAPI("BLL.WIP", "DeleteWIPSeed", wip.id.ToString()); } } DataBind(); } }
/// <summary> /// 卸料是更改线边仓及工位仓 /// </summary> /// <param name="Num"></param> /// <param name="num"></param> public void UpdateWipSeed(string Num, decimal num) { string SFC = this.kryptonDataGridView1.SelectedRows[0].Cells["Column4"].Value.ToString(); string mat_code = this.kryptonDataGridView1.SelectedRows[0].Cells["Column3"].Value.ToString(); string order_no = this.kryptonDataGridView1.SelectedRows[0].Cells["Column1"].Value.ToString(); //工单料卸料 string qty = Tools.ServiceReferenceManager.GetClient().RunServerAPI("BLL.WIP", "GetWipQtyByLot", SFC + "," + mat_code + "," + order_no); if (!string.IsNullOrWhiteSpace(qty)) { string lot_qty = (num + Convert.ToDecimal(qty)).ToString(); string str = Tools.ServiceReferenceManager.GetClient().RunServerAPI("BLL.WIP", "UpdateWIPMaterial", SFC + "," + lot_qty + "," + mat_code + "," + order_no); } //公用料卸料 string commonqty = Tools.ServiceReferenceManager.GetClient().RunServerAPI("BLL.WIP", "GetWipComQtyByLot", SFC + "," + mat_code); if (!string.IsNullOrWhiteSpace(commonqty)) { string lot_qty = (num + Convert.ToDecimal(commonqty)).ToString(); string str = Tools.ServiceReferenceManager.GetClient().RunServerAPI("BLL.WIP", "UpdateWIPMaterialCom", SFC + "," + lot_qty + "," + mat_code); } foreach (DataGridViewRow item in kryptonDataGridView1.SelectedRows) { LEDAO.V_WIP_Seed wip = (LEDAO.V_WIP_Seed)item.DataBoundItem; string str1 = Tools.ServiceReferenceManager.GetClient().RunServerAPI("BLL.WIP", "UpdateWIPSeed", wip.id.ToString() + "," + (decimal.Parse(Num) - num).ToString()); } DataBind(); }
//卸料 private void kbtnclose_Click(object sender, EventArgs e) { if (this.kryptonDataGridView1.Rows.Count > 0) { string Num = this.kryptonDataGridView1.SelectedRows[0].Cells["Column5"].Value.ToString(); if (Convert.ToDecimal(Num) > 0) { UserForm.ReturnMateralNumForm Numform = new UserForm.ReturnMateralNumForm(Num); Numform.ShowDialog(); switch (Numform.State) { case 1: decimal num = Numform.Num; UpdateWipSeed(Num, num); break; case 2: decimal num1 = Convert.ToDecimal(Num); UpdateWipSeed(Num, num1); break; default: return; } } else { foreach (DataGridViewRow item in kryptonDataGridView1.SelectedRows) { LEDAO.V_WIP_Seed wip = (LEDAO.V_WIP_Seed)item.DataBoundItem; string str1 = Tools.ServiceReferenceManager.GetClient().RunServerAPI("BLL.WIP", "UpdateWIPSeed", wip.id.ToString() + "," + "0"); } DialogResult result = KryptonMessageBox.Show("该物料消耗为负,是否卸料?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == System.Windows.Forms.DialogResult.No) { return; } DataBind(); } } else { MessageBox.Show("暂无投料,不可卸料", "提示"); return; } //this.Close(); }
//全部卸料 private void kbtnallxl_Click(object sender, EventArgs e) { UserForm.CheckPassWord password = new UserForm.CheckPassWord(); password.ShowDialog(); DialogResult result = KryptonMessageBox.Show("确定把全部物料清除吗?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == System.Windows.Forms.DialogResult.No) { return; } foreach (DataGridViewRow item in kryptonDataGridView1.Rows) { LEDAO.V_WIP_Seed wip = (LEDAO.V_WIP_Seed)item.DataBoundItem; string str = Tools.ServiceReferenceManager.GetClient().RunServerAPI("BLL.WIP", "DeleteWIPSeed", wip.id.ToString()); } DataBind(); }
//右键删除 private void toolStripMenuItem1_Click(object sender, EventArgs e) { if (kryptonDataGridView1.SelectedRows.Count > 0) { DialogResult result = KryptonMessageBox.Show("确定删除当前选择行装载物料吗?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == System.Windows.Forms.DialogResult.No) { return; } foreach (DataGridViewRow item in kryptonDataGridView1.SelectedRows) { LEDAO.V_WIP_Seed wip = (LEDAO.V_WIP_Seed)item.DataBoundItem; string str = Tools.ServiceReferenceManager.GetClient().RunServerAPI("BLL.WIP", "DeleteWIPSeed", wip.id.ToString()); } DataBind(); } }