示例#1
0
        private void threadLoad_DoWork(object sender, DoWorkEventArgs e)
        {
            //Get offdate
            offDateList = OffDayController.SelectDate();

            int[] materialIdUpperArray    = { 1, 2, 3, 4, 10 };
            int[] materialIdAssemblyArray = { 8 };
            int[] materialIdOutsoleArray  = { 6 };

            object[] args      = e.Argument as object[];
            DateTime dateFrom  = (args[0] as DateTime?).Value;
            DateTime dateTo    = (args[1] as DateTime?).Value;
            string   sectionId = args[2] as string;

            if (orderList.Count <= 0)
            {
                orderList = OrdersController.Select();
            }

            if (sectionId == sewing && sewingMasterList.Count <= 0)
            {
                sewingMasterList = SewingMasterController.Select();
            }
            if (sectionId == assembly && assemblyMasterList.Count <= 0)
            {
                assemblyMasterList = AssemblyMasterController.Select();
            }
            if (sectionId == outsole && outsoleMasterList.Count <= 0)
            {
                outsoleMasterList = OutsoleMasterController.Select();
            }

            if (rawMaterialList.Count <= 0)
            {
                rawMaterialList = RawMaterialController.Select();
            }

            string[] lineArray = null;
            string[] tempArray = null;
            if (sectionId == sewing)
            {
                //lineArray = sewingMasterList.Select(s => s.SewingLine).Distinct().OrderBy(s => s).ToArray();
                tempArray = sewingMasterList.Select(s => s.SewingLine).Distinct().ToArray();
                SortArray(tempArray);
                lineArray = tempArray;
            }
            if (sectionId == assembly)
            {
                //lineArray = assemblyMasterList.Select(s => s.AssemblyLine).Distinct().OrderBy(s => s).ToArray();
                tempArray = assemblyMasterList.Select(s => s.AssemblyLine).Distinct().ToArray();
                SortArray(tempArray);
                lineArray = tempArray;
            }
            if (sectionId == outsole)
            {
                lineArray = outsoleMasterList.Select(s => s.OutsoleLine).Distinct().OrderBy(s => s).ToArray();
            }

            foreach (string line in lineArray)
            {
                DataRow dr = dt.NewRow();
                dr["Line"] = line;
                if (sectionId == sewing)
                {
                    List <SewingMasterModel> sewingMasterTempList = sewingMasterList.Where(s => s.SewingLine == line && ((dateFrom <= s.SewingStartDate && s.SewingStartDate <= dateTo) || (dateFrom <= s.SewingFinishDate && s.SewingFinishDate <= dateTo))).ToList();
                    foreach (SewingMasterModel sewingMaster in sewingMasterTempList)
                    {
                        OrdersModel order = orderList.Where(o => o.ProductNo == sewingMaster.ProductNo).FirstOrDefault();
                        CompareDate(order, dateFrom, dateTo, sewingMaster.SewingStartDate, sewingMaster.SewingFinishDate, ref dr, materialIdUpperArray);
                    }
                }

                if (sectionId == assembly)
                {
                    List <AssemblyMasterModel> sewingMasterTempList = assemblyMasterList.Where(s => s.AssemblyLine == line && ((dateFrom <= s.AssemblyStartDate && s.AssemblyStartDate <= dateTo) || (dateFrom <= s.AssemblyFinishDate && s.AssemblyFinishDate <= dateTo))).ToList();
                    foreach (AssemblyMasterModel sewingMaster in sewingMasterTempList)
                    {
                        OrdersModel order = orderList.Where(o => o.ProductNo == sewingMaster.ProductNo).FirstOrDefault();
                        CompareDate(order, dateFrom, dateTo, sewingMaster.AssemblyStartDate, sewingMaster.AssemblyFinishDate, ref dr, materialIdAssemblyArray);
                    }
                }

                if (sectionId == outsole)
                {
                    List <OutsoleMasterModel> sewingMasterTempList = outsoleMasterList.Where(s => s.OutsoleLine == line && ((dateFrom <= s.OutsoleStartDate && s.OutsoleStartDate <= dateTo) || (dateFrom <= s.OutsoleFinishDate && s.OutsoleFinishDate <= dateTo))).ToList();
                    foreach (OutsoleMasterModel sewingMaster in sewingMasterTempList)
                    {
                        OrdersModel order = orderList.Where(o => o.ProductNo == sewingMaster.ProductNo).FirstOrDefault();
                        CompareDate(order, dateFrom, dateTo, sewingMaster.OutsoleStartDate, sewingMaster.OutsoleFinishDate, ref dr, materialIdOutsoleArray);
                    }
                }

                dt.Rows.Add(dr);
            }
        }
示例#2
0
 private void bwLoadData_DoWork(object sender, DoWorkEventArgs e)
 {
     outsoleOutputList = OutsoleOutputController.Select(productNo);
     sizeRunList       = SizeRunController.Select(productNo);
     offDayList        = OffDayController.SelectDate();
 }