Exemplo n.º 1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            int id = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID));

            if (id == 0)
            {
                return;
            }
            MaterialModel model = (MaterialModel)MaterialBO.Instance.FindByPK(id);

            _rownIndex = grvData.FocusedRowHandle;
            frmMaterial frm = new frmMaterial();

            frm.GroupID  = model.MaterialGroupID;
            frm.Material = model;
            //if (frm.ShowDialog() == DialogResult.OK)
            //{
            //    LoadInfoSearch();
            //}
            frm.LoadDataChange += main_LoadDataChange;
            frm.Show();
        }
Exemplo n.º 2
0
 private void Initialize(SqlDataReader reader, MaterialModel obj)
 {
     if (reader.GetValue(0) != DBNull.Value)
     {
         obj.MaterialCode = reader.GetInt32(0);
     }
     if (reader.GetValue(1) != DBNull.Value)
     {
         obj.MaterialName = reader.GetString(1);
     }
     if (reader.GetValue(2) != DBNull.Value)
     {
         obj.GroupCode = reader.GetString(2);
     }
     if (reader.GetValue(3) != DBNull.Value)
     {
         obj.Spec = reader.GetString(3);
     }
     if (reader.GetValue(4) != DBNull.Value)
     {
         obj.Unit = reader.GetString(4);
     }
     if (reader.GetValue(5) != DBNull.Value)
     {
         obj.StandardPrice = reader.GetDecimal(5);
     }
     if (reader.GetValue(6) != DBNull.Value)
     {
         obj.InputPerson = reader.GetString(6);
     }
     if (reader.GetValue(7) != DBNull.Value)
     {
         obj.InputDate = reader.GetDateTime(7);
     }
     if (reader.GetValue(8) != DBNull.Value)
     {
         obj.Remark = reader.GetString(8);
     }
 }
Exemplo n.º 3
0
        public HttpResponseMessage Create(MaterialModel material)
        {
            Material acu = new Material();

            try
            {
                if (material != null)
                {
                    acu.IdMaterial          = material.IdMaterial;
                    acu.IdArea              = material.IdArea;
                    acu.IdUnidadMedida      = material.IdUnidadMedida;
                    acu.NumeroParteMaterial = material.NumeroParteMaterial;
                    acu.Nombre              = material.Nombre;
                    acu.Marca           = material.Marca;
                    acu.Posicion        = material.Posicion;
                    acu.CostoUnidad     = material.CostoUnidad;
                    acu.NoSerie         = material.NoSerie;
                    acu.Cantidad        = material.Cantidad;
                    acu.Activo_Inactivo = true;
                    db.Material.Add(acu);
                    db.SaveChanges();
                    return(new HttpResponseMessage(System.Net.HttpStatusCode.OK)
                    {
                        Content = null
                    });
                }
                else
                {
                    return(new HttpResponseMessage(System.Net.HttpStatusCode.NotAcceptable)
                    {
                        Content = null
                    });
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse <string>(HttpStatusCode.InternalServerError, ex.Message + Environment.NewLine + "Material"));
            }
        }
Exemplo n.º 4
0
        private int _Insert(MaterialModel mObj)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into Material(");
            builder.Append("MaterialCode, MaterialName,GroupCode,Spec,Unit,StandardPrice,InputPerson,InputDate,Remark)");
            builder.Append(" values (");
            builder.Append("@MaterialCode, @MaterialName,@GroupCode,@Spec,@Unit,@StandardPrice,@InputPerson,@InputDate,@Remark) ");
            builder.Append("SELECT @MaterialCode = SCOPE_IDENTITY()");
            this._DataProcess.CommandText = builder.ToString();
            this._DataProcess.ProcessParametersAdd("@MaterialCode", SqlDbType.Int, 4, mObj.MaterialCode);
            this._DataProcess.ProcessParametersAdd("@MaterialName", SqlDbType.VarChar, 100, mObj.MaterialName);
            this._DataProcess.ProcessParametersAdd("@GroupCode", SqlDbType.VarChar, 50, mObj.GroupCode);
            this._DataProcess.ProcessParametersAdd("@Spec", SqlDbType.VarChar, 200, mObj.Spec);
            this._DataProcess.ProcessParametersAdd("@Unit", SqlDbType.VarChar, 50, mObj.Unit);
            this._DataProcess.ProcessParametersAdd("@StandardPrice", SqlDbType.Decimal, 9, mObj.StandardPrice);
            this._DataProcess.ProcessParametersAdd("@InputPerson", SqlDbType.VarChar, 50, mObj.InputPerson);
            this._DataProcess.ProcessParametersAdd("@InputDate", SqlDbType.DateTime, 8, mObj.InputDate);
            this._DataProcess.ProcessParametersAdd("@Remark", SqlDbType.VarChar, 800, mObj.Remark);
            this._DataProcess.RunSql();
            return(mObj.MaterialCode);
        }
 private static void DefineMaterialToMaterialModelMapping()
 {
     MapperObject.AddMap <Material, MaterialModel>(src =>
     {
         var res = new MaterialModel();
         res.InjectFrom(src);
         res.TenantDomain = src.DomainId;
         if (src.Applications != null)
         {
             res.Applications = src.Applications.Select(x => MapperObject.Map <Application, ApplicationModel>(x)).ToList();
         }
         if (src.Tools != null)
         {
             res.Tools = src.Tools.Select(x => MapperObject.Map <Tool, ToolModel>(x)).ToList();
         }
         if (src.Accessories != null)
         {
             res.Accessories = src.Accessories.Select(x => MapperObject.Map <Accessory, AccessoryModel>(x)).ToList();
         }
         return(res);
     });
 }
