コード例 #1
0
        private async Task ImportDesbaste(string fullPath, int idImport_result, Api api)
        {
            #region [ Salva tempo teórico ]
            var tempoTeorico = new T_tempo_teorico {
                id_t_importacao = idImport_result
            };
            readExcelService.ReadFile(typeof(T_tempo_teorico), tempoTeorico, fullPath, idImport_result);
            tempoTeorico.id_t_tempo_teorico = await api.SetInt(Constants.HostAddress, Constants.DataBase, "s_set_t_tempo_teorico", tempoTeorico);

            #endregion

            #region [ Salva esboços desbastadores ]
            SetBDEsboco(1, T_importacao_modelo_bd_esbocos.column_bd1, idImport_result, fullPath, api);
            SetBDEsboco(2, T_importacao_modelo_bd_esbocos.column_bd2, idImport_result, fullPath, api);
            #endregion

            #region [ Salva matéria prima ]
            var materiaPrima = new T_importacao_modelo_bd_materia_prima {
                id_t_importacao = idImport_result
            };
            readExcelService.ReadFile(typeof(T_importacao_modelo_bd_materia_prima), materiaPrima, fullPath, idImport_result);
            materiaPrima.id_t_importacao_modelo_bd_materia_prima = await api.SetInt(Constants.HostAddress, Constants.DataBase, "s_set_t_importacao_modelo_bd_materia_prima", materiaPrima);

            #endregion

            #region [ Salva produto ]
            var produto = new T_importacao_modelo_bd_produto {
                id_t_importacao = idImport_result
            };
            readExcelService.ReadFile(typeof(T_importacao_modelo_bd_produto), produto, fullPath, idImport_result);
            produto.id_t_importacao_modelo_bd_produto = await api.SetInt(Constants.HostAddress, Constants.DataBase, "s_set_t_importacao_modelo_bd_produto", produto);

            #endregion

            #region [ Salva lista de BD ]
            var bds = readExcelService.ReadFile_BD(fullPath, idImport_result);

            foreach (var bd in bds)
            {
                bd.registro_ativo            = true;
                bd.id_t_cadastro_acao        = 1;
                bd.id_t_importacao_modelo_bd = await api.SetInt(Constants.HostAddress, Constants.DataBase, "s_set_t_importacao_modelo_bd", bd);
            }
            #endregion

            #region [ Salva identificação ]
            var identificacao = new T_importacao_modelo_bd_identificacao {
                id_t_importacao = idImport_result
            };
            readExcelService.ReadFile(typeof(T_importacao_modelo_bd_identificacao), identificacao, fullPath, idImport_result);
            identificacao.id_t_importacao_modelo_bd_identificacao = await api.SetInt(Constants.HostAddress, Constants.DataBase, "s_set_t_importacao_modelo_bd_identificacao", identificacao);

            #endregion
        }
コード例 #2
0
        public void Obter_materia_prima_planilha_U200x20_Test()
        {
            //Arrange
            IReadExcelService svc = new ReadExcelService();
            var  fileName         = "U200x20,5-17,1.xlsx";
            var  fullPath         = $"../../../Mock/ModeloBd/{fileName}";
            Type type             = typeof(T_importacao_modelo_bd_materia_prima);
            var  obj = new T_importacao_modelo_bd_materia_prima();

            //Act
            var matPrima = svc.ReadFile(type, obj, fullPath) as T_importacao_modelo_bd_materia_prima;

            //Assert
            Assert.NotNull(matPrima);
            Assert.True(matPrima.comprimento >= 3.56);
            Assert.True(matPrima.peso_por_metro >= 368.3);
        }
コード例 #3
0
        public void Obter_materia_prima_planilha_UIC865_Test()
        {
            //Arrange
            IReadExcelService svc = new ReadExcelService();
            var  fileName         = "UIC865.xlsx";
            var  fullPath         = $"../../../Mock/ModeloBd/{fileName}";
            Type type             = typeof(T_importacao_modelo_bd_materia_prima);
            var  obj = new T_importacao_modelo_bd_materia_prima();

            //Act
            var matPrima = svc.ReadFile(type, obj, fullPath) as T_importacao_modelo_bd_materia_prima;

            //Assert
            Assert.NotNull(matPrima);
            Assert.True(matPrima.largura >= 245);
            Assert.True(matPrima.comprimento >= 7.2);
        }
コード例 #4
0
        public void Obter_materia_prima_planilha_com_dois_bds_exemplo2_Test()
        {
            //Arrange
            IReadExcelService svc = new ReadExcelService();
            var  fileName         = "Planilha_com_dois_bds_exemplo2.xlsx";
            var  fullPath         = $"../../../Mock/ModeloBd/{fileName}";
            Type type             = typeof(T_importacao_modelo_bd_materia_prima);
            var  obj = new T_importacao_modelo_bd_materia_prima();

            //Act
            var matPrima = svc.ReadFile(type, obj, fullPath) as T_importacao_modelo_bd_materia_prima;

            //Assert
            Assert.NotNull(matPrima);
            Assert.True(matPrima.altura == 203);
            Assert.True(matPrima.largura == 243);
        }
コード例 #5
0
        public void Obter_materia_prima_planilha_W150x13_Test()
        {
            //Arrange
            IReadExcelService svc = new ReadExcelService();
            var  fileName         = "W150x13.xlsx";
            var  fullPath         = $"../../../Mock/ModeloBd/{fileName}";
            Type type             = typeof(T_importacao_modelo_bd_materia_prima);
            var  obj = new T_importacao_modelo_bd_materia_prima();

            //Act
            var matPrima = svc.ReadFile(type, obj, fullPath) as T_importacao_modelo_bd_materia_prima;

            //Assert
            Assert.NotNull(matPrima);
            Assert.True(matPrima.tipo == "BL1");
            Assert.True(matPrima.espessura == 200);
            Assert.True(matPrima.altura == 200);
            Assert.True(matPrima.largura == 240);
            Assert.True(matPrima.comprimento == 4.6);
            Assert.True(matPrima.area == 47463.5);
            Assert.True(matPrima.peso_por_metro == 358.3);
            Assert.True(matPrima.peso == 1626.4);
        }