public static async Task <HttpResponseMessage> ParseBusinessCardContact( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequestMessage req, TraceWriter log) { log.Info("C# HTTP trigger function processed a request."); var ci = new ContactInfo(); try { // Get request body. Converted to ReadAsStringAync to avoid unicode conversion error. string data = await req.Content.ReadAsStringAsync(); //dynamic data = await req.Content.ReadAsAsync<object>(); OCRData ocr = JsonConvert.DeserializeObject <OCRData>(data.ToString()); Parallel.ForEach(ocr.Regions, (r) => { ci.Parse(r); }); } catch (Exception ex) { log.Info(ex.ToString()); return(req.CreateResponse(HttpStatusCode.BadRequest, "Unable to parse JSON")); } var results = new Results(ci.Parsers.Select(p => new { p.Name, p.Value }).ToDictionary(d => d.Name, d => d.Value), ci.UnKnown); string logOut1 = JsonConvert.SerializeObject(results); var logOut2 = JsonConvert.DeserializeObject(logOut1); log.Info("The Results are: " + results.ToString()); return(req.Content == null ? req.CreateResponse(HttpStatusCode.BadRequest, "Unable to parse JSON") : req.CreateResponse(HttpStatusCode.OK, JsonConvert.SerializeObject(results))); }
///---------------------------------------------------------------------------- /// <summary> /// CSVデータをMDBへインサートする</summary> ///---------------------------------------------------------------------------- private void GetCsvDataToMDB() { // CSVファイルがなければ終了 if (System.IO.Directory.GetFiles(Properties.Settings.Default.dataPath, "*.csv").Count() == 0) { return; } // オーナーフォームを無効にする this.Enabled = false; //プログレスバーを表示する frmPrg frmP = new frmPrg(); frmP.Owner = this; frmP.Show(); // OCRのCSVデータをMDBへ取り込む OCRData ocr = new OCRData(); ocr.CsvToMdb(Properties.Settings.Default.dataPath, frmP, dts); // いったんオーナーをアクティブにする this.Activate(); // 進行状況ダイアログを閉じる frmP.Close(); // オーナーのフォームを有効に戻す this.Enabled = true; }
///------------------------------------------------------------------------------------ /// <summary> /// エラー表示 </summary> /// <param name="ocr"> /// OCRDATAクラス</param> ///------------------------------------------------------------------------------------ private void ErrShow(OCRData ocr) { if (ocr._errNumber != ocr.eNothing) { // グリッドビューCellEnterイベント処理は実行しない gridViewCellEnterStatus = false; lblErrMsg.Visible = true; lblErrMsg.Text = ocr._errMsg; // 確認チェック if (ocr._errNumber == ocr.eDataCheck) { chkKakunin.BackColor = Color.Yellow; chkKakunin.Focus(); } // 対象年月 if (ocr._errNumber == ocr.eYearMonth) { txtYear.BackColor = Color.Yellow; txtMonth.BackColor = Color.Yellow; txtYear.Focus(); } // 対象月 if (ocr._errNumber == ocr.eMonth) { txtMonth.BackColor = Color.Yellow; txtMonth.Focus(); } // 社員番号 if (ocr._errNumber == ocr.eShainNo) { txtCode.BackColor = Color.Yellow; txtCode.Focus(); } // 対象日 if (ocr._errNumber == ocr.eDay) { //txtDay.BackColor = Color.Yellow; //txtDay.Focus(); } // 残業申請書チェック if (ocr._errNumber == ocr.eCFlg) { dGV[cFlg, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cFlg, ocr._errRow]; } // 勤務体系コード if (ocr._errNumber == ocr.eKinmuTaikeiCode) { dGV[cKinmuTaikei, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cKinmuTaikei, ocr._errRow]; } // 開始時 if (ocr._errNumber == ocr.eSH) { dGV[cSH, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cSH, ocr._errRow]; } // 開始分 if (ocr._errNumber == ocr.eSM) { dGV[cSM, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cSM, ocr._errRow]; } // 終了時 if (ocr._errNumber == ocr.eEH) { dGV[cEH, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cEH, ocr._errRow]; } // 終了分 if (ocr._errNumber == ocr.eEM) { dGV[cEM, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cEM, ocr._errRow]; } // 休憩・時 if (ocr._errNumber == ocr.eRh) { dGV[cRH, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cRH, ocr._errRow]; } // 休憩・分 if (ocr._errNumber == ocr.eRm) { dGV[cRM, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cRM, ocr._errRow]; } // 実労・時 if (ocr._errNumber == ocr.eWh) { dGV[cWH, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cWH, ocr._errRow]; } // 実労・分 if (ocr._errNumber == ocr.eWm) { dGV[cWM, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cWM, ocr._errRow]; } // 事由1 if (ocr._errNumber == ocr.eJiyu1) { dGV[cJ1, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cJ1, ocr._errRow]; } // 事由2 if (ocr._errNumber == ocr.eJiyu2) { dGV[cJ2, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cJ2, ocr._errRow]; } // グリッドビューCellEnterイベントステータスを戻す gridViewCellEnterStatus = true; } }
///------------------------------------------------------------------------------------ /// <summary> /// エラー表示 </summary> /// <param name="ocr"> /// OCRDATAクラス</param> ///------------------------------------------------------------------------------------ private void ErrShow(OCRData ocr) { if (ocr._errNumber != ocr.eNothing) { // グリッドビューCellEnterイベント処理は実行しない gridViewCellEnterStatus = false; lblErrMsg.Visible = true; lblErrMsg.Text = ocr._errMsg; // 対象年月 if (ocr._errNumber == ocr.eYearMonth) { txtYear.BackColor = Color.Yellow; txtMonth.BackColor = Color.Yellow; txtYear.Focus(); } // 対象月 if (ocr._errNumber == ocr.eMonth) { txtMonth.BackColor = Color.Yellow; txtMonth.Focus(); } // 個人番号 if (ocr._errNumber == ocr.eShainNo) { txtNo.BackColor = Color.Yellow; txtNo.Focus(); } // 日 if (ocr._errNumber == ocr.eDay) { dGV[cDay, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cDay, ocr._errRow]; } // 勤怠記号 if (ocr._errNumber == ocr.eKintaiKigou) { dGV[cKintai1, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cKintai1, ocr._errRow]; } // 開始時 if (ocr._errNumber == ocr.eSH) { dGV[cSH, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cSH, ocr._errRow]; } // 開始分 if (ocr._errNumber == ocr.eSM) { dGV[cSM, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cSM, ocr._errRow]; } // 終了時 if (ocr._errNumber == ocr.eEH) { dGV[cEH, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cEH, ocr._errRow]; } // 終了分 if (ocr._errNumber == ocr.eEM) { dGV[cEM, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cEM, ocr._errRow]; } // 休憩開始時 if (ocr._errNumber == ocr.eKSH) { dGV[cKSH, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cKSH, ocr._errRow]; } // 休憩開始分 if (ocr._errNumber == ocr.eKSM) { dGV[cKSM, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cKSM, ocr._errRow]; } // 休憩終了時 if (ocr._errNumber == ocr.eKEH) { dGV[cKEH, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cKEH, ocr._errRow]; } // 休憩終了分 if (ocr._errNumber == ocr.eKEM) { dGV[cKEM, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cKEM, ocr._errRow]; } // 実労働時間・時 if (ocr._errNumber == ocr.eWH) { dGV[cWH, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cWH, ocr._errRow]; } // 実労働時間・分 if (ocr._errNumber == ocr.eWM) { dGV[cWM, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cWM, ocr._errRow]; } // 事由1 if (ocr._errNumber == ocr.eJiyu1) { dGV[cJiyu1, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cJiyu1, ocr._errRow]; } // 事由2 if (ocr._errNumber == ocr.eJiyu2) { dGV[cJiyu2, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cJiyu2, ocr._errRow]; } // グリッドビューCellEnterイベントステータスを戻す gridViewCellEnterStatus = true; } }
///------------------------------------------------------------------------------------ /// <summary> /// エラー表示 </summary> /// <param name="ocr"> /// OCRDATAクラス</param> ///------------------------------------------------------------------------------------ private void ErrShow(OCRData ocr) { if (ocr._errNumber != ocr.eNothing) { // グリッドビューCellEnterイベント処理は実行しない gridViewCellEnterStatus = false; lblErrMsg.Visible = true; lblErrMsg.Text = ocr._errMsg; // 対象年月 if (ocr._errNumber == ocr.eYearMonth) { txtYear.BackColor = Color.Yellow; txtMonth.BackColor = Color.Yellow; txtYear.Focus(); } // 対象月 if (ocr._errNumber == ocr.eMonth) { txtMonth.BackColor = Color.Yellow; txtMonth.Focus(); } // 個人番号 if (ocr._errNumber == ocr.eShainNo) { txtNo.BackColor = Color.Yellow; txtNo.Focus(); } // 日 if (ocr._errNumber == ocr.eDay) { dGV[cDay, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cDay, ocr._errRow]; } // 勤怠記号1 if (ocr._errNumber == ocr.eKintaiKigou1) { dGV[cKintai1, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cKintai1, ocr._errRow]; } // 勤怠記号2 if (ocr._errNumber == ocr.eKintaiKigou2) { dGV[cKintai2, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cKintai2, ocr._errRow]; } // 開始時 if (ocr._errNumber == ocr.eSH) { dGV[cSH, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cSH, ocr._errRow]; } // 開始分 if (ocr._errNumber == ocr.eSM) { dGV[cSM, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cSM, ocr._errRow]; } // 終了時 if (ocr._errNumber == ocr.eEH) { dGV[cEH, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cEH, ocr._errRow]; } // 終了分 if (ocr._errNumber == ocr.eEM) { dGV[cEM, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cEM, ocr._errRow]; } // 時間外・時 if (ocr._errNumber == ocr.eZH) { dGV[cZH, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cZH, ocr._errRow]; } // 時間外・分 if (ocr._errNumber == ocr.eZM) { dGV[cZM, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cZM, ocr._errRow]; } // 深夜・時 if (ocr._errNumber == ocr.eSIH) { dGV[cSIH, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cSIH, ocr._errRow]; } // 深夜・分 if (ocr._errNumber == ocr.eSIM) { dGV[cSIM, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cSIM, ocr._errRow]; } // 休日出勤・時 if (ocr._errNumber == ocr.eKSH) { dGV[cKSH, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cKSH, ocr._errRow]; } // 休日出勤・分 if (ocr._errNumber == ocr.eKSM) { dGV[cKSM, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cKSM, ocr._errRow]; } // 出勤形態 if (ocr._errNumber == ocr.eShukeitai) { dGV[cSKEITAI, ocr._errRow].Style.BackColor = Color.Yellow; dGV.Focus(); dGV.CurrentCell = dGV[cSKEITAI, ocr._errRow]; } // 普通残業合計 if (ocr._errNumber == ocr.eZanTL) { txtZangyoTL.BackColor = Color.Yellow; txtZangyoTL.Focus(); } // 深夜残業合計 if (ocr._errNumber == ocr.eShinyaTL) { txtShinyaTL.BackColor = Color.Yellow; txtShinyaTL.Focus(); } // 休日勤務合計 if (ocr._errNumber == ocr.eKyujitsuTL) { txtKyujitsuTL.BackColor = Color.Yellow; txtKyujitsuTL.Focus(); } // 遅刻時間合計 if (ocr._errNumber == ocr.eChikokuTL) { txtChikokuTL.BackColor = Color.Yellow; txtChikokuTL.Focus(); } // 早退時間合計 if (ocr._errNumber == ocr.eSoutaiTL) { txtSoutaiTL.BackColor = Color.Yellow; txtSoutaiTL.Focus(); } // 出勤日数 if (ocr._errNumber == ocr.eShukkin) { txtShukkin.BackColor = Color.Yellow; txtShukkin.Focus(); } // 有給日数 if (ocr._errNumber == ocr.eYukyu) { txtYukyu.BackColor = Color.Yellow; txtYukyu.Focus(); } // 特別休暇 if (ocr._errNumber == ocr.eTokukyu) { txtTokukyu.BackColor = Color.Yellow; txtTokukyu.Focus(); } // 欠勤日数 if (ocr._errNumber == ocr.eKekkin) { txtKekkin.BackColor = Color.Yellow; txtKekkin.Focus(); } // 生理分娩 if (ocr._errNumber == ocr.eSeiri) { txtSeiri.BackColor = Color.Yellow; txtSeiri.Focus(); } // 時差出勤(静岡2直) if (ocr._errNumber == ocr.eJisa) { txtJisa.BackColor = Color.Yellow; txtJisa.Focus(); } // 保安回数・平日 if (ocr._errNumber == ocr.eHoanH) { txtHoanH.BackColor = Color.Yellow; txtHoanH.Focus(); } // 保安回数・休日 if (ocr._errNumber == ocr.eHoanK) { txtHoanK.BackColor = Color.Yellow; txtHoanK.Focus(); } // 宿日直回数・平日 if (ocr._errNumber == ocr.eShukuH) { txtShukuH.BackColor = Color.Yellow; txtShukuH.Focus(); } // 宿日直回数・休日 if (ocr._errNumber == ocr.eShukuK) { txtShukuK.BackColor = Color.Yellow; txtShukuK.Focus(); } // 大阪・1L勤回数 if (ocr._errNumber == ocr.e1Lkin) { txt1L.BackColor = Color.Yellow; txt1L.Focus(); } // 大阪・2勤回数 if (ocr._errNumber == ocr.e2kin) { txt2Kin.BackColor = Color.Yellow; txt2Kin.Focus(); } // 大阪・丸3勤回数 if (ocr._errNumber == ocr.eMaru3kin) { txtMaru3Kin.BackColor = Color.Yellow; txtMaru3Kin.Focus(); } // 大阪・3勤回数 if (ocr._errNumber == ocr.e3kin) { txt3Kin.BackColor = Color.Yellow; txt3Kin.Focus(); } // 大阪・日祝日勤務回数 if (ocr._errNumber == ocr.eShukujitsu) { txtshukujitsu.BackColor = Color.Yellow; txtshukujitsu.Focus(); } // 控除日数 if (ocr._errNumber == ocr.eKoujo) { txtKoujyoNissu.BackColor = Color.Yellow; txtKoujyoNissu.Focus(); } // グリッドビューCellEnterイベントステータスを戻す gridViewCellEnterStatus = true; } }
///------------------------------------------------------------------------------------ /// <summary> /// データを画面に表示します </summary> /// <param name="iX"> /// ヘッダデータインデックス</param> ///------------------------------------------------------------------------------------ private void showOcrData(int iX) { // 勤務票ヘッダテーブル行を取得 //MTYSDataSet.勤務票ヘッダRow r = (MTYSDataSet.勤務票ヘッダRow)dts.勤務票ヘッダ.Rows[iX]; // 2015/10/30 MTYSDataSet.勤務票ヘッダRow r = (MTYSDataSet.勤務票ヘッダRow)dts.勤務票ヘッダ.Single(a => a.ID == sKey[iX]); // フォーム初期化 formInitialize(dID, iX); // ヘッダ情報表示 txtYear.Text = Utility.EmptytoZero(r.年.ToString()); txtMonth.Text = Utility.EmptytoZero(r.月.ToString()); global.ChangeValueStatus = false; // チェンジバリューステータス txtNo.Text = string.Empty; global.ChangeValueStatus = true; // チェンジバリューステータス txtNo.Text = Utility.EmptytoZero(r.人番号.ToString()); // 社員番号 // 時間合計欄 txtZangyoTL.Text = r.残業時.ToString() + ":" + r.残業分.ToString().PadLeft(2, '0'); txtShinyaTL.Text = r.深夜時.ToString() + ":" + r.深夜分.ToString().PadLeft(2, '0'); txtKyujitsuTL.Text = r.休日勤務時.ToString() + ":" + r.休日勤務分.ToString().PadLeft(2, '0'); txtChikokuTL.Text = r.遅刻時間時.ToString() + ":" + r.遅刻時間分.ToString().PadLeft(2, '0'); txtSoutaiTL.Text = r.早退時間時.ToString() + ":" + r.早退時間分.ToString().PadLeft(2, '0'); // 日数合計欄 txtShukkin.Text = r.出勤日数合計.ToString() + "." + r.出勤日数2.ToString(); txtYukyu.Text = r.休日数合計.ToString() + "." + r.休日数2.ToString(); txtTokukyu.Text = r.特休日数合計.ToString(); txtKekkin.Text = r.勤日数合計.ToString(); txtSeiri.Text = r.生理分娩日数.ToString(); txtJisa.Text = r.時差出勤日数.ToString(); txtHoanH.Text = r.平日保安回数.ToString(); txtHoanK.Text = r.休日保安回数.ToString(); txtShukuH.Text = r.平日宿日直回数.ToString(); txtShukuK.Text = r.休日宿日直回数.ToString(); txt1L.Text = r._1L勤回数.ToString(); txt2Kin.Text = r._2勤回数.ToString(); txtMaru3Kin.Text = r.丸3勤回数.ToString(); txt3Kin.Text = r._3勤回数.ToString(); txtshukujitsu.Text = r.日祝日勤務回数.ToString(); txtKoujyoNissu.Text = r.控除日数.ToString(); // 帳票種別表示 global gl = new global(); label4.Text = r.帳票番号.ToString(); if (r.帳票番号 > 0 && r.帳票番号 <= gl.arrayChohyoID.Length) { label27.Text = gl.arrayChohyoID[r.帳票番号 - 1]; } // 日別勤怠表示 showItem(r.帳票番号.ToString(), r.ID, dGV, r.年.ToString(), r.月.ToString()); // エラー情報表示初期化 lblErrMsg.Visible = false; lblErrMsg.Text = string.Empty; // 画像表示 ShowImage(global.pblImagePath + r.画像名.ToString()); if (cSR != null) { OCRData ocr = new OCRData(); // 計算用出勤日数を取得 int days = ocr.getWorkDays(1, Utility.StrtoInt(txtYear.Text), Utility.StrtoInt(txtMonth.Text), r.帳票番号, cSR.大阪製造部勤務グループ); txtKeisanDays.Text = days.ToString(); // 印刷用出勤日数を取得 days = ocr.getWorkDays(0, Utility.StrtoInt(txtYear.Text), Utility.StrtoInt(txtMonth.Text), r.帳票番号, cSR.大阪製造部勤務グループ); lblNissu.Text = days.ToString(); } }
///------------------------------------------------------------------------------------ /// <summary> /// 勤怠明細表示 </summary> /// <param name="sID"> /// 帳票ID 1:本社, 2:静岡, 3:大阪製造部</param> /// <param name="hID"> /// ヘッダID</param> /// <param name="sYY"> /// 年</param> /// <param name="sMM"> /// 月</param> /// <param name="dGV"> /// データグリッドビューオブジェクト</param> ///------------------------------------------------------------------------------------ private void showItem(string sID, string hID, DataGridView dGV, string sYY, string sMM) { // 行数を設定して表示色を初期化 dGV.RowCount = global._MULTIGYO; for (int i = 0; i < global._MULTIGYO; i++) { dGV.Rows[i].DefaultCellStyle.BackColor = Color.FromName("Control"); dGV.Rows[i].ReadOnly = true; // 初期設定は編集不可とする } // 行インデックス初期化 int mRow = 0; // 日別勤務実績表示 var h = dts.勤務票明細.Where(a => a.ヘッダID == hID).OrderBy(a => a.ID); foreach (var t in h) { // 表示色を初期化 dGV.Rows[mRow].DefaultCellStyle.BackColor = Color.Empty; // 編集を可能とする dGV.Rows[mRow].ReadOnly = false; dGV[cDay, mRow].Value = t.日付; YoubiSet(mRow); global.ChangeValueStatus = false; // これ以下ChangeValueイベントを発生させない dGV[cKintai1, mRow].Value = t.勤怠記号1; dGV[cKintai2, mRow].Value = t.勤怠記号2; dGV[cSH, mRow].Value = t.開始時; dGV[cSM, mRow].Value = t.開始分; dGV[cEH, mRow].Value = t.終了時; dGV[cEM, mRow].Value = t.終了分; dGV[cZH, mRow].Value = t.時間外時; dGV[cZM, mRow].Value = t.時間外分; dGV[cKSH, mRow].Value = t.休日出勤時; dGV[cKSM, mRow].Value = t.休日出勤分; dGV[cSIH, mRow].Value = t.深夜時; dGV[cSIM, mRow].Value = t.深夜分; dGV[cSKEITAI, mRow].Value = t.出勤形態; dGV[cID, mRow].Value = t.ID.ToString(); // 明細ID global.ChangeValueStatus = true; // ChangeValueStatusをtrueに戻す //--------------------------------------------------------------------- // 休日表示 //--------------------------------------------------------------------- OCRData ocr = new OCRData(); string sDate = sYY + "/" + sMM + "/" + t.日付; DateTime eDate; bool cHoliday = false; // 存在する日付のとき休日か判断する if (DateTime.TryParse(sDate, out eDate)) { // 大阪製造部勤務グループ string oskg = string.Empty; // 帳票区分 string cKbn = sID; // 社員情報がnullのとき if (cSR != null) { cKbn = cSR.帳票区分.ToString(); oskg = cSR.大阪製造部勤務グループ; } cHoliday = ocr.getHolidayStatus(dts, eDate, cKbn, oskg); } // 休日のとき色表示する if (cHoliday) { dGV.Rows[mRow].DefaultCellStyle.BackColor = Color.MistyRose; } else { dGV.Rows[mRow].DefaultCellStyle.BackColor = Color.Empty; } //--------------------------------------------------------------------- // 警告チェック //--------------------------------------------------------------------- // 警告配列を初期化 for (int i = 0; i < ocr.warArray.Length; i++) { ocr.warArray[i] = global.flgOff; } // 警告表示色初期化 dGV[cKintai1, mRow].Style.BackColor = Color.Empty; dGV[cKintai2, mRow].Style.BackColor = Color.Empty; dGV[cSH, mRow].Style.BackColor = Color.Empty; dGV[cSE, mRow].Style.BackColor = Color.Empty; dGV[cSM, mRow].Style.BackColor = Color.Empty; dGV[cEH, mRow].Style.BackColor = Color.Empty; dGV[cEE, mRow].Style.BackColor = Color.Empty; dGV[cEM, mRow].Style.BackColor = Color.Empty; dGV[cZH, mRow].Style.BackColor = Color.Empty; dGV[cZE, mRow].Style.BackColor = Color.Empty; dGV[cZM, mRow].Style.BackColor = Color.Empty; dGV[cSIH, mRow].Style.BackColor = Color.Empty; dGV[cSIE, mRow].Style.BackColor = Color.Empty; dGV[cSIM, mRow].Style.BackColor = Color.Empty; dGV[cKSH, mRow].Style.BackColor = Color.Empty; dGV[cKSE, mRow].Style.BackColor = Color.Empty; dGV[cKSM, mRow].Style.BackColor = Color.Empty; dGV[cSKEITAI, mRow].Style.BackColor = Color.Empty; // 警告チェック実施 if (cSR != null) { if (!ocr.warnCheck(t, cSR, cHoliday, ocr.warArray)) { // 勤怠記号 if (ocr.warArray[ocr.wKintaiKigou] == global.flgOn) { dGV[cKintai1, mRow].Style.BackColor = Color.LightPink; dGV[cKintai2, mRow].Style.BackColor = Color.LightPink; } // 開始終了時刻 if (ocr.warArray[ocr.wSEHM] == global.flgOn) { dGV[cSH, mRow].Style.BackColor = Color.LightPink; dGV[cSE, mRow].Style.BackColor = Color.LightPink; dGV[cSM, mRow].Style.BackColor = Color.LightPink; dGV[cEH, mRow].Style.BackColor = Color.LightPink; dGV[cEE, mRow].Style.BackColor = Color.LightPink; dGV[cEM, mRow].Style.BackColor = Color.LightPink; } // 普通残業時価 if (ocr.warArray[ocr.wZHM] == global.flgOn) { dGV[cZH, mRow].Style.BackColor = Color.LightPink; dGV[cZE, mRow].Style.BackColor = Color.LightPink; dGV[cZM, mRow].Style.BackColor = Color.LightPink; } // 深夜残業時間 if (ocr.warArray[ocr.wSIHM] == global.flgOn) { dGV[cSIH, mRow].Style.BackColor = Color.LightPink; dGV[cSIE, mRow].Style.BackColor = Color.LightPink; dGV[cSIM, mRow].Style.BackColor = Color.LightPink; } // 休日勤務時間 if (ocr.warArray[ocr.wKSHM] == global.flgOn) { dGV[cKSH, mRow].Style.BackColor = Color.LightPink; dGV[cKSE, mRow].Style.BackColor = Color.LightPink; dGV[cKSM, mRow].Style.BackColor = Color.LightPink; } // 出勤形態 if (ocr.warArray[ocr.wShukeitai] == global.flgOn) { dGV[cSKEITAI, mRow].Style.BackColor = Color.LightPink; } } } // 行インデックス加算 mRow++; } //カレントセル選択状態としない dGV.CurrentCell = null; }
///------------------------------------------------------------------------------------ /// <summary> /// エラー表示 </summary> /// <param name="ocr"> /// OCRDATAクラス</param> ///------------------------------------------------------------------------------------ private void ErrShow(OCRData ocr) { if (ocr._errNumber != ocr.eNothing) { // グリッドビューCellEnterイベント処理は実行しない gridViewCellEnterStatus = false; lblErrMsg.Visible = true; lblErrMsg.Text = ocr._errMsg; // 確認 if (ocr._errNumber == ocr.eDataCheck) { checkBox1.BackColor = Color.Yellow; checkBox1.Focus(); } // 年月 if (ocr._errNumber == ocr.eYearMonth) { txtYear.BackColor = Color.Yellow; txtYear.Focus(); // エラー有りフラグ txtErrStatus.Text = global.FLGON; } if (ocr._errNumber == ocr.eMonth) { txtMonth.BackColor = Color.Yellow; txtMonth.Focus(); // エラー有りフラグ txtErrStatus.Text = global.FLGON; } // 得意先コード if (ocr._errNumber == ocr.eTdkNo) { txtTokuisakiCD.BackColor = Color.Yellow; txtTokuisakiCD.Focus(); // エラー有りフラグ txtErrStatus.Text = global.FLGON; } // パターンID if (ocr._errNumber == ocr.ePattern) { txtPID.BackColor = Color.Yellow; txtPID.Focus(); // エラー有りフラグ txtErrStatus.Text = global.FLGON; } // 店着日付 if (ocr._errNumber == ocr.eTenDate1) { txtTenDay1.BackColor = Color.Yellow; txtTenDay1.Focus(); // エラー有りフラグ txtErrStatus.Text = global.FLGON; } if (ocr._errNumber == ocr.eTenDate2) { txtTenDay2.BackColor = Color.Yellow; txtTenDay2.Focus(); // エラー有りフラグ txtErrStatus.Text = global.FLGON; } if (ocr._errNumber == ocr.eTenDate3) { txtTenDay3.BackColor = Color.Yellow; txtTenDay3.Focus(); // エラー有りフラグ txtErrStatus.Text = global.FLGON; } if (ocr._errNumber == ocr.eTenDate4) { txtTenDay4.BackColor = Color.Yellow; txtTenDay4.Focus(); // エラー有りフラグ txtErrStatus.Text = global.FLGON; } if (ocr._errNumber == ocr.eTenDate5) { txtTenDay5.BackColor = Color.Yellow; txtTenDay5.Focus(); // エラー有りフラグ txtErrStatus.Text = global.FLGON; } if (ocr._errNumber == ocr.eTenDate6) { txtTenDay6.BackColor = Color.Yellow; txtTenDay6.Focus(); // エラー有りフラグ txtErrStatus.Text = global.FLGON; } if (ocr._errNumber == ocr.eTenDate7) { txtTenDay7.BackColor = Color.Yellow; txtTenDay7.Focus(); // エラー有りフラグ txtErrStatus.Text = global.FLGON; } // 商品コード if (ocr._errNumber == ocr.eHinCode) { dg1[colHinCode, ocr._errRow - 1].Style.BackColor = Color.Yellow; dg1[colHinCode, ocr._errRow].Style.BackColor = Color.Yellow; dg1.Focus(); dg1.CurrentCell = dg1[colHinCode, ocr._errRow]; // エラー有りフラグ txtErrStatus.Text = global.FLGON; } // 発注数 string col = ""; for (int i = 0; i < 7; i++) { if (ocr._errNumber == ocr.eSuu[i]) { switch (i) { case 0: col = colDay1; break; case 1: col = colDay2; break; case 2: col = colDay3; break; case 3: col = colDay4; break; case 4: col = colDay5; break; case 5: col = colDay6; break; case 6: col = colDay7; break; default: break; } dg1[col, ocr._errRow - 1].Style.BackColor = Color.Yellow; dg1[col, ocr._errRow].Style.BackColor = Color.Yellow; dg1.Focus(); dg1.CurrentCell = dg1[col, ocr._errRow]; // エラー有りフラグ txtErrStatus.Text = global.FLGON; break; } } // 終売コンボボックス if (ocr._errNumber == ocr.eShubai) { dg1[colSyubai, ocr._errRow - 1].Style.BackColor = Color.Yellow; dg1.Focus(); dg1.CurrentCell = dg1[colSyubai, ocr._errRow]; // エラー有りフラグ txtErrStatus.Text = global.FLGON; } // グリッドビューCellEnterイベントステータスを戻す gridViewCellEnterStatus = true; } }
///------------------------------------------------------------------------------------ /// <summary> /// 過去勤務表データを画面に表示します </summary> /// <param name="iX"> /// 個人番号</param> /// <param name="sYY"> /// 年</param> /// <param name="sMM"> /// 月</param> ///------------------------------------------------------------------------------------ private void showPastData(int iX, int sYY, int sMM) { // フォーム初期化 formInitialize(dID, iX); // 過去勤務票ヘッダテーブル行を取得 var s = dts.過去勤務票ヘッダ.Where(a => a.人番号 == iX && a.年 == sYY && a.月 == sMM); foreach (var r in s) { // 社員情報を取得します OCRData ocr = new OCRData(); ocr.errCheckShainCode(dts, r.人番号, out cSR); // ヘッダ情報表示 txtYear.Text = Utility.EmptytoZero(r.年.ToString()); txtMonth.Text = Utility.EmptytoZero(r.月.ToString()); global.ChangeValueStatus = false; // チェンジバリューステータス txtNo.Text = string.Empty; global.ChangeValueStatus = true; // チェンジバリューステータス txtNo.Text = Utility.EmptytoZero(r.人番号.ToString()); // 社員番号 lblName.Text = r.氏名; lblFuri.Text = r.フリガナ; lblSzCode.Text = r.所属コード; label1.Text = r.所属名; // 帳票種別表示 global gl = new global(); label4.Text = r.帳票番号.ToString(); if (r.帳票番号 > 0 && r.帳票番号 <= gl.arrayChohyoID.Length) { label27.Text = gl.arrayChohyoID[r.帳票番号 - 1]; } lblNissu.Text = r.出勤すべき日数.ToString(); // 時間合計欄 txtZangyoTL.Text = r.残業時.ToString() + ":" + r.残業分.ToString().PadLeft(2, '0'); txtShinyaTL.Text = r.深夜時.ToString() + ":" + r.深夜分.ToString().PadLeft(2, '0'); txtKyujitsuTL.Text = r.休日勤務時.ToString() + ":" + r.休日勤務分.ToString().PadLeft(2, '0'); txtChikokuTL.Text = r.遅刻時間時.ToString() + ":" + r.遅刻時間分.ToString().PadLeft(2, '0'); txtSoutaiTL.Text = r.早退時間時.ToString() + ":" + r.早退時間分.ToString().PadLeft(2, '0'); // 日数合計欄 txtKeisanDays.Text = r.計算用出勤日数.ToString(); txtShukkin.Text = r.出勤日数合計.ToString() + "." + r.出勤日数2.ToString(); txtYukyu.Text = r.休日数合計.ToString() + "." + r.休日数2.ToString(); txtTokukyu.Text = r.特休日数合計.ToString(); txtKekkin.Text = r.勤日数合計.ToString(); txtSeiri.Text = r.生理分娩日数.ToString(); txtJisa.Text = r.時差出勤日数.ToString(); txtHoanH.Text = r.平日保安回数.ToString(); txtHoanK.Text = r.休日保安回数.ToString(); txtShukuH.Text = r.平日宿日直回数.ToString(); txtShukuK.Text = r.休日宿日直回数.ToString(); txt1L.Text = r._1L勤回数.ToString(); txt2Kin.Text = r._2勤回数.ToString(); txtMaru3Kin.Text = r.丸3勤回数.ToString(); txt3Kin.Text = r._3勤回数.ToString(); txtshukujitsu.Text = r.日祝日勤務回数.ToString(); txtKoujyoNissu.Text = r.控除日数.ToString(); // 日別勤怠表示 showItem(r.帳票番号.ToString(), r.ID, dGV, r.年.ToString(), r.月.ToString()); // エラー情報表示初期化 lblErrMsg.Visible = false; lblErrMsg.Text = string.Empty; // 画像表示 ShowImage(global.pblImagePath + r.画像名.ToString()); } }
public async Task <Results> GetScanData() { string uploadPath = "~/ScanImage/"; var httpRequest = HttpContext.Current.Request; var filePath = string.Empty; foreach (string file in httpRequest.Files) { var postedFile = httpRequest.Files[file]; filePath = HttpContext.Current.Server.MapPath(uploadPath + postedFile.FileName); postedFile.SaveAs(filePath); // NOTE: To store in memory use postedFile.InputStream } var ci = new ContactInfo(); ImageInfoViewModel responeData = new ImageInfoViewModel(); string extractedResult = ""; var errors = new List <string>(); HttpResponseMessage response = await GetAzureVisionAPIResponse(filePath); // Get the JSON response. string result = await response.Content.ReadAsStringAsync(); //If it is success it will execute further process. if (response.IsSuccessStatusCode) { // The JSON response mapped into respective view model. responeData = JsonConvert.DeserializeObject <ImageInfoViewModel>(result, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Include, Error = delegate(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs earg) { errors.Add(earg.ErrorContext.Member.ToString()); earg.ErrorContext.Handled = true; } } ); var linesCount = responeData.regions[0].lines.Count; for (int i = 0; i < linesCount; i++) { var wordsCount = responeData.regions[0].lines[i].words.Count; for (int j = 0; j < wordsCount; j++) { //Appending all the lines content into one. extractedResult += responeData.regions[0].lines[i].words[j].text + " "; } extractedResult += Environment.NewLine; } //dynamic data = await req.Content.ReadAsAsync<object>(); OCRData ocr = JsonConvert.DeserializeObject <OCRData>(result.ToString()); Parallel.ForEach(ocr.Regions, (r) => { ci.Parse(r); }); } var results = new Results(ci.Parsers.Select(p => new { p.Name, p.Value }).ToDictionary(d => d.Name, d => d.Value), ci.UnKnown); return(results); }
///------------------------------------------------------------------------------------ /// <summary> /// エラー表示 </summary> /// <param name="ocr"> /// OCRDATAクラス</param> ///------------------------------------------------------------------------------------ private void ErrShow(OCRData ocr) { if (ocr._errNumber != ocr.eNothing) { // グリッドビューCellEnterイベント処理は実行しない gridViewCellEnterStatus = false; lblErrMsg.Visible = true; lblErrMsg.Text = ocr._errMsg; // 確認 if (ocr._errNumber == ocr.eDataCheck) { checkBox1.BackColor = Color.Yellow; checkBox1.Focus(); } // 届先番号 if (ocr._errNumber == ocr.eTdkNo) { gcMultiRow1[0, "txtTdkNum"].Style.BackColor = Color.Yellow; gcMultiRow1.Focus(); gcMultiRow1.CurrentCell = gcMultiRow1[0, "txtTdkNum"]; gcMultiRow1.BeginEdit(true); // エラー有りフラグ txtErrStatus.Text = global.FLGON; } // パターンID if (ocr._errNumber == ocr.ePattern) { gcMultiRow1[0, "txtPtnNum"].Style.BackColor = Color.Yellow; gcMultiRow1.Focus(); gcMultiRow1.CurrentCell = gcMultiRow1[0, "txtPtnNum"]; gcMultiRow1.BeginEdit(true); // エラー有りフラグ txtErrStatus.Text = global.FLGON; } // 納品希望日 if (ocr._errNumber == ocr.eMonth || ocr._errNumber == ocr.eDay) { gcMultiRow1[0, "txtMonth"].Style.BackColor = Color.Yellow; gcMultiRow1[0, "txtDay"].Style.BackColor = Color.Yellow; gcMultiRow1.Focus(); gcMultiRow1.CurrentCell = gcMultiRow1[0, "txtMonth"]; gcMultiRow1.BeginEdit(true); // エラー有りフラグ txtErrStatus.Text = global.FLGON; } // 再FAX:2018/08/03 if (ocr._errNumber == ocr.eReFax) { gcMultiRow1[0, "chkReFax"].Style.BackColor = Color.Yellow; gcMultiRow1.Focus(); gcMultiRow1.CurrentCell = gcMultiRow1[0, "chkReFax"]; gcMultiRow1.BeginEdit(true); // エラー有りフラグ txtErrStatus.Text = global.FLGON; } // 商品コード if (ocr._errNumber == ocr.eHinCode) { gcMultiRow2[ocr._errRow, "txtHinCode"].Style.BackColor = Color.Yellow; gcMultiRow2.Focus(); gcMultiRow2.CurrentCell = gcMultiRow2[ocr._errRow, "txtHinCode"]; gcMultiRow2.BeginEdit(true); // エラー有りフラグ txtErrStatus.Text = global.FLGON; } if (ocr._errNumber == ocr.eHinCode2) { gcMultiRow2[ocr._errRow, "txtHinCode2"].Style.BackColor = Color.Yellow; gcMultiRow2.Focus(); gcMultiRow2.CurrentCell = gcMultiRow2[ocr._errRow, "txtHinCode2"]; gcMultiRow2.BeginEdit(true); // エラー有りフラグ txtErrStatus.Text = global.FLGON; } // 発注数 if (ocr._errNumber == ocr.eSuu) { gcMultiRow2[ocr._errRow, "txtSuu"].Style.BackColor = Color.Yellow; gcMultiRow2.Focus(); gcMultiRow2.CurrentCell = gcMultiRow2[ocr._errRow, "txtSuu"]; gcMultiRow2.BeginEdit(true); // エラー有りフラグ txtErrStatus.Text = global.FLGON; } if (ocr._errNumber == ocr.eSuu2) { gcMultiRow2[ocr._errRow, "txtSuu2"].Style.BackColor = Color.Yellow; gcMultiRow2.Focus(); gcMultiRow2.CurrentCell = gcMultiRow2[ocr._errRow, "txtSuu2"]; gcMultiRow2.BeginEdit(true); // エラー有りフラグ txtErrStatus.Text = global.FLGON; } // 追加注文・商品コード if (ocr._errNumber == ocr.eAddCode) { gcMultiRow3[ocr._errRow, "txtHinCode"].Style.BackColor = Color.Yellow; gcMultiRow3.Focus(); gcMultiRow3.CurrentCell = gcMultiRow3[ocr._errRow, "txtHinCode"]; gcMultiRow3.BeginEdit(true); } if (ocr._errNumber == ocr.eAddCode2) { gcMultiRow3[ocr._errRow, "txtHinCode2"].Style.BackColor = Color.Yellow; gcMultiRow3.Focus(); gcMultiRow3.CurrentCell = gcMultiRow3[ocr._errRow, "txtHinCode2"]; gcMultiRow3.BeginEdit(true); } // 追加注文・発注数 if (ocr._errNumber == ocr.eAddSuu) { gcMultiRow3[ocr._errRow, "txtSuu"].Style.BackColor = Color.Yellow; gcMultiRow3.Focus(); gcMultiRow3.CurrentCell = gcMultiRow3[ocr._errRow, "txtSuu"]; gcMultiRow3.BeginEdit(true); } if (ocr._errNumber == ocr.eAddSuu2) { gcMultiRow3[ocr._errRow, "txtSuu2"].Style.BackColor = Color.Yellow; gcMultiRow3.Focus(); gcMultiRow3.CurrentCell = gcMultiRow3[ocr._errRow, "txtSuu2"]; gcMultiRow3.BeginEdit(true); } // グリッドビューCellEnterイベントステータスを戻す gridViewCellEnterStatus = true; } }
///------------------------------------------------------------------------------------ /// <summary> /// エラー表示 </summary> /// <param name="ocr"> /// OCRDATAクラス</param> ///------------------------------------------------------------------------------------ private void ErrShow(OCRData ocr) { if (ocr._errNumber != ocr.eNothing) { lblErrMsg.Visible = true; lblErrMsg.Text = ocr._errMsg; // 登録番号 if (ocr._errNumber == ocr.eTourokuNum) { txtTourokuNum.BackColor = Color.Yellow; txtTourokuNum.Focus(); } // 車体番号 if (ocr._errNumber == ocr.eShataiNum) { txtShataiNum.BackColor = Color.Yellow; txtShataiNum.Focus(); } // 対象年月 if (ocr._errNumber == ocr.eYearMonth) { txtYear.BackColor = Color.Yellow; txtMonth.BackColor = Color.Yellow; txtYear.Focus(); } // 対象月 if (ocr._errNumber == ocr.eMonth) { txtMonth.BackColor = Color.Yellow; txtMonth.Focus(); } // 対象日 if (ocr._errNumber == ocr.eDay) { txtDay.BackColor = Color.Yellow; txtDay.Focus(); } // 警察番号 if (ocr._errNumber == ocr.eKeisatsuNum) { txtKeisatsuNum.BackColor = Color.Yellow; txtKeisatsuNum.Focus(); } // 整理番号 if (ocr._errNumber == ocr.eSeiriNum) { txtSeiriNum.BackColor = Color.Yellow; txtSeiriNum.Focus(); } // メーカー if (ocr._errNumber == ocr.eMaker) { cmbMaker.Focus(); } // 塗色 if (ocr._errNumber == ocr.eColor) { cmbColor.Focus(); } // 車種 if (ocr._errNumber == ocr.eStyle) { cmbStyle.Focus(); } // 郵便番号 if (ocr._errNumber == ocr.eZip1) { txtZip1.BackColor = Color.Yellow; txtZip1.Focus(); } if (ocr._errNumber == ocr.eZip2) { txtZip2.BackColor = Color.Yellow; txtZip2.Focus(); } // 住所フリガナ if (ocr._errNumber == ocr.eAddFuri) { txtAddFuri.BackColor = Color.Yellow; txtAddFuri.Focus(); } // 住所 if (ocr._errNumber == ocr.eAdd) { txtAdd.BackColor = Color.Yellow; txtAdd.Focus(); } // フリガナ if (ocr._errNumber == ocr.eFuri) { txtFuri.BackColor = Color.Yellow; txtFuri.Focus(); } // 氏名 if (ocr._errNumber == ocr.eName) { txtName.BackColor = Color.Yellow; txtName.Focus(); } } }