Ejemplo n.º 1
0
 /// <summary>
 /// 显示条码规则列表
 /// </summary>
 public void ShowBarcodeTable()
 {
     foreach (var model in GetBarcodeList())
     {
         BarcodeList.Add(model);
     }
     ShowBarcodeList();
 }
        private void DdExcel(IEnumerable <Uri> urilist)
        {
            var excels = urilist.Select(s => s.LocalPath).ToList(); // Excel file(s) ??

            var message           = string.Empty;
            var inBarcode2samples = Proc.Several.BarcodeExcel.ReadBarcodeExcels(excels, ref message);

            // エクセルのエラー
            if (!string.IsNullOrEmpty(message))
            {
                ShowErrorDialog(message);
                return;
            }

            var newBarcodes = new ObservableCollection <Barcode2Name>();

            foreach (var barcode2sample in inBarcode2samples)  // エクセルから作成した barcode->sample
            {
                var sample = BarcodeList.Where(s => s.BarcodeNum.Equals(barcode2sample.BarcodeNum, StringComparison.OrdinalIgnoreCase))
                             .ToArray();

                // 元々のリストにあったサンプル名と同じサンプル名がエクセルから取得出来た場合
                if (sample.Any() && !string.IsNullOrEmpty(sample.First().SampleName))
                {
                    // sample.First().SampleName = barcode2sample.SampleName;
                    sample.First().SampleName = WfComponent.Utils.FileUtils.RemoveInvalidFileChar(barcode2sample.SampleName);
                    sample.First().FontWeight = userNameWeight;
                    sample.First().FontColor  = userNameColor;
                }
                else
                {
                    // エクセルからバーコード名が取れない(空セル)か、ヘッダ文字
                    if (string.IsNullOrEmpty(barcode2sample.BarcodeNum) ||
                        barcode2sample.BarcodeNum.Equals(Proc.Several.BarcodeExcel.BarcodeHeader, StringComparison.OrdinalIgnoreCase))
                    {
                        continue;
                    }


                    // エクセルから新規に追加された
                    BarcodeList.Add(new Barcode2Name()
                    {
                        BarcodeName = barcode2sample.BarcodeName,
                        BarcodeNum  = barcode2sample.BarcodeNum,
                        SampleName  = WfComponent.Utils.FileUtils.RemoveInvalidFileChar(barcode2sample.SampleName),
                        FontWeight  = userNameWeight,
                        FontColor   = userNameColor,
                    });
                }
            }
        }
Ejemplo n.º 3
0
        private async Task ExecuteLoadItemsCommand()
        {
            IsBusy = true;

            try
            {
                BarcodeList.Clear();
                var items = await BarcodeRepository.GetAllAsync();

                foreach (var item in items)
                {
                    BarcodeList.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 4
0
        /// <数据更新保存>
        ///
        /// </数据更新保存>
        /// <param name="rst">结果</param>
        /// <param name="index_i">穴位索引</param>
        private void UpdateTester(int rst, int index_i)
        {
            /*result = 0 -> Ng
             * result = 1 -> Pass
             * result = 2 -> Timeout
             */
            switch (rst)
            {
            case 0:
                testStatus[index_i] = TestStatus.Tested;
                testResult[index_i] = TestResult.Ng;
                if (!IsInSampleMode)
                {
                    ushort barstrnum = 0;
                    if (BarcodeList.Count > 0)
                    {
                        foreach (string barcode in BarcodeList)
                        {
                            if (TesterBracode[index_i] == barcode)
                            {
                                barstrnum++;
                            }
                        }
                    }
                    if (barstrnum < 1)
                    {
                        FailCount_Nomal[index_i]++;
                    }
                    else
                    {
                        PassCount_Nomal[index_i]++;
                    }
                }

                break;

            case 1:
                testStatus[index_i] = TestStatus.Tested;
                testResult[index_i] = TestResult.Pass;
                if (!IsInSampleMode)
                {
                    PassCount_Nomal[index_i]++;
                }

                break;

            case 2:
                testStatus[index_i] = TestStatus.Tested;
                testResult[index_i] = TestResult.TimeOut;
                break;

            default:
                testStatus[index_i] = TestStatus.Err;
                testResult[index_i] = TestResult.TimeOut;
                break;
            }
            if (!IsInSampleMode)
            {
                TestCount_Nomal[index_i]++;
                BarcodeList.Add(TesterBracode[index_i]);
            }
            if (!IsInSampleMode)
            {
                if (PassCount_Nomal[index_i] + FailCount_Nomal[index_i] != 0)
                {
                    Yield_Nomal[index_i] = Math.Round((double)PassCount_Nomal[index_i] / (PassCount_Nomal[index_i] + FailCount_Nomal[index_i]) * 100, 2);
                }
                else
                {
                    Yield_Nomal[index_i] = 0;
                }
            }

            try
            {
                if (!IsInSampleMode)
                {
                    Inifile.INIWriteValue(iniTesterResutPath, "Tester" + (Index * 2 + index_i).ToString(), "TestSpan", TestSpan[index_i].ToString());
                    Inifile.INIWriteValue(iniTesterResutPath, "Tester" + (Index * 2 + index_i).ToString(), "PassCount_Nomal", PassCount_Nomal[index_i].ToString());
                    Inifile.INIWriteValue(iniTesterResutPath, "Tester" + (Index * 2 + index_i).ToString(), "FailCount_Nomal", FailCount_Nomal[index_i].ToString());
                    Inifile.INIWriteValue(iniTesterResutPath, "Tester" + (Index * 2 + index_i).ToString(), "TestCount_Nomal", TestCount_Nomal[index_i].ToString());
                    Inifile.INIWriteValue(iniTesterResutPath, "Tester" + (Index * 2 + index_i).ToString(), "Yield_Nomal", Yield_Nomal[index_i].ToString());
                }
            }
            catch
            {
            }
        }