任务添加zoneid

添加物料打印
添加物料工序
添加库存出库
修改状态返回接口
wcs请求添加 重量和入口
This commit is contained in:
zhougf committed 2025-07-09 01:11:10 +08:00
1 parent 42c26b2800
commit b12ed2d5e5
54 files changed
+1442 -393

No files matched your search

+51 -29
View File
@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using AutoMapper; using AutoMapper;
@@ -31,6 +32,7 @@ namespace HHWMS.Web
private readonly IMapper _mapper; private readonly IMapper _mapper;
private readonly IMemoryCache _cache; private readonly IMemoryCache _cache;
private const int DEBOUNCE_INTERVAL_MS = 1000; // 防抖间隔1秒 private const int DEBOUNCE_INTERVAL_MS = 1000; // 防抖间隔1秒
private int ContainerWeight = 500;
public IWCSController(IUnitWork unitWork, IMapper mapper, IMemoryCache cache) public IWCSController(IUnitWork unitWork, IMapper mapper, IMemoryCache cache)
{ {
@@ -133,7 +135,7 @@ namespace HHWMS.Web
private async Task<IActionResult> ProcessTaskStatusResult(WcsRequest request) private async Task<IActionResult> ProcessTaskStatusResult(WcsRequest request)
{ {
// 1. 根据托盘号查找对应的任务 // 1. 根据托盘号查找对应的任务
var task = _unitWork.FindSingle<TaskHeader>(x => x.ContainerCode == request.PalletNo var task = _unitWork.FindSingle<TaskHeader>(x => x.TaskNo == request.TaskNo
&& x.Status != TaskStatusEnum.完成); && x.Status != TaskStatusEnum.完成);
if (task == null) if (task == null)
@@ -166,7 +168,7 @@ namespace HHWMS.Web
// 根据请求的高度,分配仓位 // 根据请求的高度,分配仓位
var locationVm = Wtm.CreateVM<LocationVM>(); var locationVm = Wtm.CreateVM<LocationVM>();
request.RoadWay = 2; request.RoadWay = 2;
var container = _unitWork.FindSingle<Container>(x => x.Code == request.PalletNo); var container = _unitWork.FindSingle<Container>(x => x.Code == task.ContainerCode);
if (container != null) if (container != null)
{ {
request.LocationType = container.Type switch request.LocationType = container.Type switch
@@ -208,52 +210,72 @@ namespace HHWMS.Web
{ {
try try
{ {
// 1. 更新库存 // 更新库存
var inventories = _unitWork.Find<Inventory>(x => x.ContainerCode == request.PalletNo); var inventories = _unitWork.Find<Inventory>(x => x.ContainerCode == task.ContainerCode).ToList();
var invTrans = new List<InventoryTransaction>();
foreach (var inventory in inventories) foreach (var inventory in inventories)
{ {
// 更新库存的库位编码 var material = _unitWork.FindSingle<Material>(x => x.MaterialCode == inventory.MaterialCode);
inventory.LocationCode = task.ToLocation; inventory.LocationCode = task.ToLocation;
// 更新库存任务状态为空闲 if(task.TaskType == TaskTypeEnum.入库)
inventory.Qty = (request.Weight - ContainerWeight) / material.Qty;
inventory.TaskStatus = InventoryTaskStatusEnum.Idle; inventory.TaskStatus = InventoryTaskStatusEnum.Idle;
}
// 2. 更新容器状态
var container = _unitWork.FindSingle<Container>(x => x.Code == request.PalletNo); // 创建库存交易记录 放到任务完成,计算数量信息
var invTransaction = new InventoryTransaction
{
Type = task.TaskType == TaskTypeEnum.入库 ? InventoryTranType.入库 : InventoryTranType.出库,
ContainerCode = task.ContainerCode,
LocationCode = task.ToLocation,
MaterialCode = inventory.MaterialCode,
MaterialName = inventory.MaterialName,
MaterialSpec = inventory.MaterialSpec,
MaterialUnit = inventory.MaterialUnit,
Qty = inventory.Qty,
CreateTime = DateTime.Now
};
invTrans.Add(invTransaction);
}
_unitWork.BatchAdd(invTrans);
_unitWork.BatchUpdate(inventories);
// 更新容器状态
var container = _unitWork.FindSingle<Container>(x => x.Code == task.ContainerCode);
if (container != null) if (container != null)
{ {
// 更新容器的库位编码
container.LocationCode = task.ToLocation; container.LocationCode = task.ToLocation;
// 更新容器状态为有货
container.Status = ContainerStatus.有;
// 解除容器的任务锁
container.IsLock = ContainerLockEnum.未锁; container.IsLock = ContainerLockEnum.未锁;
container.UpdateTime = DateTime.Now;
} }
_unitWork.Update(container);
// 3. 更新库位状态 // 更新库位状态
var location = _unitWork.FindSingle<Location>(x => x.Code == task.ToLocation); var location = task.TaskType == TaskTypeEnum.入库
? _unitWork.FindSingle<Location>(x => x.Code == task.ToLocation)
: _unitWork.FindSingle<Location>(x => x.Code == task.FromLocation);
if (location != null) if (location != null)
{ {
// 更新库位的容器编码 location.ContainerCode = task.TaskType == TaskTypeEnum.入库 ? request.PalletNo : "";
location.ContainerCode = request.PalletNo; location.Status = LocationStatusEnum.未锁;
// 更新库位状态为有货 location.ContainerStatus = LocationStatus.空仓位;
location.Status = LocationStatusEnum.Some; location.UpdateTime = DateTime.Now;
} }
_unitWork.Update(location);
// 4. 更新任务状态为完成 // 更新任务状态为完成
task.Status = TaskStatusEnum.完成; task.Status = TaskStatusEnum.完成;
// 5. 保存所有更改 // 将任务复制到历史任务表
_unitWork.Save();
// 6. 将任务复制到历史任务表
var taskHistory = _mapper.Map<TaskHeaderHistory>(task); var taskHistory = _mapper.Map<TaskHeaderHistory>(task);
_unitWork.Add(taskHistory); _unitWork.Add(taskHistory);
// 7. 删除原任务 // 删除原任务
_unitWork.Delete(task); _unitWork.Delete(task);
// 8. 提交事务 // 提交事务
await transaction.CommitAsync(); await transaction.CommitAsync();
} }
catch (System.Exception ex) catch (System.Exception ex)
@@ -281,7 +303,7 @@ namespace HHWMS.Web
return Task.FromResult<IActionResult>(ApiResultError("巷道不能为空")); return Task.FromResult<IActionResult>(ApiResultError("巷道不能为空"));
} }
return WithDebounce($"RequestLocation_{request.PalletNo}", () => return WithDebounce($"RequestLocation_{request.TaskNo}", () =>
{ {
var vm = Wtm.CreateVM<LocationVM>(); var vm = Wtm.CreateVM<LocationVM>();
var code = vm.GetLocation(request); var code = vm.GetLocation(request);
@@ -321,11 +343,11 @@ namespace HHWMS.Web
var container = _unitWork.Find<Container>(x => x.Code == palletNo).FirstOrDefault(); var container = _unitWork.Find<Container>(x => x.Code == palletNo).FirstOrDefault();
if (container != null) if (container != null)
{ {
container.LocationCode = location.Code; container.LocationCode = location?.Code;
_unitWork.Update(container); _unitWork.Update(container);
} }
return ApiResult(new { LocationCode = location.Code }); return ApiResult(new { LocationCode = location?.Code });
} }
} }
} }
@@ -269,7 +269,8 @@ namespace HHWMS.Web.Controllers
RowFlag = (vm.RoadwayType == 1 || vm.RoadwayType == 2 ? RowFlagEnum.Outer : (row == 1 || row == 4 ? RowFlagEnum.Inner : RowFlagEnum.Outer)), RowFlag = (vm.RoadwayType == 1 || vm.RoadwayType == 2 ? RowFlagEnum.Outer : (row == 1 || row == 4 ? RowFlagEnum.Inner : RowFlagEnum.Outer)),
ContiguousCode = vm.RoadwayType == 4 ? $"{vm.Entity.Type}{vm.Entity.RoadWay.ToString().PadLeft(2, '0')}-{(row % 2 == 0?row-1:row+1) .ToString().PadLeft(2, '0')}-{line.ToString().PadLeft(2, '0')}-{layer.ToString().PadLeft(2, '0')}" : null, ContiguousCode = vm.RoadwayType == 4 ? $"{vm.Entity.Type}{vm.Entity.RoadWay.ToString().PadLeft(2, '0')}-{(row % 2 == 0?row-1:row+1) .ToString().PadLeft(2, '0')}-{line.ToString().PadLeft(2, '0')}-{layer.ToString().PadLeft(2, '0')}" : null,
IsStop = false, IsStop = false,
Status = LocationStatusEnum.Empty, Status = LocationStatusEnum.未锁,
ContainerStatus = LocationStatus.空仓位,
Length = vm.Entity.Length, Length = vm.Entity.Length,
Width = vm.Entity.Width, Width = vm.Entity.Width,
Height = vm.Entity.Height Height = vm.Entity.Height
@@ -224,5 +224,12 @@ namespace HHWMS.Web.Controllers
} }
#endregion #endregion
[HttpGet]
public IActionResult GetUniqueCode()
{
var sn = _unitWork.GetSerialNumber("M", 6);
return Json(sn);
}
} }
} }
@@ -0,0 +1,228 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Mvc;
using WalkingTec.Mvvm.Core.Extensions;
using HHWMS.Web;
namespace HHWMS.Web.Controllers
{
[Area("configs")]
[ActionDescription("物料工序")]
public partial class MaterialProcessController : BaseController
{
private readonly IUnitWork _unitWork;
public MaterialProcessController(IUnitWork unitWork)
{
_unitWork = unitWork;
}
#region Search
[ActionDescription("Sys.Search")]
public ActionResult Index()
{
var vm = Wtm.CreateVM<MaterialProcessListVM>();
return PartialView(vm);
}
[ActionDescription("Sys.Search")]
[HttpPost]
public string Search(MaterialProcessSearcher searcher)
{
var vm = Wtm.CreateVM<MaterialProcessListVM>(passInit: true);
if (ModelState.IsValid)
{
vm.Searcher = searcher;
return vm.GetJson(false);
}
else
{
return vm.GetError();
}
}
#endregion
#region Create
[ActionDescription("Sys.Create")]
public ActionResult Create()
{
var vm = Wtm.CreateVM<MaterialProcessVM>();
return PartialView(vm);
}
[HttpPost]
[ActionDescription("Sys.Create")]
public ActionResult Create(MaterialProcessVM vm)
{
if (!ModelState.IsValid)
{
return PartialView(vm);
}
else
{
vm.DoAdd();
if (!ModelState.IsValid)
{
vm.DoReInit();
return PartialView(vm);
}
else
{
return FFResult().CloseDialog().RefreshGrid();
}
}
}
#endregion
#region Edit
[ActionDescription("Sys.Edit")]
public ActionResult Edit(string id)
{
var vm = Wtm.CreateVM<MaterialProcessVM>(id);
return PartialView(vm);
}
[ActionDescription("Sys.Edit")]
[HttpPost]
[ValidateFormItemOnly]
public ActionResult Edit(MaterialProcessVM vm)
{
if (!ModelState.IsValid)
{
return PartialView(vm);
}
else
{
vm.DoEdit();
if (!ModelState.IsValid)
{
vm.DoReInit();
return PartialView(vm);
}
else
{
return FFResult().CloseDialog().RefreshGridRow(vm.Entity.ID);
}
}
}
#endregion
#region Delete
[ActionDescription("Sys.Delete")]
public ActionResult Delete(string id)
{
var vm = Wtm.CreateVM<MaterialProcessVM>(id);
return PartialView(vm);
}
[ActionDescription("Sys.Delete")]
[HttpPost]
public ActionResult Delete(string id, IFormCollection nouse)
{
var vm = Wtm.CreateVM<MaterialProcessVM>(id);
vm.DoDelete();
if (!ModelState.IsValid)
{
return PartialView(vm);
}
else
{
return FFResult().CloseDialog().RefreshGrid();
}
}
#endregion
#region Details
[ActionDescription("Sys.Details")]
public ActionResult Details(string id)
{
var vm = Wtm.CreateVM<MaterialProcessVM>(id);
return PartialView(vm);
}
#endregion
#region BatchEdit
[HttpPost]
[ActionDescription("Sys.BatchEdit")]
public ActionResult BatchEdit(string[] IDs)
{
var vm = Wtm.CreateVM<MaterialProcessBatchVM>(Ids: IDs);
return PartialView(vm);
}
[HttpPost]
[ActionDescription("Sys.BatchEdit")]
public ActionResult DoBatchEdit(MaterialProcessBatchVM vm, IFormCollection nouse)
{
if (!ModelState.IsValid || !vm.DoBatchEdit())
{
return PartialView("BatchEdit",vm);
}
else
{
return FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.BatchEditSuccess", vm.Ids.Length]);
}
}
#endregion
#region BatchDelete
[HttpPost]
[ActionDescription("Sys.BatchDelete")]
public ActionResult BatchDelete(string[] IDs)
{
var vm = Wtm.CreateVM<MaterialProcessBatchVM>(Ids: IDs);
return PartialView(vm);
}
[HttpPost]
[ActionDescription("Sys.BatchDelete")]
public ActionResult DoBatchDelete(MaterialProcessBatchVM vm, IFormCollection nouse)
{
if (!ModelState.IsValid || !vm.DoBatchDelete())
{
return PartialView("BatchDelete",vm);
}
else
{
return FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.BatchDeleteSuccess", vm.Ids.Length]);
}
}
#endregion
#region Import
[ActionDescription("Sys.Import")]
public ActionResult Import()
{
var vm = Wtm.CreateVM<MaterialProcessImportVM>();
return PartialView(vm);
}
[HttpPost]
[ActionDescription("Sys.Import")]
public ActionResult Import(MaterialProcessImportVM vm, IFormCollection nouse)
{
if (vm.ErrorListVM.EntityList.Count > 0 || !vm.BatchSaveData())
{
return PartialView(vm);
}
else
{
return FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.ImportSuccess", vm.EntityList.Count.ToString()]);
}
}
#endregion
#region Export
[ActionDescription("Sys.Export")]
[HttpPost]
public IActionResult ExportExcel(MaterialProcessListVM vm)
{
return vm.GetExportData();
}
#endregion
}
}
@@ -14,7 +14,7 @@ namespace HHWMS.Web
public partial class LocationVM : BaseCRUDVM<Location> public partial class LocationVM : BaseCRUDVM<Location>
{ {
public List<ComboSelectListItem> AllLocationZones { get; set; } public List<ComboSelectListItem> AllLocationZones { get; set; }
[Display(Name = "Location.BeginLine", Description = "起始列")] [Display(Name = "Location.BeginLine", Description = "起始列")]
public short BeginLine { get; set; } public short BeginLine { get; set; }
@@ -24,6 +24,7 @@ namespace HHWMS.Web
[Display(Name = "Location.RoadwayType", Description = "巷道类型")] [Display(Name = "Location.RoadwayType", Description = "巷道类型")]
[Required(ErrorMessage = "Validate.{0}required")] [Required(ErrorMessage = "Validate.{0}required")]
public short RoadwayType { get; set; } public short RoadwayType { get; set; }
public List<ComboSelectListItem> RoadwayTypes { get; set; } public List<ComboSelectListItem> RoadwayTypes { get; set; }
@@ -35,7 +36,7 @@ namespace HHWMS.Web
protected override void InitVM() protected override void InitVM()
{ {
AllLocationZones = DC.Set<LocationZone>().GetSelectListItems(Wtm, y => y.Name); AllLocationZones = DC.Set<LocationZone>().GetSelectListItems(Wtm, y => y.Name);
var currentCulture = Wtm.CurrentCulture; var currentCulture = Wtm.CurrentCulture;
var dictData = DC.Set<SysDictData>().ToList(); var dictData = DC.Set<SysDictData>().ToList();
RoadwayTypes = dictData.Where(x => x.DictType == "RoadwayType").Select(x => new ComboSelectListItem RoadwayTypes = dictData.Where(x => x.DictType == "RoadwayType").Select(x => new ComboSelectListItem
@@ -43,13 +44,12 @@ namespace HHWMS.Web
Text = currentCulture == "zh" ? x.DictLabel : x.DictLabelUs, Text = currentCulture == "zh" ? x.DictLabel : x.DictLabelUs,
Value = x.DictValue Value = x.DictValue
}).ToList(); }).ToList();
} }
#region base #region base
public override void DoAdd() public override void DoAdd()
{ {
base.DoAdd(); base.DoAdd();
} }
@@ -62,18 +62,20 @@ namespace HHWMS.Web
{ {
base.DoDelete(); base.DoDelete();
} }
#endregion base #endregion base
/// <summary> /// <summary>
/// 查找单伸位巷道的空仓位 /// 查找单伸位巷道的空仓位
/// </summary> /// </summary>
private string GetEmptyLocationBySingle(int? roadway) private string GetEmptyLocationBySingle(int? roadway)
{ {
var locations = DC.Set<Location>() var locations = DC.Set<Location>()
.Where(l => l.RoadWay == roadway .Where(l => l.RoadWay == roadway
&& !l.IsStop && !l.IsStop
&& l.Status == LocationStatusEnum.Empty && l.Status == LocationStatusEnum.未锁
&& l.RowFlag == 0) // 单伸位只查找外仓位 && l.ContainerStatus == LocationStatus.空仓位
&& l.RowFlag == 0) // 单伸位只查找外仓位
.OrderBy(l => l.Layer) .OrderBy(l => l.Layer)
.ThenBy(l => l.Line) .ThenBy(l => l.Line)
.AsNoTracking() .AsNoTracking()
@@ -85,7 +87,7 @@ namespace HHWMS.Web
/// <summary> /// <summary>
/// 查找双伸位巷道的空仓位 /// 查找双伸位巷道的空仓位
/// </summary> /// </summary>
private string GetEmptyLocationByDouble(int roadway,LocationTypeEnum locationType, decimal? height = 0) private string GetEmptyLocationByDouble(int roadway, LocationTypeEnum locationType, decimal? height = 0)
{ {
// 一次性获取所需的所有数据,避免多次查询数据库 // 一次性获取所需的所有数据,避免多次查询数据库
var locationPairs = DC.Set<Location>() var locationPairs = DC.Set<Location>()
@@ -93,11 +95,12 @@ namespace HHWMS.Web
&& l.Type == locationType && l.Type == locationType
&& !l.IsStop && !l.IsStop
&& l.Height >= height) && l.Height >= height)
.Select(l => new .Select(l => new
{ {
l.Code, l.Code,
l.ContiguousCode, l.ContiguousCode,
l.Status, l.Status,
l.ContainerStatus,
l.RowFlag, l.RowFlag,
l.Height, l.Height,
l.Layer, l.Layer,
@@ -108,10 +111,12 @@ namespace HHWMS.Web
// 1. 优先查找里外仓位都为空的里仓位 // 1. 优先查找里外仓位都为空的里仓位
var emptyInnerLocation = locationPairs.Values var emptyInnerLocation = locationPairs.Values
.Where(l => l.RowFlag == RowFlagEnum.Inner .Where(l => l.RowFlag == RowFlagEnum.Inner
&& l.Status == LocationStatusEnum.Empty && l.Status == LocationStatusEnum.未锁
&& locationPairs.TryGetValue(l.ContiguousCode, out var outer) && l.ContainerStatus == LocationStatus.空仓位
&& outer.Status == LocationStatusEnum.Empty) && locationPairs.TryGetValue(l.ContiguousCode, out var outer)
&& outer.Status == LocationStatusEnum.未锁
&& outer.ContainerStatus == LocationStatus.空仓位)
.OrderBy(l => l.Height) .OrderBy(l => l.Height)
.ThenBy(l => l.Layer) .ThenBy(l => l.Layer)
.ThenBy(l => l.Line) .ThenBy(l => l.Line)
@@ -124,10 +129,12 @@ namespace HHWMS.Web
// 2. 查找里仓位有货,外仓位为空的外仓位 // 2. 查找里仓位有货,外仓位为空的外仓位
var availableOuterLocation = locationPairs.Values var availableOuterLocation = locationPairs.Values
.Where(l => l.RowFlag == 0 .Where(l => l.RowFlag == 0
&& l.Status == LocationStatusEnum.Empty && l.Status == LocationStatusEnum.未锁
&& locationPairs.TryGetValue(l.ContiguousCode, out var inner) && l.ContainerStatus == LocationStatus.空仓位
&& inner.Status == LocationStatusEnum.Some) && locationPairs.TryGetValue(l.ContiguousCode, out var inner)
&& inner.Status == LocationStatusEnum.未锁
&& inner.ContainerStatus == LocationStatus.有货)
.OrderBy(l => l.Height) .OrderBy(l => l.Height)
.ThenBy(l => l.Layer) .ThenBy(l => l.Layer)
.ThenBy(l => l.Line) .ThenBy(l => l.Line)
@@ -161,7 +168,8 @@ namespace HHWMS.Web
locationCode = GetEmptyLocationBySingle(request.RoadWay.Value); locationCode = GetEmptyLocationBySingle(request.RoadWay.Value);
break; break;
case 4: // 双伸位 case 4: // 双伸位
locationCode = GetEmptyLocationByDouble(request.RoadWay.Value, request.LocationType, request.Height); locationCode =
GetEmptyLocationByDouble(request.RoadWay.Value, request.LocationType, request.Height);
break; break;
default: default:
return ResponseResult<dynamic>.Error("未知的巷道类型"); return ResponseResult<dynamic>.Error("未知的巷道类型");
@@ -175,6 +183,40 @@ namespace HHWMS.Web
return ResponseResult<dynamic>.Success(new { LocationCode = locationCode }); return ResponseResult<dynamic>.Success(new { LocationCode = locationCode });
} }
/// <summary>
/// 线边库查找空仓位
/// </summary>
public string GetEmptyLocationFromXb(int beginLine, int endLine)
{
var location = DC.Set<Location>()
.Where(l => l.Type == LocationTypeEnum.X
&& !l.IsStop
&& l.Status == LocationStatusEnum.未锁
&& l.ContainerStatus == LocationStatus.空仓位
&& l.RowFlag == 0
&& (l.Line >= beginLine && l.Line <= endLine)) // 单伸位只查找外仓位
.OrderBy(l => l.Layer)
.ThenBy(l => l.Line)
.AsNoTracking()
.FirstOrDefault();
// 没查找合适的就找靠近的此区域的
if (location == null)
{
location = DC.Set<Location>()
.Where(l => l.Type == LocationTypeEnum.X
&& !l.IsStop
&& l.Status == LocationStatusEnum.未锁
&& l.ContainerStatus == LocationStatus.空仓位
&& l.RowFlag == 0) // 单伸位只查找外仓位
.OrderBy(l => Math.Abs(l.Line - (endLine - beginLine) / 2))
.ThenBy(l => l.Layer)
.AsNoTracking()
.FirstOrDefault();
}
return location?.Code;
}
/// <summary> /// <summary>
/// 根据巷道名称获取巷道类型 /// 根据巷道名称获取巷道类型
/// </summary> /// </summary>
@@ -204,10 +246,10 @@ namespace HHWMS.Web
// 获取所有巷道配置 // 获取所有巷道配置
var roadwayConfigs = DC.Set<SysDictData>() var roadwayConfigs = DC.Set<SysDictData>()
.Where(x => x.DictType == "RoadwayConfig") .Where(x => x.DictType == "RoadwayConfig")
.Select(x => new .Select(x => new
{ {
Roadway = x.DictLabel, Roadway = x.DictLabel,
Type = x.DictValue Type = x.DictValue
}) })
.ToDictionary(x => x.Roadway, x => x.Type); .ToDictionary(x => x.Roadway, x => x.Type);
@@ -223,6 +265,7 @@ namespace HHWMS.Web
l.Code, l.Code,
l.ContiguousCode, l.ContiguousCode,
l.Status, l.Status,
l.ContainerStatus,
l.RowFlag, l.RowFlag,
l.Layer, l.Layer,
l.Line, l.Line,
@@ -250,7 +293,9 @@ namespace HHWMS.Web
{ {
case "2": // 单伸位 case "2": // 单伸位
var singleLocations = roadwayLocations var singleLocations = roadwayLocations
.Where(l => l.RowFlag == 0 && l.Status == LocationStatusEnum.Empty) .Where(l => l.RowFlag == 0
&& l.Status == LocationStatusEnum.未锁
&& l.ContainerStatus == LocationStatus.空仓位)
.OrderBy(l => l.Layer) .OrderBy(l => l.Layer)
.ThenBy(l => l.Line) .ThenBy(l => l.Line)
.Select(l => new .Select(l => new
@@ -267,10 +312,12 @@ namespace HHWMS.Web
case "4": // 双伸位 case "4": // 双伸位
// 1. 查找里外都为空的里仓位 // 1. 查找里外都为空的里仓位
var emptyInnerLocations = roadwayLocations var emptyInnerLocations = roadwayLocations
.Where(l => l.RowFlag == RowFlagEnum.Inner .Where(l => l.RowFlag == RowFlagEnum.Inner
&& l.Status == LocationStatusEnum.Empty && l.Status == LocationStatusEnum.未锁
&& allLocations.TryGetValue(l.ContiguousCode, out var outer) && l.ContainerStatus == LocationStatus.空仓位
&& outer.Status == LocationStatusEnum.Empty) && allLocations.TryGetValue(l.ContiguousCode, out var outer)
&& outer.Status == LocationStatusEnum.未锁
&& outer.ContainerStatus == LocationStatus.空仓位)
.OrderBy(l => l.Layer) .OrderBy(l => l.Layer)
.ThenBy(l => l.Line) .ThenBy(l => l.Line)
.Select(l => new .Select(l => new
@@ -285,10 +332,12 @@ namespace HHWMS.Web
// 2. 查找里仓位有货,外仓位为空的外仓位 // 2. 查找里仓位有货,外仓位为空的外仓位
var availableOuterLocations = roadwayLocations var availableOuterLocations = roadwayLocations
.Where(l => l.RowFlag == 0 .Where(l => l.RowFlag == 0
&& l.Status == LocationStatusEnum.Empty && l.Status == LocationStatusEnum.未锁
&& allLocations.TryGetValue(l.ContiguousCode, out var inner) && l.ContainerStatus == LocationStatus.空仓位
&& inner.Status == LocationStatusEnum.Some) && allLocations.TryGetValue(l.ContiguousCode, out var inner)
&& inner.Status == LocationStatusEnum.未锁
&& inner.ContainerStatus == LocationStatus.有货)
.OrderBy(l => l.Layer) .OrderBy(l => l.Layer)
.ThenBy(l => l.Line) .ThenBy(l => l.Line)
.Select(l => new .Select(l => new
@@ -309,8 +358,8 @@ namespace HHWMS.Web
return ResponseResult<dynamic>.Error("未找到可用的空仓位"); return ResponseResult<dynamic>.Error("未找到可用的空仓位");
} }
return ResponseResult<dynamic>.Success(new return ResponseResult<dynamic>.Success(new
{ {
Locations = availableLocations, Locations = availableLocations,
Total = availableLocations.Count Total = availableLocations.Count
}); });
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using HHWMS.Web.Models;
namespace HHWMS.Web
{
public partial class MaterialProcessBatchVM : BaseBatchVM<MaterialProcess, MaterialProcess_BatchEdit>
{
public MaterialProcessBatchVM()
{
ListVM = new MaterialProcessListVM();
LinkedVM = new MaterialProcess_BatchEdit();
}
}
/// <summary>
/// Class to define batch edit fields
/// </summary>
public class MaterialProcess_BatchEdit : BaseVM
{
protected override void InitVM()
{
}
}
}
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using HHWMS.Web.Models;
namespace HHWMS.Web
{
public partial class MaterialProcessTemplateVM : BaseTemplateVM
{
[Display(Name = "MaterialProcess.MaterialCode")]
public ExcelPropety MaterialCode_Excel = ExcelPropety.CreateProperty<MaterialProcess>(x => x.MaterialCode);
[Display(Name = "MaterialProcess.ProcessOrder")]
public ExcelPropety ProcessOrder_Excel = ExcelPropety.CreateProperty<MaterialProcess>(x => x.ProcessOrder);
[Display(Name = "MaterialProcess.ProcessName")]
public ExcelPropety ProcessName_Excel = ExcelPropety.CreateProperty<MaterialProcess>(x => x.ProcessName);
[Display(Name = "MaterialProcess.ProcessCode")]
public ExcelPropety ProcessCode_Excel = ExcelPropety.CreateProperty<MaterialProcess>(x => x.ProcessCode);
[Display(Name = "MaterialProcess.Description")]
public ExcelPropety Description_Excel = ExcelPropety.CreateProperty<MaterialProcess>(x => x.Description);
[Display(Name = "MaterialProcess.IsActive")]
public ExcelPropety IsActive_Excel = ExcelPropety.CreateProperty<MaterialProcess>(x => x.IsActive);
protected override void InitVM()
{
}
}
public class MaterialProcessImportVM : BaseImportVM<MaterialProcessTemplateVM, MaterialProcess>
{
}
}
@@ -0,0 +1,72 @@
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 MaterialProcessListVM : BasePagedListVM<MaterialProcess_View, MaterialProcessSearcher>
{
protected override List<GridAction> InitGridAction()
{
return new List<GridAction>
{
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"configs", dialogWidth: 800),
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "configs", dialogWidth: 800),
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "configs", dialogWidth: 800),
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "configs", dialogWidth: 800),
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.BatchEdit, Localizer["Sys.BatchEdit"], "configs", dialogWidth: 800),
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "configs", dialogWidth: 800),
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "configs", dialogWidth: 800),
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "configs"),
};
}
protected override IEnumerable<IGridColumn<MaterialProcess_View>> InitGridHeader()
{
return new List<GridColumn<MaterialProcess_View>>{
this.MakeGridHeader(x => x.MaterialCode),
this.MakeGridHeader(x => x.ProcessOrder),
this.MakeGridHeader(x => x.ProcessName),
this.MakeGridHeader(x => x.ProcessCode),
this.MakeGridHeader(x => x.Description),
this.MakeGridHeader(x => x.IsActive),
this.MakeGridHeaderAction(width: 200)
};
}
public override IOrderedQueryable<MaterialProcess_View> GetSearchQuery()
{
var query = DC.Set<MaterialProcess>()
.CheckContain(Searcher.MaterialCode, x=>x.MaterialCode)
.CheckEqual(Searcher.ProcessOrder, x=>x.ProcessOrder)
.CheckContain(Searcher.ProcessName, x=>x.ProcessName)
.CheckContain(Searcher.ProcessCode, x=>x.ProcessCode)
.CheckContain(Searcher.Description, x=>x.Description)
.Select(x => new MaterialProcess_View
{
ID = x.ID,
MaterialCode = x.MaterialCode,
ProcessOrder = x.ProcessOrder,
ProcessName = x.ProcessName,
ProcessCode = x.ProcessCode,
Description = x.Description,
IsActive = x.IsActive,
})
.OrderBy(x => x.ID);
return query;
}
}
public class MaterialProcess_View : MaterialProcess{
}
}
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using HHWMS.Web.Models;
namespace HHWMS.Web
{
public partial class MaterialProcessSearcher : BaseSearcher
{
[Display(Name = "MaterialProcess.MaterialCode")]
public String MaterialCode { get; set; }
[Display(Name = "MaterialProcess.ProcessOrder")]
public Int32? ProcessOrder { get; set; }
[Display(Name = "MaterialProcess.ProcessName")]
public String ProcessName { get; set; }
[Display(Name = "MaterialProcess.ProcessCode")]
public String ProcessCode { get; set; }
[Display(Name = "MaterialProcess.Description")]
public String Description { get; set; }
protected override void InitVM()
{
}
}
}
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using HHWMS.Web.Models;
namespace HHWMS.Web
{
public partial class MaterialProcessVM : BaseCRUDVM<MaterialProcess>
{
public MaterialProcessVM()
{
}
protected override void InitVM()
{
}
public override void DoAdd()
{
base.DoAdd();
}
public override void DoEdit(bool updateAllFields = false)
{
base.DoEdit(updateAllFields);
}
public override void DoDelete()
{
base.DoDelete();
}
}
}
@@ -25,6 +25,8 @@ namespace HHWMS.Web
this.MakeStandardAction("Material", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "configs", dialogWidth: 800), this.MakeStandardAction("Material", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "configs", dialogWidth: 800),
this.MakeStandardAction("Material", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "configs", dialogWidth: 800), this.MakeStandardAction("Material", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "configs", dialogWidth: 800),
this.MakeStandardAction("Material", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "configs"), this.MakeStandardAction("Material", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "configs"),
this.MakeAction("Material","Print",Localizer["Sys.Print"],"",GridActionParameterTypesEnum.MultiIds,"configs")
.SetShowDialog(false).SetOnClickScript("print"),
}; };
} }
@@ -12,3 +12,27 @@
</wt:row> </wt:row>
</wt:searchpanel> </wt:searchpanel>
<wt:grid vm="@Model" url="/configs/Material/Search"/> <wt:grid vm="@Model" url="/configs/Material/Search"/>
<script>
let template =
{"panels":[{"index":0,"height":60,"width":100,"paperHeader":43.5,"paperFooter":170.07874015748033,"printElements":[{"options":{"left":22.5,"top":30,"height":22.5,"width":139.5,"title":"编码","field":"MaterialCode","testData":"code","textContentVerticalAlign":"middle"},"printElementType":{"type":"text"}},{"options":{"left":22.5,"top":73.5,"height":22.5,"width":138,"title":"图号","field":"MaterialType","testData":"tuhao","textContentVerticalAlign":"middle"},"printElementType":{"type":"text"}},{"options":{"left":22.5,"top":117,"height":22.5,"width":138,"title":"名称","field":"MaterialName","testData":"name","textContentVerticalAlign":"middle"},"printElementType":{"type":"text"}},{"options":{"left":189,"top":52.5,"height":63,"width":75,"field":"MaterialCode","testData":"code","textType":"qrcode"},"printElementType":{"type":"text"}}],"paperNumberLeft":253.5,"paperNumberTop":148.5,"paperNumberDisabled":true}]}
let printData = [];
function print(ids, datas) {
datas.forEach(function (value, index, arr) {
printData.push({
MaterialCode: value.MaterialCode,
MaterialType: value.MaterialType,
MaterialName: value.MaterialName,
})
});
hiprint.init();
var hiprintTemplate = new hiprint.PrintTemplate({
template: template
});
hiprintTemplate.print(printData);
printData = [];
}
</script>
@@ -0,0 +1,12 @@
@model HHWMS.Web.MaterialProcessBatchVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:quote>@Localizer["Sys.BatchDeleteConfirm"]</wt:quote>
<wt:hidden field="Ids" />
<wt:grid vm="ListVM" use-local-data="true" height="300" hidden-checkbox="true" hidden-panel="true"/>
<wt:row align="AlignEnum.Right">
<wt:submitbutton theme=" ButtonThemeEnum.Warm" text="@Localizer["Sys.Delete"]"/>
<wt:closebutton />
</wt:row>
</wt:form>
@@ -0,0 +1,14 @@
@model HHWMS.Web.MaterialProcessBatchVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<div style="margin-bottom:10px">@Localizer["Sys.BatchEditConfirm"] </div>
<wt:row items-per-row="ItemsPerRowEnum.Two">
</wt:row>
<wt:hidden field="Ids" />
<wt:grid vm="ListVM" use-local-data="true" height="300" hidden-checkbox="true" hidden-panel="true"/>
<wt:row align="AlignEnum.Right">
<wt:submitbutton />
<wt:closebutton />
</wt:row>
</wt:form>
@@ -0,0 +1,17 @@
@model HHWMS.Web.MaterialProcessVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:textbox field="Entity.MaterialCode" />
<wt:textbox field="Entity.ProcessOrder" />
<wt:textbox field="Entity.ProcessName" />
<wt:textbox field="Entity.ProcessCode" />
<wt:textbox field="Entity.Description" />
<wt:switch field="Entity.IsActive" />
</wt:row>
<wt:row align="AlignEnum.Right">
<wt:submitbutton />
<wt:closebutton />
</wt:row>
</wt:form>
@@ -0,0 +1,19 @@
@model HHWMS.Web.MaterialProcessVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:quote>@Localizer["Sys.DeleteConfirm"]</wt:quote>
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:display field="Entity.MaterialCode" />
<wt:display field="Entity.ProcessOrder" />
<wt:display field="Entity.ProcessName" />
<wt:display field="Entity.ProcessCode" />
<wt:display field="Entity.Description" />
<wt:display field="Entity.IsActive" />
</wt:row>
<wt:hidden field="Entity.ID" />
<wt:row align="AlignEnum.Right">
<wt:submitbutton theme=" ButtonThemeEnum.Warm" text="@Localizer["Sys.Delete"]"/>
<wt:closebutton />
</wt:row>
</wt:form>
@@ -0,0 +1,16 @@
@model HHWMS.Web.MaterialProcessVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:display field="Entity.MaterialCode" />
<wt:display field="Entity.ProcessOrder" />
<wt:display field="Entity.ProcessName" />
<wt:display field="Entity.ProcessCode" />
<wt:display field="Entity.Description" />
<wt:display field="Entity.IsActive" />
</wt:row>
<wt:row align="AlignEnum.Right">
<wt:closebutton />
</wt:row>
</wt:form>
@@ -0,0 +1,18 @@
@model HHWMS.Web.MaterialProcessVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:textbox field="Entity.MaterialCode" />
<wt:textbox field="Entity.ProcessOrder" />
<wt:textbox field="Entity.ProcessName" />
<wt:textbox field="Entity.ProcessCode" />
<wt:textbox field="Entity.Description" />
<wt:switch field="Entity.IsActive" />
</wt:row>
<wt:hidden field="Entity.ID" />
<wt:row align="AlignEnum.Right">
<wt:submitbutton />
<wt:closebutton />
</wt:row>
</wt:form>
@@ -0,0 +1,14 @@
@model HHWMS.Web.MaterialProcessImportVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:row align="AlignEnum.Right">
<wt:downloadTemplateButton vm="@Model" />
</wt:row>
<wt:upload field="UploadFileId" label-text="@Model.Localizer["Sys.UploadTemplate"]" upload-type="ExcelFile" />
<wt:grid vm="ErrorListVM" use-local-data="true" hidden-checkbox="true" hidden-grid-index="true" hidden-panel="true" height="300"/>
<wt:row align="AlignEnum.Right">
<wt:submitbutton />
<wt:closebutton />
</wt:row>
</wt:form>
@@ -0,0 +1,13 @@
@model HHWMS.Web.MaterialProcessListVM
@inject IStringLocalizer<Program> Localizer;
<wt:searchpanel vm="@Model" reset-btn="true">
<wt:row items-per-row="ItemsPerRowEnum.Three">
<wt:textbox field="Searcher.MaterialCode" />
<wt:textbox field="Searcher.ProcessOrder" />
<wt:textbox field="Searcher.ProcessName" />
<wt:textbox field="Searcher.ProcessCode" />
<wt:textbox field="Searcher.Description" />
</wt:row>
</wt:searchpanel>
<wt:grid vm="@Model" url="/configs/MaterialProcess/Search"/>
@@ -5,6 +5,7 @@ using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Mvc; using WalkingTec.Mvvm.Mvc;
using WalkingTec.Mvvm.Core.Extensions; using WalkingTec.Mvvm.Core.Extensions;
using HHWMS.Web; using HHWMS.Web;
using HHWMS.Web.Models;
namespace HHWMS.Web.Controllers namespace HHWMS.Web.Controllers
{ {
@@ -224,5 +225,125 @@ namespace HHWMS.Web.Controllers
} }
#endregion #endregion
#region InvOut 出库
[ActionDescription("TaskType.Out")]
public ActionResult InvOut(string id)
{
var vm = Wtm.CreateVM<InventoryVM>(id);
if (vm.Entity.TaskStatus == InventoryTaskStatusEnum.Locked)
{
return FFResult().Alert("所选库存已被锁定!,请检查后重试!").RefreshGrid();
}
return PartialView(vm);
}
[HttpPost]
[ActionDescription("TaskType.Out")]
public ActionResult InvOut(InventoryVM vm)
{
var id = vm.Entity.ID;
// 校验参数
if (string.IsNullOrWhiteSpace(vm.OutPort))
{
return FFResult().Alert("出口必选,请选择后重试!");
}
// 校验库存
var inv = _unitWork.FindSingle<Inventory>(x => x.ID == id);
if (inv == null)
{
return FFResult().CloseDialog().Alert("所选库存不存在,请检查后重试!").RefreshGrid();
}
if (inv.TaskStatus == InventoryTaskStatusEnum.Locked)
{
return FFResult().CloseDialog().Alert("所选库存已被锁定!,请检查后重试!").RefreshGrid();
}
// 校验容器
var container = _unitWork.FindSingle<Container>(x => x.Code == inv.ContainerCode);
if (container == null)
{
return FFResult().CloseDialog().Alert("所选库存的容器不存在,请检查后重试!").RefreshGrid();
}
if (container.IsLock == ContainerLockEnum.任务锁)
{
return FFResult().CloseDialog().Alert("库存所在容器已被锁定!,请检查后重试!").RefreshGrid();
}
// 校验库位
var location = _unitWork.FindSingle<Location>(x => x.Code == inv.LocationCode);
if (location == null)
{
return FFResult().CloseDialog().Alert("所选库存不在库内,请检查后重试!").RefreshGrid();
}
if (location.Status == LocationStatusEnum.锁定)
{
return FFResult().CloseDialog().Alert("库存所在仓位已被锁定!,请检查后重试!").RefreshGrid();
}
// 创建任务
var task = new TaskHeader()
{
TaskNo = _unitWork.GetSerialNumber("Out", 6),
ZoneId = inv.ZoneId,
TaskType = TaskTypeEnum.出库,
FromLocation = inv.LocationCode,
ToLocation = vm.OutPort,
ContainerCode = inv.ContainerCode,
RoadWay = 1,
Status = TaskStatusEnum.新建,
CreateBy = Wtm.LoginUserInfo.ITCode,
CreateTime = DateTime.Now
};
// 6. 调用WCS接口下发任务
var wcsTaskModel = new WCSTaskModel
{
TaskNo = task.TaskNo,
PalletNo = task.ContainerCode,
FromLocation = task.FromLocation, // 入库任务起始位置为空
ToLocation = task.ToLocation,
};
//调用WCS任务下发接口
var wcsResult = Wtm.CallAPI<WCSTaskResponse>("WCSXB", "TaskAssign", HttpMethodEnum.POST, wcsTaskModel).Result.Data;
if (wcsResult != null && wcsResult.Success)
{
// WCS任务下发成功
task.Status = TaskStatusEnum.已下发;
_unitWork.Add(task);
// 更新库存
inv.TaskStatus = InventoryTaskStatusEnum.Locked;
inv.UpdateTime = DateTime.Now;
_unitWork.Update(inv);
// 更新容器
// _unitWork.BatchUpdate<Container>(x => x.Code == task.ContainerCode, x => new Container()
// {
// IsLock = ContainerLockEnum.任务锁,
// UpdateTime = DateTime.Now
// });
container.IsLock = ContainerLockEnum.任务锁;
container.UpdateTime = DateTime.Now;
_unitWork.Update(container);
// 更新库位
location.Status = LocationStatusEnum.锁定;
location.UpdateTime = DateTime.Now;
_unitWork.Update(location);
return FFResult().CloseDialog().Message("出库任务创建成功").RefreshGrid();
}
else
{
// WCS任务下发失败
return FFResult().CloseDialog().Message(wcsResult?.Msg ?? "WCS任务下发失败").RefreshGrid();
}
}
#endregion
} }
} }
@@ -25,6 +25,8 @@ namespace HHWMS.Web
this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "inventory", dialogWidth: 800), this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "inventory", dialogWidth: 800),
this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "inventory", dialogWidth: 800), this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "inventory", dialogWidth: 800),
this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "inventory"), this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "inventory"),
this.MakeAction("Inventory","InvOut",Localizer["TaskType.Out"],"",GridActionParameterTypesEnum.SingleId,"inventory")
.SetSize(500,400),
}; };
} }
@@ -13,6 +13,10 @@ namespace HHWMS.Web
public partial class InventoryVM : BaseCRUDVM<Inventory> public partial class InventoryVM : BaseCRUDVM<Inventory>
{ {
public List<ComboSelectListItem> AllZones { get; set; } public List<ComboSelectListItem> AllZones { get; set; }
public List<ComboSelectListItem> AllOutPorts { get; set; }
[Display(Name = "Location.OutPort", Description = "拣货口")]
public string OutPort { get; set; }
public InventoryVM() public InventoryVM()
{ {
@@ -22,6 +26,16 @@ namespace HHWMS.Web
protected override void InitVM() protected override void InitVM()
{ {
AllZones = DC.Set<LocationZone>().GetSelectListItems(Wtm, y => y.Name); AllZones = DC.Set<LocationZone>().GetSelectListItems(Wtm, y => y.Name);
AllOutPorts = new List<ComboSelectListItem>
{
new ComboSelectListItem { Text = "拣货口1", Value = "EnterExit_P2001" },
new ComboSelectListItem { Text = "拣货口2", Value = "EnterExit_P2003" },
new ComboSelectListItem { Text = "拣货口3", Value = "EnterExit_P2005" },
new ComboSelectListItem { Text = "拣货口4", Value = "EnterExit_P2007" },
new ComboSelectListItem { Text = "拣货口5", Value = "EnterExit_P2009" },
new ComboSelectListItem { Text = "拣货口6", Value = "EnterExit_P2011" },
new ComboSelectListItem { Text = "拣货口7", Value = "EnterExit_P2013" }
};
} }
public override void DoAdd() public override void DoAdd()
@@ -0,0 +1,13 @@
@model HHWMS.Web.InventoryVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.One">
<wt:hidden field="Entity.ID" />
<wt:combobox field="OutPort" items="AllOutPorts"/>
</wt:row>
<wt:row align="AlignEnum.Right">
<wt:submitbutton />
<wt:closebutton />
</wt:row>
</wt:form>
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using HHWMS.Web.Models; using HHWMS.Web.Models;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Linq; using System.Linq;
using Aliyun.OSS;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using WalkingTec.Mvvm.Core.Extensions; using WalkingTec.Mvvm.Core.Extensions;
@@ -16,10 +17,17 @@ namespace HHWMS.Web.Controllers
public partial class ReceiptInController : BaseController public partial class ReceiptInController : BaseController
{ {
private readonly IUnitWork _unitWork; private readonly IUnitWork _unitWork;
private readonly Dictionary<string, LineRange> _materialZones;
public ReceiptInController(IUnitWork unitwork) public ReceiptInController(IUnitWork unitwork)
{ {
_unitWork = unitwork; _unitWork = unitwork;
_materialZones = new Dictionary<string, LineRange>
{
{ "zone1", new LineRange { BeginLine = 1, EndLine = 25 } },
{ "zone2", new LineRange { BeginLine = 26, EndLine = 57 } },
{ "zone3", new LineRange { BeginLine = 58, EndLine = 96 } },
};
} }
#region Index #region Index
@@ -37,32 +45,68 @@ namespace HHWMS.Web.Controllers
[HttpPost] [HttpPost]
public IActionResult GetOperators() public IActionResult GetOperators()
{ {
// TODO: 从数据库获取操作员列表 var users = _unitWork.Find<FrameworkUser>(x => x.ITCode != "Admin")
var operators = new List<object> .Select(x => new {x.ITCode,x.Name})
{ .ToList();
new { value = "1", label = "张三" }, return Json(new { Code = 200, Data = users});
new { value = "2", label = "李四" }
};
return Json(new { Code = 200, Data = operators });
} }
[HttpPost] [HttpPost]
public IActionResult GetProcesses() public IActionResult GetProcesses()
{ {
// TODO: 从数据库获取工序列表 try
var processes = new List<object>
{ {
new { value = "1", label = "工序1" }, var processes = _unitWork.Find<MaterialProcess>(x => x.IsActive)
new { value = "2", label = "工序2" } .OrderBy(x => x.ProcessOrder)
}; .Select(x => new {
return Json(new { Code = 200, Data = processes }); value = x.ID.ToString(),
label = x.ProcessName,
processCode = x.ProcessCode,
processName = x.ProcessName
})
.ToList();
return Json(new { Code = 200, Data = processes });
}
catch (Exception ex)
{
return Json(new { Code = 500, Msg = $"获取工序列表失败:{ex.Message}" });
}
}
[HttpPost]
public IActionResult GetProcessesByMaterial(string materialCode)
{
try
{
if (string.IsNullOrWhiteSpace(materialCode))
{
return Json(new { Code = 200, Data = new object[] { } });
}
var processes = _unitWork.Find<MaterialProcess>(x => x.MaterialCode == materialCode && x.IsActive)
.OrderBy(x => x.ProcessOrder)
.Select(x => new {
value = x.ID.ToString(),
label = x.ProcessName,
processCode = x.ProcessCode,
processName = x.ProcessName
})
.ToList();
return Json(new { Code = 200, Data = processes });
}
catch (Exception ex)
{
return Json(new { Code = 500, Msg = $"获取物料工序失败:{ex.Message}" });
}
} }
[HttpPost] [HttpPost]
public IActionResult GetOperatorInfo() public IActionResult GetOperatorInfo()
{ {
// TODO: 获取当前登录用户信息 var users = _unitWork.Find<FrameworkUser>(x => x.ITCode != "Admin")
return Json(new { Code = 200, Data = "当前操作员:张三" }); .Select(x => new {x.ITCode,x.Name})
.ToList();
return Json(new { Code = 200, Data = users});
} }
[HttpPost] [HttpPost]
@@ -80,38 +124,13 @@ namespace HHWMS.Web.Controllers
[HttpPost] [HttpPost]
public IActionResult SubmitReceipt([FromBody] ReceiptInModel model) public IActionResult SubmitReceipt([FromBody] ReceiptInModel model)
{ {
// 1. 查找可用库位信息 - 使用LocationVM的GetLocation方法
var locationVM = Wtm.CreateVM<LocationVM>();
// 创建WcsRequest对象,设置巷道号为1
var wcsRequest = new WcsRequest { RoadWay = 1 };
// 调用GetLocation方法获取可用库位
var locationResult = locationVM.GetLocation(wcsRequest);
if (!locationResult.Status)
{
return Json(new { Code = 500, Msg = locationResult.Message });
}
// 获取返回的库位编码
string locationCode = locationResult.Data.LocationCode;
// 根据库位编码获取完整的库位信息,使用AsNoTracking()避免实体跟踪冲突
// var availableLocation = DC.Set<Location>().AsNoTracking().FirstOrDefault(l => l.Code == locationCode);
//
// if (availableLocation == null)
// {
// return Json(new { Code = 500, Msg = "没有可用库位" });
// }
// 获取物料信息 // 获取物料信息
var material = _unitWork.FindSingle<Material>(m => m.MaterialCode == model.MaterialCode); var material = _unitWork.FindSingle<Material>(m => m.MaterialCode == model.MaterialCode);
if (material == null) if (material == null)
{ {
return Json(new { Code = 500, Msg = "物料不存在" }); return Json(new { Code = 500, Msg = "物料不存在" });
} }
// 获取容器信息 // 获取容器信息
var container = _unitWork.FindSingle<Container>(c => c.Code == model.PalletCode); var container = _unitWork.FindSingle<Container>(c => c.Code == model.PalletCode);
if (container == null) if (container == null)
@@ -119,15 +138,35 @@ namespace HHWMS.Web.Controllers
return Json(new { Code = 500, Msg = "容器不存在" }); return Json(new { Code = 500, Msg = "容器不存在" });
} }
// 从字典查询工序对应的区域
var processName = _unitWork.FindSingle<SysDictData>(x => x.DictType == "ProcessZone"
&& x.DictLabel == model.ProcessName)?.DictValue;
if (string.IsNullOrEmpty(processName))
{
return Json(new { Code = 500, Msg = "未找到此工序配置" });
}
// 1. 查找可用库位信息
var locationVm = Wtm.CreateVM<LocationVM>();
var locationCode = locationVm.GetEmptyLocationFromXb(_materialZones[processName].BeginLine, _materialZones[processName].EndLine);
if (string.IsNullOrWhiteSpace(locationCode))
{
return Json(new { Code = 500, Msg = "未找到可用的空仓位" });
}
// 使用事务 // 使用事务
using (var tran = DC.BeginTransaction()) using (var tran = DC.BeginTransaction())
{ {
try try
{ {
var zone = _unitWork.FindSingle<LocationZone>(x => x.Name == "线边库");
// 2. 生成入库任务 // 2. 生成入库任务
var taskNo = _unitWork.GetSerialNumber("In", 6); var taskNo = _unitWork.GetSerialNumber("In", 6);
var taskHeader = new TaskHeader var taskHeader = new TaskHeader
{ {
ZoneId = zone.ID,
TaskNo = taskNo, TaskNo = taskNo,
TaskType = TaskTypeEnum.入库, TaskType = TaskTypeEnum.入库,
FromLocation = "", FromLocation = "",
@@ -144,13 +183,15 @@ namespace HHWMS.Web.Controllers
// 3. 创建库存信息 // 3. 创建库存信息
var inventory = new Inventory var inventory = new Inventory
{ {
ZoneId = zone.ID,
ContainerCode = model.PalletCode, ContainerCode = model.PalletCode,
LocationCode = locationCode, LocationCode = locationCode,
MaterialCode = model.MaterialCode, MaterialCode = model.MaterialCode,
MaterialName = material.MaterialName, MaterialName = material.MaterialName,
MaterialSpec = material.MaterialSpec, MaterialSpec = material.MaterialSpec,
MaterialUnit = material.MaterialUnit, MaterialUnit = material.MaterialUnit,
Qty = model.Quantity, Batch = model.ProcessName,
Lot = model.ProcessId.ToString(),
TaskStatus = InventoryTaskStatusEnum.Locked, TaskStatus = InventoryTaskStatusEnum.Locked,
CreateBy = model.OperatorId, CreateBy = model.OperatorId,
CreateTime = DateTime.Now CreateTime = DateTime.Now
@@ -158,33 +199,32 @@ namespace HHWMS.Web.Controllers
_unitWork.Add(inventory); _unitWork.Add(inventory);
// 4. 创建库存交易记录
var transaction = new InventoryTransaction
{
Type = InventoryTranType.入库,
ContainerCode = model.PalletCode,
LocationCode = locationCode,
MaterialCode = model.MaterialCode,
MaterialName = material.MaterialName,
MaterialSpec = material.MaterialSpec,
MaterialUnit = material.MaterialUnit,
Qty = model.Quantity,
CreateBy = model.OperatorId,
CreateTime = DateTime.Now
};
_unitWork.Add(transaction);
// 5. 锁定容器和库位 // 5. 锁定容器和库位
container.IsLock = ContainerLockEnum.任务锁; container.IsLock = ContainerLockEnum.任务锁;
container.Status = ContainerStatus.有;
container.LocationCode = locationCode; container.LocationCode = locationCode;
_unitWork.Update(container); _unitWork.Update(container);
// 从数据库中重新获取库位实体,避免实体跟踪冲突 // 从数据库中重新获取库位实体,避免实体跟踪冲突
var locationToUpdate = _unitWork.FindSingle<Location>(l => l.Code == locationCode); var locationToUpdate = _unitWork.FindSingle<Location>(l => l.Code == locationCode);
locationToUpdate.Status = LocationStatusEnum.Locked;
locationToUpdate.ContainerCode = model.PalletCode; var resultNum = _unitWork.BatchUpdate<Location>(x => x.Code == locationCode && x.Version == locationToUpdate.Version,
_unitWork.Update(locationToUpdate); x => new Location()
{
Status = LocationStatusEnum.锁定,
ContainerStatus = LocationStatus.有货,
ContainerCode = model.PalletCode,
UpdateTime = DateTime.Now,
UpdateBy = "WMS",
Version = Guid.NewGuid()
});
if (resultNum == 0)
{
//失败 回滚
tran.Rollback();
return Json(new { Code = 500, Msg = "更新仓位失败!请重新提交!"});
}
// 6. 调用WCS接口下发任务 // 6. 调用WCS接口下发任务
var wcsTaskModel = new WCSTaskModel var wcsTaskModel = new WCSTaskModel
@@ -196,7 +236,7 @@ namespace HHWMS.Web.Controllers
}; };
// 调用WCS任务下发接口 // 调用WCS任务下发接口
var wcsResult = Wtm.CallAPI<WCSTaskResponse>("WCS", "TaskAssign", HttpMethodEnum.POST, wcsTaskModel).Result.Data; var wcsResult = Wtm.CallAPI<WCSTaskResponse>("WCSXB", "TaskAssign", HttpMethodEnum.POST, wcsTaskModel).Result.Data;
if (wcsResult != null && wcsResult.Success) if (wcsResult != null && wcsResult.Success)
{ {
@@ -220,6 +260,115 @@ namespace HHWMS.Web.Controllers
} }
} }
/// <summary>
/// 空托盘入库
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
public IActionResult SubmitEmptyPallet([FromBody] ReceiptInModel model)
{
// 获取容器信息
var container = _unitWork.FindSingle<Container>(c => c.Code == model.PalletCode);
if (container == null)
{
return Json(new { Code = 500, Msg = "容器不存在" });
}
// 1. 查找可用库位信息
var locationVm = Wtm.CreateVM<LocationVM>();
var locationCode = locationVm.GetEmptyLocationFromXb(_materialZones["zone1"].BeginLine, _materialZones["zone1"].EndLine);
if (string.IsNullOrWhiteSpace(locationCode))
{
return Json(new { Code = 500, Msg = "未找到可用的空仓位" });
}
// 使用事务
using (var tran = DC.BeginTransaction())
{
try
{
var zone = _unitWork.FindSingle<LocationZone>(x => x.Name == "线边库");
// 2. 生成入库任务
var taskNo = _unitWork.GetSerialNumber("In", 6);
var taskHeader = new TaskHeader
{
ZoneId = zone.ID,
TaskNo = taskNo,
TaskType = TaskTypeEnum.入库,
FromLocation = "",
ToLocation = locationCode,
ContainerCode = model.PalletCode,
RoadWay = 1,
Status = TaskStatusEnum.新建,
CreateBy = model.OperatorId,
CreateTime = DateTime.Now
};
_unitWork.Add(taskHeader);
// 5. 锁定容器和库位
container.IsLock = ContainerLockEnum.任务锁;
container.LocationCode = locationCode;
container.Status = ContainerStatus.空;
_unitWork.Update(container);
// 从数据库中重新获取库位实体,避免实体跟踪冲突
var locationToUpdate = _unitWork.FindSingle<Location>(l => l.Code == locationCode);
var resultNum = _unitWork.BatchUpdate<Location>(x => x.Code == locationCode && x.Version == locationToUpdate.Version,
x => new Location()
{
Status = LocationStatusEnum.锁定,
ContainerStatus = LocationStatus.空仓位,
ContainerCode = model.PalletCode,
UpdateTime = DateTime.Now,
UpdateBy = "WMS",
Version = Guid.NewGuid()
});
if (resultNum == 0)
{
//失败 回滚
tran.Rollback();
return Json(new { Code = 500, Msg = "更新仓位失败!请重新提交!"});
}
// 6. 调用WCS接口下发任务
var wcsTaskModel = new WCSTaskModel
{
TaskNo = taskNo,
PalletNo = model.PalletCode,
FromLocation = "", // 入库任务起始位置为空
ToLocation = locationCode,
};
// 调用WCS任务下发接口
var wcsResult = Wtm.CallAPI<WCSTaskResponse>("WCSXB", "TaskAssign", HttpMethodEnum.POST, wcsTaskModel).Result.Data;
if (wcsResult != null && wcsResult.Success)
{
// WCS任务下发成功,提交事务
tran.Commit();
return Json(new { Code = 200, Msg = "入库成功", Data = new { TaskNo = taskNo } });
}
else
{
// WCS任务下发失败,回滚事务
tran.Rollback();
return Json(new { Code = 500, Msg = wcsResult?.Msg ?? "WCS任务下发失败" });
}
}
catch (System.Exception ex)
{
// 发生异常,回滚事务
tran.Rollback();
return Json(new { Code = 500, Msg = ex.Message });
}
}}
/// <summary> /// <summary>
/// 搜索物料 /// 搜索物料
/// </summary> /// </summary>
@@ -260,9 +409,16 @@ namespace HHWMS.Web.Controllers
public string MaterialCode { get; set; } public string MaterialCode { get; set; }
public string OrderId { get; set; } public string OrderId { get; set; }
public string OperatorId { get; set; } public string OperatorId { get; set; }
public string ProcessId { get; set; } public int ProcessId { get; set; }
public int Quantity { get; set; } public string ProcessName { get; set; }
public bool IsQualified { get; set; } public bool IsQualified { get; set; }
public string OperatorInfo { get; set; } public string OperatorInfo { get; set; }
} }
public class LineRange
{
public int BeginLine { get; set; }
public int EndLine { get; set; }
}
} }
@@ -4,34 +4,23 @@
<a-card class="general-card"> <a-card class="general-card">
<a-form :model="form" :rules="rules" ref="formRef" auto-label-width> <a-form :model="form" :rules="rules" ref="formRef" auto-label-width>
<a-form-item label="托盘码" field="palletCode"> <a-form-item label="托盘码" field="palletCode">
<a-input v-model="form.palletCode" @@change="scanPallet" ref="palletCodeRef" placeholder="请扫描托盘码" @@keydown.enter.prevent="focusNext('materialCodeRef')" /> <a-input v-model="form.palletCode" ref="palletCodeRef" placeholder="请扫描托盘码" @@change="scanPallet" @@keydown.enter="focusNext('materialCodeRef')" />
</a-form-item> </a-form-item>
<a-form-item label="物料码" field="materialCode"> <a-form-item label="物料码" field="materialCode">
<a-auto-complete <a-auto-complete
v-model="form.materialCode" v-model="form.materialCode"
:data="materialOptions" :data="materialOptions"
ref="materialCodeRef"
placeholder="请扫描或输入物料码" placeholder="请扫描或输入物料码"
@@search="handleMaterialSearch" @@search="handleMaterialSearch"
@@select="handleMaterialSelect" @@select="handleMaterialSelect"
ref="materialCodeRef"
@@keydown.enter.prevent="focusNext('quantityInput')"
> >
</a-auto-complete> </a-auto-complete>
</a-form-item> </a-form-item>
<a-form-item label="生产订单" field="orderId">
<a-select v-model="form.orderId" placeholder="请选择生产订单" @@change="handleOrderChange" ref="orderSelect">
<a-option v-for="item in orderOptions"
:key="item.value"
:value="item.value">
{{ item.label }}
</a-option>
</a-select>
</a-form-item>
<a-form-item label="当前工序" field="processId"> <a-form-item label="当前工序" field="processId">
<a-select v-model="form.processId" placeholder="请选择工序" ref="processSelect"> <a-select v-model="form.processId" placeholder="请选择工序" @@change="processSelect">
<a-option v-for="item in processOptions" <a-option v-for="item in processOptions"
:key="item.value" :key="item.value"
:value="item.value"> :value="item.value">
@@ -40,31 +29,26 @@
</a-select> </a-select>
</a-form-item> </a-form-item>
<a-form-item label="入库数量" field="quantity"> <a-form-item label="工序名称" field="processName" v-show="false">
<a-input-number v-model="form.quantity" :min="1" :precision="0" ref="quantityInput" /> <a-input v-model="form.processName" />
</a-form-item> </a-form-item>
<a-form-item label="是否合格" field="isQualified"> <a-form-item label="是否合格" field="isQualified">
<a-switch v-model="form.isQualified" ref="isQualifiedSwitch" /> <a-switch v-model="form.isQualified" />
</a-form-item> </a-form-item>
<a-form-item label="操作员工" field="operatorId"> <a-form-item label="操作员工" field="operatorId">
<a-select v-model="form.operatorId" placeholder="请选择操作员工" ref="operatorSelect"> <a-input v-model="form.operatorId" ref="operatorIdRef" placeholder="请扫描员工码" @@keydown.enter="focusNext('operatorInfoRef')" />
<a-option v-for="item in operatorOptions"
:key="item.value"
:value="item.value">
{{ item.label }}
</a-option>
</a-select>
</a-form-item> </a-form-item>
<a-form-item label="检验员信息" field="operatorInfo"> <a-form-item label="检验员信息" field="operatorInfo">
<a-input v-model="form.operatorInfo" placeholder="请输入检验员信息" /> <a-input v-model="form.operatorInfo" ref="operatorInfoRef" placeholder="请扫描检验员信息" @@keydown.enter="submitForm" />
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<a-space> <a-space>
<a-button type="primary" @@click="submitForm" :loading="loading">上架入库</a-button> <a-button type="primary" @@click="submitForm" :loading="loading">上架入库</a-button>
<a-button type="success" @@click="submitEmptyPallet" :loading="loading">空托盘入库</a-button>
<a-button @@click="resetForm">重置</a-button> <a-button @@click="resetForm">重置</a-button>
</a-space> </a-space>
</a-form-item> </a-form-item>
@@ -81,14 +65,26 @@
const app = createApp({ const app = createApp({
setup() { setup() {
const formRef = ref(null); const formRef = ref(null);
const loading = ref(false);
const palletCodeRef = ref(null); const palletCodeRef = ref(null);
const materialCodeRef = ref(null); const materialCodeRef = ref(null);
const orderSelect = ref(null); const operatorIdRef = ref(null);
const processSelect = ref(null); const operatorInfoRef = ref(null);
const operatorSelect = ref(null);
const quantityInput = ref(null); const inputRefs = {
const isQualifiedSwitch = ref(null); palletCodeRef,
const loading = ref(false); materialCodeRef,
operatorIdRef,
operatorInfoRef
};
const focusNext = (nextRefName) => {
nextTick(() => {
if (inputRefs[nextRefName] && inputRefs[nextRefName].value && inputRefs[nextRefName].value.focus) {
inputRefs[nextRefName].value.focus();
}
});
};
const form = reactive({ const form = reactive({
palletCode: '', palletCode: '',
@@ -96,15 +92,11 @@
orderId: '', orderId: '',
operatorId: '', operatorId: '',
processId: '', processId: '',
quantity: 1, processName:'',
isQualified: true, isQualified: true,
operatorInfo: '' operatorInfo: ''
}); });
const orderOptions = ref([]);
const operatorOptions = ref([]);
const processOptions = ref([]); const processOptions = ref([]);
const materialOptions = ref([]); const materialOptions = ref([]);
let searchTimer = null; let searchTimer = null;
@@ -115,35 +107,24 @@
materialCode: [ materialCode: [
{ required: true, message: '请输入物料码', trigger: ['change', 'blur'] } { required: true, message: '请输入物料码', trigger: ['change', 'blur'] }
], ],
orderId: [
{ required: true, message: '请选择生产订单', trigger: ['change', 'blur'] }
],
operatorId: [
{ required: true, message: '请选择操作员工', trigger: ['change', 'blur'] }
],
processId: [ processId: [
{ required: true, message: '请选择工序', trigger: ['change', 'blur'] } { required: true, message: '请选择工序', trigger: ['change', 'blur'] }
], ],
quantity: [ operatorId: [
{ required: true, type: 'number', message: '请输入数量', trigger: ['change', 'blur'] } { required: true, message: '请输入操作员工信息', trigger: ['change', 'blur'] }
], ],
operatorInfo: [ operatorInfo: [
{ required: true, message: '请输入检验员信息', trigger: ['change', 'blur'] } { required: true, message: '请输入检验员信息', trigger: ['change', 'blur'] }
] ]
}; };
// 加载操作员列表 const processSelect = (value) => {
const loadOperators = () => { form.processName = processOptions.value.find(item => item.value === value).processName;
$.ajax({ focusNext('operatorIdRef');
type: "post", }
dataType: "json",
url: "/receipt/ReceiptIn/GetOperators",
success: (json) => {
operatorOptions.value = json.Data;
}
});
};
// 加载工序列表 // 加载工序列表
const loadProcesses = () => { const loadProcesses = () => {
$.ajax({ $.ajax({
@@ -151,19 +132,41 @@
dataType: "json", dataType: "json",
url: "/receipt/ReceiptIn/GetProcesses", url: "/receipt/ReceiptIn/GetProcesses",
success: (json) => { success: (json) => {
processOptions.value = json.Data; if (json.Code == 200) {
processOptions.value = json.Data;
} else {
Message.error(json.Msg || '加载工序列表失败');
}
},
error: (xhr, status, error) => {
Message.error('加载工序列表失败:' + error);
} }
}); });
}; };
// 加载当前操作员信息 // 根据物料加载工序列表
const loadOperatorInfo = () => { const loadProcessesByMaterial = (materialCode) => {
if (!materialCode) {
processOptions.value = [];
return;
}
$.ajax({ $.ajax({
type: "post", type: "post",
dataType: "json", dataType: "json",
url: "/receipt/ReceiptIn/GetOperatorInfo", data: { materialCode: materialCode },
url: "/receipt/ReceiptIn/GetProcessesByMaterial",
success: (json) => { success: (json) => {
form.operatorInfo = json.Data; if (json.Code == 200) {
processOptions.value = json.Data;
} else {
Message.error(json.Msg || '加载物料工序失败');
processOptions.value = [];
}
},
error: (xhr, status, error) => {
Message.error('加载物料工序失败:' + error);
processOptions.value = [];
} }
}); });
}; };
@@ -220,28 +223,15 @@
const selectedMaterial = materialOptions.value.find(item => item.value === value); const selectedMaterial = materialOptions.value.find(item => item.value === value);
if (selectedMaterial) { if (selectedMaterial) {
form.materialCode = selectedMaterial.MaterialCode; form.materialCode = selectedMaterial.MaterialCode;
// 选择物料后加载相关订单 // 选择物料后加载相关工序
scanMaterial(); loadProcessesByMaterial(selectedMaterial.MaterialCode);
} }
}; };
// 扫描物料码 // 扫描物料码
const scanMaterial = () => { const scanMaterial = () => {
if (!form.materialCode) return; if (!form.materialCode) return;
$.ajax({ loadProcessesByMaterial(form.materialCode);
type: "post",
dataType: "json",
data: { materialCode: form.materialCode },
url: "/receipt/ReceiptIn/GetOrdersByMaterial",
success: (json) => {
orderOptions.value = json.Data;
}
});
};
// 生产订单变更
const handleOrderChange = () => {
loadProcesses();
}; };
// 提交表单 // 提交表单
@@ -260,7 +250,10 @@
Message.success('入库成功!'); Message.success('入库成功!');
resetForm(); resetForm();
} else { } else {
Message.error(json.Msg || '入库失败!'); Message.error({
content: json.Msg || '入库失败!',
duration: 5000 // 设置为 5 秒
});
} }
}, },
error: (xhr, status, error) => { error: (xhr, status, error) => {
@@ -276,10 +269,48 @@
}); });
}; };
// 空托盘入库
const submitEmptyPallet = () => {
if (!form.palletCode) {
Message.error('请输入托盘码!');
return;
}
loading.value = true;
const emptyPalletData = {
palletCode: form.palletCode,
operatorId: form.operatorId || 'SYSTEM'
};
$.ajax({
type: "post",
dataType: "json",
contentType: "application/json",
data: JSON.stringify(emptyPalletData),
url: "/receipt/ReceiptIn/SubmitEmptyPallet",
success: (json) => {
if (json.Code == 200) {
Message.success('空托盘入库成功!');
resetForm();
} else {
Message.error({
content: json.Msg || '空托盘入库失败!',
duration: 5000
});
}
},
error: (xhr, status, error) => {
Message.error('提交失败:' + error);
},
complete: () => {
loading.value = false;
}
});
};
// 重置表单 // 重置表单
const resetForm = () => { const resetForm = () => {
formRef.value.resetFields(); formRef.value.resetFields();
orderOptions.value = [];
processOptions.value = []; processOptions.value = [];
setTimeout(() => { setTimeout(() => {
if (palletCodeRef.value) { if (palletCodeRef.value) {
@@ -288,40 +319,9 @@
}, 100); }, 100);
}; };
// 焦点跳转到下一个输入框
const focusNext = (nextRef) => {
const refMap = {
materialCodeRef: materialCodeRef,
quantityInput: quantityInput
};
const nextElement = refMap[nextRef];
if (nextElement?.value) {
// 先让当前元素失去焦点
if (document.activeElement) {
document.activeElement.blur();
}
// 使用 nextTick 确保 DOM 更新完成
nextTick(() => {
if (nextElement.value.$el) {
// 处理 Input 组件
const input = nextElement.value.$el.querySelector('input');
if (input) {
input.focus();
}
} else {
// 处理基础组件
nextElement.value.focus();
}
});
}
};
// 生命周期钩子 // 生命周期钩子
onMounted(() => { onMounted(() => {
loadOperators();
loadOperatorInfo();
// 页面加载时自动聚焦第一个输入框 // 页面加载时自动聚焦第一个输入框
setTimeout(() => { setTimeout(() => {
if (palletCodeRef.value) { if (palletCodeRef.value) {
@@ -332,28 +332,26 @@
return { return {
formRef, formRef,
palletCodeRef,
materialCodeRef,
orderSelect,
processSelect,
operatorSelect,
quantityInput,
isQualifiedSwitch,
form, form,
loading, loading,
orderOptions,
operatorOptions,
processOptions, processOptions,
rules, rules,
scanPallet, scanPallet,
scanMaterial, scanMaterial,
handleOrderChange,
submitForm, submitForm,
submitEmptyPallet,
resetForm, resetForm,
focusNext,
materialOptions, materialOptions,
handleMaterialSearch, handleMaterialSearch,
handleMaterialSelect handleMaterialSelect,
palletCodeRef,
materialCodeRef,
operatorIdRef,
operatorInfoRef,
focusNext,
loadProcesses,
loadProcessesByMaterial,
processSelect
}; };
} }
}); });
@@ -12,8 +12,6 @@ namespace HHWMS.Web
{ {
public partial class TaskHeaderHistoryTemplateVM : BaseTemplateVM public partial class TaskHeaderHistoryTemplateVM : BaseTemplateVM
{ {
[Display(Name = "Task.ZoneCode")]
public ExcelPropety ZoneCode_Excel = ExcelPropety.CreateProperty<TaskHeaderHistory>(x => x.ZoneCode);
[Display(Name = "Task.TaskNo")] [Display(Name = "Task.TaskNo")]
public ExcelPropety TaskNo_Excel = ExcelPropety.CreateProperty<TaskHeaderHistory>(x => x.TaskNo); public ExcelPropety TaskNo_Excel = ExcelPropety.CreateProperty<TaskHeaderHistory>(x => x.TaskNo);
[Display(Name = "Task.TaskType")] [Display(Name = "Task.TaskType")]
@@ -32,7 +32,7 @@ namespace HHWMS.Web
protected override IEnumerable<IGridColumn<TaskHeaderHistory_View>> InitGridHeader() protected override IEnumerable<IGridColumn<TaskHeaderHistory_View>> InitGridHeader()
{ {
return new List<GridColumn<TaskHeaderHistory_View>>{ return new List<GridColumn<TaskHeaderHistory_View>>{
this.MakeGridHeader(x => x.ZoneCode), this.MakeGridHeader(x => x.Name_view),
this.MakeGridHeader(x => x.TaskNo), this.MakeGridHeader(x => x.TaskNo),
this.MakeGridHeader(x => x.TaskType), this.MakeGridHeader(x => x.TaskType),
this.MakeGridHeader(x => x.FromLocation), this.MakeGridHeader(x => x.FromLocation),
@@ -50,7 +50,7 @@ namespace HHWMS.Web
public override IOrderedQueryable<TaskHeaderHistory_View> GetSearchQuery() public override IOrderedQueryable<TaskHeaderHistory_View> GetSearchQuery()
{ {
var query = DC.Set<TaskHeaderHistory>() var query = DC.Set<TaskHeaderHistory>()
.CheckContain(Searcher.ZoneCode, x=>x.ZoneCode) .CheckEqual(Searcher.ZoneId, x=>x.ZoneId)
.CheckContain(Searcher.TaskNo, x=>x.TaskNo) .CheckContain(Searcher.TaskNo, x=>x.TaskNo)
.CheckEqual(Searcher.TaskType, x=>x.TaskType) .CheckEqual(Searcher.TaskType, x=>x.TaskType)
.CheckContain(Searcher.FromLocation, x=>x.FromLocation) .CheckContain(Searcher.FromLocation, x=>x.FromLocation)
@@ -58,10 +58,11 @@ namespace HHWMS.Web
.CheckContain(Searcher.ContainerCode, x=>x.ContainerCode) .CheckContain(Searcher.ContainerCode, x=>x.ContainerCode)
.CheckEqual(Searcher.RoadWay, x=>x.RoadWay) .CheckEqual(Searcher.RoadWay, x=>x.RoadWay)
.CheckEqual(Searcher.Status, x=>x.Status) .CheckEqual(Searcher.Status, x=>x.Status)
.DPWhere(Wtm,x => x.ZoneId)
.Select(x => new TaskHeaderHistory_View .Select(x => new TaskHeaderHistory_View
{ {
ID = x.ID, ID = x.ID,
ZoneCode = x.ZoneCode, Name_view = x.Zone.Name,
TaskNo = x.TaskNo, TaskNo = x.TaskNo,
TaskType = x.TaskType, TaskType = x.TaskType,
FromLocation = x.FromLocation, FromLocation = x.FromLocation,
@@ -79,7 +80,9 @@ namespace HHWMS.Web
} }
public class TaskHeaderHistory_View : TaskHeaderHistory{ public class TaskHeaderHistory_View : TaskHeaderHistory
{
[Display(Name = "Location.ZoneName")]
public String Name_view { get; set; }
} }
} }
@@ -12,8 +12,9 @@ namespace HHWMS.Web
{ {
public partial class TaskHeaderHistorySearcher : BaseSearcher public partial class TaskHeaderHistorySearcher : BaseSearcher
{ {
[Display(Name = "Task.ZoneCode")] public List<ComboSelectListItem> AllZones { get; set; }
public String ZoneCode { get; set; } [Display(Name = "Location.ZoneName")]
public int? ZoneId { get; set; }
[Display(Name = "Task.TaskNo")] [Display(Name = "Task.TaskNo")]
public String TaskNo { get; set; } public String TaskNo { get; set; }
[Display(Name = "Task.TaskType")] [Display(Name = "Task.TaskType")]
@@ -29,8 +30,10 @@ namespace HHWMS.Web
[Display(Name = "Task.Status")] [Display(Name = "Task.Status")]
public TaskStatusEnum? Status { get; set; } public TaskStatusEnum? Status { get; set; }
protected override void InitVM() protected override void InitVM()
{ {
AllZones = DC.Set<LocationZone>().GetSelectListItems(Wtm, y => y.Name);
} }
} }
@@ -12,13 +12,15 @@ namespace HHWMS.Web
{ {
public partial class TaskHeaderHistoryVM : BaseCRUDVM<TaskHeaderHistory> public partial class TaskHeaderHistoryVM : BaseCRUDVM<TaskHeaderHistory>
{ {
public List<ComboSelectListItem> AllZones { get; set; }
public TaskHeaderHistoryVM() public TaskHeaderHistoryVM()
{ {
SetInclude(x => x.Zone);
} }
protected override void InitVM() protected override void InitVM()
{ {
AllZones = DC.Set<LocationZone>().GetSelectListItems(Wtm, y => y.Name);
} }
public override void DoAdd() public override void DoAdd()
@@ -12,8 +12,6 @@ namespace HHWMS.Web
{ {
public partial class TaskHeaderTemplateVM : BaseTemplateVM public partial class TaskHeaderTemplateVM : BaseTemplateVM
{ {
[Display(Name = "Task.ZoneCode")]
public ExcelPropety ZoneCode_Excel = ExcelPropety.CreateProperty<TaskHeader>(x => x.ZoneCode);
[Display(Name = "Task.TaskNo")] [Display(Name = "Task.TaskNo")]
public ExcelPropety TaskNo_Excel = ExcelPropety.CreateProperty<TaskHeader>(x => x.TaskNo); public ExcelPropety TaskNo_Excel = ExcelPropety.CreateProperty<TaskHeader>(x => x.TaskNo);
[Display(Name = "Task.TaskType")] [Display(Name = "Task.TaskType")]
@@ -12,13 +12,11 @@ namespace HHWMS.Web
{ {
public partial class TaskHeaderListVM : BasePagedListVM<TaskHeader_View, TaskHeaderSearcher> public partial class TaskHeaderListVM : BasePagedListVM<TaskHeader_View, TaskHeaderSearcher>
{ {
public List<ComboSelectListItem> ZoneCodes { get; set; }
public TaskDetailListVM2 TaskDetails { get; set; } = new TaskDetailListVM2(); public TaskDetailListVM2 TaskDetails { get; set; } = new TaskDetailListVM2();
protected override void InitVM() protected override void InitVM()
{ {
var vm = Wtm.CreateVM<TaskHeaderVM>(); var vm = Wtm.CreateVM<TaskHeaderVM>();
ZoneCodes = vm.ZoneCodes;
TaskDetails.CopyContext(this); TaskDetails.CopyContext(this);
} }
@@ -46,12 +44,7 @@ namespace HHWMS.Web
{ {
InitVM(); InitVM();
return new List<GridColumn<TaskHeader_View>>{ return new List<GridColumn<TaskHeader_View>>{
this.MakeGridHeader(x => x.ZoneCode) this.MakeGridHeader(x => x.Name_view).SetWidth(150),
.SetFormat((a, b) =>
{
var data = ZoneCodes.FirstOrDefault(x => x.Value.ToString() == a.ZoneCode);
return data?.Text ?? a.ZoneCode;
}).SetWidth(150),
this.MakeGridHeader(x => x.TaskNo) this.MakeGridHeader(x => x.TaskNo)
.SetFormat((a,b) => .SetFormat((a,b) =>
{ {
@@ -75,7 +68,7 @@ namespace HHWMS.Web
public override IOrderedQueryable<TaskHeader_View> GetSearchQuery() public override IOrderedQueryable<TaskHeader_View> GetSearchQuery()
{ {
var query = DC.Set<TaskHeader>() var query = DC.Set<TaskHeader>()
.CheckContain(Searcher.ZoneCode, x=>x.ZoneCode) .CheckEqual(Searcher.ZoneId, x=>x.ZoneId)
.CheckContain(Searcher.TaskNo, x=>x.TaskNo) .CheckContain(Searcher.TaskNo, x=>x.TaskNo)
.CheckEqual(Searcher.TaskType, x=>x.TaskType) .CheckEqual(Searcher.TaskType, x=>x.TaskType)
.CheckContain(Searcher.FromLocation, x=>x.FromLocation) .CheckContain(Searcher.FromLocation, x=>x.FromLocation)
@@ -83,10 +76,11 @@ namespace HHWMS.Web
.CheckContain(Searcher.ContainerCode, x=>x.ContainerCode) .CheckContain(Searcher.ContainerCode, x=>x.ContainerCode)
.CheckEqual(Searcher.RoadWay, x=>x.RoadWay) .CheckEqual(Searcher.RoadWay, x=>x.RoadWay)
.CheckEqual(Searcher.Status, x=>x.Status) .CheckEqual(Searcher.Status, x=>x.Status)
.DPWhere(Wtm,x => x.ZoneId)
.Select(x => new TaskHeader_View .Select(x => new TaskHeader_View
{ {
ID = x.ID, ID = x.ID,
ZoneCode = x.ZoneCode, Name_view = x.Zone.Name,
TaskNo = x.TaskNo, TaskNo = x.TaskNo,
TaskType = x.TaskType, TaskType = x.TaskType,
FromLocation = x.FromLocation, FromLocation = x.FromLocation,
@@ -105,6 +99,7 @@ namespace HHWMS.Web
} }
public class TaskHeader_View : TaskHeader{ public class TaskHeader_View : TaskHeader{
[Display(Name = "Location.ZoneName")]
public String Name_view { get; set; }
} }
} }
@@ -12,8 +12,9 @@ namespace HHWMS.Web
{ {
public partial class TaskHeaderSearcher : BaseSearcher public partial class TaskHeaderSearcher : BaseSearcher
{ {
[Display(Name = "Task.ZoneCode")] public List<ComboSelectListItem> AllZones { get; set; }
public String ZoneCode { get; set; } [Display(Name = "Location.ZoneName")]
public int? ZoneId { get; set; }
[Display(Name = "Task.TaskNo")] [Display(Name = "Task.TaskNo")]
public String TaskNo { get; set; } public String TaskNo { get; set; }
[Display(Name = "Task.TaskType")] [Display(Name = "Task.TaskType")]
@@ -31,6 +32,7 @@ namespace HHWMS.Web
protected override void InitVM() protected override void InitVM()
{ {
AllZones = DC.Set<LocationZone>().GetSelectListItems(Wtm, y => y.Name);
} }
} }
@@ -12,15 +12,17 @@ namespace HHWMS.Web
{ {
public partial class TaskHeaderVM : BaseCRUDVM<TaskHeader> public partial class TaskHeaderVM : BaseCRUDVM<TaskHeader>
{ {
public List<ComboSelectListItem> ZoneCodes { get; set; } public List<ComboSelectListItem> AllZones { get; set; }
private IUnitWork _unitWork { get; set; } private IUnitWork _unitWork { get; set; }
public TaskHeaderVM() public TaskHeaderVM()
{ {
SetInclude(x => x.Zone);
} }
protected override void InitVM() protected override void InitVM()
{ {
AllZones = DC.Set<LocationZone>().GetSelectListItems(Wtm, y => y.Name);
} }
public override void DoAdd() public override void DoAdd()
@@ -3,7 +3,7 @@
<wt:form vm="@Model"> <wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two"> <wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:textbox field="Entity.ZoneCode" /> <wt:combobox field="Entity.ZoneId" items="AllZones"/>
<wt:textbox field="Entity.TaskNo" /> <wt:textbox field="Entity.TaskNo" />
<wt:combobox field="Entity.TaskType" /> <wt:combobox field="Entity.TaskType" />
<wt:textbox field="Entity.FromLocation" /> <wt:textbox field="Entity.FromLocation" />
@@ -3,19 +3,19 @@
<wt:form vm="@Model"> <wt:form vm="@Model">
<wt:quote>@Localizer["Sys.DeleteConfirm"]</wt:quote> <wt:quote>@Localizer["Sys.DeleteConfirm"]</wt:quote>
<wt:row items-per-row="ItemsPerRowEnum.Two"> <wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:display field="Entity.ZoneCode" /> <wt:display field="Entity.Zone.Name"/>
<wt:display field="Entity.TaskNo" /> <wt:display field="Entity.TaskNo"/>
<wt:display field="Entity.TaskType" /> <wt:display field="Entity.TaskType"/>
<wt:display field="Entity.FromLocation" /> <wt:display field="Entity.FromLocation"/>
<wt:display field="Entity.ToLocation" /> <wt:display field="Entity.ToLocation"/>
<wt:display field="Entity.Station" /> <wt:display field="Entity.Station"/>
<wt:display field="Entity.ContainerCode" /> <wt:display field="Entity.ContainerCode"/>
<wt:display field="Entity.RoadWay" /> <wt:display field="Entity.RoadWay"/>
<wt:display field="Entity.Priority" /> <wt:display field="Entity.Priority"/>
<wt:display field="Entity.Status" /> <wt:display field="Entity.Status"/>
<wt:display field="Entity.ErrorMsg" /> <wt:display field="Entity.ErrorMsg"/>
</wt:row> </wt:row>
<wt:hidden field="Entity.ID" /> <wt:hidden field="Entity.ID" />
<wt:row align="AlignEnum.Right"> <wt:row align="AlignEnum.Right">
<wt:submitbutton theme=" ButtonThemeEnum.Warm" text="@Localizer["Sys.Delete"]"/> <wt:submitbutton theme=" ButtonThemeEnum.Warm" text="@Localizer["Sys.Delete"]"/>
@@ -3,7 +3,7 @@
<wt:form vm="@Model"> <wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two"> <wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:display field="Entity.ZoneCode" /> <wt:display field="Entity.Zone.Name" />
<wt:display field="Entity.TaskNo" /> <wt:display field="Entity.TaskNo" />
<wt:display field="Entity.TaskType" /> <wt:display field="Entity.TaskType" />
<wt:display field="Entity.FromLocation" /> <wt:display field="Entity.FromLocation" />
@@ -3,7 +3,7 @@
<wt:form vm="@Model"> <wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two"> <wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:textbox field="Entity.ZoneCode" /> <wt:combobox field="Entity.ZoneId" items="AllZones"/>
<wt:textbox field="Entity.TaskNo" /> <wt:textbox field="Entity.TaskNo" />
<wt:combobox field="Entity.TaskType" /> <wt:combobox field="Entity.TaskType" />
<wt:textbox field="Entity.FromLocation" /> <wt:textbox field="Entity.FromLocation" />
@@ -3,7 +3,7 @@
<wt:searchpanel vm="@Model" reset-btn="true" grid-id="TaskHeader"> <wt:searchpanel vm="@Model" reset-btn="true" grid-id="TaskHeader">
<wt:row items-per-row="ItemsPerRowEnum.Three"> <wt:row items-per-row="ItemsPerRowEnum.Three">
<wt:combobox field="Searcher.ZoneCode" items="ZoneCodes" /> <wt:combobox field="Searcher.ZoneId" items="Searcher.AllZones" empty-text="@Localizer["Sys.All"]" />
<wt:textbox field="Searcher.TaskNo" /> <wt:textbox field="Searcher.TaskNo" />
<wt:combobox field="Searcher.TaskType" empty-text="@Localizer["Sys.All"]" /> <wt:combobox field="Searcher.TaskType" empty-text="@Localizer["Sys.All"]" />
<wt:textbox field="Searcher.FromLocation" /> <wt:textbox field="Searcher.FromLocation" />
@@ -13,8 +13,8 @@
<wt:combobox field="Searcher.Status" empty-text="@Localizer["Sys.All"]" /> <wt:combobox field="Searcher.Status" empty-text="@Localizer["Sys.All"]" />
</wt:row> </wt:row>
</wt:searchpanel> </wt:searchpanel>
<wt:grid vm="@Model" id="TaskHeader" url="/taskManage/TaskHeader/Search" limit="7" /> <wt:grid vm="@Model" id="TaskHeader" url="/taskManage/TaskHeader/Search" />
<wt:grid vm="@Model.TaskDetails" id="TaskDetail" url="/taskManage/TaskDetail/Search2" height="400" /> @* <wt:grid vm="@Model.TaskDetails" id="TaskDetail" url="/taskManage/TaskDetail/Search2" height="400" /> *@
<script> <script>
var headerId = 0; var headerId = 0;
@@ -3,7 +3,7 @@
<wt:form vm="@Model"> <wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two"> <wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:textbox field="Entity.ZoneCode" /> <wt:combobox field="Entity.ZoneId" items="AllZones"/>
<wt:textbox field="Entity.TaskNo" /> <wt:textbox field="Entity.TaskNo" />
<wt:combobox field="Entity.TaskType" /> <wt:combobox field="Entity.TaskType" />
<wt:textbox field="Entity.FromLocation" /> <wt:textbox field="Entity.FromLocation" />
@@ -4,7 +4,7 @@
<wt:form vm="@Model"> <wt:form vm="@Model">
<wt:quote>@Localizer["Sys.DeleteConfirm"]</wt:quote> <wt:quote>@Localizer["Sys.DeleteConfirm"]</wt:quote>
<wt:row items-per-row="ItemsPerRowEnum.Two"> <wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:display field="Entity.ZoneCode" /> <wt:display field="Entity.Zone.Name" />
<wt:display field="Entity.TaskNo" /> <wt:display field="Entity.TaskNo" />
<wt:display field="Entity.TaskType" /> <wt:display field="Entity.TaskType" />
<wt:display field="Entity.FromLocation" /> <wt:display field="Entity.FromLocation" />
@@ -3,7 +3,7 @@
<wt:form vm="@Model"> <wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two"> <wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:display field="Entity.ZoneCode" /> <wt:display field="Entity.Zone.Name" />
<wt:display field="Entity.TaskNo" /> <wt:display field="Entity.TaskNo" />
<wt:display field="Entity.TaskType" /> <wt:display field="Entity.TaskType" />
<wt:display field="Entity.FromLocation" /> <wt:display field="Entity.FromLocation" />
@@ -3,7 +3,7 @@
<wt:form vm="@Model"> <wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two"> <wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:textbox field="Entity.ZoneCode" /> <wt:combobox field="Entity.ZoneId" items="AllZones"/>
<wt:textbox field="Entity.TaskNo" /> <wt:textbox field="Entity.TaskNo" />
<wt:combobox field="Entity.TaskType" /> <wt:combobox field="Entity.TaskType" />
<wt:textbox field="Entity.FromLocation" /> <wt:textbox field="Entity.FromLocation" />
@@ -3,7 +3,7 @@
<wt:searchpanel vm="@Model" reset-btn="true"> <wt:searchpanel vm="@Model" reset-btn="true">
<wt:row items-per-row="ItemsPerRowEnum.Three"> <wt:row items-per-row="ItemsPerRowEnum.Three">
<wt:textbox field="Searcher.ZoneCode" /> <wt:combobox field="Searcher.ZoneId" items="Searcher.AllZones" empty-text="@Localizer["Sys.All"]" />
<wt:textbox field="Searcher.TaskNo" /> <wt:textbox field="Searcher.TaskNo" />
<wt:combobox field="Searcher.TaskType" empty-text="@Localizer["Sys.All"]" /> <wt:combobox field="Searcher.TaskType" empty-text="@Localizer["Sys.All"]" />
<wt:textbox field="Searcher.FromLocation" /> <wt:textbox field="Searcher.FromLocation" />
-1
View File
@@ -189,7 +189,6 @@ namespace HHWMS.Web.Controllers
{ {
return JsonMore(UserSessionManager.AllSignined().ToList()); return JsonMore(UserSessionManager.AllSignined().ToList());
} }
} }
} }
+1
View File
@@ -53,6 +53,7 @@ namespace HHWMS.Web
public DbSet<ShipmentDetailHistory> ShipmentDetailHistories { get; set; } public DbSet<ShipmentDetailHistory> ShipmentDetailHistories { get; set; }
public DbSet<ReportDesign> ReportDesigns { get; set; } public DbSet<ReportDesign> ReportDesigns { get; set; }
public DbSet<Material> Materials { get; set; } public DbSet<Material> Materials { get; set; }
public DbSet<MaterialProcess> MaterialProcesses { get; set; }
public DbSet<PrintConfig> PrintConfigs { get; set; } public DbSet<PrintConfig> PrintConfigs { get; set; }
public DbSet<LocationZone> LocationZones { get; set; } public DbSet<LocationZone> LocationZones { get; set; }
public override async Task<bool> DataInit(object allModules, bool IsSpa) public override async Task<bool> DataInit(object allModules, bool IsSpa)
+5 -42
View File
@@ -23,8 +23,12 @@ public class Location : BasePoco
[Display(Name = "Location.Type", Description = "库位类型")] [Display(Name = "Location.Type", Description = "库位类型")]
public LocationTypeEnum Type { get; set; } public LocationTypeEnum Type { get; set; }
[Display(Name = "Location.Status", Description = "库位状态")] [Display(Name = "Location.Status", Description = "是否锁定")]
public LocationStatusEnum Status { get; set; } public LocationStatusEnum Status { get; set; }
[Display(Name = "Location.ContainerStatus", Description = "库位状态")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string ContainerStatus { get; set; }
[Display(Name = "Location.RoadWay", Description = "巷道")] [Display(Name = "Location.RoadWay", Description = "巷道")]
[Required(ErrorMessage = "Validate.{0}required")] [Required(ErrorMessage = "Validate.{0}required")]
@@ -68,45 +72,4 @@ public class Location : BasePoco
public string ContiguousCode { get; set; } public string ContiguousCode { get; set; }
public Guid? Version { get; set; } public Guid? Version { get; set; }
}
public enum LocationTypeEnum : short
{
/// <summary>
/// 成品库位
/// </summary>
[Display(Name = "LocationTypeEnum.L")]
C = 0,
/// <summary>
/// 模具库位
/// </summary>
[Display(Name = "LocationTypeEnum.M")]
M = 1,
/// <summary>
/// 线边库位
/// </summary>
[Display(Name = "LocationTypeEnum.X")]
X = 2
}
public enum LocationStatusEnum : short
{
[Display(Name = "LocationStatusEnum.Empty")]
Empty = 0,
[Display(Name = "LocationStatusEnum.EmptyContainer")]
EmptyContainer = 1,
[Display(Name = "LocationStatusEnum.Some")]
Some = 2,
[Display(Name = "LocationStatusEnum.Full")]
Full = 3,
[Display(Name = "LocationStatusEnum.Locked")]
Locked = 4,
}
public enum RowFlagEnum : short
{
[Display(Name = "RowFlagEnum.Outer")]
Outer = 0,
[Display(Name = "RowFlagEnum.Inner")]
Inner = 1,
} }
@@ -0,0 +1,37 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
namespace HHWMS.Web.Models
{
[Table("MaterialProcess")]
public class MaterialProcess : BasePoco
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public new int ID { get; set; }
[Display(Name = "MaterialProcess.MaterialCode", Description = "物料编码")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string MaterialCode { get; set; }
[Display(Name = "MaterialProcess.ProcessOrder", Description = "工序顺序")]
public int ProcessOrder { get; set; }
[Display(Name = "MaterialProcess.ProcessName", Description = "工序名称")]
[StringLength(100, ErrorMessage = "Validate.{0}stringmax{1}")]
public string ProcessName { get; set; }
[Display(Name = "MaterialProcess.ProcessCode", Description = "工序编码")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string ProcessCode { get; set; }
[Display(Name = "MaterialProcess.Description", Description = "工序描述")]
[StringLength(500, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Description { get; set; }
[Display(Name = "MaterialProcess.IsActive", Description = "是否启用")]
public bool IsActive { get; set; } = true;
}
}
+77 -23
View File
@@ -38,28 +38,10 @@ namespace HHWMS.Web.Models
出库 = 2, 出库 = 2,
/// <summary> /// <summary>
/// 盘料入库 /// 移库任务
/// </summary> /// </summary>
[Display(Name = "TaskType.PIn")] [Display(Name = "TaskType.Move")]
盘料入库 = 3, 移库 = 3,
/// <summary>
/// 盘料出库
/// </summary>
[Display(Name = "TaskType.POut")]
盘料出库 = 4,
/// <summary>
/// 散料入库
/// </summary>
[Display(Name = "TaskType.SIn")]
散料盒入库 = 5,
/// <summary>
/// 散料出库
/// </summary>
[Display(Name = "TaskType.SOut")]
散料盒出库 = 6
} }
/// <summary> /// <summary>
@@ -269,9 +251,9 @@ namespace HHWMS.Web.Models
} }
/// <summary> /// <summary>
/// 拣货口 /// 线边库拣货口
/// </summary> /// </summary>
public static class PickingLocation public static class PickingLocationXB
{ {
/// <summary> /// <summary>
/// 拣货口1 /// 拣货口1
@@ -308,4 +290,76 @@ namespace HHWMS.Web.Models
/// </summary> /// </summary>
public const string Picking_7 = "EnterExit_P2013"; public const string Picking_7 = "EnterExit_P2013";
} }
/// <summary>
/// 成品库拣货口
/// </summary>
public static class PickingLocationCP
{
/// <summary>
/// 拣货口1
/// </summary>
public const string Picking_1 = "EnterExit_P1001";
/// <summary>
/// 拣货口2
/// </summary>
public const string Picking_2 = "EnterExit_P1004";
/// <summary>
/// 拣货口3
/// </summary>
public const string Picking_3 = "EnterExit_P1007";
/// <summary>
/// 拣货口4
/// </summary>
public const string Picking_4 = "EnterExit_P1008";
/// <summary>
/// 拣货口5
/// </summary>
public const string Picking_5 = "EnterExit_P1009";
/// <summary>
/// 拣货口6
/// </summary>
public const string Picking_6 = "EnterExit_P1010";
}
#region location
public enum LocationTypeEnum : short
{
/// <summary>
/// 成品库位
/// </summary>
[Display(Name = "LocationTypeEnum.L")]
C = 0,
/// <summary>
/// 模具库位
/// </summary>
[Display(Name = "LocationTypeEnum.M")]
M = 1,
/// <summary>
/// 线边库位
/// </summary>
[Display(Name = "LocationTypeEnum.X")]
X = 2
}
public enum LocationStatusEnum : short
{
[Display(Name = "LocationStatusEnum.Idle")]
未锁 = 0,
[Display(Name = "LocationStatusEnum.Locked")]
锁定 = 1,
}
public enum RowFlagEnum : short
{
[Display(Name = "RowFlagEnum.Outer")]
Outer = 0,
[Display(Name = "RowFlagEnum.Inner")]
Inner = 1,
}
#endregion
} }
@@ -12,6 +12,8 @@ namespace HHWMS.Web
public decimal? Length { get; set; } public decimal? Length { get; set; }
public decimal? Width { get; set; } public decimal? Width { get; set; }
public decimal? Height { get; set; } public decimal? Height { get; set; }
public int Weight { get; set; }
public string InPort { get; set; }
public LocationTypeEnum LocationType { get; set; } public LocationTypeEnum LocationType { get; set; }
} }
} }
+3 -2
View File
@@ -18,8 +18,9 @@ namespace HHWMS.Web.Models
public new int ID { get; set; } public new int ID { get; set; }
[Display(Name = "Task.ZoneCode", Description = "库区")] [Display(Name = "Task.ZoneCode", Description = "库区")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")] public int ZoneId { get; set; }
public string ZoneCode { get; set; }
public LocationZone Zone { get; set; }
[Display(Name = "Task.TaskNo", Description = "任务号")] [Display(Name = "Task.TaskNo", Description = "任务号")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")] [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
+3 -2
View File
@@ -17,8 +17,9 @@ namespace HHWMS.Web.Models
public new int ID { get; set; } public new int ID { get; set; }
[Display(Name = "Task.ZoneCode", Description = "库区")] [Display(Name = "Task.ZoneCode", Description = "库区")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")] public int ZoneId { get; set; }
public string ZoneCode { get; set; }
public LocationZone Zone { get; set; }
[Display(Name = "Task.TaskNo", Description = "任务号")] [Display(Name = "Task.TaskNo", Description = "任务号")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")] [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
-3
View File
@@ -924,7 +924,4 @@
<data name="_Admin.ZipCode" xml:space="preserve"> <data name="_Admin.ZipCode" xml:space="preserve">
<value>Zip</value> <value>Zip</value>
</data> </data>
<data name="LocationStatusEnum.Locked" xml:space="preserve">
<value />
</data>
</root> </root>
+31 -16
View File
@@ -1018,25 +1018,13 @@
<value>错误信息</value> <value>错误信息</value>
</data> </data>
<data name="TaskType.In" xml:space="preserve"> <data name="TaskType.In" xml:space="preserve">
<value>盘料盒入库</value> <value>入库</value>
</data> </data>
<data name="TaskType.Out" xml:space="preserve"> <data name="TaskType.Out" xml:space="preserve">
<value>盘料盒出库</value> <value>出库</value>
</data> </data>
<data name="TaskType.PIn" xml:space="preserve"> <data name="TaskType.Move" xml:space="preserve">
<value>盘料入库</value> <value>移库</value>
</data>
<data name="TaskType.POut" xml:space="preserve">
<value>盘料出库</value>
</data>
<data name="TaskType.SIn" xml:space="preserve">
<value>散料盒入库</value>
</data>
<data name="TaskType.SOut" xml:space="preserve">
<value>散料盒出库</value>
</data>
<data name="TaskType.Move" xml:space="preserve">
<value>移库任务</value>
</data> </data>
<data name="TaskStatusEnum.0" xml:space="preserve"> <data name="TaskStatusEnum.0" xml:space="preserve">
<value>新建</value> <value>新建</value>
@@ -1123,6 +1111,9 @@
<value>库位类型</value> <value>库位类型</value>
</data> </data>
<data name="Location.Status" xml:space="preserve"> <data name="Location.Status" xml:space="preserve">
<value>是否锁定</value>
</data>
<data name="Location.ContainerStatus" xml:space="preserve">
<value>库位状态</value> <value>库位状态</value>
</data> </data>
<data name="Location.Row" xml:space="preserve"> <data name="Location.Row" xml:space="preserve">
@@ -1440,6 +1431,9 @@
<data name="LocationStatusEnum.Locked" xml:space="preserve"> <data name="LocationStatusEnum.Locked" xml:space="preserve">
<value>锁定</value> <value>锁定</value>
</data> </data>
<data name="LocationStatusEnum.Idle" xml:space="preserve">
<value>空闲</value>
</data>
<data name="Location.ZoneName" xml:space="preserve"> <data name="Location.ZoneName" xml:space="preserve">
<value>库区</value> <value>库区</value>
</data> </data>
@@ -1449,4 +1443,25 @@
<data name="InventoryTaskStatusEnum.Locked" xml:space="preserve"> <data name="InventoryTaskStatusEnum.Locked" xml:space="preserve">
<value>任务中</value> <value>任务中</value>
</data> </data>
<data name="MaterialProcess.MaterialCode" xml:space="preserve">
<value>物料编码</value>
</data>
<data name="MaterialProcess.ProcessOrder" xml:space="preserve">
<value>工序顺序</value>
</data>
<data name="MaterialProcess.ProcessName" xml:space="preserve">
<value>工序名称</value>
</data>
<data name="MaterialProcess.ProcessCode" xml:space="preserve">
<value>工序编码</value>
</data>
<data name="MaterialProcess.Description" xml:space="preserve">
<value>工序描述</value>
</data>
<data name="MaterialProcess.IsActive" xml:space="preserve">
<value>是否启用</value>
</data>
<data name="Location.OutPort" xml:space="preserve">
<value>拣货口</value>
</data>
</root> </root>