Exemple #1
0
        public List<Container> CalculateLoadScheme(List<Container> containers,
            ObservableCollection<Vehicle> selectedVehicles, TextBox textBox, int maxTonnage)
        {
            // BtnCalculate_click
            int tempMaxTonnage;
            var widthBetweenVehicles = 1000;
            var tempPoint = new Point3D(0, 0, 0);
            textBox.Clear();
            textBox.AppendText("Протокол расчета схемы загрузки:\n");
            var tempList = RotateContainers(containers);

            foreach (var vehicle in selectedVehicles)
            {
                LocateContainers locateContainers = new LocateContainers(vehicle);

                tempMaxTonnage = maxTonnage == 0 ? vehicle.Tonnage : maxTonnage;
                tempList = locateContainers.DownloadContainers(tempList, tempMaxTonnage);
                SetFirstPoint(tempPoint,vehicle);
                tempPoint.Y = tempPoint.Y + widthBetweenVehicles + vehicle.Width;// TODO tempPoint.Z = tempPoint.Z + widthBetweenVehicles + vehicle.Width;
                PutCargoInfoInTextBox(vehicle, textBox);
                CheckOverweight(vehicle, textBox, tempMaxTonnage);
                VehicleAxisMass vehicleAxisMass = new VehicleAxisMass(vehicle, vehicle.Mass);
                PutVehAxisMassInfoInTextBox(vehicleAxisMass.AxisMassCalculate(), textBox);
            }
            PutWasteContainersInfoInTextBox(tempList, textBox);
            CheckErrors(tempList, textBox, selectedVehicles, containers);

            return tempList;
        }
        private void AddDescription(FlowDocument doc, Vehicle vehicle)
        {
            var fromTempListToContList = new FromTempListToContList();
            var tempList = vehicle.VehicleToContainerList();
            tempList = fromTempListToContList.ToContainerList(tempList);
            //tempList.AddRange(v.smallBlocks);
            var shipmentList = DistinctShipmentID(tempList);
            foreach (var order in shipmentList)
            {
                var tempList2 = tempList.Where(c => c.ShipmentId == order).ToList();
                AddRow(doc,
                    "Грузоотправление: " + tempList2[0].ShipmentId + ".    Грузополучатель: " + tempList2[0].ShipToName +
                    ".    Количество тар: " + tempList2.Count());
            }
            AddRow(doc, "Общий вес:" + vehicle.Mass + " кг.");

            VehicleAxisMass vehicleAxisMass = new VehicleAxisMass(vehicle, vehicle.Mass);
            var axisMassList=vehicleAxisMass.AxisMassCalculate();
            for (int i = 0; i < axisMassList.Count; i++)
            {
                AddRow(doc, String.Format("Нагрузка на ось{0} - {1:0.000} \n", (i + 1), axisMassList[i]));
            }
        }