设计出库口入库流程

托盘、周转箱分区存放
This commit is contained in:
Mac mini git server 2024-04-30 23:17:53 +08:00
parent 70e6866e20
commit a6168a75bf
7 changed files with 99 additions and 53 deletions

View File

@ -149,23 +149,30 @@ namespace HHWMS.Web
_unitWork.BatchDelete<Inventory>(inventoryList2);
}
// 下发AGV到出库口的任务
// 如果对接 执行下方任务,否则不执行
var interfaceAgv = _unitWork.FindSingle<SysCount>(x => x.Prefix == "interfaceAGV")?.Value;
if (interfaceAgv == 1)
// 创建入库任务
if (inventoryList2.Count == 0)
{
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);
// if (res.Result.Data.ack == 0)
// {
//
// }
var agv_task_id = Wtm.ConfigInfo.AppSettings.FirstOrDefault(x => x.Key == "OutIn").Value;
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;

View File

@ -12,10 +12,12 @@ namespace HHWMS.Web.Controllers
public partial class ReceiptInController : BaseController
{
private readonly IUnitWork _unitWork;
private readonly WTMContext _context;
public ReceiptInController(IUnitWork unitWork)
public ReceiptInController(IUnitWork unitWork, WTMContext wtmContext)
{
_unitWork = unitWork;
_context = wtmContext;
}
#region Index
@ -29,8 +31,12 @@ namespace HHWMS.Web.Controllers
#endregion Index
[HttpPost]
public ActionResult TaskIn(string containerCode, bool inv)
public ActionResult TaskIn(string containerCode, bool inv, bool agv)
{
if (Wtm == null)
{
Wtm = _context;
}
// 判断containerCode是否为空
if (string.IsNullOrEmpty(containerCode))
{
@ -45,17 +51,17 @@ namespace HHWMS.Web.Controllers
// 如果 container的库位不为空,或者islock为true,则返回错误信息
if (!string.IsNullOrEmpty(container.LocationCode) || container.IsLock == ContainerLockEnum.任务锁)
{
return JsonMore(null, 500, $"容器 {containerCode} 已被占用!");
return JsonMore(null, 500, $"容器 {containerCode} 已被锁定或已在库内!");
}
container.IsLock = ContainerLockEnum.任务锁;
container.UpdateTime = DateTime.Now;
container.UpdateBy = Wtm.LoginUserInfo?.ITCode??"WMS";
container.UpdateBy = Wtm?.LoginUserInfo?.ITCode??"WMS";
// _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)
.ThenBy(x => x.Line)
.FirstOrDefault();
@ -67,7 +73,7 @@ namespace HHWMS.Web.Controllers
}
location.Status = LocationStatus.任务锁;
location.UpdateTime = DateTime.Now;
location.UpdateBy = Wtm.LoginUserInfo?.ITCode??"WMS";
location.UpdateBy = Wtm?.LoginUserInfo?.ITCode??"WMS";
_unitWork.Update(location);
if (inv) //有货
@ -95,7 +101,7 @@ namespace HHWMS.Web.Controllers
FromLocation = "",
ToLocation = location.Code,
Status = TaskStatusEnum.待下发,
CreateBy = Wtm.LoginUserInfo?.ITCode??"WMS",
CreateBy = Wtm?.LoginUserInfo?.ITCode??"WMS",
CreateTime = DateTime.Now
};
_unitWork.Add(task);
@ -108,21 +114,37 @@ namespace HHWMS.Web.Controllers
FromLocation = task.FromLocation,
ToLocation = task.ToLocation
};
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData)
.Result.Data;
try
{
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData)
.Result.Data;
if (res.Success)
{
task.Status = TaskStatusEnum.已下发;
if (res.Success)
{
task.Status = TaskStatusEnum.已下发;
}
else
{
task.ErrorMsg = res.Msg;
}
}
else
catch (Exception ex)
{
task.ErrorMsg = res.Msg;
}
task.UpdateTime = DateTime.Now;
task.UpdateBy = "WMS";
_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);
}
}

View File

@ -13,6 +13,15 @@
空箱
</template>
</a-switch>
<a-switch v-model="agv">
<template #checked>
出库口
</template>
<template #unchecked>
入库口
</template>
</a-switch>
</a-space>
<a-space>
@ -33,6 +42,7 @@
ContainerCode: '',
loading1:false,
inv:false,
agv:false,
data: reactive([])
}
},
@ -50,6 +60,7 @@
let postData = new URLSearchParams();
postData.append('containerCode', _this.ContainerCode);
postData.append('inv', _this.inv);
postData.append('agv', _this.agv);
axios.post("/receipt/ReceiptIn/TaskIn", postData)
.then(function (json) {

View File

@ -1,4 +1,5 @@
using System;
using System.Linq;
using HHWMS.Web.Models;
using Microsoft.AspNetCore.Mvc;
using WalkingTec.Mvvm.Core;
@ -94,11 +95,13 @@ public class ShipOutController : BaseController
{
try
{
var ids = Wtm.ConfigInfo.AppSettings.ToList();
var task_id = type switch
{
"In" => "ee66a5dc570cecd0",
"Out" => "6970907a6b82e7fb",
"Charge" => "a7a93155ff7f23a7",
"In" => ids.FirstOrDefault(x => x.Key == "In").Value,
"Out" => ids.FirstOrDefault(x => x.Key == "Out").Value,
"Charge" => ids.FirstOrDefault(x => x.Key == "Charge").Value,
"OutIn" => ids.FirstOrDefault(x => x.Key == "OutIn").Value,
_ => throw new Exception("参数错误!")
};

View File

@ -13,12 +13,12 @@
<template #split>
<a-divider direction="vertical" />
</template>
<a-button @@click='handleAGVTask("In")'
<a-button @@click='handleAGVTask("OutIn")'
:loading="loading2"
type="primary"
status="warning"
size="large">
到入库点
入库
</a-button>
<a-button @@click='handleAGVTask("Charge")'
@ -29,12 +29,12 @@
充电任务
</a-button>
<a-button @@click='handleAGVTask("Out")'
:loading="loading2"
type="outline"
size="large">
到出库点
</a-button>
@* <a-button @@click='handleAGVTask("Out")' *@
@* :loading="loading2" *@
@* type="outline" *@
@* size="large"> *@
@* 到出库点 *@
@* </a-button> *@
</a-space>
</a-space>
</div>

View File

@ -104,16 +104,10 @@ namespace HHWMS.Web.Models
/// <summary>
/// 容器类型
/// </summary>
public enum ContainerTypeEnum : int
public static class ContainerTypeEnum
{
//// 11:23格料盒; 12:13格料盒; 13:16格料盒; 14:19格料盒
格料盒23 = 11,
格料盒13 = 12,
格料盒16 = 13,
格料盒19 = 14,
public const string 料箱 = "B";
public const string 托盘 = "P";
}
/// <summary>
@ -286,14 +280,19 @@ namespace HHWMS.Web.Models
}
/// <summary>
/// 区域
/// 类型
/// </summary>
public static class LocationTypeEnum
{
/// <summary>
/// 立库库位 = "L";
/// 周转箱库位 = "B";
/// </summary>
public const string 立库库位 = "L";
public const string 周转箱库位 = "B";
/// <summary>
/// 托盘库位 = "P";
/// </summary>
public const string 托盘库位 = "P";
}

View File

@ -119,6 +119,10 @@
},
"AppSettings": {
"Key1": "abc",
"Key2": "123"
"Key2": "123",
"Out": "123",
"In": "123",
"Charge": "123",
"OutIn": "123",
}
}