Exemplo n.º 6
0
        public ActionResult Edit(MaterialModel model, int id)
        {
            if (ModelState.IsValid)
            {
                var material = new JL.Core.Models.Material();
                material.AutoId       = id;
                material.Title        = model.Title;
                material.MaterialType = model.FileType;
                material.Description  = model.Description;

                material.Status = model.Status ? 0 : 1;

                // picture
                if (Request.Files != null &&
                    Request.Files.Count > 0 &&
                    Request.Files[0].ContentLength > 0)
                {
                    string picture, filename;
                    var    success = FileHelper.SaveMaterial(Request.Files[0], material.MaterialType, out filename, out picture);

                    if (success)
                    {
                        material.Picture  = picture;
                        material.FileName = filename;
                        material.Url      = model.FileName;
                    }

                    //for show
                    model.Picture  = picture;
                    model.FileName = filename;
                    model.Url      = filename;
                }

                jlService.UpdateMaterial(material);
                ViewData.Add("ResultObject", ResultObject.Succeed());
            }

            return(View(model));
        }
        public async Task <IActionResult> CreateMaterial([FromBody] MaterialModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                var materialData = JobAssistantMapper.Map <Material>(model);
                // TODO: Validate that the tenant/domain exists and based on the security context, that the API caller should have access to it!
                // TODO: var tenant = await _repo.All<Tenant>().SingleAsync(t => t.DomainId == model.TenantDomain);
                await _repo.Create(materialData);
            }
            catch (Exception e)
            {
                _logger.LogError(1, e, "Failed to create material in DB repository");
                throw;
            }

            return(Ok());
        }
Exemplo n.º 8
0
 public OrcamentoIntumescenteModel(string grupo, string ocupacaoUso, string classe, string divisao, string tempoResistenciaFogo,
                                   double qtdeLitrosTotal, double percentualPerda, double qtdeBaldes, double qtdeBaldesReal,
                                   double valorUnitarioIntumescente, double valorBaldeIntumescente, MaterialModel produto, List <ItensOrcamentoIntumescenteModel> itensOrcamentoIntumescente,
                                   int orcamentoId, string nomeObra, string referencia, string prazoEntrega, int diasTrabalhado, DateTime dataCriacaoOrcamento,
                                   string contatoObra, string tipoObra, TotaisOrcamentoModel totaisOrcamento, PessoaModel clienteOrcamento,
                                   List <MaoObraOrcamentoModel> maoObraOrcamento, List <CustoOrcamentoModel> custoOrcamento,
                                   List <EquipamentoOrcamentoModel> equipamentoOrcamento, List <MaterialOrcamentoModel> materialOrcamento) : base(orcamentoId, nomeObra, referencia,
                                                                                                                                                  prazoEntrega, diasTrabalhado, dataCriacaoOrcamento, contatoObra, tipoObra, totaisOrcamento, clienteOrcamento,
                                                                                                                                                  maoObraOrcamento, custoOrcamento, equipamentoOrcamento, materialOrcamento)
 {
     GRUPO                             = grupo;
     OCUPACAO_USO                      = ocupacaoUso;
     CLASSE                            = classe;
     DIVISAO                           = divisao;
     TEMPO_RESISTENCIA_FOGO            = tempoResistenciaFogo;
     QTDE_LITROS_TOTAL                 = qtdeLitrosTotal;
     PERCENTUAL_PERDA                  = percentualPerda;
     QTDE_BALDES                       = qtdeBaldes;
     QTDE_BALDES_REAL                  = qtdeBaldesReal;
     VALOR_UNITARIO_INTUMESCENTE       = valorUnitarioIntumescente;
     VALOR_BALDE_INTUMESCENTE          = valorBaldeIntumescente;
     PRODUTO                           = produto;
     LIST_ITENS_ORCAMENTO_INTUMESCENTE = itensOrcamentoIntumescente;
     ORCAMENTO_ID                      = orcamentoId;
     NOME_OBRA                         = nomeObra;
     REFERENCIA                        = referencia;
     PRAZO_ENTREGA                     = prazoEntrega;
     DIAS_TRABALHADO                   = diasTrabalhado;
     DATA_CRIACAO_ORCAMENTO            = dataCriacaoOrcamento;
     A_C                        = contatoObra;
     TIPO_OBRA                  = tipoObra;
     TOTAIS_ORCAMENTO           = totaisOrcamento;
     CLIENTE_ORCAMENTO          = clienteOrcamento;
     LIST_MAO_OBRA_ORCAMENTO    = maoObraOrcamento;
     LIST_CUSTO_ORCAMENTO       = custoOrcamento;
     LIST_EQUIPAMENTO_ORCAMENTO = equipamentoOrcamento;
     LIST_MATERIAL_ORCAMENTO    = materialOrcamento;
 }
        private async void BtnCreateMaterials_Click(object sender, RoutedEventArgs e)
        {
            if (listSelectObjs.Items.Count == 0 || objType == null || objType.TypeInfo == null)
            {
                return;
            }
            if (objType.Name != "Texture")
            {
                MessageBox.Show($"select texture to create material");
                return;
            }

            int success = 0;

            foreach (var item in listObjs.SelectedItems)
            {
                EntityBase entity = item as EntityBase;
                if (entity == null)
                {
                    continue;
                }
                // get object first.
                var texRes = await Logic.BambooEditor.Instance.api.GetAsync <TextureModel>("/texture/" + entity.id);

                var           texture  = texRes.Content;
                MaterialModel material = new MaterialModel();
                material.iconFileAsset = texture.iconFileAsset;
                material.IconUrl       = texture.IconUrl;
                material.name          = texture.name;
                material.parameters    = $"T&_ParamsName=ParamsName;ParamsNameId=Y6UK36GY8AA5P6;ParamsNameIcon={texture.IconUrl};ParamsNameP=;ParamsNameU=;";
                var result = await Logic.BambooEditor.Instance.api.PostAsync("/material", material);

                if (result.IsSuccess)
                {
                    success++;
                }
            }
        }
Exemplo n.º 10
0
        public static MaterialModel GetMaterial(object Code)
        {
            MaterialModel model      = new MaterialModel();
            SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString());

            try
            {
                model = new MaterialBLL().GetModel(Code, connection);
                connection.Close();
            }
            catch (SqlException exception)
            {
                throw exception;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Dispose();
                }
            }
            return(model);
        }
Exemplo n.º 11
0
        public MaterialModel GetMterialModel()
        {
            List <tbl_Category>    Category;
            List <tbl_SubCategory> SubCategory;
            List <tbl_Vendor>      Vendor;
            MaterialModel          MaterialModel;
            List <tbl_Material>    Material;
            List <tbl_UOM>         UOM;

            try
            {
                MaterialModel = new MaterialModel();
                Category      = this.GetAllCategory();
                SubCategory   = this.GetAllSubCategory();
                Vendor        = this.GetAllVendor();
                Material      = this.GetAll();
                UOM           = this.GetAllUOM();

                MaterialModel.GetAllCategory    = Category;
                MaterialModel.GetAllSubCategory = SubCategory;
                MaterialModel.GetAllVendor      = Vendor;
                MaterialModel.GetAllMaterial    = Material;
                MaterialModel.MUOM = UOM;

                return(MaterialModel);
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
                Category    = null;
                SubCategory = null;
                Vendor      = null;
            }
        }
