개정판 284fa2c9
issue #000:
Change-Id: I6a600a1d1869b65f32f28368718a9fc357738a86
DTI_PID/ID2PSN/Form/EquipmentSetting.cs | ||
---|---|---|
27 | 27 |
EquipmentAirFinCoolerInfo currentEquipmentAirFinCoolerInfo = null; |
28 | 28 |
private RepositoryItemComboBox repositoryGroupType2 = new RepositoryItemComboBox(); |
29 | 29 |
|
30 |
private RepositoryItemComboBox repositoryAttributeItem = new RepositoryItemComboBox(); |
|
31 |
private DataTable SymbolList = new DataTable(); |
|
30 | 32 |
public EquipmentSetting() |
31 | 33 |
{ |
32 | 34 |
InitializeComponent(); |
... | ... | |
34 | 36 |
InitGridEquipmentNoPocket(); |
35 | 37 |
InitGridEquipmentAirFinCooler(); |
36 | 38 |
|
39 |
gridViewAirFinCooler.CellValueChanging += new DevExpress.XtraGrid.Views.Base.CellValueChangedEventHandler(gridViewSymbol_CellValueChanged); |
|
40 |
|
|
37 | 41 |
EquipmentNoPocketInfos = new List<EquipmentNoPocketInfo>(); |
38 | 42 |
currentEquipmentNoPocketInfo = new EquipmentNoPocketInfo(); |
39 | 43 |
|
... | ... | |
44 | 48 |
InitAirFinCoolerData(); |
45 | 49 |
} |
46 | 50 |
|
47 |
//const string FluidPriorityType = "FLUIDCODE"; |
|
48 |
//const string PipingMaterialsPriorityType = "PIPINGMATERIALSCLASS"; |
|
51 |
private void gridViewSymbol_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) |
|
52 |
{ |
|
53 |
if (e.Column.FieldName == "Type") |
|
54 |
{ |
|
55 |
DevExpress.XtraGrid.Views.Base.ColumnView columnView = sender as DevExpress.XtraGrid.Views.Base.ColumnView; |
|
56 |
if (!string.IsNullOrEmpty(e.Value.ToString())) |
|
57 |
{ |
|
58 |
string selectItem = e.Value.ToString(); |
|
59 |
DataTable dt = gridControlAirFinCooler.DataSource as DataTable; |
|
60 |
if (selectItem.Contains("Air Fin Cooler")) |
|
61 |
{ |
|
62 |
dt.Rows[columnView.FocusedRowHandle]["TagIdentifier"] = "AFC"; |
|
63 |
} |
|
64 |
else if (selectItem.Contains("Pump")) |
|
65 |
{ |
|
66 |
dt.Rows[columnView.FocusedRowHandle]["TagIdentifier"] = "P"; |
|
67 |
} |
|
68 |
} |
|
69 |
} |
|
70 |
|
|
71 |
} |
|
72 |
|
|
49 | 73 |
public void InitGridEquipmentNoPocket() |
50 | 74 |
{ |
51 | 75 |
RepositoryItemButtonEdit btnRemove = new RepositoryItemButtonEdit(); |
... | ... | |
120 | 144 |
DataTable dtType = new DataTable(); |
121 | 145 |
dtType.Columns.Add("Index"); |
122 | 146 |
dtType.Columns.Add("Type"); |
147 |
dtType.Columns.Add("TagIdentifier"); |
|
148 |
dtType.Columns.Add("AttributeName"); |
|
123 | 149 |
dtType.Columns.Add("SppidSymbolName"); |
124 | 150 |
dtType.Columns.Add(" "); |
125 | 151 |
gridControlAirFinCooler.DataSource = dtType; |
126 | 152 |
|
127 | 153 |
GridColumn gridColumn = gridViewAirFinCooler.Columns[0]; |
128 | 154 |
|
129 |
|
|
130 | 155 |
gridColumn.Name = "Index"; |
131 | 156 |
gridColumn.Caption = "Index"; |
132 | 157 |
gridColumn.OptionsColumn.AllowEdit = false; |
... | ... | |
146 | 171 |
gridViewAirFinCooler.Columns["Type"].ColumnEdit = repositoryGroupType2; |
147 | 172 |
|
148 | 173 |
gridColumn = gridViewAirFinCooler.Columns[2]; |
174 |
gridColumn.Name = "TagIdentifier"; |
|
175 |
gridColumn.Caption = "Prefix"; |
|
176 |
gridColumn.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; |
|
177 |
gridColumn.VisibleIndex = 2; |
|
178 |
|
|
179 |
repositoryAttributeItem.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; |
|
180 |
repositoryAttributeItem.AppearanceDropDown.Font = Font; |
|
181 |
gridControlAirFinCooler.RepositoryItems.Add(repositoryAttributeItem); |
|
182 |
|
|
183 |
gridColumn = gridViewAirFinCooler.Columns[3]; |
|
184 |
gridColumn.Name = "AttributeName"; |
|
185 |
gridColumn.Caption = "ID2 Attribute Name"; |
|
186 |
gridColumn.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; |
|
187 |
gridColumn.VisibleIndex = 3; |
|
188 |
gridViewAirFinCooler.Columns["AttributeName"].ColumnEdit = repositoryAttributeItem; |
|
189 |
|
|
190 |
gridColumn = gridViewAirFinCooler.Columns[4]; |
|
149 | 191 |
gridColumn.Name = "SppidSymbolName"; |
150 | 192 |
gridColumn.Caption = "ID2 Symbol Name"; |
151 | 193 |
gridColumn.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; |
152 |
gridColumn.VisibleIndex = 2; |
|
194 |
gridColumn.VisibleIndex = 4; |
|
195 |
|
|
196 |
SymbolList = DB.SelectAllSymbolAttribute(); |
|
153 | 197 |
|
154 | 198 |
RepositoryItemTreeListLookUpEdit treeListLookUpEdit = new RepositoryItemTreeListLookUpEdit(); |
155 | 199 |
gridControlAirFinCooler.RepositoryItems.Add(treeListLookUpEdit); |
... | ... | |
157 | 201 |
|
158 | 202 |
gridViewAirFinCooler.Columns["SppidSymbolName"].ColumnEdit = treeListLookUpEdit; |
159 | 203 |
|
160 |
gridColumn = gridViewAirFinCooler.Columns[3];
|
|
204 |
gridColumn = gridViewAirFinCooler.Columns[5];
|
|
161 | 205 |
gridColumn.Name = "Remove"; |
162 | 206 |
gridColumn.Caption = ""; |
163 | 207 |
gridColumn.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; |
164 |
gridColumn.VisibleIndex = 3;
|
|
208 |
gridColumn.VisibleIndex = 5;
|
|
165 | 209 |
gridColumn.MaxWidth = 16; |
166 | 210 |
|
167 | 211 |
gridColumn.ColumnEdit = btnRemove; |
168 | 212 |
gridColumn.ShowButtonMode = DevExpress.XtraGrid.Views.Base.ShowButtonModeEnum.ShowAlways; |
213 |
gridViewAirFinCooler.CustomRowCellEditForEditing += GridViewAirFinCooler_CustomRowCellEditForEditing; |
|
214 |
} |
|
215 |
|
|
216 |
private void GridViewAirFinCooler_CustomRowCellEditForEditing(object sender, CustomRowCellEditEventArgs e) |
|
217 |
{ |
|
218 |
if (e.Column == (sender as GridView).Columns["AttributeName"]) |
|
219 |
{ |
|
220 |
DevExpress.XtraGrid.Views.Base.ColumnView columnView = sender as DevExpress.XtraGrid.Views.Base.ColumnView; |
|
221 |
DataTable dt = gridControlAirFinCooler.DataSource as DataTable; |
|
222 |
string SppidSymbolName = dt.Rows[columnView.FocusedRowHandle]["SppidSymbolName"].ToString(); |
|
223 |
|
|
224 |
if (string.IsNullOrEmpty(SppidSymbolName)) |
|
225 |
{ |
|
226 |
MessageBox.Show("Choose a symbol !", "ID2 " + ID2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Information); |
|
227 |
return; |
|
228 |
} |
|
229 |
|
|
230 |
repositoryAttributeItem.Items.Clear(); |
|
231 |
repositoryAttributeItem.Items.Add(""); |
|
232 |
// repositoryAttributeItem.Items.Add("NoSelection"); |
|
233 |
foreach (DataRow dr in SymbolList.Rows) |
|
234 |
{ |
|
235 |
if (dr["SymbolName"].ToString().ToUpper().Equals(SppidSymbolName.ToUpper())) |
|
236 |
{ |
|
237 |
repositoryAttributeItem.Items.Add(dr["SymbolAttribute"].ToString()); |
|
238 |
} |
|
239 |
} |
|
240 |
} |
|
169 | 241 |
} |
170 | 242 |
|
171 | 243 |
private void GridViewKeyword_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e) |
... | ... | |
222 | 294 |
{ |
223 | 295 |
int index = Convert.ToInt32(row["INDEX"]); |
224 | 296 |
string Type = row["TYPE"].ToString(); |
297 |
string TagIdentifier = row["TagIdentifier"].ToString(); |
|
298 |
string AttributeName = row["AttributeName"].ToString(); |
|
225 | 299 |
string SppidSymbolName = row["NAME"].ToString(); |
226 | 300 |
|
227 |
typeDT.Rows.Add(index, Type, SppidSymbolName, null); |
|
301 |
typeDT.Rows.Add(index, Type, TagIdentifier, AttributeName, SppidSymbolName, null);
|
|
228 | 302 |
} |
229 | 303 |
|
230 | 304 |
} |
... | ... | |
327 | 401 |
} |
328 | 402 |
|
329 | 403 |
DataTable dt = gridControlAirFinCooler.DataSource as DataTable; |
330 |
dt.Rows.Add(dt.Rows.Count + 1, null, null, null); |
|
404 |
dt.Rows.Add(dt.Rows.Count + 1, null, null, null, null, null);
|
|
331 | 405 |
gridViewAirFinCooler.Columns["Index"].BestFit(); |
332 | 406 |
} |
333 | 407 |
|
... | ... | |
360 | 434 |
{ |
361 | 435 |
Index = i + 1, |
362 | 436 |
Type = row["Type"].ToString(), |
437 |
TagIdentifier = row["TagIdentifier"].ToString(), |
|
438 |
AttributeName = row["AttributeName"].ToString(), |
|
363 | 439 |
Name = row["SppidSymbolName"].ToString() |
364 | 440 |
}); |
365 | 441 |
} |
... | ... | |
399 | 475 |
return; |
400 | 476 |
} |
401 | 477 |
|
478 |
if (currentEquipmentAirFinCoolerInfo.EquipmentAirFinCoolerItem.Find(x => x.TagIdentifier == string.Empty || x.AttributeName == string.Empty || x.Name == string.Empty) != null) |
|
479 |
{ |
|
480 |
IEnumerable<EquipmentAirFinCoolerItem> lstafc = currentEquipmentAirFinCoolerInfo.EquipmentAirFinCoolerItem.Where(x => x.TagIdentifier == string.Empty || x.AttributeName == string.Empty || x.Name == string.Empty); |
|
481 |
//Scope Break |
|
482 |
foreach (EquipmentAirFinCoolerItem vg in lstafc) |
|
483 |
{ |
|
484 |
if(vg.Type == string.Empty || vg.Name == string.Empty) |
|
485 |
{ |
|
486 |
MessageBox.Show("Please save after entering data.", "ID2 " + ID2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
487 |
return; |
|
488 |
} |
|
489 |
} |
|
490 |
} |
|
491 |
|
|
402 | 492 |
if (DB.SaveEquipmentNopocketSetting(currentEquipmentNoPocketInfo.EquipmentNoPocketItem) && |
403 | 493 |
DB.SaveAirFinCoolerSetting(currentEquipmentAirFinCoolerInfo.EquipmentAirFinCoolerItem)) |
404 | 494 |
MessageBox.Show("Save was successful", "ID2 " + ID2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Information); |
내보내기 Unified diff