Beispiel #1
0
        protected void UpdateImage()
        {
            byte[]   imageBytes = null;
            int      caseCount = 0;
            int      layerCount = 0;
            double   weightLoad = 0.0, weightTotal = 0.0;
            Vector3D bbLoad  = Vector3D.Zero;
            Vector3D bbTotal = Vector3D.Zero;

            PalletStacking.GetSolution(
                DimCase, WeightCase, BitmapTexture,
                DimPallet, WeightPallet,
                MaxPalletHeight, BoxPositions,
                ChkbMirrorLength.Checked, ChkbMirrorWidth.Checked,
                InterlayersBoolArray,
                Angle,
                new Size(550, 550),
                ref imageBytes, ref caseCount, ref layerCount, ref weightLoad, ref weightTotal, ref bbLoad, ref bbTotal);

            Session[SessionVariables.ImageWidth]  = 550;
            Session[SessionVariables.ImageHeight] = 550;
            Session[SessionVariables.ImageBytes]  = imageBytes;

            ImagePallet.ImageUrl = "~/Handler.ashx?param=" + DateTime.Now.Ticks.ToString();

            loadedPallet.Update();
        }
Beispiel #2
0
        protected void BTRefresh_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (Page.IsValid)
            {
                bool onlyBestLayers = false;

                DimCase         = DimCaseCtrl;
                WeightCase      = WeightCaseCtrl;
                DimPallet       = DimPalletCtrl;
                WeightPallet    = WeightPalletCtrl;
                MaxPalletHeight = MaxPalletHeightCtrl;

                List <LayerDetails> listLayers = new List <LayerDetails>();
                PalletStacking.GetLayers(DimCaseCtrl, WeightCaseCtrl, DimPalletCtrl, WeightPalletCtrl, MaxPalletHeightCtrl, onlyBestLayers, ref listLayers);

                dlLayers.DataSource = listLayers;
                dlLayers.DataBind();
                layersUpdate.Update();
                ExecuteKeyPad();
                PalletDetails.DataSource = null;
                PalletDetails.DataBind();
                dlLayers.SelectedIndex = -1;

                selectedLayer.Update();
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Angle = 45.0;
                ChkbMirrorLength.Checked = LayersMirrorLength;
                ChkbMirrorWidth.Checked  = LayersMirrorWidth;
                TBFileName.Text          = FileName;

                var interlayerArray = Interlayers.Select(p => p == '1' ? true : false).ToArray();
                var listInterlayers = new List <InterlayerDetails>();
                PalletStacking.InitializeInterlayers(DimCase, DimPallet, MaxPalletHeight, string.Empty, ref listInterlayers);
                for (var i = 0; i < interlayerArray.Length; ++i)
                {
                    if (i < listInterlayers.Count)
                    {
                        listInterlayers[i].Activated = interlayerArray[i];
                    }
                }

                listInterlayers.Reverse();
                LVInterlayers.DataSource = listInterlayers;
                LVInterlayers.DataBind();
            }
            ExecuteKeyPad();
            UpdateImage();
        }
Beispiel #4
0
        protected void BTRefresh_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (Page.IsValid)
            {
                DimCase        = DimCaseCtrl;
                WeightCase     = WeightCaseCtrl;
                PalletIndex    = PalletIndexCtrl;
                WeightPallet   = WeightPalletCtrl;
                NumberOfLayers = NumberOfLayersCtrl;

                if (DimCase.X < 50 || DimCase.Y < 50 || DimCase.Z < 50)
                {
                    return;
                }

                List <LayerDetails> listLayers = new List <LayerDetails>();
                PalletStacking.GetLayers(DimCaseCtrl, WeightCaseCtrl, PalletIndexCtrl, WeightPalletCtrl, NumberOfLayersCtrl, false, ref listLayers);

                dlLayers.DataSource = listLayers;
                dlLayers.DataBind();
                layersUpdate.Update();
                ExecuteKeyPad();
                PalletDetails.DataSource = null;
                PalletDetails.DataBind();
                dlLayers.SelectedIndex = -1;

                selectedLayer.Update();
            }
        }
Beispiel #5
0
        protected void OnExport(object sender, EventArgs e)
        {
            try
            {
                string fileName = TBFileName.Text;
                fileName = Path.ChangeExtension(fileName, "csv");

                byte[] fileBytes      = null;
                byte[] imageFileBytes = null;
                PalletStacking.Export(
                    DimCase, WeightCase,
                    DimPallet, WeightPallet,
                    MaxPalletHeight, BoxPositions,
                    ChkbMirrorLength.Checked, ChkbMirrorWidth.Checked,
                    InterlayersBoolArray,
                    ref fileBytes,
                    ParseImageFormat(ConfigSettings.ExportImageFormat),
                    ref imageFileBytes);

                if (FtpHelpers.Upload(fileBytes, ConfigSettings.FtpDirectory, fileName, ConfigSettings.FtpUsername, ConfigSettings.FtpPassword) &&
                    FtpHelpers.Upload(imageFileBytes, ConfigSettings.FtpDirectory + "Images/", Path.ChangeExtension(fileName, ConfigSettings.ExportImageFormat), ConfigSettings.FtpUsername, ConfigSettings.FtpPassword))
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", $"alert('{fileName} was successfully exported!');", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", $"alert('{ex.Message}');", true);
            }
        }
