Пример #1
0
        public void LCATheoreticalMinimumWeightTest()
        {
            LCASettings settings = GetBasicSettings();

            settings.DoDistPhase   = false;
            settings.DoBeautyPhase = false;

            LCAWrapper lca = new LCAWrapper(settings);

            lca.AddArea("TEST_AREA", 1, 1);

            lca.AddAisle("TEST_AREA", "TEST_AISLE", 1, 1, 1, 1, "+");

            lca.AddPickBatchLine("TEST_PBROW_1", 1, "TEST_PRODUCT", "TEST_COMPANY", 1, 1, 5, "TEST_AREA", "TEST_AISLE", "TEST_PRODUCT_GROUP", "TEST_CAT_GROUP", 1, 1, "TEST_WPADR");
            lca.AddPickBatchLine("TEST_PBROW_2", 2, "TEST_PRODUCT", "TEST_COMPANY", 1, 1, 5, "TEST_AREA", "TEST_AISLE", "TEST_PRODUCT_GROUP", "TEST_CAT_GROUP", 1, 1, "TEST_WPADR");
            lca.AddPickBatchLine("TEST_PBROW_3", 3, "TEST_PRODUCT", "TEST_COMPANY", 1, 1, 5, "TEST_AREA", "TEST_AISLE", "TEST_PRODUCT_GROUP", "TEST_CAT_GROUP", 1, 1, "TEST_WPADR");
            lca.AddPickBatchLine("TEST_PBROW_4", 4, "TEST_PRODUCT", "TEST_COMPANY", 1, 1, 5, "TEST_AREA", "TEST_AISLE", "TEST_PRODUCT_GROUP", "TEST_CAT_GROUP", 1, 1, "TEST_WPADR");
            lca.AddPickBatchLine("TEST_PBROW_5", 5, "TEST_PRODUCT", "TEST_COMPANY", 1, 1, 5, "TEST_AREA", "TEST_AISLE", "TEST_PRODUCT_GROUP", "TEST_CAT_GROUP", 1, 1, "TEST_WPADR");
            lca.AddPickBatchLine("TEST_PBROW_6", 6, "TEST_PRODUCT", "TEST_COMPANY", 1, 1, 5, "TEST_AREA", "TEST_AISLE", "TEST_PRODUCT_GROUP", "TEST_CAT_GROUP", 1, 1, "TEST_WPADR");
            lca.AddPickBatchLine("TEST_PBROW_7", 7, "TEST_PRODUCT", "TEST_COMPANY", 1, 1, 5, "TEST_AREA", "TEST_AISLE", "TEST_PRODUCT_GROUP", "TEST_CAT_GROUP", 1, 1, "TEST_WPADR");
            lca.AddPickBatchLine("TEST_PBROW_8", 8, "TEST_PRODUCT", "TEST_COMPANY", 1, 1, 5, "TEST_AREA", "TEST_AISLE", "TEST_PRODUCT_GROUP", "TEST_CAT_GROUP", 1, 1, "TEST_WPADR");
            lca.AddPickBatchLine("TEST_PBROW_9", 9, "TEST_PRODUCT", "TEST_COMPANY", 1, 1, 5, "TEST_AREA", "TEST_AISLE", "TEST_PRODUCT_GROUP", "TEST_CAT_GROUP", 1, 1, "TEST_WPADR");
            lca.AddPickBatchLine("TEST_PBROW_10", 10, "TEST_PRODUCT", "TEST_COMPANY", 1, 1, 5, "TEST_AREA", "TEST_AISLE", "TEST_PRODUCT_GROUP", "TEST_CAT_GROUP", 1, 1, "TEST_WPADR");

            LCAWrapperResult result = lca.Process();

            Assert.AreEqual(0, result.Errors.Count);
            Assert.AreEqual(10, result.Lines.Count);
            var loadCarrierCount = (from x in result.Lines
                                    select x.PBCarIdVirtual).Distinct().Count();

            Assert.AreEqual(5, loadCarrierCount);
        }
Пример #2
0
        public void LCAInvalidParamtersShouldThrow()
        {
            LCASettings settings = GetBasicSettings();

            settings.MaxLDWgt = -1;
            LCAWrapper lca = new LCAWrapper(settings);

            lca.AddArea("TEST_AREA", 1, 1);

            lca.AddAisle("TEST_AREA", "TEST_AISLE", 1, 1, 1, 1, "+");

            lca.AddPickBatchLine("TEST_PBROW", 0, "TEST_PRODUCT", "TEST_COMPANY", 10, 1, 1, "TEST_AREA", "TEST_AISLE", "TEST_PRODUCT_GROUP", "", 1, 1, "TEST_WPADR");

            try
            {
                LCAWrapperResult result = lca.Process();
            }
            catch (LCAWrapperException ex)
            {
                if (ex.ErrorCode == 1401) //Parameter out of bounds
                {
                    return;
                }
            }

            Assert.Fail("Parameter out of bounds error expected.");
        }
Пример #3
0
        public void LCABasicTest()
        {
            LCASettings settings = GetBasicSettings();

            LCAWrapper lca = new LCAWrapper(settings);

            lca.AddArea("TEST_AREA", 1, 1);

            lca.AddAisle("TEST_AREA", "TEST_AISLE", 1, 1, 1, 1, "+");

            lca.AddPickBatchLine("TEST_PBROW", 0, "TEST_PRODUCT", "TEST_COMPANY", 10, 1, 1, "TEST_AREA", "TEST_AISLE", "TEST_PRODUCT_GROUP", "TEST_CAT_GROUP", 1, 1, "TEST_WPADR");

            LCAWrapperResult result = lca.Process();

            Assert.AreEqual(0, result.Errors.Count);
            Assert.AreEqual(1, result.Lines.Count);
            Assert.AreEqual("TEST_PBROW", result.Lines[0].PBRowId);
            Assert.IsNotNull(result.Lines[0].PBCarIdVirtual);
        }
Пример #4
0
        public string Process(List <string> parameters)
        {
            try
            {
                IList <PBROW>          rows        = null;
                IList <AISLE_WAYPOINT> waypoints   = null;
                LCASettings            lcaSettings = null;

                XmlSerializer pbrowsSeri      = new XmlSerializer(typeof(List <PBROW>));
                XmlSerializer waypointsSeri   = new XmlSerializer(typeof(List <AISLE_WAYPOINT>));
                XmlSerializer lcaSettingsSeri = new XmlSerializer(typeof(LCASettings));

                if (parameters.Count != 3)
                {
                    return(null);
                }

                try
                {
                    rows        = pbrowsSeri.Deserialize(new StringReader(parameters[0])) as IList <PBROW>;
                    waypoints   = waypointsSeri.Deserialize(new StringReader(parameters[1])) as IList <AISLE_WAYPOINT>;
                    lcaSettings = lcaSettingsSeri.Deserialize(new StringReader(parameters[2])) as LCASettings;
                }
                catch
                {
                    return(null);
                }

                if (rows == null || waypoints == null || lcaSettings == null)
                {
                    return(null);
                }


                LCAWrapperResult result = null;

                using (LCAWrapper lca = new LCAWrapper(lcaSettings))
                {
                    if (!string.IsNullOrEmpty(lcaSettings.StrekArea))
                    {
                        lca.AddArea(lcaSettings.StrekArea, lcaSettings.StrekXCoord, lcaSettings.StrekYCoord);
                    }

                    string prevWSID  = "";
                    string prevAISLE = "";

                    foreach (AISLE_WAYPOINT waypoint in waypoints)
                    {
                        if (waypoint.WSID != prevWSID)
                        {
                            lca.AddArea(waypoint.WSID, waypoint.WS_XCORD, waypoint.WS_YCORD);
                        }

                        prevWSID = waypoint.WSID;

                        if (waypoint.AISLE != prevAISLE)
                        {
                            lca.AddAisle(waypoint.WSID, waypoint.AISLE, waypoint.AISLE_FROM_XCORD, waypoint.AISLE_FROM_YCORD, waypoint.AISLE_TO_XCORD, waypoint.AISLE_TO_YCORD, waypoint.DIRECTION_PICK);
                        }

                        prevAISLE = waypoint.AISLE;

                        lca.AddAisleWayPoint(waypoint.WSID, waypoint.AISLE, waypoint.WAYPOINT_ID, waypoint.WAYPOINT_XCORD, waypoint.WAYPOINT_YCORD);
                    }

                    foreach (PBROW row in rows)
                    {
                        lca.AddPickBatchLine(row.PBROWID, row.PICKSEQ, row.ARTID, row.COMPANY_ID, row.ORDQTY, row.VOLUME, row.WEIGHT, row.WSID, row.AISLE, row.ARTGROUP, row.CATGROUP, row.XCORD, row.YCORD, row.WPADR);
                    }

                    result = lca.Process();
                }



                if (result != null)
                {
                    XmlSerializer resultSeri = new XmlSerializer(typeof(LCAWrapperResultWrapper));

                    XmlWriterSettings xmlsettings = new XmlWriterSettings();
                    xmlsettings.Indent = true;
                    xmlsettings.NewLineOnAttributes = true;

                    StringBuilder builder = new StringBuilder();
                    XmlWriter     writer  = XmlWriter.Create(builder, xmlsettings);

                    LCAWrapperResultWrapper wrapper = new LCAWrapperResultWrapper(result);

                    resultSeri.Serialize(writer, wrapper);

                    return(builder.ToString());
                }
                else
                {
                    return(null);
                }
            }
            finally
            {
                WorkerProcessHost.processing = false;
            }
        }