Esempio n. 1
0
        private void bwLoadData_DoWork(object sender, DoWorkEventArgs e)
        {
            materialTypeList = MaterialTypeController.Select().Where(w => w.MaterialGroup.Contains("UPPER")).ToList();
            orderList        = OrdersController.Select();
            rawMaterialList  = RawMaterialController.Select();
            sewingMasterList = SewingMasterController.SelectByProductNo();

            DataTable dt = new DelayDataSet().Tables["DelayTable"];

            List <String> productNoList       = rawMaterialList.Select(r => r.ProductNo).Distinct().ToList();
            var           materialUpperIdList = materialTypeList.Select(s => s.MaterialTypeId).Distinct().ToList();

            foreach (string productNo in productNoList)
            {
                OrdersModel order = orderList.Where(o => o.ProductNo == productNo).FirstOrDefault();

                List <Int32> materialTypeIdList = rawMaterialList.Where(w => materialUpperIdList.Contains(w.MaterialTypeId)).Select(r => r.MaterialTypeId).Distinct().ToList();
                // get assemblyline from productNo
                //AssemblyMasterModel assemblyMaster = assemblyMasterList.Where(o => o.ProductNo == productNo).FirstOrDefault();

                // get sewingLing from productNo
                SewingMasterModel sewingMaster = sewingMasterList.Where(o => o.ProductNo == productNo).FirstOrDefault();
                //materialTypeIdList.Remove(6);
                //materialTypeIdList.Remove(11);
                //materialTypeIdList.Remove(12);
                //materialTypeIdList.Remove(13);
                //materialTypeIdList.Remove(14);

                foreach (int materialTypeId in materialTypeIdList)
                {
                    RawMaterialModel rawMaterial = rawMaterialList.Where(r => r.ProductNo == productNo && r.MaterialTypeId == materialTypeId).FirstOrDefault();
                    if (rawMaterial != null && rawMaterial.ETD.Date != new DateTime(2000, 1, 1) && rawMaterial.ETD.Date < DateTime.Now.Date &&
                        rawMaterial.ActualDate.Date == new DateTime(2000, 1, 1))
                    {
                        DataRow dr = dt.NewRow();
                        // binding data to reportviewer
                        dr["SewingLine"] = sewingMaster.SewingLine;
                        dr["ProductNo"]  = productNo;
                        if (order != null)
                        {
                            dr["ArticleNo"] = order.ArticleNo;
                            dr["ShoeName"]  = order.ShoeName;
                            dr["Quantity"]  = order.Quantity;
                            dr["ETD"]       = order.ETD;
                        }

                        dr["SupplierETD"] = rawMaterial.ETD;
                        dr["Remarks"]     = rawMaterial.Remarks;
                        MaterialTypeModel materialType = materialTypeList.Where(m => m.MaterialTypeId == rawMaterial.MaterialTypeId).FirstOrDefault();
                        if (materialType != null)
                        {
                            dr["Supplier"] = materialType.Name;
                        }

                        dt.Rows.Add(dr);
                    }
                }
            }
            e.Result = dt;
        }
Esempio n. 2
0
        private void modBtnSaveMaterialType_Click(object sender, EventArgs e)
        {
            this.controller = new MaterialTypeController();
            Dictionary <string, dynamic> data = new Dictionary <string, dynamic>();

            TipoMaterial modifiedMaterialType = new TipoMaterial()
            {
                IdTipoMaterial = registeredMaterialType.IdTipoMaterial,
                Descripcion    = txtDescription.Text.TrimStart().TrimEnd(),
                FechaAgrega    = registeredMaterialType.FechaAgrega,
                FechaElimina   = registeredMaterialType.FechaElimina,
                UsuarioAgrega  = registeredMaterialType.UsuarioAgrega,
                Eliminado      = registeredMaterialType.Eliminado,
                IdEstado       = registeredMaterialType.IdEstado
            };

            data["user"]    = Session.getInstance().session["identification"];
            controller.data = data;

            Dictionary <Object, dynamic> result = controller.modifyMaterialType(registeredMaterialType, modifiedMaterialType);

            if (result["code"] == Result.Processed)
            {
                this.loadCombos();
            }

            MessageBox.Show(result["msg"]);
        }
