コード例 #1
0
 private void bwUpdateSizeRun_DoWork(object sender, DoWorkEventArgs e)
 {
     foreach (var model in sizeRunToUpdateList)
     {
         SizeRunController.Insert(model);
     }
 }
コード例 #2
0
 private void bwLoadData_DoWork(object sender, DoWorkEventArgs e)
 {
     insockSupplierList    = InsockSuppliersController.Select();
     insockMaterialList    = InsockMaterialController.Select(productNo);
     sizeRunList           = SizeRunController.Select(productNo);
     insockRawMaterialList = InsockRawMaterialController.SelectPerPO(productNo);
 }
コード例 #3
0
ファイル: OrderWindow.xaml.cs プロジェクト: toanitsv/Mold
 private void bwSaveSizeRun_DoWork(object sender, DoWorkEventArgs e)
 {
     foreach (var sizeRun in sizeRunList_OutsoleCode)
     {
         SizeRunController.Insert(sizeRun);
     }
 }
コード例 #4
0
 private void bwLoadData_DoWork(object sender, DoWorkEventArgs e)
 {
     upperComponentList         = UpperComponentController.Select();
     upperComponentMaterialList = UpperComponentMaterialController.Select(productNo);
     sizeRunList = SizeRunController.Select(productNo);
     upperComponentRawMaterialList = UpperComponentRawMaterialController.Select(productNo);
 }
コード例 #5
0
ファイル: OrderWindow.xaml.cs プロジェクト: toanitsv/Mold
        private void bwRemoveSizeRun_DoWork(object sender, DoWorkEventArgs e)
        {
            var sizeRunRemove = e.Argument as SizeRun;

            SizeRunController.Delete(sizeRunRemove);
            sizeRunList_OutsoleCode.Remove(sizeRunRemove);
        }
 private void bwLoadData_DoWork(object sender, DoWorkEventArgs e)
 {
     outsoleReleaseMaterialAllList = OutsoleReleaseMaterialController.Select(reportId, null);
     orderAllList           = OrdersController.SelectByOutsoleReleaseMaterial(reportId);
     outsoleMaterialAllList = OutsoleMaterialController.SelectByOutsoleReleaseMaterial(reportId);
     sizeRunAllList         = SizeRunController.SelectByOutsoleReleaseMaterial(reportId);
 }
コード例 #7
0
 private void bwLoadData_DoWork(object sender, DoWorkEventArgs e)
 {
     assemblyReleaseAllList = AssemblyReleaseController.Select(reportId, null);
     orderAllList           = OrdersController.SelectByAssemblyRelease(reportId);
     sewingOutputAllList    = SewingOutputController.SelectByAssemblyRelease(reportId);
     outsoleOutputAllList   = OutsoleOutputController.SelectByAssemblyRelease(reportId);
     sizeRunAllList         = SizeRunController.SelectByAssemblyRelease(reportId);
 }
コード例 #8
0
 private void bwLoadData_DoWork(object sender, DoWorkEventArgs e)
 {
     outsoleSupplierList             = OutsoleSuppliersController.Select();
     outsoleMaterialList             = OutsoleMaterialController.Select(productNo);
     sizeRunList                     = SizeRunController.Select(productNo);
     outsoleRawMaterialList          = OutsoleRawMaterialController.Select(productNo);
     outsoleMaterialRackPositionList = OutsoleMaterialRackPositionController.Select(productNo);
 }
コード例 #9
0
 private void BwLoad_DoWork(object sender, DoWorkEventArgs e)
 {
     materialPlanList = MaterialPlanController.GetMaterialPlanByPO(productNo);
     materialPlanList.ForEach(t => t.ActualDateString = t.ActualDate != dtDefault ? String.Format("{0:MM/dd}", t.ActualDate) : "");
     supplierAccessoriesList = SupplierController.GetSuppliersAccessories();
     sizeRunList             = SizeRunController.Select(productNo);
     matsInspectionList      = MaterialInspectController.GetMaterialInspectByPO(productNo);
     matsDeliveryList        = MaterialDeliveryController.GetMaterialDeliveryByPO(productNo);
 }
コード例 #10
0
 private void bwLoad_DoWork(object sender, DoWorkEventArgs e)
 {
     orderList     = OrderController.Select();
     supplierList  = SupplierController.Select();
     componentList = ComponentController.Select();
     sizeRunList   = SizeRunController.Select();
     offDayList    = OffDayController.Select();
     offDayMapList = OffDayMapController.Select();
 }
コード例 #11
0
 private void bwLoad_DoWork(object sender, DoWorkEventArgs e)
 {
     sizeRunList               = SizeRunController.Select(productNo);
     outsoleMaterialList       = OutsoleMaterialController.Select(productNo);
     outsoleSupplierList       = OutsoleSuppliersController.Select();
     outsoleMaterialDetailList = OutsoleMaterialDetailController.Select(productNo);
     orderSearch               = OrdersController.SelectTop1(productNo);
     accountList               = AccountController.SelectAccount();
 }
コード例 #12
0
ファイル: OrderWindow.xaml.cs プロジェクト: toanitsv/Mold
        private void cbOutsoleCode_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var cbSelect = cbOutsoleCode.SelectedItem as Order;

            sizeRunList = SizeRunController.Select();

            sizeRunList_OutsoleCode = sizeRunList.Where(w => w.OutsoleCode == cbSelect.OutsoleCode).ToList();
            var regex = new Regex(@"[a-z]|[A-Z]");

            sizeRunList_OutsoleCode = sizeRunList_OutsoleCode.OrderBy(o => regex.IsMatch(o.SizeNo) ? Double.Parse(regex.Replace(o.SizeNo, "100")) : Double.Parse(o.SizeNo)).ToList();
            LoadSizeRun(sizeRunList_OutsoleCode);
        }
コード例 #13
0
        private void bwAddMore_DoWork(object sender, DoWorkEventArgs e)
        {
            string productNo = "";

            txtProductNo.Dispatcher.Invoke((Action)(() =>
            {
                productNo = txtProductNo.Text;
            }));
            orderSearch       = OrdersController.SelectTop1(productNo);
            sizeRunSearchList = SizeRunController.Select(productNo);
            outsoleReleaseMaterialSearchList = OutsoleReleaseMaterialController.Select(productNo);
            outsoleMaterialSearchList        = OutsoleMaterialController.Select(productNo);
        }
コード例 #14
0
        private void bwReport_DoWork(object sender, DoWorkEventArgs e)
        {
            outsoleRawMaterialList = OutsoleRawMaterialController.Select();
            outsoleMaterialList    = OutsoleMaterialController.SelectByOutsoleRawMaterial();
            sizeRunList            = SizeRunController.SelectByOutsoleRawMaterial();
            outsoleSupplierList    = OutsoleSuppliersController.Select();
            ordersList             = OrdersController.SelectByOutsoleRawMaterial();

            DataTable dt = new OutsoleDeliveryDataSet().Tables["OutsoleDeliveryTable"];

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

            foreach (string productNo in productNoList)
            {
                OrdersModel order = ordersList.Where(o => o.ProductNo == productNo).FirstOrDefault();
                List <OutsoleRawMaterialModel> outsoleRawMaterialOfProductNoList = outsoleRawMaterialList.Where(o => o.ProductNo == productNo).ToList();
                List <SizeRunModel>            sizeRunOfProductNoList            = sizeRunList.Where(s => s.ProductNo == productNo).ToList();
                List <OutsoleMaterialModel>    outsoleMaterialOfProductNoList    = outsoleMaterialList.Where(o => o.ProductNo == productNo).ToList();
                foreach (OutsoleRawMaterialModel outsoleRawMaterial in outsoleRawMaterialOfProductNoList)
                {
                    DateTime etd    = outsoleRawMaterial.ETD.Date;
                    bool     isFull = OutsoleRawMaterialController.IsFull(sizeRunOfProductNoList, new List <OutsoleRawMaterialModel>()
                    {
                        outsoleRawMaterial,
                    }, outsoleMaterialOfProductNoList);
                    if (etd != new DateTime(2000, 1, 1) && etd == dateSearch.Date && isFull == false)
                    {
                        DataRow dr = dt.NewRow();
                        dr["ProductNo"] = productNo;
                        if (order != null)
                        {
                            dr["ArticleNo"]   = order.ArticleNo;
                            dr["OutsoleCode"] = order.OutsoleCode;
                            dr["Quantity"]    = order.Quantity;
                            dr["ETD"]         = order.ETD;
                        }
                        dr["SupplierETD"] = etd;
                        dr["Remarks"]     = sizeRunOfProductNoList.Sum(s => (s.Quantity - outsoleMaterialOfProductNoList.Where(o => o.OutsoleSupplierId == outsoleRawMaterial.OutsoleSupplierId && o.SizeNo == s.SizeNo).Sum(o => (o.Quantity - o.QuantityReject)))).ToString();
                        OutsoleSuppliersModel outsoleSupplier = outsoleSupplierList.Where(o => o.OutsoleSupplierId == outsoleRawMaterial.OutsoleSupplierId).FirstOrDefault();
                        if (outsoleSupplier != null)
                        {
                            dr["Supplier"] = outsoleSupplier.Name;
                        }

                        dt.Rows.Add(dr);
                    }
                }
            }
            e.Result = dt;
        }
