容器出库
库位禁用 演示逻辑修改 task station=1的出库任务需要自动下发入库任务和AGv任务
This commit is contained in:
1 parent
a6168a75bf
commit
a3e91357ee
10 files changed
+166
-33
No files matched your search
@@ -149,30 +149,26 @@ namespace HHWMS.Web
|
||||
|
||||
_unitWork.BatchDelete<Inventory>(inventoryList2);
|
||||
}
|
||||
// 创建入库任务
|
||||
if (inventoryList2.Count == 0)
|
||||
// 如果是出库页面创建的任务,则创建入库任务并联动AGV
|
||||
if (task.Station == "1")
|
||||
{
|
||||
new ReceiptInController(_unitWork, Wtm).TaskIn(task.ContainerCode, false, false);
|
||||
|
||||
// 下发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
|
||||
{
|
||||
task_id = agv_task_id,
|
||||
};
|
||||
|
||||
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)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
}
|
||||
var res = Wtm.CallAPI<ShipOutController.agvResult>("ACS", "task_mould_do",
|
||||
HttpMethodEnum.POST, postAgv);
|
||||
// if (res.Result.Data.ack == 0)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HHWMS.Web.Models;
|
||||
@@ -290,5 +291,89 @@ namespace HHWMS.Web.Controllers
|
||||
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 HHWMS.Web;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HHWMS.Web.Models;
|
||||
|
||||
namespace HHWMS.Web.Controllers
|
||||
@@ -287,5 +288,30 @@ namespace HHWMS.Web.Controllers
|
||||
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.ExportExcel, Localizer["Sys.Export"], "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")
|
||||
.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.ExportExcel, Localizer["Sys.Export"], "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")
|
||||
.SetShowDialog(false).SetOnClickScript("print"),
|
||||
|
||||
|
||||
@@ -5,15 +5,17 @@
|
||||
<wt:row items-per-row="ItemsPerRowEnum.Three">
|
||||
<wt:combobox field="Searcher.ZoneCode" items="ZoneCodes" />
|
||||
<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:textbox field="Searcher.ContainerCode" />
|
||||
<wt:combobox field="Searcher.IsStop" empty-text="@Localizer["Sys.All"]" />
|
||||
<wt:textbox field="Searcher.Row" />
|
||||
<wt:textbox field="Searcher.Line" />
|
||||
<wt:textbox field="Searcher.Layer" />
|
||||
@*
|
||||
<wt:textbox field="Searcher.RoadWay" />
|
||||
<wt:textbox field="Searcher.ContainerCode" />
|
||||
<wt:combobox field="Searcher.IsStop" empty-text="@Localizer["Sys.All"]" /> *@
|
||||
@*<wt:textbox field="Searcher.ContiguousCode" />*@
|
||||
<wt:textbox field="Searcher.ContiguousCode" />
|
||||
*@
|
||||
</wt:row>
|
||||
</wt:searchpanel>
|
||||
<wt:grid vm="@Model" url="/configs/Location/Search"/>
|
||||
|
||||
@@ -225,6 +225,7 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
#endregion
|
||||
|
||||
[ActionDescription("Inventory.Out")]
|
||||
public IActionResult Out(int id)
|
||||
{
|
||||
var inv = _unitwork.FindById<Inventory>(id);
|
||||
|
||||
@@ -61,9 +61,10 @@ namespace HHWMS.Web.Controllers
|
||||
|
||||
//查找仓位
|
||||
var location = _unitWork.Find<Location>(u => u.Status == LocationStatus.空仓位
|
||||
&& u.Type == container.Type)
|
||||
.OrderBy(x => x.Layer)
|
||||
.ThenBy(x => x.Line)
|
||||
&& u.Type == container.Type
|
||||
&& !u.IsStop)
|
||||
.OrderByDescending(x => x.Layer)
|
||||
.ThenByDescending(x => x.Line)
|
||||
.FirstOrDefault();
|
||||
|
||||
// 判断location是否为空
|
||||
@@ -130,11 +131,12 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
task.ErrorMsg = ex.Message;
|
||||
}
|
||||
|
||||
task.UpdateTime = DateTime.Now;
|
||||
task.UpdateBy = "WMS";
|
||||
_unitWork.Update(task);
|
||||
|
||||
if (agv)
|
||||
{
|
||||
// 调用AGV接口
|
||||
|
||||
@@ -55,6 +55,7 @@ public class ShipOutController : BaseController
|
||||
ContainerCode = location.ContainerCode,
|
||||
FromLocation = location.Code,
|
||||
ToLocation = "",
|
||||
Station = "1",
|
||||
Status = TaskStatusEnum.待下发,
|
||||
CreateBy = Wtm.LoginUserInfo?.ITCode??"WMS",
|
||||
CreateTime = DateTime.Now
|
||||
@@ -69,25 +70,34 @@ public class ShipOutController : BaseController
|
||||
FromLocation = task.FromLocation,
|
||||
ToLocation = task.ToLocation
|
||||
};
|
||||
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData)
|
||||
.Result.Data;
|
||||
if (res.Success)
|
||||
try
|
||||
{
|
||||
task.Status = TaskStatusEnum.已下发;
|
||||
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData)
|
||||
.Result.Data;
|
||||
if (res.Success)
|
||||
{
|
||||
task.Status = TaskStatusEnum.已下发;
|
||||
}
|
||||
else
|
||||
{
|
||||
task.ErrorMsg = res.Msg;
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception ex)
|
||||
{
|
||||
task.ErrorMsg = res.Msg;
|
||||
task.ErrorMsg = ex.Message;
|
||||
}
|
||||
|
||||
task.UpdateTime = DateTime.Now;
|
||||
task.UpdateBy = "WMS";
|
||||
_unitWork.Update(task);
|
||||
|
||||
|
||||
return JsonMore(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
return JsonMore(null, 500, "库内无可用容器!");
|
||||
return JsonMore(null, 500, "库内无可用空容器!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1152,6 +1152,12 @@
|
||||
<data name="Location.AddLocation" xml:space="preserve">
|
||||
<value>添加库位</value>
|
||||
</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">
|
||||
<value>起始列</value>
|
||||
</data>
|
||||
|
||||
Reference in new issue
Block a user