Exemplo n.º 12
0
        private void CreateMaterialAndGeometry(MaterialModel materalModel, GeometryModel geometryModel)
        {
            Material = new Material
            {
                armatura = ReinforcementType.GetArmatura().Find(x => x.name == materalModel.SelectedReinf),
                beton    = betonServices.GetNew(materalModel.SelectedConcrete),
            };

            Material.beton.αcc = Settings.MaterialSettings.alfa_cc;

            Geometry = new ElementGeometryWithReinfI
            {
                b            = geometryModel.b,
                h            = geometryModel.h,
                d1           = geometryModel.d1,
                d2           = geometryModel.d2,
                As_1         = geometryModel.As_1,
                As_2         = geometryModel.As_2,
                b_eff_top    = geometryModel.b_eff_top,
                h_f_top      = geometryModel.h_f_top,
                b_eff_bottom = geometryModel.b_eff_bottom,
                h_f_bottom   = geometryModel.h_f_bottom,
            };
        }
Exemplo n.º 13
0
        public static int SelectMaterialID(MaterialModel material)
        {
            string procedure = "[dbo].[SelectMaterialID]";
            var    p         = new DynamicParameters();

            p.Add("@id", dbType: DbType.Int32, direction: ParameterDirection.ReturnValue);
            p.Add("@material", material.MaterialNumber);
            int i;

            using (IDbConnection connection = new SqlConnection(sapConnect))
            {
                try
                {
                    var retrun = connection.Query(procedure, p, commandType: CommandType.StoredProcedure);
                    i = p.Get <int>("@id");
                }
                catch (Exception e)
                {
                    txtWriter.writeInfo($"{material.MaterialNumber}, {e}");
                    throw;
                }
            }
            return(i);
        }
