Compare commits

..
2 Commits
Author SHA1 Message Date
zhougf a3e91357ee 容器出库
库位禁用
演示逻辑修改 task station=1的出库任务需要自动下发入库任务和AGv任务
2024-05-29 17:09:03 +08:00
zhougf a6168a75bf 设计出库口入库流程
托盘、周转箱分区存放
2024-04-30 23:18:05 +08:00
14 changed files with 224 additions and 45 deletions

No files matched your search

+9 -6
View File
@@ -149,23 +149,26 @@ namespace HHWMS.Web
_unitWork.BatchDelete<Inventory>(inventoryList2); _unitWork.BatchDelete<Inventory>(inventoryList2);
} }
// 如果是出库页面创建的任务,则创建入库任务并联动AGV
if (task.Station == "1")
{
new ReceiptInController(_unitWork, Wtm).TaskIn(task.ContainerCode, false, false);
// 下发AGV到出库口的任务 // 下发AGV到出库口的任务
// 如果对接 执行下方任务,否则不执行
var interfaceAgv = _unitWork.FindSingle<SysCount>(x => x.Prefix == "interfaceAGV")?.Value;
if (interfaceAgv == 1)
{
var agv_task_id = Wtm.ConfigInfo.AppSettings.FirstOrDefault(x => x.Key == "OutIn").Value;
var postAgv = new var postAgv = new
{ {
task_id = "6970907a6b82e7fb" task_id = agv_task_id,
}; };
var res = Wtm.CallAPI<ShipOutController.agvResult>("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) // if (res.Result.Data.ack == 0)
// { // {
// //
// } // }
} }
break; break;
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using HHWMS.Web.Models; using HHWMS.Web.Models;
@@ -290,5 +291,89 @@ namespace HHWMS.Web.Controllers
return FFResult().CloseDialog().RefreshGrid(); return FFResult().CloseDialog().RefreshGrid();
} }
} }
[ActionDescription("Inventory.Out")]
public IActionResult Out(int id)
{
var container = _unitwork.FindById<Container>(id);
if (container == null)
{
return FFResult().RefreshGrid().Alert("选定容器不存在!请检查后再执行出库任务!");
}
if (string.IsNullOrEmpty(container.LocationCode))
{
return FFResult().RefreshGrid().Alert("选定容器不在库位!请检查后再执行出库任务!");
}
if (_unitwork.IsExit<TaskHeader>(x => x.ContainerCode.Equals(container.Code)))
{
return FFResult().RefreshGrid().Alert("选定容器已存在任务!请检查后再执行出库任务!");
}
var location = _unitwork.FindSingle<Location>(x => x.Code == container.LocationCode);
if (location != null)
{
location.Status = LocationStatus.任务锁;
location.UpdateTime = DateTime.Now;
location.UpdateBy = Wtm.LoginUserInfo?.ITCode ?? "WMS";
_unitwork.Update(location);
// 查找container,并更新状态
// var container = _unitwork.FindSingle<Container>(x => x.Code == location.ContainerCode);
container.IsLock = ContainerLockEnum.任务锁;
container.UpdateTime = DateTime.Now;
container.UpdateBy = Wtm.LoginUserInfo?.ITCode ?? "WMS";
_unitwork.Update(container);
//创建出库任务
var task = new TaskHeader
{
ZoneCode = ZoneCodeEnum.立库,
TaskNo = _unitwork.GetSerialNumber("Out"),
TaskType = TaskTypeEnum.立库出库,
ContainerCode = location.ContainerCode,
FromLocation = location.Code,
ToLocation = "",
Status = TaskStatusEnum.待下发,
CreateBy = Wtm.LoginUserInfo?.ITCode ?? "WMS",
CreateTime = DateTime.Now
};
_unitwork.Add(task);
// 下发任务到wcs
var postData = new
{
TaskNo = task.TaskNo,
PalletNo = task.ContainerCode,
FromLocation = task.FromLocation,
ToLocation = task.ToLocation
};
try
{
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData)
.Result.Data;
if (res.Success)
{
task.Status = TaskStatusEnum.已下发;
}
else
{
task.ErrorMsg = res.Msg;
}
}
catch (Exception ex)
{
task.ErrorMsg = ex.Message;
}
task.UpdateTime = DateTime.Now;
task.UpdateBy = "WMS";
_unitwork.Update(task);
}
return FFResult().RefreshGrid().Message("任务创建成功!");
}
} }
} }
@@ -6,6 +6,7 @@ using WalkingTec.Mvvm.Mvc;
using WalkingTec.Mvvm.Core.Extensions; using WalkingTec.Mvvm.Core.Extensions;
using HHWMS.Web; using HHWMS.Web;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using HHWMS.Web.Models; using HHWMS.Web.Models;
namespace HHWMS.Web.Controllers namespace HHWMS.Web.Controllers
@@ -287,5 +288,30 @@ namespace HHWMS.Web.Controllers
return Ok(); return Ok();
} }
[ActionDescription("Location.StopLocation")]
public ActionResult StopLocation(string[] ids)
{
_unitwork.BatchUpdate<Location>(x => ids.Contains(x.ID.ToString()),
x => new Location
{
IsStop = true,
UpdateBy = Wtm.LoginUserInfo.ITCode,
UpdateTime = DateTime.Now
});
return FFResult().RefreshGrid().Message("库位禁用成功!");
}
[ActionDescription("Location.LiftLocation")]
public ActionResult LiftLocation(string[] ids)
{
_unitwork.BatchUpdate<Location>(x => ids.Contains(x.ID.ToString()),
x => new Location
{
IsStop = false,
UpdateBy = Wtm.LoginUserInfo.ITCode,
UpdateTime = DateTime.Now
});
return FFResult().RefreshGrid().Message("库位解禁成功!");
}
} }
} }
@@ -31,6 +31,8 @@ namespace HHWMS.Web
this.MakeStandardAction("Container", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "configs", dialogWidth: 800), this.MakeStandardAction("Container", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "configs", dialogWidth: 800),
this.MakeStandardAction("Container", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "configs"), this.MakeStandardAction("Container", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "configs"),
this.MakeAction("Container","AddContainer",Localizer["Container.AddContainer"],Localizer["Container.AddContainer"],GridActionParameterTypesEnum.NoId,"configs"), this.MakeAction("Container","AddContainer",Localizer["Container.AddContainer"],Localizer["Container.AddContainer"],GridActionParameterTypesEnum.NoId,"configs"),
this.MakeAction("Container","Out",Localizer["Inventory.Out"],Localizer["Inventory.Out"],GridActionParameterTypesEnum.SingleId,"configs"),
this.MakeAction("Location","Print",Localizer["Sys.Print"],Localizer["Sys.Print"],GridActionParameterTypesEnum.MultiIds,"configs") this.MakeAction("Location","Print",Localizer["Sys.Print"],Localizer["Sys.Print"],GridActionParameterTypesEnum.MultiIds,"configs")
.SetShowDialog(false).SetOnClickScript("print"), .SetShowDialog(false).SetOnClickScript("print"),
}; };
@@ -33,6 +33,9 @@ namespace HHWMS.Web
this.MakeStandardAction("Location", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "configs", dialogWidth: 800), this.MakeStandardAction("Location", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "configs", dialogWidth: 800),
this.MakeStandardAction("Location", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "configs"), this.MakeStandardAction("Location", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "configs"),
this.MakeAction("Location","AddLocation",Localizer["Location.AddLocation"],Localizer["Location.AddLocation"],GridActionParameterTypesEnum.NoId,"configs"), this.MakeAction("Location","AddLocation",Localizer["Location.AddLocation"],Localizer["Location.AddLocation"],GridActionParameterTypesEnum.NoId,"configs"),
this.MakeAction("Location","StopLocation",Localizer["Location.StopLocation"],Localizer["Location.StopLocation"],GridActionParameterTypesEnum.MultiIds,"configs"),
this.MakeAction("Location","LiftLocation",Localizer["Location.LiftLocation"],Localizer["Location.LiftLocation"],GridActionParameterTypesEnum.MultiIds,"configs"),
this.MakeAction("Location","Print",Localizer["Sys.Print"],Localizer["Sys.Print"],GridActionParameterTypesEnum.MultiIds,"configs") this.MakeAction("Location","Print",Localizer["Sys.Print"],Localizer["Sys.Print"],GridActionParameterTypesEnum.MultiIds,"configs")
.SetShowDialog(false).SetOnClickScript("print"), .SetShowDialog(false).SetOnClickScript("print"),
@@ -5,15 +5,17 @@
<wt:row items-per-row="ItemsPerRowEnum.Three"> <wt:row items-per-row="ItemsPerRowEnum.Three">
<wt:combobox field="Searcher.ZoneCode" items="ZoneCodes" /> <wt:combobox field="Searcher.ZoneCode" items="ZoneCodes" />
<wt:textbox field="Searcher.Code" /> <wt:textbox field="Searcher.Code" />
@* <wt:combobox field="Searcher.Type" items="Types" /> <wt:combobox field="Searcher.Type" items="Types" />
<wt:combobox field="Searcher.Status" items="LocationStatus" /> <wt:combobox field="Searcher.Status" items="LocationStatus" />
<wt:textbox field="Searcher.ContainerCode" />
<wt:combobox field="Searcher.IsStop" empty-text="@Localizer["Sys.All"]" />
<wt:textbox field="Searcher.Row" /> <wt:textbox field="Searcher.Row" />
<wt:textbox field="Searcher.Line" /> <wt:textbox field="Searcher.Line" />
<wt:textbox field="Searcher.Layer" /> <wt:textbox field="Searcher.Layer" />
@*
<wt:textbox field="Searcher.RoadWay" /> <wt:textbox field="Searcher.RoadWay" />
<wt:textbox field="Searcher.ContainerCode" /> <wt:textbox field="Searcher.ContiguousCode" />
<wt:combobox field="Searcher.IsStop" empty-text="@Localizer["Sys.All"]" /> *@ *@
@*<wt:textbox field="Searcher.ContiguousCode" />*@
</wt:row> </wt:row>
</wt:searchpanel> </wt:searchpanel>
<wt:grid vm="@Model" url="/configs/Location/Search"/> <wt:grid vm="@Model" url="/configs/Location/Search"/>
@@ -225,6 +225,7 @@ namespace HHWMS.Web.Controllers
} }
#endregion #endregion
[ActionDescription("Inventory.Out")]
public IActionResult Out(int id) public IActionResult Out(int id)
{ {
var inv = _unitwork.FindById<Inventory>(id); var inv = _unitwork.FindById<Inventory>(id);
@@ -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,19 +51,20 @@ 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.空仓位
.OrderBy(x => x.Layer) && u.Type == container.Type
.ThenBy(x => x.Line) && !u.IsStop)
.OrderByDescending(x => x.Layer)
.ThenByDescending(x => x.Line)
.FirstOrDefault(); .FirstOrDefault();
// 判断location是否为空 // 判断location是否为空
@@ -67,7 +74,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 +102,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,6 +115,8 @@ namespace HHWMS.Web.Controllers
FromLocation = task.FromLocation, FromLocation = task.FromLocation,
ToLocation = task.ToLocation ToLocation = task.ToLocation
}; };
try
{
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData) var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData)
.Result.Data; .Result.Data;
@@ -119,10 +128,25 @@ namespace HHWMS.Web.Controllers
{ {
task.ErrorMsg = res.Msg; task.ErrorMsg = res.Msg;
} }
}
catch (Exception ex)
{
task.ErrorMsg = ex.Message;
}
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;
@@ -54,6 +55,7 @@ public class ShipOutController : BaseController
ContainerCode = location.ContainerCode, ContainerCode = location.ContainerCode,
FromLocation = location.Code, FromLocation = location.Code,
ToLocation = "", ToLocation = "",
Station = "1",
Status = TaskStatusEnum.待下发, Status = TaskStatusEnum.待下发,
CreateBy = Wtm.LoginUserInfo?.ITCode??"WMS", CreateBy = Wtm.LoginUserInfo?.ITCode??"WMS",
CreateTime = DateTime.Now CreateTime = DateTime.Now
@@ -68,6 +70,8 @@ public class ShipOutController : BaseController
FromLocation = task.FromLocation, FromLocation = task.FromLocation,
ToLocation = task.ToLocation ToLocation = task.ToLocation
}; };
try
{
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData) var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData)
.Result.Data; .Result.Data;
if (res.Success) if (res.Success)
@@ -78,15 +82,22 @@ public class ShipOutController : BaseController
{ {
task.ErrorMsg = res.Msg; task.ErrorMsg = res.Msg;
} }
}
catch (Exception ex)
{
task.ErrorMsg = ex.Message;
}
task.UpdateTime = DateTime.Now; task.UpdateTime = DateTime.Now;
task.UpdateBy = "WMS"; task.UpdateBy = "WMS";
_unitWork.Update(task); _unitWork.Update(task);
return JsonMore(null); return JsonMore(null);
} }
else else
{ {
return JsonMore(null, 500, "库内无可用容器!"); return JsonMore(null, 500, "库内无可用空容器!");
} }
} }
@@ -94,11 +105,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";
} }
+6
View File
@@ -1152,6 +1152,12 @@
<data name="Location.AddLocation" xml:space="preserve"> <data name="Location.AddLocation" xml:space="preserve">
<value>添加库位</value> <value>添加库位</value>
</data> </data>
<data name="Location.StopLocation" xml:space="preserve">
<value>禁用库位</value>
</data>
<data name="Location.LiftLocation" xml:space="preserve">
<value>解禁库位</value>
</data>
<data name="Location.BeginLine" xml:space="preserve"> <data name="Location.BeginLine" xml:space="preserve">
<value>起始列</value> <value>起始列</value>
</data> </data>
+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",
} }
} }