添加项目文件。
This commit is contained in:
@@ -0,0 +1,255 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Models.Ext;
|
||||
using Models.Models;
|
||||
using SamplePre.Models.Ext;
|
||||
using SamplePre.ProcessBll.BLL;
|
||||
using SamplePre.UIWpf.ParamManager.chirld;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.SopManager
|
||||
{
|
||||
public partial class ActionManagerViewModel : ObservableObject
|
||||
{
|
||||
ActionMangerBll actionMangerBll = new ActionMangerBll();
|
||||
|
||||
SOPManagerBll sopBll = new SOPManagerBll();
|
||||
|
||||
public ActionManagerViewModel()
|
||||
{
|
||||
|
||||
///获取所有动作
|
||||
InitActionData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 所有动作列表
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
public List<sys_action_ext> sysActions = new List<sys_action_ext>();
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有动作
|
||||
/// </summary>
|
||||
public void InitActionData()
|
||||
{
|
||||
|
||||
SysActions = actionMangerBll.QuerySysAction();
|
||||
|
||||
}
|
||||
|
||||
[ObservableProperty]
|
||||
public List<sys_action_parm_map_ext> actionParams;
|
||||
|
||||
|
||||
private sys_action_ext _selectItem;
|
||||
|
||||
/// <summary>
|
||||
/// 选中的动作行
|
||||
/// </summary>
|
||||
public sys_action_ext SelectItem
|
||||
{
|
||||
get { return _selectItem; }
|
||||
set {
|
||||
|
||||
SetProperty(ref _selectItem, value);
|
||||
|
||||
OnSelectedActionChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选中的参数
|
||||
/// </summary>
|
||||
|
||||
private sys_action_parm_map_ext _selectParam;
|
||||
|
||||
public sys_action_parm_map_ext SelectParam
|
||||
{
|
||||
get { return _selectParam; }
|
||||
set {
|
||||
SetProperty(ref _selectParam, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询动作下参数
|
||||
/// </summary>
|
||||
/// <param name="processId"></param>
|
||||
public void GetParmData(string actionId)
|
||||
{
|
||||
ActionParams = actionMangerBll.GetProcess_parm_mapByProcessId(actionId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取动作下的参数
|
||||
/// </summary>
|
||||
private void OnSelectedActionChanged()
|
||||
{
|
||||
if (SelectItem == null) return;
|
||||
//获取动作下的参数
|
||||
GetParmData(SelectItem.id);
|
||||
}
|
||||
|
||||
public void DeleAction()
|
||||
{
|
||||
if (SelectItem == null) return;
|
||||
|
||||
sys_action_ext action = SelectItem;
|
||||
|
||||
if (action.action_unit == "0") return;
|
||||
|
||||
if (MessageBox.Show($"确定删除:{action.action_name}", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
|
||||
{
|
||||
//校验动作是否已经被使用
|
||||
if (CheckAction(action) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//删除动作
|
||||
actionMangerBll.DelSysActionData(action.id);
|
||||
|
||||
|
||||
//=====刷新列表===================
|
||||
InitActionData();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckAction(sys_action process)
|
||||
{
|
||||
bool isExis = sopBll.IsExisAction(process.id);
|
||||
|
||||
if (isExis)
|
||||
{
|
||||
MessageBox.Show("该动作已经被使用,不能删除!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SelectShowParmList()
|
||||
{
|
||||
if(SelectItem == null)
|
||||
{
|
||||
MessageBox.Show("请先选择动作!");
|
||||
return;
|
||||
}
|
||||
SelectParmListWindow frm = new SelectParmListWindow(SelectItem);
|
||||
if(frm.ShowDialog() == true)
|
||||
{
|
||||
//获取动作下的参数
|
||||
GetParmData(SelectItem.id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除参数
|
||||
/// </summary>
|
||||
public void DeleParam()
|
||||
{
|
||||
if (SelectItem == null || SelectParam == null) return;//SelectItem
|
||||
|
||||
sys_action_parm_map_ext process = SelectParam;
|
||||
int id = process.id;
|
||||
string parm_name = process.title;
|
||||
|
||||
if (MessageBox.Show($"确定删除:{parm_name}", "提示",MessageBoxButton.OKCancel) == MessageBoxResult.OK)
|
||||
{
|
||||
|
||||
actionMangerBll.DelProcessParmMap(id);
|
||||
|
||||
GetParmData(process.process_id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 新增动作
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
[RelayCommand]
|
||||
public void BtnAddActionClick()
|
||||
{
|
||||
NewActionWindow frm = new NewActionWindow(this);
|
||||
if (frm.ShowDialog() == true)
|
||||
{
|
||||
//刷新列表
|
||||
|
||||
InitActionData();
|
||||
|
||||
//刷新列表
|
||||
ListCollectionView view = (ListCollectionView)CollectionViewSource.GetDefaultView(SysActions);//获取数据视图
|
||||
|
||||
////分组
|
||||
//view.SortDescriptions.Add(new SortDescription("action_seqno", ListSortDirection.Ascending));
|
||||
view.GroupDescriptions.Clear();
|
||||
view.GroupDescriptions.Add(new PropertyGroupDescription("action_unitname"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除动作
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
[RelayCommand]
|
||||
public void BtnDelActionClick()
|
||||
{
|
||||
|
||||
DeleAction();
|
||||
|
||||
//刷新列表
|
||||
ListCollectionView view = (ListCollectionView)CollectionViewSource.GetDefaultView(SysActions);//获取数据视图
|
||||
|
||||
////分组
|
||||
view.GroupDescriptions.Clear();
|
||||
view.GroupDescriptions.Add(new PropertyGroupDescription("action_unitname"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 动作下新增参数
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
[RelayCommand]
|
||||
public void BtnSelectParamClick()
|
||||
{
|
||||
|
||||
SelectShowParmList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除动作下参数
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
public void BtnDelParmClick()
|
||||
{
|
||||
|
||||
DeleParam();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
18
SamplePreSystem.UI/ViewModel/SopManager/DataGroup.cs
Normal file
18
SamplePreSystem.UI/ViewModel/SopManager/DataGroup.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using SamplePre.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.SopManager
|
||||
{
|
||||
public class DataGroup
|
||||
{
|
||||
public string Id { get; set; }
|
||||
|
||||
public string SopName { get; set; }
|
||||
|
||||
public List<TreeListItem> ListItems { get; set; } = new List<TreeListItem>();
|
||||
}
|
||||
}
|
||||
258
SamplePreSystem.UI/ViewModel/SopManager/ParamManagerViewModel.cs
Normal file
258
SamplePreSystem.UI/ViewModel/SopManager/ParamManagerViewModel.cs
Normal file
@@ -0,0 +1,258 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Models.Const;
|
||||
using Models.Models;
|
||||
using SamplePre.ProcessBll.BLL;
|
||||
using SamplePre.UIWpf.ParamManager.chirld;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.SopManager
|
||||
{
|
||||
public partial class ParamManagerViewModel : ObservableObject
|
||||
{
|
||||
SysParamBll sysParamBll = new SysParamBll();
|
||||
|
||||
|
||||
|
||||
public ParamManagerViewModel()
|
||||
{
|
||||
//初始化标准
|
||||
InitParamData();
|
||||
|
||||
BangdingUnit();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 参数列表
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
public List<sys_parm> sysParams = new List<sys_parm>();
|
||||
|
||||
/// <summary>
|
||||
/// 选中的参数行
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
public sys_parm selectItem = new sys_parm();
|
||||
|
||||
List<sys_parm> allSysParams = new List<sys_parm>();
|
||||
|
||||
public void InitParamData()
|
||||
{
|
||||
allSysParams = sysParamBll.QuerySysParm()?.OrderBy(p => p.plc_type).ToList();
|
||||
|
||||
|
||||
OnFilterTypeChange();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 参数类型
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
public List<string> dataTypes = new List<string> { "通用", "耗材", "液体" };
|
||||
|
||||
/// <summary>
|
||||
/// 过滤类型
|
||||
/// </summary>
|
||||
private string filterType = "通用";
|
||||
|
||||
public string FilterType
|
||||
{
|
||||
get { return filterType; }
|
||||
set {
|
||||
|
||||
SetProperty(ref filterType, value);
|
||||
|
||||
OnFilterTypeChange();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void OnFilterTypeChange()
|
||||
{
|
||||
if (string.IsNullOrEmpty(FilterType))
|
||||
{
|
||||
SysParams = allSysParams;
|
||||
return;
|
||||
}
|
||||
|
||||
SysParams = allSysParams.Where(p => p.param_type == FilterType).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 单位列表
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
public List<sys_dict> units = new List<sys_dict>();
|
||||
|
||||
|
||||
public void BangdingUnit()
|
||||
{
|
||||
Units = SystemConst.dictDatas.Where(p => p.class_id == 4).ToList();
|
||||
|
||||
//cmbUnit.BindingData<sys_dict>(units, "data_value", "id");
|
||||
//cmbUnit.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 参数值绑定
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
public sys_parm sysParm = new sys_parm();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存参数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool SaveParam()
|
||||
{
|
||||
if (string.IsNullOrEmpty(SysParm.title) || string.IsNullOrEmpty(SysParm.data_value))
|
||||
{
|
||||
MessageBox.Show("内容不能为空");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(SysParm.param_type))
|
||||
{
|
||||
MessageBox.Show("参数类型不能为空");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (SysParm.data_type == "数值")
|
||||
{
|
||||
string val = SysParm.data_value;
|
||||
if (float.TryParse(val, out _) == false)
|
||||
{
|
||||
MessageBox.Show("参数值格式不正确,请重新修改!");
|
||||
SysParm.data_value = "0";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (SysParm != null && !string.IsNullOrEmpty(SysParm.id))
|
||||
{
|
||||
//修改
|
||||
sysParamBll.UpdateSysParm(SysParm);
|
||||
}
|
||||
else
|
||||
{
|
||||
//判断plc编码是否重复
|
||||
if (sysParamBll.IsExtisPlCcode(SysParm.plc_type))
|
||||
{
|
||||
MessageBox.Show("存在相同plc编码,不能保存!");
|
||||
return false;
|
||||
}
|
||||
//新增
|
||||
SysParm.id = Guid.NewGuid().ToString();
|
||||
|
||||
sysParamBll.SaveSysParm(SysParm);
|
||||
}
|
||||
|
||||
//刷新参数列表
|
||||
InitParamData();
|
||||
OnFilterTypeChange();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除参数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool DelParam()
|
||||
{
|
||||
sys_parm parm = SelectItem;
|
||||
string id = parm.id;
|
||||
string title = parm.title;
|
||||
|
||||
|
||||
if (MessageBox.Show($"确定删除:{title}", "提示",MessageBoxButton.OKCancel) == MessageBoxResult.OK)
|
||||
{
|
||||
//判断该参数是否已经被使用
|
||||
if (IsDelete(id) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
sysParamBll.DelSysParm(id);
|
||||
|
||||
//刷新参数列表
|
||||
InitParamData();
|
||||
OnFilterTypeChange();
|
||||
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
private bool IsDelete(string parmId)
|
||||
{
|
||||
bool isExit = sysParamBll.IsExtisActionParam(parmId);
|
||||
if (isExit)
|
||||
{
|
||||
MessageBox.Show("该参数已经被使用,不能删除!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 新增参数
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
[RelayCommand]
|
||||
public void BtnAddParamClick()
|
||||
{
|
||||
SysParm = new sys_parm();
|
||||
NewStandParmWindow frm = new NewStandParmWindow(this);
|
||||
frm.ShowDialog();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑参数
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
public void BtnEditClick()
|
||||
{
|
||||
SysParm = SelectItem;
|
||||
|
||||
NewStandParmWindow frm = new NewStandParmWindow(this);
|
||||
frm.ShowDialog();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除参数
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
[RelayCommand]
|
||||
private void BtnDelParamClick()
|
||||
{
|
||||
DelParam();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
376
SamplePreSystem.UI/ViewModel/SopManager/SopMangerViewModel.cs
Normal file
376
SamplePreSystem.UI/ViewModel/SopManager/SopMangerViewModel.cs
Normal file
@@ -0,0 +1,376 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Models.Const;
|
||||
using Models.Models;
|
||||
using SamplePre.Models;
|
||||
using SamplePre.Models.Ext;
|
||||
using SamplePre.ProcessBll.BLL;
|
||||
using SamplePre.UIWpf.ParamManager.chirld;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.SopManager
|
||||
{
|
||||
public partial class SopMangerViewModel : ObservableObject
|
||||
{
|
||||
|
||||
SOPManagerBll sopManagerBll = new SOPManagerBll();
|
||||
|
||||
SystemBll systemBll = new SystemBll();
|
||||
|
||||
|
||||
public SopMangerViewModel()
|
||||
{
|
||||
//初始化标准
|
||||
InitStandardData();
|
||||
|
||||
//初始化动作
|
||||
InitActionData();
|
||||
//sop
|
||||
GetSopData("111");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// sop列表
|
||||
/// </summary>
|
||||
public List<DataGroup> StandardGroups { get; set; } = new List<DataGroup>();
|
||||
|
||||
/// <summary>
|
||||
/// sop列表
|
||||
/// </summary>
|
||||
|
||||
private List<sys_standard_action_ext> _sopList = new List<sys_standard_action_ext>();
|
||||
|
||||
public List<sys_standard_action_ext> SopList
|
||||
{
|
||||
get { return _sopList; }
|
||||
set {
|
||||
SetProperty(ref _sopList, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选择的动作
|
||||
/// </summary>
|
||||
private sys_standard_action_ext _selectItem;
|
||||
|
||||
public sys_standard_action_ext SelectItem
|
||||
{
|
||||
get { return _selectItem; }
|
||||
set {
|
||||
SetProperty(ref _selectItem, value);
|
||||
|
||||
OnSelectedActionChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选择的参数
|
||||
/// </summary>
|
||||
private sys_standard_action_parm_ext _selectParamItem;
|
||||
|
||||
public sys_standard_action_parm_ext SelectParamItem
|
||||
{
|
||||
get { return _selectParamItem; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref _selectParamItem, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 动作参数列表
|
||||
/// </summary>
|
||||
private List<sys_standard_action_parm_ext> _actionParamList = new List<sys_standard_action_parm_ext>();
|
||||
|
||||
public List<sys_standard_action_parm_ext> ActionParamList
|
||||
{
|
||||
get { return _actionParamList; }
|
||||
set {
|
||||
|
||||
SetProperty(ref _actionParamList, value);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OnSelectedActionChanged()
|
||||
{
|
||||
if (SelectItem == null) return;
|
||||
//获取动作下的参数
|
||||
List<sys_standard_action_parm_ext> paramList = sopManagerBll.GetStrandActionParamByStrandId(SelectItem.standard_id);
|
||||
ActionParamList = paramList.Where(p => p.action_id == SelectItem.process_id && p.action_seqno == SelectItem.process_no).ToList();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void InitStandardData()
|
||||
{
|
||||
|
||||
SystemConst.dictDatas = systemBll.QueryDictData();
|
||||
|
||||
List<TreeListItem> treeListItems = sopManagerBll.GetStandardData();
|
||||
|
||||
|
||||
|
||||
var group = treeListItems.Where(p=>p.ParentID == "0").ToList();
|
||||
foreach (TreeListItem item in group)
|
||||
{
|
||||
DataGroup sopGroup = new DataGroup();
|
||||
sopGroup.Id = item.ID;
|
||||
sopGroup.SopName = item.DisplayText;
|
||||
|
||||
sopGroup.ListItems = treeListItems.Where(p => p.ParentID == item.ID).ToList();
|
||||
|
||||
StandardGroups.Add(sopGroup);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public List<DataGroup> ActionGroups { get; set; } = new List<DataGroup>();
|
||||
|
||||
/// <summary>
|
||||
/// 初始化动作字典
|
||||
/// </summary>
|
||||
public void InitActionData()
|
||||
{
|
||||
|
||||
//获取动作
|
||||
List<sys_action_ext> actions = sopManagerBll.QuerySysAction();
|
||||
|
||||
//拼装组
|
||||
var groups = actions.GroupBy(p => new { p.action_unitname, p.action_unit }).ToList();
|
||||
foreach (var item in groups)
|
||||
{
|
||||
DataGroup sopGroup = new DataGroup();
|
||||
sopGroup.Id = item.Key.action_unit;
|
||||
sopGroup.SopName = item.Key.action_unitname;
|
||||
|
||||
var itemList = actions.Where(p => p.action_unit == item.Key.action_unit).ToList();
|
||||
foreach(var it in itemList)
|
||||
{
|
||||
sopGroup.ListItems.Add(new TreeListItem() { ID = it.id, DisplayText = it.action_name, ParentID = item.Key.action_unit });
|
||||
}
|
||||
|
||||
|
||||
ActionGroups.Add(sopGroup);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public string m_standradId;
|
||||
|
||||
public void GetSopData(string standradId)
|
||||
{
|
||||
m_standradId = standradId;
|
||||
SopList = sopManagerBll.QueryStandardProcessByStandardId(standradId);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 拖拽新增动作
|
||||
/// </summary>
|
||||
/// <param name="dropItem"></param>
|
||||
[RelayCommand]
|
||||
public void AddDragSopAction(TreeListItem dropItem)
|
||||
{
|
||||
List<sys_standard_action_ext> actionList = SopList;
|
||||
|
||||
if (string.IsNullOrEmpty(m_standradId)) return;
|
||||
|
||||
if (dropItem != null && actionList != null)
|
||||
{
|
||||
int maxSeqno = 0;
|
||||
//取最后的动作序号+1;
|
||||
if (actionList.Count > 0)
|
||||
{
|
||||
maxSeqno = actionList[actionList.Count - 1].process_no + 1;
|
||||
}
|
||||
|
||||
|
||||
sys_standard_action procemodel = new sys_standard_action()
|
||||
{
|
||||
id = Guid.NewGuid().ToString(),
|
||||
process_id = dropItem.ID,
|
||||
//process_name = process.process_name,
|
||||
process_no = maxSeqno,//actionList.Count + 1,
|
||||
standard_id = m_standradId
|
||||
};
|
||||
|
||||
//保存标准动作表、动作参数表
|
||||
sopManagerBll.SaveStandardAction_param(procemodel);
|
||||
|
||||
//=======================================================
|
||||
//查询标准下的SOP
|
||||
GetSopData(m_standradId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除动作
|
||||
/// </summary>
|
||||
public void RemoveAction()
|
||||
{
|
||||
|
||||
sys_standard_action_ext pro = SelectItem; //this.gridView1.GetRow(rows[0]) as sys_standard_action_ext;
|
||||
if (pro == null) return;
|
||||
if (MessageBox.Show($"确定移除:{pro.action_name}", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
|
||||
{
|
||||
//移除标准下的动作
|
||||
sopManagerBll.removeStandAction(pro);
|
||||
|
||||
|
||||
//查询标准下的SOP
|
||||
GetSopData(pro.standard_id);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上移动作操作
|
||||
/// </summary>
|
||||
public void UpMove()
|
||||
{
|
||||
sys_standard_action_ext[] temp_list = new sys_standard_action_ext[SopList.Count];
|
||||
SopList.CopyTo(temp_list);
|
||||
|
||||
for (int i = 0;i < temp_list.Length;i++)
|
||||
{
|
||||
if (i != 0 && temp_list[i] == SelectItem)
|
||||
{
|
||||
|
||||
var item = temp_list[i - 1];
|
||||
temp_list[i - 1] = SelectItem;
|
||||
temp_list[i] = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SopList = temp_list.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下移动作操作
|
||||
/// </summary>
|
||||
public void DownMove()
|
||||
{
|
||||
sys_standard_action_ext[] temp_list = new sys_standard_action_ext[SopList.Count];
|
||||
SopList.CopyTo(temp_list);
|
||||
|
||||
for (int i = 0; i < temp_list.Length; i++)
|
||||
{
|
||||
if (i < temp_list.Length - 1 && temp_list[i] == SelectItem)
|
||||
{
|
||||
|
||||
var item = temp_list[i + 1];
|
||||
temp_list[i + 1] = SelectItem;
|
||||
temp_list[i] = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SopList = temp_list.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新序号
|
||||
/// </summary>
|
||||
public void UpdateSeqno()
|
||||
{
|
||||
//List<sys_standard_action_ext> sopList = gridActions.DataSource as List<sys_standard_action_ext>;
|
||||
|
||||
int seqno = 1;
|
||||
string standradId = "";
|
||||
foreach (var action in SopList)
|
||||
{
|
||||
//sys_standard_action_ext action = tree_Actions.GetDataRecordByNode(node) as sys_standard_action_ext;
|
||||
standradId = action.standard_id;
|
||||
|
||||
action.new_action_seqno = seqno;
|
||||
|
||||
sopManagerBll.UpdateActionSeqno(action);
|
||||
seqno++;
|
||||
}
|
||||
GetSopData(standradId);
|
||||
}
|
||||
|
||||
public void AddParamShow()
|
||||
{
|
||||
if (SelectItem != null)
|
||||
{
|
||||
SelectParmListWindow frm = new SelectParmListWindow(SelectItem);
|
||||
if(frm.ShowDialog() == true)
|
||||
{
|
||||
OnSelectedActionChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveParam()
|
||||
{
|
||||
|
||||
if (SelectItem != null && SelectParamItem != null)
|
||||
{
|
||||
if (MessageBox.Show($"是否移除【{SelectParamItem.title}】参数?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
|
||||
{
|
||||
sopManagerBll.removeActionParmByParamId(SelectItem.standard_id, SelectItem.process_id, SelectItem.process_no, SelectParamItem.parm_id);
|
||||
|
||||
OnSelectedActionChanged();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal void AddEidtParam()
|
||||
{
|
||||
if(ActionParamList.Count > 0)
|
||||
{
|
||||
//List<sys_standard_action_parm> list = uCActionParam.GetEditVal();
|
||||
//if (list == null) return;
|
||||
foreach (var item in ActionParamList)
|
||||
{
|
||||
sopManagerBll.updateStandardActionParm(item);
|
||||
}
|
||||
|
||||
MessageBox.Show("修改成功!");
|
||||
|
||||
OnSelectedActionChanged();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 标准选择命令
|
||||
/// </summary>
|
||||
/// <param name="selectItem"></param>
|
||||
[RelayCommand]
|
||||
public void StandSelectedItemChanged(object obj)
|
||||
{
|
||||
TreeListItem selectItem = obj as TreeListItem;
|
||||
if (selectItem == null) return;
|
||||
GetSopData(selectItem.ID);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user