Esempio n. 3
0
 private void bwLoadData_DoWork(object sender, DoWorkEventArgs e)
 {
     //materialTypeList = MaterialTypeController.Select();
     materialTypeList = MaterialTypeController.Select().Where(w => w.MaterialGroup.Contains("UPPER")).ToList();
     orderList        = OrdersController.Select();
     rawMaterialList  = RawMaterialController.Select();
 }
        void threadLoad_DoWork(object sender, DoWorkEventArgs e)
        {
            materialTypeList = MaterialTypeController.Select();
            orderList        = OrdersController.Select();
            rawMaterialList  = RawMaterialController.Select();

            List <String> productNoList = rawMaterialList.Select(r => r.ProductNo).Distinct().ToList();

            foreach (string productNo in productNoList)
            {
                OrdersModel  order = orderList.Where(o => o.ProductNo == productNo).FirstOrDefault();
                List <Int32> materialTypeIdList = rawMaterialList.Select(r => r.MaterialTypeId).Distinct().ToList();

                //Red!
                materialTypeIdList.Remove(6);
                materialTypeIdList.Remove(11);
                materialTypeIdList.Remove(12);
                materialTypeIdList.Remove(13);

                foreach (int materialTypeId in materialTypeIdList)
                {
                    RawMaterialModel rawMaterial = rawMaterialList.Where(r => r.ProductNo == productNo && r.MaterialTypeId == materialTypeId).FirstOrDefault();
                    if (rawMaterial != null && rawMaterial.ETD.Date != dtDefault
                        //&& rawMaterial.ActualDate.Date == dtDefault
                        )
                    {
                        DeliveryStatusViewModel deliveryStatusView = new DeliveryStatusViewModel();

                        deliveryStatusView.ProductNo = productNo;
                        if (order != null)
                        {
                            deliveryStatusView.Country   = order.Country;
                            deliveryStatusView.ArticleNo = order.ArticleNo;
                            deliveryStatusView.ShoeName  = order.ShoeName;
                            deliveryStatusView.Quantity  = order.Quantity;
                            deliveryStatusView.ETD       = order.ETD;
                        }
                        MaterialTypeModel materialType = materialTypeList.Where(m => m.MaterialTypeId == rawMaterial.MaterialTypeId).FirstOrDefault();
                        if (materialType != null)
                        {
                            deliveryStatusView.Supplier = materialType.Name;
                        }
                        deliveryStatusView.SupplierETD = rawMaterial.ETD;
                        if (rawMaterial.ActualDate != dtDefault)
                        {
                            deliveryStatusView.Actual     = string.Format("{0:MM/dd/yyyy}", rawMaterial.ActualDate);
                            deliveryStatusView.IsFinished = true;
                        }
                        else
                        {
                            deliveryStatusView.Actual     = rawMaterial.Remarks;
                            deliveryStatusView.IsFinished = false;
                        }
                        deliveryStatusViewList.Add(deliveryStatusView);
                    }
                }
            }
        }
