任务明细 出库明细 库存分析 启动出库
This commit is contained in:
1 parent
eef6df7099
commit
f5423e78fe
28 files changed
+500
-77
No files matched your search
@@ -6,6 +6,8 @@ using WalkingTec.Mvvm.Mvc;
|
||||
using WalkingTec.Mvvm.Core.Extensions;
|
||||
using HHWMS.Web;
|
||||
using HHWMS.Web.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq;
|
||||
|
||||
namespace HHWMS.Web.Controllers
|
||||
{
|
||||
@@ -44,6 +46,15 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
[ActionDescription("Sys.Search")]
|
||||
[HttpPost]
|
||||
public string Search2(TaskDetailListVM2 vm)
|
||||
{
|
||||
vm.Searcher.Page = vm.FC.GetValue<int>("Page");
|
||||
vm.Searcher.Limit = vm.FC.GetValue<int>("Limit");
|
||||
return vm.GetJson(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Create
|
||||
@@ -160,7 +171,7 @@ namespace HHWMS.Web.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid || !vm.DoBatchEdit())
|
||||
{
|
||||
return PartialView("BatchEdit",vm);
|
||||
return PartialView("BatchEdit", vm);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -184,7 +195,7 @@ namespace HHWMS.Web.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid || !vm.DoBatchDelete())
|
||||
{
|
||||
return PartialView("BatchDelete",vm);
|
||||
return PartialView("BatchDelete", vm);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -194,7 +205,7 @@ namespace HHWMS.Web.Controllers
|
||||
#endregion
|
||||
|
||||
#region Import
|
||||
[ActionDescription("Sys.Import")]
|
||||
[ActionDescription("Sys.Import")]
|
||||
public ActionResult Import()
|
||||
{
|
||||
var vm = Wtm.CreateVM<TaskDetailImportVM>();
|
||||
@@ -229,22 +240,30 @@ namespace HHWMS.Web.Controllers
|
||||
[ActionDescription("TaskHeader.Cancel")]
|
||||
public ActionResult Cancel(string id)
|
||||
{
|
||||
var task = _unitwork.FindById<TaskDetail>(int.Parse(id));
|
||||
// 判断任务 是否能取消
|
||||
if (task.Status < TaskStatusEnum.已下发)
|
||||
{
|
||||
return FFResult().Alert($"此任务未下发,无需取消!");
|
||||
}
|
||||
var task = _unitwork.Find<TaskDetail>(x => x.ID == int.Parse(id))
|
||||
.Include(x => x.TaskHeader).FirstOrDefault();
|
||||
|
||||
if (task != null)
|
||||
{
|
||||
// 判断任务 是否能取消
|
||||
if (task.Status < TaskStatusEnum.已下发)
|
||||
{
|
||||
return FFResult().Alert($"此任务未下发,无需取消!");
|
||||
}
|
||||
else if (task.Status == TaskStatusEnum.完成)
|
||||
{
|
||||
return FFResult().Alert($"此任务已完成,无需取消!");
|
||||
}
|
||||
|
||||
var taskInfo = new TaskInfo
|
||||
{
|
||||
TaskId = $"{task.TaskHeader.TaskNo}-{task.FromLocation}",
|
||||
TaskType = 99,
|
||||
};
|
||||
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, taskInfo).Result.Data;
|
||||
try
|
||||
{
|
||||
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, taskInfo).Result.Data;
|
||||
|
||||
if ((bool)res?.Success)
|
||||
{
|
||||
// 删除任务,处理数据
|
||||
|
||||
@@ -309,9 +309,9 @@ namespace HHWMS.Web.Controllers
|
||||
taskInfo.EndPos = end;
|
||||
}
|
||||
|
||||
/* var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, taskInfo).Result.Data;
|
||||
try
|
||||
{
|
||||
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, taskInfo).Result.Data;
|
||||
if ((bool)res?.Success)
|
||||
{
|
||||
// 删除已回传MES的任务
|
||||
@@ -321,7 +321,7 @@ namespace HHWMS.Web.Controllers
|
||||
catch (Exception ex)
|
||||
{
|
||||
return FFResult().Alert($"操作失败,{ex.Message}");
|
||||
}*/
|
||||
}
|
||||
return FFResult().RefreshGrid();
|
||||
}
|
||||
#endregion 任务下发
|
||||
@@ -331,9 +331,10 @@ namespace HHWMS.Web.Controllers
|
||||
public ActionResult Cancel(string id)
|
||||
{
|
||||
var task = _unitwork.FindById<TaskHeader>(int.Parse(id));
|
||||
|
||||
if (task != null) {
|
||||
if(task.Status < TaskStatusEnum.已下发)
|
||||
|
||||
if (task != null)
|
||||
{
|
||||
if (task.Status > TaskStatusEnum.已下发)
|
||||
{
|
||||
return FFResult().Alert($"此任务未下发,无需取消!");
|
||||
}
|
||||
@@ -347,9 +348,9 @@ namespace HHWMS.Web.Controllers
|
||||
TaskId = task.TaskNo,
|
||||
TaskType = 99,
|
||||
};
|
||||
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, taskInfo).Result.Data;
|
||||
try
|
||||
{
|
||||
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, taskInfo).Result.Data;
|
||||
if ((bool)res?.Success)
|
||||
{
|
||||
// 删除任务,处理数据
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using WalkingTec.Mvvm.Core.Extensions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using HHWMS.Web.Models;
|
||||
|
||||
|
||||
namespace HHWMS.Web
|
||||
{
|
||||
public partial class TaskDetailListVM2 : BasePagedListVM<TaskDetail_View, TaskDetailSearcher>
|
||||
{
|
||||
protected override List<GridAction> InitGridAction()
|
||||
{
|
||||
return new List<GridAction>
|
||||
{
|
||||
this.MakeAction("TaskDetail","Cancel",Localizer["TaskHeader.Cancel"],Localizer["TaskHeader.Cancel"],GridActionParameterTypesEnum.SingleId,"taskManage"),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
protected override IEnumerable<IGridColumn<TaskDetail_View>> InitGridHeader()
|
||||
{
|
||||
return new List<GridColumn<TaskDetail_View>>{
|
||||
this.MakeGridHeader(x => x.TaskNo_view),
|
||||
this.MakeGridHeader(x => x.OrderCode).SetHide(),
|
||||
this.MakeGridHeader(x => x.OrderDetailId).SetHide(),
|
||||
this.MakeGridHeader(x => x.UniqueCode),
|
||||
this.MakeGridHeader(x => x.MaterialCode),
|
||||
this.MakeGridHeader(x => x.MaterialName).SetHide(),
|
||||
this.MakeGridHeader(x => x.MaterialSpec).SetHide(),
|
||||
this.MakeGridHeader(x => x.MaterialUnit).SetHide(),
|
||||
this.MakeGridHeader(x => x.Batch).SetHide(),
|
||||
this.MakeGridHeader(x => x.Lot).SetHide(),
|
||||
this.MakeGridHeader(x => x.ContainerCode),
|
||||
this.MakeGridHeader(x => x.Qty),
|
||||
this.MakeGridHeader(x => x.InventoryId).SetHide(),
|
||||
this.MakeGridHeader(x => x.FromLocation),
|
||||
this.MakeGridHeader(x => x.ToLocation),
|
||||
this.MakeGridHeader(x => x.Status),
|
||||
this.MakeGridHeaderAction(width: 200)
|
||||
};
|
||||
}
|
||||
|
||||
public override IOrderedQueryable<TaskDetail_View> GetSearchQuery()
|
||||
{
|
||||
var query = DC.Set<TaskDetail>()
|
||||
.Where(x => x.TaskHeaderId == Searcher.TaskHeaderId)
|
||||
.Select(x => new TaskDetail_View
|
||||
{
|
||||
ID = x.ID,
|
||||
TaskNo_view = $"{x.TaskHeader.TaskNo}-{x.FromLocation}",
|
||||
OrderCode = x.OrderCode,
|
||||
OrderDetailId = x.OrderDetailId,
|
||||
UniqueCode = x.UniqueCode,
|
||||
MaterialCode = x.MaterialCode,
|
||||
MaterialName = x.MaterialName,
|
||||
MaterialSpec = x.MaterialSpec,
|
||||
MaterialUnit = x.MaterialUnit,
|
||||
Batch = x.Batch,
|
||||
Lot = x.Lot,
|
||||
ContainerCode = x.ContainerCode,
|
||||
Qty = x.Qty,
|
||||
InventoryId = x.InventoryId,
|
||||
FromLocation = x.FromLocation,
|
||||
ToLocation = x.ToLocation,
|
||||
Status = x.Status,
|
||||
})
|
||||
.OrderBy(x => x.ID);
|
||||
return query;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
@@ -14,6 +14,10 @@ namespace HHWMS.Web
|
||||
{
|
||||
[Display(Name = "Inventory.UniqueCode")]
|
||||
public String UniqueCode { get; set; }
|
||||
|
||||
[Display(Name = "Task.TaskNo")]
|
||||
public int? TaskHeaderId { get; set; }
|
||||
|
||||
[Display(Name = "Inventory.MaterialCode")]
|
||||
public String MaterialCode { get; set; }
|
||||
[Display(Name = "Task.FromLocation")]
|
||||
|
||||
@@ -13,11 +13,14 @@ namespace HHWMS.Web
|
||||
public partial class TaskHeaderListVM : BasePagedListVM<TaskHeader_View, TaskHeaderSearcher>
|
||||
{
|
||||
public List<ComboSelectListItem> ZoneCodes { get; set; }
|
||||
public TaskDetailListVM2 TaskDetails { get; set; } = new TaskDetailListVM2();
|
||||
|
||||
protected override void InitVM()
|
||||
{
|
||||
var vm = Wtm.CreateVM<TaskHeaderVM>();
|
||||
ZoneCodes = vm.ZoneCodes;
|
||||
|
||||
TaskDetails.CopyContext(this);
|
||||
}
|
||||
|
||||
protected override List<GridAction> InitGridAction()
|
||||
@@ -49,7 +52,12 @@ namespace HHWMS.Web
|
||||
var data = ZoneCodes.FirstOrDefault(x => x.Value.ToString() == a.ZoneCode);
|
||||
return data?.Text ?? a.ZoneCode;
|
||||
}),
|
||||
this.MakeGridHeader(x => x.TaskNo),
|
||||
this.MakeGridHeader(x => x.TaskNo)
|
||||
.SetFormat((a,b) =>
|
||||
{
|
||||
string rv = UIService.MakeScriptButton(ButtonTypesEnum.Link,a.TaskNo,$"details('{a.ID}')");
|
||||
return rv;
|
||||
}),
|
||||
this.MakeGridHeader(x => x.TaskType),
|
||||
this.MakeGridHeader(x => x.FromLocation),
|
||||
this.MakeGridHeader(x => x.ToLocation),
|
||||
@@ -89,7 +97,7 @@ namespace HHWMS.Web
|
||||
Status = x.Status,
|
||||
ErrorMsg = x.ErrorMsg,
|
||||
})
|
||||
.OrderBy(x => x.ID);
|
||||
.OrderByDescending(x => x.ID);
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@model HHWMS.Web.TaskHeaderListVM
|
||||
@inject IStringLocalizer<Program> Localizer;
|
||||
|
||||
<wt:searchpanel vm="@Model" reset-btn="true">
|
||||
<wt:searchpanel vm="@Model" reset-btn="true" grid-id="header">
|
||||
<wt:row items-per-row="ItemsPerRowEnum.Three">
|
||||
<wt:combobox field="Searcher.ZoneCode" items="ZoneCodes" />
|
||||
<wt:textbox field="Searcher.TaskNo" />
|
||||
@@ -13,4 +13,13 @@
|
||||
<wt:combobox field="Searcher.Status" empty-text="@Localizer["Sys.All"]" />
|
||||
</wt:row>
|
||||
</wt:searchpanel>
|
||||
<wt:grid vm="@Model" url="/taskManage/TaskHeader/Search"/>
|
||||
<wt:grid vm="@Model" id="header" url="/taskManage/TaskHeader/Search" limit="7" />
|
||||
<wt:grid vm="@Model.TaskDetails" id="detail" url="/taskManage/TaskDetail/Search2" height="400" />
|
||||
|
||||
<script>
|
||||
var headerId = 0;
|
||||
function details(id) {
|
||||
headerId = id;
|
||||
layui.table.reload('detail', { where: { "Searcher.TaskHeaderId": id } });
|
||||
}
|
||||
</script>
|
||||
Reference in new issue
Block a user