测试
This commit is contained in:
1 parent
3467d4aa9d
commit
820d9d065b
27 files changed
+249
-59
No files matched your search
@@ -1,10 +1,13 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using HHWMS.Web.Models;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using WalkingTec.Mvvm.Mvc;
|
||||
using WalkingTec.Mvvm.Core.Extensions;
|
||||
using HHWMS.Web;
|
||||
using WalkingTec.Mvvm.Mvc;
|
||||
|
||||
namespace HHWMS.Web.Controllers
|
||||
{
|
||||
@@ -12,7 +15,15 @@ namespace HHWMS.Web.Controllers
|
||||
[ActionDescription("任务主表")]
|
||||
public partial class TaskHeaderController : BaseController
|
||||
{
|
||||
private readonly IUnitWork _unitwork;
|
||||
|
||||
public TaskHeaderController(IUnitWork unitwork)
|
||||
{
|
||||
_unitwork = unitwork;
|
||||
}
|
||||
|
||||
#region Search
|
||||
|
||||
[ActionDescription("Sys.Search")]
|
||||
public ActionResult Index()
|
||||
{
|
||||
@@ -36,9 +47,10 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion Search
|
||||
|
||||
#region Create
|
||||
|
||||
[ActionDescription("Sys.Create")]
|
||||
public ActionResult Create()
|
||||
{
|
||||
@@ -68,9 +80,11 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion Create
|
||||
|
||||
#region Edit
|
||||
|
||||
[ActionDescription("Sys.Edit")]
|
||||
public ActionResult Edit(string id)
|
||||
{
|
||||
@@ -101,9 +115,11 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion Edit
|
||||
|
||||
#region Delete
|
||||
|
||||
[ActionDescription("Sys.Delete")]
|
||||
public ActionResult Delete(string id)
|
||||
{
|
||||
@@ -126,18 +142,22 @@ namespace HHWMS.Web.Controllers
|
||||
return FFResult().CloseDialog().RefreshGrid();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion Delete
|
||||
|
||||
#region Details
|
||||
|
||||
[ActionDescription("Sys.Details")]
|
||||
public ActionResult Details(string id)
|
||||
{
|
||||
var vm = Wtm.CreateVM<TaskHeaderVM>(id);
|
||||
return PartialView(vm);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion Details
|
||||
|
||||
#region BatchEdit
|
||||
|
||||
[HttpPost]
|
||||
[ActionDescription("Sys.BatchEdit")]
|
||||
public ActionResult BatchEdit(string[] IDs)
|
||||
@@ -152,16 +172,18 @@ namespace HHWMS.Web.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid || !vm.DoBatchEdit())
|
||||
{
|
||||
return PartialView("BatchEdit",vm);
|
||||
return PartialView("BatchEdit", vm);
|
||||
}
|
||||
else
|
||||
{
|
||||
return FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.BatchEditSuccess", vm.Ids.Length]);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion BatchEdit
|
||||
|
||||
#region BatchDelete
|
||||
|
||||
[HttpPost]
|
||||
[ActionDescription("Sys.BatchDelete")]
|
||||
public ActionResult BatchDelete(string[] IDs)
|
||||
@@ -176,17 +198,19 @@ namespace HHWMS.Web.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid || !vm.DoBatchDelete())
|
||||
{
|
||||
return PartialView("BatchDelete",vm);
|
||||
return PartialView("BatchDelete", vm);
|
||||
}
|
||||
else
|
||||
{
|
||||
return FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.BatchDeleteSuccess", vm.Ids.Length]);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion BatchDelete
|
||||
|
||||
#region Import
|
||||
[ActionDescription("Sys.Import")]
|
||||
|
||||
[ActionDescription("Sys.Import")]
|
||||
public ActionResult Import()
|
||||
{
|
||||
var vm = Wtm.CreateVM<TaskHeaderImportVM>();
|
||||
@@ -206,16 +230,88 @@ namespace HHWMS.Web.Controllers
|
||||
return FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.ImportSuccess", vm.EntityList.Count.ToString()]);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion Import
|
||||
|
||||
#region Export
|
||||
|
||||
[ActionDescription("Sys.Export")]
|
||||
[HttpPost]
|
||||
public IActionResult ExportExcel(TaskHeaderListVM vm)
|
||||
{
|
||||
return vm.GetExportData();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion Export
|
||||
|
||||
#region 任务下发
|
||||
|
||||
[ActionDescription("TaskHeader.Assign")]
|
||||
public ActionResult Assign(string id)
|
||||
{
|
||||
var task = _unitwork.Find<TaskHeader>(x => x.ID == int.Parse(id)).Include(x => x.TaskDetails).FirstOrDefault();
|
||||
if(task == null)
|
||||
return FFResult().RefreshGrid().Alert($"操作失败,此任务不存在!");
|
||||
var taskInfo = new TaskInfo();
|
||||
var beginlocation = _unitwork.FindSingle<Location>(x => x.Code.Equals(task.FromLocation));
|
||||
var endLocation = _unitwork.FindSingle<Location>(x => x.Code.Equals(task.ToLocation));
|
||||
var start = new CoordPos();
|
||||
var end = new CoordPos();
|
||||
if ((int)task.TaskType == 3 || (int)task.TaskType == 4)
|
||||
{
|
||||
// 盘料起点终点 与普通任务起点终点不一样,编码未在location中保存
|
||||
var taskdel = task.TaskDetails.FirstOrDefault(x => x.Status.Equals(TaskStatusEnum.新建));
|
||||
start.X = int.Parse(taskdel.Batch.Split("-")[0]);
|
||||
start.Y = int.Parse(taskdel.Batch.Split("-")[1]);
|
||||
start.Z = int.Parse(taskdel.Batch.Split("-")[2]);
|
||||
|
||||
end.X = int.Parse(taskdel.Lot.Split("-")[0]);
|
||||
end.Y = int.Parse(taskdel.Lot.Split("-")[1]);
|
||||
end.Z = int.Parse(taskdel.Lot.Split("-")[2]);
|
||||
|
||||
taskInfo.TaskId = taskdel.TaskHeader.TaskNo;
|
||||
taskInfo.TaskType = (int)task.TaskType;
|
||||
taskInfo.ObjId = taskdel.ContainerCode;
|
||||
taskInfo.StartType = int.Parse(task.Station);
|
||||
taskInfo.StartPos = start;
|
||||
taskInfo.EndType = int.Parse(task.Station);
|
||||
taskInfo.EndPos = end;
|
||||
}
|
||||
else
|
||||
{
|
||||
start.X = beginlocation.Line;
|
||||
start.Y = beginlocation.Row;
|
||||
start.Z = beginlocation.Layer;
|
||||
|
||||
end.X = endLocation.Line;
|
||||
end.Y = endLocation.Row;
|
||||
end.Z = endLocation.Layer;
|
||||
|
||||
taskInfo.TaskId = task.TaskNo;
|
||||
taskInfo.TaskType = (int)task.TaskType;
|
||||
taskInfo.ObjId = task.ContainerCode;
|
||||
taskInfo.StartType = int.Parse(task.Station);
|
||||
taskInfo.StartPos = start;
|
||||
taskInfo.EndType = int.Parse(task.Station);
|
||||
taskInfo.EndPos = end;
|
||||
}
|
||||
|
||||
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, taskInfo).Result.Data;
|
||||
try
|
||||
{
|
||||
if ((bool)res?.Success)
|
||||
{
|
||||
// 删除已回传MES的任务
|
||||
//_unitwork.Delete(item);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return FFResult().Alert($"操作失败,{ex.Message}");
|
||||
}
|
||||
return FFResult().RefreshGrid();
|
||||
}
|
||||
|
||||
#endregion 任务下发
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user