Esempio n. 5
0
        private void btnAddMaterialType_Click(object sender, EventArgs e)
        {
            catchInformation();
            storeDataIntoArray();

            MaterialTypeController controller = new MaterialTypeController();

            data["user"]    = Session.getInstance().session["identification"];
            controller.data = this.data;
            Dictionary <Object, dynamic> result = controller.insertMaterialTypeFromMaintenance();

            MessageBox.Show(result["msg"]);
        }
        public void loadCombos()
        {
            controller = new MaterialTypeController();
            Dictionary <Object, dynamic> resultMaterialType = this.controller.getDataToFillMaterialsCombo();

            if (resultMaterialType["code"] == Result.Failed)
            {
                MessageBox.Show(resultMaterialType["msg"]);
                return;
            }

            if (resultMaterialType["code"] == Result.Processed)
            {
                loadMaterialTypesComboBox(resultMaterialType["content"]);
            }
        }
        private void delBtnDeleteMaterialTypes_Click(object sender, EventArgs e)
        {
            this.controller = new MaterialTypeController();
            Dictionary <string, dynamic> data = new Dictionary <string, dynamic>();

            this.registeredMaterialType = (TipoMaterial)delDropMaterialType.SelectedItem;
            data["id"]      = registeredMaterialType.IdTipoMaterial;
            data["user"]    = Session.getInstance().session["identification"];
            controller.data = data;

            Dictionary <Object, dynamic> result = controller.deleteMaterialType(registeredMaterialType);

            if (result["code"] == Result.Processed)
            {
                this.loadCombos();
            }

            MessageBox.Show(result["msg"]);
        }
        private void btnList_Click(object sender, EventArgs e)
        {
            removeAllManagamentControls();

            switch (this.Mantenimiento)
            {
            case "Users":

                ViewUsers viewUser = new ViewUsers();
                UserCtrl  userCtrl = new UserCtrl();

                viewUser.Height = Parent.Height;
                viewUser.Width  = Parent.Width;

                this.result = userCtrl.getAllUsers();
                if (this.result["code"] == Result.Failed)
                {
                    MessageBox.Show(this.result["msg"]);
                    return;
                }

                if (this.result["code"] == Result.Processed)
                {
                    viewUser.loadDataGrid(this.result["content"]);
                    Parent.Controls.Add(viewUser);
                }

                break;

            case "Clients":
                ClientsList       clientsList = new ClientsList();
                ClientsController cont        = new ClientsController();
                clientsList.Height = Parent.Height;
                clientsList.Width  = Parent.Width;
                Dictionary <Object, dynamic> res = cont.getAllClients();
                if (res["code"] == Result.Failed)
                {
                    MessageBox.Show(res["msg"]);
                    return;
                }
                if (res["code"] == Result.Processed)
                {
                    clientsList.loadDataGrid(res["content"]);
                    Parent.Controls.Add(clientsList);
                }
                break;

            case "States":

                ViewStates      viewState  = new ViewStates();
                StateController controller = new StateController();

                viewState.Height = Parent.Height;
                viewState.Width  = Parent.Width;

                this.result = controller.getAllStates();
                if (this.result["code"] == Result.Failed)
                {
                    MessageBox.Show(this.result["msg"]);
                    return;
                }

                if (this.result["code"] == Result.Processed)
                {
                    viewState.loadDataGrid(this.result["content"]);
                    Parent.Controls.Add(viewState);
                }

                break;

            case "PaymentMethods":

                ViewPaymentMethods      viewPayment = new ViewPaymentMethods();
                PaymentMethodController cnt         = new PaymentMethodController();

                viewPayment.Height = Parent.Height;
                viewPayment.Width  = Parent.Width;

                this.result = cnt.getAllPaymentMethods();
                if (this.result["code"] == Result.Failed)
                {
                    MessageBox.Show(this.result["msg"]);
                    return;
                }

                if (this.result["code"] == Result.Processed)
                {
                    viewPayment.loadDataGrid(this.result["content"]);
                    Parent.Controls.Add(viewPayment);
                }

                break;

            case "MaterialTypes":

                ViewMaterialTypes      viewMaterials = new ViewMaterialTypes();
                MaterialTypeController contr         = new MaterialTypeController();

                viewMaterials.Height = Parent.Height;
                viewMaterials.Width  = Parent.Width;

                this.result = contr.getAllMaterialTypes();
                if (this.result["code"] == Result.Failed)
                {
                    MessageBox.Show(this.result["msg"]);
                    return;
                }

                if (this.result["code"] == Result.Processed)
                {
                    viewMaterials.loadDataGrid(this.result["content"]);
                    Parent.Controls.Add(viewMaterials);
                }

                break;

            case "Materials":

                MaterialsList      listMaterials = new MaterialsList();
                MaterialController ctrl          = new MaterialController();

                listMaterials.Height = Parent.Height;
                listMaterials.Width  = Parent.Width;

                this.result = ctrl.getMaterialsToPopulate();
                if (this.result["code"] == Result.Failed)
                {
                    MessageBox.Show(this.result["msg"]);
                    return;
                }

                if (this.result["code"] == Result.Processed)
                {
                    listMaterials.loadDataGrid(this.result["content"]);
                    Parent.Controls.Add(listMaterials);
                }

                break;

            case "ProductTypes":
                ViewProductTypes      viewProductTypes = new ViewProductTypes();
                ProductTypeController contr2           = new ProductTypeController();

                viewProductTypes.Height = Parent.Height;
                viewProductTypes.Width  = Parent.Width;

                this.result = contr2.getAllProductTypes();
                if (this.result["code"] == Result.Failed)
                {
                    MessageBox.Show(this.result["msg"]);
                    return;
                }

                if (this.result["code"] == Result.Processed)
                {
                    viewProductTypes.loadDataGrid(this.result["content"]);
                    Parent.Controls.Add(viewProductTypes);
                }

                break;

            case "Products":
                ViewProducts      viewProducts = new ViewProducts();
                ProductController contr3       = new ProductController();

                viewProducts.Height = Parent.Height;
                viewProducts.Width  = Parent.Width;

                this.result = contr3.getAllProducts();
                if (this.result["code"] == Result.Failed)
                {
                    MessageBox.Show(this.result["msg"]);
                    return;
                }

                if (this.result["code"] == Result.Processed)
                {
                    viewProducts.loadDataGrid(this.result["content"]);
                    Parent.Controls.Add(viewProducts);
                }

                break;

            case "Providers":
                ViewProviders      viewProviders = new ViewProviders();
                ProviderController providerCtrl  = new ProviderController();

                viewProviders.Height = Parent.Height;
                viewProviders.Width  = Parent.Width;

                this.result = providerCtrl.getAllProviders();
                if (this.result["code"] == Result.Failed)
                {
                    MessageBox.Show(this.result["msg"]);
                    return;
                }

                if (this.result["code"] == Result.Processed)
                {
                    viewProviders.loadDataGrid(this.result["content"]);
                    Parent.Controls.Add(viewProviders);
                }
                break;
            }
        }
