Exemple #1
0
        private void bwLoadData_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            DataTable dt    = new OutsoleMaterialRejectDataSet().Tables["OutsoleMaterialRejectTable"];
            var       regex = new Regex(@"[a-z]|[A-Z]");

            foreach (OutsoleMaterialModel outsoleMaterialReject in outsoleMaterialRejectList)
            {
                OutsoleSuppliersModel   outsoleSupplier    = outsoleSupplierList.Where(o => o.OutsoleSupplierId == outsoleMaterialReject.OutsoleSupplierId).FirstOrDefault();
                OrdersModel             order              = orderList.Where(o => o.ProductNo == outsoleMaterialReject.ProductNo).FirstOrDefault();
                OutsoleRawMaterialModel outsoleRawMaterial = outsoleRawMaterialList.Where(o => o.ProductNo == outsoleMaterialReject.ProductNo && o.OutsoleSupplierId == outsoleMaterialReject.OutsoleSupplierId).FirstOrDefault();
                DataRow dr = dt.NewRow();
                dr["ProductNo"] = outsoleMaterialReject.ProductNo;
                if (order != null)
                {
                    dr["OutsoleCode"] = order.OutsoleCode;
                    dr["ETD"]         = order.ETD;
                }
                if (outsoleRawMaterial != null)
                {
                    dr["SupplierETD"] = outsoleRawMaterial.ETD;
                }
                if (outsoleSupplier != null)
                {
                    dr["OutsoleSupplier"] = outsoleSupplier.Name;
                }
                string sizeNoString = regex.IsMatch(outsoleMaterialReject.SizeNo) == true?regex.Replace(outsoleMaterialReject.SizeNo, "") : outsoleMaterialReject.SizeNo;

                double sizeNoDouble = 0;
                Double.TryParse(sizeNoString, out sizeNoDouble);
                dr["SizeNoDouble"] = sizeNoDouble;

                dr["SizeNo"] = outsoleMaterialReject.SizeNo;

                dr["QuantityReject"] = outsoleMaterialReject.QuantityReject;
                dt.Rows.Add(dr);
            }

            // bo 3.5 thanh 35 roi orderby theo sizeno
            //Regex regex = new Regex(@"[^\d\.]");
            //dt = dt.AsEnumerable().OrderBy(r => double.Parse(regex.Replace(r.Field<String>("SizeNo"), ""))).CopyToDataTable();

            ReportDataSource rds = new ReportDataSource();

            rds.Name  = "OutsoleMaterialReject";
            rds.Value = dt;
            //reportViewer.LocalReport.ReportPath = @"C:\Users\IT02\Documents\Visual Studio 2010\Projects\Saoviet Master Schedule Solution\MasterSchedule\Reports\OutsoleMaterialRejectReport.rdlc";
            reportViewer.LocalReport.ReportPath = @"Reports\OutsoleMaterialRejectReport.rdlc";
            reportViewer.LocalReport.DataSources.Add(rds);
            reportViewer.RefreshReport();
            this.Cursor = null;
        }
        private void bwLoadBalance_DoWork(object sender, DoWorkEventArgs e)
        {
            outsoleMaterialBalanceReportList = ReportController.GetOutsoleBalanceReportList();

            DataTable dtBalance = new OutsoleMaterialRejectDataSet().Tables["OutsoleMaterialRejectTable"];
            var       regex     = new Regex(@"[a-z]|[A-Z]");

            foreach (var outsoleMaterialBalance in outsoleMaterialBalanceReportList)
            {
                DataRow dr            = dtBalance.NewRow();
                var     productNoList = new List <String>();
                productNoList = orderList.Where(w => w.OutsoleCode == outsoleMaterialBalance.OutsoleCode).Select(s => s.ProductNo).ToList();

                dr["ProductNo"] = outsoleMaterialBalance.ProductNo;

                dr["OutsoleCode"]     = outsoleMaterialBalance.OutsoleCode;
                dr["ETD"]             = outsoleMaterialBalance.ETD;
                dr["ArticleNo"]       = outsoleMaterialBalance.ArticleNo;
                dr["SupplierETD"]     = outsoleMaterialBalance.SupplierETD;
                dr["OutsoleSupplier"] = outsoleMaterialBalance.SupplierName;

                string sizeNoDisplay      = outsoleMaterialBalance.SizeNo;
                var    sizeNo_OutsoleCode = sizeRunList.Where(w => productNoList.Contains(w.ProductNo) && w.SizeNo == sizeNoDisplay).FirstOrDefault();
                if (sizeNo_OutsoleCode != null)
                {
                    if (String.IsNullOrEmpty(sizeNo_OutsoleCode.OutsoleSize) == false)
                    {
                        sizeNoDisplay = sizeNo_OutsoleCode.OutsoleSize;
                    }
                }

                string sizeNoString = regex.IsMatch(sizeNoDisplay) == true?
                                      regex.Replace(sizeNoDisplay, "100")
                                          : sizeNoDisplay;

                double sizeNoDouble = 0;
                Double.TryParse(sizeNoString, out sizeNoDouble);
                dr["SizeNoDouble"] = sizeNoDouble;
                dr["SizeNo"]       = outsoleMaterialBalance.SizeNo;
                if (def.ShowOSSizeValue)
                {
                    dr["SizeOutsole"] = sizeNoDisplay;
                }
                dr["QuantityDelivery"] = outsoleMaterialBalance.QuantityDelivery;
                dr["QuantityBalance"]  = outsoleMaterialBalance.QuantityBalance;
                dr["QuantityOrder"]    = outsoleMaterialBalance.QuantityOrder;

                dtBalance.Rows.Add(dr);
            }
            e.Result = dtBalance;
        }
        private void bwLoadData_DoWork(object sender, DoWorkEventArgs e)
        {
            outsoleMaterialRejectList = OutsoleMaterialController.SelectReject();
            outsoleSupplierList       = OutsoleSuppliersController.Select();
            orderList = OrdersController.SelectByOutsoleMaterialReject();
            outsoleRawMaterialList = OutsoleRawMaterialController.Select();
            sizeRunList            = SizeRunController.SelectIsEnable();
            def = PrivateDefineController.GetDefine();

            DataTable dt  = new OutsoleMaterialRejectDataSet().Tables["OutsoleMaterialRejectTable"];
            DataTable dt1 = new OutsoleMaterialRejectDataSet().Tables["OutsoleMaterialRejectTable"];

            var regex = new Regex(@"[a-z]|[A-Z]");

            foreach (OutsoleMaterialModel outsoleMaterialReject in outsoleMaterialRejectList)
            {
                var     outsoleSupplier    = outsoleSupplierList.FirstOrDefault(f => f.OutsoleSupplierId == outsoleMaterialReject.OutsoleSupplierId);
                var     order              = orderList.FirstOrDefault(f => f.ProductNo == outsoleMaterialReject.ProductNo);
                var     outsoleRawMaterial = outsoleRawMaterialList.FirstOrDefault(f => f.ProductNo == outsoleMaterialReject.ProductNo && f.OutsoleSupplierId == outsoleMaterialReject.OutsoleSupplierId);
                DataRow dr  = dt.NewRow();
                DataRow dr1 = dt1.NewRow();

                dr["ProductNo"]  = outsoleMaterialReject.ProductNo;
                dr1["ProductNo"] = outsoleMaterialReject.ProductNo;
                var productNoList = new List <String>();
                if (order != null)
                {
                    dr["OutsoleCode"]  = order.OutsoleCode;
                    dr1["OutsoleCode"] = order.OutsoleCode;
                    dr["ETD"]          = order.ETD;
                    dr1["ETD"]         = order.ETD;
                    dr["ArticleNo"]    = order.ArticleNo;
                    dr1["ArticleNo"]   = order.ArticleNo;
                    productNoList      = orderList.Where(w => w.OutsoleCode == order.OutsoleCode).Select(s => s.ProductNo).ToList();
                }
                if (outsoleRawMaterial != null)
                {
                    dr["SupplierETD"]  = outsoleRawMaterial.ETD;
                    dr1["SupplierETD"] = outsoleRawMaterial.ETD;
                }
                if (outsoleSupplier != null)
                {
                    dr["OutsoleSupplier"]  = outsoleSupplier.Name;
                    dr1["OutsoleSupplier"] = outsoleSupplier.Name;
                }

                string sizeNoOutsole      = outsoleMaterialReject.SizeNo;
                var    sizeNo_OutsoleCode = sizeRunList.Where(w => productNoList.Contains(w.ProductNo) && w.SizeNo == sizeNoOutsole).FirstOrDefault();
                if (sizeNo_OutsoleCode != null)
                {
                    if (String.IsNullOrEmpty(sizeNo_OutsoleCode.OutsoleSize) == false)
                    {
                        sizeNoOutsole = sizeNo_OutsoleCode.OutsoleSize;
                    }
                }

                string sizeNoString = regex.IsMatch(sizeNoOutsole) == true?regex.Replace(sizeNoOutsole, "") : sizeNoOutsole;

                double sizeNoDouble = 0;
                Double.TryParse(sizeNoString, out sizeNoDouble);
                dr["SizeNoDouble"]  = sizeNoDouble;
                dr1["SizeNoDouble"] = sizeNoDouble;

                dr["SizeNo"]  = outsoleMaterialReject.SizeNo;
                dr1["SizeNo"] = outsoleMaterialReject.SizeNo;
                if (def.ShowOSSizeValue)
                {
                    dr["SizeOutsole"]  = sizeNoOutsole;
                    dr1["SizeOutsole"] = sizeNoOutsole;
                }


                if (outsoleMaterialReject.QuantityReject > 0)
                {
                    dr["QuantityReject"] = outsoleMaterialReject.QuantityReject;
                    dt.Rows.Add(dr);
                }

                if (outsoleMaterialReject.RejectAssembly > 0)
                {
                    dr1["QuantityReject"] = outsoleMaterialReject.RejectAssembly;
                    dt1.Rows.Add(dr1);
                }
            }
            dtRejectAssemblyStockfit = dt1;
            e.Result = dt;
        }