成品库入库页面
库纯出库相关 location添加sendwcstask
This commit is contained in:
1 parent
b12ed2d5e5
commit
2435176f77
13 files changed
+1687
-58
No files matched your search
@@ -57,7 +57,8 @@ namespace HHWMS.Web
|
|||||||
var timeSinceLastRequest = DateTime.Now - lastRequestTime;
|
var timeSinceLastRequest = DateTime.Now - lastRequestTime;
|
||||||
if (timeSinceLastRequest.TotalMilliseconds < DEBOUNCE_INTERVAL_MS)
|
if (timeSinceLastRequest.TotalMilliseconds < DEBOUNCE_INTERVAL_MS)
|
||||||
{
|
{
|
||||||
var remainingSeconds = Math.Ceiling((DEBOUNCE_INTERVAL_MS - timeSinceLastRequest.TotalMilliseconds) / 1000);
|
var remainingSeconds =
|
||||||
|
Math.Ceiling((DEBOUNCE_INTERVAL_MS - timeSinceLastRequest.TotalMilliseconds) / 1000);
|
||||||
return ApiResultError($"请求过于频繁,请等待{remainingSeconds}秒后重试");
|
return ApiResultError($"请求过于频繁,请等待{remainingSeconds}秒后重试");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,18 +116,17 @@ namespace HHWMS.Web
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 状态返回(带防抖)
|
/// 状态返回(带防抖)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Public]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public Task<IActionResult> TaskStatusResult(WcsRequest request)
|
public Task<IActionResult> TaskStatusResult(WcsRequest request)
|
||||||
{
|
{
|
||||||
if (request == null || string.IsNullOrEmpty(request.PalletNo))
|
if (request == null || string.IsNullOrEmpty(request.TaskNo))
|
||||||
{
|
{
|
||||||
return Task.FromResult<IActionResult>(ApiResultError("请求参数无效"));
|
return Task.FromResult<IActionResult>(ApiResultError("请求参数无效"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return WithDebounce($"TaskStatus_{request.PalletNo}", async () =>
|
return WithDebounce($"TaskStatus_{request.PalletNo}",
|
||||||
{
|
async () => { return await ProcessTaskStatusResult(request); });
|
||||||
return await ProcessTaskStatusResult(request);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -165,9 +165,24 @@ namespace HHWMS.Web
|
|||||||
{
|
{
|
||||||
if (request.State == 10) // 任务请求,需要分配仓位
|
if (request.State == 10) // 任务请求,需要分配仓位
|
||||||
{
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(task.ToLocation))
|
||||||
|
{
|
||||||
|
return ApiResult(new { LocationCode = task.ToLocation });
|
||||||
|
}
|
||||||
|
|
||||||
// 根据请求的高度,分配仓位
|
// 根据请求的高度,分配仓位
|
||||||
var locationVm = Wtm.CreateVM<LocationVM>();
|
var locationVm = Wtm.CreateVM<LocationVM>();
|
||||||
|
|
||||||
request.RoadWay = 2;
|
request.RoadWay = 2;
|
||||||
|
|
||||||
|
// 默认1 模具2 低仓位3 高仓位4 成品大于4 超限 模具大于2 超限
|
||||||
|
if(request.Height == 2)
|
||||||
|
request.Height = 999;
|
||||||
|
else if (request.Height == 3)
|
||||||
|
request.Height = 1100;
|
||||||
|
else
|
||||||
|
request.Height = 0;
|
||||||
|
|
||||||
var container = _unitWork.FindSingle<Container>(x => x.Code == task.ContainerCode);
|
var container = _unitWork.FindSingle<Container>(x => x.Code == task.ContainerCode);
|
||||||
if (container != null)
|
if (container != null)
|
||||||
{
|
{
|
||||||
@@ -179,16 +194,29 @@ namespace HHWMS.Web
|
|||||||
_ => request.LocationType
|
_ => request.LocationType
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
var location = await locationVm.GetLocation(request).Data;
|
|
||||||
|
// 模具库 高度超限直接返回失败
|
||||||
|
if (request.LocationType == LocationTypeEnum.M && request.Height >= 2)
|
||||||
|
{
|
||||||
|
return ApiResultError(msg: "模具超高,未找到合适的仓位");
|
||||||
|
}
|
||||||
|
var location = locationVm.GetLocation(request).Data;
|
||||||
if (location != null)
|
if (location != null)
|
||||||
{
|
{
|
||||||
// 更新任务的目标仓位
|
// 更新任务的目标仓位
|
||||||
task.ToLocation = location.LocationCode;
|
task.ToLocation = location.LocationCode;
|
||||||
_unitWork.Update(task);
|
_unitWork.Update(task);
|
||||||
|
|
||||||
|
var loc = _unitWork.FindSingle<Location>(x => x.Code == task.ToLocation);
|
||||||
|
loc.Status = LocationStatusEnum.锁定;
|
||||||
|
loc.Version = Guid.NewGuid();
|
||||||
|
loc.UpdateTime = DateTime.Now;
|
||||||
|
_unitWork.Update(loc);
|
||||||
|
return ApiResult(new { LocationCode = location.LocationCode });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return ApiResultError("未找到合适的仓位");
|
return ApiResultError(msg: "未找到合适的仓位");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (request.State == 100) // 任务完成
|
else if (request.State == 100) // 任务完成
|
||||||
@@ -215,18 +243,25 @@ namespace HHWMS.Web
|
|||||||
var invTrans = new List<InventoryTransaction>();
|
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.入库)
|
// 线边库
|
||||||
|
if (inventory.ZoneId == 1027)
|
||||||
|
{
|
||||||
|
if (task.TaskType == TaskTypeEnum.入库)
|
||||||
|
{
|
||||||
|
var material =
|
||||||
|
_unitWork.FindSingle<Material>(x => x.MaterialCode == inventory.MaterialCode);
|
||||||
inventory.Qty = (request.Weight - ContainerWeight) / material.Qty;
|
inventory.Qty = (request.Weight - ContainerWeight) / material.Qty;
|
||||||
inventory.TaskStatus = InventoryTaskStatusEnum.Idle;
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (task.TaskType != TaskTypeEnum.移库)
|
||||||
|
{
|
||||||
// 创建库存交易记录 放到任务完成,计算数量信息
|
// 创建库存交易记录 放到任务完成,计算数量信息
|
||||||
var invTransaction = new InventoryTransaction
|
var invTransaction = new InventoryTransaction
|
||||||
{
|
{
|
||||||
Type = task.TaskType == TaskTypeEnum.入库 ? InventoryTranType.入库 : InventoryTranType.出库,
|
Type = task.TaskType == TaskTypeEnum.入库
|
||||||
|
? InventoryTranType.入库
|
||||||
|
: InventoryTranType.出库,
|
||||||
ContainerCode = task.ContainerCode,
|
ContainerCode = task.ContainerCode,
|
||||||
LocationCode = task.ToLocation,
|
LocationCode = task.ToLocation,
|
||||||
MaterialCode = inventory.MaterialCode,
|
MaterialCode = inventory.MaterialCode,
|
||||||
@@ -238,7 +273,46 @@ namespace HHWMS.Web
|
|||||||
};
|
};
|
||||||
invTrans.Add(invTransaction);
|
invTrans.Add(invTransaction);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 创建库存交易记录 放到任务完成,计算数量信息
|
||||||
|
var invTransaction = new InventoryTransaction
|
||||||
|
{
|
||||||
|
Type = 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);
|
||||||
|
|
||||||
|
var invTransaction2 = new InventoryTransaction
|
||||||
|
{
|
||||||
|
Type = 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(invTransaction2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inventory.TaskStatus = InventoryTaskStatusEnum.Idle;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (invTrans.Any())
|
||||||
|
{
|
||||||
_unitWork.BatchAdd(invTrans);
|
_unitWork.BatchAdd(invTrans);
|
||||||
|
}
|
||||||
_unitWork.BatchUpdate(inventories);
|
_unitWork.BatchUpdate(inventories);
|
||||||
|
|
||||||
|
|
||||||
@@ -246,24 +320,73 @@ namespace HHWMS.Web
|
|||||||
var container = _unitWork.FindSingle<Container>(x => x.Code == task.ContainerCode);
|
var container = _unitWork.FindSingle<Container>(x => x.Code == task.ContainerCode);
|
||||||
if (container != null)
|
if (container != null)
|
||||||
{
|
{
|
||||||
container.LocationCode = task.ToLocation;
|
container.LocationCode = task.TaskType == TaskTypeEnum.出库 ? "" : task.ToLocation;
|
||||||
container.IsLock = ContainerLockEnum.未锁;
|
container.IsLock = ContainerLockEnum.未锁;
|
||||||
container.UpdateTime = DateTime.Now;
|
container.UpdateTime = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
|
||||||
_unitWork.Update(container);
|
_unitWork.Update(container);
|
||||||
|
|
||||||
// 更新库位状态
|
// 更新库位状态(区分入库、出库、移库)
|
||||||
var location = task.TaskType == TaskTypeEnum.入库
|
switch (task.TaskType)
|
||||||
? _unitWork.FindSingle<Location>(x => x.Code == task.ToLocation)
|
|
||||||
: _unitWork.FindSingle<Location>(x => x.Code == task.FromLocation);
|
|
||||||
if (location != null)
|
|
||||||
{
|
{
|
||||||
location.ContainerCode = task.TaskType == TaskTypeEnum.入库 ? request.PalletNo : "";
|
case TaskTypeEnum.入库:
|
||||||
location.Status = LocationStatusEnum.未锁;
|
// 处理入库:更新目标库位
|
||||||
location.ContainerStatus = LocationStatus.空仓位;
|
var inLocation = _unitWork.FindSingle<Location>(x => x.Code == task.ToLocation);
|
||||||
location.UpdateTime = DateTime.Now;
|
if (inLocation != null)
|
||||||
|
{
|
||||||
|
inLocation.ContainerCode = task.ContainerCode; // 绑定容器编码
|
||||||
|
inLocation.Status = LocationStatusEnum.未锁; // 标记为未锁状态
|
||||||
|
inLocation.ContainerStatus = inventories.Any() ? LocationStatus.有货 : LocationStatus.空容器;
|
||||||
|
inLocation.UpdateTime = DateTime.Now;
|
||||||
|
_unitWork.Update(inLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TaskTypeEnum.出库:
|
||||||
|
// 处理出库:更新源库位
|
||||||
|
var outLocation = _unitWork.FindSingle<Location>(x => x.Code == task.FromLocation);
|
||||||
|
if (outLocation != null)
|
||||||
|
{
|
||||||
|
outLocation.ContainerCode = ""; // 清空容器编码
|
||||||
|
outLocation.Status = LocationStatusEnum.未锁; // 标记为未锁状态
|
||||||
|
outLocation.ContainerStatus = LocationStatus.空仓位; // 标记为空仓位
|
||||||
|
outLocation.UpdateTime = DateTime.Now;
|
||||||
|
_unitWork.Update(outLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TaskTypeEnum.移库:
|
||||||
|
// 处理移库:同时更新源库位和目标库位
|
||||||
|
// 1. 更新源库位(移出后变为空)
|
||||||
|
var sourceLocation = _unitWork.FindSingle<Location>(x => x.Code == task.FromLocation);
|
||||||
|
if (sourceLocation != null)
|
||||||
|
{
|
||||||
|
sourceLocation.ContainerCode = "";
|
||||||
|
sourceLocation.Status = LocationStatusEnum.未锁;
|
||||||
|
sourceLocation.ContainerStatus = LocationStatus.空仓位;
|
||||||
|
sourceLocation.UpdateTime = DateTime.Now;
|
||||||
|
_unitWork.Update(sourceLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 更新目标库位(移入后有容器)
|
||||||
|
var targetLocation = _unitWork.FindSingle<Location>(x => x.Code == task.ToLocation);
|
||||||
|
if (targetLocation != null)
|
||||||
|
{
|
||||||
|
targetLocation.ContainerCode = task.ContainerCode;
|
||||||
|
targetLocation.Status = LocationStatusEnum.未锁;
|
||||||
|
targetLocation.UpdateTime = DateTime.Now;
|
||||||
|
_unitWork.Update(targetLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// 处理未定义的任务类型(可选)
|
||||||
|
throw new ArgumentOutOfRangeException($"未处理的任务类型:{task.TaskType}");
|
||||||
}
|
}
|
||||||
_unitWork.Update(location);
|
|
||||||
|
|
||||||
// 更新任务状态为完成
|
// 更新任务状态为完成
|
||||||
task.Status = TaskStatusEnum.完成;
|
task.Status = TaskStatusEnum.完成;
|
||||||
@@ -312,6 +435,7 @@ namespace HHWMS.Web
|
|||||||
var updateResult = UpdateLocationAndContainer(code.Data.LocationCode, request.PalletNo);
|
var updateResult = UpdateLocationAndContainer(code.Data.LocationCode, request.PalletNo);
|
||||||
return Task.FromResult<IActionResult>(updateResult);
|
return Task.FromResult<IActionResult>(updateResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.FromResult<IActionResult>(ApiResultError("没有符合条件的可用库位"));
|
return Task.FromResult<IActionResult>(ApiResultError("没有符合条件的可用库位"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -325,7 +449,8 @@ namespace HHWMS.Web
|
|||||||
private IActionResult UpdateLocationAndContainer(string locationCode, string palletNo)
|
private IActionResult UpdateLocationAndContainer(string locationCode, string palletNo)
|
||||||
{
|
{
|
||||||
var location = _unitWork.Find<Location>(x => x.Code == locationCode).FirstOrDefault();
|
var location = _unitWork.Find<Location>(x => x.Code == locationCode).FirstOrDefault();
|
||||||
var resultNum = _unitWork.BatchUpdate<Location>(x => x.Code == locationCode && x.Version == location.Version,
|
var resultNum = _unitWork.BatchUpdate<Location>(
|
||||||
|
x => x.Code == locationCode && x.Version == location.Version,
|
||||||
x => new Location()
|
x => new Location()
|
||||||
{
|
{
|
||||||
ContainerCode = palletNo,
|
ContainerCode = palletNo,
|
||||||
|
|||||||
@@ -87,62 +87,90 @@ namespace HHWMS.Web
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找双伸位巷道的空仓位
|
/// 查找双伸位巷道的空仓位
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private string GetEmptyLocationByDouble(int roadway, LocationTypeEnum locationType, decimal? height = 0)
|
private string GetEmptyLocationByDouble(int roadway, LocationTypeEnum locationType, string inPort,
|
||||||
|
decimal? height = 0)
|
||||||
{
|
{
|
||||||
// 一次性获取所需的所有数据,避免多次查询数据库
|
// 一次性获取所需的所有数据,避免多次查询数据库
|
||||||
var locationPairs = DC.Set<Location>()
|
var locationPairs = DC.Set<Location>()
|
||||||
.Where(l => l.RoadWay == roadway
|
.Where(l => l.Type == locationType
|
||||||
&& l.Type == locationType
|
&& l.Status == LocationStatusEnum.未锁
|
||||||
&& !l.IsStop
|
&& !l.IsStop
|
||||||
&& l.Height >= height)
|
&& l.Height >= height)
|
||||||
.Select(l => new
|
|
||||||
{
|
|
||||||
l.Code,
|
|
||||||
l.ContiguousCode,
|
|
||||||
l.Status,
|
|
||||||
l.ContainerStatus,
|
|
||||||
l.RowFlag,
|
|
||||||
l.Height,
|
|
||||||
l.Layer,
|
|
||||||
l.Line
|
|
||||||
})
|
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
.ToDictionary(l => l.Code);
|
.ToDictionary(l => l.Code);
|
||||||
|
if (locationPairs.Count <= 20)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
// 1. 优先查找里外仓位都为空的里仓位
|
// 1. 优先查找里外仓位都为空的里仓位
|
||||||
var emptyInnerLocation = locationPairs.Values
|
/// 1 7 8 优先1巷道
|
||||||
|
/// 4 9 10 优先2 巷道
|
||||||
|
var availableLocation = locationPairs.Values
|
||||||
.Where(l => l.RowFlag == RowFlagEnum.Inner
|
.Where(l => l.RowFlag == RowFlagEnum.Inner
|
||||||
&& l.Status == LocationStatusEnum.未锁
|
|
||||||
&& l.ContainerStatus == LocationStatus.空仓位
|
&& l.ContainerStatus == LocationStatus.空仓位
|
||||||
&& locationPairs.TryGetValue(l.ContiguousCode, out var outer)
|
&& locationPairs.TryGetValue(l.ContiguousCode, out var outer)
|
||||||
&& outer.Status == LocationStatusEnum.未锁
|
|
||||||
&& outer.ContainerStatus == LocationStatus.空仓位)
|
&& outer.ContainerStatus == LocationStatus.空仓位)
|
||||||
.OrderBy(l => l.Height)
|
.OrderBy(l => l.Height)
|
||||||
.ThenBy(l => l.Layer)
|
.ToList();
|
||||||
.ThenBy(l => l.Line)
|
|
||||||
.FirstOrDefault();
|
|
||||||
|
|
||||||
if (emptyInnerLocation != null)
|
if (availableLocation.Any())
|
||||||
{
|
{
|
||||||
return emptyInnerLocation.Code;
|
return GetSortedLocationCode(availableLocation, inPort) ?? availableLocation.First().Code;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 查找里仓位有货,外仓位为空的外仓位
|
// 2. 查找里仓位有货,外仓位为空的外仓位
|
||||||
var availableOuterLocation = locationPairs.Values
|
availableLocation = locationPairs.Values
|
||||||
.Where(l => l.RowFlag == 0
|
.Where(l => l.RowFlag == RowFlagEnum.Outer
|
||||||
&& l.Status == LocationStatusEnum.未锁
|
&& l.Status == LocationStatusEnum.未锁
|
||||||
&& l.ContainerStatus == LocationStatus.空仓位
|
&& l.ContainerStatus == LocationStatus.空仓位
|
||||||
&& locationPairs.TryGetValue(l.ContiguousCode, out var inner)
|
&& locationPairs.TryGetValue(l.ContiguousCode, out var inner)
|
||||||
&& inner.Status == LocationStatusEnum.未锁
|
&& inner.Status == LocationStatusEnum.未锁
|
||||||
&& inner.ContainerStatus == LocationStatus.有货)
|
&& inner.ContainerStatus == LocationStatus.有货)
|
||||||
.OrderBy(l => l.Height)
|
.OrderBy(l => l.Height)
|
||||||
.ThenBy(l => l.Layer)
|
.ToList();
|
||||||
.ThenBy(l => l.Line)
|
|
||||||
.FirstOrDefault();
|
|
||||||
|
|
||||||
return availableOuterLocation?.Code;
|
return GetSortedLocationCode(availableLocation, inPort) ?? availableLocation.First().Code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetSortedLocationCode(List<Location> locations, string inPort)
|
||||||
|
{
|
||||||
|
if (locations == null || !locations.Any())
|
||||||
|
return null;
|
||||||
|
|
||||||
|
// 定义端口组与排序规则的映射(键:端口数组,值:排序函数)
|
||||||
|
var portSortMappings = new Dictionary<string[], Func<IEnumerable<Location>, IOrderedEnumerable<Location>>>
|
||||||
|
{
|
||||||
|
{
|
||||||
|
new[] { "EnterExit_P1001" },
|
||||||
|
locs => locs.OrderBy(x => x.Height).ThenBy(x => x.RoadWay).ThenBy(l => l.Layer).ThenByDescending(x => x.Line)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
new[] { "EnterExit_P1007", "EnterExit_P1008" },
|
||||||
|
locs => locs.OrderBy(x => x.Height).ThenBy(x => x.RoadWay).ThenBy(l => l.Layer).ThenBy(x => x.Line)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
new[] { "EnterExit_P1004" },
|
||||||
|
locs => locs.OrderBy(x => x.Height).ThenByDescending(x => x.RoadWay).ThenBy(l => l.Layer).ThenByDescending(x => x.Line)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
new[] { "EnterExit_P1009", "EnterExit_P1010" },
|
||||||
|
locs => locs.OrderBy(x => x.Height).ThenByDescending(x => x.RoadWay).ThenBy(l => l.Layer).ThenBy(x => x.Line)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 查找匹配的端口组,应用排序规则
|
||||||
|
foreach (var (ports, sortFunc) in portSortMappings)
|
||||||
|
{
|
||||||
|
if (ports.Contains(inPort))
|
||||||
|
{
|
||||||
|
return sortFunc(locations).FirstOrDefault()?.Code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 无匹配端口时,返回默认排序的第一个
|
||||||
|
return locations.FirstOrDefault()?.Code;
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据巷道类型查找可用仓位
|
/// 根据巷道类型查找可用仓位
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -169,7 +197,8 @@ namespace HHWMS.Web
|
|||||||
break;
|
break;
|
||||||
case 4: // 双伸位
|
case 4: // 双伸位
|
||||||
locationCode =
|
locationCode =
|
||||||
GetEmptyLocationByDouble(request.RoadWay.Value, request.LocationType, request.Height);
|
GetEmptyLocationByDouble(request.RoadWay.Value, request.LocationType, request.InPort,
|
||||||
|
request.Height);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return ResponseResult<dynamic>.Error("未知的巷道类型");
|
return ResponseResult<dynamic>.Error("未知的巷道类型");
|
||||||
@@ -364,5 +393,181 @@ namespace HHWMS.Web
|
|||||||
Total = availableLocations.Count
|
Total = availableLocations.Count
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 下发任务到wcs
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="taskHeader"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public ResponseResult<dynamic> SendWcsTask(TaskHeader task)
|
||||||
|
{
|
||||||
|
// 下发任务到wcs
|
||||||
|
// 1.入库任务直接下发
|
||||||
|
// 2.出库任务 判断是否为双伸位库位
|
||||||
|
// 2.1 单伸位:直接下发
|
||||||
|
// 2.2 双伸位:判断出库库位是否为里仓位
|
||||||
|
// 2.2.1 里仓位,判断是否需要移库,先生成移库任务,再下发出库任务
|
||||||
|
// 2.2.2 外仓位,直接下发
|
||||||
|
|
||||||
|
var _unitWork = new UnitWork(Wtm);
|
||||||
|
if (task.TaskType != TaskTypeEnum.入库)
|
||||||
|
{
|
||||||
|
var loc = DC.Set<Location>().Where(x => x.Code == task.FromLocation)
|
||||||
|
.AsNoTracking()
|
||||||
|
.FirstOrDefault();
|
||||||
|
// 双伸位 并且里仓位
|
||||||
|
if (loc != null && loc.RowFlag == RowFlagEnum.Inner && !string.IsNullOrWhiteSpace(loc.ContiguousCode))
|
||||||
|
{
|
||||||
|
var outter = DC.Set<Location>().FirstOrDefault(x => x.Code == loc.ContiguousCode);
|
||||||
|
if (outter != null && outter.Status == LocationStatusEnum.未锁 &&
|
||||||
|
outter.ContainerStatus != LocationStatus.空仓位)
|
||||||
|
{
|
||||||
|
// 查找移库仓位
|
||||||
|
var moveloc = GetMoveLocation(outter);
|
||||||
|
if (moveloc.Status)
|
||||||
|
{
|
||||||
|
string code = moveloc.Data.Code;
|
||||||
|
var movelocation = _unitWork.FindSingle<Location>(x => x.Code == code);
|
||||||
|
|
||||||
|
|
||||||
|
// 生成outter移库任务
|
||||||
|
var outterTask = new TaskHeader()
|
||||||
|
{
|
||||||
|
ZoneId = outter.ZoneId,
|
||||||
|
TaskNo = _unitWork.GetSerialNumber("Move"),
|
||||||
|
TaskType = TaskTypeEnum.移库,
|
||||||
|
ContainerCode = outter.ContainerCode,
|
||||||
|
FromLocation = outter.Code,
|
||||||
|
ToLocation = movelocation.Code,
|
||||||
|
Status = TaskStatusEnum.待下发,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
CreateBy = Wtm?.LoginUserInfo?.ITCode ?? "WMS",
|
||||||
|
};
|
||||||
|
var result = SendWcsTask(outterTask);
|
||||||
|
if (result.Status)
|
||||||
|
{
|
||||||
|
movelocation.Status = LocationStatusEnum.锁定;
|
||||||
|
_unitWork.Update(movelocation);
|
||||||
|
|
||||||
|
outter.Status = LocationStatusEnum.锁定;
|
||||||
|
_unitWork.Update(outter);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return moveloc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下发任务到wcs
|
||||||
|
var postData = new
|
||||||
|
{
|
||||||
|
TaskNo = task.TaskNo,
|
||||||
|
PalletNo = task.ContainerCode,
|
||||||
|
FromLocation = task.FromLocation,
|
||||||
|
ToLocation = task.ToLocation
|
||||||
|
};
|
||||||
|
task.Status = TaskStatusEnum.已下发;
|
||||||
|
task.UpdateTime = DateTime.Now;
|
||||||
|
task.UpdateBy = "WMS";
|
||||||
|
_unitWork.Add(task);
|
||||||
|
/*try
|
||||||
|
{
|
||||||
|
var domain = task.ZoneId == 1027 ? "WCSXB" : "WCSCP";
|
||||||
|
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>(domain, "TaskAssign", HttpMethodEnum.POST, postData)
|
||||||
|
.Result?.Data;
|
||||||
|
|
||||||
|
if (res != null && res.Success)
|
||||||
|
{
|
||||||
|
task.Status = TaskStatusEnum.已下发;
|
||||||
|
task.UpdateTime = DateTime.Now;
|
||||||
|
task.UpdateBy = "WMS";
|
||||||
|
_unitWork.Add(task);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
task.ErrorMsg = res?.Msg;
|
||||||
|
return ResponseResult<dynamic>.Error(res?.Msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
task.ErrorMsg = ex.Message;
|
||||||
|
return ResponseResult<dynamic>.Error("任务下发失败!");
|
||||||
|
}*/
|
||||||
|
|
||||||
|
return ResponseResult<dynamic>.Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponseResult<dynamic> GetMoveLocation(Location outter)
|
||||||
|
{
|
||||||
|
// 查找移库仓位
|
||||||
|
// 一次性获取所需的所有数据,避免多次查询数据库
|
||||||
|
var locationPairs = DC.Set<Location>()
|
||||||
|
.Where(l => l.Type == outter.Type
|
||||||
|
&& !l.IsStop
|
||||||
|
&& l.Status == LocationStatusEnum.未锁
|
||||||
|
&& l.Height >= outter.Height)
|
||||||
|
.Select(l => new
|
||||||
|
{
|
||||||
|
l.RoadWay,
|
||||||
|
l.Code,
|
||||||
|
l.ContiguousCode,
|
||||||
|
l.Status,
|
||||||
|
l.ContainerStatus,
|
||||||
|
l.RowFlag,
|
||||||
|
l.Height,
|
||||||
|
l.Layer,
|
||||||
|
l.Line
|
||||||
|
})
|
||||||
|
.AsNoTracking()
|
||||||
|
.ToDictionary(l => l.Code);
|
||||||
|
|
||||||
|
// 1. 优先查找里外仓位都为空的里仓位
|
||||||
|
var moveloc = locationPairs.Values
|
||||||
|
.Where(l => l.RowFlag == RowFlagEnum.Inner
|
||||||
|
&& l.ContainerStatus == LocationStatus.空仓位
|
||||||
|
&& locationPairs.TryGetValue(l.ContiguousCode, out var outer)
|
||||||
|
&& outer.ContainerStatus == LocationStatus.空仓位)
|
||||||
|
.OrderBy(l => l.Height)
|
||||||
|
.ThenBy(l => Math.Abs(outter.RoadWay - l.RoadWay))
|
||||||
|
.ThenBy(l => Math.Abs(outter.Line - l.Line))
|
||||||
|
.ThenBy(l => l.Layer)
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
if (moveloc == null)
|
||||||
|
{
|
||||||
|
// 2. 查找里仓位有货,外仓位为空的外仓位
|
||||||
|
moveloc = locationPairs.Values
|
||||||
|
.Where(l => l.RowFlag == RowFlagEnum.Outer
|
||||||
|
&& l.ContainerStatus == LocationStatus.空仓位
|
||||||
|
&& locationPairs.TryGetValue(l.ContiguousCode, out var inner)
|
||||||
|
&& inner.Status == LocationStatusEnum.未锁
|
||||||
|
&& inner.ContainerStatus == LocationStatus.有货)
|
||||||
|
.OrderBy(l => Math.Abs((decimal)outter.Height - (decimal)l.Height))
|
||||||
|
.ThenBy(l => Math.Abs(outter.RoadWay - l.RoadWay))
|
||||||
|
.ThenBy(l => Math.Abs(outter.Line - l.Line))
|
||||||
|
.ThenBy(l => l.Layer)
|
||||||
|
.FirstOrDefault();
|
||||||
|
if (moveloc == null)
|
||||||
|
{
|
||||||
|
return ResponseResult<dynamic>.Error("找不到可用的移库仓位!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ResponseResult<dynamic>.Success(new { LocationCode = moveloc.Code });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ResponseResult<dynamic>.Success(new { LocationCode = moveloc.Code });
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -345,5 +345,150 @@ namespace HHWMS.Web.Controllers
|
|||||||
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region InvOut 成品出库
|
||||||
|
[ActionDescription("TaskType.Out")]
|
||||||
|
public ActionResult InvOut2(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 InvOut2(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 = 2,
|
||||||
|
Status = TaskStatusEnum.新建,
|
||||||
|
CreateBy = Wtm.LoginUserInfo.ITCode,
|
||||||
|
CreateTime = DateTime.Now
|
||||||
|
};
|
||||||
|
|
||||||
|
var locationVm = Wtm.CreateVM<LocationVM>();
|
||||||
|
var result = locationVm.SendWcsTask(task);
|
||||||
|
if (result.Status)
|
||||||
|
{
|
||||||
|
// 更新库存
|
||||||
|
inv.TaskStatus = InventoryTaskStatusEnum.Locked;
|
||||||
|
inv.UpdateTime = DateTime.Now;
|
||||||
|
_unitWork.Update(inv);
|
||||||
|
|
||||||
|
// 更新容器
|
||||||
|
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
|
||||||
|
{
|
||||||
|
return FFResult().CloseDialog().Message(result.Message?? "WCS任务下发失败").RefreshGrid();
|
||||||
|
}
|
||||||
|
/*// 6. 调用WCS接口下发任务
|
||||||
|
var wcsTaskModel = new WCSTaskModel
|
||||||
|
{
|
||||||
|
TaskNo = task.TaskNo,
|
||||||
|
PalletNo = task.ContainerCode,
|
||||||
|
FromLocation = task.FromLocation, // 入库任务起始位置为空
|
||||||
|
ToLocation = task.ToLocation,
|
||||||
|
};
|
||||||
|
|
||||||
|
//调用WCS任务下发接口
|
||||||
|
var wcsResult = Wtm.CallAPI<WCSTaskResponse>("WCSCP", "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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -27,6 +27,8 @@ namespace HHWMS.Web
|
|||||||
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")
|
this.MakeAction("Inventory","InvOut",Localizer["TaskType.Out"],"",GridActionParameterTypesEnum.SingleId,"inventory")
|
||||||
.SetSize(500,400),
|
.SetSize(500,400),
|
||||||
|
this.MakeAction("Inventory","InvOut2",Localizer["TaskType.Out1"],"",GridActionParameterTypesEnum.SingleId,"inventory")
|
||||||
|
.SetSize(500,400),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace HHWMS.Web
|
|||||||
{
|
{
|
||||||
public List<ComboSelectListItem> AllZones { get; set; }
|
public List<ComboSelectListItem> AllZones { get; set; }
|
||||||
public List<ComboSelectListItem> AllOutPorts { get; set; }
|
public List<ComboSelectListItem> AllOutPorts { get; set; }
|
||||||
|
public List<ComboSelectListItem> AllOutPorts2 { get; set; }
|
||||||
|
|
||||||
[Display(Name = "Location.OutPort", Description = "拣货口")]
|
[Display(Name = "Location.OutPort", Description = "拣货口")]
|
||||||
public string OutPort { get; set; }
|
public string OutPort { get; set; }
|
||||||
@@ -26,6 +27,7 @@ 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>
|
AllOutPorts = new List<ComboSelectListItem>
|
||||||
{
|
{
|
||||||
new ComboSelectListItem { Text = "拣货口1", Value = "EnterExit_P2001" },
|
new ComboSelectListItem { Text = "拣货口1", Value = "EnterExit_P2001" },
|
||||||
@@ -36,6 +38,15 @@ namespace HHWMS.Web
|
|||||||
new ComboSelectListItem { Text = "拣货口6", Value = "EnterExit_P2011" },
|
new ComboSelectListItem { Text = "拣货口6", Value = "EnterExit_P2011" },
|
||||||
new ComboSelectListItem { Text = "拣货口7", Value = "EnterExit_P2013" }
|
new ComboSelectListItem { Text = "拣货口7", Value = "EnterExit_P2013" }
|
||||||
};
|
};
|
||||||
|
AllOutPorts2 = new List<ComboSelectListItem>
|
||||||
|
{
|
||||||
|
new ComboSelectListItem { Text = "拣货口1", Value = "EnterExit_P1001" },
|
||||||
|
new ComboSelectListItem { Text = "拣货口2", Value = "EnterExit_P1004" },
|
||||||
|
new ComboSelectListItem { Text = "拣货口3", Value = "EnterExit_P1007" },
|
||||||
|
new ComboSelectListItem { Text = "拣货口4", Value = "EnterExit_P1008" },
|
||||||
|
new ComboSelectListItem { Text = "拣货口5", Value = "EnterExit_P1009" },
|
||||||
|
new ComboSelectListItem { Text = "拣货口6", Value = "EnterExit_P1010" }
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DoAdd()
|
public override void DoAdd()
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
<wt:form vm="@Model">
|
<wt:form vm="@Model">
|
||||||
<wt:row items-per-row="ItemsPerRowEnum.One">
|
<wt:row items-per-row="ItemsPerRowEnum.One">
|
||||||
|
<wt:hidden field="Entity.ZoneId" />
|
||||||
<wt:hidden field="Entity.ID" />
|
<wt:hidden field="Entity.ID" />
|
||||||
<wt:combobox field="OutPort" items="AllOutPorts"/>
|
<wt:combobox field="OutPort" items="AllOutPorts"/>
|
||||||
</wt:row>
|
</wt:row>
|
||||||
@@ -11,3 +12,4 @@
|
|||||||
<wt:closebutton />
|
<wt:closebutton />
|
||||||
</wt:row>
|
</wt:row>
|
||||||
</wt:form>
|
</wt:form>
|
||||||
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
@model HHWMS.Web.InventoryVM
|
||||||
|
@inject IStringLocalizer<Program> Localizer;
|
||||||
|
|
||||||
|
<wt:form vm="@Model">
|
||||||
|
<wt:row items-per-row="ItemsPerRowEnum.One">
|
||||||
|
<wt:hidden field="Entity.ZoneId" />
|
||||||
|
<wt:hidden field="Entity.ID" />
|
||||||
|
<wt:combobox field="OutPort" items="AllOutPorts2"/>
|
||||||
|
</wt:row>
|
||||||
|
<wt:row align="AlignEnum.Right">
|
||||||
|
<wt:submitbutton />
|
||||||
|
<wt:closebutton />
|
||||||
|
</wt:row>
|
||||||
|
</wt:form>
|
||||||
|
|
||||||
@@ -0,0 +1,541 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using HHWMS.Web.Models;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using WalkingTec.Mvvm.Core;
|
||||||
|
using WalkingTec.Mvvm.Mvc;
|
||||||
|
|
||||||
|
namespace HHWMS.Web.Controllers
|
||||||
|
{
|
||||||
|
[Area("receipt")]
|
||||||
|
[ActionDescription("成品出入库操作")]
|
||||||
|
public partial class SimpleReceiptInController : BaseController
|
||||||
|
{
|
||||||
|
private readonly IUnitWork _unitWork;
|
||||||
|
private readonly WTMContext _context;
|
||||||
|
|
||||||
|
public SimpleReceiptInController(IUnitWork unitWork, WTMContext wtmContext)
|
||||||
|
{
|
||||||
|
_unitWork = unitWork;
|
||||||
|
_context = wtmContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Index
|
||||||
|
|
||||||
|
[ActionDescription("Sys.Search")]
|
||||||
|
public ActionResult Index()
|
||||||
|
{
|
||||||
|
return PartialView("Index");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Index
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public JsonResult ValidateContainer(string containerCode)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(containerCode))
|
||||||
|
{
|
||||||
|
return Json(new { Code = 400, Msg = "容器编码不能为空" });
|
||||||
|
}
|
||||||
|
|
||||||
|
var container = _unitWork.FindSingle<Container>(u => u.Code == containerCode);
|
||||||
|
if (container == null)
|
||||||
|
{
|
||||||
|
return Json(new { Code = 400, Msg = "容器不存在" });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(container.LocationCode))
|
||||||
|
{
|
||||||
|
return Json(new { Code = 400, Msg = $"{containerCode} 容器状态不正确!已存在任务或者已在库内" });
|
||||||
|
}
|
||||||
|
|
||||||
|
// var task = _unitWork.FindSingle<TaskHeader>(u => u.ContainerCode == containerCode);
|
||||||
|
// if (task != null && !string.IsNullOrWhiteSpace(task.ToLocation))
|
||||||
|
// {
|
||||||
|
// return Json(new { Code = 400, Msg = $"{containerCode} 容器已存在任务!" });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 获取容器内的物料信息
|
||||||
|
var inventories = _unitWork.Find<Inventory>(x => x.ContainerCode == containerCode)
|
||||||
|
.Select(x => new {
|
||||||
|
Id = x.ID,
|
||||||
|
ContainerCode = x.ContainerCode,
|
||||||
|
MaterialCode = x.MaterialCode,
|
||||||
|
MaterialName = x.MaterialName,
|
||||||
|
MaterialSpec = x.MaterialSpec,
|
||||||
|
Company = x.CompanyCode,
|
||||||
|
Qty = x.Qty
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
return Json(new {
|
||||||
|
Code = 200,
|
||||||
|
Msg = "验证成功",
|
||||||
|
Data = inventories
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return Json(new { Code = 500, Msg = ex.Message });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public ActionResult SearchMaterials(string keyword)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(keyword))
|
||||||
|
{
|
||||||
|
return JsonMore(new { Data = new object[] { } });
|
||||||
|
}
|
||||||
|
|
||||||
|
var materials = _unitWork.Find<Material>(x =>
|
||||||
|
x.MaterialCode.Contains(keyword) ||
|
||||||
|
x.MaterialName.Contains(keyword))
|
||||||
|
.Take(10)
|
||||||
|
.Select(x => new {
|
||||||
|
MaterialCode = x.MaterialCode,
|
||||||
|
MaterialName = x.MaterialName,
|
||||||
|
MaterialSpec = x.MaterialSpec,
|
||||||
|
MaterialUnit = x.MaterialUnit
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
return JsonMore( materials );
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public ActionResult AddInventory(string containerCode, string materialCode, string company, decimal qty)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(containerCode))
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, "容器编码为空!");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(materialCode))
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, "物料编码为空!");
|
||||||
|
}
|
||||||
|
if (qty <= 0)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, "数量必须大于0!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询容器
|
||||||
|
var container = _unitWork.FindSingle<Container>(u => u.Code == containerCode);
|
||||||
|
if (container == null)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, $"库内没有编码为 {containerCode} 的容器!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询物料信息
|
||||||
|
var material = _unitWork.FindSingle<Material>(x => x.MaterialCode == materialCode);
|
||||||
|
if (material == null)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, $"未找到物料编码为 {materialCode} 的物料信息!");
|
||||||
|
}
|
||||||
|
|
||||||
|
var zone = _unitWork.FindSingle<LocationZone>(x => x.ZoneCode == container.Type);
|
||||||
|
// 创建库存记录
|
||||||
|
var inventory = new Inventory()
|
||||||
|
{
|
||||||
|
ZoneId = zone.ID,
|
||||||
|
ContainerCode = containerCode,
|
||||||
|
MaterialCode = material.MaterialCode,
|
||||||
|
MaterialName = material.MaterialName,
|
||||||
|
MaterialType = material.MaterialType,
|
||||||
|
MaterialSpec = material.MaterialSpec,
|
||||||
|
MaterialUnit = material.MaterialUnit,
|
||||||
|
CompanyCode = company,
|
||||||
|
Qty = qty,
|
||||||
|
TaskStatus = InventoryTaskStatusEnum.Locked,
|
||||||
|
CreateTime = DateTime.Now
|
||||||
|
};
|
||||||
|
_unitWork.Add(inventory);
|
||||||
|
|
||||||
|
// 创建入库交易记录
|
||||||
|
var transaction = new InventoryTransaction
|
||||||
|
{
|
||||||
|
ZoneCode = zone.ZoneCode,
|
||||||
|
BillType = InventoryTranType.入库,
|
||||||
|
MaterialCode = material.MaterialCode,
|
||||||
|
MaterialName = material.MaterialName,
|
||||||
|
MaterialUnit = material.MaterialUnit,
|
||||||
|
ContainerCode = containerCode,
|
||||||
|
Qty = qty,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
CreateBy = "WMS",
|
||||||
|
UpdateTime = DateTime.Now,
|
||||||
|
UpdateBy = "WMS"
|
||||||
|
};
|
||||||
|
_unitWork.Add(transaction);
|
||||||
|
|
||||||
|
return JsonMore(new { Id = inventory.ID });
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public ActionResult TaskIn(string containerCode)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(containerCode))
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, "容器编码为空!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询容器
|
||||||
|
var container = _unitWork.FindSingle<Container>(u => u.Code == containerCode);
|
||||||
|
if (container == null)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, $"库内没有编码为 {containerCode} 的容器!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询容器的库存
|
||||||
|
var inventories = _unitWork.Find<Inventory>(x => x.ContainerCode == containerCode).ToList();
|
||||||
|
|
||||||
|
// 根据库存情况设置容器状态
|
||||||
|
if (inventories.Any())
|
||||||
|
{
|
||||||
|
container.Status = ContainerStatus.有;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
container.Status = ContainerStatus.空;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新容器状态
|
||||||
|
container.IsLock = ContainerLockEnum.任务锁;
|
||||||
|
container.UpdateTime = DateTime.Now;
|
||||||
|
container.UpdateBy = Wtm?.LoginUserInfo?.ITCode ?? "WMS";
|
||||||
|
|
||||||
|
|
||||||
|
// 创建入库任务
|
||||||
|
var task = new TaskHeader
|
||||||
|
{
|
||||||
|
ZoneId = inventories.First().ZoneId,
|
||||||
|
TaskNo = _unitWork.GetSerialNumber("In"),
|
||||||
|
TaskType = TaskTypeEnum.入库,
|
||||||
|
RoadWay = 2,
|
||||||
|
ContainerCode = containerCode,
|
||||||
|
FromLocation = "",
|
||||||
|
ToLocation = "",
|
||||||
|
Status = TaskStatusEnum.待下发,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
CreateBy = Wtm?.LoginUserInfo?.ITCode??"WMS",
|
||||||
|
};
|
||||||
|
|
||||||
|
// 下发任务到wcs
|
||||||
|
var postData = new
|
||||||
|
{
|
||||||
|
TaskNo = task.TaskNo,
|
||||||
|
PalletNo = task.ContainerCode,
|
||||||
|
FromLocation = task.FromLocation,
|
||||||
|
ToLocation = task.ToLocation
|
||||||
|
};
|
||||||
|
_unitWork.Add(task);
|
||||||
|
|
||||||
|
_unitWork.Update(container);
|
||||||
|
/*try
|
||||||
|
{
|
||||||
|
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCSCP", "TaskAssign", HttpMethodEnum.POST, postData)
|
||||||
|
.Result?.Data;
|
||||||
|
|
||||||
|
if (res.Success)
|
||||||
|
{
|
||||||
|
task.Status = TaskStatusEnum.已下发;
|
||||||
|
task.UpdateTime = DateTime.Now;
|
||||||
|
task.UpdateBy = "WMS";
|
||||||
|
_unitWork.Add(task);
|
||||||
|
|
||||||
|
_unitWork.Update(container);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
task.ErrorMsg = res.Msg;
|
||||||
|
return JsonMore(null, 500, res.Msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
task.ErrorMsg = ex.Message;
|
||||||
|
return JsonMore(null, 500, "任务下发失败!");
|
||||||
|
}*/
|
||||||
|
|
||||||
|
return JsonMore(null);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public ActionResult DeleteInventory(int id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 查询库存记录
|
||||||
|
var inventory = _unitWork.Find<Inventory>(x => x.ID == id).FirstOrDefault();
|
||||||
|
|
||||||
|
if (inventory == null)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, "未找到对应的库存记录!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建出库交易记录
|
||||||
|
var transaction = new InventoryTransaction
|
||||||
|
{
|
||||||
|
BillType = InventoryTranType.出库,
|
||||||
|
MaterialCode = inventory.MaterialCode,
|
||||||
|
MaterialName = inventory.MaterialName,
|
||||||
|
MaterialUnit = inventory.MaterialUnit,
|
||||||
|
ContainerCode = inventory.ContainerCode,
|
||||||
|
Qty = inventory.Qty,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
CreateBy = "WMS",
|
||||||
|
UpdateTime = DateTime.Now,
|
||||||
|
UpdateBy = "WMS"
|
||||||
|
};
|
||||||
|
_unitWork.Add(transaction);
|
||||||
|
|
||||||
|
// 删除库存记录
|
||||||
|
_unitWork.Delete(inventory);
|
||||||
|
|
||||||
|
return JsonMore(null);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public ActionResult UpdateInventory(int id, decimal qty)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (qty <= 0)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, "数量必须大于0!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询库存记录
|
||||||
|
var inventory = _unitWork.Find<Inventory>(x => x.ID == id).FirstOrDefault();
|
||||||
|
|
||||||
|
if (inventory == null)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, "未找到对应的库存记录!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建出库交易记录(原数量)
|
||||||
|
var outTransaction = new InventoryTransaction
|
||||||
|
{
|
||||||
|
BillType = InventoryTranType.出库,
|
||||||
|
MaterialCode = inventory.MaterialCode,
|
||||||
|
MaterialName = inventory.MaterialName,
|
||||||
|
MaterialUnit = inventory.MaterialUnit,
|
||||||
|
ContainerCode = inventory.ContainerCode,
|
||||||
|
Qty = inventory.Qty,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
CreateBy = "WMS",
|
||||||
|
UpdateTime = DateTime.Now,
|
||||||
|
UpdateBy = "WMS"
|
||||||
|
};
|
||||||
|
_unitWork.Add(outTransaction);
|
||||||
|
|
||||||
|
// 创建入库交易记录(新数量)
|
||||||
|
var inTransaction = new InventoryTransaction
|
||||||
|
{
|
||||||
|
BillType = InventoryTranType.入库,
|
||||||
|
MaterialCode = inventory.MaterialCode,
|
||||||
|
MaterialName = inventory.MaterialName,
|
||||||
|
MaterialUnit = inventory.MaterialUnit,
|
||||||
|
ContainerCode = inventory.ContainerCode,
|
||||||
|
Qty = qty,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
CreateBy = "WMS",
|
||||||
|
UpdateTime = DateTime.Now,
|
||||||
|
UpdateBy = "WMS"
|
||||||
|
};
|
||||||
|
_unitWork.Add(inTransaction);
|
||||||
|
|
||||||
|
// 更新库存数量
|
||||||
|
inventory.Qty = qty;
|
||||||
|
inventory.UpdateTime = DateTime.Now;
|
||||||
|
inventory.UpdateBy = Wtm?.LoginUserInfo?.ITCode ?? "WMS";
|
||||||
|
_unitWork.Update(inventory);
|
||||||
|
|
||||||
|
return JsonMore(null);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public ActionResult EmptyIn(string containerCode)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(containerCode))
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, "容器编码为空!");
|
||||||
|
}
|
||||||
|
// 查询容器
|
||||||
|
var container = _unitWork.FindSingle<Container>(u => u.Code == containerCode);
|
||||||
|
if (container == null)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, $"库内没有编码为 {containerCode} 的容器!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询容器
|
||||||
|
var taskHeader = _unitWork.FindSingle<TaskHeader>(u => u.ContainerCode == containerCode);
|
||||||
|
if (taskHeader != null)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, $"容器 {containerCode} 已存在任务,请检查后再试!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 空托盘入库逻辑(如直接生成入库任务,状态置空等)
|
||||||
|
container.Status = ContainerStatus.空;
|
||||||
|
container.IsLock = ContainerLockEnum.任务锁;
|
||||||
|
container.UpdateTime = DateTime.Now;
|
||||||
|
container.UpdateBy = Wtm?.LoginUserInfo?.ITCode ?? "WMS";
|
||||||
|
|
||||||
|
var zone = _unitWork.FindSingle<LocationZone>(x => x.ZoneCode == container.Type);
|
||||||
|
// 创建入库任务
|
||||||
|
var task = new TaskHeader
|
||||||
|
{
|
||||||
|
ZoneId = zone.ID,
|
||||||
|
TaskNo = _unitWork.GetSerialNumber("In"),
|
||||||
|
TaskType = TaskTypeEnum.入库,
|
||||||
|
RoadWay = 2,
|
||||||
|
ContainerCode = containerCode,
|
||||||
|
FromLocation = "",
|
||||||
|
ToLocation = "",
|
||||||
|
Status = TaskStatusEnum.待下发,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
CreateBy = Wtm?.LoginUserInfo?.ITCode??"WMS",
|
||||||
|
};
|
||||||
|
|
||||||
|
var locationVm = Wtm.CreateVM<LocationVM>();
|
||||||
|
var result = locationVm.SendWcsTask(task);
|
||||||
|
if (result.Status)
|
||||||
|
{
|
||||||
|
_unitWork.Update(container);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, result.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return JsonMore(null);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public ActionResult CallOut(string level, string port)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var locationType = level == "mid" ? LocationTypeEnum.M : LocationTypeEnum.C;
|
||||||
|
var height = 0;
|
||||||
|
if (level == "mid")
|
||||||
|
height = 0;
|
||||||
|
else if (level == "high")
|
||||||
|
height = 1250;
|
||||||
|
else if (level == "low")
|
||||||
|
height = 1000;
|
||||||
|
|
||||||
|
|
||||||
|
// 一次性获取所需的所有数据,避免多次查询数据库
|
||||||
|
var locationPairs = DC.Set<Location>()
|
||||||
|
.Where(l => l.Type == locationType
|
||||||
|
&& l.Status == LocationStatusEnum.未锁
|
||||||
|
&& !l.IsStop
|
||||||
|
&& l.Height == height)
|
||||||
|
.Select(l => new
|
||||||
|
{
|
||||||
|
l.Code,
|
||||||
|
l.ContiguousCode,
|
||||||
|
l.Status,
|
||||||
|
l.ContainerStatus,
|
||||||
|
l.RowFlag,
|
||||||
|
l.Height,
|
||||||
|
l.Layer,
|
||||||
|
l.Line
|
||||||
|
})
|
||||||
|
.AsNoTracking()
|
||||||
|
.ToDictionary(l => l.Code);
|
||||||
|
|
||||||
|
// 1. 优先查找里外仓位都为空的里仓位
|
||||||
|
var outloc = locationPairs.Values
|
||||||
|
.Where(l => l.RowFlag == RowFlagEnum.Inner
|
||||||
|
&& l.ContainerStatus == LocationStatus.空容器
|
||||||
|
&& locationPairs.TryGetValue(l.ContiguousCode, out var outer)
|
||||||
|
&& outer.ContainerStatus == LocationStatus.空仓位)
|
||||||
|
.OrderBy(l => l.Layer)
|
||||||
|
.ThenBy(l => l.Line)
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
if (outloc == null)
|
||||||
|
{
|
||||||
|
outloc = locationPairs.Values
|
||||||
|
.Where(l => l.ContainerStatus == LocationStatus.空容器)
|
||||||
|
.OrderBy(l => l.RowFlag)
|
||||||
|
.ThenBy(l => l.Layer)
|
||||||
|
.ThenBy(l => l.Line)
|
||||||
|
.FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (outloc == null)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, "库内暂无可用空托盘!");
|
||||||
|
}
|
||||||
|
var code = outloc?.Code;
|
||||||
|
var location = _unitWork.FindSingle<Location>(l => l.Code == code);
|
||||||
|
location.Status = LocationStatusEnum.锁定;
|
||||||
|
location.UpdateTime = DateTime.Now;
|
||||||
|
// 创建任务
|
||||||
|
var task = new TaskHeader
|
||||||
|
{
|
||||||
|
ZoneId = location.ZoneId,
|
||||||
|
TaskNo = _unitWork.GetSerialNumber("Out"),
|
||||||
|
TaskType = TaskTypeEnum.出库,
|
||||||
|
RoadWay = 2,
|
||||||
|
ContainerCode = location.ContainerCode,
|
||||||
|
FromLocation = location.Code,
|
||||||
|
ToLocation = port,
|
||||||
|
Status = TaskStatusEnum.待下发,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
CreateBy = Wtm?.LoginUserInfo?.ITCode??"WMS",
|
||||||
|
};
|
||||||
|
|
||||||
|
var locationVm = Wtm.CreateVM<LocationVM>();
|
||||||
|
var result = locationVm.SendWcsTask(task);
|
||||||
|
if (!result.Status)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, result.Message);
|
||||||
|
}
|
||||||
|
return JsonMore(null);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,580 @@
|
|||||||
|
<div id="receiptin">
|
||||||
|
<a-space direction="vertical" fill>
|
||||||
|
<a-form :model="formData" layout="horizontal" :label-col="{ style: { width: '100px' } }" :wrapper-col="{ style: { width: '220px' } }">
|
||||||
|
<a-form-item field="containerCode" label="容器编码">
|
||||||
|
<a-input
|
||||||
|
v-model="ContainerCode"
|
||||||
|
placeholder="扫描箱号"
|
||||||
|
allow-clear
|
||||||
|
@@keyup.enter="validateContainer"
|
||||||
|
ref="containerInput"/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item field="materialCode" label="物料信息">
|
||||||
|
<a-auto-complete
|
||||||
|
v-model="MaterialCode"
|
||||||
|
:data="materialOptions"
|
||||||
|
@@search="handleSearch"
|
||||||
|
@@select="handleSelect"
|
||||||
|
placeholder="输入物料编码或名称"
|
||||||
|
ref="materialInput">
|
||||||
|
</a-auto-complete>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item field="materialName" label="物料名称">
|
||||||
|
<a-input v-model="MaterialName" disabled/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item field="materialSpec" label="物料型号">
|
||||||
|
<a-input v-model="MaterialSpec" disabled/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item field="company" label="公司">
|
||||||
|
<a-input v-model="Company" placeholder="输入公司"/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item field="qty" label="数量">
|
||||||
|
<a-input-number v-model="Qty" :min="0" style="width: 100%"/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item>
|
||||||
|
<a-space>
|
||||||
|
<a-button @@click="handleBind" type="primary">绑定</a-button>
|
||||||
|
<a-button @@click="handleClick" :loading="loading1" type="primary">入库</a-button>
|
||||||
|
<a-button @@click="emptyIn" :loading="loading1" type="success">空托入库</a-button>
|
||||||
|
<a-button @@click="outClick" :loading="loading1" type="primary">呼叫出库</a-button>
|
||||||
|
</a-space>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
|
||||||
|
<a-table :data="bindList" :columns="columns" :pagination="false">
|
||||||
|
<template #operations="{ record }">
|
||||||
|
<a-space>
|
||||||
|
<a-button type="text" status="danger" @@click="handleDelete(record)">删除</a-button>
|
||||||
|
<a-button type="text" @@click="handleEdit(record)">修改</a-button>
|
||||||
|
@* <a-button type="text" @@click="handleDeduct(record)">扣料</a-button> *@
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
<template #qty="{ record }">
|
||||||
|
{{ Math.floor(record.Qty) }}
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
|
||||||
|
<a-modal v-model:visible="editModalVisible" title="修改数量" @@ok="handleEditConfirm" @@cancel="handleEditCancel">
|
||||||
|
<a-form :model="editForm">
|
||||||
|
<a-form-item field="qty" label="数量">
|
||||||
|
<a-input-number v-model="editForm.qty" :min="0" :precision="0" style="width: 100%"/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</a-modal>
|
||||||
|
|
||||||
|
<a-modal v-model:visible="deductModalVisible" title="扣除数量" @@ok="handleDeductConfirm" @@cancel="handleDeductCancel">
|
||||||
|
<a-form :model="deductForm">
|
||||||
|
<a-form-item field="qty" label="扣除数量">
|
||||||
|
<a-input-number v-model="deductForm.qty" :min="0" :max="deductForm.maxQty" :precision="0" style="width: 100%"/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</a-modal>
|
||||||
|
|
||||||
|
<!-- 呼叫出库弹窗 -->
|
||||||
|
<a-modal v-model:visible="outModalVisible" title="呼叫出库" @@ok="handleOutConfirm" @@cancel="handleOutCancel">
|
||||||
|
<a-form :model="outForm">
|
||||||
|
<a-form-item label="货位类型">
|
||||||
|
<a-radio-group v-model="outForm.level">
|
||||||
|
<a-radio value="high">高货位</a-radio>
|
||||||
|
<a-radio value="low">低货位</a-radio>
|
||||||
|
</a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="出库口">
|
||||||
|
<a-select v-model="outForm.port" placeholder="请选择出库口">
|
||||||
|
<a-option v-for="item in outPortOptions" :key="item.value" :value="item.value">{{ item.label }}</a-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</a-modal>
|
||||||
|
</a-space>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
const { createApp, reactive, ref } = Vue
|
||||||
|
|
||||||
|
const app = createApp({
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
ContainerCode: '',
|
||||||
|
MaterialCode: '',
|
||||||
|
MaterialName: '',
|
||||||
|
MaterialSpec: '',
|
||||||
|
Company: '',
|
||||||
|
Qty: null,
|
||||||
|
loading1: false,
|
||||||
|
materialOptions: [],
|
||||||
|
searchTimer: null,
|
||||||
|
bindList: [],
|
||||||
|
editModalVisible: false,
|
||||||
|
editForm: {
|
||||||
|
index: -1,
|
||||||
|
qty: 0
|
||||||
|
},
|
||||||
|
deductModalVisible: false,
|
||||||
|
deductForm: {
|
||||||
|
index: -1,
|
||||||
|
qty: 0,
|
||||||
|
maxQty: 0
|
||||||
|
},
|
||||||
|
outModalVisible: false,
|
||||||
|
outForm: {
|
||||||
|
level: 'high', // 'high' or 'low'
|
||||||
|
port: ''
|
||||||
|
},
|
||||||
|
outPortOptions: [
|
||||||
|
{ label: '拣货口1', value: 'EnterExit_P1001' },
|
||||||
|
{ label: '拣货口2', value: 'EnterExit_P1004' },
|
||||||
|
{ label: '拣货口3', value: 'EnterExit_P1007' },
|
||||||
|
{ label: '拣货口4', value: 'EnterExit_P1008' },
|
||||||
|
{ label: '拣货口5', value: 'EnterExit_P1009' },
|
||||||
|
{ label: '拣货口6', value: 'EnterExit_P1010' }
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
title: 'ID',
|
||||||
|
dataIndex: 'Id',
|
||||||
|
width: 80
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '容器编码',
|
||||||
|
dataIndex: 'ContainerCode',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '物料编码',
|
||||||
|
dataIndex: 'MaterialCode',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '物料名称',
|
||||||
|
dataIndex: 'MaterialName',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '物料型号',
|
||||||
|
dataIndex: 'MaterialSpec',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '公司',
|
||||||
|
dataIndex: 'Company',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '数量',
|
||||||
|
dataIndex: 'Qty',
|
||||||
|
slotName: 'qty'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
slotName: 'operations',
|
||||||
|
width: 120
|
||||||
|
}
|
||||||
|
],
|
||||||
|
formData: {
|
||||||
|
containerCode: '',
|
||||||
|
materialCode: '',
|
||||||
|
materialName: '',
|
||||||
|
materialSpec: '',
|
||||||
|
company: '',
|
||||||
|
qty: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
// 页面加载完成后,将焦点设置到容器编码输入框
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.containerInput.focus();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleSearch(value) {
|
||||||
|
if (this.searchTimer) {
|
||||||
|
clearTimeout(this.searchTimer);
|
||||||
|
}
|
||||||
|
this.searchTimer = setTimeout(() => {
|
||||||
|
if (value) {
|
||||||
|
this.searchMaterials(value);
|
||||||
|
} else {
|
||||||
|
this.materialOptions = [];
|
||||||
|
}
|
||||||
|
}, 300);
|
||||||
|
},
|
||||||
|
|
||||||
|
searchMaterials(keyword) {
|
||||||
|
var _this = this;
|
||||||
|
axios.get(`/receipt/SimpleReceiptIn/SearchMaterials?keyword=${encodeURIComponent(keyword)}`)
|
||||||
|
.then(function (json) {
|
||||||
|
if (json.data.Code == 200) {
|
||||||
|
_this.materialOptions = json.data.Data.map(item => ({
|
||||||
|
...item,
|
||||||
|
value: item.MaterialCode,
|
||||||
|
label: `${item.MaterialCode} - ${item.MaterialName} - ${item.MaterialSpec}`
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
_this.$message.error(json.data.Msg);
|
||||||
|
_this.materialOptions = [];
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
_this.$message.error(error);
|
||||||
|
_this.materialOptions = [];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSelect(value, option) {
|
||||||
|
const selectedMaterial = this.materialOptions.find(item => item.value === value);
|
||||||
|
if (selectedMaterial) {
|
||||||
|
this.MaterialCode = selectedMaterial.MaterialCode;
|
||||||
|
this.MaterialName = selectedMaterial.MaterialName;
|
||||||
|
this.MaterialSpec = selectedMaterial.MaterialSpec;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
handleBind() {
|
||||||
|
if (!this.ContainerCode) {
|
||||||
|
this.$notification.error("请扫描箱号!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.MaterialCode) {
|
||||||
|
this.$notification.error("请选择物料!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.Qty || this.Qty <= 0 || !Number.isInteger(this.Qty)) {
|
||||||
|
this.$notification.error("请输入大于0的正整数!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查已绑定物料的容器编码
|
||||||
|
if (this.bindList.length > 0) {
|
||||||
|
const firstBind = this.bindList[0];
|
||||||
|
if (firstBind.ContainerCode !== this.ContainerCode) {
|
||||||
|
this.$notification.warning("容器编码已变更,已清空绑定物料");
|
||||||
|
this.bindList = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加到绑定列表
|
||||||
|
const bindItem = {
|
||||||
|
ContainerCode: this.ContainerCode,
|
||||||
|
MaterialCode: this.MaterialCode,
|
||||||
|
MaterialName: this.MaterialName,
|
||||||
|
MaterialSpec: this.MaterialSpec,
|
||||||
|
Company: this.Company,
|
||||||
|
Qty: this.Qty
|
||||||
|
};
|
||||||
|
|
||||||
|
// 调用后端添加库存
|
||||||
|
let postData = new URLSearchParams();
|
||||||
|
postData.append('containerCode', this.ContainerCode);
|
||||||
|
postData.append('materialCode', this.MaterialCode);
|
||||||
|
postData.append('company', this.Company);
|
||||||
|
postData.append('qty', this.Qty);
|
||||||
|
|
||||||
|
axios.post("/receipt/SimpleReceiptIn/AddInventory", postData)
|
||||||
|
.then((json) => {
|
||||||
|
if (json.data.Code == 200) {
|
||||||
|
// 添加ID到绑定项
|
||||||
|
bindItem.Id = json.data.Data.Id;
|
||||||
|
this.bindList.push(bindItem);
|
||||||
|
this.$message.success("物料绑定成功");
|
||||||
|
// 清空表单
|
||||||
|
this.MaterialCode = '';
|
||||||
|
this.MaterialName = '';
|
||||||
|
this.MaterialSpec = '';
|
||||||
|
this.Company = '';
|
||||||
|
this.Qty = null;
|
||||||
|
// 验证成功后,将焦点设置到物料编码输入框
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.materialInput.focus();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$notification.error(json.data.Msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.$notification.error("物料绑定失败");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
handleClick() {
|
||||||
|
if (!this.ContainerCode) {
|
||||||
|
this.$notification.error('请扫描箱号!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.loading1 = true;
|
||||||
|
let postData = new URLSearchParams();
|
||||||
|
postData.append('containerCode', this.ContainerCode);
|
||||||
|
|
||||||
|
axios.post("/receipt/SimpleReceiptIn/TaskIn", postData)
|
||||||
|
.then((json) => {
|
||||||
|
this.loading1 = false;
|
||||||
|
if (json.data.Code == 200) {
|
||||||
|
this.ContainerCode = '';
|
||||||
|
this.MaterialCode = '';
|
||||||
|
this.MaterialName = '';
|
||||||
|
this.MaterialSpec = '';
|
||||||
|
this.Company = '';
|
||||||
|
this.Qty = 1;
|
||||||
|
this.bindList = [];
|
||||||
|
this.$notification.success("入库任务创建成功!");
|
||||||
|
} else {
|
||||||
|
this.$notification.error({
|
||||||
|
content: json.data.Msg,
|
||||||
|
duration: 5000,
|
||||||
|
closable: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.loading1 = false;
|
||||||
|
this.$notification.error({
|
||||||
|
content: error,
|
||||||
|
duration: 5000,
|
||||||
|
closable: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
validateContainer() {
|
||||||
|
if (!this.ContainerCode) return;
|
||||||
|
|
||||||
|
axios.get(`/receipt/SimpleReceiptIn/ValidateContainer?containerCode=${encodeURIComponent(this.ContainerCode)}`)
|
||||||
|
.then((json) => {
|
||||||
|
if (json.data.Code == 200) {
|
||||||
|
this.$message.success("容器验证成功");
|
||||||
|
// 更新绑定列表
|
||||||
|
this.bindList = json.data.Data;
|
||||||
|
// 验证成功后,将焦点设置到物料编码输入框
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.materialInput.focus();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$message.error(json.data.Msg || "容器验证失败");
|
||||||
|
this.ContainerCode = '';
|
||||||
|
this.bindList = [];
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.$message.error("容器验证失败");
|
||||||
|
this.ContainerCode = '';
|
||||||
|
this.bindList = [];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
handleDelete(record) {
|
||||||
|
const index = this.bindList.findIndex(item => item.Id === record.Id);
|
||||||
|
|
||||||
|
if (index > -1) {
|
||||||
|
// 调用后端删除库存
|
||||||
|
let postData = new URLSearchParams();
|
||||||
|
postData.append('id', record.Id);
|
||||||
|
|
||||||
|
axios.post("/receipt/SimpleReceiptIn/DeleteInventory", postData)
|
||||||
|
.then((json) => {
|
||||||
|
if (json.data.Code == 200) {
|
||||||
|
this.bindList.splice(index, 1);
|
||||||
|
this.$message.success("删除成功");
|
||||||
|
} else {
|
||||||
|
this.$message.error(json.data.Msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.$message.error("删除失败");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
handleEdit(record) {
|
||||||
|
this.editForm.index = this.bindList.findIndex(item => item.Id === record.Id);
|
||||||
|
this.editForm.qty = Math.floor(record.Qty);
|
||||||
|
this.editModalVisible = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
handleEditConfirm() {
|
||||||
|
if (this.editForm.index > -1) {
|
||||||
|
if (!this.editForm.qty || this.editForm.qty <= 0 || !Number.isInteger(this.editForm.qty)) {
|
||||||
|
this.$notification.error("请输入大于0的正整数!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const record = this.bindList[this.editForm.index];
|
||||||
|
|
||||||
|
// 调用后端更新库存
|
||||||
|
let postData = new URLSearchParams();
|
||||||
|
postData.append('id', record.Id);
|
||||||
|
postData.append('qty', this.editForm.qty);
|
||||||
|
|
||||||
|
axios.post("/receipt/SimpleReceiptIn/UpdateInventory", postData)
|
||||||
|
.then((json) => {
|
||||||
|
if (json.data.Code == 200) {
|
||||||
|
this.bindList[this.editForm.index].Qty = this.editForm.qty;
|
||||||
|
this.$notification.success("修改成功");
|
||||||
|
this.editModalVisible = false;
|
||||||
|
} else {
|
||||||
|
this.$notification.error(json.data.Msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.$notification.error("修改失败");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
handleEditCancel() {
|
||||||
|
this.editModalVisible = false;
|
||||||
|
this.editForm.index = -1;
|
||||||
|
this.editForm.qty = 1;
|
||||||
|
},
|
||||||
|
|
||||||
|
handleDeduct(record) {
|
||||||
|
this.deductForm.index = this.bindList.findIndex(item => item.Id === record.Id);
|
||||||
|
this.deductForm.qty = null;
|
||||||
|
this.deductForm.maxQty = Math.floor(record.Qty);
|
||||||
|
this.deductModalVisible = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
handleDeductConfirm() {
|
||||||
|
if (this.deductForm.index > -1) {
|
||||||
|
const record = this.bindList[this.deductForm.index];
|
||||||
|
|
||||||
|
if (!this.deductForm.qty) {
|
||||||
|
this.$notification.error("请输入扣除数量");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Number.isInteger(this.deductForm.qty) || this.deductForm.qty <= 0) {
|
||||||
|
this.$notification.error("请输入大于0的正整数!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.deductForm.qty > record.Qty) {
|
||||||
|
this.$notification.error("扣除数量不能大于当前数量");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const newQty = record.Qty - this.deductForm.qty;
|
||||||
|
|
||||||
|
if (newQty == 0) {
|
||||||
|
// 如果扣除后数量等于0,直接删除
|
||||||
|
this.handleDelete(record);
|
||||||
|
} else {
|
||||||
|
// 调用后端更新库存
|
||||||
|
let postData = new URLSearchParams();
|
||||||
|
postData.append('id', record.Id);
|
||||||
|
postData.append('qty', newQty);
|
||||||
|
|
||||||
|
axios.post("/receipt/SimpleReceiptIn/UpdateInventory", postData)
|
||||||
|
.then((json) => {
|
||||||
|
if (json.data.Code == 200) {
|
||||||
|
this.bindList[this.deductForm.index].Qty = newQty;
|
||||||
|
this.$notification.success("扣除成功");
|
||||||
|
this.deductModalVisible = false;
|
||||||
|
} else {
|
||||||
|
this.$notification.error(json.data.Msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.$notification.error("扣除失败");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
handleDeductCancel() {
|
||||||
|
this.deductModalVisible = false;
|
||||||
|
this.deductForm.index = -1;
|
||||||
|
this.deductForm.qty = 1;
|
||||||
|
this.deductForm.maxQty = 0;
|
||||||
|
},
|
||||||
|
emptyIn() {
|
||||||
|
if (!this.ContainerCode) {
|
||||||
|
this.$notification.error('请扫描箱号!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.loading1 = true;
|
||||||
|
let postData = new URLSearchParams();
|
||||||
|
postData.append('containerCode', this.ContainerCode);
|
||||||
|
axios.post("/receipt/SimpleReceiptIn/EmptyIn", postData)
|
||||||
|
.then((json) => {
|
||||||
|
this.loading1 = false;
|
||||||
|
if (json.data.Code == 200) {
|
||||||
|
this.ContainerCode = '';
|
||||||
|
this.MaterialCode = '';
|
||||||
|
this.MaterialName = '';
|
||||||
|
this.MaterialSpec = '';
|
||||||
|
this.Company = '';
|
||||||
|
this.Qty = 1;
|
||||||
|
this.bindList = [];
|
||||||
|
this.$notification.success("空托入库成功!");
|
||||||
|
} else {
|
||||||
|
this.$notification.error({
|
||||||
|
content: json.data.Msg,
|
||||||
|
duration: 5000,
|
||||||
|
closable: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.loading1 = false;
|
||||||
|
this.$notification.error({
|
||||||
|
content: error,
|
||||||
|
duration: 5000,
|
||||||
|
closable: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
outClick() {
|
||||||
|
// if (!this.ContainerCode) {
|
||||||
|
// this.$notification.error('请扫描箱号!');
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
this.outForm.level = 'low';
|
||||||
|
this.outForm.port = '';
|
||||||
|
this.outModalVisible = true;
|
||||||
|
},
|
||||||
|
handleOutConfirm() {
|
||||||
|
if (!this.outForm.port) {
|
||||||
|
this.$notification.error('请选择出库口!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.loading1 = true;
|
||||||
|
let postData = new URLSearchParams();
|
||||||
|
// postData.append('containerCode', this.ContainerCode);
|
||||||
|
postData.append('level', this.outForm.level);
|
||||||
|
postData.append('port', this.outForm.port);
|
||||||
|
axios.post("/receipt/SimpleReceiptIn/CallOut", postData)
|
||||||
|
.then((json) => {
|
||||||
|
this.loading1 = false;
|
||||||
|
if (json.data.Code == 200) {
|
||||||
|
this.ContainerCode = '';
|
||||||
|
this.MaterialCode = '';
|
||||||
|
this.MaterialName = '';
|
||||||
|
this.MaterialSpec = '';
|
||||||
|
this.Company = '';
|
||||||
|
this.Qty = 1;
|
||||||
|
this.bindList = [];
|
||||||
|
this.outModalVisible = false;
|
||||||
|
this.$notification.success("呼叫出库成功!");
|
||||||
|
} else {
|
||||||
|
this.$notification.error({
|
||||||
|
content: json.data.Msg,
|
||||||
|
duration: 5000,
|
||||||
|
closable: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.loading1 = false;
|
||||||
|
this.$notification.error({
|
||||||
|
content: error,
|
||||||
|
duration: 5000,
|
||||||
|
closable: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleOutCancel() {
|
||||||
|
this.outModalVisible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
app.use(ArcoVue)
|
||||||
|
.use(ArcoVueIcon)
|
||||||
|
.mount('#receiptin');
|
||||||
|
</script>
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ namespace HHWMS.Web
|
|||||||
{
|
{
|
||||||
public DataContext CreateDbContext(string[] args)
|
public DataContext CreateDbContext(string[] args)
|
||||||
{
|
{
|
||||||
return new DataContext("Server=127.0.0.1;Port=3306;Database=WMS2;Uid=root;Password=abc123*;Character Set=utf8mb4;", DBTypeEnum.MySql);
|
return new DataContext("Server=127.0.0.1;Port=3306;Database=wms2;Uid=root;Password=123456;Character Set=utf8mb4;", DBTypeEnum.MySql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ namespace HHWMS.Web.Models
|
|||||||
public static class ContainerTypeEnum
|
public static class ContainerTypeEnum
|
||||||
{
|
{
|
||||||
public const string 线边库 = "X";
|
public const string 线边库 = "X";
|
||||||
public const string 成品库 = "L";
|
public const string 成品库 = "C";
|
||||||
public const string 模具库 = "M";
|
public const string 模具库 = "M";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace HHWMS.Web
|
|||||||
public string PalletNo { get; set; }
|
public string PalletNo { get; set; }
|
||||||
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 int? Height { get; set; }
|
||||||
public int Weight { get; set; }
|
public int Weight { get; set; }
|
||||||
public string InPort { get; set; }
|
public string InPort { get; set; }
|
||||||
public LocationTypeEnum LocationType { get; set; }
|
public LocationTypeEnum LocationType { get; set; }
|
||||||
|
|||||||
@@ -1022,6 +1022,9 @@
|
|||||||
</data>
|
</data>
|
||||||
<data name="TaskType.Out" xml:space="preserve">
|
<data name="TaskType.Out" xml:space="preserve">
|
||||||
<value>出库</value>
|
<value>出库</value>
|
||||||
|
</data>
|
||||||
|
<data name="TaskType.Out1" xml:space="preserve">
|
||||||
|
<value>出 库</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TaskType.Move" xml:space="preserve">
|
<data name="TaskType.Move" xml:space="preserve">
|
||||||
<value>移库</value>
|
<value>移库</value>
|
||||||
|
|||||||
Reference in new issue
Block a user