Esempio n. 9
0
 private void bwLoadData_DoWork(object sender, DoWorkEventArgs e)
 {
     materialTypeList = MaterialTypeController.Select();
     orderList        = OrdersController.Select();
     rawMaterialList  = RawMaterialController.Select();
 }
Esempio n. 10
0
        private void bwLoad_DoWork(object sender, DoWorkEventArgs e)
        {
            materialTypeList = MaterialTypeController.Select();
            Excel.Application excelApplication = new Excel.Application();
            Excel.Workbook    excelWorkbook    = excelApplication.Workbooks.Open(filePath);
            //excelApplication.Visible = true;
            Excel.Worksheet excelWorksheet;
            Excel.Range     excelRange;
            try
            {
                excelWorksheet = (Excel.Worksheet)excelWorkbook.Worksheets[1];
                excelRange     = excelWorksheet.UsedRange;
                progressBar.Dispatcher.Invoke((Action)(() => progressBar.Maximum = excelRange.Rows.Count));
                for (int i = 3; i <= excelRange.Rows.Count; i++)
                {
                    var productNoValue = (excelRange.Cells[i, 1] as Excel.Range).Value2;
                    if (productNoValue != null)
                    {
                        // column 2,3 = TAIWAN (10)
                        var taiwanMaterial = new RawMaterialModel();
                        taiwanMaterial.ProductNo        = productNoValue.ToString();
                        taiwanMaterial.MaterialTypeId   = 10;
                        taiwanMaterial.MaterialTypeName = materialTypeList.FirstOrDefault(w => w.MaterialTypeId == 10) != null?materialTypeList.FirstOrDefault(w => w.MaterialTypeId == 10).Name : "";

                        taiwanMaterial.ETD        = dtDefault;
                        taiwanMaterial.ActualDate = dtDefault;
                        var efdTaiwan = (excelRange.Cells[i, 2] as Excel.Range).Value2;
                        if (efdTaiwan != null)
                        {
                            double efd = 0;
                            Double.TryParse(efdTaiwan.ToString(), out efd);
                            taiwanMaterial.ETD = DateTime.FromOADate(efd);
                        }
                        var actualTaiwan = (excelRange.Cells[i, 3] as Excel.Range).Value2;
                        if (actualTaiwan != null)
                        {
                            double actual = 0;
                            Double.TryParse(actualTaiwan.ToString(), out actual);
                            taiwanMaterial.ActualDate = DateTime.FromOADate(actual);
                        }
                        if (efdTaiwan != null || actualTaiwan != null)
                        {
                            upperMaterialFromExcelList.Add(taiwanMaterial);
                        }

                        // Column 4,5 = LAMINATION (1)
                        var laminationMaterial = new RawMaterialModel();
                        laminationMaterial.ProductNo        = productNoValue.ToString();
                        laminationMaterial.MaterialTypeId   = 1;
                        laminationMaterial.MaterialTypeName = materialTypeList.FirstOrDefault(w => w.MaterialTypeId == 1) != null?materialTypeList.FirstOrDefault(w => w.MaterialTypeId == 1).Name : "";

                        laminationMaterial.ETD        = dtDefault;
                        laminationMaterial.ActualDate = dtDefault;
                        var efdLamination = (excelRange.Cells[i, 4] as Excel.Range).Value2;
                        if (efdLamination != null)
                        {
                            double efd = 0;
                            Double.TryParse(efdLamination.ToString(), out efd);
                            laminationMaterial.ETD = DateTime.FromOADate(efd);
                        }
                        var actualLamination = (excelRange.Cells[i, 5] as Excel.Range).Value2;
                        if (actualLamination != null)
                        {
                            double actual = 0;
                            Double.TryParse(actualLamination.ToString(), out actual);
                            laminationMaterial.ActualDate = DateTime.FromOADate(actual);
                        }

                        if (efdLamination != null || actualLamination != null)
                        {
                            upperMaterialFromExcelList.Add(laminationMaterial);
                        }

                        // Column 6,7 = CUTTING (1)
                        var cuttingMaterial = new RawMaterialModel();
                        cuttingMaterial.ProductNo        = productNoValue.ToString();
                        cuttingMaterial.MaterialTypeId   = 2;
                        cuttingMaterial.MaterialTypeName = materialTypeList.FirstOrDefault(w => w.MaterialTypeId == 2) != null?materialTypeList.FirstOrDefault(w => w.MaterialTypeId == 2).Name : "";

                        cuttingMaterial.ETD        = dtDefault;
                        cuttingMaterial.ActualDate = dtDefault;
                        var efdCutting = (excelRange.Cells[i, 6] as Excel.Range).Value2;
                        if (efdCutting != null)
                        {
                            double efd = 0;
                            Double.TryParse(efdCutting.ToString(), out efd);
                            cuttingMaterial.ETD = DateTime.FromOADate(efd);
                        }
                        var actualCutting = (excelRange.Cells[i, 7] as Excel.Range).Value2;
                        if (actualCutting != null)
                        {
                            double actual = 0;
                            Double.TryParse(actualCutting.ToString(), out actual);
                            cuttingMaterial.ActualDate = DateTime.FromOADate(actual);
                        }
                        if (efdCutting != null || actualCutting != null)
                        {
                            upperMaterialFromExcelList.Add(cuttingMaterial);
                        }

                        // Column 8,9 = LEATHER (1)
                        var leatherMaterial = new RawMaterialModel();
                        leatherMaterial.ProductNo        = productNoValue.ToString();
                        leatherMaterial.MaterialTypeId   = 3;
                        leatherMaterial.MaterialTypeName = materialTypeList.FirstOrDefault(w => w.MaterialTypeId == 3) != null?materialTypeList.FirstOrDefault(w => w.MaterialTypeId == 3).Name : "";

                        leatherMaterial.ETD        = dtDefault;
                        leatherMaterial.ActualDate = dtDefault;
                        var efdLeather = (excelRange.Cells[i, 8] as Excel.Range).Value2;
                        if (efdLeather != null)
                        {
                            double efd = 0;
                            Double.TryParse(efdLeather.ToString(), out efd);
                            leatherMaterial.ETD = DateTime.FromOADate(efd);
                        }
                        var actualLeather = (excelRange.Cells[i, 9] as Excel.Range).Value2;
                        if (actualLeather != null)
                        {
                            double actual = 0;
                            Double.TryParse(actualLeather.ToString(), out actual);
                            leatherMaterial.ActualDate = DateTime.FromOADate(actual);
                        }
                        if (efdLeather != null || actualLeather != null)
                        {
                            upperMaterialFromExcelList.Add(leatherMaterial);
                        }

                        // Column 10, 11 = SEMIPROCESS (1)
                        var semiprocessMaterial = new RawMaterialModel();
                        semiprocessMaterial.ProductNo        = productNoValue.ToString();
                        semiprocessMaterial.MaterialTypeId   = 4;
                        semiprocessMaterial.MaterialTypeName = materialTypeList.FirstOrDefault(w => w.MaterialTypeId == 4) != null?materialTypeList.FirstOrDefault(w => w.MaterialTypeId == 4).Name : "";

                        semiprocessMaterial.ETD        = dtDefault;
                        semiprocessMaterial.ActualDate = dtDefault;
                        var efdSemiprocess = (excelRange.Cells[i, 10] as Excel.Range).Value2;
                        if (efdSemiprocess != null)
                        {
                            double efd = 0;
                            Double.TryParse(efdSemiprocess.ToString(), out efd);
                            semiprocessMaterial.ETD = DateTime.FromOADate(efd);
                        }
                        var actualSemiprocess = (excelRange.Cells[i, 11] as Excel.Range).Value2;
                        if (actualSemiprocess != null)
                        {
                            double actual = 0;
                            Double.TryParse(actualSemiprocess.ToString(), out actual);
                            semiprocessMaterial.ActualDate = DateTime.FromOADate(actual);
                        }
                        if (efdSemiprocess != null || actualSemiprocess != null)
                        {
                            upperMaterialFromExcelList.Add(semiprocessMaterial);
                        }

                        // Column 12, 13 = SEWING (1)
                        var sewingMaterial = new RawMaterialModel();
                        sewingMaterial.ProductNo        = productNoValue.ToString();
                        sewingMaterial.MaterialTypeId   = 5;
                        sewingMaterial.MaterialTypeName = materialTypeList.FirstOrDefault(w => w.MaterialTypeId == 5) != null?materialTypeList.FirstOrDefault(w => w.MaterialTypeId == 5).Name : "";

                        sewingMaterial.ETD        = dtDefault;
                        sewingMaterial.ActualDate = dtDefault;
                        var efdSewing = (excelRange.Cells[i, 12] as Excel.Range).Value2;
                        if (efdSewing != null)
                        {
                            double efd = 0;
                            Double.TryParse(efdSewing.ToString(), out efd);
                            sewingMaterial.ETD = DateTime.FromOADate(efd);
                        }
                        var actualSewing = (excelRange.Cells[i, 13] as Excel.Range).Value2;
                        if (actualSewing != null)
                        {
                            double actual = 0;
                            Double.TryParse(actualSewing.ToString(), out actual);
                            sewingMaterial.ActualDate = DateTime.FromOADate(actual);
                        }
                        if (efdSewing != null || actualSewing != null)
                        {
                            upperMaterialFromExcelList.Add(sewingMaterial);
                        }

                        // Column 14,15 = SECURITY LABEL (1)
                        var securitylabelMaterial = new RawMaterialModel();
                        securitylabelMaterial.ProductNo        = productNoValue.ToString();
                        securitylabelMaterial.MaterialTypeId   = 7;
                        securitylabelMaterial.MaterialTypeName = materialTypeList.FirstOrDefault(w => w.MaterialTypeId == 7) != null?materialTypeList.FirstOrDefault(w => w.MaterialTypeId == 7).Name : "";

                        securitylabelMaterial.ETD        = dtDefault;
                        securitylabelMaterial.ActualDate = dtDefault;
                        var efdSecuritylabel = (excelRange.Cells[i, 14] as Excel.Range).Value2;
                        if (efdSecuritylabel != null)
                        {
                            double efd = 0;
                            Double.TryParse(efdSecuritylabel.ToString(), out efd);
                            securitylabelMaterial.ETD = DateTime.FromOADate(efd);
                        }
                        var actualSecuritylabel = (excelRange.Cells[i, 15] as Excel.Range).Value2;
                        if (actualSecuritylabel != null)
                        {
                            double actual = 0;
                            Double.TryParse(actualSecuritylabel.ToString(), out actual);
                            securitylabelMaterial.ActualDate = DateTime.FromOADate(actual);
                        }
                        if (efdSecuritylabel != null || actualSecuritylabel != null)
                        {
                            upperMaterialFromExcelList.Add(securitylabelMaterial);
                        }

                        // Column 16,17 = ASSEMBLY (1)
                        var assemblyMaterial = new RawMaterialModel();
                        assemblyMaterial.ProductNo        = productNoValue.ToString();
                        assemblyMaterial.MaterialTypeId   = 8;
                        assemblyMaterial.MaterialTypeName = materialTypeList.FirstOrDefault(w => w.MaterialTypeId == 8) != null?materialTypeList.FirstOrDefault(w => w.MaterialTypeId == 8).Name : "";

                        assemblyMaterial.ETD        = dtDefault;
                        assemblyMaterial.ActualDate = dtDefault;
                        var efdAssembly = (excelRange.Cells[i, 16] as Excel.Range).Value2;
                        if (efdAssembly != null)
                        {
                            double efd = 0;
                            Double.TryParse(efdAssembly.ToString(), out efd);
                            assemblyMaterial.ETD = DateTime.FromOADate(efd);
                        }
                        var actualAssembly = (excelRange.Cells[i, 17] as Excel.Range).Value2;
                        if (actualAssembly != null)
                        {
                            double actual = 0;
                            Double.TryParse(actualAssembly.ToString(), out actual);
                            assemblyMaterial.ActualDate = DateTime.FromOADate(actual);
                        }
                        if (efdAssembly != null || actualAssembly != null)
                        {
                            upperMaterialFromExcelList.Add(assemblyMaterial);
                        }

                        // Column 18,19 = SOCKLINING (1)
                        var sockliningMaterial = new RawMaterialModel();
                        sockliningMaterial.ProductNo        = productNoValue.ToString();
                        sockliningMaterial.MaterialTypeId   = 9;
                        sockliningMaterial.MaterialTypeName = materialTypeList.FirstOrDefault(w => w.MaterialTypeId == 9) != null?materialTypeList.FirstOrDefault(w => w.MaterialTypeId == 9).Name : "";

                        sockliningMaterial.ETD        = dtDefault;
                        sockliningMaterial.ActualDate = dtDefault;
                        var efdSocklining = (excelRange.Cells[i, 18] as Excel.Range).Value2;
                        if (efdSocklining != null)
                        {
                            double efd = 0;
                            Double.TryParse(efdSocklining.ToString(), out efd);
                            sockliningMaterial.ETD = DateTime.FromOADate(efd);
                        }
                        var actualSocklining = (excelRange.Cells[i, 19] as Excel.Range).Value2;
                        if (actualSocklining != null)
                        {
                            double actual = 0;
                            Double.TryParse(actualSocklining.ToString(), out actual);
                            sockliningMaterial.ActualDate = DateTime.FromOADate(actual);
                        }
                        if (efdSocklining != null || actualSocklining != null)
                        {
                            upperMaterialFromExcelList.Add(sockliningMaterial);
                        }
                        //upperMaterialFromExcelList.Add(taiwanMaterial);
                        //upperMaterialFromExcelList.Add(laminationMaterial);
                        //upperMaterialFromExcelList.Add(cuttingMaterial);
                        //upperMaterialFromExcelList.Add(leatherMaterial);
                        //upperMaterialFromExcelList.Add(semiprocessMaterial);
                        //upperMaterialFromExcelList.Add(sewingMaterial);
                        //upperMaterialFromExcelList.Add(securitylabelMaterial);
                        //upperMaterialFromExcelList.Add(assemblyMaterial);
                        //upperMaterialFromExcelList.Add(sockliningMaterial);

                        progressBar.Dispatcher.Invoke((Action)(() => progressBar.Value = i - 2));
                    }
                }
            }
            catch
            {
                upperMaterialFromExcelList.Clear();
            }
            finally
            {
                excelWorkbook.Close(false, Missing.Value, Missing.Value);
                excelApplication.Quit();
            }
        }