コード例 #15
0
 private void bwLoadData_DoWork(object sender, DoWorkEventArgs e)
 {
     if (releaseTo == ERelease.ReleaseToOutsole)
     {
         outsoleReleaseMaterialAllList = OutsoleReleaseMaterialController.Select(reportId, null);
         orderAllList           = OrdersController.SelectByOutsoleReleaseMaterial(reportId);
         outsoleMaterialAllList = OutsoleMaterialController.SelectByOutsoleReleaseMaterial(reportId);
         sizeRunAllList         = SizeRunController.SelectByOutsoleReleaseMaterial(reportId);
     }
     else
     {
         outsoleReleaseMaterialAllList = OutsoleReleaseWHInspectionController.Select(reportId, null);
         orderAllList           = OrdersController.SelectByOutsoleReleaseMaterialToWHInspection(reportId);
         outsoleMaterialAllList = OutsoleMaterialController.SelectByOutsoleReleaseMaterialToWHInspection(reportId);
         sizeRunAllList         = SizeRunController.SelectByOutsoleReleaseMaterialToWHInspection(reportId);
     }
 }
コード例 #16
0
        private void bwSearchOutsoleCode_DoWork(object sender, DoWorkEventArgs e)
        {
            orderList = OrdersController.Select();
            sizeRunPerOutsoleCodeList = SizeRunController.SelectPerOutsoleCode(outsoleCode).Where(w => w.UpdateOutsoleSizeByArticle == false).ToList();
            var outsoleCodeList = orderList.Select(s => s.OutsoleCode).Distinct().ToList();

            Dispatcher.Invoke(new Action(() =>
            {
                dgSizeMap.Columns.Clear();
                if (outsoleCodeList.Contains(outsoleCode) == false)
                {
                    MessageBox.Show("Not Found !", this.Title, MessageBoxButton.OK, MessageBoxImage.Information);
                    txtOutsoleCode.SelectAll();
                    txtOutsoleCode.Focus();
                    return;
                }
                FillDataSearch(dtSizeMap, dgSizeMap, sizeRunPerOutsoleCodeList);
            }));
        }
コード例 #17
0
        private void bwSearchArticleNo_DoWork(object sender, DoWorkEventArgs e)
        {
            orderList             = OrdersController.Select();
            sizeRunPerArticleList = SizeRunController.SelectPerArticle(articleNo);
            var ordersList_Article = orderList.Where(w => w.ArticleNo.Contains("-") ? w.ArticleNo.Split('-')[0].ToString().Contains(articleNo) == true : w.ArticleNo.Contains(articleNo) == true).ToList();

            Dispatcher.Invoke(new Action(() =>
            {
                dgSizeMapByArticle.Columns.Clear();
                if (ordersList_Article.Count == 0)
                {
                    MessageBox.Show("Not Found !", this.Title, MessageBoxButton.OK, MessageBoxImage.Information);
                    txtArticleNo.SelectAll();
                    txtArticleNo.Focus();
                    return;
                }
                FillDataSearch(dtSizeMapByArticle, dgSizeMapByArticle, sizeRunPerArticleList);
            }));
        }
コード例 #18
0
        private void bwUpdateSizeMapByArticleNo_DoWork(object sender, DoWorkEventArgs e)
        {
            GetDataFromTable(dgSizeMapByArticle, sizeRunPerArticleList, true);
            Dispatcher.Invoke(new Action(() =>
            {
                prgStatusUpdateOutsoleCode.Maximum = sizeRunMapToUpdateList.Count;
            }));
            int indexProgressBar = 1;

            foreach (var sizeRunMapUpdate in sizeRunMapToUpdateList)
            {
                SizeRunController.UpdateSizeMap(sizeRunMapUpdate);
                Dispatcher.Invoke(new Action(() =>
                {
                    prgStatusUpdateOutsoleCode.Value = indexProgressBar;
                }));
                indexProgressBar++;
            }
        }
コード例 #19
0
        private void bwCheckOutsoleCode_DoWork(object sender, DoWorkEventArgs e)
        {
            var sizeRunList = SizeRunController.SelectIsEnable().Where(w => String.IsNullOrEmpty(w.OutsoleSize) == true).ToList();
            var orderList   = OrdersController.Select();

            Dispatcher.Invoke(new Action(() =>
            {
                if (sizeRunList.Count == 0)
                {
                    MessageBox.Show("Empty !", "Checking Result", MessageBoxButton.OK, MessageBoxImage.Information);
                    this.Cursor = null;
                    btnCheckOutsoleCodeNotYetUpdateSizeOutsole.IsEnabled = true;
                    return;
                }

                var productNoList   = sizeRunList.Select(s => s.ProductNo).Distinct().ToList();
                var outsoleCodeList = orderList.Where(w => productNoList.Contains(w.ProductNo)).Select(s => s.OutsoleCode).Distinct().ToList();
                MessageBox.Show(String.Format("Outsole Code List:\n{0}", String.Join("\n", outsoleCodeList)), "Checking Result", MessageBoxButton.OK, MessageBoxImage.Information);
            }));
        }
コード例 #20
0
        private void bwImport_DoWork(object sender, DoWorkEventArgs e)
        {
            // Insert SizeRun
            int i = 1;

            progressBar.Dispatcher.Invoke((Action)(() => progressBar.Maximum = sizeRunToImportList.Count));
            foreach (SizeRunModel sizeRun in sizeRunToImportList)
            {
                SizeRunController.InsertNew(sizeRun);
                dgSizeRun.Dispatcher.Invoke((Action)(() =>
                {
                    dgSizeRun.SelectedItem = sizeRun;
                    dgSizeRun.ScrollIntoView(sizeRun);
                }));
                Dispatcher.Invoke(new Action(() =>
                {
                    lblStatus.Text    = "Importing SizeRun ...";
                    progressBar.Value = i;
                }));
                i++;
            }
        }
        private void BwSearch_DoWork(object sender, DoWorkEventArgs e)
        {
            var searchWhat = e.Argument as String;

            try
            {
                if (doMode == DoMode.Confirm)
                {
                    osmConfirmList = OutsoleMaterialController.GetOSConfirmByIndexNo(int.Parse(searchWhat));
                }
                else if (doMode == DoMode.Release)
                {
                    osmConfirmList = OutsoleMaterialController.GetOSConfirmByPO(searchWhat);
                    sizeRunList    = SizeRunController.Select(searchWhat);
                }
            }
            catch (Exception ex)
            {
                Dispatcher.Invoke(new Action(() =>
                {
                    MessageBox.Show(ex.Message, this.Title, MessageBoxButton.OK, MessageBoxImage.Error);
                }));
            }
        }
コード例 #22
0
        private void bwLoadData_DoWork(object sender, DoWorkEventArgs e)
        {
            outsoleMaterialList        = OutsoleMaterialController.Select();
            outsoleReleaseMaterialList = OutsoleReleaseMaterialController.SelectByOutsoleMaterial();
            outsoleOutputList          = OutsoleOutputController.SelectByAssemblyMaster();
            outsoleMasterList          = OutsoleMasterController.Select();
            orderList           = OrdersController.Select();
            outsoleSupplierList = OutsoleSuppliersController.Select();
            assemblyReleaseList = AssemblyReleaseController.SelectByAssemblyMaster();
            sizeRunList         = SizeRunController.SelectIsEnable();

            inventoryByOSCodeList = ReportController.InventoryByOutsoleCode();
            inventoryByOSLineList = ReportController.InventoryByOutsoleLine();

            foreach (var inven in inventoryByOSCodeList)
            {
                inven.ProductNoList = orderList.Where(w => w.OutsoleCode == inven.OutsoleCode).Select(s => s.ProductNo).Distinct().ToList();
            }
            foreach (var inven in inventoryByOSLineList)
            {
                inven.ProductNoList = outsoleMasterList.Where(w => w.OutsoleLine == inven.OutsoleLine).Select(s => s.ProductNo).Distinct().ToList();
                inven.OutsoleCode   = inven.OutsoleLine;
            }
        }
