private void bwLoadData_DoWork(object sender, DoWorkEventArgs e) { offDayList = OffDayController.Select(); foreach (OffDayModel offDay in offDayList) { offDayViewList.Add(offDay); } }
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(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (modeViewStatistics == "1") { this.Title = "Master Schedule - Lead Time Per Section Statistics"; cboSection.SelectedIndex = 0; } if (modeViewStatistics == "2" && cutAB == "Cut A") { cboSection.Visibility = Visibility.Collapsed; this.Title = "Master Schedule - Cut A Lead Time Statistics"; cuta = cutAB; } if (modeViewStatistics == "2" && cutAB == "Cut B") { cboSection.Visibility = Visibility.Collapsed; this.Title = "Master Schedule - Cut B Lead Time Statistics"; cutb = cutAB; } dpDateFrom.SelectedDate = DateTime.Now; dpDateTo.SelectedDate = DateTime.Now; offDayList = OffDayController.Select(); }
private void bwLoad_DoWork(object sender, DoWorkEventArgs e) { try { orderList = OrdersController.Select(); rawMaterialList = RawMaterialController.Select(); sewingMasterList = SewingMasterController.Select(); productionMemoList = ProductionMemoController.Select(); offDayList = OffDayController.Select(); privateDefine = PrivateDefineController.GetDefine(); } catch (Exception ex) { Dispatcher.Invoke(new Action(() => { MessageBox.Show(ex.Message, this.Title, MessageBoxButton.OK, MessageBoxImage.Error); })); return; } _SEW_VS_OTHERS_CUT_A = privateDefine.SewingVsOthersCutTypeA; _SEW_VS_OTHERS_CUT_B = privateDefine.SewingVsOthersCutTypeB; //sewingMasterList.RemoveAll(s => DateTimeHelper.Create(s.SewingBalance) != dtDefault && DateTimeHelper.Create(s.SewingBalance) != dtNothing); sewingMasterList = sewingMasterList.OrderBy(s => s.Sequence).ToList(); int[] materialIdUpperArray = { 1, 2, 3, 4, 10 }; int[] materialIdSewingArray = { 5, 7 }; int[] materialIdOutsoleArray = { 6 }; foreach (SewingMasterModel sewingMaster in sewingMasterList) { CutprepMasterExportViewModel cutprepMasterExportView = new CutprepMasterExportViewModel(); cutprepMasterExportView.Sequence = sewingMaster.Sequence; cutprepMasterExportView.ProductNo = sewingMaster.ProductNo; OrdersModel order = orderList.FirstOrDefault(f => f.ProductNo == sewingMaster.ProductNo); string memoId = ""; if (order != null) { cutprepMasterExportView.Country = order.Country; cutprepMasterExportView.ShoeName = order.ShoeName; cutprepMasterExportView.ArticleNo = order.ArticleNo; cutprepMasterExportView.PatternNo = order.PatternNo; cutprepMasterExportView.Quantity = order.Quantity; cutprepMasterExportView.ETD = order.ETD; List <ProductionMemoModel> productionMemoByProductionNumberList = productionMemoList.Where(p => p.ProductionNumbers.Contains(order.ProductNo) == true).ToList(); for (int p = 0; p <= productionMemoByProductionNumberList.Count - 1; p++) { ProductionMemoModel productionMemo = productionMemoByProductionNumberList[p]; memoId += productionMemo.MemoId; if (p < productionMemoByProductionNumberList.Count - 1) { memoId += "\n"; } } cutprepMasterExportView.MemoId = memoId; } MaterialArrivalViewModel materialArrivalUpper = MaterialArrival(order.ProductNo, materialIdUpperArray); cutprepMasterExportView.IsUpperMatsArrivalOk = false; if (materialArrivalUpper != null) { cutprepMasterExportView.UpperMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalUpper.Date); cutprepMasterExportView.IsUpperMatsArrivalOk = materialArrivalUpper.IsMaterialArrivalOk; } cutprepMasterExportView.SewingLine = sewingMaster.SewingLine; cutprepMasterExportView.SewingStartDate = sewingMaster.SewingStartDate; cutprepMasterExportView.SewingQuota = sewingMaster.SewingQuota; cutprepMasterExportView.SewingBalance = sewingMaster.SewingBalance; cutprepMasterExportView.CutAStartDate = sewingMaster.CutAStartDate; cutprepMasterExportView.CutAFinishDate = sewingMaster.CutAFinishDate; cutprepMasterExportView.CutAQuota = sewingMaster.CutAQuota; cutprepMasterExportView.AutoCut = sewingMaster.AutoCut; cutprepMasterExportView.LaserCut = sewingMaster.LaserCut; cutprepMasterExportView.HuasenCut = sewingMaster.HuasenCut; cutprepMasterExportView.CutABalance = sewingMaster.CutABalance; cutprepMasterExportView.PrintingBalance = sewingMaster.PrintingBalance; cutprepMasterExportView.H_FBalance = sewingMaster.H_FBalance; cutprepMasterExportView.EmbroideryBalance = sewingMaster.EmbroideryBalance; cutprepMasterExportView.CutBBalance = sewingMaster.CutBBalance; // Cut type A before sewing 18days var cutTypeABeforeSewing = sewingMaster.SewingStartDate.AddDays(-_SEW_VS_OTHERS_CUT_A); var dtCheckOffDateCutTypeAList = CheckOffDay(cutTypeABeforeSewing, sewingMaster.SewingStartDate); // Cut type B before sewing 10days var cutTypeBBeforeSewing = sewingMaster.SewingStartDate.AddDays(-_SEW_VS_OTHERS_CUT_B); var dtCheckOffDateCutTypeBList = CheckOffDay(cutTypeBBeforeSewing, sewingMaster.SewingStartDate); var firstDateCheckOffCutTypeA = String.Format("{0:M/d}", dtCheckOffDateCutTypeAList.FirstOrDefault()); var firstDateCheckOffCutTypeB = String.Format("{0:M/d}", dtCheckOffDateCutTypeBList.FirstOrDefault()); if (!String.IsNullOrEmpty(sewingMaster.CutBStartDate)) { cutprepMasterExportView.CutBStartDate = sewingMaster.CutBStartDate; } else if (sewingMaster.SewingStartDate != dtDefault) { cutprepMasterExportView.CutBStartDate = firstDateCheckOffCutTypeB; } else { cutprepMasterExportView.CutBStartDate = ""; } if (!String.IsNullOrEmpty(sewingMaster.AtomCutA)) { cutprepMasterExportView.AtomCutA = sewingMaster.AtomCutA; } else if (sewingMaster.SewingStartDate != dtDefault) { cutprepMasterExportView.AtomCutA = firstDateCheckOffCutTypeA; } else { cutprepMasterExportView.AtomCutA = ""; } if (!String.IsNullOrEmpty(sewingMaster.AtomCutB)) { cutprepMasterExportView.AtomCutB = sewingMaster.AtomCutB; } else if (sewingMaster.SewingStartDate != dtDefault) { cutprepMasterExportView.AtomCutB = firstDateCheckOffCutTypeB; } else { cutprepMasterExportView.AtomCutB = ""; } if (!String.IsNullOrEmpty(sewingMaster.LaserCutA)) { cutprepMasterExportView.LaserCutA = sewingMaster.LaserCutA; } else if (sewingMaster.SewingStartDate != dtDefault) { cutprepMasterExportView.LaserCutA = firstDateCheckOffCutTypeA; } else { cutprepMasterExportView.LaserCutA = ""; } if (!String.IsNullOrEmpty(sewingMaster.LaserCutB)) { cutprepMasterExportView.LaserCutB = sewingMaster.LaserCutB; } else if (sewingMaster.SewingStartDate != dtDefault) { cutprepMasterExportView.LaserCutB = firstDateCheckOffCutTypeB; } else { cutprepMasterExportView.LaserCutB = ""; } if (!String.IsNullOrEmpty(sewingMaster.HuasenCutA)) { cutprepMasterExportView.HuasenCutA = sewingMaster.HuasenCutA; } else if (sewingMaster.SewingStartDate != dtDefault) { cutprepMasterExportView.HuasenCutA = firstDateCheckOffCutTypeA; } else { cutprepMasterExportView.HuasenCutA = ""; } if (!String.IsNullOrEmpty(sewingMaster.HuasenCutB)) { cutprepMasterExportView.HuasenCutB = sewingMaster.HuasenCutB; } else if (sewingMaster.SewingStartDate != dtDefault) { cutprepMasterExportView.HuasenCutB = firstDateCheckOffCutTypeB; } else { cutprepMasterExportView.HuasenCutB = ""; } if (!String.IsNullOrEmpty(sewingMaster.ComelzCutA)) { cutprepMasterExportView.ComelzCutA = sewingMaster.ComelzCutA; } else if (sewingMaster.SewingStartDate != dtDefault) { cutprepMasterExportView.ComelzCutA = firstDateCheckOffCutTypeA; } else { cutprepMasterExportView.ComelzCutA = ""; } if (!String.IsNullOrEmpty(sewingMaster.ComelzCutB)) { cutprepMasterExportView.ComelzCutB = sewingMaster.ComelzCutB; } else if (sewingMaster.SewingStartDate != dtDefault) { cutprepMasterExportView.ComelzCutB = firstDateCheckOffCutTypeB; } else { cutprepMasterExportView.ComelzCutB = ""; } cutprepMasterExportViewList.Add(cutprepMasterExportView); } }
private void bwLoad_DoWork(object sender, DoWorkEventArgs e) { orderList = OrdersController.Select(); offDayList = OffDayController.Select(); }
private void bwLoad_DoWork(object sender, DoWorkEventArgs e) { sizeRunList = SizeRunController.Select(productNo); sockliningInputList = SockliningInputController.SelectByPO(productNo); offDayList = OffDayController.Select(); }
private void BwLoad_DoWork(object sender, DoWorkEventArgs e) { try { offDayList = OffDayController.Select(); productionMemoList = ProductionMemoController.Select(); sewingMasterViewModelNewList = ReportController.GetSewingSummaryReport(); rawMaterialViewModelNewList = RawMaterialController.Select_1(); } catch (Exception ex) { Dispatcher.Invoke(new Action(() => { MessageBox.Show(ex.Message, this.Title, MessageBoxButton.OK, MessageBoxImage.Error); })); return; } _SEW_VS_OTHERS_CUT_A = privateDefine.SewingVsOthersCutTypeA; _SEW_VS_OTHERS_CUT_B = privateDefine.SewingVsOthersCutTypeB; //int index = 1; DataTable dt = new SewingSummaryDataset().Tables["SewingSummaryDatatable"]; foreach (var sewNew in sewingMasterViewModelNewList) { var memoByPOList = productionMemoList.Where(p => p.ProductionNumbers.Contains(sewNew.ProductNo) == true).Select(s => s.MemoId).ToList(); var sewingMasterView = new SewingMasterViewModel(); // Order Information sewingMasterView.ProductNoBackground = Brushes.Transparent; sewingMasterView.ProductNo = sewNew.ProductNo; sewingMasterView.Country = sewNew.Country; sewingMasterView.ShoeName = sewNew.ShoeName; sewingMasterView.ArticleNo = sewNew.ArticleNo; sewingMasterView.PatternNo = sewNew.PatternNo; sewingMasterView.Quantity = sewNew.Quantity; sewingMasterView.ETD = sewNew.ETD; // Sewing Master Information sewingMasterView.Sequence = sewNew.Sequence; sewingMasterView.SewingLine = sewNew.SewingLine; sewingMasterView.SewingQuota = sewNew.SewingQuota; sewingMasterView.SewingStartDate = sewNew.SewingStartDate; sewingMasterView.SewingFinishDate = sewNew.SewingFinishDate; sewingMasterView.SewingPrep = sewNew.SewingPrep; sewingMasterView.SewingActualStartDate = sewNew.SewingActualStartDate; sewingMasterView.SewingActualFinishDate = sewNew.SewingActualFinishDate; sewingMasterView.SewingActualStartDateAuto = sewNew.SewingActualStartDateAuto; sewingMasterView.SewingActualFinishDateAuto = sewNew.SewingActualFinishDateAuto; sewingMasterView.SewingBalance = sewNew.SewingBalance; sewingMasterView.CutAStartDate = sewNew.CutAStartDate; sewingMasterView.CutAFinishDate = sewNew.CutAFinishDate; sewingMasterView.CutAQuota = sewNew.CutAQuota; sewingMasterView.CutAActualStartDate = sewNew.CutAActualStartDate; sewingMasterView.CutAActualFinishDate = sewNew.CutAActualFinishDate; sewingMasterView.PrintingBalance = sewNew.PrintingBalance; sewingMasterView.H_FBalance = sewNew.H_FBalance; sewingMasterView.EmbroideryBalance = sewNew.EmbroideryBalance; sewingMasterView.CutBBalance = sewNew.CutBBalance; sewingMasterView.AutoCut = sewNew.AutoCut; sewingMasterView.LaserCut = sewNew.LaserCut; sewingMasterView.HuasenCut = sewNew.HuasenCut; sewingMasterView.AssemblyBalance = sewNew.AssemblyBalance; // Outsole Master Infor sewingMasterView.OSFinishDate = sewNew.OSFinishDate; sewingMasterView.OSBalance = sewNew.OSBalance; sewingMasterView.SewingStartDateForeground = Brushes.Black; sewingMasterView.SewingFinishDateForeground = Brushes.Black; sewingMasterView.CutAStartDateForeground = Brushes.Black; //var bfSew10 = sewNew.SewingStartDate.AddDays(-10); var bfSew10 = sewNew.SewingStartDate.AddDays(-_SEW_VS_OTHERS_CUT_B); var bfSew10IncludeHolidayList = CheckOffDay(bfSew10, sewNew.SewingStartDate); //var bfSew15 = sewNew.SewingStartDate.AddDays(-15); var bfSew15 = sewNew.SewingStartDate.AddDays(-_SEW_VS_OTHERS_CUT_A); var bfSew15IncludeHolidayList = CheckOffDay(bfSew15, sewNew.SewingStartDate); var bf10 = bfSew10IncludeHolidayList.FirstOrDefault(); var bf15 = bfSew15IncludeHolidayList.FirstOrDefault(); if (string.IsNullOrEmpty(sewNew.CutBStartDate) == false) { sewingMasterView.CutBStartDate = sewNew.CutBStartDate; } else { if (sewNew.SewingStartDate != dtDefault) { sewingMasterView.CutBStartDate = TimeHelper.ConvertDateToView(new DateTime(bf10.Year, bf10.Month, bf10.Day).ToString("MM/dd/yyyy")); } else { sewingMasterView.CutBStartDate = ""; } } if (string.IsNullOrEmpty(sewNew.AtomCutA) == false) { sewingMasterView.AtomCutA = sewNew.AtomCutA; } else { if (sewNew.SewingStartDate != dtDefault) { sewingMasterView.AtomCutA = TimeHelper.ConvertDateToView(new DateTime(bf15.Year, bf15.Month, bf15.Day).ToString("MM/dd/yyyy")); } else { sewingMasterView.AtomCutA = ""; } } if (string.IsNullOrEmpty(sewNew.AtomCutB) == false) { sewingMasterView.AtomCutB = sewNew.AtomCutB; } else { if (sewNew.SewingStartDate != dtDefault) { sewingMasterView.AtomCutB = TimeHelper.ConvertDateToView(new DateTime(bf10.Year, bf10.Month, bf10.Day).ToString("MM/dd/yyyy")); } else { sewingMasterView.AtomCutB = ""; } } if (string.IsNullOrEmpty(sewNew.LaserCutA) == false) { sewingMasterView.LaserCutA = sewNew.LaserCutA; } else { if (sewNew.SewingStartDate != dtDefault) { sewingMasterView.LaserCutA = TimeHelper.ConvertDateToView(new DateTime(bf15.Year, bf15.Month, bf15.Day).ToString("MM/dd/yyyy")); } else { sewingMasterView.LaserCutA = ""; } } if (string.IsNullOrEmpty(sewNew.LaserCutB) == false) { sewingMasterView.LaserCutB = sewNew.LaserCutB; } else { if (sewNew.SewingStartDate != dtDefault) { sewingMasterView.LaserCutB = TimeHelper.ConvertDateToView(new DateTime(bf10.Year, bf10.Month, bf10.Day).ToString("MM/dd/yyyy")); } else { sewingMasterView.LaserCutB = ""; } } if (string.IsNullOrEmpty(sewNew.HuasenCutA) == false) { sewingMasterView.HuasenCutA = sewNew.HuasenCutA; } else { if (sewNew.SewingStartDate != dtDefault) { sewingMasterView.HuasenCutA = TimeHelper.ConvertDateToView(new DateTime(bf15.Year, bf15.Month, bf15.Day).ToString("MM/dd/yyyy")); } else { sewingMasterView.HuasenCutA = ""; } } if (string.IsNullOrEmpty(sewNew.HuasenCutB) == false) { sewingMasterView.HuasenCutB = sewNew.HuasenCutB; } else { if (sewNew.SewingStartDate != dtDefault) { sewingMasterView.HuasenCutB = TimeHelper.ConvertDateToView(new DateTime(bf10.Year, bf10.Month, bf10.Day).ToString("MM/dd/yyyy")); } else { sewingMasterView.HuasenCutB = ""; } } // UpperMaterial 1, 2, 3, 4, 10 if (sewNew.UpperMaterialFinisedDate != dtDefault) { sewingMasterView.UpperMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", sewNew.UpperMaterialFinisedDate); } else if (sewNew.UpperMaterialETD != dtDefault) { sewingMasterView.UpperMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", sewNew.UpperMaterialETD); } //Sewing Material 5, 7 if (sewNew.SewingMaterialFinisedDate != dtDefault) { sewingMasterView.SewingMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", sewNew.SewingMaterialFinisedDate); } else if (sewNew.SewingMaterialETD != dtDefault) { sewingMasterView.SewingMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", sewNew.SewingMaterialETD); } // Assembly Material 8, 9 if (sewNew.AssemblyMaterialFinisedDate != dtDefault) { sewingMasterView.AssemblyMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", sewNew.AssemblyMaterialFinisedDate); } else if (sewNew.AssemblyMaterialETD != dtDefault) { sewingMasterView.AssemblyMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", sewNew.AssemblyMaterialETD); } //// Outsole Material 6 //if (sewNew.OutsoleMaterialFinisedDate != dtDefault) // sewingMasterView.OSMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", sewNew.OutsoleMaterialFinisedDate); //else if (sewNew.OutsoleMaterialETD != dtDefault) // sewingMasterView.OSMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", sewNew.OutsoleMaterialETD); // Base on rawmaterial sewingMasterView.OSMatsArrival = ""; var osMaterial = rawMaterialViewModelNewList.FirstOrDefault(f => f.ProductNo == sewNew.ProductNo); if (String.IsNullOrEmpty(osMaterial.OUTSOLE_Remarks) && !String.IsNullOrEmpty(osMaterial.OUTSOLE_ActualDate)) { sewingMasterView.OSMatsArrival = osMaterial.OUTSOLE_ActualDate; } else if (osMaterial.OUTSOLE_ETD_DATE != dtDefault) { sewingMasterView.OSMatsArrival = osMaterial.OUTSOLE_ETD; } sewingMasterView.OutsoleStartDate = sewNew.OutsoleStartDate; sewingMasterView.OutsoleFinishDate = sewNew.OutsoleFinishDate; sewingMasterView.AssemblyStartDate = sewNew.AssemblyStartDate; sewingMasterView.AssemblyFinishDate = sewNew.AssemblyFinishDate; sewingMasterView.OutsoleCode = sewNew.OutsoleCode; sewingMasterViewList.Add(sewingMasterView); DataRow dr = dt.NewRow(); dr["MemoId"] = memoByPOList.Count() > 0 ? String.Join("\n", memoByPOList) : ""; dr["ProductNo"] = sewNew.ProductNo; dr["Country"] = sewNew.Country; dr["ShoeName"] = sewNew.ShoeName; dr["ArticleNo"] = sewNew.ArticleNo; dr["PatternNo"] = sewNew.PatternNo; dr["Quantity"] = sewNew.Quantity; dr["ETD"] = sewNew.ETD; dr["CSD"] = sewNew.ETD.AddDays(10); dr["UpperMatsArrival"] = sewingMasterView.UpperMatsArrival; dr["SewingMatsArrival"] = sewingMasterView.SewingMatsArrival; dr["OutsoleMatsArrival"] = sewingMasterView.OSMatsArrival; dr["AssemblyMatsArrival"] = sewingMasterView.AssemblyMatsArrival; dr["SewingLine"] = sewNew.SewingLine; dr["SewingStartDate"] = sewNew.SewingStartDate; dr["SewingFinishDate"] = sewNew.SewingFinishDate; dr["SewingActualStartDate"] = sewNew.SewingActualStartDate; dr["SewingActualFinishDate"] = sewNew.SewingActualFinishDate; dr["SewingActualStartDateAuto"] = sewNew.SewingActualStartDateAuto; dr["SewingActualFinishDateAuto"] = sewNew.SewingActualFinishDateAuto; dr["SewingBalance"] = sewNew.SewingBalance; dr["CutAStartDate"] = sewNew.CutAStartDate; dr["CutAFinishDate"] = sewNew.CutAFinishDate; dr["CutAQuota"] = sewNew.CutAQuota; dr["CutAActualStartDate"] = sewNew.CutAActualStartDate; dr["CutAActualFinishDate"] = sewNew.CutAActualFinishDate; dr["CutABalance"] = sewNew.CutABalance; dr["PrintingBalance"] = sewNew.PrintingBalance; dr["H_FBalance"] = sewNew.H_FBalance; dr["EmbroideryBalance"] = sewNew.EmbroideryBalance; dr["AutoCut"] = sewNew.AutoCut; dr["LaserCut"] = sewNew.LaserCut; dr["HuasenCut"] = sewNew.HuasenCut; dr["CutBStartDate"] = sewNew.CutBStartDate; dr["AtomCutA"] = sewingMasterView.AtomCutA; dr["AtomCutB"] = sewingMasterView.AtomCutB; dr["LaserCutA"] = sewingMasterView.LaserCutA; dr["LaserCutB"] = sewingMasterView.LaserCutB; dr["HuasenCutA"] = sewingMasterView.HuasenCutA; dr["HuasenCutB"] = sewingMasterView.HuasenCutB; dr["OutsoleStartDate"] = sewNew.OutsoleStartDate; dr["OutsoleFinishDate"] = sewNew.OutsoleFinishDate; dr["AssemblyStartDate"] = sewNew.AssemblyStartDate; dr["AssemblyFinishDate"] = sewNew.AssemblyFinishDate; dr["SewingPrep"] = sewNew.SewingPrep; dr["StockfitFinishDate"] = sewNew.OutsoleFinishDate; dr["StockfitBalance"] = sewNew.OSBalance; dr["CutprepBalance"] = sewNew.H_FBalance; dr["SewingQuota"] = sewNew.SewingQuota; dr["OutsoleCode"] = sewNew.OutsoleCode; dr["AssemblyBalance"] = sewNew.AssemblyBalance; dt.Rows.Add(dr); } sewingMasterViewList = sewingMasterViewList.OrderBy(s => s.SewingLine).ThenBy(s => s.Sequence).ToList(); e.Result = dt; }
private void bwLoad_DoWork(object sender, DoWorkEventArgs e) { supplierDefaultList = SupplierController.Select(); offDayCurrentList = OffDayController.Select(); }