设计出库口入库流程

托盘、周转箱分区存放
This commit is contained in:
zhougf committed 2024-04-30 23:18:05 +08:00
1 parent 70e6866e20
commit a6168a75bf
7 files changed
+99 -53

No files matched your search

+20 -13
View File
@@ -149,23 +149,30 @@ namespace HHWMS.Web
_unitWork.BatchDelete<Inventory>(inventoryList2); _unitWork.BatchDelete<Inventory>(inventoryList2);
} }
// 创建入库任务
// 下发AGV到出库口的任务 if (inventoryList2.Count == 0)
// 如果对接 执行下方任务,否则不执行
var interfaceAgv = _unitWork.FindSingle<SysCount>(x => x.Prefix == "interfaceAGV")?.Value;
if (interfaceAgv == 1)
{ {
new ReceiptInController(_unitWork, Wtm).TaskIn(task.ContainerCode, false, false);
var postAgv = new // 下发AGV到出库口的任务
// 如果对接 执行下方任务,否则不执行
var interfaceAgv = _unitWork.FindSingle<SysCount>(x => x.Prefix == "interfaceAGV")?.Value;
if (interfaceAgv == 1)
{ {
task_id = "6970907a6b82e7fb"
};
var res = Wtm.CallAPI<ShipOutController.agvResult>("ACS", "task_mould_do", HttpMethodEnum.POST, postAgv); var agv_task_id = Wtm.ConfigInfo.AppSettings.FirstOrDefault(x => x.Key == "OutIn").Value;
// if (res.Result.Data.ack == 0) var postAgv = new
// { {
// task_id = agv_task_id,
// } };
var res = Wtm.CallAPI<ShipOutController.agvResult>("ACS", "task_mould_do",
HttpMethodEnum.POST, postAgv);
// if (res.Result.Data.ack == 0)
// {
//
// }
}
} }
break; break;
@@ -12,10 +12,12 @@ namespace HHWMS.Web.Controllers
public partial class ReceiptInController : BaseController public partial class ReceiptInController : BaseController
{ {
private readonly IUnitWork _unitWork; private readonly IUnitWork _unitWork;
private readonly WTMContext _context;
public ReceiptInController(IUnitWork unitWork) public ReceiptInController(IUnitWork unitWork, WTMContext wtmContext)
{ {
_unitWork = unitWork; _unitWork = unitWork;
_context = wtmContext;
} }
#region Index #region Index
@@ -29,8 +31,12 @@ namespace HHWMS.Web.Controllers
#endregion Index #endregion Index
[HttpPost] [HttpPost]
public ActionResult TaskIn(string containerCode, bool inv) public ActionResult TaskIn(string containerCode, bool inv, bool agv)
{ {
if (Wtm == null)
{
Wtm = _context;
}
// 判断containerCode是否为空 // 判断containerCode是否为空
if (string.IsNullOrEmpty(containerCode)) if (string.IsNullOrEmpty(containerCode))
{ {
@@ -45,17 +51,17 @@ namespace HHWMS.Web.Controllers
// 如果 container的库位不为空,或者islock为true,则返回错误信息 // 如果 container的库位不为空,或者islock为true,则返回错误信息
if (!string.IsNullOrEmpty(container.LocationCode) || container.IsLock == ContainerLockEnum.任务锁) if (!string.IsNullOrEmpty(container.LocationCode) || container.IsLock == ContainerLockEnum.任务锁)
{ {
return JsonMore(null, 500, $"容器 {containerCode} 已被占用!"); return JsonMore(null, 500, $"容器 {containerCode} 已被锁定或已在库内!");
} }
container.IsLock = ContainerLockEnum.任务锁; container.IsLock = ContainerLockEnum.任务锁;
container.UpdateTime = DateTime.Now; container.UpdateTime = DateTime.Now;
container.UpdateBy = Wtm.LoginUserInfo?.ITCode??"WMS"; container.UpdateBy = Wtm?.LoginUserInfo?.ITCode??"WMS";
// _unitWork.Update(container); // _unitWork.Update(container);
//查找仓位 //查找仓位
var location = _unitWork.Find<Location>(u => u.Status == LocationStatus.空仓位) var location = _unitWork.Find<Location>(u => u.Status == LocationStatus.空仓位
&& u.Type == container.Type)
.OrderBy(x => x.Layer) .OrderBy(x => x.Layer)
.ThenBy(x => x.Line) .ThenBy(x => x.Line)
.FirstOrDefault(); .FirstOrDefault();
@@ -67,7 +73,7 @@ namespace HHWMS.Web.Controllers
} }
location.Status = LocationStatus.任务锁; location.Status = LocationStatus.任务锁;
location.UpdateTime = DateTime.Now; location.UpdateTime = DateTime.Now;
location.UpdateBy = Wtm.LoginUserInfo?.ITCode??"WMS"; location.UpdateBy = Wtm?.LoginUserInfo?.ITCode??"WMS";
_unitWork.Update(location); _unitWork.Update(location);
if (inv) //有货 if (inv) //有货
@@ -95,7 +101,7 @@ namespace HHWMS.Web.Controllers
FromLocation = "", FromLocation = "",
ToLocation = location.Code, ToLocation = location.Code,
Status = TaskStatusEnum.待下发, Status = TaskStatusEnum.待下发,
CreateBy = Wtm.LoginUserInfo?.ITCode??"WMS", CreateBy = Wtm?.LoginUserInfo?.ITCode??"WMS",
CreateTime = DateTime.Now CreateTime = DateTime.Now
}; };
_unitWork.Add(task); _unitWork.Add(task);
@@ -108,21 +114,37 @@ namespace HHWMS.Web.Controllers
FromLocation = task.FromLocation, FromLocation = task.FromLocation,
ToLocation = task.ToLocation ToLocation = task.ToLocation
}; };
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData) try
.Result.Data; {
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData)
.Result.Data;
if (res.Success) if (res.Success)
{ {
task.Status = TaskStatusEnum.已下发; task.Status = TaskStatusEnum.已下发;
}
else
{
task.ErrorMsg = res.Msg;
}
} }
else catch (Exception ex)
{ {
task.ErrorMsg = res.Msg;
} }
task.UpdateTime = DateTime.Now; task.UpdateTime = DateTime.Now;
task.UpdateBy = "WMS"; task.UpdateBy = "WMS";
_unitWork.Update(task); _unitWork.Update(task);
if (agv)
{
// 调用AGV接口
var task_id = Wtm.ConfigInfo.AppSettings
.FirstOrDefault(x => x.Key == "OutIn").Value;
var res2 = Wtm.CallAPI<ShipOutController.agvResult>("ACS", "task_mould_do", HttpMethodEnum.POST, new
{
task_id = task_id
});
}
return JsonMore(null); return JsonMore(null);
} }
} }
@@ -13,6 +13,15 @@
空箱 空箱
</template> </template>
</a-switch> </a-switch>
<a-switch v-model="agv">
<template #checked>
出库口
</template>
<template #unchecked>
入库口
</template>
</a-switch>
</a-space> </a-space>
<a-space> <a-space>
@@ -33,6 +42,7 @@
ContainerCode: '', ContainerCode: '',
loading1:false, loading1:false,
inv:false, inv:false,
agv:false,
data: reactive([]) data: reactive([])
} }
}, },
@@ -50,6 +60,7 @@
let postData = new URLSearchParams(); let postData = new URLSearchParams();
postData.append('containerCode', _this.ContainerCode); postData.append('containerCode', _this.ContainerCode);
postData.append('inv', _this.inv); postData.append('inv', _this.inv);
postData.append('agv', _this.agv);
axios.post("/receipt/ReceiptIn/TaskIn", postData) axios.post("/receipt/ReceiptIn/TaskIn", postData)
.then(function (json) { .then(function (json) {
@@ -1,4 +1,5 @@
using System; using System;
using System.Linq;
using HHWMS.Web.Models; using HHWMS.Web.Models;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using WalkingTec.Mvvm.Core; using WalkingTec.Mvvm.Core;
@@ -94,11 +95,13 @@ public class ShipOutController : BaseController
{ {
try try
{ {
var ids = Wtm.ConfigInfo.AppSettings.ToList();
var task_id = type switch var task_id = type switch
{ {
"In" => "ee66a5dc570cecd0", "In" => ids.FirstOrDefault(x => x.Key == "In").Value,
"Out" => "6970907a6b82e7fb", "Out" => ids.FirstOrDefault(x => x.Key == "Out").Value,
"Charge" => "a7a93155ff7f23a7", "Charge" => ids.FirstOrDefault(x => x.Key == "Charge").Value,
"OutIn" => ids.FirstOrDefault(x => x.Key == "OutIn").Value,
_ => throw new Exception("参数错误!") _ => throw new Exception("参数错误!")
}; };
@@ -13,12 +13,12 @@
<template #split> <template #split>
<a-divider direction="vertical" /> <a-divider direction="vertical" />
</template> </template>
<a-button @@click='handleAGVTask("In")' <a-button @@click='handleAGVTask("OutIn")'
:loading="loading2" :loading="loading2"
type="primary" type="primary"
status="warning" status="warning"
size="large"> size="large">
到入库点 入库
</a-button> </a-button>
<a-button @@click='handleAGVTask("Charge")' <a-button @@click='handleAGVTask("Charge")'
@@ -29,12 +29,12 @@
充电任务 充电任务
</a-button> </a-button>
<a-button @@click='handleAGVTask("Out")' @* <a-button @@click='handleAGVTask("Out")' *@
:loading="loading2" @* :loading="loading2" *@
type="outline" @* type="outline" *@
size="large"> @* size="large"> *@
到出库点 @* 到出库点 *@
</a-button> @* </a-button> *@
</a-space> </a-space>
</a-space> </a-space>
</div> </div>
+11 -12
View File
@@ -104,16 +104,10 @@ namespace HHWMS.Web.Models
/// <summary> /// <summary>
/// 容器类型 /// 容器类型
/// </summary> /// </summary>
public enum ContainerTypeEnum : int public static class ContainerTypeEnum
{ {
//// 11:23格料盒; 12:13格料盒; 13:16格料盒; 14:19格料盒 public const string 料箱 = "B";
格料盒23 = 11, public const string 托盘 = "P";
格料盒13 = 12,
格料盒16 = 13,
格料盒19 = 14,
} }
/// <summary> /// <summary>
@@ -286,14 +280,19 @@ namespace HHWMS.Web.Models
} }
/// <summary> /// <summary>
/// 区域 /// 类型
/// </summary> /// </summary>
public static class LocationTypeEnum public static class LocationTypeEnum
{ {
/// <summary> /// <summary>
/// 立库库位 = "L"; /// 周转箱库位 = "B";
/// </summary> /// </summary>
public const string 立库库位 = "L"; public const string 周转箱库位 = "B";
/// <summary>
/// 托盘库位 = "P";
/// </summary>
public const string 托盘库位 = "P";
} }
+5 -1
View File
@@ -119,6 +119,10 @@
}, },
"AppSettings": { "AppSettings": {
"Key1": "abc", "Key1": "abc",
"Key2": "123" "Key2": "123",
"Out": "123",
"In": "123",
"Charge": "123",
"OutIn": "123",
} }
} }