コード例 #23
0
        private void bwLoad_DoWork(object sender, DoWorkEventArgs e)
        {
            outsoleSupplierList = OutsoleSuppliersController.Select();
            sizeRunList         = SizeRunController.SelectByOutsoleRawMaterial();
            sewingMasterList    = SewingMasterController.Select();
            outsoleMaterialList = OutsoleMaterialController.Select().Where(w => productNoList.Contains(w.ProductNo) && w.OutsoleSupplierId == supplierID).ToList();

            DataTable dt = new DataTable();

            Dispatcher.Invoke(new Action(() =>
            {
                dt.Columns.Add("ProductNo", typeof(String));
                DataGridTextColumn columnProductNo = new DataGridTextColumn();
                columnProductNo.Header             = "PO No.";

                //Style
                Style styleColumnProductNo = new Style(typeof(DataGridCell));

                Setter setterColumnProductNoForeground   = new Setter();
                setterColumnProductNoForeground.Property = DataGridCell.ForegroundProperty;
                setterColumnProductNoForeground.Value    = Brushes.Black;
                styleColumnProductNo.Setters.Add(setterColumnProductNoForeground);

                Setter setterColumnProductNoBackground   = new Setter();
                setterColumnProductNoBackground.Property = DataGridCell.BackgroundProperty;
                setterColumnProductNoBackground.Value    = new Binding("ProductNoBackground");
                styleColumnProductNo.Setters.Add(setterColumnProductNoBackground);

                columnProductNo.CellStyle = styleColumnProductNo;

                columnProductNo.Binding    = new Binding("ProductNo");
                columnProductNo.FontWeight = FontWeights.Bold;

                DataColumn columnProductNoBackground   = new DataColumn("ProductNoBackground", typeof(SolidColorBrush));
                columnProductNoBackground.DefaultValue = Brushes.Transparent;
                dt.Columns.Add(columnProductNoBackground);

                dgInventory.Columns.Add(columnProductNo);

                Binding bindingWidth1 = new Binding();
                bindingWidth1.Source  = columnProductNo;
                bindingWidth1.Path    = new PropertyPath("ActualWidth");
                ColumnDefinition cd1  = new ColumnDefinition();
                cd1.SetBinding(ColumnDefinition.WidthProperty, bindingWidth1);
                gridTotal.ColumnDefinitions.Add(cd1);

                dt.Columns.Add("ArticleNo", typeof(String));
                DataGridTextColumn column1_1_1 = new DataGridTextColumn();
                column1_1_1.Header             = "Article No.";
                column1_1_1.Binding            = new Binding("ArticleNo");
                //column1_1_1.FontWeight = FontWeights.Bold;
                dgInventory.Columns.Add(column1_1_1);
                Binding bindingWidth1_1_1 = new Binding();
                bindingWidth1_1_1.Source  = column1_1_1;
                bindingWidth1_1_1.Path    = new PropertyPath("ActualWidth");
                ColumnDefinition cd1_1_1  = new ColumnDefinition();
                cd1_1_1.SetBinding(ColumnDefinition.WidthProperty, bindingWidth1_1_1);
                gridTotal.ColumnDefinitions.Add(cd1_1_1);

                dt.Columns.Add("OrderETD", typeof(DateTime));
                DataGridTextColumn column1_1 = new DataGridTextColumn();
                column1_1.Header             = "Order EFD";
                // Style
                Style styleOrderETD = new Style(typeof(DataGridCell));
                styleOrderETD.Setters.Add(new Setter(TextBlock.TextAlignmentProperty, TextAlignment.Center));
                column1_1.CellStyle = styleOrderETD;

                Binding binding      = new Binding();
                binding.Path         = new PropertyPath("OrderETD");
                binding.StringFormat = "dd-MMM";
                column1_1.Binding    = binding;
                column1_1.FontWeight = FontWeights.Bold;
                dgInventory.Columns.Add(column1_1);
                Binding bindingWidth1_1 = new Binding();
                bindingWidth1_1.Source  = column1_1;
                bindingWidth1_1.Path    = new PropertyPath("ActualWidth");
                ColumnDefinition cd1_1  = new ColumnDefinition();
                cd1_1.SetBinding(ColumnDefinition.WidthProperty, bindingWidth1_1);
                gridTotal.ColumnDefinitions.Add(cd1_1);

                dt.Columns.Add("DeliveryETD", typeof(DateTime));
                DataGridTextColumn column1_1_A = new DataGridTextColumn();
                column1_1_A.Header             = "Delivery EFD";
                Binding bindingEDTSupp         = new Binding();
                bindingEDTSupp.Path            = new PropertyPath("DeliveryETD");
                bindingEDTSupp.StringFormat    = "dd-MMM";
                column1_1_A.Binding            = bindingEDTSupp;
                column1_1_A.FontWeight         = FontWeights.Bold;

                // Style
                Style styleDeliveryETD = new Style(typeof(DataGridCell));
                styleDeliveryETD.Setters.Add(new Setter(TextBlock.TextAlignmentProperty, TextAlignment.Center));
                column1_1_A.CellStyle = styleDeliveryETD;

                dgInventory.Columns.Add(column1_1_A);
                Binding bindingWidth1_1_A = new Binding();
                bindingWidth1_1_A.Source  = column1_1_A;
                bindingWidth1_1_A.Path    = new PropertyPath("ActualWidth");
                ColumnDefinition cd1_1_A  = new ColumnDefinition();
                cd1_1_A.SetBinding(ColumnDefinition.WidthProperty, bindingWidth1_1_A);
                gridTotal.ColumnDefinitions.Add(cd1_1_A);


                dt.Columns.Add("SewingStartDate", typeof(DateTime));
                DataGridTextColumn column1_1_B  = new DataGridTextColumn();
                column1_1_B.Header              = "Sewing Start";
                Binding bindingSewingStart      = new Binding();
                bindingSewingStart.Path         = new PropertyPath("SewingStartDate");
                bindingSewingStart.StringFormat = "dd-MMM";
                column1_1_B.Binding             = bindingSewingStart;
                column1_1_B.FontWeight          = FontWeights.Bold;

                // Style
                Style styleSewingStart = new Style(typeof(DataGridCell));
                styleDeliveryETD.Setters.Add(new Setter(TextBlock.TextAlignmentProperty, TextAlignment.Center));
                column1_1_B.CellStyle = styleDeliveryETD;

                dgInventory.Columns.Add(column1_1_B);
                Binding bindingWidthSewingStart = new Binding();
                bindingWidthSewingStart.Source  = column1_1_B;
                bindingWidthSewingStart.Path    = new PropertyPath("ActualWidth");
                ColumnDefinition cdSewingStart  = new ColumnDefinition();
                cdSewingStart.SetBinding(ColumnDefinition.WidthProperty, bindingWidthSewingStart);
                gridTotal.ColumnDefinitions.Add(cdSewingStart);

                dt.Columns.Add("Quantity", typeof(Int32));
                DataGridTextColumn column1_2 = new DataGridTextColumn();
                column1_2.Header             = "Quantity";
                Binding bindingQuantity      = new Binding();
                bindingQuantity.Path         = new PropertyPath("Quantity");
                //binding.StringFormat = "dd-MMM";
                column1_2.Binding = bindingQuantity;
                //column1_2.FontWeight = FontWeights.Bold;
                dgInventory.Columns.Add(column1_2);
                Binding bindingWidth1_2 = new Binding();
                bindingWidth1_2.Source  = column1_2;
                bindingWidth1_2.Path    = new PropertyPath("ActualWidth");
                ColumnDefinition cd1_2  = new ColumnDefinition();
                cd1_2.SetBinding(ColumnDefinition.WidthProperty, bindingWidth1_2);
                gridTotal.ColumnDefinitions.Add(cd1_2);


                dt.Columns.Add("Release", typeof(Int32));
                DataGridTextColumn column1_3 = new DataGridTextColumn();
                column1_3.Header             = "Release";
                Binding bindingRelease       = new Binding();
                bindingRelease.Path          = new PropertyPath("Release");
                column1_3.Binding            = bindingRelease;
                dgInventory.Columns.Add(column1_3);
                Binding bindingWidth1_3 = new Binding();
                bindingWidth1_3.Source  = column1_3;
                bindingWidth1_3.Path    = new PropertyPath("ActualWidth");
                ColumnDefinition cd1_3  = new ColumnDefinition();
                cd1_3.SetBinding(ColumnDefinition.WidthProperty, bindingWidth1_3);
                gridTotal.ColumnDefinitions.Add(cd1_3);


                dt.Columns.Add("QuantityDelivery", typeof(Int32));
                DataGridTextColumn column1_4 = new DataGridTextColumn();
                column1_4.Header             = "Delivery Qty";
                // Style
                Style styleQtyDelivery = new Style(typeof(DataGridCell));
                styleQtyDelivery.Setters.Add(new Setter(TextBlock.TextAlignmentProperty, TextAlignment.Center));
                Setter setterBackgroundDelivery   = new Setter();
                setterBackgroundDelivery.Property = DataGridCell.ForegroundProperty;
                setterBackgroundDelivery.Value    = new Binding("QuantityDeliveryForeground");
                styleQtyDelivery.Setters.Add(setterBackgroundDelivery);
                column1_4.CellStyle = styleQtyDelivery;

                Binding bindingQtyDelivery = new Binding();
                bindingQtyDelivery.Path    = new PropertyPath("QuantityDelivery");
                column1_4.Binding          = bindingQtyDelivery;
                dgInventory.Columns.Add(column1_4);
                Binding bindingWidth1_4 = new Binding();
                bindingWidth1_4.Source  = column1_4;
                bindingWidth1_4.Path    = new PropertyPath("ActualWidth");
                ColumnDefinition cd1_4  = new ColumnDefinition();
                cd1_4.SetBinding(ColumnDefinition.WidthProperty, bindingWidth1_4);
                gridTotal.ColumnDefinitions.Add(cd1_4);

                DataColumn columnDeliveryForeground   = new DataColumn("QuantityDeliveryForeground", typeof(SolidColorBrush));
                columnDeliveryForeground.DefaultValue = Brushes.Black;
                dt.Columns.Add(columnDeliveryForeground);

                dgInventory.FrozenColumnCount = 8;

                var regex  = new Regex("[a-z]|[A-Z]");
                sizeNoList = outsoleMaterialList.Select(s => s.SizeNo).Distinct().OrderBy(s => regex.IsMatch(s) ? Double.Parse(regex.Replace(s, "")) : Double.Parse(s)).ToList();
                for (int i = 0; i <= sizeNoList.Count - 1; i++)
                {
                    //OutsoleSuppliersModel outsoleSupplier = outsoleSupplierList[i];
                    string sizeNoBinding = sizeNoList[i].Contains(".") ? sizeNoList[i].Replace(".", "") : sizeNoList[i];
                    dt.Columns.Add(String.Format("Column{0}", sizeNoBinding), typeof(Int32));
                    DataGridTextColumn column = new DataGridTextColumn();
                    //column.SetValue(TagProperty, sizeRun.SizeNo);
                    column.Header  = sizeNoList[i];
                    column.Width   = 35;
                    column.Binding = new Binding(String.Format("Column{0}", sizeNoBinding));

                    Style style = new Style(typeof(DataGridCell));
                    style.Setters.Add(new Setter(TextBlock.TextAlignmentProperty, TextAlignment.Center));

                    Setter setterBackground   = new Setter();
                    setterBackground.Property = DataGridCell.BackgroundProperty;
                    setterBackground.Value    = new Binding(String.Format("Column{0}Background", sizeNoBinding));

                    Setter setterForeground   = new Setter();
                    setterForeground.Property = DataGridCell.ForegroundProperty;
                    setterForeground.Value    = new Binding(String.Format("Column{0}Foreground", sizeNoBinding));

                    Setter setterToolTip   = new Setter();
                    setterToolTip.Property = DataGridCell.ToolTipProperty;
                    setterToolTip.Value    = new Binding(String.Format("Column{0}ToolTip", sizeNoBinding));

                    style.Setters.Add(setterBackground);
                    style.Setters.Add(setterForeground);
                    style.Setters.Add(setterToolTip);

                    column.CellStyle = style;
                    dgInventory.Columns.Add(column);
                    Binding bindingWidth = new Binding();
                    bindingWidth.Source  = column;
                    bindingWidth.Path    = new PropertyPath("ActualWidth");
                    ColumnDefinition cd  = new ColumnDefinition();
                    cd.SetBinding(ColumnDefinition.WidthProperty, bindingWidth);
                    gridTotal.ColumnDefinitions.Add(cd);

                    DataColumn columnBackground   = new DataColumn(String.Format("Column{0}Background", sizeNoBinding), typeof(SolidColorBrush));
                    columnBackground.DefaultValue = Brushes.Transparent;

                    DataColumn columnForeground   = new DataColumn(String.Format("Column{0}Foreground", sizeNoBinding), typeof(SolidColorBrush));
                    columnForeground.DefaultValue = Brushes.Black;

                    DataColumn columnToolTip = new DataColumn(String.Format("Column{0}ToolTip", sizeNoBinding), typeof(String));

                    dt.Columns.Add(columnBackground);
                    dt.Columns.Add(columnForeground);
                    dt.Columns.Add(columnToolTip);
                }

                dt.Columns.Add("TotalBalance", typeof(Int32));
                DataGridTextColumn columnTotalBalance = new DataGridTextColumn();
                columnTotalBalance.Header             = "Total";
                columnTotalBalance.Binding            = new Binding("TotalBalance");
                dgInventory.Columns.Add(columnTotalBalance);
                Binding bindingWidthTotalBalance = new Binding();
                bindingWidthTotalBalance.Source  = columnTotalBalance;
                bindingWidthTotalBalance.Path    = new PropertyPath("ActualWidth");
                ColumnDefinition cdTotalBalance  = new ColumnDefinition();
                cdTotalBalance.SetBinding(ColumnDefinition.WidthProperty, bindingWidthTotalBalance);
                gridTotal.ColumnDefinitions.Add(cdTotalBalance);
            }));

            foreach (string productNo in productNoList)
            {
                var outsoleMaterialDetailList = OutsoleMaterialDetailController.Select(productNo).Where(w => w.OutsoleSupplierId == supplierID).ToList();
                var order = orderList.FirstOrDefault(f => f.ProductNo == productNo);

                var dr = dt.NewRow();

                if (order == null)
                {
                    continue;
                }
                dr["ProductNo"] = productNo;

                //HighLightPO
                int qtyOutsoleMaterialDetail = outsoleMaterialDetailList.Sum(s => s.Quantity);
                if (qtyOutsoleMaterialDetail >= order.Quantity)
                {
                    dr["ProductNoBackground"] = Brushes.Green;
                }
                else if (qtyOutsoleMaterialDetail != 0 && qtyOutsoleMaterialDetail < order.Quantity)
                {
                    dr["ProductNoBackground"] = Brushes.Yellow;
                }

                dr["ArticleNo"] = order.ArticleNo;
                dr["Quantity"]  = order.Quantity;
                dr["OrderETD"]  = order.ETD;

                var sewingMasterModel = sewingMasterList.Where(w => w.ProductNo == productNo).FirstOrDefault();
                if (sewingMasterModel != null)
                {
                    dr["SewingStartDate"] = sewingMasterModel.SewingStartDate;
                }

                var outsoleRawMaterialModel = outsoleRawMaterialList.Where(w => w.ProductNo == productNo && w.OutsoleSupplierId == supplierID).FirstOrDefault();
                var dtTemp = new DateTime(2000, 01, 01);
                if (outsoleRawMaterialModel != null)
                {
                    dr["DeliveryETD"] = outsoleRawMaterialModel.ETD;
                    dtTemp            = outsoleRawMaterialModel.ETD;
                }

                int qtyDelivery = 0;
                foreach (string sizeNo in sizeNoList)
                {
                    string sizeNoBinding          = sizeNo.Contains(".") ? sizeNo.Replace(".", "") : sizeNo;
                    var    outsoleMaterialRecieve = outsoleMaterialList.Where(w => w.ProductNo == productNo && w.SizeNo == sizeNo).FirstOrDefault();

                    int qtyDeliveryPerSize = 0;
                    int qtyRejectPerSize   = 0;
                    if (outsoleMaterialRecieve != null)
                    {
                        qtyDeliveryPerSize = outsoleMaterialRecieve.Quantity;
                        qtyRejectPerSize   = outsoleMaterialRecieve.QuantityReject;
                    }
                    int qtyPerSize = 0;
                    if (sizeRunList.Where(w => w.ProductNo == productNo).Count() > 0)
                    {
                        qtyPerSize = sizeRunList.Where(w => w.ProductNo == productNo && w.SizeNo == sizeNo).Select(s => s.Quantity).FirstOrDefault();
                    }

                    if (qtyRejectPerSize > 0)
                    {
                        dr[String.Format("Column{0}", sizeNoBinding)]           = qtyRejectPerSize;
                        dr[String.Format("Column{0}Foreground", sizeNoBinding)] = Brushes.Red;
                    }

                    int qtyBalance = qtyPerSize - qtyDeliveryPerSize;
                    if (qtyBalance > 0 && dtTemp != dtDefault)
                    {
                        dr[String.Format("Column{0}", sizeNoBinding)] = qtyBalance + qtyRejectPerSize;
                        var dtNow = DateTime.Now;
                        if (outsoleMaterialRecieve != null)
                        {
                            if (outsoleMaterialRecieve.ModifiedTime.Date < dtNow.Date)
                            {
                                dr[String.Format("Column{0}Background", sizeNoBinding)] = Brushes.Tomato;
                            }
                            if (outsoleMaterialRecieve.ModifiedTime.Date == dtNow.Date)
                            {
                                dr[String.Format("Column{0}Background", sizeNoBinding)] = Brushes.Green;
                            }
                            dr[String.Format("Column{0}Foreground", sizeNoBinding)] = Brushes.Black;
                        }

                        if (qtyRejectPerSize > 0)
                        {
                            dr[String.Format("Column{0}Background", sizeNoBinding)] = Brushes.Yellow;
                            dr[String.Format("Column{0}ToolTip", sizeNoBinding)]    = String.Format("Balance: {0}\nReject: {1}", qtyBalance, qtyRejectPerSize);
                        }
                    }
                    qtyDelivery += qtyDeliveryPerSize;
                }
                int totalRelease = outsoleReleaseMaterialList.Where(w => w.ProductNo == productNo).Sum(s => s.Quantity);

                if (order.Quantity != qtyDelivery && qtyDelivery != 0)
                {
                    dr["QuantityDeliveryForeground"] = Brushes.Red;
                }

                dr["Release"]          = totalRelease;
                dr["QuantityDelivery"] = qtyDelivery;


                int totalQty    = outsoleMaterialList.Where(w => w.ProductNo == productNo).Sum(s => s.Quantity);
                int totalReject = outsoleMaterialList.Where(w => w.ProductNo == productNo).Sum(s => s.QuantityReject);

                if (order.Quantity - totalQty + totalReject > 0)
                {
                    dr["TotalBalance"] = order.Quantity - totalQty + totalReject;
                }

                dt.Rows.Add(dr);
            }

            Dispatcher.Invoke(new Action(() =>
            {
                TextBlock lblTotal  = new TextBlock();
                lblTotal.Text       = "TOTAL";
                lblTotal.Margin     = new Thickness(1, 0, 0, 0);
                lblTotal.FontWeight = FontWeights.Bold;
                Border bdrTotal     = new Border();
                Grid.SetColumn(bdrTotal, 2);
                Grid.SetColumnSpan(bdrTotal, 5);
                bdrTotal.BorderThickness = new Thickness(1, 0, 1, 1);
                bdrTotal.BorderBrush     = Brushes.Black;
                bdrTotal.Child           = lblTotal;
                gridTotal.Children.Add(bdrTotal);

                TextBlock lblQuantityTotal     = new TextBlock();
                lblQuantityTotal.Text          = dt.Compute("Sum(Quantity)", "").ToString();
                lblQuantityTotal.Margin        = new Thickness(1, 0, 0, 0);
                lblQuantityTotal.FontWeight    = FontWeights.Bold;
                lblQuantityTotal.TextAlignment = TextAlignment.Center;

                Border bdrQuantityTotal = new Border();
                Grid.SetColumn(bdrQuantityTotal, 7);
                bdrQuantityTotal.BorderThickness = new Thickness(0, 0, 1, 1);
                bdrQuantityTotal.BorderBrush     = Brushes.Black;
                bdrQuantityTotal.Child           = lblQuantityTotal;
                gridTotal.Children.Add(bdrQuantityTotal);
                dgInventory.ItemsSource = dt.AsDataView();

                TextBlock lblReleaseTotal     = new TextBlock();
                lblReleaseTotal.Text          = dt.Compute("Sum(Release)", "").ToString();
                lblReleaseTotal.Margin        = new Thickness(1, 0, 0, 0);
                lblReleaseTotal.FontWeight    = FontWeights.Bold;
                lblReleaseTotal.TextAlignment = TextAlignment.Center;

                Border bdrReleaseTotal = new Border();
                Grid.SetColumn(bdrReleaseTotal, 8);
                bdrReleaseTotal.BorderThickness = new Thickness(0, 0, 1, 1);
                bdrReleaseTotal.BorderBrush     = Brushes.Black;
                bdrReleaseTotal.Child           = lblReleaseTotal;
                gridTotal.Children.Add(bdrReleaseTotal);
                dgInventory.ItemsSource = dt.AsDataView();

                TextBlock lblQuantityDelivery     = new TextBlock();
                lblQuantityDelivery.Text          = dt.Compute("Sum(QuantityDelivery)", "").ToString();
                lblQuantityDelivery.Margin        = new Thickness(1, 0, 0, 0);
                lblQuantityDelivery.FontWeight    = FontWeights.Bold;
                lblQuantityDelivery.TextAlignment = TextAlignment.Center;

                Border bdrQuantityDeliveryTotal = new Border();
                Grid.SetColumn(bdrQuantityDeliveryTotal, 9);
                bdrQuantityDeliveryTotal.BorderThickness = new Thickness(0, 0, 1, 1);
                bdrQuantityDeliveryTotal.BorderBrush     = Brushes.Black;
                bdrQuantityDeliveryTotal.Child           = lblQuantityDelivery;
                gridTotal.Children.Add(bdrQuantityDeliveryTotal);
                dgInventory.ItemsSource = dt.AsDataView();

                for (int i = 0; i <= sizeNoList.Count - 1; i++)
                {
                    Border brTemp = new Border();
                    Grid.SetColumn(brTemp, 10 + i);
                    gridTotal.Children.Add(brTemp);
                }

                TextBlock txtTotalBalance     = new TextBlock();
                txtTotalBalance.Text          = dt.Compute("Sum(TotalBalance)", "").ToString();
                txtTotalBalance.Margin        = new Thickness(1, 0, 0, 0);
                txtTotalBalance.FontWeight    = FontWeights.Bold;
                txtTotalBalance.TextAlignment = TextAlignment.Center;

                Border brTotalBalance = new Border();
                Grid.SetColumn(brTotalBalance, 11 + sizeNoList.Count());
                brTotalBalance.BorderThickness = new Thickness(1, 0, 1, 1);
                brTotalBalance.BorderBrush     = Brushes.Black;
                brTotalBalance.Child           = txtTotalBalance;
                gridTotal.Children.Add(brTotalBalance);
                dgInventory.ItemsSource = dt.AsDataView();
            }));
            dtExportExcel = dt;
        }
