现场初始调试完成,
入库(有货/空容器) 出库,库存出库 AGV任务对接
This commit is contained in:
1 parent
b4632cfc33
commit
70e6866e20
9 files changed
+243
-100
No files matched your search
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AutoMapper;
|
||||
using HHWMS.Web.Controllers;
|
||||
using HHWMS.Web.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -36,14 +37,14 @@ namespace HHWMS.Web
|
||||
public IActionResult ReturnStatus(WcsRequest request)
|
||||
{
|
||||
// 返回状态 只接收100
|
||||
if(request.State != 100)
|
||||
if (request.State != 100)
|
||||
{
|
||||
return ApiResultError(msg:"State 不为100, 请检查后重新请求!");
|
||||
return ApiResultError(msg: "State 不为100, 请检查后重新请求!");
|
||||
}
|
||||
|
||||
// 判断任务是否合理
|
||||
var task = _unitWork.FindSingle<TaskHeader>(x => x.TaskNo.Equals(request.TaskNo));
|
||||
if(task == null)
|
||||
if (task == null)
|
||||
{
|
||||
return ApiResultError(msg: $"任务不存在, 任务号 {request.TaskNo} , 请检查后重新请求!");
|
||||
}
|
||||
@@ -67,17 +68,18 @@ namespace HHWMS.Web
|
||||
IsLock = ContainerLockEnum.未锁,
|
||||
LocationCode = task.ToLocation
|
||||
});
|
||||
var inventoryList = _unitWork.Find<Inventory>(x => x.ContainerCode.Equals(task.ContainerCode))
|
||||
.ToList();
|
||||
// 3.更新库位
|
||||
_unitWork.BatchUpdate<Location>(x => x.Code.Equals(task.ToLocation), x => new Location
|
||||
{
|
||||
UpdateTime = DateTime.Now,
|
||||
UpdateBy = "WMS",
|
||||
Status = LocationStatus.空容器,
|
||||
Status = inventoryList.Count > 0 ? LocationStatus.有货 : LocationStatus.空容器,
|
||||
ContainerCode = task.ContainerCode
|
||||
});
|
||||
// 4.插入库存交易
|
||||
// 1.将任务容器的库存查出来
|
||||
var inventoryList = _unitWork.Find<Inventory>(x => x.ContainerCode.Equals(task.ContainerCode)).ToList();
|
||||
if (inventoryList.Count > 0)
|
||||
{
|
||||
// 2.根据库存生成库存交易出库信息
|
||||
@@ -120,7 +122,8 @@ namespace HHWMS.Web
|
||||
ContainerCode = ""
|
||||
});
|
||||
// 1.将任务容器的库存查出来
|
||||
var inventoryList2 = _unitWork.Find<Inventory>(x => x.ContainerCode.Equals(task.ContainerCode)).ToList();
|
||||
var inventoryList2 = _unitWork.Find<Inventory>(x => x.ContainerCode.Equals(task.ContainerCode))
|
||||
.ToList();
|
||||
if (inventoryList2.Count > 0)
|
||||
{
|
||||
// 2.根据库存生成库存交易出库信息
|
||||
@@ -144,8 +147,9 @@ namespace HHWMS.Web
|
||||
// 3.批量插入库存交易
|
||||
_unitWork.BatchAdd(inventoryTransactions2);
|
||||
|
||||
_unitWork.BatchDelete<Inventory>(x => x.ContainerCode.Equals(task.ContainerCode));
|
||||
_unitWork.BatchDelete<Inventory>(inventoryList2);
|
||||
}
|
||||
|
||||
// 下发AGV到出库口的任务
|
||||
// 如果对接 执行下方任务,否则不执行
|
||||
var interfaceAgv = _unitWork.FindSingle<SysCount>(x => x.Prefix == "interfaceAGV")?.Value;
|
||||
@@ -154,10 +158,10 @@ namespace HHWMS.Web
|
||||
|
||||
var postAgv = new
|
||||
{
|
||||
task_id = "123456"
|
||||
task_id = "6970907a6b82e7fb"
|
||||
};
|
||||
|
||||
var res = Wtm.CallAPI<dynamic>("ACS", "task_mould_do", HttpMethodEnum.POST, postAgv);
|
||||
var res = Wtm.CallAPI<ShipOutController.agvResult>("ACS", "task_mould_do", HttpMethodEnum.POST, postAgv);
|
||||
// if (res.Result.Data.ack == 0)
|
||||
// {
|
||||
//
|
||||
@@ -166,7 +170,7 @@ namespace HHWMS.Web
|
||||
|
||||
break;
|
||||
default:
|
||||
return ApiResultError(msg:$"任务类型不正确!任务号{request.TaskNo}");
|
||||
return ApiResultError(msg: $"任务类型不正确!任务号{request.TaskNo}");
|
||||
}
|
||||
|
||||
task.Status = TaskStatusEnum.完成;
|
||||
@@ -203,7 +207,7 @@ namespace HHWMS.Web
|
||||
}
|
||||
|
||||
var location = _unitWork.FindSingle<Location>(x => x.Status == LocationStatus.空仓位);
|
||||
if(location == null)
|
||||
if (location == null)
|
||||
{
|
||||
return ApiResultError(msg: "没有空仓位");
|
||||
}
|
||||
@@ -228,7 +232,7 @@ namespace HHWMS.Web
|
||||
public IActionResult EmptyOut(WcsRequest request)
|
||||
{
|
||||
var task = _unitWork.FindSingle<TaskHeader>(x => x.TaskNo.Equals(request.TaskNo));
|
||||
if(task == null)
|
||||
if (task == null)
|
||||
{
|
||||
return ApiResultError(msg: $"任务不存在, 任务号 {request.TaskNo} , 请检查后重新请求!");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user