(아직 업데이트 안함.)

=====* UniMarc [0.0130] 버전 업데이트 내용 *=====

** ERP 작업 전면 중단 (마크우선) **
*** 마크작성 - 칸채우기 버그 수정을 위해 테스트 계정 제외하고 잠금***

1. 퀵메뉴
ㄴ> ERP 작업 중단으로 인해 퀵메뉴 설정 잠금.

2. 마크 작성
ㄴ> 칸채우기에서 메모장으로 변환시 순서 변경되던 버그 수정.
ㄴ> 메모장에 없는 태그를 칸채우기에서 넣을경우 메모장에 적용되지않는 버그 발견. (수정중에 다른 작업 진행중)

3. 마크 정리
ㄴ> 인코딩값 설정하여 저장기능 추가. (ANSI, UTF-8, UniCode)
ㄴ> 반출 성공/실패 메시지박스 알림 추가.
ㄴ> 태그변경 버그 수정.
ㄴ> 체크창 적용되지 않는 버그 수정.
ㄴ> Grid의 푸른부분 수정시 마크에 반영되게 수정.

4. 마크 반출
ㄴ> 인코딩값 설정하여 저장기능 추가. (ANSI, UTF-8, UniCode)
This commit is contained in:
SeungHo Yang
2022-02-22 17:47:38 +09:00
parent 0909d5874f
commit 5ae4474bec
15 changed files with 266 additions and 101 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -36,6 +37,10 @@ namespace WindowsFormsApp1.Mac
string[] divNum = { "4", "5", "6" };
cb_divNum.Items.AddRange(divNum);
string[] Encoding = { "ANSI", "UTF-8", "UniCode" };
cb_EncodingType.Items.AddRange(Encoding);
cb_EncodingType.SelectedIndex = 0;
}
private void btn_Select_List_Click(object sender, EventArgs e)
@@ -45,6 +50,7 @@ namespace WindowsFormsApp1.Mac
Marc_Plan_Sub_SelectList sub = new Marc_Plan_Sub_SelectList(this);
sub.TopMost = true;
sub.Show();
dataGridView1.CellValueChanged += new DataGridViewCellEventHandler(dataGridView1_CellValueChanged);
}
private void Btn_Search_Click(object sender, EventArgs e)
@@ -232,6 +238,10 @@ namespace WindowsFormsApp1.Mac
{
string marc = dataGridView1.Rows[a].Cells["marc"].Value.ToString();
string changeTag = dataGridView1.Rows[a].Cells["search_tag"].Value.ToString();
if (changeTag == "")
continue;
if (dataGridView1.Rows[a].Cells["colCheck"].Value.ToString() == "T")
dataGridView1.Rows[a].Cells["marc"].Value = marc.Replace(BackUpTag[a], changeTag);
}
@@ -296,12 +306,16 @@ namespace WindowsFormsApp1.Mac
private void btn_Output_Click(object sender, EventArgs e)
{
string Marc_data = string.Empty;
for (int a = 0; a < dataGridView1.Rows.Count; a++)
{
if (dataGridView1.Rows[a].Cells["marc"].Value.ToString() == "" &&
dataGridView1.Rows[a].Cells["marc"].Value == null)
continue;
if (dataGridView1.Rows[a].Cells["colCheck"].Value.ToString() != "T")
continue;
Marc_data += dataGridView1.Rows[a].Cells["marc"].Value.ToString().Replace("₩", "\\");
}
@@ -310,12 +324,24 @@ namespace WindowsFormsApp1.Mac
saveFileDialog.Title = "저장 경로를 지정하세요.";
saveFileDialog.OverwritePrompt = true;
saveFileDialog.Filter = "마크 파일 (*.mrc)|*.mrc|모든 파일 (*.*)|*.*";
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
FileName = saveFileDialog.FileName;
System.IO.File.WriteAllText(FileName, Marc_data, Encoding.Default);
if (cb_EncodingType.SelectedIndex == 0) {
FileName = saveFileDialog.FileName;
File.WriteAllText(FileName, Marc_data, Encoding.Default);
}
else if (cb_EncodingType.SelectedIndex == 1) {
FileName = saveFileDialog.FileName;
File.WriteAllText(FileName, Marc_data, Encoding.UTF8);
}
else if (cb_EncodingType.SelectedIndex == 2) {
FileName = saveFileDialog.FileName;
File.WriteAllText(FileName, Marc_data, Encoding.Unicode);
}
}
MessageBox.Show("반출되었습니다!");
}
#region Grid ( ) ( dataGridView1의 AllowDrop )
@@ -342,5 +368,147 @@ namespace WindowsFormsApp1.Mac
sg.DragOver(sender, e);
}
#endregion
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
int row = e.RowIndex;
int col = dataGridView1.CurrentCell.ColumnIndex;
if (col < 2 && col > 7)
return;
if (dataGridView1.Rows[row].Cells["marc"].Value.ToString() == "" &&
dataGridView1.Rows[row].Cells["marc"].Value == null)
{
MessageBox.Show("저장된 마크가 없습니다!");
return;
}
string Marc = dataGridView1.Rows[row].Cells["marc"].Value.ToString();
string AddTag = "";
if (col == 2 || col == 5 || col == 6 || col == 7)
{
string I = dataGridView1.Rows[row].Cells[2].Value.ToString();
string V = dataGridView1.Rows[row].Cells[5].Value.ToString();
string C = dataGridView1.Rows[row].Cells[6].Value.ToString();
string F = dataGridView1.Rows[row].Cells[7].Value.ToString();
if (I != "")
I = string.Format("▼i{0}", I);
if (V != "")
V = string.Format("▼v{0}", V);
if (C != "")
C = string.Format("▼c{0}", C);
if (F != "")
F = string.Format("▼f{0}", F);
AddTag = string.Format("049\t \t{0}{1}{2}{3}▲", I, V, C, F);
}
else if (col == 3 || col == 4)
{
string A = dataGridView1.Rows[row].Cells[3].Value.ToString();
string B = dataGridView1.Rows[row].Cells[4].Value.ToString();
if (A != "")
A = string.Format("▼a{0}", A);
if (B != "")
B = string.Format("▼b{0}", B);
AddTag = string.Format("090\t \t{0}{1}▲", A, B);
}
string TypeView = ConvertMarcType(Marc);
string AddMarc = AddTagInMarc(AddTag, TypeView);
String_Text st = new String_Text();
dataGridView1.Rows[row].Cells["marc"].Value = st.made_Ori_marc(AddMarc);
}
/// <summary>
/// 한줄짜리 마크를 보기 쉬운 형태로 변환
/// </summary>
/// <param name="Marc">한줄짜리 마크</param>
/// <returns></returns>
string ConvertMarcType(string Marc)
{
if (Marc.Length < 3) return "";
string result = "";
List<string> TagNum = new List<string>(); // 태그번호 저장용
List<string> Field = new List<string>(); // 가변길이필드 저장용
// 특수기호 육안으로 확인하기 쉽게 변환
Marc = Marc.Replace("", "▼");
Marc = Marc.Replace("", "▲");
Marc = Marc.Replace("₩", "\\");
int StartIdx = 0;
// 리더부를 제외한 디렉토리, 가변길이필드 저장
string[] data = Marc.Substring(24).Split('▲');
for (int a = 1; a < data.Length - 1; a++)
{
TagNum.Add(data[0].Substring(StartIdx, 3));
StartIdx += 12;
Field.Add(data[a] + "▲");
}
// List에 들어간 데이터를 메모장에 출력
for (int a = 0; a < TagNum.Count; a++)
{
string res = TagNum[a];
if (Field[a].IndexOf("▼") == -1)
{
res += "\t \t" + Field[a];
}
else
{
string temp = Field[a].Insert(2, "\t");
res += "\t" + temp;
}
result += res + "\n";
}
return result;
}
string AddTagInMarc(string Tag, string TypeView)
{
int TargetTagNum = Convert.ToInt32(Tag.Substring(0, 3));
string[] SplitView = TypeView.Split('\n');
List<string> View = new List<string>(SplitView);
int ViewCount = 0;
foreach (string LineMarc in View)
{
string LineTag = LineMarc.Substring(0, 3);
int TagNum = Convert.ToInt32(LineTag);
if (TargetTagNum == TagNum)
{
View[ViewCount] = Tag;
break;
}
else if (TargetTagNum < TagNum)
{
View.Insert(ViewCount, Tag);
break;
}
ViewCount++;
}
return string.Join("\n", View);
}
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
{
Skill_Grid sg = new Skill_Grid();
sg.Excel_to_DataGridView(sender, e);
}
}
}