예제 #1
0
        public Types.ScanInfo DiskScan(string diskId, bool isUndo, int PackCount, string skuID, DateTime createDatetime, string loc)
        {
            if (string.IsNullOrEmpty(diskId))
            {
                return(Types.ScanInfo.ScanError);
            }
            this.currentDiskId = diskId;

            if (isUndo)
            {
                return(UnDoScan());
            }
            //return CheckDiskIsScaned();
            Types.ScanInfo info = CheckDiskIsScaned();
            if (info == Types.ScanInfo.Successful)
            {
                SKU s = GetCurrentSKU(skuID);
                AddCurrentDisk(s, PackCount, loc);
                Types.ScanInfo sInfo = CurrentDisk.Asn(createDatetime);
                if (sInfo == Types.ScanInfo.Successful)
                {
                    CheckIsFinish();
                }
                else
                {
                    this.CurrentDisk.Sku = null;
                }
                return(sInfo);
            }
            else
            {
                return(info);
            }
        }
예제 #2
0
 private Types.ScanInfo UnDoScan()
 {
     if (CurrentDisk == null || !CurrentDisk.IsScaned)
     {
         return(Types.ScanInfo.NotScan);
     }
     Types.ScanInfo si = CurrentDisk.UnAsn();
     if (si != Types.ScanInfo.Successful)
     {
         return(si);
     }
     this.disks.Remove(currentDiskId);
     this.currentDisk = null;
     return(Types.ScanInfo.Successful);
 }
예제 #3
0
        private Types.ScanInfo UnDoScan()
        {
            if (CurrentDisk == null || !CurrentDisk.IsScaned)
            {
                return(Types.ScanInfo.NotScan);
            }
            Types.ScanInfo si = CurrentDisk.UnPutAway();

            if (si != Types.ScanInfo.Successful)
            {
                return(si);
            }
            this.FinishBillsId.Remove(currentDisk.Sku.BillNo);
            scanedDiskCount--;
            return(Types.ScanInfo.Successful);
        }
예제 #4
0
 private Types.ScanInfo UnDoScan()
 {
     //if (CurrentDisk == null || !CurrentDisk.IsScaned) { return Types.ScanInfo.NotScan; }
     //return CurrentDisk.unPick();
     if (CurrentDisk == null || !CurrentDisk.IsScaned)
     {
         return(Types.ScanInfo.NotScan);
     }
     Types.ScanInfo si = CurrentDisk.unPick();
     if (si != Types.ScanInfo.Successful)
     {
         return(si);
     }
     scanedDiskCount--;
     return(Types.ScanInfo.Successful);
 }
예제 #5
0
 public Types.ScanInfo LocScan(string locNo)
 {
     if (string.IsNullOrEmpty(locNo))
     {
         return(Types.ScanInfo.ScanError);
     }
     Types.ScanInfo sInfo = CurrentDisk.PutAway(locNo);
     if (sInfo == Types.ScanInfo.Successful)
     {
         scanedDiskCount++;
         CheckIsFinish();
     }
     else
     {
         this.currentDisk.Sku = null;
     }
     return(sInfo);
 }
예제 #6
0
 public Types.ScanInfo LotScan(string lotNo)
 {
     if (string.IsNullOrEmpty(lotNo))
     {
         return(Types.ScanInfo.ScanError);
     }
     if (this.currentDisk.Sku.NewLot.Trim().ToUpper() != lotNo.Trim().ToUpper())
     {
         return(Types.ScanInfo.NotExpectedLot);
     }
     Types.ScanInfo sInfo = CurrentDisk.MoveLot(lotNo);
     if (sInfo == Types.ScanInfo.Successful)
     {
         scanedDiskCount++;
         CheckIsFinish();
     }
     else
     {
         this.currentDisk.Sku = null;
     }
     return(sInfo);
 }
예제 #7
0
        /// <summary>
        /// Start reading and analyzing disk.
        /// </summary>
        private async Task RunAsync()
        {
            if (!Account.IsAdmin)
            {
                MessageBox.Show("This application needs to be run by administrator.",
                                ProductInfo.Title, MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            if ((Settings.Current.Method == ReadMethod.Native) && !DiskReader.NativeExeExists)
            {
                MessageBox.Show("Win32 console application for native method is not found.",
                                ProductInfo.Title, MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            // Prepare to store settings and data.
            if (!_diskScores[0].IsPinned)
            {
                _diskScores[0] = new DiskScore();
            }
            else             // If preceding score is pinned.
            {
                _diskScores.Insert(0, new DiskScore());
            }

            _diskScores[0].Disk      = CurrentDisk.Clone();
            _diskScores[0].StartTime = DateTime.Now;

            _diskScores[0].BlockSize      = Settings.Current.BlockSize;
            _diskScores[0].BlockOffset    = Settings.Current.BlockOffset;
            _diskScores[0].AreaSize       = Settings.Current.AreaSize;
            _diskScores[0].AreaLocation   = Settings.Current.AreaLocation;
            _diskScores[0].AreaRatioInner = Settings.Current.AreaRatioInner;
            _diskScores[0].AreaRatioOuter = Settings.Current.AreaRatioOuter;

            _diskScores[0].NumRun = Settings.Current.NumRun;
            _diskScores[0].Method = Settings.Current.Method;

            // Reset scores and chart.
            UpdateScores();
            _mainWindow.DrawChart(DrawMode.Clear);

            try
            {
                // Start.
                await Op.ReadAnalyzeAsync(new Progress <ProgressInfo>(UpdateProgress));
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Failed to read disk. {0}", ex);
            }

            // Save screenshot and log.
            if (Settings.Current.SavesScreenshotLog && !Op.IsCanceled)
            {
                // Wait for rendering of scores and chart.
                // (Synchronously start empty action of lower priority than rendering.)
                _mainWindow.Dispatcher.Invoke(new Action(() => { }), DispatcherPriority.ContextIdle, null);

                WindowSupplement.ActivateWindow(_mainWindow);

                // Wait for this window to be activated (provided up to 10 times).
                for (int i = 0; i <= 9; i++)
                {
                    if (WindowSupplement.IsWindowActivated(_mainWindow))
                    {
                        break;
                    }

                    await Task.Delay(TimeSpan.FromMilliseconds(100));
                }

                await SaveScreenshotLog();
            }
        }