コード例 #24
0
        private void bwLoadData_DoWork(object sender, DoWorkEventArgs e)
        {
            assemblyMasterList          = AssemblyMasterController.Select();
            sewingOutputList            = SewingOutputController.SelectByAssemblyMaster();
            outsoleOutputList           = OutsoleOutputController.SelectByAssemblyMaster();
            assemblyReleaseList         = AssemblyReleaseController.SelectByAssemblyMaster();
            orderList                   = OrdersController.Select();
            sockliningInputList         = SockliningInputController.SelectByAssemblyMaster();
            sizeRunList                 = SizeRunController.SelectIsEnable();
            rawMaterialViewModelNewList = RawMaterialController.Select_1();

            List <UpperWHInventoryViewModel> upperWHInventoryList   = new List <UpperWHInventoryViewModel>();
            List <UpperWHInventoryViewModel> upperWHInventoryList_1 = new List <UpperWHInventoryViewModel>();
            var POList = orderList.Select(s => s.ProductNo).Distinct().ToList();

            foreach (var productNo in POList)
            {
                var assemblyMaster_PO  = assemblyMasterList.FirstOrDefault(w => w.ProductNo == productNo);
                var assemblyRelease_PO = assemblyReleaseList.Where(w => w.ProductNo == productNo).ToList();
                var sewingOutput_PO    = sewingOutputList.Where(w => w.ProductNo == productNo).ToList();
                var outsoleOutput_PO   = outsoleOutputList.Where(w => w.ProductNo == productNo).ToList();
                var sockliningInput_PO = sockliningInputList.Where(w => w.ProductNo == productNo).ToList();
                var sizeNoList         = sizeRunList.Where(w => w.ProductNo == productNo).Select(s => s.SizeNo).ToList();

                int qtyUpper_PO = 0, qtyOutsole_PO = 0, qtySocklining_PO = 0, qtyMatch_PO = 0, qtyMatchWithSocklining_PO = 0;
                foreach (var sizeNo in sizeNoList)
                {
                    int qtyAssemblyRelease_Size = assemblyRelease_PO.Where(w => w.SizeNo == sizeNo).Sum(s => s.Quantity);
                    int qtySewingOutput_Size    = sewingOutput_PO.Where(w => w.SizeNo == sizeNo).Sum(s => s.Quantity);
                    int qtyOutsoleOutput_Size   = outsoleOutput_PO.Where(w => w.SizeNo == sizeNo).Sum(s => s.Quantity);
                    int qtySocklining_Size      = sockliningInput_PO.Where(w => w.SizeNo == sizeNo).Sum(s => s.Quantity);

                    int qtyUpper = qtySewingOutput_Size - qtyAssemblyRelease_Size;
                    if (qtyUpper < 0)
                    {
                        qtyUpper = 0;
                    }
                    qtyUpper_PO += qtyUpper;

                    int qtyOutsole = qtyOutsoleOutput_Size - qtyAssemblyRelease_Size;
                    if (qtyOutsole < 0)
                    {
                        qtyOutsole = 0;
                    }
                    qtyOutsole_PO += qtyOutsole;

                    int qtySocklining = qtySocklining_Size - qtyAssemblyRelease_Size;
                    if (qtySocklining < 0)
                    {
                        qtySocklining = 0;
                    }
                    qtySocklining_PO += qtySocklining;

                    int qtyMatch = Math.Min(qtySewingOutput_Size, qtyOutsoleOutput_Size) - qtyAssemblyRelease_Size;
                    if (qtyMatch < 0)
                    {
                        qtyMatch = 0;
                    }
                    qtyMatch_PO += qtyMatch;

                    List <Int32> materialList = new List <Int32>();
                    materialList.Add(qtySewingOutput_Size > 0 ? qtySewingOutput_Size : 0);
                    materialList.Add(qtyOutsoleOutput_Size > 0 ? qtyOutsoleOutput_Size : 0);
                    materialList.Add(qtySocklining_Size > 0 ? qtySocklining_Size : 0);

                    int qtyMatchWithSocklining = materialList.Min() - qtyAssemblyRelease_Size;
                    if (qtyMatchWithSocklining < 0)
                    {
                        qtyMatchWithSocklining = 0;
                    }
                    qtyMatchWithSocklining_PO += qtyMatchWithSocklining;
                }

                string assemblyLine_PO   = assemblyMaster_PO != null ? assemblyMaster_PO.AssemblyLine : "";
                var    upperInventory_PO = new UpperWHInventoryViewModel()
                {
                    AssemblyLine           = assemblyLine_PO,
                    SewingOutput           = qtyUpper_PO,
                    OutsoleOutput          = qtyOutsole_PO,
                    SockliningInput        = qtySocklining_PO,
                    Matching               = qtyMatch_PO,
                    MatchingWithSocklining = qtyMatchWithSocklining_PO,
                };
                upperWHInventoryList.Add(upperInventory_PO);
            }

            var assemblyLineList = upperWHInventoryList.Select(s => s.AssemblyLine).Distinct().ToList();

            if (assemblyLineList.Count() > 0)
            {
                assemblyLineList = assemblyLineList.OrderBy(o => o).ToList();
            }
            var regex = new Regex(@"\D");
            var assemblyLineCustomList = assemblyLineList.Select(s => new { Line = s, LineNumber = regex.IsMatch(s) ? regex.Replace(s, "") : s }).ToList();

            if (assemblyLineCustomList.Count() > 0)
            {
                assemblyLineCustomList = assemblyLineCustomList.OrderBy(o => String.IsNullOrEmpty(o.LineNumber) ? 100 : Int32.Parse(o.LineNumber)).ThenBy(th => th.Line).ToList();
            }

            foreach (var assemblyLineCustom in assemblyLineCustomList)
            {
                var assemblyLine = assemblyLineCustom.Line;
                var upperWHInventoryByAssemblyLine = upperWHInventoryList.Where(w => w.AssemblyLine == assemblyLine).ToList();
                var productNoList_Assembly         = assemblyMasterList.Where(w => w.AssemblyLine == assemblyLine).Select(s => s.ProductNo).Distinct().ToList();
                var upperInventory = new UpperWHInventoryViewModel()
                {
                    AssemblyLine    = assemblyLine,
                    ProductNoList   = productNoList_Assembly,
                    SewingOutput    = upperWHInventoryByAssemblyLine.Sum(s => s.SewingOutput),
                    OutsoleOutput   = upperWHInventoryByAssemblyLine.Sum(s => s.OutsoleOutput),
                    SockliningInput = upperWHInventoryByAssemblyLine.Sum(s => s.SockliningInput),
                    Matching        = upperWHInventoryByAssemblyLine.Sum(s => s.Matching),
                };
                upperWHInventoryViewList.Add(upperInventory);

                var upperInventory_1 = new UpperWHInventoryViewModel()
                {
                    AssemblyLine    = assemblyLine,
                    ProductNoList   = productNoList_Assembly,
                    SewingOutput    = upperWHInventoryByAssemblyLine.Sum(s => s.SewingOutput),
                    OutsoleOutput   = upperWHInventoryByAssemblyLine.Sum(s => s.OutsoleOutput),
                    SockliningInput = upperWHInventoryByAssemblyLine.Sum(s => s.SockliningInput),
                    Matching        = upperWHInventoryByAssemblyLine.Sum(s => s.MatchingWithSocklining),
                };
                upperWHInventoryViewList_WithSocklining.Add(upperInventory_1);
            }
        }