Exemplo n.º 14
0
        /// <summary>
        /// 处理数据总表
        /// </summary>
        /// <param name="orderMaterialInfo"></param>
        /// <param name="iqcNeedInspectionsItemdatas"></param>
        /// <returns></returns>
        private List <InspectionItemDataSummaryVM> HandleInspectionSummayDatas(MaterialModel orderMaterialInfo, List <InspectionIqcItemConfigModel> iqcNeedInspectionsItemdatas)
        {
            List <InspectionItemDataSummaryVM> returnList = new List <InspectionItemDataSummaryVM>();
            InspectionItemDataSummaryVM        model      = null;

            iqcNeedInspectionsItemdatas.ForEach(m =>
            {
                var inspectionMode = GetJudgeInspectionMode("IQC", m.MaterialId, m.InspectionItem);
                ///得到检验方法数据
                var inspectionModeConfigModelData = this.GetInspectionModeConfigDataBy(m.InspectionLevel, m.InspectionAQL, orderMaterialInfo.ProduceNumber, inspectionMode);
                ///得到已经检验的数据
                var iqcHaveInspectionData = DetailDatasGather.GetIqcInspectionDetailModelBy(orderMaterialInfo.OrderID, orderMaterialInfo.ProductID, m.InspectionItem);
                ///初始化 综合模块
                InitializeSummaryVM(out model, orderMaterialInfo, iqcNeedInspectionsItemdatas, m, inspectionMode);
                ///加载已经录入的数据
                SetHaveInspectionItemDataVaule(model, iqcHaveInspectionData);
                ///加载项目的抽样方案
                SetItemModeConfig(model, inspectionModeConfigModelData);
                returnList.Add(model);
                //产生测试项目先存入到数据库中(如果存在 直接反回)
                DetailDatasGather.InitializestoreInspectionDetial(model);
            });
            return(returnList);
        }
        public async void CreatePostAndVerify1()
        {
            var client  = GetClient();
            var request = new RestRequest {
                Resource = "api/materials/"
            };

            request.Method = Method.POST;
            request.Parameters.Clear();
            request.AddHeader("Accept", "application/json");
            request.AddHeader(TenantModel.DomainField, BoschTenants.BoschBlueDomain);
            var aMaterial = new MaterialModel {
                Name = "A test material", TenantDomain = "Bosch Blue"
            };

            request.AddParameter("application/json", aMaterial, ParameterType.RequestBody);
            var response = await client.Execute(request);

            Assert.NotNull(response);
            Assert.NotNull(response.Content);
            Assert.True(response.StatusCode == HttpStatusCode.OK);

            client.Dispose();
        }
        public IHttpActionResult Change(MaterialModel materialModel)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.BadRequest(this.ModelState));
            }

            var material = this.StudentSystemData.Materials.Find(materialModel.MaterialId);

            if (material == null)
            {
                return(this.NotFound());
            }

            try
            {
                material.DownloadUrl = materialModel.DownloadUrl;
                material.HomeworkId  = materialModel.HomeworkId;
                materialModel.Type   = materialModel.Type;

                this.StudentSystemData.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!this.MaterialExists(materialModel.MaterialId))
                {
                    return(this.NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(this.StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 17
0
 public void Update(int materialId, MaterialModel material)
 {
     try
     {
         using (var cn = Conexao.AbrirConexao())
         {
             cn.Execute(@"UPDATE T_ORCA_MATERIAL SET NOME_MATERIAL = @NOME_MATERIAL, 
                         DESCRICAO_MATERIAL = @DESCRICAO_MATERIAL, TIPO_MATERIAL = @TIPO_MATERIAL, 
                         PESSOA_ID = @PESSOA_ID, NOME_PESSOA = @NOME_PESSOA WHERE MATERIAL_ID = @materialId", new
             {
                 material.NOME_MATERIAL,
                 material.DESCRICAO_MATERIAL,
                 material.TIPO_MATERIAL,
                 material.FABRICANTE.PESSOA_ID,
                 material.FABRICANTE.NOME_PESSOA,
                 materialId
             });
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 18
0
        public PartialViewResult GetMaterialById(string MaterialID)
        {
            List <Proc_LoadMaterialDetails_Result> MaterialDetails = new List <Proc_LoadMaterialDetails_Result>();

            MaterialDetails = MaterialBL.GetByIDMaterial(MaterialID);

            MM = MaterialBL.GetMterialModel();
            MM.GetByIDMaterial = MaterialDetails;
            MM.MaterialID      = MaterialDetails.FirstOrDefault().MaterialID;
            MM.MaterialDesc1   = MaterialDetails.FirstOrDefault().MaterialDesc1;
            MM.MaterialDesc2   = MaterialDetails.FirstOrDefault().MaterialDesc2;
            MM.CategoryID      = MaterialDetails.FirstOrDefault().CategoryID;
            MM.SubCategoryID   = MaterialDetails.FirstOrDefault().SubCategoryID;
            MM.BaseUOM         = MaterialDetails.FirstOrDefault().BaseUOM;
            MM.Cost            = MaterialDetails.FirstOrDefault().Cost;
            MM.VendorID        = MaterialDetails.FirstOrDefault().VendorID;
            MM.ID = MaterialDetails.FirstOrDefault().ID;

            for (int i = 0; i < MaterialDetails.Count; i++)
            {
                MM.EAN13        = MaterialDetails[i].EAN13.ToString();
                MM.UOM          = MaterialDetails[i].UOM.ToString();
                MM.ConvertValue = Convert.ToDecimal(MaterialDetails[i].ConvertValue);
                MM.EBaseUOM     = MaterialDetails[i].BaseUOM.ToString();
                MM.MaterialMix  = MaterialDetails[i].MaterialMix.ToString();
                MM.Price        = Convert.ToDecimal(MaterialDetails[i].Price);

                PartialView("~/Views/Material/Partial/_MaterialDetailsPartial.cshtml", MM);
            }
            if (MaterialDetails.FirstOrDefault().PreforUOMMaterialID != null && MaterialDetails.FirstOrDefault().PreforUOMEAN13 != null)
            {
                //write textbox id names
                MM.PreforUOM = true;
            }
            return(PartialView("~/Views/Material/Partial/_MaterialDetailsPartial.cshtml", MM));
        }
Exemplo n.º 19
0
        public async Task <List <StockModel> > MaterialUpdate(MaterialModel model, int yardId)
        {
            await this.quarryRepository.MaterialUpdate(model);

            return(await this.StockGet(yardId));
        }
Exemplo n.º 20
0
 public PartialViewResult NewMaterialEntries(string index)
 {
     MM = MaterialBL.GetMterialModel();
     ViewBag.NewEANIndex = index;
     return(PartialView("~/Views/Material/Partial/_MaterialNewEANEntries.cshtml", MM));
 }
Exemplo n.º 21
0
 // GET: Material
 public ActionResult Index()
 {
     MM = MaterialBL.GetMterialModel();
     ViewBag.NewEANIndex = 0;
     return(View(MM));
 }
 public MaterialViewModel(MaterialModel MaterialModel, PrintViewModel PrintViewModel)
 {
     _materialModel  = MaterialModel;
     _printViewModel = PrintViewModel;
 }
Exemplo n.º 23
0
        /// <summary>
        /// Find all of the coordinates of a continuous movement in relative positions.
        /// A continuous movement is defined any series of individual movements where each movement can be executed consecutively without coming to a complete stop.
        /// Continuous movements enable the XYZ stage to transition between each movement without coming to a complete stop.
        /// </summary>
        /// <param name="convertedGCodeLineList"></param>
        /// <param name="materialStartIndex"></param>
        /// <param name="materialEndIndex"></param>
        /// <returns></returns>
        private List <List <MovementModel> > FindContinuousMovements(List <ConvertedGCodeLine> convertedGCodeLineList, MaterialModel materialModel, int materialStartIndex, int materialEndIndex)
        {
            //The outer list contains sets of individual movements. Each set represents a continuous movement.
            //The inner list contains a single movement.
            //The [0][0] would contain the coordinates for the first movement starting from the initial position of the Material.
            List <List <MovementModel> > continuousMovementsList = new List <List <MovementModel> >();

            //If true, then make a new inner list.
            bool startNewContinuousMovement = true;

            //Iterate through the entire Material's GCode.
            //Note the coordinates of every set of continuous movements.
            for (int i = materialStartIndex; i <= materialEndIndex; i++)
            {
                //Find the next coordinate.
                //If it is a part of a continuous movement, then add it to the list.
                if ((convertedGCodeLineList[i].GCode.Length > 2) &&
                    ((convertedGCodeLineList[i].GCode.Substring(0, 3) == "G00") ||
                     (convertedGCodeLineList[i].GCode.Substring(0, 3) == "G01") ||
                     (convertedGCodeLineList[i].GCode.Substring(0, 3) == "G02"))) //Is a movement or print command.
                {
                    //Read the coordinates.
                    MovementModel newMovementModel = ReadCoord(convertedGCodeLineList[i].GCode, i, materialModel);

                    //Make a new inner list if applicable.
                    if (startNewContinuousMovement == true)
                    {
                        continuousMovementsList.Add(new List <MovementModel>());
                        startNewContinuousMovement = false;
                    }

                    //Add continuous movement.
                    continuousMovementsList[continuousMovementsList.Count - 1].Add(newMovementModel);
                }
                else
                {
                    //End of the movement.
                    startNewContinuousMovement = true;
                }
            }

            return(continuousMovementsList);
        }
Exemplo n.º 24
0
        /// <summary>
        /// Adds the "T" (exit speed) parameter to the converted GCode.
        /// </summary>
        /// <param name="continuousMovementsList"></param>
        /// <param name="convertedGCodeLinesList"></param>
        /// <param name="printerModel"></param>
        /// <param name="materialModel"></param>
        private void WriteExitSpeed(List <List <MovementModel> > continuousMovementsList, ref List <ConvertedGCodeLine> convertedGCodeLinesList, MaterialModel materialModel)
        {
            foreach (List <MovementModel> movementsList in continuousMovementsList)
            {
                foreach (MovementModel movement in movementsList)
                {
                    //Append the 'T' exit speed parameter to this movement's converted GCode.
                    if (movement.ExitSpeed != 0)
                    {
                        int    intExitSpeed       = Convert.ToInt32(Math.Floor(movement.ExitSpeed));
                        string exitSpeedParameter = " T" + intExitSpeed.ToString();
                        convertedGCodeLinesList[movement.GCodeIndex].GCode += (exitSpeedParameter.ToString());
                    }
                }

                TickProgressBar(continuousMovementsList);
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// Calculate the velocity profiles and the distances required to reach acceleration and deceleration of each movement.
        /// </summary>
        /// <param name="continuousMovementsList"></param>
        /// <param name="convertedGCodeLineList"></param>
        /// <param name="materialModel"></param>
        /// <returns></returns>
        private void CalculateVelocityProfile(List <List <MovementModel> > continuousMovementsList, MaterialModel materialModel)
        {
            foreach (List <MovementModel> continuousMovement in continuousMovementsList)
            {
                for (int j = 0; j < continuousMovement.Count; j++)
                {
                    double entrySpeed = (j > 0) ? continuousMovement[j - 1].ExitSpeed : 0;

                    //All Axes can have two different profiles:
                    //1. Max speed is attainable and runs through acceleration, cruise at max speed, then deceleration.
                    //2. Max speed is never reached because the number of steps in the movement is too small and deceleration occurs immediately after acceleration.
                    //3. Continuous acceleration/deceleration/no velocity change throughout the entirety of the movement.

                    //Distance to go from entry speed to the maximum allowable exit speed assuming pure acceleration/deceleration throughout the entire movement.
                    double presumedEntryToExitDistance = Math.Abs((continuousMovement[j].ExitSpeed - entrySpeed) / continuousMovement[j].Acceleration) * (entrySpeed + 0.5 * (continuousMovement[j].ExitSpeed - entrySpeed));
                    //Distance required for the movement to attain max speed from entry speed.
                    double presumedEntryToCruiseDistance = ((continuousMovement[j].MaxSpeed - entrySpeed) / continuousMovement[j].Acceleration) * (entrySpeed + 0.5 * (continuousMovement[j].MaxSpeed - entrySpeed));
                    //Distance to decelerate from max speed to exit speed.
                    double presumedCruiseToExitDistance = (continuousMovement[j].MaxSpeed != continuousMovement[j].ExitSpeed)
                        ? ((continuousMovement[j].MaxSpeed - continuousMovement[j].ExitSpeed) / continuousMovement[j].Acceleration) * (continuousMovement[j].ExitSpeed + 0.5 * (continuousMovement[j].MaxSpeed - continuousMovement[j].ExitSpeed))
                        : 0;

                    //Account for the rounding errors of floating point variables.
                    presumedEntryToExitDistance   = Math.Round(presumedEntryToExitDistance, 8);
                    presumedEntryToCruiseDistance = Math.Round(presumedEntryToCruiseDistance, 8);
                    presumedCruiseToExitDistance  = Math.Round(presumedCruiseToExitDistance, 8);
                    double totalDistanceRounded = Math.Round(continuousMovement[j].TotalDistance, 8);

                    //Is there enough distance to accelerate to max speed and form a trapezoid velocity profile?
                    if ((presumedEntryToCruiseDistance + presumedCruiseToExitDistance) < totalDistanceRounded)
                    {
                        //Scenario 1.

                        continuousMovement[j].VelocityProfileType    = VelocityProfileType.Trapezoid;
                        continuousMovement[j].DistanceToCruise       = presumedEntryToCruiseDistance;
                        continuousMovement[j].DistanceToDeceleration = continuousMovement[j].TotalDistance - presumedCruiseToExitDistance;
                    }
                    //Is there enough distance to accelerate then decelerate and form a triangle velocity profile?
                    else if (presumedEntryToExitDistance < totalDistanceRounded)
                    {
                        //Scenario 2.

                        continuousMovement[j].VelocityProfileType = VelocityProfileType.Triangle;
                        //Movement can be divided into two parts for this profile.
                        //One half of the movement involves accelerating to an arbitrary speed, then decelerating back to entry speed. Acceleration == -1 * deceleration so acceleration and deceleration share exactly half of this section's distance.
                        //The other half of the movement involves travelling from the entry speed to the exit speed across presumedEntryToExitDistnce.
                        //Whichever part occurs first depends on whether or not the exit speed is greater than the movement speed.
                        if (entrySpeed >= continuousMovement[j].ExitSpeed)
                        {
                            //Acceleration and deceleration occurs before deceleration to exit speed.
                            continuousMovement[j].DistanceToCruise = continuousMovement[j].DistanceToDeceleration = (continuousMovement[j].TotalDistance - presumedEntryToExitDistance) / 2;
                        }
                        else
                        {
                            //Acceleration to exit speed occurs before further acceleration and deceleration.
                            continuousMovement[j].DistanceToCruise = continuousMovement[j].DistanceToDeceleration = presumedEntryToExitDistance + (continuousMovement[j].TotalDistance - presumedEntryToExitDistance) / 2;
                        }
                    }
                    //Is there enough distance for linear acceleration/deceleration from entry to exit?
                    //Should not be no. This minimal junction speed should have been caught earlier.
                    else if (presumedEntryToExitDistance == totalDistanceRounded)
                    {
                        //Scenario 3.

                        continuousMovement[j].VelocityProfileType = VelocityProfileType.Linear;
                        continuousMovement[j].DistanceToCruise    = continuousMovement[j].DistanceToDeceleration = continuousMovement[j].TotalDistance;
                    }
                    else
                    {
                        //Should not happen.

                        continuousMovement[j].VelocityProfileType = VelocityProfileType.Unset;
                        _parametersModel.ErrorReporterViewModel.ReportError("G-Code Conversion Failed: Junction Calculations Error, Should Not Happen, Please Report This Error To The Developer", "ContinuousMovementIndex: " + continuousMovement[j].GCodeIndex + " ");
                    }
                }

                TickProgressBar(continuousMovementsList);
            }
        }
Exemplo n.º 26
0
        public async void MaterialUpdate(int quarryId)
        {
            // Arrange
            this.QuarryDbContext.Yards.AddRange(
                    new YardEntity() { YardId = 1, YardName = "Central Yard", QuarryId = 1, CompanyId = 1, DeletedInd = false },
                    new YardEntity() { YardId = 2, YardName = "NDB Central Yard", QuarryId = 2, CompanyId = 1, DeletedInd = false });

            this.QuarryDbContext.Materials.Add(new MaterialEntity() { MaterialId = 1, BlockNumber = "1111", QuarryId = 1, YardId = 1, MaterialColourId = 1, ProductTypeId = 1, ProcessTypeId = 1, Length = 0.5m, Width = 0.5m, Height = 0.5m, Weight = 0.5m, MaterialDate = DateTime.Now });
            this.QuarryDbContext.MaterialMovements.Add(new MaterialMovementEntity() { MaterialId = 1, FromYardId = 1, ToYardId = 1 });

            await this.SaveChangesAsync(this.QuarryDbContext);

            await this.StockGetArrange();

            MaterialModel model = new MaterialModel() { MaterialId = 1, BlockNumber = "1112", QuarryId = quarryId, YardId = 1, MaterialColourId = 1, ProductTypeId = 1, ProcessTypeId = 1, Length = 0.5m, Width = 0.5m, Height = 0.5m, Weight = 0.5m, MaterialDate = DateTime.Now };

            // Act
            AjaxModel<List<StockModel>> ajaxModel = await this.Controller.MaterialUpdate(model, 1);

            // Assert
            MaterialEntity materialEntity = this.QuarryDbContext.Materials.Where(m => m.MaterialId == 1).Single();
            List<MaterialMovementEntity> movements = this.QuarryDbContext.MaterialMovements.ToList();

            Assert.Equal(ajaxModel.Message, QuarryMessages.MaterialUpdateSuccess);
            Assert.Equal(materialEntity.BlockNumber, "1112");

            this.StockGetAssert(ajaxModel.Model);
        }
Exemplo n.º 27
0
 protected MaterialFacade(MaterialModel model) : base(model)
 {
 }
        /// <summary>
        /// Interpret a switch material command set and return an array of commands.
        /// </summary>
        /// <param name="commandSet"></param>
        /// <returns></returns>
        private List <string> InterpretSwitchMaterial(string commandSet)
        {
            //Remove "*SwitchMaterial" from the beginning of the command set.
            commandSet = commandSet.Substring(14);

            //Potentially pause before deactivating the current printhead.
            bool pauseBeforeDeactivating = false;

            if (commandSet.Contains('D'))
            {
                pauseBeforeDeactivating = true;
            }

            //Potentially pause after activating the next printhead.
            bool pauseBeforeActivating = false;

            if (commandSet.Contains('A'))
            {
                pauseBeforeActivating = true;
            }

            //Set of commands to be returned at the end of this method.
            List <string> returnCommands = new List <string>();

            //The name of the Material which will be switched to will be between quote characters.
            int           firstNameIndex = commandSet.IndexOf('"');
            int           nameLength     = commandSet.Substring(firstNameIndex + 1).IndexOf('"');
            string        materialName   = commandSet.Substring(firstNameIndex + 1, nameLength);
            MaterialModel materialModel  = _printModel.FindMaterialByName(materialName);

            if (materialModel == null)
            {
                _errorListViewModel.AddError("Command Set Invalid", materialName + " Not Set");
                return(null);
            }

            //References to the current and new Printheads.
            PrintheadModel currentPrintheadModel = _printerModel.FindPrinthead(_realTimeStatusDataModel.ActivePrintheadModel.Name);
            PrintheadModel newPrintheadModel     = materialModel.PrintheadModel;

            //References to the Z Axis on the current Printhead.
            AxisModel currentZAxisModel  = _printerModel.FindAxis(currentPrintheadModel.AttachedZAxisModel.Name);
            int       currentZLimitPinID = (currentZAxisModel.AttachedLimitSwitchGPIOPinModel != null) ? currentZAxisModel.AttachedLimitSwitchGPIOPinModel.PinID : GlobalValues.PinIDNull;

            //References to the XY Axes and new Z Axis.
            AxisModel xAxisModel  = _printerModel.AxisModelList[0];
            int       xLimitPinID = (xAxisModel.AttachedLimitSwitchGPIOPinModel != null) ? xAxisModel.AttachedLimitSwitchGPIOPinModel.PinID : GlobalValues.PinIDNull;
            AxisModel yAxisModel  = _printerModel.AxisModelList[1];
            int       yLimitPinID = (yAxisModel.AttachedLimitSwitchGPIOPinModel != null) ? yAxisModel.AttachedLimitSwitchGPIOPinModel.PinID : GlobalValues.PinIDNull;
            AxisModel zAxisModel  = _printerModel.FindAxis(newPrintheadModel.AttachedZAxisModel.Name);
            int       zLimitPinID = (zAxisModel.AttachedLimitSwitchGPIOPinModel != null) ? zAxisModel.AttachedLimitSwitchGPIOPinModel.PinID : GlobalValues.PinIDNull;

            //If a new Printhead is required...
            if (newPrintheadModel.Name != currentPrintheadModel.Name)
            {
                //1. Set previous Z Axis at max speeds.
                //2. Retract the previous Printhead / Z Axis.
                returnCommands.Add(_writeSetAxisModel.WriteSetAxis('Z', currentZAxisModel.AttachedMotorStepGPIOPinModel.PinID, currentZAxisModel.AttachedMotorDirectionGPIOPinModel.PinID,
                                                                   currentZAxisModel.StepPulseTime, currentZLimitPinID, currentZAxisModel.MaxSpeed, currentZAxisModel.MaxAcceleration, currentZAxisModel.MmPerStep));
                List <string> retractZ = RetractZ("", currentPrintheadModel.AttachedZAxisModel);
                foreach (string command in retractZ)
                {
                    if (!String.IsNullOrWhiteSpace(command))
                    {
                        returnCommands.Add(command);
                    }
                }

                //Pause before deactivating.
                if (pauseBeforeDeactivating == true)
                {
                    returnCommands.Add(SerialMessageCharacters.SerialPrintPauseCharacter.ToString());
                }

                //3. Set new XYZ to max speeds and move to the new Offset.
                //Set associated X Axis at max speeds.
                returnCommands.Add(_writeSetAxisModel.WriteSetAxis('X', xAxisModel.AttachedMotorStepGPIOPinModel.PinID, xAxisModel.AttachedMotorDirectionGPIOPinModel.PinID,
                                                                   xAxisModel.StepPulseTime, xLimitPinID, xAxisModel.MaxSpeed, xAxisModel.MaxAcceleration, xAxisModel.MmPerStep));
                //Set associated Y Axis at max speeds.
                returnCommands.Add(_writeSetAxisModel.WriteSetAxis('Y', yAxisModel.AttachedMotorStepGPIOPinModel.PinID, yAxisModel.AttachedMotorDirectionGPIOPinModel.PinID,
                                                                   yAxisModel.StepPulseTime, yLimitPinID, yAxisModel.MaxSpeed, yAxisModel.MaxAcceleration, yAxisModel.MmPerStep));
                //Set associated Z Axis at max speeds.
                returnCommands.Add(_writeSetAxisModel.WriteSetAxis('Z', zAxisModel.AttachedMotorStepGPIOPinModel.PinID, zAxisModel.AttachedMotorDirectionGPIOPinModel.PinID,
                                                                   zAxisModel.StepPulseTime, zLimitPinID, zAxisModel.MaxSpeed, zAxisModel.MaxAcceleration, zAxisModel.MmPerStep));
                //4.Move to the new Offset at max speeds.
                double        zPosition    = _realTimeStatusDataModel.ZRealTimeStatusAxisModel.Position;
                List <string> moveToOffset = WriteMoveToOffset(newPrintheadModel, currentPrintheadModel, zPosition, pauseBeforeActivating);
                foreach (string command in moveToOffset)
                {
                    if (!String.IsNullOrWhiteSpace(command))
                    {
                        returnCommands.Add(command);
                    }
                }
            }

            //5.Set the print speed parameters for the new Material.
            //Set associated X Axis at print speeds.
            returnCommands.Add(_writeSetAxisModel.WriteSetAxis('X', xAxisModel.AttachedMotorStepGPIOPinModel.PinID, xAxisModel.AttachedMotorDirectionGPIOPinModel.PinID,
                                                               xAxisModel.StepPulseTime, xLimitPinID, materialModel.XYPrintSpeed, materialModel.XYPrintAcceleration, xAxisModel.MmPerStep));
            //Set associated Y Axis at print speeds.
            returnCommands.Add(_writeSetAxisModel.WriteSetAxis('Y', yAxisModel.AttachedMotorStepGPIOPinModel.PinID, yAxisModel.AttachedMotorDirectionGPIOPinModel.PinID,
                                                               yAxisModel.StepPulseTime, yLimitPinID, materialModel.XYPrintSpeed, materialModel.XYPrintAcceleration, yAxisModel.MmPerStep));
            //Set associated Z Axis at print speeds.
            returnCommands.Add(_writeSetAxisModel.WriteSetAxis('Z', zAxisModel.AttachedMotorStepGPIOPinModel.PinID, zAxisModel.AttachedMotorDirectionGPIOPinModel.PinID,
                                                               zAxisModel.StepPulseTime, zLimitPinID, materialModel.ZPrintSpeed, materialModel.ZPrintAcceleration, zAxisModel.MmPerStep));

            //6. Set the new Printhead at print speeds.
            string setNewPrinthead = _setWritePrintheadModel.SetWritePrinthead(newPrintheadModel);

            returnCommands.Add(setNewPrinthead);

            return(returnCommands);
        }
Exemplo n.º 29
0
        public JsonResult List()
        {
            var mongo = new MongoHelper();

            // 获取所有类别
            var filter = Builders <BsonDocument> .Filter.Eq("Type", "Material");

            var categories = mongo.FindMany(Constant.CategoryCollectionName, filter).ToList();

            var docs = new List <BsonDocument>();

            if (ConfigHelper.EnableAuthority)
            {
                var user = UserHelper.GetCurrentUser();

                if (user != null)
                {
                    var filter1 = Builders <BsonDocument> .Filter.Eq("UserID", user.ID);

                    if (user.Name == "Administrator")
                    {
                        var filter2 = Builders <BsonDocument> .Filter.Exists("UserID");

                        var filter3 = Builders <BsonDocument> .Filter.Not(filter2);

                        filter1 = Builders <BsonDocument> .Filter.Or(filter1, filter3);
                    }
                    docs = mongo.FindMany(Constant.MaterialCollectionName, filter1).ToList();
                }
            }
            else
            {
                docs = mongo.FindAll(Constant.MaterialCollectionName).ToList();
            }

            var list = new List <MaterialModel>();

            foreach (var i in docs)
            {
                var categoryID   = "";
                var categoryName = "";

                if (i.Contains("Category") && !i["Category"].IsBsonNull && !string.IsNullOrEmpty(i["Category"].ToString()))
                {
                    var doc = categories.Where(n => n["_id"].ToString() == i["Category"].ToString()).FirstOrDefault();
                    if (doc != null)
                    {
                        categoryID   = doc["_id"].ToString();
                        categoryName = doc["Name"].ToString();
                    }
                }

                var info = new MaterialModel
                {
                    ID           = i["ID"].AsObjectId.ToString(),
                    Name         = i["Name"].AsString,
                    CategoryID   = categoryID,
                    CategoryName = categoryName,
                    TotalPinYin  = i["TotalPinYin"].ToString(),
                    FirstPinYin  = i["FirstPinYin"].ToString(),
                    CreateTime   = i["CreateTime"].ToUniversalTime(),
                    UpdateTime   = i["UpdateTime"].ToUniversalTime(),
                    Thumbnail    = i.Contains("Thumbnail") && !i["Thumbnail"].IsBsonNull ? i["Thumbnail"].ToString() : null
                };

                list.Add(info);
            }

            list = list.OrderByDescending(n => n.UpdateTime).ToList();

            return(Json(new
            {
                Code = 200,
                Msg = "Get Successfully!",
                Data = list
            }));
        }
Exemplo n.º 30
0
        async Task <int> parseCategoryDir(string dir, CategoryModel cate)
        {
            if (cate == null)
            {
                //templog("category is null");
                return(0);
            }

            var files = Directory.GetFiles(dir);

            Dictionary <string, List <MaterialTextureInfo> > textureMap = new Dictionary <string, List <MaterialTextureInfo> >();

            MaterialModel matTemplate = null;

            Logic.CategoryCustomData_Material matTemplateInfo = null;
            if (string.IsNullOrEmpty(cate.customData) == false)
            {
                try
                {
                    matTemplateInfo = Newtonsoft.Json.JsonConvert.DeserializeObject <Logic.CategoryCustomData_Material>(cate.customData);
                }
                catch { }
            }
            if (matTemplateInfo?.TemplateId != null)
            {
                var getres = await Logic.BambooEditor.Instance.api.GetAsync <MaterialModel>("/material/" + matTemplateInfo.TemplateId);

                matTemplate = getres.Content;
                categoryTemplateMap[cate.id] = matTemplate;
            }

            foreach (var file in files)
            {
                MaterialTextureInfo info = new MaterialTextureInfo();
                info.Path = Path.GetDirectoryName(file);
                string filename = Path.GetFileNameWithoutExtension(file);
                info.Name      = "";
                info.ParamName = "";
                int tagIndex = filename.IndexOf('_');
                if (tagIndex > 0)
                {
                    info.Name = filename.Substring(0, tagIndex);
                    if (tagIndex < filename.Length - 1)
                    {
                        info.ParamName = filename.Substring(tagIndex + 1);
                    }
                }
                else
                {
                    info.Name = filename;
                }

                List <MaterialTextureInfo> textures = null;
                if (textureMap.ContainsKey(info.Name))
                {
                    textures = textureMap[info.Name];
                }
                else
                {
                    textures = new List <MaterialTextureInfo>();
                    textureMap[info.Name] = textures;
                }
                textures.Add(info);
            }

            //templog($"{dir} find {files.Length} files, get {textureMap.Count} materials");

            foreach (var item in textureMap)
            {
                MaterialFactoryItem mat = new MaterialFactoryItem();
                mat.TextureList         = item.Value;
                mat.Name                = item.Key;
                mat.CategoryId          = cate.id;
                mat.CategoryPath        = getCategoryPathName(cate);
                mat.MaterialTempateName = matTemplate?.name;

                mat.PropObjToString();
                Items.Add(mat);
            }

            var dirs = Directory.GetDirectories(dir);

            foreach (var d in dirs)
            {
                string        dirname   = Path.GetFileName(d);
                CategoryModel childcate = cate.children.Find(t => t.name == dirname);
                await parseCategoryDir(d, childcate);
            }

            return(textureMap.Count);
        }
Exemplo n.º 31
0
        /// <summary>
        /// Calculate the junction speeds of movements.
        /// Junction speeds are maximized but do not exceed specified parameters.
        /// </summary>
        /// <param name=""></param>
        /// <param name=""></param>
        /// <param name=""></param>
        /// <param name="materialModel"></param>
        private void CalculateJunctionSpeeds(List <List <MovementModel> > continuousMovementsList, MaterialModel materialModel)
        {
            //The junction speed is limited by how quickly all of the steppers can decelerate to zero by the very end of the continuous movement assuming they travelled at max speed until the last possible moment.
            //The junction speed is also limited by the centripedial acceleration of the XYZ stage during cornering.
            //The junction speed is also limited by the adjacent movement's entry and exit speeds.
            //In other words, the more continous movement length remaining, the higher the junction speed.
            //The faster the stepper's acceleration/deceleration, the higher the junction speed.
            //The higher the junction deviation, the higher the junction speed.
            //Junction speed is in units of steps / s.

            //For each continuous movement...
            for (int i = 0; i < continuousMovementsList.Count; i++)
            {
                //Calculate the junction speed such that:
                //1. Centripedal acceleration is not exceeded.
                //2. Enough time is given for the XYZ stage to decelerate to the exit junction speed.
                //Exit speeds for the last movement of each continuous movement is zero as all Axes come to a halt.
                //3. Maximum speed of the movement is not exceeded.
                //Start from the movement that will be executed last and proceed towards the first movement.
                continuousMovementsList[i][continuousMovementsList[i].Count - 1].ExitSpeed = 0; //Last movement's exit speed is always zero.
                for (int j = continuousMovementsList[i].Count - 1; j >= 0; j--)
                {
                    MovementModel currentMovement = continuousMovementsList[i][j];

                    if (j > 0)
                    {
                        MovementModel previousMovement = continuousMovementsList[i][j - 1];

                        //1. Calculate junction speed based on centipedal acceleration.
                        double junctionAcceleration         = Math.Min(currentMovement.Acceleration, previousMovement.Acceleration);
                        double junctionAngle                = CalculateJunctionAngle(currentMovement, previousMovement); //In radians.
                        double centripedalAccelerationSpeed = CalculateJunctionSpeed(junctionAcceleration, materialModel.JunctionDeviation, junctionAngle);
                        previousMovement.ExitSpeed = (Double.IsNaN(centripedalAccelerationSpeed)) ? double.MaxValue : centripedalAccelerationSpeed;

                        //2. Calculate junction speed based on distance to exit.
                        //Minimal entry speed required to finish deceleration by movement's end.
                        double entrySpeedToDecelerate = Math.Sqrt(Math.Pow(currentMovement.ExitSpeed, 2) + 2 * currentMovement.TotalDistance * currentMovement.Acceleration);
                        previousMovement.ExitSpeed = Math.Min(entrySpeedToDecelerate, previousMovement.ExitSpeed);

                        //3. Calculate junction speed based on max speed of adjacent movements.
                        //Ensure neither movement's max speed is exceeded.
                        double junctionMaxSpeed = Math.Min(previousMovement.MaxSpeed, currentMovement.MaxSpeed);
                        previousMovement.ExitSpeed = Math.Min(junctionMaxSpeed, previousMovement.ExitSpeed);
                    }
                    else
                    {
                        //First movement in this continuous movement.
                        //No previous movement. Nothing to calculate.
                    }
                }

                //Calculate the junction speed such that:
                //1. Enough time is given for the XYZ stage to accelerate to the junction speed.
                //Entry speed for the first movement for each continuous movement is zero.
                //Start from the first movement that will be execute and proceed towards the last.
                //The first movement's entry speed is always zero.
                for (int j = 0; j < continuousMovementsList[i].Count - 1; j++)
                {
                    MovementModel currentMovement = continuousMovementsList[i][j];

                    //1. Calculate junction speed based on distance from entry.
                    if (j > 0)
                    {
                        MovementModel previousMovement = continuousMovementsList[i][j - 1];

                        double exitSpeedFromAcceleration = Math.Sqrt(Math.Pow(previousMovement.ExitSpeed, 2) + 2 * currentMovement.TotalDistance * currentMovement.Acceleration);
                        currentMovement.ExitSpeed = Math.Min(exitSpeedFromAcceleration, currentMovement.ExitSpeed);
                    }
                    else
                    {
                        //First movement in this continuous movement.
                        double exitSpeedFromAcceleration = Math.Sqrt(2 * currentMovement.TotalDistance * currentMovement.Acceleration);
                        currentMovement.ExitSpeed = Math.Min(exitSpeedFromAcceleration, currentMovement.ExitSpeed);
                    }
                }

                TickProgressBar(continuousMovementsList);
            }
        }