|
@@ -40,7 +40,10 @@ namespace PLCTool.ViewModels.BasicConfigViewModel
|
|
DeleteCommand = new DelegateCommand<object>(Delete);
|
|
DeleteCommand = new DelegateCommand<object>(Delete);
|
|
GetPLCConfig();
|
|
GetPLCConfig();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 修改
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="obj"></param>
|
|
private void Edit(object obj)
|
|
private void Edit(object obj)
|
|
{
|
|
{
|
|
int id = Convert.ToInt32(obj);
|
|
int id = Convert.ToInt32(obj);
|
|
@@ -56,7 +59,12 @@ namespace PLCTool.ViewModels.BasicConfigViewModel
|
|
if (returnValue != null)
|
|
if (returnValue != null)
|
|
{
|
|
{
|
|
var plcCon = _mapper.Map<BasPlcItemConfigDto, bas_plc_item_config>(returnValue);
|
|
var plcCon = _mapper.Map<BasPlcItemConfigDto, bas_plc_item_config>(returnValue);
|
|
-
|
|
|
|
|
|
+ var findPlc = allPLCConfigList.FirstOrDefault(x => (x.PlcAddress == returnValue.PlcAddress) || (x.PlcItem == returnValue.PlcAddress));
|
|
|
|
+ if ((findPlc != null)&&(findPlc.Id!=id))
|
|
|
|
+ {
|
|
|
|
+ MessageBox.Show("已有此PLC变量地址或名称,请更改名称!", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
//修改
|
|
//修改
|
|
plcCon.id = id;
|
|
plcCon.id = id;
|
|
bool isSucc = _iBasPlcItemConfigService.Edit(plcCon);
|
|
bool isSucc = _iBasPlcItemConfigService.Edit(plcCon);
|