コード例 #25
0
 private void bwLoad_DoWork(object sender, DoWorkEventArgs e)
 {
     sizeRunList     = SizeRunController.Select(productNo);
     outsoleWHFGList = OutsoleWHFGController.Select(productNo).OrderBy(o => o.CreatedDate).ToList();
 }
コード例 #26
0
 private void bwLoadData_DoWork(object sender, DoWorkEventArgs e)
 {
     outsoleOutputList = OutsoleOutputController.Select(productNo);
     sizeRunList       = SizeRunController.Select(productNo);
     offDayList        = OffDayController.SelectDate();
 }
コード例 #27
0
        private void bwImport_DoWork(object sender, DoWorkEventArgs e)
        {
            // Insert SizeRun
            int i = 1;

            progressBar.Dispatcher.Invoke((Action)(() => progressBar.Maximum = sizeRunToImportList.Count));
            foreach (SizeRunModel sizeRun in sizeRunToImportList)
            {
                SizeRunController.Insert(sizeRun);
                dgSizeRun.Dispatcher.Invoke((Action)(() =>
                {
                    dgSizeRun.SelectedItem = sizeRun;
                    dgSizeRun.ScrollIntoView(sizeRun);
                }));
                Dispatcher.Invoke(new Action(() =>
                {
                    lblStatus.Text    = "Importing SizeRun ...";
                    progressBar.Value = i;
                }));
                i++;
            }

            // Update OutsoleSize, MidSoleSize
            var productNoList = sizeRunToImportList.Select(s => s.ProductNo).Distinct().ToList();
            var orderList     = OrdersController.Select();
            int indexPO       = 1;

            progressBar.Dispatcher.Invoke((Action)(() => progressBar.Value = 0));
            progressBar.Dispatcher.Invoke((Action)(() => progressBar.Maximum = productNoList.Count));
            foreach (var productNo in productNoList)
            {
                var orderPerPOModel = orderList.FirstOrDefault(f => f.ProductNo == productNo);
                if (orderPerPOModel == null)
                {
                    continue;
                }
                string outsoleCode = orderPerPOModel.OutsoleCode;
                string articleNo   = orderPerPOModel.ArticleNo.Contains("-") ? orderPerPOModel.ArticleNo.Split('-')[0].ToString() : orderPerPOModel.ArticleNo;

                var sizeRunPerArticleList     = SizeRunController.SelectPerArticle(articleNo).Where(w => w.UpdateOutsoleSizeByArticle == true).ToList();
                var sizeRunPerOutsoleCodeList = SizeRunController.SelectPerOutsoleCode(outsoleCode).Where(w => w.UpdateOutsoleSizeByArticle == false).ToList();

                if (sizeRunPerOutsoleCodeList.Count == 0 && sizeRunPerArticleList.Count == 0)
                {
                    continue;
                }

                var sizeRunUpdateSizeMapList = sizeRunToImportList.Where(w => w.ProductNo == productNo).ToList();

                foreach (var sizeRun in sizeRunUpdateSizeMapList)
                {
                    string outsoleSize = "", midsoleSize = "";

                    var sizeRunInOutsoleCode = sizeRunPerOutsoleCodeList.FirstOrDefault(f => f.SizeNo == sizeRun.SizeNo);
                    if (sizeRunPerArticleList.Count > 0)
                    {
                        sizeRunInOutsoleCode = sizeRunPerArticleList.FirstOrDefault(f => f.SizeNo == sizeRun.SizeNo);
                    }

                    if (sizeRunInOutsoleCode == null)
                    {
                        continue;
                    }
                    outsoleSize = sizeRunInOutsoleCode.OutsoleSize;
                    midsoleSize = sizeRunInOutsoleCode.MidsoleSize;

                    if (String.IsNullOrEmpty(outsoleSize) == true && String.IsNullOrEmpty(midsoleSize) == true)
                    {
                        continue;
                    }

                    sizeRun.OutsoleSize = outsoleSize;
                    sizeRun.MidsoleSize = midsoleSize;
                    sizeRun.UpdateOutsoleSizeByArticle = sizeRunPerArticleList.Count > 0 ? true : false;

                    SizeRunController.UpdateSizeMap(sizeRun);
                }
                Dispatcher.Invoke(new Action(() =>
                {
                    lblStatus.Text    = "Updating OutsoleSize, MidsoleSize ...";
                    progressBar.Value = indexPO;
                }));
                indexPO++;
            }
        }
