|
|
|
@ -27,6 +27,7 @@ using Admin.Core.Model.Model_New;
|
|
|
|
|
using Aucma.Core.SheetMetalTasks;
|
|
|
|
|
using Microsoft.IdentityModel.Logging;
|
|
|
|
|
using StackExchange.Profiling.Internal;
|
|
|
|
|
using Admin.Core.Service;
|
|
|
|
|
/*
|
|
|
|
|
* 首页信息
|
|
|
|
|
*/
|
|
|
|
@ -1210,6 +1211,11 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
string stationCode = Appsettings.app("StationInfo", "StationCode");
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (SelectedCells==null)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请选中要暂停的计划!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//获取当前计划的id
|
|
|
|
|
string Id = SelectedCells.ID;
|
|
|
|
|
if (string.IsNullOrEmpty(Id))
|
|
|
|
@ -1225,7 +1231,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
bool result = await _taskExecutionPlanInfoServices.UpdateAsync(taskExecutionPlanInfo);
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
await _taskExecutionPlanInfoServices.PlanMoveDown(objId.ToString(), stationCode);
|
|
|
|
|
// await _taskExecutionPlanInfoServices.PlanMoveDown(objId.ToString(), stationCode);
|
|
|
|
|
MessageBox.Show($"暂停计划成功,任务号:[{SelectedCells.TaskCode}]");
|
|
|
|
|
await LoadData();
|
|
|
|
|
}
|
|
|
|
@ -1256,8 +1262,6 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取当前计划的id
|
|
|
|
|
string Id = SelectedCells.ID;
|
|
|
|
|
if (string.IsNullOrEmpty(Id))
|
|
|
|
@ -1273,7 +1277,21 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
bool result = await _taskExecutionPlanInfoServices.UpdateAsync(taskExecutionPlanInfo);
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
//await _taskExecutionPlanInfoServices.PlanMoveDown(objId.ToString(), stationCode);
|
|
|
|
|
List<SheetMetaSendPlanInfoView> planInfo = await _executePlanInfoServices.QuerySheetMetalSendPlanData("1001");
|
|
|
|
|
|
|
|
|
|
var task = planInfo.First(d => d.ObjId == objId);
|
|
|
|
|
List<ExecutePlanInfo> execList = new List<ExecutePlanInfo>();
|
|
|
|
|
|
|
|
|
|
task.ExecuteStatus = 1;
|
|
|
|
|
SortTaskInfos(ref planInfo, objId);
|
|
|
|
|
planInfo.ForEach(async t =>
|
|
|
|
|
{
|
|
|
|
|
ExecutePlanInfo executePlanInfo = await _executePlanInfoServices.FirstAsync(d=>d.ObjId==t.ObjId);
|
|
|
|
|
executePlanInfo.ExecuteOrder = t.ExecuteOrder;
|
|
|
|
|
execList.Add(executePlanInfo);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
bool plan = await _taskExecutionPlanInfoServices.UpdateAsync(execList);
|
|
|
|
|
MessageBox.Show($"下发计划成功,任务号:[{SelectedCells.TaskCode}]");
|
|
|
|
|
await LoadData();
|
|
|
|
|
}
|
|
|
|
@ -1285,6 +1303,68 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 集合排序:将指定实体移动至第1位并将执行顺序整体后移
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="info"></param>
|
|
|
|
|
/// <param name="objId"></param>
|
|
|
|
|
/// <exception cref="ArgumentException"></exception>
|
|
|
|
|
private void SortTaskInfos(ref List<SheetMetaSendPlanInfoView> info, int objId)
|
|
|
|
|
{
|
|
|
|
|
if (info == null)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException($"执行计划排序异常:参数为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (objId <= 0)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException($"执行计划排序异常:主键无效");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var taskExecutionPlanInfo = info.First(d => d.ObjId == objId);
|
|
|
|
|
if (taskExecutionPlanInfo != null)
|
|
|
|
|
{
|
|
|
|
|
info.Remove(taskExecutionPlanInfo);
|
|
|
|
|
info.Insert(0, taskExecutionPlanInfo);
|
|
|
|
|
|
|
|
|
|
int[] order = new int[info.Count];
|
|
|
|
|
for (int i = 0; i < info.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
order[i] = info[i].ExecuteOrder;
|
|
|
|
|
}
|
|
|
|
|
BubbleSort(ref order);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < info.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
info[i].ExecuteOrder = order[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 排序
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="arr"></param>
|
|
|
|
|
public static void BubbleSort(ref int[] arr)
|
|
|
|
|
{
|
|
|
|
|
int n = arr.Length;
|
|
|
|
|
for (int i = 0; i < n - 1; i++)
|
|
|
|
|
{
|
|
|
|
|
for (int j = 0; j < n - i - 1; j++)
|
|
|
|
|
{
|
|
|
|
|
if (arr[j] > arr[j + 1])
|
|
|
|
|
{
|
|
|
|
|
int temp = arr[j];
|
|
|
|
|
arr[j] = arr[j + 1];
|
|
|
|
|
arr[j + 1] = temp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|