private void SetParameters() { colParameters.DisplayMemberPath = "Name"; colParameters.SelectedValueMemberPath = "ID"; FormulaParameters = bizFormula.GetFormulas(EntityID, true); FormulaParameters.Add(new FormulaDTO() { ID = 0, Name = " " }); colParameters.ItemsSource = FormulaParameters; }
private void btn_Next_Click(object sender, RoutedEventArgs e) { //update batch to rotation if (SessionInfo.PraperRotation != null) { new RotationInfoController().UpdateTubesBatch(SessionInfo.PraperRotation.RotationID, CurrentTubesBatch.TubesBatchID); if (SessionInfo.PraperRotation != null) { FormulaParameters formulaParameters = SessionInfo.RotationFormulaParameters[Guid.Empty]; SessionInfo.RotationFormulaParameters.Remove(Guid.Empty); if (!SessionInfo.RotationFormulaParameters.ContainsKey(SessionInfo.PraperRotation.RotationID)) { SessionInfo.RotationFormulaParameters.Add(SessionInfo.PraperRotation.RotationID, formulaParameters); } else { SessionInfo.RotationFormulaParameters[SessionInfo.PraperRotation.RotationID] = formulaParameters; } } new PlateController().UpdateRotationId(CurrentTubesBatch.TubesBatchID, SessionInfo.PraperRotation.RotationID); } dg_TubesGroup.IsEnabled = false; dg_Bules.IsEnabled = false; //for (int i = 0; i < dg_TubesGroup.Items.Count; i++) //{ // ComboBox cb_PoolingRulesConfigurations = CommFuntion.FindName(dg_TubesGroup, 1, i, "btn_del") as ComboBox; // if (cb_PoolingRulesConfigurations != null) // cb_PoolingRulesConfigurations.IsEditable = false; // Button btn_del = CommFuntion.FindName(dg_TubesGroup, 3, i, "btn_del") as Button; // if (btn_del != null) // btn_del.IsEnabled = false; // CheckBox ch_Complement = CommFuntion.FindName(dg_TubesGroup, 4, i, "ch_Complement") as CheckBox; // if (ch_Complement != null) // ch_Complement.IsEnabled = false; //} btn_detail.IsEnabled = false; btn_Group.IsEnabled = false; btn_Next.IsEnabled = false; btn_Save.IsEnabled = false; btn_scan.IsEnabled = false; SessionInfo.NextButIndex = 1; if (SessionInfo.NextTurnStep == 0) { SessionInfo.NextTurnStep = 1; } if (NextStepEvent != null) { NextStepEvent(sender, e); } }
/// <summary> /// 每个操作完成调用此方法添加耗材消耗量 /// </summary> /// <param name="rotationID"></param> /// <param name="operationID"></param> public void AddSuppliesConsumption(Guid rotationID, Guid operationID, FormulaParameters formulaParameters) { Dictionary <short, bool> operation = new OperationController().GetOperationOrders(operationID); List <ReagentAndSuppliesConfiguration> suppliseConfig = reagentConfigController.GetAll().FindAll(P => P.ItemType >= 100 && P.ItemType < 200); List <ReagentAndSupply> supplise = reagentController.GetReagentID(rotationID).FindAll(P => P.ItemType >= 100 && P.ItemType < 200); foreach (ReagentAndSuppliesConfiguration supplyconfig in suppliseConfig) { ReagentAndSupply supply = supplise.FirstOrDefault(P => P.ConfigurationItemID == supplyconfig.ItemID); if (supply != null) { Guid supplyID = supply.ItemID; double consumption = reagentConfigController.CalcVolume(supplyconfig.CalculationFormula, operation, formulaParameters); reagentConsumptionController.AddConsumption(rotationID, supplyID, 0 - consumption, ConsumptionType.consume); } } }
private void save_button_Click(object sender, RoutedEventArgs e) { if (!validate()) { return; } List <RotationInfo> rotationInfoList = new List <RotationInfo>(); foreach (DataRow row in dataTable.Rows) { RotationInfo rotationInfo = new RotationInfo(); rotationInfo.RotationID = WanTaiObjectService.NewSequentialGuid(); rotationInfo.ExperimentID = SessionInfo.ExperimentID; if (row["TubesBatchID"] != null && !string.IsNullOrEmpty(row["TubesBatchID"].ToString())) { rotationInfo.TubesBatchID = new Guid(row["TubesBatchID"].ToString()); } if (row["RotationName"] != null && !string.IsNullOrEmpty(row["RotationName"].ToString())) { rotationInfo.RotationName = row["RotationName"].ToString(); } rotationInfo.State = (short)RotationInfoStatus.Create; rotationInfo.CreateTime = DateTime.Now; OperationConfiguration operation = row["Operation"] as OperationConfiguration; rotationInfo.OperationID = operation.OperationID; rotationInfo.OperationName = operation.OperationName; rotationInfo.RotationSequence = (short)row["Sequence"]; rotationInfoList.Add(rotationInfo); } if (controller.Create(rotationInfoList)) { //if (SessionInfo.PraperRotation == null) //{ Guid RotationID = Guid.Empty; if (SessionInfo.PraperRotation != null) { RotationID = SessionInfo.PraperRotation.RotationID; } SessionInfo.PraperRotation = rotationInfoList.FirstOrDefault(); FormulaParameters formulaParameters = SessionInfo.RotationFormulaParameters[RotationID]; SessionInfo.RotationFormulaParameters.Remove(RotationID); if (!SessionInfo.RotationFormulaParameters.ContainsKey(SessionInfo.PraperRotation.RotationID)) { SessionInfo.RotationFormulaParameters.Add(SessionInfo.PraperRotation.RotationID, formulaParameters); } else { SessionInfo.RotationFormulaParameters[SessionInfo.PraperRotation.RotationID] = formulaParameters; } // } // MessageBox.Show("保存成功!", "系统提示"); if (NextStepEvent != null) { NextStepEvent(sender, e); } this.next_button.IsEnabled = true; } else { MessageBox.Show("保存失败!", "系统提示"); } }
public double CalcVolume(string formula, Dictionary <short, bool> operationsOrders, FormulaParameters formulaParameters) { double volume = 0; MSScriptControl.ScriptControl sc = new MSScriptControl.ScriptControl(); sc.Language = "JavaScript"; string newFormula = ""; string tempFormula = ""; foreach (short operationOrder in operationsOrders.Keys) { tempFormula = operationsOrders[operationOrder] ? formula.Replace("[" + operationOrder + "]", "1") : formula.Replace("[" + operationOrder + "]", "0"); formula = tempFormula; } newFormula = formula.Replace("PCRWorkListRowCount", formulaParameters.PCRWorkListRowCount.ToString()) .Replace("PoolCountInTotal", formulaParameters.PoolCountInTotal.ToString()) .Replace("PoolingWorkListRowCount", formulaParameters.PoolingWorkListRowCount.ToString()) .Replace("TestItemCountInTotal", formulaParameters.TestItemCountInTotal.ToString()) .Replace("PCRPlatesCount", formulaParameters.PCRPlatesCount.ToString()); formula = newFormula; foreach (string strKey in formulaParameters.PoolCountOfTestItem.Keys) { if (formula.Contains(strKey)) { newFormula = formula.Replace(strKey, formulaParameters.PoolCountOfTestItem[strKey].ToString()); formula = newFormula; } } volume = new Common.SafeConvertion().GetSafeDouble(sc.Eval(formula)); return(volume); }
public List <ReagentAndSuppliesConfiguration> GetReagentAndSuppliesNeeded(short[] itemTypes, Dictionary <short, bool> operationsOrders, FormulaParameters formulaParameters) { List <ReagentAndSuppliesConfiguration> list = new List <ReagentAndSuppliesConfiguration>(); try { using (WanTaiEntities wanTaiEntites = new WanTaiEntities()) { list = wanTaiEntites.ReagentAndSuppliesConfigurations.Where(c => c.ActiveStatus == true && itemTypes.Contains((short)c.ItemType)).ToList(); } foreach (ReagentAndSuppliesConfiguration r in list) { double volumne = CalcVolume(r.CalculationFormula, operationsOrders, formulaParameters); r.NeedVolume = r.ItemType >= 100 ? Math.Ceiling(volumne) : volumne; } } catch (Exception ex) { string errorMessage = ex.Message + System.Environment.NewLine + ex.StackTrace; LogInfoController.AddLogInfo(LogInfoLevelEnum.Error, errorMessage, SessionInfo.LoginName, this.GetType().Name, SessionInfo.ExperimentID); throw; } return(list); }
private void SetDefaultFieldsValue(List <LetterTemplatePlainFieldDTO> plainfields, List <LetterTemplateRelationshipFieldDTO> relationshipfields) { if (plainfields != null) { foreach (var field in plainfields) { if (field.EntityListViewColumnsID == 0 && field.FormulaID == 0) { if (field.FieldName.ToLower().StartsWith("col_")) { if (SelectedEntityListView != null) { var columnName = field.FieldName.Split('_')[1]; //برای الیاس ها هم فکری شود var column = SelectedEntityListView.EntityListViewAllColumns.FirstOrDefault(x => x.Alias != null && x.Alias.ToLower() == columnName.ToLower()); if (column != null) { field.EntityListViewColumnsID = column.ID; } } } else if (field.FieldName.ToLower().StartsWith("prm_")) { if (FormulaParameters != null) { //var paramters = bizFormula.GetFormulas(EntityID); var parameterName = field.FieldName.Split('_')[1]; var parameter = FormulaParameters.FirstOrDefault(x => x.Name.ToLower() == parameterName.ToLower()); if (parameter != null) { field.FormulaID = parameter.ID; } } } } } } if (relationshipfields != null) { foreach (var field in relationshipfields) { if (field.PartialLetterTemplateID == 0) { if (RelationshipTails != null) { var relName = field.FieldName.Split('_')[1]; var relationshipTail = RelationshipTails.FirstOrDefault(x => x.EntityPath.ToLower() == relName.ToLower()); if (relationshipTail != null && field.tmpPartialLetterTemplates.Count == 0) { field.RelationshipTailID = relationshipTail.ID; SetLetterRelationshipTemplates(field); //SetEntityPreDefinedSearches(field); //var firstTemplate = field.tmpPartialLetterTemplates.FirstOrDefault(); //if (firstTemplate != null) // field.PartialLetterTemplateID = firstTemplate.ID; } } } } } }