292 lines
10 KiB
C#
292 lines
10 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.Windows.Forms;
|
|
|
|
namespace FLG0000.LogData
|
|
{
|
|
public partial class Add : Form
|
|
{
|
|
BindingSource bsManu;
|
|
BindingSource bsModel;
|
|
DSLog.LogDataRow dr;
|
|
public Boolean repeatAdd = false;
|
|
public Add(DSLog.LogDataRow dr_)
|
|
{
|
|
InitializeComponent();
|
|
bsManu = new BindingSource();
|
|
bsModel = new BindingSource();
|
|
this.dr = dr_;
|
|
this.KeyPreview = true;
|
|
this.StartPosition = FormStartPosition.CenterScreen;
|
|
this.KeyDown += (s1, e1) =>
|
|
{
|
|
if (e1.KeyCode == Keys.Escape) this.Close();
|
|
};
|
|
|
|
foreach (Control ctl in this.Controls)
|
|
{
|
|
if (ctl.GetType() == typeof(TextBox) || ctl.GetType() == typeof(ComboBox))
|
|
{
|
|
ctl.KeyDown += ctl_KeyDown;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void __Load(object sender, EventArgs e)
|
|
{
|
|
|
|
////장비제조
|
|
//var dt_dept = FCOMMON.DBM.getCodeTable("06");
|
|
//bsManu.DataSource = dt_dept;
|
|
//this.cbEQManu.DisplayMember = "Value";
|
|
//this.cbEQManu.ValueMember = "Value";
|
|
//this.cbEQManu.DataSource = bsManu;
|
|
|
|
dtPdate.Value = DateTime.Parse(dr.pdate);
|
|
tbLocation.Text = dr.location;
|
|
tbReason.Text = dr.reason;
|
|
tbResult.Text = dr.result;
|
|
tbRemark.Text = dr.remark;
|
|
|
|
this.Show();
|
|
Application.DoEvents();
|
|
textBox1.Focus();
|
|
|
|
}
|
|
|
|
void ctl_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
Control ctl = sender as Control;
|
|
string nm = ctl.Name.ToLower();
|
|
string search = ctl.Text.Trim();
|
|
|
|
Console.WriteLine("inner keydown " + nm + ":" + search);
|
|
|
|
switch (nm)
|
|
{
|
|
case "tblocation":
|
|
if (search == "")
|
|
Lov_Location(search, false);
|
|
else if (search.Contains("L")) //바코드입력
|
|
{
|
|
var grpdata = FCOMMON.DBM.getCodeBySvalue("19", search);
|
|
if(grpdata.title != null)
|
|
{
|
|
ctl.Text = grpdata.title;
|
|
SendKeys.Send("{TAB}");
|
|
}
|
|
else Lov_Location(search, false);
|
|
}
|
|
break;
|
|
case "tbreason":
|
|
if (search == "")
|
|
Lov_Reason(search, false);
|
|
else if (search.StartsWith("L")) //바코드입력
|
|
{
|
|
var grpdata = FCOMMON.DBM.getCodeBySvalue("19", search);
|
|
if (grpdata.title != null)
|
|
{
|
|
ctl.Text = grpdata.title;
|
|
SendKeys.Send("{TAB}");
|
|
}
|
|
else Lov_Reason(search, false);
|
|
}
|
|
break;
|
|
case "tbresult":
|
|
if (search.StartsWith("L"))
|
|
{
|
|
var grpdata = FCOMMON.DBM.getCodeBySvalue("19", search);
|
|
if (grpdata.title != null)
|
|
{
|
|
ctl.Text = grpdata.title;
|
|
btSave.Focus();
|
|
}
|
|
else Lov_Result(search, false);
|
|
}
|
|
else if (search != "")
|
|
Lov_Result(search, false);
|
|
break;
|
|
default:
|
|
SendKeys.Send("{TAB}");
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
private void linkLabel5_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
{
|
|
Lov_Location("", true);
|
|
}
|
|
|
|
void Lov_Location(string search, Boolean allowAll)
|
|
{
|
|
var f = new Lov_LogItem("00", "00");
|
|
if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
{
|
|
this.tbLocation.Text = string.Format("{0}|{1}", f.tbGrp.Text, f.tbItem.Text);
|
|
}
|
|
//if (search == "" && allowAll == false)
|
|
//{
|
|
// FCOMMON.Util.MsgE("품명은 필수 값 입니다");
|
|
// tbLocation.Focus();
|
|
// return;
|
|
//}
|
|
//else if (search.ToLower() != tbLocation.Tag.ToString().ToLower() || tbPumIDX.Text == "-1" || tbPumIDX.Text == "") //값이 바뀌엇다면 검색을 해준다.
|
|
//{
|
|
// var f = new FCM0000.fLovItem(search);
|
|
// if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
// {
|
|
// //인덱스값이 다르면 모델 및 가격을 업데이트 한다.
|
|
// tbLocation.Text = f.itemName;
|
|
// tbLocation.Tag = f.itemName;
|
|
|
|
// this.tbPumIDX.Text = f.item.ToString();
|
|
// this.tbPumModel.Text = f.itemmodel;
|
|
// this.tbPumPrice.Text = f.itemprice.ToString();
|
|
// this.tbSID.Text = f.SID;
|
|
// this.tbSID.Tag = f.SID;
|
|
// this.tbPumUnit.Text = f.itemUnit; //181214
|
|
|
|
// this.tbPumModel.Enabled = false;
|
|
// this.tbPumUnit.Enabled = false;
|
|
// if (tbSID.Text != "") tbSID.Enabled = false;
|
|
// else tbSID.Enabled = true;
|
|
|
|
// //제품을 찾앗다면 suppy 등을 업데이트 해준다.
|
|
// var pcInfo = FCOMMON.DBM.getLastPurchaseInfo(f.item);
|
|
// if (pcInfo.idx != -1)
|
|
// {
|
|
// tbReason.Text = pcInfo.supply;
|
|
// tbSupplyIndex.Text = pcInfo.supplyidx.ToString();
|
|
// if (pcInfo.project != "" && tbResult.Text == "")
|
|
// tbResult.Text = pcInfo.project;
|
|
// }
|
|
// else
|
|
// {
|
|
// tbReason.Text = f.itemSupply;
|
|
// tbSupplyIndex.Text = f.itemSupplyidx.ToString();
|
|
// }
|
|
|
|
// //display image
|
|
// var image = FCOMMON.DBM.GetImageData("Items", "image", int.Parse(tbPumIDX.Text));
|
|
// var oimage = this.pictureBox1.Image;
|
|
// this.pictureBox1.Image = image;
|
|
// if (oimage != null) oimage.Dispose();
|
|
// }
|
|
//}
|
|
//this.tbPumQty.Focus();
|
|
}
|
|
void Lov_Reason(string search, Boolean allowAll)
|
|
{
|
|
var f = new Lov_LogItem("00", "01");
|
|
if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
{
|
|
this.tbReason.Text = string.Format("{0}|{1}", f.tbGrp.Text, f.tbItem.Text);
|
|
}
|
|
//if (search != "" || allowAll == true)
|
|
//{
|
|
// var f = new FCM0000.fLovProject(search);
|
|
// if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
// {
|
|
// this.tbResult.Text = f.Title;
|
|
// this.tbResult.Tag = f.Title;
|
|
// this.tbProjectIndex.Text = f.Index.ToString();
|
|
// btSave.Focus();
|
|
// }
|
|
// else
|
|
// {
|
|
// tbResult.SelectAll();
|
|
// tbResult.Focus();
|
|
// }
|
|
//}
|
|
//else this.btSave.Focus();
|
|
}
|
|
void Lov_Result(string search, Boolean allowAll)
|
|
{
|
|
var f = new Lov_LogItem("00", "02");
|
|
if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
{
|
|
this.tbResult.Text = string.Format("{0}|{1}", f.tbGrp.Text, f.tbItem.Text);
|
|
}
|
|
//if (search != "" || allowAll == true)
|
|
//{
|
|
// FCM0000.fLovSupply f = new FCM0000.fLovSupply(search);
|
|
// if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
// {
|
|
// tbReason.Text = f.Title;
|
|
// tbReason.Tag = f.Title;
|
|
// tbSupplyIndex.Text = f.Index.ToString();
|
|
// this.tbResult.Focus();
|
|
// }
|
|
// else
|
|
// {
|
|
// tbReason.Focus();
|
|
// tbReason.SelectAll();
|
|
// }
|
|
//}
|
|
//else tbResult.Focus();
|
|
}
|
|
private bool saveData()
|
|
{
|
|
this.Validate();
|
|
|
|
if (tbLocation.Text.isEmpty())
|
|
{
|
|
FCOMMON.Util.MsgE("위치정보가 없습니다.");
|
|
tbLocation.Focus();
|
|
return false;
|
|
}
|
|
|
|
if (tbReason.Text == "")
|
|
{
|
|
FCOMMON.Util.MsgE("원인을 입력하세요.");
|
|
tbReason.Focus();
|
|
return false;
|
|
}
|
|
//if (tbResult.Text == "")
|
|
//{
|
|
// FCOMMON.Util.MsgE("결과를 입력하세요.");
|
|
// tbResult.Focus();
|
|
// return false;
|
|
//}
|
|
|
|
dr.gcode = FCOMMON.info.Login.gcode;
|
|
dr.pdate = this.dtPdate.Value.ToShortDateString();
|
|
dr.location = tbLocation.Text.Trim();
|
|
dr.reason = tbReason.Text.Trim();
|
|
dr.result = tbResult.Text.Trim();
|
|
dr.remark = tbRemark.Text.Trim();
|
|
dr.EndEdit();
|
|
return true;
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
if (!saveData()) return;
|
|
DialogResult = System.Windows.Forms.DialogResult.OK;
|
|
}
|
|
|
|
|
|
private void linkLabel6_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
{
|
|
//lov 공급처
|
|
Lov_Reason("", true);
|
|
}
|
|
|
|
private void linkLabel7_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
{
|
|
//lov 프로젝트
|
|
Lov_Result("", true);
|
|
}
|
|
|
|
}
|
|
}
|