Showing
3 changed files
with
521 additions
and
23 deletions
| @@ -67,6 +67,25 @@ | @@ -67,6 +67,25 @@ | ||
| 67 | this.label3 = new System.Windows.Forms.Label(); | 67 | this.label3 = new System.Windows.Forms.Label(); |
| 68 | this.label19 = new System.Windows.Forms.Label(); | 68 | this.label19 = new System.Windows.Forms.Label(); |
| 69 | this.label20 = new System.Windows.Forms.Label(); | 69 | this.label20 = new System.Windows.Forms.Label(); |
| 70 | + this.button5 = new System.Windows.Forms.Button(); | ||
| 71 | + this.button6 = new System.Windows.Forms.Button(); | ||
| 72 | + this.panel1 = new System.Windows.Forms.Panel(); | ||
| 73 | + this.textBox30 = new System.Windows.Forms.TextBox(); | ||
| 74 | + this.textBox29 = new System.Windows.Forms.TextBox(); | ||
| 75 | + this.textBox28 = new System.Windows.Forms.TextBox(); | ||
| 76 | + this.textBox27 = new System.Windows.Forms.TextBox(); | ||
| 77 | + this.textBox26 = new System.Windows.Forms.TextBox(); | ||
| 78 | + this.textBox25 = new System.Windows.Forms.TextBox(); | ||
| 79 | + this.textBox24 = new System.Windows.Forms.TextBox(); | ||
| 80 | + this.textBox23 = new System.Windows.Forms.TextBox(); | ||
| 81 | + this.textBox22 = new System.Windows.Forms.TextBox(); | ||
| 82 | + this.textBox21 = new System.Windows.Forms.TextBox(); | ||
| 83 | + this.textBox20 = new System.Windows.Forms.TextBox(); | ||
| 84 | + this.textBox19 = new System.Windows.Forms.TextBox(); | ||
| 85 | + this.textBox18 = new System.Windows.Forms.TextBox(); | ||
| 86 | + this.textBox17 = new System.Windows.Forms.TextBox(); | ||
| 87 | + this.textBox3 = new System.Windows.Forms.TextBox(); | ||
| 88 | + this.panel1.SuspendLayout(); | ||
| 70 | this.SuspendLayout(); | 89 | this.SuspendLayout(); |
| 71 | // | 90 | // |
| 72 | // textBox1 | 91 | // textBox1 |
| @@ -392,7 +411,7 @@ | @@ -392,7 +411,7 @@ | ||
| 392 | // | 411 | // |
| 393 | // button1 | 412 | // button1 |
| 394 | // | 413 | // |
| 395 | - this.button1.Location = new System.Drawing.Point(183, 482); | 414 | + this.button1.Location = new System.Drawing.Point(231, 482); |
| 396 | this.button1.Name = "button1"; | 415 | this.button1.Name = "button1"; |
| 397 | this.button1.Size = new System.Drawing.Size(75, 23); | 416 | this.button1.Size = new System.Drawing.Size(75, 23); |
| 398 | this.button1.TabIndex = 34; | 417 | this.button1.TabIndex = 34; |
| @@ -402,7 +421,7 @@ | @@ -402,7 +421,7 @@ | ||
| 402 | // | 421 | // |
| 403 | // button2 | 422 | // button2 |
| 404 | // | 423 | // |
| 405 | - this.button2.Location = new System.Drawing.Point(269, 482); | 424 | + this.button2.Location = new System.Drawing.Point(315, 482); |
| 406 | this.button2.Name = "button2"; | 425 | this.button2.Name = "button2"; |
| 407 | this.button2.Size = new System.Drawing.Size(86, 23); | 426 | this.button2.Size = new System.Drawing.Size(86, 23); |
| 408 | this.button2.TabIndex = 35; | 427 | this.button2.TabIndex = 35; |
| @@ -416,6 +435,7 @@ | @@ -416,6 +435,7 @@ | ||
| 416 | this.button3.Name = "button3"; | 435 | this.button3.Name = "button3"; |
| 417 | this.button3.Size = new System.Drawing.Size(75, 23); | 436 | this.button3.Size = new System.Drawing.Size(75, 23); |
| 418 | this.button3.TabIndex = 36; | 437 | this.button3.TabIndex = 36; |
| 438 | + this.button3.TabStop = false; | ||
| 419 | this.button3.Text = "復元"; | 439 | this.button3.Text = "復元"; |
| 420 | this.button3.UseVisualStyleBackColor = true; | 440 | this.button3.UseVisualStyleBackColor = true; |
| 421 | this.button3.Click += new System.EventHandler(this.button3_Click); | 441 | this.button3.Click += new System.EventHandler(this.button3_Click); |
| @@ -426,6 +446,7 @@ | @@ -426,6 +446,7 @@ | ||
| 426 | this.button4.Name = "button4"; | 446 | this.button4.Name = "button4"; |
| 427 | this.button4.Size = new System.Drawing.Size(75, 23); | 447 | this.button4.Size = new System.Drawing.Size(75, 23); |
| 428 | this.button4.TabIndex = 37; | 448 | this.button4.TabIndex = 37; |
| 449 | + this.button4.TabStop = false; | ||
| 429 | this.button4.Text = "前の入力へ"; | 450 | this.button4.Text = "前の入力へ"; |
| 430 | this.button4.UseVisualStyleBackColor = true; | 451 | this.button4.UseVisualStyleBackColor = true; |
| 431 | this.button4.Click += new System.EventHandler(this.button4_Click); | 452 | this.button4.Click += new System.EventHandler(this.button4_Click); |
| @@ -442,7 +463,7 @@ | @@ -442,7 +463,7 @@ | ||
| 442 | // label19 | 463 | // label19 |
| 443 | // | 464 | // |
| 444 | this.label19.AutoSize = true; | 465 | this.label19.AutoSize = true; |
| 445 | - this.label19.Location = new System.Drawing.Point(258, 18); | 466 | + this.label19.Location = new System.Drawing.Point(209, 18); |
| 446 | this.label19.Name = "label19"; | 467 | this.label19.Name = "label19"; |
| 447 | this.label19.Size = new System.Drawing.Size(23, 12); | 468 | this.label19.Size = new System.Drawing.Size(23, 12); |
| 448 | this.label19.TabIndex = 39; | 469 | this.label19.TabIndex = 39; |
| @@ -457,11 +478,194 @@ | @@ -457,11 +478,194 @@ | ||
| 457 | this.label20.TabIndex = 40; | 478 | this.label20.TabIndex = 40; |
| 458 | this.label20.Text = "エラー表示"; | 479 | this.label20.Text = "エラー表示"; |
| 459 | // | 480 | // |
| 481 | + // button5 | ||
| 482 | + // | ||
| 483 | + this.button5.Location = new System.Drawing.Point(91, 482); | ||
| 484 | + this.button5.Name = "button5"; | ||
| 485 | + this.button5.Size = new System.Drawing.Size(75, 23); | ||
| 486 | + this.button5.TabIndex = 41; | ||
| 487 | + this.button5.TabStop = false; | ||
| 488 | + this.button5.Text = "削除"; | ||
| 489 | + this.button5.UseVisualStyleBackColor = true; | ||
| 490 | + this.button5.Click += new System.EventHandler(this.button5_Click); | ||
| 491 | + // | ||
| 492 | + // button6 | ||
| 493 | + // | ||
| 494 | + this.button6.Location = new System.Drawing.Point(317, 12); | ||
| 495 | + this.button6.Name = "button6"; | ||
| 496 | + this.button6.Size = new System.Drawing.Size(84, 23); | ||
| 497 | + this.button6.TabIndex = 42; | ||
| 498 | + this.button6.TabStop = false; | ||
| 499 | + this.button6.Text = "1回目の入力"; | ||
| 500 | + this.button6.UseVisualStyleBackColor = true; | ||
| 501 | + this.button6.Click += new System.EventHandler(this.button6_Click); | ||
| 502 | + // | ||
| 503 | + // panel1 | ||
| 504 | + // | ||
| 505 | + this.panel1.Controls.Add(this.textBox30); | ||
| 506 | + this.panel1.Controls.Add(this.textBox29); | ||
| 507 | + this.panel1.Controls.Add(this.textBox28); | ||
| 508 | + this.panel1.Controls.Add(this.textBox27); | ||
| 509 | + this.panel1.Controls.Add(this.textBox26); | ||
| 510 | + this.panel1.Controls.Add(this.textBox25); | ||
| 511 | + this.panel1.Controls.Add(this.textBox24); | ||
| 512 | + this.panel1.Controls.Add(this.textBox23); | ||
| 513 | + this.panel1.Controls.Add(this.textBox22); | ||
| 514 | + this.panel1.Controls.Add(this.textBox21); | ||
| 515 | + this.panel1.Controls.Add(this.textBox20); | ||
| 516 | + this.panel1.Controls.Add(this.textBox19); | ||
| 517 | + this.panel1.Controls.Add(this.textBox18); | ||
| 518 | + this.panel1.Controls.Add(this.textBox17); | ||
| 519 | + this.panel1.Controls.Add(this.textBox3); | ||
| 520 | + this.panel1.Location = new System.Drawing.Point(292, 59); | ||
| 521 | + this.panel1.Name = "panel1"; | ||
| 522 | + this.panel1.Size = new System.Drawing.Size(109, 417); | ||
| 523 | + this.panel1.TabIndex = 43; | ||
| 524 | + this.panel1.Visible = false; | ||
| 525 | + // | ||
| 526 | + // textBox30 | ||
| 527 | + // | ||
| 528 | + this.textBox30.Location = new System.Drawing.Point(3, 378); | ||
| 529 | + this.textBox30.Name = "textBox30"; | ||
| 530 | + this.textBox30.ReadOnly = true; | ||
| 531 | + this.textBox30.Size = new System.Drawing.Size(31, 19); | ||
| 532 | + this.textBox30.TabIndex = 14; | ||
| 533 | + this.textBox30.TabStop = false; | ||
| 534 | + // | ||
| 535 | + // textBox29 | ||
| 536 | + // | ||
| 537 | + this.textBox29.Location = new System.Drawing.Point(3, 351); | ||
| 538 | + this.textBox29.Name = "textBox29"; | ||
| 539 | + this.textBox29.ReadOnly = true; | ||
| 540 | + this.textBox29.Size = new System.Drawing.Size(31, 19); | ||
| 541 | + this.textBox29.TabIndex = 13; | ||
| 542 | + this.textBox29.TabStop = false; | ||
| 543 | + // | ||
| 544 | + // textBox28 | ||
| 545 | + // | ||
| 546 | + this.textBox28.Location = new System.Drawing.Point(3, 314); | ||
| 547 | + this.textBox28.Name = "textBox28"; | ||
| 548 | + this.textBox28.ReadOnly = true; | ||
| 549 | + this.textBox28.Size = new System.Drawing.Size(31, 19); | ||
| 550 | + this.textBox28.TabIndex = 12; | ||
| 551 | + this.textBox28.TabStop = false; | ||
| 552 | + // | ||
| 553 | + // textBox27 | ||
| 554 | + // | ||
| 555 | + this.textBox27.Location = new System.Drawing.Point(3, 289); | ||
| 556 | + this.textBox27.Name = "textBox27"; | ||
| 557 | + this.textBox27.ReadOnly = true; | ||
| 558 | + this.textBox27.Size = new System.Drawing.Size(31, 19); | ||
| 559 | + this.textBox27.TabIndex = 11; | ||
| 560 | + this.textBox27.TabStop = false; | ||
| 561 | + // | ||
| 562 | + // textBox26 | ||
| 563 | + // | ||
| 564 | + this.textBox26.Location = new System.Drawing.Point(3, 264); | ||
| 565 | + this.textBox26.Name = "textBox26"; | ||
| 566 | + this.textBox26.ReadOnly = true; | ||
| 567 | + this.textBox26.Size = new System.Drawing.Size(31, 19); | ||
| 568 | + this.textBox26.TabIndex = 10; | ||
| 569 | + this.textBox26.TabStop = false; | ||
| 570 | + // | ||
| 571 | + // textBox25 | ||
| 572 | + // | ||
| 573 | + this.textBox25.Location = new System.Drawing.Point(3, 239); | ||
| 574 | + this.textBox25.Name = "textBox25"; | ||
| 575 | + this.textBox25.ReadOnly = true; | ||
| 576 | + this.textBox25.Size = new System.Drawing.Size(31, 19); | ||
| 577 | + this.textBox25.TabIndex = 9; | ||
| 578 | + this.textBox25.TabStop = false; | ||
| 579 | + // | ||
| 580 | + // textBox24 | ||
| 581 | + // | ||
| 582 | + this.textBox24.Location = new System.Drawing.Point(3, 214); | ||
| 583 | + this.textBox24.Name = "textBox24"; | ||
| 584 | + this.textBox24.ReadOnly = true; | ||
| 585 | + this.textBox24.Size = new System.Drawing.Size(31, 19); | ||
| 586 | + this.textBox24.TabIndex = 8; | ||
| 587 | + this.textBox24.TabStop = false; | ||
| 588 | + // | ||
| 589 | + // textBox23 | ||
| 590 | + // | ||
| 591 | + this.textBox23.Location = new System.Drawing.Point(3, 189); | ||
| 592 | + this.textBox23.Name = "textBox23"; | ||
| 593 | + this.textBox23.ReadOnly = true; | ||
| 594 | + this.textBox23.Size = new System.Drawing.Size(31, 19); | ||
| 595 | + this.textBox23.TabIndex = 7; | ||
| 596 | + this.textBox23.TabStop = false; | ||
| 597 | + // | ||
| 598 | + // textBox22 | ||
| 599 | + // | ||
| 600 | + this.textBox22.Location = new System.Drawing.Point(3, 164); | ||
| 601 | + this.textBox22.Name = "textBox22"; | ||
| 602 | + this.textBox22.ReadOnly = true; | ||
| 603 | + this.textBox22.Size = new System.Drawing.Size(31, 19); | ||
| 604 | + this.textBox22.TabIndex = 6; | ||
| 605 | + this.textBox22.TabStop = false; | ||
| 606 | + // | ||
| 607 | + // textBox21 | ||
| 608 | + // | ||
| 609 | + this.textBox21.Location = new System.Drawing.Point(3, 139); | ||
| 610 | + this.textBox21.Name = "textBox21"; | ||
| 611 | + this.textBox21.ReadOnly = true; | ||
| 612 | + this.textBox21.Size = new System.Drawing.Size(31, 19); | ||
| 613 | + this.textBox21.TabIndex = 5; | ||
| 614 | + this.textBox21.TabStop = false; | ||
| 615 | + // | ||
| 616 | + // textBox20 | ||
| 617 | + // | ||
| 618 | + this.textBox20.Location = new System.Drawing.Point(3, 114); | ||
| 619 | + this.textBox20.Name = "textBox20"; | ||
| 620 | + this.textBox20.ReadOnly = true; | ||
| 621 | + this.textBox20.Size = new System.Drawing.Size(31, 19); | ||
| 622 | + this.textBox20.TabIndex = 4; | ||
| 623 | + this.textBox20.TabStop = false; | ||
| 624 | + // | ||
| 625 | + // textBox19 | ||
| 626 | + // | ||
| 627 | + this.textBox19.Location = new System.Drawing.Point(3, 81); | ||
| 628 | + this.textBox19.Name = "textBox19"; | ||
| 629 | + this.textBox19.ReadOnly = true; | ||
| 630 | + this.textBox19.Size = new System.Drawing.Size(100, 19); | ||
| 631 | + this.textBox19.TabIndex = 3; | ||
| 632 | + this.textBox19.TabStop = false; | ||
| 633 | + // | ||
| 634 | + // textBox18 | ||
| 635 | + // | ||
| 636 | + this.textBox18.Location = new System.Drawing.Point(3, 56); | ||
| 637 | + this.textBox18.Name = "textBox18"; | ||
| 638 | + this.textBox18.ReadOnly = true; | ||
| 639 | + this.textBox18.Size = new System.Drawing.Size(100, 19); | ||
| 640 | + this.textBox18.TabIndex = 2; | ||
| 641 | + this.textBox18.TabStop = false; | ||
| 642 | + // | ||
| 643 | + // textBox17 | ||
| 644 | + // | ||
| 645 | + this.textBox17.Location = new System.Drawing.Point(3, 31); | ||
| 646 | + this.textBox17.Name = "textBox17"; | ||
| 647 | + this.textBox17.ReadOnly = true; | ||
| 648 | + this.textBox17.Size = new System.Drawing.Size(100, 19); | ||
| 649 | + this.textBox17.TabIndex = 1; | ||
| 650 | + this.textBox17.TabStop = false; | ||
| 651 | + // | ||
| 652 | + // textBox3 | ||
| 653 | + // | ||
| 654 | + this.textBox3.Location = new System.Drawing.Point(3, 6); | ||
| 655 | + this.textBox3.Name = "textBox3"; | ||
| 656 | + this.textBox3.ReadOnly = true; | ||
| 657 | + this.textBox3.Size = new System.Drawing.Size(100, 19); | ||
| 658 | + this.textBox3.TabIndex = 0; | ||
| 659 | + this.textBox3.TabStop = false; | ||
| 660 | + // | ||
| 460 | // Form2 | 661 | // Form2 |
| 461 | // | 662 | // |
| 462 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); | 663 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); |
| 463 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | 664 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
| 464 | - this.ClientSize = new System.Drawing.Size(367, 517); | 665 | + this.ClientSize = new System.Drawing.Size(411, 517); |
| 666 | + this.Controls.Add(this.panel1); | ||
| 667 | + this.Controls.Add(this.button6); | ||
| 668 | + this.Controls.Add(this.button5); | ||
| 465 | this.Controls.Add(this.label20); | 669 | this.Controls.Add(this.label20); |
| 466 | this.Controls.Add(this.label19); | 670 | this.Controls.Add(this.label19); |
| 467 | this.Controls.Add(this.label3); | 671 | this.Controls.Add(this.label3); |
| @@ -505,6 +709,8 @@ | @@ -505,6 +709,8 @@ | ||
| 505 | this.Name = "Form2"; | 709 | this.Name = "Form2"; |
| 506 | this.Text = "Form2"; | 710 | this.Text = "Form2"; |
| 507 | this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form2_KeyDown); | 711 | this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form2_KeyDown); |
| 712 | + this.panel1.ResumeLayout(false); | ||
| 713 | + this.panel1.PerformLayout(); | ||
| 508 | this.ResumeLayout(false); | 714 | this.ResumeLayout(false); |
| 509 | this.PerformLayout(); | 715 | this.PerformLayout(); |
| 510 | 716 | ||
| @@ -551,5 +757,23 @@ | @@ -551,5 +757,23 @@ | ||
| 551 | private System.Windows.Forms.Label label3; | 757 | private System.Windows.Forms.Label label3; |
| 552 | private System.Windows.Forms.Label label19; | 758 | private System.Windows.Forms.Label label19; |
| 553 | private System.Windows.Forms.Label label20; | 759 | private System.Windows.Forms.Label label20; |
| 760 | + private System.Windows.Forms.Button button5; | ||
| 761 | + private System.Windows.Forms.Button button6; | ||
| 762 | + private System.Windows.Forms.Panel panel1; | ||
| 763 | + private System.Windows.Forms.TextBox textBox30; | ||
| 764 | + private System.Windows.Forms.TextBox textBox29; | ||
| 765 | + private System.Windows.Forms.TextBox textBox28; | ||
| 766 | + private System.Windows.Forms.TextBox textBox27; | ||
| 767 | + private System.Windows.Forms.TextBox textBox26; | ||
| 768 | + private System.Windows.Forms.TextBox textBox25; | ||
| 769 | + private System.Windows.Forms.TextBox textBox24; | ||
| 770 | + private System.Windows.Forms.TextBox textBox23; | ||
| 771 | + private System.Windows.Forms.TextBox textBox22; | ||
| 772 | + private System.Windows.Forms.TextBox textBox21; | ||
| 773 | + private System.Windows.Forms.TextBox textBox20; | ||
| 774 | + private System.Windows.Forms.TextBox textBox19; | ||
| 775 | + private System.Windows.Forms.TextBox textBox18; | ||
| 776 | + private System.Windows.Forms.TextBox textBox17; | ||
| 777 | + private System.Windows.Forms.TextBox textBox3; | ||
| 554 | } | 778 | } |
| 555 | } | 779 | } |
| @@ -33,6 +33,10 @@ namespace MedicalCheckInputTool | @@ -33,6 +33,10 @@ namespace MedicalCheckInputTool | ||
| 33 | 33 | ||
| 34 | label20.Text = ""; //エラーメッセージなし | 34 | label20.Text = ""; //エラーメッセージなし |
| 35 | 35 | ||
| 36 | + if("1回目".Equals(Global.times)) | ||
| 37 | + { | ||
| 38 | + button6.Enabled = false; | ||
| 39 | + } | ||
| 36 | dspCount(); | 40 | dspCount(); |
| 37 | } | 41 | } |
| 38 | 42 | ||
| @@ -693,6 +697,34 @@ namespace MedicalCheckInputTool | @@ -693,6 +697,34 @@ namespace MedicalCheckInputTool | ||
| 693 | return err; | 697 | return err; |
| 694 | } | 698 | } |
| 695 | 699 | ||
| 700 | + private bool deleteData(SaveData sv, string tableName, MySqlConnection conn) | ||
| 701 | + { | ||
| 702 | + bool err = false; | ||
| 703 | + | ||
| 704 | + string sql = "delete from `" + tableName + "` where `ロット番号` = @lotNo and `整理番号` = @serialNo"; | ||
| 705 | + | ||
| 706 | + // コマンドを作成 | ||
| 707 | + MySqlCommand cmd = new MySqlCommand(sql, conn); | ||
| 708 | + | ||
| 709 | + // パラメータ設定 | ||
| 710 | + cmd.Parameters.Add(new MySqlParameter("lotNo", sv.lotNo)); | ||
| 711 | + cmd.Parameters.Add(new MySqlParameter("serialNo", sv.serialNo)); | ||
| 712 | + | ||
| 713 | + try | ||
| 714 | + { | ||
| 715 | + // 実行 | ||
| 716 | + cmd.ExecuteNonQuery(); | ||
| 717 | + } | ||
| 718 | + catch (SqlException ex) | ||
| 719 | + { | ||
| 720 | + // 例外処理 | ||
| 721 | + MessageBox.Show("例外発生:" + ex.Message); | ||
| 722 | + return true; | ||
| 723 | + } | ||
| 724 | + | ||
| 725 | + return err; | ||
| 726 | + } | ||
| 727 | + | ||
| 696 | private void sendTabKey(TextBox textbox, int length) | 728 | private void sendTabKey(TextBox textbox, int length) |
| 697 | { | 729 | { |
| 698 | if (textbox.Text.Length == length) | 730 | if (textbox.Text.Length == length) |
| @@ -738,6 +770,8 @@ namespace MedicalCheckInputTool | @@ -738,6 +770,8 @@ namespace MedicalCheckInputTool | ||
| 738 | label20.Text = ""; | 770 | label20.Text = ""; |
| 739 | 771 | ||
| 740 | textBox1.Focus(); | 772 | textBox1.Focus(); |
| 773 | + | ||
| 774 | + panel1.Visible = false; | ||
| 741 | } | 775 | } |
| 742 | 776 | ||
| 743 | private void textBox1_TextChanged(object sender, EventArgs e) //整理番号 | 777 | private void textBox1_TextChanged(object sender, EventArgs e) //整理番号 |
| @@ -1014,12 +1048,18 @@ namespace MedicalCheckInputTool | @@ -1014,12 +1048,18 @@ namespace MedicalCheckInputTool | ||
| 1014 | private void button4_Click(object sender, EventArgs e) | 1048 | private void button4_Click(object sender, EventArgs e) |
| 1015 | { | 1049 | { |
| 1016 | string serialNo = historyGet(); | 1050 | string serialNo = historyGet(); |
| 1051 | + if("".Equals(serialNo)) | ||
| 1052 | + { | ||
| 1053 | + return; | ||
| 1054 | + } | ||
| 1017 | 1055 | ||
| 1018 | MySqlConnection conn; | 1056 | MySqlConnection conn; |
| 1019 | string connstr = System.Configuration.ConfigurationManager.AppSettings["Conn"]; | 1057 | string connstr = System.Configuration.ConfigurationManager.AppSettings["Conn"]; |
| 1020 | conn = new MySqlConnection(connstr); | 1058 | conn = new MySqlConnection(connstr); |
| 1021 | conn.Open(); | 1059 | conn.Open(); |
| 1022 | 1060 | ||
| 1061 | + clearForm(); //いったんクリア | ||
| 1062 | + textBox1.Text = serialNo; //整理番号だけ戻す | ||
| 1023 | selectData(Global.times, Global.lotNo, serialNo, conn); | 1063 | selectData(Global.times, Global.lotNo, serialNo, conn); |
| 1024 | 1064 | ||
| 1025 | conn.Close(); | 1065 | conn.Close(); |
| @@ -1174,5 +1214,120 @@ namespace MedicalCheckInputTool | @@ -1174,5 +1214,120 @@ namespace MedicalCheckInputTool | ||
| 1174 | } | 1214 | } |
| 1175 | } | 1215 | } |
| 1176 | 1216 | ||
| 1217 | + //削除 | ||
| 1218 | + private void button5_Click(object sender, EventArgs e) | ||
| 1219 | + { | ||
| 1220 | + if("".Equals(textBox1.Text)) | ||
| 1221 | + { | ||
| 1222 | + return; | ||
| 1223 | + } | ||
| 1224 | + | ||
| 1225 | + MySqlConnection conn; | ||
| 1226 | + string connstr = System.Configuration.ConfigurationManager.AppSettings["Conn"]; | ||
| 1227 | + conn = new MySqlConnection(connstr); | ||
| 1228 | + conn.Open(); | ||
| 1229 | + | ||
| 1230 | + SaveData sv1 = new SaveData(); | ||
| 1231 | + sv1.lotNo = int.Parse(Global.lotNo); | ||
| 1232 | + sv1.serialNo = textBox1.Text.PadLeft(10,'0'); | ||
| 1233 | + string tableName = Global.times; | ||
| 1234 | + deleteData(sv1, tableName, conn);//削除 | ||
| 1235 | + | ||
| 1236 | + sv1.done = ""; | ||
| 1237 | + tableName = "1回目".Equals(Global.times) ? "2回目" : "1回目"; | ||
| 1238 | + updateDoneFlag(sv1, tableName, conn);//別の回の完了フラグはおろす | ||
| 1239 | + | ||
| 1240 | + conn.Close(); | ||
| 1241 | + | ||
| 1242 | + clearForm(); | ||
| 1243 | + dspCount(); | ||
| 1244 | + } | ||
| 1245 | + | ||
| 1246 | + private bool selectDataOnce(string tableName, string lotNo, string serialNo, MySqlConnection conn) | ||
| 1247 | + { | ||
| 1248 | + bool err = false; | ||
| 1249 | + MySqlCommand cmd = new MySqlCommand("select * from `" + tableName + "` where `ロット番号` = @lotNo and `整理番号` = @serialNo", conn); | ||
| 1250 | + // パラメータ設定 | ||
| 1251 | + cmd.Parameters.Add(new MySqlParameter("lotNo", lotNo)); | ||
| 1252 | + cmd.Parameters.Add(new MySqlParameter("serialNo", serialNo)); | ||
| 1253 | + | ||
| 1254 | + try | ||
| 1255 | + { | ||
| 1256 | + MySqlDataReader reader = cmd.ExecuteReader(); | ||
| 1257 | + if (!reader.HasRows) | ||
| 1258 | + { | ||
| 1259 | + //無かった | ||
| 1260 | + reader.Close(); | ||
| 1261 | + | ||
| 1262 | + textBox3.Text = ""; | ||
| 1263 | + textBox17.Text = ""; | ||
| 1264 | + textBox18.Text = ""; | ||
| 1265 | + textBox19.Text = ""; | ||
| 1266 | + textBox20.Text = ""; | ||
| 1267 | + textBox21.Text = ""; | ||
| 1268 | + textBox22.Text = ""; | ||
| 1269 | + textBox23.Text = ""; | ||
| 1270 | + textBox24.Text = ""; | ||
| 1271 | + textBox25.Text = ""; | ||
| 1272 | + textBox26.Text = ""; | ||
| 1273 | + textBox27.Text = ""; | ||
| 1274 | + textBox28.Text = ""; | ||
| 1275 | + textBox29.Text = ""; | ||
| 1276 | + textBox30.Text = ""; | ||
| 1277 | + } | ||
| 1278 | + else | ||
| 1279 | + { | ||
| 1280 | + string[] row = new string[reader.FieldCount]; | ||
| 1281 | + while (reader.Read()) | ||
| 1282 | + { | ||
| 1283 | + textBox3.Text = isDBNull(reader, "整理番号"); | ||
| 1284 | + textBox17.Text = isDBNull(reader, "世帯番号"); | ||
| 1285 | + textBox18.Text = isDBNull(reader, "電話番号"); | ||
| 1286 | + textBox19.Text = isDBNull(reader, "携帯番号"); | ||
| 1287 | + textBox20.Text = isDBNull(reader, "健康診査"); | ||
| 1288 | + textBox21.Text = isDBNull(reader, "結核肺がん"); | ||
| 1289 | + textBox22.Text = isDBNull(reader, "胃がん"); | ||
| 1290 | + textBox23.Text = isDBNull(reader, "大腸がん"); | ||
| 1291 | + textBox24.Text = isDBNull(reader, "前立腺がん"); | ||
| 1292 | + textBox25.Text = isDBNull(reader, "骨粗鬆症"); | ||
| 1293 | + textBox26.Text = isDBNull(reader, "成人歯科"); | ||
| 1294 | + textBox27.Text = isDBNull(reader, "子宮頸がん"); | ||
| 1295 | + textBox28.Text = isDBNull(reader, "乳がん"); | ||
| 1296 | + textBox29.Text = isDBNull(reader, "希望場所"); | ||
| 1297 | + textBox30.Text = isDBNull(reader, "身体不自由"); | ||
| 1298 | + } | ||
| 1299 | + reader.Close(); | ||
| 1300 | + } | ||
| 1301 | + } | ||
| 1302 | + catch (SqlException ex) | ||
| 1303 | + { | ||
| 1304 | + } | ||
| 1305 | + | ||
| 1306 | + return err; | ||
| 1307 | + } | ||
| 1308 | + | ||
| 1309 | + //1回目の入力 | ||
| 1310 | + private void button6_Click(object sender, EventArgs e) | ||
| 1311 | + { | ||
| 1312 | + if("".Equals(textBox1.Text)) | ||
| 1313 | + { | ||
| 1314 | + return; | ||
| 1315 | + } | ||
| 1316 | + | ||
| 1317 | + MySqlConnection conn; | ||
| 1318 | + string connstr = System.Configuration.ConfigurationManager.AppSettings["Conn"]; | ||
| 1319 | + conn = new MySqlConnection(connstr); | ||
| 1320 | + conn.Open(); | ||
| 1321 | + | ||
| 1322 | + string serialNo = textBox1.Text.PadLeft(10, '0'); | ||
| 1323 | + selectDataOnce("1回目", Global.lotNo, serialNo, conn);//削除 | ||
| 1324 | + | ||
| 1325 | + panel1.Visible = true; | ||
| 1326 | + | ||
| 1327 | + conn.Close(); | ||
| 1328 | + | ||
| 1329 | + } | ||
| 1330 | + | ||
| 1331 | + | ||
| 1177 | } | 1332 | } |
| 1178 | } | 1333 | } |
| @@ -372,7 +372,7 @@ namespace MedicalCheckInputTool | @@ -372,7 +372,7 @@ namespace MedicalCheckInputTool | ||
| 372 | //出力 | 372 | //出力 |
| 373 | private void button5_Click(object sender, EventArgs e) | 373 | private void button5_Click(object sender, EventArgs e) |
| 374 | { | 374 | { |
| 375 | - //最初の画面で選択したロット番号と明細種別のデータをファイル出力する | 375 | + //最初の画面で選択したロット番号のデータをファイル出力する |
| 376 | string connstr = System.Configuration.ConfigurationManager.AppSettings["Conn"]; | 376 | string connstr = System.Configuration.ConfigurationManager.AppSettings["Conn"]; |
| 377 | MySqlConnection readerCon = new MySqlConnection(connstr); | 377 | MySqlConnection readerCon = new MySqlConnection(connstr); |
| 378 | readerCon.Open(); | 378 | readerCon.Open(); |
| @@ -402,6 +402,8 @@ namespace MedicalCheckInputTool | @@ -402,6 +402,8 @@ namespace MedicalCheckInputTool | ||
| 402 | reader.Close(); | 402 | reader.Close(); |
| 403 | 403 | ||
| 404 | } | 404 | } |
| 405 | + // 完了 | ||
| 406 | + MessageBox.Show("データを出力しました"); | ||
| 405 | } | 407 | } |
| 406 | catch (SqlException ex) | 408 | catch (SqlException ex) |
| 407 | { | 409 | { |
| @@ -434,18 +436,22 @@ namespace MedicalCheckInputTool | @@ -434,18 +436,22 @@ namespace MedicalCheckInputTool | ||
| 434 | return line; | 436 | return line; |
| 435 | } | 437 | } |
| 436 | 438 | ||
| 437 | - //集計 | ||
| 438 | - private void makeSummary() | 439 | + //行政区サマリ |
| 440 | + public class SummaryAdmin | ||
| 439 | { | 441 | { |
| 440 | - //最初の画面で選択したロット番号と明細種別のデータをファイル出力する | ||
| 441 | - string connstr = System.Configuration.ConfigurationManager.AppSettings["Conn"]; | ||
| 442 | - MySqlConnection readerCon = new MySqlConnection(connstr); | ||
| 443 | - readerCon.Open(); | 442 | + public string adminCode; |
| 443 | + public string adminName; | ||
| 444 | + public int count; | ||
| 445 | + } | ||
| 444 | 446 | ||
| 445 | - string readQuery = "select `行政区コード`,`行政区名称`,count(行政区コード) from `1回目` group by `行政区コード` order by `行政区コード`"; | 447 | + //行政区集計 |
| 448 | + private void makeSummaryAdmin(MySqlConnection readerCon) | ||
| 449 | + { | ||
| 450 | + string readQuery = "select `行政区コード`,`行政区名称`,count(行政区コード) from `1回目` where `ロット番号` = @lotNo group by `行政区コード` order by `行政区コード`"; | ||
| 446 | MySqlCommand readCmd = new MySqlCommand(readQuery, readerCon); | 451 | MySqlCommand readCmd = new MySqlCommand(readQuery, readerCon); |
| 452 | + readCmd.Parameters.AddWithValue("lotNo", EditParam.lotNo); | ||
| 447 | 453 | ||
| 448 | - string countQuery = "select count(`世帯番号`) from `1回目` where `行政区コード`= @adminCode group by `行政区コード`"; | 454 | + string countQuery = "select count(`世帯番号`) from `1回目` where `行政区コード`= @adminCode and `ロット番号` = @lotNo group by `行政区コード`"; |
| 449 | MySqlCommand countCmd = new MySqlCommand(countQuery, readerCon); | 455 | MySqlCommand countCmd = new MySqlCommand(countQuery, readerCon); |
| 450 | 456 | ||
| 451 | try | 457 | try |
| @@ -458,24 +464,36 @@ namespace MedicalCheckInputTool | @@ -458,24 +464,36 @@ namespace MedicalCheckInputTool | ||
| 458 | } | 464 | } |
| 459 | else | 465 | else |
| 460 | { | 466 | { |
| 461 | - StreamWriter writer = new StreamWriter("Summary.csv", false, System.Text.Encoding.GetEncoding("shift_jis")); //ファイルストリーム | 467 | + List<SummaryAdmin> adminList = new List<SummaryAdmin>(); |
| 462 | while (reader.Read()) | 468 | while (reader.Read()) |
| 463 | { | 469 | { |
| 464 | - string adminCode = this.isDBNull(reader, "行政区コード"); | ||
| 465 | - string adminName = this.isDBNull(reader, "行政区名称"); | ||
| 466 | - int count = reader.GetInt16(2); | 470 | + SummaryAdmin tmp = new SummaryAdmin(); |
| 471 | + tmp.adminCode = this.isDBNull(reader, "行政区コード"); | ||
| 472 | + tmp.adminName = this.isDBNull(reader, "行政区名称"); | ||
| 473 | + tmp.count = reader.GetInt16(2); | ||
| 474 | + adminList.Add(tmp); | ||
| 475 | + } | ||
| 476 | + reader.Close(); | ||
| 477 | + | ||
| 478 | + StreamWriter writer = new StreamWriter("SummaryAdmin.csv", false, System.Text.Encoding.GetEncoding("shift_jis")); //ファイルストリーム | ||
| 479 | + | ||
| 480 | + foreach (SummaryAdmin sa in adminList) | ||
| 481 | + { | ||
| 467 | countCmd.Parameters.Clear(); | 482 | countCmd.Parameters.Clear(); |
| 468 | - countCmd.Parameters.Add(new MySqlParameter("adminCode", adminCode)); | 483 | + countCmd.Parameters.AddWithValue("adminCode", sa.adminCode); |
| 484 | + countCmd.Parameters.AddWithValue("lotNo", EditParam.lotNo); | ||
| 469 | MySqlDataReader reader2 = countCmd.ExecuteReader(); | 485 | MySqlDataReader reader2 = countCmd.ExecuteReader(); |
| 470 | - int count2 = reader2.GetInt16(0); | 486 | + while (reader2.Read()) |
| 487 | + { | ||
| 488 | + int count2 = reader2.GetInt16(0); | ||
| 471 | 489 | ||
| 472 | - string line = adminCode+","+adminName+","+count+","+count2; | ||
| 473 | - writer.WriteLine(line); | 490 | + string line = sa.adminCode + "," + sa.adminName + "," + sa.count + "," + count2; |
| 491 | + writer.WriteLine(line); | ||
| 492 | + } | ||
| 474 | reader2.Close(); | 493 | reader2.Close(); |
| 475 | } | 494 | } |
| 476 | 495 | ||
| 477 | writer.Close(); | 496 | writer.Close(); |
| 478 | - reader.Close(); | ||
| 479 | 497 | ||
| 480 | } | 498 | } |
| 481 | } | 499 | } |
| @@ -487,9 +505,110 @@ namespace MedicalCheckInputTool | @@ -487,9 +505,110 @@ namespace MedicalCheckInputTool | ||
| 487 | 505 | ||
| 488 | } | 506 | } |
| 489 | 507 | ||
| 508 | + //保健区集計 | ||
| 509 | + private void makeSummaryHealthArea(MySqlConnection readerCon) | ||
| 510 | + { | ||
| 511 | + string getQuery = "select `保健区` from `1回目` where `ロット番号` = @lotNo group by `保健区`"; | ||
| 512 | + MySqlCommand getCmd = new MySqlCommand(getQuery, readerCon); | ||
| 513 | + getCmd.Parameters.AddWithValue("lotNo", EditParam.lotNo); | ||
| 514 | + | ||
| 515 | + string readQuery = "select `行政区コード`,`行政区名称`,count(行政区コード) from `1回目` where (`ロット番号` = @lotNo) and (`保健区` = @healthArea) group by `行政区コード` order by `行政区コード`"; | ||
| 516 | + MySqlCommand readCmd = new MySqlCommand(readQuery, readerCon); | ||
| 517 | + | ||
| 518 | + string countQuery = "select count(`世帯番号`) from `1回目` where (`行政区コード`= @adminCode) and (`ロット番号` = @lotNo) and (`保健区` = @healthArea) group by `行政区コード`"; | ||
| 519 | + MySqlCommand countCmd = new MySqlCommand(countQuery, readerCon); | ||
| 520 | + | ||
| 521 | + try | ||
| 522 | + { | ||
| 523 | + MySqlDataReader reader3 = getCmd.ExecuteReader(); | ||
| 524 | + List<string> healthAreaList = new List<string>(); | ||
| 525 | + if (!reader3.HasRows) | ||
| 526 | + { //無かった | ||
| 527 | + reader3.Close(); | ||
| 528 | + return; | ||
| 529 | + } | ||
| 530 | + else | ||
| 531 | + { | ||
| 532 | + while (reader3.Read()) | ||
| 533 | + { | ||
| 534 | + healthAreaList.Add(isDBNull(reader3, "保健区")); | ||
| 535 | + } | ||
| 536 | + reader3.Close(); | ||
| 537 | + } | ||
| 538 | + | ||
| 539 | + foreach (string ha in healthAreaList) | ||
| 540 | + { | ||
| 541 | + readCmd.Parameters.Clear(); | ||
| 542 | + readCmd.Parameters.AddWithValue("lotNo", EditParam.lotNo); | ||
| 543 | + readCmd.Parameters.AddWithValue("healthArea", ha); | ||
| 544 | + // 実行 | ||
| 545 | + MySqlDataReader reader = readCmd.ExecuteReader(); | ||
| 546 | + if (!reader.HasRows) | ||
| 547 | + { //無かった | ||
| 548 | + reader.Close(); | ||
| 549 | + } | ||
| 550 | + else | ||
| 551 | + { | ||
| 552 | + List<SummaryAdmin> adminList = new List<SummaryAdmin>(); | ||
| 553 | + while (reader.Read()) | ||
| 554 | + { | ||
| 555 | + SummaryAdmin tmp = new SummaryAdmin(); | ||
| 556 | + tmp.adminCode = this.isDBNull(reader, "行政区コード"); | ||
| 557 | + tmp.adminName = this.isDBNull(reader, "行政区名称"); | ||
| 558 | + tmp.count = reader.GetInt16(2); | ||
| 559 | + adminList.Add(tmp); | ||
| 560 | + } | ||
| 561 | + reader.Close(); | ||
| 562 | + | ||
| 563 | + StreamWriter writer = new StreamWriter("SummaryHealthArea_" + ha + ".csv", false, System.Text.Encoding.GetEncoding("shift_jis")); //ファイルストリーム | ||
| 564 | + | ||
| 565 | + foreach (SummaryAdmin sa in adminList) | ||
| 566 | + { | ||
| 567 | + countCmd.Parameters.Clear(); | ||
| 568 | + countCmd.Parameters.AddWithValue("adminCode", sa.adminCode); | ||
| 569 | + countCmd.Parameters.AddWithValue("lotNo", EditParam.lotNo); | ||
| 570 | + countCmd.Parameters.AddWithValue("healthArea", ha); | ||
| 571 | + MySqlDataReader reader2 = countCmd.ExecuteReader(); | ||
| 572 | + while (reader2.Read()) | ||
| 573 | + { | ||
| 574 | + int count2 = reader2.GetInt16(0); | ||
| 575 | + | ||
| 576 | + string line = sa.adminCode + "," + sa.adminName + "," + sa.count + "," + count2; | ||
| 577 | + writer.WriteLine(line); | ||
| 578 | + } | ||
| 579 | + reader2.Close(); | ||
| 580 | + } | ||
| 581 | + | ||
| 582 | + writer.Close(); | ||
| 583 | + | ||
| 584 | + } | ||
| 585 | + } | ||
| 586 | + } | ||
| 587 | + catch (SqlException ex) | ||
| 588 | + { | ||
| 589 | + // 例外処理 | ||
| 590 | + MessageBox.Show("例外発生:" + ex.Message); | ||
| 591 | + } | ||
| 592 | + | ||
| 593 | + } | ||
| 594 | + | ||
| 595 | + | ||
| 596 | + //集計 | ||
| 490 | private void button6_Click(object sender, EventArgs e) | 597 | private void button6_Click(object sender, EventArgs e) |
| 491 | { | 598 | { |
| 492 | - makeSummary(); | 599 | + string connstr = System.Configuration.ConfigurationManager.AppSettings["Conn"]; |
| 600 | + MySqlConnection readerCon = new MySqlConnection(connstr); | ||
| 601 | + readerCon.Open(); | ||
| 602 | + | ||
| 603 | + makeSummaryHealthArea(readerCon); | ||
| 604 | + | ||
| 605 | + makeSummaryAdmin(readerCon); | ||
| 606 | + | ||
| 607 | + readerCon.Close(); | ||
| 608 | + | ||
| 609 | + // 完了 | ||
| 610 | + MessageBox.Show("集計を出力しました"); | ||
| 611 | + | ||
| 493 | } | 612 | } |
| 494 | 613 | ||
| 495 | } | 614 | } |
Please
register
or
login
to post a comment