Showing
2 changed files
with
45 additions
and
9 deletions
| ... | ... | @@ -396,7 +396,7 @@ |
| 396 | 396 | // label18 |
| 397 | 397 | // |
| 398 | 398 | this.label18.AutoSize = true; |
| 399 | - this.label18.Location = new System.Drawing.Point(82, 566); | |
| 399 | + this.label18.Location = new System.Drawing.Point(82, 563); | |
| 400 | 400 | this.label18.Name = "label18"; |
| 401 | 401 | this.label18.Size = new System.Drawing.Size(65, 12); |
| 402 | 402 | this.label18.TabIndex = 31; |
| ... | ... | @@ -416,7 +416,7 @@ |
| 416 | 416 | // textBox16 |
| 417 | 417 | // |
| 418 | 418 | this.textBox16.ImeMode = System.Windows.Forms.ImeMode.Off; |
| 419 | - this.textBox16.Location = new System.Drawing.Point(163, 563); | |
| 419 | + this.textBox16.Location = new System.Drawing.Point(163, 559); | |
| 420 | 420 | this.textBox16.MaxLength = 1; |
| 421 | 421 | this.textBox16.Name = "textBox16"; |
| 422 | 422 | this.textBox16.Size = new System.Drawing.Size(31, 19); |
| ... | ... | @@ -568,7 +568,7 @@ |
| 568 | 568 | // |
| 569 | 569 | // textBox36 |
| 570 | 570 | // |
| 571 | - this.textBox36.Location = new System.Drawing.Point(3, 365); | |
| 571 | + this.textBox36.Location = new System.Drawing.Point(3, 361); | |
| 572 | 572 | this.textBox36.MaxLength = 1; |
| 573 | 573 | this.textBox36.Name = "textBox36"; |
| 574 | 574 | this.textBox36.ReadOnly = true; |
| ... | ... | @@ -854,7 +854,7 @@ |
| 854 | 854 | // |
| 855 | 855 | this.label26.AutoSize = true; |
| 856 | 856 | this.label26.ForeColor = System.Drawing.SystemColors.ActiveBorder; |
| 857 | - this.label26.Location = new System.Drawing.Point(8, 548); | |
| 857 | + this.label26.Location = new System.Drawing.Point(8, 544); | |
| 858 | 858 | this.label26.Name = "label26"; |
| 859 | 859 | this.label26.Size = new System.Drawing.Size(269, 12); |
| 860 | 860 | this.label26.TabIndex = 52; | ... | ... |
| ... | ... | @@ -49,6 +49,7 @@ namespace MedicalCheckInputTool |
| 49 | 49 | conn = new MySqlConnection(connstr); |
| 50 | 50 | conn.Open(); |
| 51 | 51 | string code = serialNo.PadLeft(10, '0'); |
| 52 | + bool noData = false; | |
| 52 | 53 | |
| 53 | 54 | textBox1.Text = code; |
| 54 | 55 | MySqlCommand cmd = new MySqlCommand("select * from `" + Global.times + "` where `ロット番号` = @lotNo and `整理番号` = @serialNo", conn); |
| ... | ... | @@ -63,6 +64,7 @@ namespace MedicalCheckInputTool |
| 63 | 64 | { |
| 64 | 65 | //無かった |
| 65 | 66 | reader.Close(); |
| 67 | + noData = true; | |
| 66 | 68 | } |
| 67 | 69 | else |
| 68 | 70 | { |
| ... | ... | @@ -98,6 +100,33 @@ namespace MedicalCheckInputTool |
| 98 | 100 | } |
| 99 | 101 | reader.Close(); |
| 100 | 102 | } |
| 103 | + | |
| 104 | + if(noData) //修正からの遷移のときは新規かつ整理番号指定だけで来ることがあるので、その整理番号の行政区を別テーブルから調べる | |
| 105 | + { | |
| 106 | + string times = "1回目".Equals(Global.times) ? "2回目" : "1回目"; | |
| 107 | + MySqlCommand cmd2 = new MySqlCommand("select * from `" + times + "` where `ロット番号` = @lotNo and `整理番号` = @serialNo", conn); | |
| 108 | + // パラメータ設定 | |
| 109 | + cmd2.Parameters.Add(new MySqlParameter("lotNo", Global.lotNo)); | |
| 110 | + cmd2.Parameters.Add(new MySqlParameter("serialNo", serialNo)); | |
| 111 | + MySqlDataReader reader2 = cmd2.ExecuteReader(); | |
| 112 | + if (!reader2.HasRows) | |
| 113 | + { | |
| 114 | + //無かった | |
| 115 | + reader2.Close(); //このルートはありえない | |
| 116 | + } | |
| 117 | + else | |
| 118 | + { | |
| 119 | + string[] row = new string[reader2.FieldCount]; | |
| 120 | + while (reader2.Read()) | |
| 121 | + { | |
| 122 | + Global.adminCode = isDBNull(reader2, "行政区コード"); | |
| 123 | + Global.adminName = isDBNull(reader2, "行政区名称"); | |
| 124 | + Global.healthArea = isDBNull(reader2, "保健区"); | |
| 125 | + } | |
| 126 | + reader2.Close(); | |
| 127 | + } | |
| 128 | + | |
| 129 | + } | |
| 101 | 130 | } |
| 102 | 131 | catch (SqlException ) |
| 103 | 132 | { |
| ... | ... | @@ -1105,7 +1134,10 @@ namespace MedicalCheckInputTool |
| 1105 | 1134 | //入力可能(数字とハイフンとBS) |
| 1106 | 1135 | private void inputAllNumber(object sender, KeyPressEventArgs e) |
| 1107 | 1136 | { |
| 1108 | - if ((e.KeyChar < '0' || e.KeyChar > '9') && (e.KeyChar != '\b') && (e.KeyChar != '-')) | |
| 1137 | + if ((e.KeyChar < '0' || e.KeyChar > '9') && | |
| 1138 | + (e.KeyChar != '\b') && | |
| 1139 | + (e.KeyChar != '-') && | |
| 1140 | + ((int)(e.KeyChar) != 3) && ((int)(e.KeyChar) != 24) && ((int)(e.KeyChar) != 22)) //3:CtrlC、24:CtrlX、22:CtrlV | |
| 1109 | 1141 | { |
| 1110 | 1142 | e.Handled = true; |
| 1111 | 1143 | } |
| ... | ... | @@ -1527,14 +1559,14 @@ namespace MedicalCheckInputTool |
| 1527 | 1559 | } |
| 1528 | 1560 | |
| 1529 | 1561 | //1回目の修正 |
| 1530 | - private void updateDataOnce(MySqlConnection conn) | |
| 1562 | + private SaveData updateDataOnce(MySqlConnection conn) | |
| 1531 | 1563 | { |
| 1532 | 1564 | bool match = false; |
| 1533 | 1565 | //入力チェック |
| 1534 | 1566 | if ("".Equals(textBox3.Text)) //必須は整理番号のみ |
| 1535 | 1567 | { |
| 1536 | 1568 | MessageBox.Show("整理番号が入力されていません"); |
| 1537 | - return; | |
| 1569 | + return null; | |
| 1538 | 1570 | } |
| 1539 | 1571 | |
| 1540 | 1572 | SaveData sv = makeSaveDataOnce(); //保存用データ生成(パディング済み) |
| ... | ... | @@ -1568,6 +1600,7 @@ namespace MedicalCheckInputTool |
| 1568 | 1600 | string tableName = "2回目"; |
| 1569 | 1601 | updateDoneFlag(sv1, tableName, conn);//別の回の完了フラグも立てる |
| 1570 | 1602 | |
| 1603 | + return sv; | |
| 1571 | 1604 | } |
| 1572 | 1605 | |
| 1573 | 1606 | private SaveData makeSaveDataOnce() |
| ... | ... | @@ -1679,7 +1712,11 @@ namespace MedicalCheckInputTool |
| 1679 | 1712 | changeEdit(false); |
| 1680 | 1713 | button6.Text = "1回目の編集"; |
| 1681 | 1714 | //データ保存 |
| 1682 | - updateDataOnce(conn); | |
| 1715 | + SaveData sv = updateDataOnce(conn); | |
| 1716 | + if (sv != null) | |
| 1717 | + { | |
| 1718 | + selectDataOnce("1回目", sv.lotNo.ToString(), sv.serialNo, conn);//表示を今登録したデータにする | |
| 1719 | + } | |
| 1683 | 1720 | } |
| 1684 | 1721 | |
| 1685 | 1722 | panel1.Visible = true; |
| ... | ... | @@ -1839,6 +1876,5 @@ namespace MedicalCheckInputTool |
| 1839 | 1876 | } |
| 1840 | 1877 | |
| 1841 | 1878 | |
| 1842 | - | |
| 1843 | 1879 | } |
| 1844 | 1880 | } | ... | ... |
Please
register
or
login
to post a comment