コード例 #28
0
        private void bwLoadData_DoWork(object sender, DoWorkEventArgs e)
        {
            var regex = new Regex(@"[a-z]|[A-Z]");

            outsoleRawMaterialList = OutsoleRawMaterialController.Select();
            outsoleMaterialList    = OutsoleMaterialController.SelectByOutsoleRawMaterial();
            sizeRunList            = SizeRunController.SelectByOutsoleRawMaterial();
            outsoleSupplierList    = OutsoleSuppliersController.Select();
            ordersList             = OrdersController.SelectByOutsoleRawMaterial();

            DataTable dt = new OutsoleDelayDataSet().Tables["OutsoleDelayTable"];

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

            foreach (string productNo in productNoList)
            {
                OrdersModel order = ordersList.Where(o => o.ProductNo == productNo).FirstOrDefault();
                List <OutsoleRawMaterialModel> outsoleRawMaterialList_D1 = outsoleRawMaterialList.Where(o => o.ProductNo == productNo).ToList();
                List <SizeRunModel>            sizeRunList_D1            = sizeRunList.Where(s => s.ProductNo == productNo).OrderBy(o => Double.Parse(regex.IsMatch(o.SizeNo) ? regex.Replace(o.SizeNo, "") : o.SizeNo)).ToList();
                List <OutsoleMaterialModel>    outsoleMaterialList_D1    = outsoleMaterialList.Where(o => o.ProductNo == productNo).ToList();
                foreach (OutsoleRawMaterialModel outsoleRawMaterial in outsoleRawMaterialList_D1)
                {
                    List <OutsoleMaterialModel> outsoleMaterialList_D2 = outsoleMaterialList_D1.Where(o => o.OutsoleSupplierId == outsoleRawMaterial.OutsoleSupplierId).ToList();
                    OutsoleSuppliersModel       outsoleSupplier        = outsoleSupplierList.Where(o => o.OutsoleSupplierId == outsoleRawMaterial.OutsoleSupplierId).FirstOrDefault();
                    DateTime etd = outsoleRawMaterial.ETD.Date;
                    //bool isFull = OutsoleRawMaterialController.IsFull(sizeRunList_D1, new List<OutsoleRawMaterialModel>() { outsoleRawMaterial }, outsoleMaterialList_D1);
                    //if (etd != new DateTime(2000, 1, 1) && etd < DateTime.Now.Date && isFull == false)
                    if (etd != new DateTime(2000, 1, 1) && etd < DateTime.Now.Date)
                    {
                        foreach (SizeRunModel sizeRun in sizeRunList_D1)
                        {
                            int qtyDelay = sizeRun.Quantity -
                                           outsoleMaterialList_D2.Where(o => o.SizeNo == sizeRun.SizeNo).Sum(o => o.Quantity);
                            if (qtyDelay > 0)
                            {
                                DataRow dr = dt.NewRow();
                                dr["ProductNo"] = productNo;

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

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

                                dr["SizeNo"] = sizeRun.SizeNo;

                                dr["SupplierETD"] = outsoleRawMaterial.ETD;
                                if (order != null)
                                {
                                    dr["OutsoleCode"] = order.OutsoleCode;
                                    dr["ArticleNo"]   = order.ArticleNo;
                                    dr["ETD"]         = order.ETD;
                                }
                                if (outsoleSupplier != null)
                                {
                                    dr["OutsoleSupplier"] = outsoleSupplier.Name;
                                }
                                dr["QuantityDelay"] = qtyDelay;
                                dt.Rows.Add(dr);
                            }
                        }
                    }
                }
            }
            e.Result = dt;
        }
