Пример #1
0
 private void CreateOrderPrintJobs(List<IPrintJob> printJobs, Order order, int seriesGroup, int seriesNo)
 {
     printJobs.Add(new OrderPrintJob(order.No, order.Quantity)
     {
         PrinterName = settings.OrderPrinterName,
         LabelQuantity = 1,
         SeriesNo = seriesNo,
         SeriesGroup = seriesGroup
     });
 }
Пример #2
0
        private void CreatePrintJobs(List<IPrintJob> printJobs, Order order, int seriesGroup, IList<int> seriesQuantities, int seriesIndex)
        {
            var seriesNo = seriesQuantities.Count > 1 ? (seriesIndex + 1) : 0;

            foreach (var formatType in settings.LabelOrder)
            {
                switch (formatType)
                {
                    case "order":
                        if (orderFormatCheckBox.Checked)
                        {
                            CreateOrderPrintJobs(printJobs, order, seriesGroup, seriesNo);
                        }
                        break;

                    case "program":
                        if (programFormatCheckBox.Checked)
                        {
                            CreateProgramPrintJobs(printJobs, order, seriesGroup, seriesNo, seriesQuantities[seriesIndex]);
                        }
                        break;

                    case "serviceTag":
                        if (serviceTagFormatCheckBox.Checked)
                        {
                            CreateServiceTagPrintJobs(printJobs, order, seriesGroup, seriesNo, seriesQuantities, seriesIndex);
                        }
                        break;
                }
            }
        }
Пример #3
0
        private void CreatePrintJobs(List<IPrintJob> printJobs, Order order, int seriesGroup)
        {
            var seriesQuantities = CreateSeriesQuantities(order);

            for (var i = 0; i < seriesQuantities.Count; ++i)
            {
                CreatePrintJobs(printJobs, order, seriesGroup, seriesQuantities, i);
            }
        }
Пример #4
0
        private void CreateServiceTagPrintJobs(List<IPrintJob> printJobs, Order order, int seriesGroup, int series, IList<int> seriesQuantities, int seriesIndex)
        {
            var firstSerialNo = 1;

            for (var i = 0; i < seriesIndex; ++i)
            {
                firstSerialNo += seriesQuantities[i];
            }

            printJobs.Add(new ServiceTagPrintJob(order.No, firstSerialNo)
            {
                PrinterName = settings.ServiceTagPrinterName,
                LabelQuantity = seriesQuantities[seriesIndex],
                SeriesNo = series,
                SeriesGroup = seriesGroup
            });
        }
Пример #5
0
        private IList<int> CreateSeriesQuantities(Order order)
        {
            var workCenter = workCenterList.Find(wc => wc.Id == order.WorkCenter);
            var minDivQuantity = workCenter == null ? 1 : workCenter.MinDivQuantity;
            var prodLineCount = workCenter == null ? 1 : workCenter.ProdLineCount;
            var orderDivMinQuantity = order.Quantity / minDivQuantity;
            int seriesQuantity;
            int lastSeriesQuantity;
            int seriesCount;

            if (orderDivMinQuantity < prodLineCount)
            {
                seriesQuantity = minDivQuantity;
            }
            else
            {
                seriesQuantity = (int)Math.Floor((float)orderDivMinQuantity / prodLineCount * minDivQuantity);
            }

            seriesCount = (int)Math.Ceiling((float)order.Quantity / seriesQuantity);
            lastSeriesQuantity = order.Quantity % seriesQuantity;

            var seriesQuantities = new List<int>(seriesCount);

            if (lastSeriesQuantity > 0)
            {
                --seriesCount;
            }

            for (var i = 0; i < seriesCount; ++i)
            {
                seriesQuantities.Add(seriesQuantity);
            }

            if (lastSeriesQuantity > 0)
            {
                seriesQuantities.Add(lastSeriesQuantity);
            }

            return seriesQuantities;
        }
Пример #6
0
 private void CreateProgramPrintJobs(List<IPrintJob> printJobs, Order order, int seriesGroup, int seriesNo, int labelQuantity)
 {
     printJobs.Add(new ProgramPrintJob(order.Nc12, order.ProgramName)
     {
         PrinterName = settings.ProgramPrinterName,
         LabelQuantity = labelQuantity,
         SeriesNo = seriesNo,
         SeriesGroup = seriesGroup
     });
 }