Beispiel #6
0
        protected void UpdateImage()
        {
            // clear output directory
            DirectoryHelpers.ClearDirectory(Output);

            int    caseCount = 0, layerCount = 0;
            double weightLoad = 0.0, weightTotal = 0.0;
            var    bbLoad   = Vector3D.Zero;
            var    bbTotal  = Vector3D.Zero;
            string fileGuid = Guid.NewGuid().ToString() + ".glb";

            PalletStacking.GenerateExport(
                DimCase, WeightCase, BitmapTexture,
                DimPallet, WeightPallet,
                MaxPalletHeight,
                BoxPositions,
                ChkbMirrorLength.Checked, ChkbMirrorWidth.Checked,
                InterlayersBoolArray,
                Path.Combine(Output, fileGuid),
                ref caseCount, ref layerCount,
                ref weightLoad, ref weightTotal,
                ref bbLoad, ref bbTotal
                );

            XModelDiv.InnerHtml = $"<x-model class=\"x-model\" src=\"./Output/{fileGuid}\"/>";

            loadedPallet.Update();
        }
Beispiel #7
0
        protected void UpdateImage()
        {
            // clear output directory
            DirectoryHelpers.ClearDirectory(Output);

            Vector3D caseDim         = DimCaseCtrl;
            double   caseWeight      = WeightCaseCtrl;
            Vector3D palletDim       = DimPalletCtrl;
            double   palletWeight    = WeightPalletCtrl;
            double   maxPalletHeight = MaxPalletHeightCtrl;

            byte[]      imageBytes = null;
            int         caseCount = 0;
            int         layerCount = 0;
            double      weightLoad = 0.0, weightTotal = 0.0;
            Vector3D    bbLoad      = Vector3D.Zero;
            Vector3D    bbTotal     = Vector3D.Zero;
            string      fileGuid    = Guid.NewGuid().ToString() + ".glb";
            List <bool> interlayers = new List <bool>();

            PalletStacking.GenerateExport(
                caseDim, caseWeight, BitmapTexture,
                palletDim, palletWeight,
                maxPalletHeight,
                BoxPositionsLayer,
                false, false,
                interlayers,
                Path.Combine(Output, fileGuid),
                ref caseCount, ref layerCount,
                ref weightLoad, ref weightTotal,
                ref bbLoad, ref bbTotal
                );

            XModelDiv.InnerHtml = string.Format("<x-model class=\"x-model\" src=\"./Output/{0}\"/>", fileGuid);

            var palletDetails = new List <PalletDetails>
            {
                new PalletDetails("Number of cases", $"{caseCount}", ""),
                new PalletDetails("Layer count", $"{layerCount}", ""),
                new PalletDetails("Load weight", $"{weightLoad}", "kg"),
                new PalletDetails("Total weight", $"{weightTotal}", "kg"),
                new PalletDetails("Load dimensions", $"{bbLoad.X} x {bbLoad.Y} x {bbLoad.Z}", "mm"),
                new PalletDetails("Overall dimensions", $"{bbTotal.X} x {bbTotal.Y} x {bbTotal.Z}", "mm")
            };

            PalletDetails.DataSource = palletDetails;
            PalletDetails.DataBind();

            DimCase         = caseDim;
            DimPallet       = palletDim;
            MaxPalletHeight = maxPalletHeight;
            Session[SessionVariables.ImageWidth]  = 500;
            Session[SessionVariables.ImageHeight] = 460;
            Session[SessionVariables.ImageBytes]  = imageBytes;

            selectedLayer.Update();
        }
Beispiel #8
0
        private void UpdateImage()
        {
            var caseDim         = DimCaseCtrl;
            var caseWeight      = WeightCaseCtrl;
            var palletDim       = DimPalletCtrl;
            var palletWeight    = WeightPalletCtrl;
            var maxPalletHeight = MaxPalletHeightCtrl;

            byte[] imageBytes = null;
            int    caseCount = 0;
            int    layerCount = 0;
            double weightLoad = 0.0, weightTotal = 0.0;
            var    bbLoad  = Vector3D.Zero;
            var    bbTotal = Vector3D.Zero;

            PalletStacking.GetSolution(
                caseDim, caseWeight, BitmapTexture,
                palletDim, palletWeight,
                maxPalletHeight,
                BoxPositionsLayer,
                false, false,
                new List <bool>(),
                Angle,
                new Size(500, 460),
                ref imageBytes,
                ref caseCount, ref layerCount,
                ref weightLoad, ref weightTotal,
                ref bbLoad, ref bbTotal
                );

            var palletDetails = new List <PalletDetails>
            {
                new PalletDetails("Number of cases", $"{caseCount}", ""),
                new PalletDetails("Layer count", $"{layerCount}", ""),
                new PalletDetails("Load weight", $"{weightLoad}", "kg"),
                new PalletDetails("Total weight", $"{weightTotal}", "kg"),
                new PalletDetails("Load dimensions", $"{bbLoad.X} x {bbLoad.Y} x {bbLoad.Z}", "mm"),
                new PalletDetails("Overall dimensions", $"{bbTotal.X} x {bbTotal.Y} x {bbTotal.Z}", "mm")
            };

            PalletDetails.DataSource = palletDetails;
            PalletDetails.DataBind();

            DimCase         = caseDim;
            DimPallet       = palletDim;
            MaxPalletHeight = maxPalletHeight;
            Session[SessionVariables.ImageWidth]  = 500;
            Session[SessionVariables.ImageHeight] = 460;
            Session[SessionVariables.ImageBytes]  = imageBytes;

            selectedLayer.Update();
        }