구매신청화면에서 콤보를 버튼으로 변경하고 db검색 validation 기능 추가, 품목 추가시 sid검색기능도 추가 함

This commit is contained in:
chi
2023-07-31 17:20:19 +09:00
parent 4a6bf3d0f0
commit d8ddd7cfa7
31 changed files with 2807 additions and 3170 deletions

View File

@@ -1,19 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using FCOMMON;
using System;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace FCM0000
{
public partial class fCode : FCOMMON.fBase
{
public fCode()
string defaultgubun = "";
string defafilter = "";
public fCode(string gubun = "",string filter="")
{
InitializeComponent();
this.defaultgubun = gubun;
this.defafilter = filter;
Properties.Settings.Default["gwcs"] = FCOMMON.info.CS;
this.dsMSSQL.Common.TableNewRow += Common_TableNewRow;
if (FCOMMON.info.Login.level >= 9) toolStripButton1.Visible = true;
@@ -35,6 +37,18 @@ namespace FCM0000
private void __Load(object sender, EventArgs e)
{
if(this.defaultgubun.isEmpty()==false)
{
commonDataGridView.AllowUserToAddRows = false;
commonDataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
btAddNew.Visible = false;
}
else
{
btCancle.Visible = false;
}
this.Show();
Application.DoEvents();
@@ -46,7 +60,32 @@ namespace FCM0000
toolStripButton1.Visible = FCOMMON.info.Login.no == "dev";
// this.TopMost=true;
// this.Activate();
cmbList_SelectedIndexChanged(null, null);
//자동선택해준다.
if (defaultgubun.isEmpty() == false)
{
RefreshCodeList();
var idx = -1;
for (int i = 0; i < this.cmbList.Items.Count; i++)
{
var itemname = $"[{i:00}]";
var item = cmbList.Items[i];
if (item.ToString().StartsWith($"[{defaultgubun}]"))
{
idx = i;
break;
}
}
if(idx > -1)
{
this.cmbList.SelectedIndex = idx;
this.cmbList.Enabled = false;
}
cmbList_SelectedIndexChanged(null, null);
}
else cmbList_SelectedIndexChanged(null, null);
}
void RefreshCodeList()
{
@@ -70,6 +109,7 @@ namespace FCM0000
try
{
this.ta.Fill(this.dsMSSQL.Common, grp, FCOMMON.info.Login.gcode);
this.bs.Filter = this.defafilter;
this.dsMSSQL.Common.AcceptChanges();
}
catch (Exception ex)
@@ -88,6 +128,7 @@ namespace FCM0000
{
cmbList_SelectedIndexChanged(null, null);
}
}
@@ -189,7 +230,7 @@ namespace FCM0000
if (cmbList.SelectedIndex <= 0)
{
if (FCOMMON.Util.MsgQ("없는 목록을 기본값에서 생성 할까요?") != DialogResult.Yes) return;
var sql = "insert into Common(gcode,grp,code,svalue,ivalue,fvalue,memo,wuid,wdate)" +
$" select '{gcode}',grp,code,svalue,ivalue,fvalue,memo,'{uid}',getdate() from Common where gcode = 'EET1P' and grp = '99'" +
$" and code not in (select code from Common where gcode = '{gcode}' and grp = '99')";
@@ -213,5 +254,45 @@ namespace FCM0000
}
}
private void commonDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void btAdd_Click(object sender, EventArgs e)
{
}
private void commonDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex < 0 || e.ColumnIndex < 0) return;
if (this.defaultgubun.isEmpty()) return;
this.Validate();
this.bs.EndEdit();
if (this.dsMSSQL.Common.GetChanges() != null)
{
Util.MsgE("변경된 내용이 있습니다. 저장 후 다시 시도하세요");
return;
}
var drv = bs.Current as DataRowView;
if (drv == null) return;
var dr = drv.Row as dsMSSQL.CommonRow;
SelectedTitle = dr.memo;
//선택된것으로 한다.
DialogResult = DialogResult.OK;
}
public string SelectedTitle { get; set; } = "";
private void toolStripButton2_Click_1(object sender, EventArgs e)
{
this.SelectedTitle = string.Empty;
this.DialogResult = DialogResult.OK;
}
}
}