コード例 #1
0
        async private void Menu_del_Click(object sender, EventArgs e)
        {
            //删除当前行
            var typeNo = this.radGridView1.CurrentRow.Cells[1].Value.ToString();

            if (string.IsNullOrEmpty(typeNo))
            {
                this.radGridView1.CurrentRow.Delete();
            }
            else
            {
                if (MessageBox.Show($"确认要删除产品【{typeNo}】?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.OK)
                {
                    int row = await serviceClient.DeleteProductContinairCapacityAsync(typeNo);

                    LogHelper.Log.Info($"【删除产品】产品名称={typeNo}影响行数={row} 操作用户={MESMainForm.currentUser}");
                    if (row > 0)
                    {
                        //删除产品后,同时将工艺删除
                        row = await serviceClient.DeleteProcessAsync(typeNo);

                        LogHelper.Log.Info($"【删除工艺】工艺名称={typeNo}影响行数={row} 操作用户={MESMainForm.currentUser}");
                        //删除产品和工艺后,删除对应配置
                        if (row > 0)
                        {
                            InitStandConfig.QueryCurrentStandProductDirectory("");//查询并删除当前工艺配置文件
                        }
                        RefreshData();
                    }
                }
            }
        }