async private void DeleteRowData() { if (materialType == MaterialType.MATERIAL_BINDING) { if (this.radGridViewBind.RowCount < 1) { MessageBox.Show("当前没有可删除的数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } MesService.ProductMaterial productMaterial = new MesService.ProductMaterial(); if (this.radGridViewBind.CurrentRow.Cells[2].Value != null) { productMaterial.MaterialCode = this.radGridViewBind.CurrentRow.Cells[2].Value.ToString(); } if (this.radGridViewBind.CurrentRow.Cells[1].Value != null) { productMaterial.TypeNo = this.radGridViewBind.CurrentRow.Cells[1].Value.ToString(); } if (this.radGridViewBind.CurrentRow.Cells[1].Value == null && this.radGridViewBind.CurrentRow.Cells[2].Value == null && this.radGridViewBind.CurrentRow.Cells[3].Value == null) { this.radGridViewBind.CurrentRow.Delete(); return; } if (MessageBox.Show($"确认解除物料【{productMaterial.MaterialCode}】与产品【{productMaterial.TypeNo}】的绑定?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { int res = await serviceClient.DeleteProductMaterialAsync(productMaterial); if (res > 0) { MessageBox.Show("解除绑定成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("解除绑定失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } SelectData(); } } else if (materialType == MaterialType.MATERIAL_STOCK_MODIFY) { if (this.radGridViewStock.RowCount < 1) { MessageBox.Show("当前没有可删除的数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } var materialRid = this.radGridViewStock.CurrentRow.Cells[3].Value.ToString(); if (MessageBox.Show($"确认删除料盘号为【{materialRid}】的物料?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { var materialCode = serviceClient.GetMaterialCode(materialRid); int res = serviceClient.DeleteMaterial(materialCode); if (res > 0) { MessageBox.Show("删除物料成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("删除物料失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } SelectData(); } } }