async private void SelectMaterialDetail(string inMaterialCode) { var dt = (await serviceClient.SelectMaterialDetailMsgAsync(inMaterialCode)).Tables[0]; if (dt.Rows.Count < 1) { return; } this.dataSourceMaterialDetail.Clear(); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dataSourceMaterialDetail.NewRow(); var materialCode = dt.Rows[i][0].ToString();//pn/lot/rid/dc/qty var materialName = dt.Rows[i][1].ToString(); var productTypeNo = dt.Rows[i][2].ToString(); var stationName = dt.Rows[i][3].ToString(); var useAmounted = dt.Rows[i][4].ToString(); var teamLeader = dt.Rows[i][5].ToString(); var admin = dt.Rows[i][6].ToString(); var updateDate = dt.Rows[i][7].ToString(); var sn = dt.Rows[i][8].ToString(); var amountedTotal = dt.Rows[i][9].ToString(); var putInStorage = dt.Rows[i][10].ToString(); var currentRemain = dt.Rows[i][11].ToString(); var snPCBA = serviceClient.GetPCBASn(sn); var snOutter = serviceClient.GetProductSn(sn); AnalysisMaterialCode analysisMaterialCode = AnalysisMaterialCode.GetMaterialDetail(materialCode); var pnCode = analysisMaterialCode.MaterialPN; var lotCode = analysisMaterialCode.MaterialLOT; var ridCode = analysisMaterialCode.MaterialRID; var dcCode = analysisMaterialCode.MaterialDC; //var qtyCode = analysisMaterialCode.MaterialQTY; materialName = serviceClient.SelectMaterialName(pnCode); dr[MATERIAL_PN] = pnCode; dr[MATERIAL_LOT] = lotCode; dr[MATERIAL_RID] = ridCode; dr[MATERIAL_DC] = dcCode; dr[MATERIAL_QTY] = putInStorage; dr[MATERIAL_NAME] = materialName; dr[PRODUCT_TYPENO] = productTypeNo; dr[STATION_NAME] = stationName; dr[USE_AMOUNTED] = useAmounted; dr[TEAM_LEADER] = teamLeader; dr[ADMIN] = admin; dr[UPDATE_DATE] = updateDate; dr[SN_PCBA] = snPCBA; dr[SN_OUTTER] = snOutter; dr[RESIDUE_STOCK] = int.Parse(putInStorage) - int.Parse(amountedTotal); dr[CURRENT_REMAIN_STOCK] = currentRemain; dataSourceMaterialDetail.Rows.Add(dr); } this.radGridView1.DataSource = dataSourceMaterialDetail; this.radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.None; this.radGridView1.BestFitColumns(); }