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) { 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) { orderList = OrdersController.Select(); rawMaterialList = RawMaterialController.Select(); sewingMasterList = SewingMasterController.Select(); outsoleMasterList = OutsoleMasterController.Select(); sockliningMasterList = SockliningMasterController.Select(); assemblyMasterList = AssemblyMasterController.Select(); productionMemoList = ProductionMemoController.Select(); outsoleRawMaterialList = OutsoleRawMaterialController.Select(); rawMaterialViewModelNewList = RawMaterialController.Select_1(); //sewingMasterList.RemoveAll(s => DateTimeHelper.Create(s.SewingBalance) != dtDefault && DateTimeHelper.Create(s.SewingBalance) != dtNothing); assemblyMasterList = assemblyMasterList.OrderBy(s => s.Sequence).ToList(); int[] materialIdUpperArray = { 1, 2, 3, 4, 10 }; int[] materialIdSewingArray = { 5, 7 }; int[] materialIdOutsoleArray = { 6 }; int[] materialIdAssemblyArray = { 8, 9 }; int[] materialIdCartonArray = { 11 }; foreach (AssemblyMasterModel assemblyMaster in assemblyMasterList) { AssemblyMasterExportViewModel assemblyMasterExportView = new AssemblyMasterExportViewModel(); assemblyMasterExportView.Sequence = assemblyMaster.Sequence; assemblyMasterExportView.ProductNo = assemblyMaster.ProductNo; OrdersModel order = orderList.Where(o => o.ProductNo == assemblyMaster.ProductNo).FirstOrDefault(); string memoId = ""; if (order != null) { assemblyMasterExportView.Country = order.Country; assemblyMasterExportView.ShoeName = order.ShoeName; assemblyMasterExportView.ArticleNo = order.ArticleNo; assemblyMasterExportView.LastCode = order.LastCode; assemblyMasterExportView.Quantity = order.Quantity; assemblyMasterExportView.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"; } } assemblyMasterExportView.MemoId = memoId; } //MaterialArrivalViewModel materialArrivalOutsole = MaterialArrival(order.ProductNo, materialIdOutsoleArray); //assemblyMasterExportView.IsOutsoleMatsArrivalOk = false; //if (materialArrivalOutsole != null) //{ // assemblyMasterExportView.OutsoleMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalOutsole.Date); // assemblyMasterExportView.IsOutsoleMatsArrivalOk = materialArrivalOutsole.IsMaterialArrivalOk; //} //// follow OutsoleRawMaterial //var osRawMaterial = outsoleRawMaterialList.Where(w => w.ProductNo == order.ProductNo).ToList(); //var actualDateList = osRawMaterial.Select(s => s.ActualDate).ToList(); //assemblyMasterExportView.IsOutsoleMatsArrivalOk = false; //if (actualDateList.Count() > 0 && actualDateList.Contains(dtDefault) == false) //{ // assemblyMasterExportView.OutsoleMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", actualDateList.Max()); // assemblyMasterExportView.IsOutsoleMatsArrivalOk = true; //} //else //{ // var etdDateList = osRawMaterial.Select(s => s.ETD).ToList(); // if (etdDateList.Count() > 0) // { // assemblyMasterExportView.OutsoleMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", etdDateList.Max()); // } //} assemblyMasterExportView.IsOutsoleMatsArrivalOk = false; var rawMaterialViewModelNew = rawMaterialViewModelNewList.FirstOrDefault(f => f.ProductNo == order.ProductNo); if (String.IsNullOrEmpty(rawMaterialViewModelNew.OUTSOLE_Remarks) && !String.IsNullOrEmpty(rawMaterialViewModelNew.OUTSOLE_ActualDate)) { assemblyMasterExportView.OutsoleMatsArrival = rawMaterialViewModelNew.OUTSOLE_ActualDate; assemblyMasterExportView.IsOutsoleMatsArrivalOk = true; } else { assemblyMasterExportView.OutsoleMatsArrival = rawMaterialViewModelNew.OUTSOLE_ETD; } MaterialArrivalViewModel materialArrivalAssembly = MaterialArrival(order.ProductNo, materialIdAssemblyArray); assemblyMasterExportView.IsAssemblyMatsArrivalOk = false; if (materialArrivalAssembly != null) { assemblyMasterExportView.AssemblyMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalAssembly.Date); assemblyMasterExportView.IsAssemblyMatsArrivalOk = materialArrivalAssembly.IsMaterialArrivalOk; } MaterialArrivalViewModel materialArrivalCarton = MaterialArrival(order.ProductNo, materialIdCartonArray); if (materialArrivalCarton != null) { assemblyMasterExportView.CartonMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalCarton.Date); } assemblyMasterExportView.AssemblyLine = assemblyMaster.AssemblyLine; assemblyMasterExportView.AssemblyStartDate = assemblyMaster.AssemblyStartDate; assemblyMasterExportView.AssemblyFinishDate = assemblyMaster.AssemblyFinishDate; assemblyMasterExportView.AssemblyQuota = assemblyMaster.AssemblyQuota; assemblyMasterExportView.AssemblyBalance = assemblyMaster.AssemblyBalance; SewingMasterModel sewingMaster = sewingMasterList.Where(o => o.ProductNo == assemblyMaster.ProductNo).FirstOrDefault(); if (sewingMaster != null) { assemblyMasterExportView.SewingStartDate = sewingMaster.SewingStartDate; assemblyMasterExportView.SewingFinishDate = sewingMaster.SewingFinishDate; assemblyMasterExportView.SewingBalance = sewingMaster.SewingBalance; } else { assemblyMasterExportView.SewingStartDate = dtDefault; assemblyMasterExportView.SewingFinishDate = dtDefault; assemblyMasterExportView.SewingBalance = ""; } OutsoleMasterModel outsoleMaster = outsoleMasterList.Where(o => o.ProductNo == assemblyMaster.ProductNo).FirstOrDefault(); if (outsoleMaster != null) { assemblyMasterExportView.OutsoleBalance = outsoleMaster.OutsoleBalance; } else { assemblyMasterExportView.OutsoleBalance = ""; } SockliningMasterModel sockliningMaster = sockliningMasterList.Where(o => o.ProductNo == assemblyMaster.ProductNo).FirstOrDefault(); if (sockliningMaster != null) { assemblyMasterExportView.InsoleBalance = sockliningMaster.InsoleBalance; assemblyMasterExportView.InsockBalance = sockliningMaster.InsockBalance; } else { assemblyMasterExportView.InsoleBalance = ""; assemblyMasterExportView.InsockBalance = ""; } assemblyMasterExportViewList.Add(assemblyMasterExportView); } }
private void bwLoad_DoWork(object sender, DoWorkEventArgs e) { orderList = OrdersController.Select(); rawMaterialList = RawMaterialController.Select(); sewingMasterList = SewingMasterController.Select(); outsoleMasterList = OutsoleMasterController.Select(); productionMemoList = ProductionMemoController.Select(); outsoleRawMaterialList = OutsoleRawMaterialController.Select(); rawMaterialViewModelNewList = RawMaterialController.Select_1(); //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) { SewingMasterExportViewModel sewingMasterExportView = new SewingMasterExportViewModel(); sewingMasterExportView.Sequence = sewingMaster.Sequence; sewingMasterExportView.ProductNo = sewingMaster.ProductNo; OrdersModel order = orderList.Where(o => o.ProductNo == sewingMaster.ProductNo).FirstOrDefault(); string memoId = ""; if (order != null) { sewingMasterExportView.Country = order.Country; sewingMasterExportView.ShoeName = order.ShoeName; sewingMasterExportView.ArticleNo = order.ArticleNo; sewingMasterExportView.PatternNo = order.PatternNo; sewingMasterExportView.Quantity = order.Quantity; sewingMasterExportView.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"; } } sewingMasterExportView.MemoId = memoId; } MaterialArrivalViewModel materialArrivalUpper = MaterialArrival(order.ProductNo, materialIdUpperArray); sewingMasterExportView.IsUpperMatsArrivalOk = false; if (materialArrivalUpper != null) { sewingMasterExportView.UpperMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalUpper.Date); sewingMasterExportView.IsUpperMatsArrivalOk = materialArrivalUpper.IsMaterialArrivalOk; } MaterialArrivalViewModel materialArrivalSewing = MaterialArrival(order.ProductNo, materialIdSewingArray); sewingMasterExportView.IsSewingMatsArrivalOk = false; if (materialArrivalSewing != null) { sewingMasterExportView.SewingMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalSewing.Date); sewingMasterExportView.IsSewingMatsArrivalOk = materialArrivalSewing.IsMaterialArrivalOk; } //MaterialArrivalViewModel materialArrivalOutsole = MaterialArrival(order.ProductNo, materialIdOutsoleArray); //sewingMasterExportView.IsOSMatsArrivalOk = false; //if (materialArrivalOutsole != null) //{ // sewingMasterExportView.OSMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalOutsole.Date); // sewingMasterExportView.IsOSMatsArrivalOk = materialArrivalOutsole.IsMaterialArrivalOk; //} // For Outsole Material //var osRawMaterial = outsoleRawMaterialList.Where(w => w.ProductNo == order.ProductNo).ToList(); //var actualDateList = osRawMaterial.Select(s => s.ActualDate).ToList(); //sewingMasterExportView.IsOSMatsArrivalOk = false; //if (actualDateList.Count() > 0 && actualDateList.Contains(dtDefault) == false) //{ // sewingMasterExportView.OSMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", actualDateList.Max()); // sewingMasterExportView.IsOSMatsArrivalOk = true; //} //else //{ // var etdDateList = osRawMaterial.Select(s => s.ETD).ToList(); // if (etdDateList.Count() > 0) // { // sewingMasterExportView.OSMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", etdDateList.Max()); // } //} var rawMaterialViewModelNew = rawMaterialViewModelNewList.FirstOrDefault(f => f.ProductNo == order.ProductNo); sewingMasterExportView.IsOSMatsArrivalOk = false; if (String.IsNullOrEmpty(rawMaterialViewModelNew.OUTSOLE_Remarks) && !String.IsNullOrEmpty(rawMaterialViewModelNew.OUTSOLE_ActualDate)) { sewingMasterExportView.OSMatsArrival = rawMaterialViewModelNew.OUTSOLE_ActualDate; sewingMasterExportView.IsOSMatsArrivalOk = true; } else { sewingMasterExportView.OSMatsArrival = rawMaterialViewModelNew.OUTSOLE_ETD; } sewingMasterExportView.SewingLine = sewingMaster.SewingLine; sewingMasterExportView.CutAStartDate = sewingMaster.CutAStartDate; sewingMasterExportView.SewingStartDate = sewingMaster.SewingStartDate; sewingMasterExportView.SewingFinishDate = sewingMaster.SewingFinishDate; sewingMasterExportView.SewingQuota = sewingMaster.SewingQuota; sewingMasterExportView.SewingBalance = sewingMaster.SewingBalance; sewingMasterExportView.CutABalance = sewingMaster.CutABalance; sewingMasterExportView.CutBBalance = sewingMaster.CutBBalance; OutsoleMasterModel outsoleMaster = outsoleMasterList.Where(o => o.ProductNo == sewingMaster.ProductNo).FirstOrDefault(); if (outsoleMaster != null) { sewingMasterExportView.OSBalance = outsoleMaster.OutsoleBalance; } else { sewingMasterExportView.OSBalance = ""; } sewingMasterExportViewList.Add(sewingMasterExportView); } }
private void bwLoad_DoWork(object sender, DoWorkEventArgs e) { orderList = OrdersController.Select(); rawMaterialList = RawMaterialController.Select(); sewingMasterList = SewingMasterController.Select(); outsoleMasterList = OutsoleMasterController.Select(); outsoleReleaseMaterialList = OutsoleReleaseMaterialController.SelectByOutsoleMaster(); productionMemoList = ProductionMemoController.Select(); //sewingMasterList.RemoveAll(s => DateTimeHelper.Create(s.SewingBalance) != dtDefault && DateTimeHelper.Create(s.SewingBalance) != dtNothing); outsoleMasterList = outsoleMasterList.OrderBy(s => s.Sequence).ToList(); int[] materialIdUpperArray = { 1, 2, 3, 4, 10 }; int[] materialIdSewingArray = { 5, 7 }; int[] materialIdOutsoleArray = { 6 }; foreach (OutsoleMasterModel outsoleMaster in outsoleMasterList) { OutsoleMasterExportViewModel outsoleMasterExportView = new OutsoleMasterExportViewModel(); outsoleMasterExportView.Sequence = outsoleMaster.Sequence; outsoleMasterExportView.ProductNo = outsoleMaster.ProductNo; OrdersModel order = orderList.Where(o => o.ProductNo == outsoleMaster.ProductNo).FirstOrDefault(); string memoId = ""; if (order != null) { outsoleMasterExportView.Country = order.Country; outsoleMasterExportView.ShoeName = order.ShoeName; outsoleMasterExportView.ArticleNo = order.ArticleNo; outsoleMasterExportView.OutsoleCode = order.OutsoleCode; outsoleMasterExportView.Quantity = order.Quantity; outsoleMasterExportView.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"; } } outsoleMasterExportView.MemoId = memoId; } MaterialArrivalViewModel materialArrivalOutsole = MaterialArrival(order.ProductNo, materialIdOutsoleArray); outsoleMasterExportView.IsOutsoleMatsArrivalOk = false; if (materialArrivalOutsole != null) { outsoleMasterExportView.OutsoleMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalOutsole.Date); outsoleMasterExportView.IsOutsoleMatsArrivalOk = materialArrivalOutsole.IsMaterialArrivalOk; } outsoleMasterExportView.OutsoleLine = outsoleMaster.OutsoleLine; outsoleMasterExportView.OutsoleStartDate = outsoleMaster.OutsoleStartDate; outsoleMasterExportView.OutsoleFinishDate = outsoleMaster.OutsoleFinishDate; outsoleMasterExportView.OutsoleQuota = outsoleMaster.OutsoleQuota; outsoleMasterExportView.OutsoleBalance = outsoleMaster.OutsoleBalance; RawMaterialModel outsoleRawMaterial = rawMaterialList.Where(r => r.ProductNo == outsoleMaster.ProductNo && materialIdOutsoleArray.Contains(r.MaterialTypeId)).FirstOrDefault(); if (outsoleRawMaterial != null) { outsoleMasterExportView.OutsoleWHBalance = outsoleRawMaterial.Remarks; } else { outsoleMasterExportView.OutsoleWHBalance = ""; } SewingMasterModel sewingMaster = sewingMasterList.Where(o => o.ProductNo == outsoleMaster.ProductNo).FirstOrDefault(); if (sewingMaster != null) { outsoleMasterExportView.SewingStartDate = sewingMaster.SewingStartDate; outsoleMasterExportView.SewingFinishDate = sewingMaster.SewingFinishDate; outsoleMasterExportView.SewingQuota = sewingMaster.SewingQuota; outsoleMasterExportView.SewingBalance = sewingMaster.SewingBalance; } else { outsoleMasterExportView.SewingStartDate = dtDefault; outsoleMasterExportView.SewingFinishDate = dtDefault; outsoleMasterExportView.SewingQuota = 0; outsoleMasterExportView.SewingBalance = ""; } List <OutsoleReleaseMaterialModel> outsoleReleaseMaterialList_D1 = outsoleReleaseMaterialList.Where(o => o.ProductNo == outsoleMaster.ProductNo).ToList(); int qtyReleased = outsoleReleaseMaterialList_D1.Sum(o => o.Quantity); outsoleMasterExportView.ReleasedQuantity = qtyReleased.ToString(); if (qtyReleased <= 0) { outsoleMasterExportView.ReleasedQuantity = ""; } if (qtyReleased >= outsoleMasterExportView.Quantity && outsoleReleaseMaterialList_D1.Count > 0) { DateTime releasedDate = outsoleReleaseMaterialList_D1.FirstOrDefault().ModifiedTime; outsoleMasterExportView.ReleasedQuantity = string.Format("{0:M/d}", releasedDate); } outsoleMasterExportViewList.Add(outsoleMasterExportView); } }
private void bwLoad_DoWork(object sender, DoWorkEventArgs e) { orderList = OrdersController.Select(); rawMaterialList = RawMaterialController.Select(); sewingMasterList = SewingMasterController.Select(); outsoleMasterList = OutsoleMasterController.Select(); outsoleRawMaterialList = OutsoleRawMaterialController.Select(); outsoleReleaseMaterialList = OutsoleReleaseMaterialController.SelectByOutsoleMaster(); productionMemoList = ProductionMemoController.Select(); outsoleMaterialList = OutsoleMaterialController.Select(); rawMaterialViewModelNewList = RawMaterialController.Select_1(); //sewingMasterList.RemoveAll(s => DateTimeHelper.Create(s.SewingBalance) != dtDefault && DateTimeHelper.Create(s.SewingBalance) != dtNothing); outsoleMasterList = outsoleMasterList.OrderBy(s => s.Sequence).ToList(); int[] materialIdUpperArray = { 1, 2, 3, 4, 10 }; int[] materialIdSewingArray = { 5, 7 }; int[] materialIdOutsoleArray = { 6 }; foreach (OutsoleMasterModel outsoleMaster in outsoleMasterList) { OutsoleMasterExportViewModel outsoleMasterExportView = new OutsoleMasterExportViewModel(); outsoleMasterExportView.Sequence = outsoleMaster.Sequence; outsoleMasterExportView.ProductNo = outsoleMaster.ProductNo; OrdersModel order = orderList.FirstOrDefault(f => f.ProductNo == outsoleMaster.ProductNo); string memoId = ""; if (order != null) { outsoleMasterExportView.Country = order.Country; outsoleMasterExportView.ShoeName = order.ShoeName; outsoleMasterExportView.ArticleNo = order.ArticleNo; outsoleMasterExportView.OutsoleCode = order.OutsoleCode; outsoleMasterExportView.PatternNo = order.PatternNo; outsoleMasterExportView.Quantity = order.Quantity; outsoleMasterExportView.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"; } } outsoleMasterExportView.MemoId = memoId; } //MaterialArrivalViewModel materialArrivalOutsole = MaterialArrival(order.ProductNo, materialIdOutsoleArray); //outsoleMasterExportView.IsOutsoleMatsArrivalOk = false; //if (materialArrivalOutsole != null) //{ // outsoleMasterExportView.OutsoleMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalOutsole.Date); // outsoleMasterExportView.IsOutsoleMatsArrivalOk = materialArrivalOutsole.IsMaterialArrivalOk; //} // Update follow OutsoleRawMaterial //var osRawMaterial = outsoleRawMaterialList.Where(w => w.ProductNo == order.ProductNo).ToList(); //var actualDateList = osRawMaterial.Select(s => s.ActualDate).ToList(); //outsoleMasterExportView.IsOutsoleMatsArrivalOk = false; //if (actualDateList.Count() > 0 && actualDateList.Contains(dtDefault) == false) //{ // outsoleMasterExportView.OutsoleMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", actualDateList.Max()); // outsoleMasterExportView.IsOutsoleMatsArrivalOk = true; //} //else //{ // var etdDateList = osRawMaterial.Select(s => s.ETD).ToList(); // if (etdDateList.Count() > 0) // { // outsoleMasterExportView.OutsoleMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", etdDateList.Max()); // } //} outsoleMasterExportView.IsOutsoleMatsArrivalOk = false; var rawMaterialViewModelNew = rawMaterialViewModelNewList.FirstOrDefault(f => f.ProductNo == order.ProductNo); if (String.IsNullOrEmpty(rawMaterialViewModelNew.OUTSOLE_Remarks) && !String.IsNullOrEmpty(rawMaterialViewModelNew.OUTSOLE_ActualDate)) { outsoleMasterExportView.OutsoleMatsArrival = rawMaterialViewModelNew.OUTSOLE_ActualDate; outsoleMasterExportView.IsOutsoleMatsArrivalOk = true; } else { outsoleMasterExportView.OutsoleMatsArrival = rawMaterialViewModelNew.OUTSOLE_ETD; } outsoleMasterExportView.OutsoleLine = outsoleMaster.OutsoleLine; outsoleMasterExportView.OutsoleStartDate = outsoleMaster.OutsoleStartDate; outsoleMasterExportView.OutsoleFinishDate = outsoleMaster.OutsoleFinishDate; outsoleMasterExportView.OutsoleQuota = outsoleMaster.OutsoleQuota; outsoleMasterExportView.OutsoleBalance = outsoleMaster.OutsoleBalance; //RawMaterialModel outsoleRawMaterial = rawMaterialList.FirstOrDefault(f => f.ProductNo == outsoleMaster.ProductNo && materialIdOutsoleArray.Contains(f.MaterialTypeId)); //if (outsoleRawMaterial != null) //{ // outsoleMasterExportView.OutsoleWHBalance = outsoleRawMaterial.Remarks; //} //else //{ // outsoleMasterExportView.OutsoleWHBalance = ""; //} // Load Outsole_Remarks from OutsoleMaterial var outsoleMaterial_PO = outsoleMaterialList.Where(w => w.ProductNo == order.ProductNo).ToList(); var osMaterialSumBySupplier = outsoleMaterial_PO.GroupBy( g => g.OutsoleSupplierId) .Select(s => new { PO = order.ProductNo, Supplier = s.Key, ActualDelivery = outsoleMaterial_PO.Where(w => w.OutsoleSupplierId == s.Key) .Sum(su => su.Quantity - su.QuantityReject) }).ToList(); // if pot no one delivery. not show the balance quantity. if (osMaterialSumBySupplier.Count > 0 && order.Quantity - osMaterialSumBySupplier.Min(m => m.ActualDelivery) > 0) { // show the balance outsoleMasterExportView.OutsoleWHBalance = (order.Quantity - osMaterialSumBySupplier.Min(m => m.ActualDelivery)).ToString(); // if no one delivery, show blank if (outsoleMaterial_PO.Sum(s => s.Quantity) == 0) { outsoleMasterExportView.OutsoleWHBalance = ""; } } SewingMasterModel sewingMaster = sewingMasterList.FirstOrDefault(f => f.ProductNo == outsoleMaster.ProductNo); if (sewingMaster != null) { outsoleMasterExportView.SewingStartDate = sewingMaster.SewingStartDate; outsoleMasterExportView.SewingFinishDate = sewingMaster.SewingFinishDate; outsoleMasterExportView.SewingQuota = sewingMaster.SewingQuota; outsoleMasterExportView.SewingBalance = sewingMaster.SewingBalance; } else { outsoleMasterExportView.SewingStartDate = dtDefault; outsoleMasterExportView.SewingFinishDate = dtDefault; outsoleMasterExportView.SewingQuota = 0; outsoleMasterExportView.SewingBalance = ""; } List <OutsoleReleaseMaterialModel> outsoleReleaseMaterialList_D1 = outsoleReleaseMaterialList.Where(o => o.ProductNo == outsoleMaster.ProductNo).ToList(); int qtyReleased = outsoleReleaseMaterialList_D1.Sum(o => o.Quantity); outsoleMasterExportView.ReleasedQuantity = qtyReleased.ToString(); if (qtyReleased <= 0) { outsoleMasterExportView.ReleasedQuantity = ""; } if (qtyReleased >= outsoleMasterExportView.Quantity && outsoleReleaseMaterialList_D1.Count > 0) { DateTime releasedDate = outsoleReleaseMaterialList_D1.FirstOrDefault().ModifiedTime; outsoleMasterExportView.ReleasedQuantity = string.Format("{0:M/d}", releasedDate); } outsoleMasterExportViewList.Add(outsoleMasterExportView); } }
private void bwLoad_DoWork(object sender, DoWorkEventArgs e) { orderList = OrdersController.Select(); rawMaterialList = RawMaterialController.Select(); sewingMasterList = SewingMasterController.Select(); productionMemoList = ProductionMemoController.Select(); //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.Where(o => o.ProductNo == sewingMaster.ProductNo).FirstOrDefault(); 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; cutprepMasterExportViewList.Add(cutprepMasterExportView); } }
private void threadSearchByProductionNumber_DoWork(object sender, DoWorkEventArgs e) { string productionNumber = e.Argument as string; e.Result = ProductionMemoController.Select(null, productionNumber); }