コード例 #1
0
        async private void CommitTypeNoMesService()
        {
            try
            {
                //修改行数据
                if (modifyTypeNoTemp.Count > 0)
                {
                    foreach (var val in this.modifyTypeNoTemp)
                    {
                        await serviceClient.DeleteProductContinairCapacityAsync(val);
                    }
                }

                int      row   = radGridView1.RowCount;
                string[] array = new string[row];
                //新增行数据
                for (int i = 0; i < row; i++)
                {
                    var ID          = radGridView1.Rows[i].Cells[0].Value.ToString().Trim();
                    var productName = radGridView1.Rows[i].Cells[1].Value.ToString().Trim();
                    var storage     = radGridView1.Rows[i].Cells[2].Value.ToString().Trim();
                    var describle   = radGridView1.Rows[i].Cells[5].Value.ToString().Trim();
                    if (!string.IsNullOrEmpty(productName))
                    {
                        array[i] = productName;
                        var res = await serviceClient.CommitProductContinairCapacityAsync(productName, storage, MESMainForm.currentUser, describle);

                        if (res < 1)
                        {
                            MessageBox.Show($"【{productName}】更新失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                    }
                }
                MessageBox.Show("更新成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                RefreshData();
                //将其他产品型号替换成新的型号
                foreach (var basic in this.modifyProductTypeNoList)
                {
                    serviceClient.UpdateAllProductTypeNo(basic.keyOldTypeNo, basic.keyNewTypeNo);
                    ModifyStandConfigProductType(basic.keyOldTypeNo, basic.keyNewTypeNo);
                }
                modifyProductTypeNoList.Clear();
            }
            catch (Exception ex)
            {
                LogHelper.Log.Error(ex.Message + "\r\n" + ex.StackTrace);
                MessageBox.Show($"{ex.Message}", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }