예제 #1
0
        public async Task <IActionResult> GetBillOfMaterials()
        {
            try
            {
                var billOfMaterialList = new List <Tuple <string, string, string> >()
                {
                    new Tuple <string, string, string>("200ALFS0304000018", "LIVE", "201"),
                    new Tuple <string, string, string>("200DYNA0102000000", "LIVE", "201"),
                    new Tuple <string, string, string>("204LMAC3K04000260", "TEST", "201"),
                    new Tuple <string, string, string>("204STBKS903000089", "TEST", "201"),
                };

                IBillOfMaterialManager manager = _serviceProvider.GetRequiredService <IBillOfMaterialManager>();
                var results = new List <BomOutputParameter>();
                await Task.WhenAll(billOfMaterialList.Select(material => Task.Run(async() =>
                {
                    BomOutputParameter result = await manager.GetBillOfMaterialAsync(material.Item1, material.Item3, material.Item2);
                    results.Add(result);
                })).ToArray()).ConfigureAwait(false);

                return(View(results));
            }
            catch (Exception e)
            {
                _logger.LogError(e, "GetBillOfMaterials Execution Error");
                throw;
            }
        }
예제 #2
0
        public BomOutputParameter GetBillOfMaterial(string materialCode, string plantCode)
        {
            using IRfcConnection connection = _serviceProvider.GetService <IRfcConnection>();
            connection.Connect();

            var inputParameter = new BomInputParameter
            {
                Aumgb = "0",
                Capid = "PP01",
                Datuv = DateTime.Now,
                Emeng = "1",
                Mktls = "x",
                Mehrs = "x",
                Stpst = "0",
                Svwvo = "x",
                Werks = plantCode,
                Vrsvo = "x",
                Stlal = "1",
                Stlan = "1",
                Mtnrv = materialCode
            };

            using IReadRfc rfcFunction = _serviceProvider.GetService <IReadRfc>();
            BomOutputParameter bomResult = rfcFunction.GetRfc <BomOutputParameter, BomInputParameter>(connection, "CS_BOM_EXPL_MAT_V2_RFC", inputParameter);

            return(bomResult);
        }
예제 #3
0
        public async Task <BomOutputParameter> GetBillOfMaterialAsync(string materialCode, string plantCode, string alias = null)
        {
            var inputParameter = new BomInputParameter
            {
                Aumgb = "0",
                Capid = "PP01",
                Datuv = DateTime.Now,
                Emeng = "1",
                Mktls = "x",
                Mehrs = "x",
                Stpst = "0",
                Svwvo = "x",
                Werks = plantCode,
                Vrsvo = "x",
                Stlal = "1",
                Stlan = "1",
                Mtnrv = materialCode
            };

            using IRfcClient client = _serviceProvider.GetRequiredService <IRfcClient>();
            if (!string.IsNullOrWhiteSpace(alias))
            {
                client.UseServer(alias);
            }
            BomOutputParameter bomResult = await client.ExecuteRfcAsync <BomInputParameter, BomOutputParameter>("CS_BOM_EXPL_MAT_V2_RFC", inputParameter);

            return(bomResult);
        }
예제 #4
0
        private static async Task GetBillOfMaterialsAsync()
        {
            var billOfMaterialList = new List <Tuple <string, string, string> >()
            {
                new Tuple <string, string, string>("200ALFS0304000018", "LIVE", "201"),
                new Tuple <string, string, string>("200DYNA0102000000", "LIVE", "201"),
                new Tuple <string, string, string>("200ELAC0303000738", "LIVE", "201"),
                new Tuple <string, string, string>("200RUBA0305000861", "LIVE", "201"),
                new Tuple <string, string, string>("201STBK1603000092", "LIVE", "201"),
                new Tuple <string, string, string>("203BARB2306000021", "LIVE", "201"),
                new Tuple <string, string, string>("203ELAC2D06000000", "LIVE", "201"),
                new Tuple <string, string, string>("204LMAC3K04000260", "LIVE", "201"),
                new Tuple <string, string, string>("204STBKS903000089", "LIVE", "201"),
                new Tuple <string, string, string>("207ALBZ1002000400", "LIVE", "201"),
                new Tuple <string, string, string>("207SLPT0000000000", "LIVE", "201"),
                new Tuple <string, string, string>("207SMCF1602000900", "LIVE", "201"),
                new Tuple <string, string, string>("200ALFS0304000018", "TEST", "201"),
                new Tuple <string, string, string>("200DYNA0102000000", "TEST", "201"),
                new Tuple <string, string, string>("200ELAC0303000738", "TEST", "201"),
                new Tuple <string, string, string>("200RUBA0305000861", "TEST", "201"),
                new Tuple <string, string, string>("201STBK1603000092", "TEST", "201"),
                new Tuple <string, string, string>("203BARB2306000021", "TEST", "201"),
                new Tuple <string, string, string>("203ELAC2D06000000", "TEST", "201"),
                new Tuple <string, string, string>("204LMAC3K04000260", "TEST", "201"),
                new Tuple <string, string, string>("204STBKS903000089", "TEST", "201"),
            };

            IBillOfMaterialManager manager = ServiceProvider.GetRequiredService <IBillOfMaterialManager>();

            await Task.WhenAll(billOfMaterialList.Select(material => Task.Run(async() =>
            {
                BomOutputParameter result = await manager.GetBillOfMaterialAsync(material.Item1, material.Item3, material.Item2);
                manager.Print(result?.Topmat);
            })).ToArray()).ConfigureAwait(false);
        }
예제 #5
0
        private static async Task GetBillOfMaterialAsync()
        {
            const string MATERIAL_CODE = "200DYNA0102000000";
            const string PLANT_CODE    = "201";

            IBillOfMaterialManager manager = ServiceProvider.GetRequiredService <IBillOfMaterialManager>();
            BomOutputParameter     result  = await manager.GetBillOfMaterialAsync(MATERIAL_CODE, PLANT_CODE);

            manager.Print(result);
        }
예제 #6
0
        public void Print(BomOutputParameter bom)
        {
            if (bom == null)
            {
                Console.WriteLine("BillOfMaterial Not Found!");
            }

            Console.WriteLine($"Material:\t{bom.Topmat.Code} - {bom.Topmat.Definition} ");
            Console.WriteLine("".PadLeft(20, '='));
            foreach (Stb stb in bom.StbData)
            {
                Console.WriteLine($"{stb.Name}\t {stb.SubItemCode}-{stb.SubItemName}");
            }
        }
예제 #7
0
        public void Print(BomOutputParameter model)
        {
            if (model == null)
            {
                Console.WriteLine("\nBillOfMaterial Not Found!");
                return;
            }

            Console.WriteLine($"Material:\t{model.Topmat.Code} - {model.Topmat.Definition} ");
            Console.WriteLine("".PadLeft(20, '='));
            foreach (Stb stb in model.StbData)
            {
                Console.WriteLine($"{stb.Name}\t {stb.SubItemCode}-{stb.SubItemName}");
            }
        }
예제 #8
0
        public async Task <IActionResult> GetBillOfMaterial()
        {
            try
            {
                const string MATERIAL_CODE = "200DYNA0102000000";
                const string PLANT_CODE    = "201";

                IBillOfMaterialManager manager = _serviceProvider.GetRequiredService <IBillOfMaterialManager>();
                BomOutputParameter     result  = await manager.GetBillOfMaterialAsync(MATERIAL_CODE, PLANT_CODE);

                return(View(result));
            }
            catch (Exception e)
            {
                _logger.LogError(e, "GetBillOfMaterial Execution Error");
                throw;
            }
        }