private void KintaiData() { // 自らのロックファイルを削除する Utility.deleteLockFile(Properties.Settings.Default.DataPath, Properties.Settings.Default.lockFileName); //他のPCで処理中の場合、続行不可 if (Utility.existsLockFile(Properties.Settings.Default.DataPath)) { MessageBox.Show("他のPCで処理中です。しばらくおまちください。", "確認", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } // タイマー監視受信した出勤簿件数 int s = System.IO.Directory.GetFiles(Properties.Settings.Default.DataPath, "*.tif").Count(); // 処理可能なデータが存在するか? // OCR認識データ bool _ocrFile = false; foreach (var dir in System.IO.Directory.GetDirectories(Properties.Settings.Default.DataPath)) { if (System.IO.Directory.GetFiles(dir, "*.csv").Any()) { _ocrFile = true; break; } } // リカバリ処理データが存在するか?:2020/06/16 bool _NgRec = false; if (System.IO.Directory.GetFiles(Properties.Settings.Default.MyDataPath, "*.csv").Any()) { _NgRec = true; } // ローカルデータベース:リカバリ処理データを条件に追加 2020/06/16 //if (!_ocrFile && tblFax.Count() == 0 && tblHold.Count() == 0) if (!_ocrFile && tblFax.Count() == 0 && tblHold.Count() == 0 && !_NgRec) { MessageBox.Show("現在、処理可能なFAX発注書データはありません", "確認", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } //LOCKファイル作成 Utility.makeLockFile(Properties.Settings.Default.DataPath, Properties.Settings.Default.lockFileName); this.Hide(); // 処理するデータを取得 frmFaxSelect frmFax = new frmFaxSelect(); frmFax.ShowDialog(); int _myCnt = frmFax.myCnt; bool _myBool = frmFax.myBool; frmFax.Dispose(); // ロックファイルを削除する Utility.deleteLockFile(Properties.Settings.Default.DataPath, Properties.Settings.Default.lockFileName); if (!_myBool) { Show(); } else { // データ作成処理へ frmCorrect frm = new frmCorrect(string.Empty); frm.ShowDialog(); Show(); } }
private void button4_Click(object sender, EventArgs e) { NHBR_CLIDataSet dtsC = new NHBR_CLIDataSet(); NHBR_CLIDataSetTableAdapters.FAX注文書TableAdapter adp = new NHBR_CLIDataSetTableAdapters.FAX注文書TableAdapter(); NHBR_CLIDataSetTableAdapters.保留注文書TableAdapter hAdp = new NHBR_CLIDataSetTableAdapters.保留注文書TableAdapter(); // データ読み込み adp.Fill(dtsC.FAX注文書); hAdp.Fill(dtsC.保留注文書); // 自らのロックファイルを削除する Utility.deleteLockFile(Properties.Settings.Default.dataPath, Properties.Settings.Default.lockFileName); //他のPCで処理中の場合、続行不可 if (Utility.existsLockFile(Properties.Settings.Default.dataPath)) { MessageBox.Show("他のPCで処理中です。しばらくおまちください。", "確認", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } // タイマー監視受信したFAX発注書件数 int s = System.IO.Directory.GetFiles(Properties.Settings.Default.dataPath, "*.tif").Count(); // 処理中の注文書データ int d = dtsC.FAX注文書.Count(); // 保留中データ int h = dtsC.保留注文書.Count(); // 処理可能なデータが存在するか? if (s == 0 && d == 0 && h == 0) { MessageBox.Show("現在、処理可能なFAX注文書データはありません", "確認", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } //LOCKファイル作成 Utility.makeLockFile(Properties.Settings.Default.dataPath, Properties.Settings.Default.lockFileName); this.Hide(); // 担当者コードを入力 frmUserCode frmCode = new frmUserCode(); frmCode.ShowDialog(); string _myCode = frmCode.myCode; frmCode.Dispose(); if (_myCode == string.Empty) { // ロックファイルを削除する Utility.deleteLockFile(Properties.Settings.Default.dataPath, Properties.Settings.Default.lockFileName); // 処理をキャンセル Show(); } else { // 処理するデータを取得 frmFaxSelect frmFax = new frmFaxSelect(); frmFax.ShowDialog(); int _myCnt = frmFax.myCnt; bool _myBool = frmFax.myBool; frmFax.Dispose(); // ロックファイルを削除する Utility.deleteLockFile(Properties.Settings.Default.dataPath, Properties.Settings.Default.lockFileName); if (!_myBool) { Show(); } else { // データ作成処理へ frmCorrect frm = new frmCorrect(_myCode.ToString()); frm.ShowDialog(); } } Show(); }