public static FurnaceInfo Mapper(BatchProductInfo s) { FurnaceInfo d = Activator.CreateInstance <FurnaceInfo>(); try { var Types = s.GetType(); //获得类型 var Typed = typeof(FurnaceInfo); foreach (PropertyInfo sp in Types.GetProperties()) //获得类型的属性字段 { foreach (PropertyInfo dp in Typed.GetProperties()) { if (dp.Name == sp.Name) //判断属性名是否相同 { dp.SetValue(d, sp.GetValue(s, null), null); //获得s对象属性的值复制给d对象的属性 } } } d.PWOs = s.GetPWOsFromXML(); } catch (Exception ex) { throw ex; } return(d); }
private void ucPrdtParams_Ionitriding_Load(object sender, EventArgs e) { grdPWOs.DataSource = pwos; BatchProductInfo data = GetWorkUnitProductionInfo(); if (data != null) { if (data.InProduction == 0) { prdtStatus = ProductionStatus.Idle; pwos = LoadFromFile(stationInfo.T133Code); grdPWOs.DataSource = pwos; grdvPWOs.BestFitColumns(); GetMethodStandards(0, 0, ""); } else { prdtStatus = ProductionStatus.Busy; pwos = data.GetPWOsFromXML(); grdPWOs.DataSource = pwos; grdvPWOs.BestFitColumns(); currentOperator = new STB006() { UserCode = data.OperatorCode, UserName = data.OperatorName, }; currentBatchNo = data.BatchNumber; startDatetime = data.BatchStartDate; if (pwos.Count > 0) { GetMethodStandards(0, stationInfo.T216LeafID, currentBatchNo); } } edtOperatorCode.Text = string.Format( "{0}[{1}]", currentOperator.UserName, currentOperator.UserCode); lblBatchNo.Text = currentBatchNo; } else { pwos = LoadFromFile(stationInfo.T133Code); grdPWOs.DataSource = pwos; grdvPWOs.BestFitColumns(); } RefreshForm(); }
private void ucBatchSysProduction_Load(object sender, EventArgs e) { grdPWOs.DataSource = pwos; BatchProductInfo data = GetWorkUnitProductionInfo(); if (data != null) { currentOperator = new STB006() { UserCode = data.OperatorCode, UserName = data.OperatorName, }; currentBatchNo = data.BatchNumber; startDatetime = data.BatchStartDate; if (data.InProduction == 0) { prdtStatus = ProductionStatus.Idle; } else { prdtStatus = ProductionStatus.Busy; } pwos = data.GetPWOsFromXML(); #region 遍历所有生产工单,获取生产工单的在制品的材质 //foreach (EntityBatchPWO pwo in pwos) //{ // int errCode = 0; // string errText = ""; // string texture = // GetTextureCodeFromMaterialCode( // pwo.T102Code, // out errCode, // out errText); // if (errCode == 0) // pwo.Texture = texture; // else // pwo.Texture = ""; //} #endregion grdPWOs.DataSource = pwos; grdvPWOs.BestFitColumns(); edtOperatorCode.Text = string.Format( "{0}[{1}]", currentOperator.UserName, currentOperator.UserCode); lblBatchNo.Text = currentBatchNo; lblStartTime.Text = startDatetime.ToString("yyyy-MM-dd HH:mm:ss"); cboPrdtType.SelectedIndex = -1; for (int i = 0; i < cboPrdtType.Properties.Items.Count; i++) { BatchRingCategory prdtType = (BatchRingCategory)cboPrdtType.Properties.Items[i]; if (prdtType.T131LeafID == data.T131LeafID) { cboPrdtType.SelectedIndex = i; break; } } //GetMethodStandards(data.T131LeafID, stationInfo.T216LeafID, data.BatchNumber); } RefreshForm(); }