94 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			94 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.ComponentModel;
 | |
| using System.Data;
 | |
| using System.Drawing;
 | |
| using System.Linq;
 | |
| using System.Text;
 | |
| using System.Threading.Tasks;
 | |
| using System.Windows.Forms;
 | |
| 
 | |
| namespace FCOMMON
 | |
| {
 | |
|     public partial class fSFI : Form
 | |
|     {
 | |
|         public fSFI(string sfi_type, float time, float cnt)
 | |
|         {
 | |
|             InitializeComponent();
 | |
|             if (sfi_type == "M")
 | |
|             {
 | |
|                 radM.Checked = true;
 | |
|                 nudMsavetime.Value = (decimal)time;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 radO.Checked = true;
 | |
|                 nudOsavetime.Value= (decimal)time;
 | |
|             }
 | |
|             nudMSaveCnt.Value = (decimal)cnt;
 | |
|             
 | |
|         }
 | |
| 
 | |
|         private void label1_Click(object sender, EventArgs e)
 | |
|         {
 | |
| 
 | |
|         }
 | |
| 
 | |
|         private void radioButton1_CheckedChanged(object sender, EventArgs e)
 | |
|         {
 | |
|             panel1.Enabled = radO.Checked;
 | |
|             panel2.Enabled = !panel1.Enabled;
 | |
|         }
 | |
| 
 | |
|         private void numericUpDown1_ValueChanged(object sender, EventArgs e)
 | |
|         {
 | |
|             //mfg 절감시간 업데이트
 | |
|             var nud = sender as NumericUpDown;
 | |
|             if (nud.Tag.ToString().ToLower() == "o")
 | |
|             {
 | |
|                 updateOFF();
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 updateMFG();
 | |
|             }
 | |
|         }
 | |
|         private void numericUpDown6_ValueChanged(object sender, EventArgs e)
 | |
|         {
 | |
|             var nud = sender as NumericUpDown;
 | |
|             //mfg의 총 절감 시간이 변경되었다
 | |
|             var 총절감시간 = (double)nud.Value;
 | |
|             var sfi = 총절감시간 / (int)numericUpDown5.Value;
 | |
|             numericUpDown4.Value = (Decimal)sfi;
 | |
|         }
 | |
|         public double Value { get; set; } = 0;
 | |
|         void updateMFG()
 | |
|         {
 | |
|             var 절감시간 = (double)nudMsavetime.Value;
 | |
|             var SHIFT수 = (int)nudMSaveCnt.Value;
 | |
|             var shift총수 = (double)(절감시간 * SHIFT수);
 | |
|             numericUpDown9.Value = (decimal)shift총수; //1쉬프트 개선절감횟수
 | |
|             var 쉬프트수 = (int)numericUpDown10.Value;
 | |
|             numericUpDown6.Value = (decimal)(shift총수 * 쉬프트수);
 | |
|         }
 | |
|         void updateOFF()
 | |
|         {
 | |
|             var savetime = (double)nudOsavetime.Value;
 | |
|             var min = (int)numericUpDown2.Value;
 | |
|             var sfi = savetime / min;
 | |
|             numericUpDown3.Value = (decimal)sfi;
 | |
|         }
 | |
| 
 | |
|         private void button1_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             this.Invalidate();
 | |
|             if (radO.Checked)
 | |
|                 this.Value = (double)numericUpDown3.Value;
 | |
|             else
 | |
|                 this.Value = (double)numericUpDown4.Value;
 | |
|             DialogResult = DialogResult.OK;
 | |
| 
 | |
|         }
 | |
|     }
 | |
| }
 | 
