现场初始调试完成,
入库(有货/空容器) 出库,库存出库 AGV任务对接
This commit is contained in:
1 parent
b4632cfc33
commit
70e6866e20
9 files changed
+243
-100
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using HHWMS.Web.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
@@ -28,7 +29,7 @@ namespace HHWMS.Web.Controllers
|
||||
#endregion Index
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult TaskIn(string containerCode)
|
||||
public ActionResult TaskIn(string containerCode, bool inv)
|
||||
{
|
||||
// 判断containerCode是否为空
|
||||
if (string.IsNullOrEmpty(containerCode))
|
||||
@@ -41,14 +42,24 @@ namespace HHWMS.Web.Controllers
|
||||
{
|
||||
return JsonMore(null, 500, $"库内没有编码为 {containerCode} 的容器!");
|
||||
}
|
||||
// 如果 container的库位不为空,或者islock为true,则返回错误信息
|
||||
if (!string.IsNullOrEmpty(container.LocationCode) || container.IsLock == ContainerLockEnum.任务锁)
|
||||
{
|
||||
return JsonMore(null, 500, $"容器 {containerCode} 已被占用!");
|
||||
}
|
||||
|
||||
|
||||
container.IsLock = ContainerLockEnum.任务锁;
|
||||
container.UpdateTime = DateTime.Now;
|
||||
container.UpdateBy = Wtm.LoginUserInfo?.ITCode??"WMS";
|
||||
_unitWork.Update(container);
|
||||
// _unitWork.Update(container);
|
||||
|
||||
//查找仓位
|
||||
var location = _unitWork.Find<Location>(u => u.Status == LocationStatus.空仓位)
|
||||
.OrderBy(x => x.Layer)
|
||||
.ThenBy(x => x.Line)
|
||||
.FirstOrDefault();
|
||||
|
||||
//查询location表的一个空库位 更新仓位状态为锁定
|
||||
var location = _unitWork.FindSingle<Location>(u => u.Status == LocationStatus.空仓位);
|
||||
// 判断location是否为空
|
||||
if (location == null)
|
||||
{
|
||||
@@ -59,6 +70,21 @@ namespace HHWMS.Web.Controllers
|
||||
location.UpdateBy = Wtm.LoginUserInfo?.ITCode??"WMS";
|
||||
_unitWork.Update(location);
|
||||
|
||||
if (inv) //有货
|
||||
{
|
||||
_unitWork.Add<Inventory>(new Inventory()
|
||||
{
|
||||
ZoneCode = ZoneCodeEnum.立库,
|
||||
ContainerCode = containerCode,
|
||||
LocationCode = location.Code,
|
||||
MaterialCode = "123456",
|
||||
MaterialName = "矿泉水",
|
||||
Qty = 1,
|
||||
TaskStatus = InventoryTaskStatus.任务中,
|
||||
CreateTime = DateTime.Now
|
||||
});
|
||||
}
|
||||
_unitWork.Update(container);
|
||||
//创建容器编码为containercode的任务
|
||||
var task = new TaskHeader
|
||||
{
|
||||
@@ -82,8 +108,9 @@ namespace HHWMS.Web.Controllers
|
||||
FromLocation = task.FromLocation,
|
||||
ToLocation = task.ToLocation
|
||||
};
|
||||
var res1 = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData);
|
||||
var res = res1.Result.Data;
|
||||
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData)
|
||||
.Result.Data;
|
||||
|
||||
if (res.Success)
|
||||
{
|
||||
task.Status = TaskStatusEnum.已下发;
|
||||
|
||||
Reference in new issue
Block a user