示例#1
0
        private void bwLoad_DoWork(object sender, DoWorkEventArgs e)
        {
            storingList   = StoringController.SelectIsNotLoad();
            outputingList = OutputingController.SelectIsNotLoad();

            if (outputingList.Count > 0)
            {
                foreach (var outputInDB in outputingList)
                {
                    OutputingCurrent current = new OutputingCurrent();
                    current.Outputing = outputInDB;
                    outputingCurrentList.Add(current);
                }
            }
            else
            {
                OutputingModel outputingDefault = new OutputingModel()
                {
                    ProductNo         = "Default",
                    Barcode           = "Default",
                    SizeNo            = "Default",
                    CartonNo          = 0,
                    GrossWeight       = 0,
                    ActualWeight      = 0,
                    DifferencePercent = 0,
                    IsPass            = false,
                    WorkerId          = "Default",
                    IssuesId          = 0
                };

                OutputingCurrent currentDefault = new OutputingCurrent();
                currentDefault.Outputing = outputingDefault;
                outputingCurrentList.Add(currentDefault);
            }
        }
示例#2
0
        private void bwLoad_DoWork(object sender, DoWorkEventArgs e)
        {
            storingWeighedList = StoringController.SelectIsNotLoad();
            outputtedList      = OutputingController.SelectIsNotLoad();

            int storingIndex = 1;

            foreach (StoringModel storing in storingWeighedList)
            {
                var current = new StoringCurrent()
                {
                    StoringModel = storing,
                };
                storingCurrentList.Add(current);

                Dispatcher.Invoke(new Action(() =>
                {
                    tempTitle  = string.Format("Downloading Carton: {0} / {1}", storingIndex, storingWeighedList.Count);
                    this.Title = tempTitle;
                }));

                storingIndex++;
            }

            // If this carton was outputted, allow reweigh
            if (outputtedList.Count > 0)
            {
                var barcodeOutputedList = outputtedList.Select(s => s.Barcode).Distinct().ToList();
                storingCurrentList.RemoveAll(r => barcodeOutputedList.Contains(r.StoringModel.Barcode));
            }

            var POScannedList = storingWeighedList.Where(w => w.Barcode.Contains(",") == false).Select(s => s.ProductNo).Distinct().ToList();

            // Create barcode temp
            int poCreatedIndex = 1;

            foreach (var PO in POScannedList)
            {
                var cartonNumberingDetail_POScannedList = CartonNumberingDetailController.Select(PO);
                // If total carton current in po equals total carton in cartonnumberingdetail. PO will be ignore.
                if (storingWeighedList.Where(w => w.ProductNo == PO).Count() == cartonNumberingDetail_POList.Count())
                {
                    poCreatedIndex++;
                    continue;
                }
                var firstStoringWeighedList = storingWeighedList.Where(w => w.ProductNo == PO).FirstOrDefault();
                int serialCarton_0          = ConvertBarcodeToSerial(firstStoringWeighedList.Barcode) - firstStoringWeighedList.CartonNo;
                int cartonIndex             = 1;
                foreach (var cartonDetail in cartonNumberingDetail_POScannedList)
                {
                    var storingTemp = new StoringTemp()
                    {
                        SizeNo    = cartonDetail.SizeNo,
                        ProductNo = cartonDetail.ProductNo,
                        CartonNo  = cartonDetail.CartonNo,
                        SerialNo  = serialCarton_0 + cartonDetail.CartonNo,
                    };
                    storingTempList.Add(storingTemp);

                    Dispatcher.Invoke(new Action(() =>
                    {
                        tempTitle = String.Format("Creating Barcode: {0} of {1} for {2} / {3} PO#",
                                                  cartonIndex,
                                                  cartonNumberingDetail_POScannedList.Select(s => s.CartonNo).Max(),
                                                  poCreatedIndex,
                                                  POScannedList.Count);
                        this.Title = tempTitle;
                    }));

                    cartonIndex++;
                }
                poCreatedIndex++;
            }
        }