コード例 #29
0
 private void bwLoad_DoWork(object sender, DoWorkEventArgs e)
 {
     sizeRunList         = SizeRunController.Select(productNo);
     sockliningInputList = SockliningInputController.SelectByPO(productNo);
     offDayList          = OffDayController.Select();
 }
コード例 #30
0
        private void bwLoad_DoWork(object sender, DoWorkEventArgs e)
        {
            Dispatcher.Invoke(new Action(() =>
            {
                lblStatus.Text = String.Format("Creating Columns");
            }));

            outsoleMaterialList        = OutsoleMaterialController.Select();
            outsoleReleaseMaterialList = OutsoleReleaseMaterialController.SelectByOutsoleMaterial();
            supplierList = OutsoleSuppliersController.Select();
            ordersList   = OrdersController.Select();
            sizeRunList  = SizeRunController.SelectIsEnable();

            osDeliverySummaryList = ReportController.GetOSDeliverySummary();

            var productNoList   = ordersList.Select(s => s.ProductNo).Distinct().ToList();
            var outsoleCodeList = osDeliverySummaryList.Select(s => s.OutsoleCode).Distinct().ToList();

            // Create Column
            DataTable dt = new DataTable();

            Dispatcher.Invoke(new Action(() =>
            {
                // Column OutsoleCode
                dt.Columns.Add("OutsoleCode", typeof(String));
                DataGridTemplateColumn colOutsoleCode = new DataGridTemplateColumn();
                colOutsoleCode.Header       = String.Format("Outsole Code");
                DataTemplate templateOSCode = new DataTemplate();
                FrameworkElementFactory tblOSCodeFactory = new FrameworkElementFactory(typeof(TextBlock));
                templateOSCode.VisualTree = tblOSCodeFactory;
                tblOSCodeFactory.SetValue(TextBlock.TextProperty, "");
                tblOSCodeFactory.SetBinding(TextBlock.TextProperty, new Binding(String.Format("OutsoleCode")));
                tblOSCodeFactory.SetValue(TextBlock.FontWeightProperty, FontWeights.SemiBold);
                tblOSCodeFactory.SetValue(TextBlock.VerticalAlignmentProperty, VerticalAlignment.Center);
                tblOSCodeFactory.SetValue(TextBlock.PaddingProperty, new Thickness(3, 0, 0, 0));
                colOutsoleCode.CellTemplate            = templateOSCode;
                colOutsoleCode.ClipboardContentBinding = new Binding(String.Format("OutsoleCode"));
                dgWHDelivery.Columns.Add(colOutsoleCode);

                // Column OutsoleCode
                dt.Columns.Add("OrderQuantity", typeof(String));
                DataGridTemplateColumn colOrderQty = new DataGridTemplateColumn();
                colOrderQty.Header                 = String.Format("Order Quantity");
                DataTemplate templateOrderQty      = new DataTemplate();
                FrameworkElementFactory tblOderQty = new FrameworkElementFactory(typeof(TextBlock));
                templateOrderQty.VisualTree        = tblOderQty;
                tblOderQty.SetValue(TextBlock.TextProperty, "");
                tblOderQty.SetBinding(TextBlock.TextProperty, new Binding(String.Format("OrderQuantity")));
                tblOderQty.SetValue(TextBlock.VerticalAlignmentProperty, VerticalAlignment.Center);
                tblOderQty.SetValue(TextBlock.PaddingProperty, new Thickness(3, 0, 0, 0));
                colOrderQty.CellTemplate            = templateOrderQty;
                colOrderQty.ClipboardContentBinding = new Binding(String.Format("OrderQuantity"));
                dgWHDelivery.Columns.Add(colOrderQty);

                // Column WHQuantity
                dt.Columns.Add("WHQuantity", typeof(String));
                DataGridTemplateColumn colWHQuantity = new DataGridTemplateColumn();
                colWHQuantity.Header                  = String.Format("WH Quantity");
                DataTemplate templateWHQuantity       = new DataTemplate();
                FrameworkElementFactory tblWHQuantity = new FrameworkElementFactory(typeof(TextBlock));
                templateWHQuantity.VisualTree         = tblWHQuantity;
                tblWHQuantity.SetBinding(TextBlock.TextProperty, new Binding(String.Format("WHQuantity")));
                tblWHQuantity.SetValue(TextBlock.VerticalAlignmentProperty, VerticalAlignment.Center);
                tblWHQuantity.SetValue(TextBlock.PaddingProperty, new Thickness(3, 0, 0, 0));
                colWHQuantity.CellTemplate            = templateWHQuantity;
                colWHQuantity.ClipboardContentBinding = new Binding(String.Format("WHQuantity"));
                dgWHDelivery.Columns.Add(colWHQuantity);

                // Column WHQuantity
                dt.Columns.Add("Reject", typeof(String));
                DataGridTemplateColumn colReject = new DataGridTemplateColumn();
                colReject.Header                  = String.Format("Reject");
                DataTemplate templateReject       = new DataTemplate();
                FrameworkElementFactory tblReject = new FrameworkElementFactory(typeof(TextBlock));
                templateReject.VisualTree         = tblReject;
                tblReject.SetBinding(TextBlock.TextProperty, new Binding(String.Format("Reject")));
                tblReject.SetValue(TextBlock.PaddingProperty, new Thickness(3, 0, 0, 0));
                tblReject.SetValue(TextBlock.VerticalAlignmentProperty, VerticalAlignment.Center);
                colReject.CellTemplate            = templateReject;
                colReject.ClipboardContentBinding = new Binding(String.Format("Reject"));
                dgWHDelivery.Columns.Add(colReject);

                // Column Matching
                dt.Columns.Add("Matching", typeof(String));
                DataGridTemplateColumn colMatching = new DataGridTemplateColumn();
                colMatching.Header                  = String.Format("Matching");
                DataTemplate templateMatching       = new DataTemplate();
                FrameworkElementFactory tblMatching = new FrameworkElementFactory(typeof(TextBlock));
                templateMatching.VisualTree         = tblMatching;
                tblMatching.SetBinding(TextBlock.TextProperty, new Binding(String.Format("Matching")));
                tblMatching.SetValue(TextBlock.PaddingProperty, new Thickness(3, 0, 0, 0));
                tblMatching.SetValue(TextBlock.VerticalAlignmentProperty, VerticalAlignment.Center);
                colMatching.CellTemplate            = templateMatching;
                colMatching.ClipboardContentBinding = new Binding(String.Format("Matching"));
                dgWHDelivery.Columns.Add(colMatching);

                // Column Release
                dt.Columns.Add("Release", typeof(String));
                DataGridTemplateColumn colRelease = new DataGridTemplateColumn();
                colRelease.Header                  = String.Format("Release");
                DataTemplate templateRelease       = new DataTemplate();
                FrameworkElementFactory tblRelease = new FrameworkElementFactory(typeof(TextBlock));
                templateRelease.VisualTree         = tblRelease;
                tblRelease.SetBinding(TextBlock.TextProperty, new Binding(String.Format("Release")));
                tblRelease.SetValue(TextBlock.PaddingProperty, new Thickness(3, 0, 0, 0));
                tblRelease.SetValue(TextBlock.VerticalAlignmentProperty, VerticalAlignment.Center);
                colRelease.CellTemplate            = templateRelease;
                colRelease.ClipboardContentBinding = new Binding(String.Format("Release"));
                dgWHDelivery.Columns.Add(colRelease);

                // Column Suppliers
                int maxNumberOfSupplier = osDeliverySummaryList.Max(m => m.NoOfSupp);
                for (int i = 0; i < maxNumberOfSupplier; i++)
                {
                    dt.Columns.Add(String.Format("Column{0}", i), typeof(String));
                    dt.Columns.Add(String.Format("ColumnSupplierID{0}", i), typeof(Int32));
                    DataGridTemplateColumn colSupplier = new DataGridTemplateColumn();
                    colSupplier.Header                  = String.Format("Supplier {0}", i + 1);
                    DataTemplate templateSupplier       = new DataTemplate();
                    FrameworkElementFactory tblSupplier = new FrameworkElementFactory(typeof(TextBlock));
                    templateSupplier.VisualTree         = tblSupplier;
                    tblSupplier.SetBinding(TextBlock.TextProperty, new Binding(String.Format("Column{0}", i)));
                    tblSupplier.SetValue(TextBlock.PaddingProperty, new Thickness(3, 3, 3, 3));
                    tblSupplier.SetValue(TextBlock.VerticalAlignmentProperty, VerticalAlignment.Center);

                    colSupplier.CellTemplate            = templateSupplier;
                    colSupplier.ClipboardContentBinding = new Binding(String.Format("Column{0}", i));
                    dgWHDelivery.Columns.Add(colSupplier);
                }
            }));

            // Binding Data
            int indexProgressBar = 1;

            Dispatcher.Invoke(new Action(() => {
                progressBar.Maximum = outsoleCodeList.Count();
            }));
            int totalQtyOrder = 0, totalQtyWH = 0, totalQtyReject = 0, totalQtyMatch = 0, totalQtyRelease = 0;

            foreach (var outsoleCode in outsoleCodeList)
            {
                DataRow dr = dt.NewRow();

                var osDeliveryByOScode = osDeliverySummaryList.Where(w => w.OutsoleCode == outsoleCode).ToList();

                dr["OutsoleCode"]   = outsoleCode;
                dr["OrderQuantity"] = string.Format("{0:#,0}", osDeliveryByOScode.Max(m => m.QtyOrder));
                dr["WHQuantity"]    = string.Format("{0:#,0}", osDeliveryByOScode.Max(m => m.QtyWH));
                dr["Reject"]        = string.Format("{0:#,0}", osDeliveryByOScode.Max(m => m.QtyReject));
                dr["Matching"]      = string.Format("{0:#,0}", osDeliveryByOScode.Max(m => m.QtyMatch));
                dr["Release"]       = string.Format("{0:#,0}", osDeliveryByOScode.Max(m => m.QtyRelease));

                totalQtyOrder   += osDeliveryByOScode.Max(m => m.QtyOrder);
                totalQtyWH      += osDeliveryByOScode.Max(m => m.QtyWH);
                totalQtyReject  += osDeliveryByOScode.Max(m => m.QtyReject);
                totalQtyMatch   += osDeliveryByOScode.Max(m => m.QtyMatch);
                totalQtyRelease += osDeliveryByOScode.Max(m => m.QtyRelease);

                var supplierIDList_OSCode = osDeliverySummaryList.Where(w => w.OutsoleCode == outsoleCode).Select(s => s.OutsoleSupplierId).Distinct().ToList();

                for (int i = 0; i < supplierIDList_OSCode.Count(); i++)
                {
                    int supplierID = supplierIDList_OSCode[i];
                    var osDeliverySummaryByOSCodeBySupplier = osDeliverySummaryList.FirstOrDefault(w => w.OutsoleCode == outsoleCode && w.OutsoleSupplierId == supplierID);

                    string numberOfPO = osDeliverySummaryByOSCodeBySupplier.NoOfPO > 0 ?
                                        string.Format("({0:#,0})", osDeliverySummaryByOSCodeBySupplier.NoOfPO) :
                                        "";
                    string quantityDelivery_SupplierString = osDeliverySummaryByOSCodeBySupplier.QtyDelivery > 0 ? string.Format("\nDelivery: {0:#,0}", osDeliverySummaryByOSCodeBySupplier.QtyDelivery)   : "";
                    string reject_SupplierString           = osDeliverySummaryByOSCodeBySupplier.QtyReject > 0 ?   string.Format("\nReject:     {0:#,0}", osDeliverySummaryByOSCodeBySupplier.QtyReject)   : "";
                    string balance_SupplierString          = osDeliverySummaryByOSCodeBySupplier.QtyBalance > 0 ?  string.Format("\nBalance:  {0:#,0}", osDeliverySummaryByOSCodeBySupplier.QtyBalance)    : "";

                    dr[String.Format("Column{0}", i)] = String.Format("{0} {1}{2}{3}{4}",
                                                                      osDeliverySummaryByOSCodeBySupplier.Name,
                                                                      numberOfPO,
                                                                      quantityDelivery_SupplierString,
                                                                      reject_SupplierString,
                                                                      balance_SupplierString);

                    dr[String.Format("ColumnSupplierID{0}", i)] = supplierIDList_OSCode[i];
                }
                dt.Rows.Add(dr);
                Dispatcher.Invoke(new Action(() =>
                {
                    progressBar.Value = indexProgressBar;
                    lblStatus.Text    = String.Format("Writing  {0} rows / {1}", indexProgressBar, outsoleCodeList.Count());
                    Thread.Sleep(50);
                }));
                indexProgressBar++;
            }

            DataRow drTotal = dt.NewRow();

            drTotal["OutsoleCode"]   = "Total";
            drTotal["OrderQuantity"] = string.Format("{0:#,0}", totalQtyOrder);
            drTotal["WHQuantity"]    = string.Format("{0:#,0}", totalQtyWH);
            drTotal["Reject"]        = string.Format("{0:#,0}", totalQtyReject);
            drTotal["Matching"]      = string.Format("{0:#,0}", totalQtyMatch);
            drTotal["Release"]       = string.Format("{0:#,0}", totalQtyRelease);

            dt.Rows.Add(drTotal);
            e.Result = dt;
        }