1. 添加你入库页面验证
2. 库存查询条件 3. 接口任务完成修改 4. 添加物料及物料工序的修改
This commit is contained in:
1 parent
13d3a96f0c
commit
713c3528ad
15 files changed
+280
-154
No files matched your search
@@ -480,14 +480,6 @@ namespace HHWMS.Web
|
|||||||
// 处理移库:同时更新源库位和目标库位
|
// 处理移库:同时更新源库位和目标库位
|
||||||
// 1. 更新源库位(移出后变为空)
|
// 1. 更新源库位(移出后变为空)
|
||||||
var sourceLocation = _unitWork.FindSingle<Location>(x => x.Code == task.FromLocation);
|
var sourceLocation = _unitWork.FindSingle<Location>(x => x.Code == task.FromLocation);
|
||||||
if (sourceLocation != null)
|
|
||||||
{
|
|
||||||
sourceLocation.ContainerCode = "";
|
|
||||||
sourceLocation.Status = LocationStatusEnum.未锁;
|
|
||||||
sourceLocation.ContainerStatus = LocationStatus.空仓位;
|
|
||||||
sourceLocation.UpdateTime = DateTime.Now;
|
|
||||||
_unitWork.Update(sourceLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. 更新目标库位(移入后有容器)
|
// 2. 更新目标库位(移入后有容器)
|
||||||
var targetLocation = _unitWork.FindSingle<Location>(x => x.Code == task.ToLocation);
|
var targetLocation = _unitWork.FindSingle<Location>(x => x.Code == task.ToLocation);
|
||||||
@@ -495,10 +487,20 @@ namespace HHWMS.Web
|
|||||||
{
|
{
|
||||||
targetLocation.ContainerCode = task.ContainerCode;
|
targetLocation.ContainerCode = task.ContainerCode;
|
||||||
targetLocation.Status = LocationStatusEnum.未锁;
|
targetLocation.Status = LocationStatusEnum.未锁;
|
||||||
|
targetLocation.ContainerStatus = sourceLocation.ContainerStatus;
|
||||||
targetLocation.UpdateTime = DateTime.Now;
|
targetLocation.UpdateTime = DateTime.Now;
|
||||||
_unitWork.Update(targetLocation);
|
_unitWork.Update(targetLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sourceLocation != null)
|
||||||
|
{
|
||||||
|
sourceLocation.ContainerCode = "";
|
||||||
|
sourceLocation.Status = LocationStatusEnum.未锁;
|
||||||
|
sourceLocation.ContainerStatus = LocationStatus.空仓位;
|
||||||
|
sourceLocation.UpdateTime = DateTime.Now;
|
||||||
|
_unitWork.Update(sourceLocation);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -45,6 +45,14 @@ namespace HHWMS.Web.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ActionDescription("Sys.Search")]
|
||||||
|
[HttpPost]
|
||||||
|
public string Search2(MaterialProcessListVM2 vm)
|
||||||
|
{
|
||||||
|
vm.Searcher.Page = vm.FC.GetValue<int>("Page");
|
||||||
|
vm.Searcher.Limit = vm.FC.GetValue<int>("Limit");
|
||||||
|
return vm.GetJson(false);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Create
|
#region Create
|
||||||
@@ -112,6 +120,15 @@ namespace HHWMS.Web.Controllers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
var code = _unitWork.FindSingle<MaterialProcess>(x => x.ProcessName == vm.Entity.ProcessName)?.ProcessCode;
|
||||||
|
vm.Entity.ProcessCode = code;
|
||||||
|
// 判断是否重复
|
||||||
|
if (_unitWork.IsExit<MaterialProcess>(x => x.ID != vm.Entity.ID && x.MaterialCode == vm.Entity.MaterialCode
|
||||||
|
&& (x.ProcessOrder == vm.Entity.ProcessOrder
|
||||||
|
|| x.ProcessName == vm.Entity.ProcessName)))
|
||||||
|
{
|
||||||
|
return FFResult().Alert("同一物料的工序或者顺序不能重复,请检查后重新编辑!");
|
||||||
|
}
|
||||||
vm.DoEdit();
|
vm.DoEdit();
|
||||||
if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
{
|
{
|
||||||
@@ -120,7 +137,7 @@ namespace HHWMS.Web.Controllers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return FFResult().CloseDialog().RefreshGridRow(vm.Entity.ID);
|
return FFResult().CloseDialog().RefreshGrid(vm.ParentWindowId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ namespace HHWMS.Web
|
|||||||
var moveloc = GetMoveLocation(outter);
|
var moveloc = GetMoveLocation(outter);
|
||||||
if (moveloc.Status)
|
if (moveloc.Status)
|
||||||
{
|
{
|
||||||
string code = moveloc.Data.Code;
|
string code = moveloc.Data.LocationCode;
|
||||||
var movelocation = _unitWork.FindSingle<Location>(x => x.Code == code);
|
var movelocation = _unitWork.FindSingle<Location>(x => x.Code == code);
|
||||||
|
|
||||||
// 生成outter移库任务
|
// 生成outter移库任务
|
||||||
@@ -435,6 +435,7 @@ namespace HHWMS.Web
|
|||||||
ZoneId = outter.ZoneId,
|
ZoneId = outter.ZoneId,
|
||||||
TaskNo = _unitWork.GetSerialNumber("Move"),
|
TaskNo = _unitWork.GetSerialNumber("Move"),
|
||||||
TaskType = TaskTypeEnum.移库,
|
TaskType = TaskTypeEnum.移库,
|
||||||
|
RoadWay = 2,
|
||||||
ContainerCode = outter.ContainerCode,
|
ContainerCode = outter.ContainerCode,
|
||||||
FromLocation = outter.Code,
|
FromLocation = outter.Code,
|
||||||
ToLocation = movelocation.Code,
|
ToLocation = movelocation.Code,
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace HHWMS.Web
|
|||||||
return new List<GridAction>
|
return new List<GridAction>
|
||||||
{
|
{
|
||||||
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"configs", dialogWidth: 800),
|
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"configs", dialogWidth: 800),
|
||||||
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "configs", dialogWidth: 800),
|
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "configs", dialogWidth: 800,dialogHeight:800),
|
||||||
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "configs", dialogWidth: 800),
|
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "configs", dialogWidth: 800),
|
||||||
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "configs", dialogWidth: 800),
|
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "configs", dialogWidth: 800),
|
||||||
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.BatchEdit, Localizer["Sys.BatchEdit"], "configs", dialogWidth: 800),
|
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.BatchEdit, Localizer["Sys.BatchEdit"], "configs", dialogWidth: 800),
|
||||||
@@ -64,7 +64,7 @@ namespace HHWMS.Web
|
|||||||
Description = x.Description,
|
Description = x.Description,
|
||||||
IsActive = x.IsActive,
|
IsActive = x.IsActive,
|
||||||
})
|
})
|
||||||
.OrderBy(x => x.ID);
|
.OrderBy(x => x.ProcessOrder);
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WalkingTec.Mvvm.Core;
|
||||||
|
using WalkingTec.Mvvm.Core.Extensions;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using HHWMS.Web.Models;
|
||||||
|
|
||||||
|
|
||||||
|
namespace HHWMS.Web
|
||||||
|
{
|
||||||
|
public partial class MaterialProcessListVM2 : BasePagedListVM<MaterialProcess_View, MaterialProcessSearcher>
|
||||||
|
{
|
||||||
|
protected override List<GridAction> InitGridAction()
|
||||||
|
{
|
||||||
|
return new List<GridAction>
|
||||||
|
{
|
||||||
|
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"configs", dialogWidth: 800),
|
||||||
|
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "configs", dialogWidth: 800,dialogHeight:800),
|
||||||
|
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "configs", dialogWidth: 800),
|
||||||
|
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "configs", dialogWidth: 800),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override IEnumerable<IGridColumn<MaterialProcess_View>> InitGridHeader()
|
||||||
|
{
|
||||||
|
return new List<GridColumn<MaterialProcess_View>>{
|
||||||
|
this.MakeGridHeader(x => x.MaterialCode).SetHide(),
|
||||||
|
this.MakeGridHeader(x => x.ProcessOrder),
|
||||||
|
this.MakeGridHeader(x => x.ProcessName),
|
||||||
|
this.MakeGridHeader(x => x.ProcessCode).SetHide(),
|
||||||
|
this.MakeGridHeader(x => x.Weight),
|
||||||
|
this.MakeGridHeader(x => x.Description),
|
||||||
|
this.MakeGridHeader(x => x.IsActive).SetHide(),
|
||||||
|
this.MakeGridHeaderAction(width: 200)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IOrderedQueryable<MaterialProcess_View> GetSearchQuery()
|
||||||
|
{
|
||||||
|
var query = DC.Set<MaterialProcess>()
|
||||||
|
.Where( x=>x.MaterialCode == Searcher.MaterialCode)
|
||||||
|
.Select(x => new MaterialProcess_View
|
||||||
|
{
|
||||||
|
ID = x.ID,
|
||||||
|
MaterialCode = x.MaterialCode,
|
||||||
|
ProcessOrder = x.ProcessOrder,
|
||||||
|
ProcessName = x.ProcessName,
|
||||||
|
ProcessCode = x.ProcessCode,
|
||||||
|
Weight = x.Weight,
|
||||||
|
Description = x.Description,
|
||||||
|
IsActive = x.IsActive,
|
||||||
|
})
|
||||||
|
.OrderBy(x => x.ProcessOrder);
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,13 +12,20 @@ namespace HHWMS.Web
|
|||||||
{
|
{
|
||||||
public partial class MaterialProcessVM : BaseCRUDVM<MaterialProcess>
|
public partial class MaterialProcessVM : BaseCRUDVM<MaterialProcess>
|
||||||
{
|
{
|
||||||
|
public List<ComboSelectListItem> Processes { get; set; }
|
||||||
public MaterialProcessVM()
|
public MaterialProcessVM()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void InitVM()
|
protected override void InitVM()
|
||||||
{
|
{
|
||||||
|
var CurrentCulture = Wtm.CurrentCulture;
|
||||||
|
var processDatas = DC.Set<ProcessConfig>().ToList();
|
||||||
|
Processes = processDatas.Select(x => new ComboSelectListItem
|
||||||
|
{
|
||||||
|
Text = x.Name,
|
||||||
|
Value = x.Name
|
||||||
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DoAdd()
|
public override void DoAdd()
|
||||||
|
|||||||
@@ -12,13 +12,15 @@ namespace HHWMS.Web
|
|||||||
{
|
{
|
||||||
public partial class MaterialVM : BaseCRUDVM<Material>
|
public partial class MaterialVM : BaseCRUDVM<Material>
|
||||||
{
|
{
|
||||||
|
public MaterialProcessListVM2 materialProcesses = new MaterialProcessListVM2();
|
||||||
public MaterialVM()
|
public MaterialVM()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void InitVM()
|
protected override void InitVM()
|
||||||
{
|
{
|
||||||
|
materialProcesses.CopyContext(this);
|
||||||
|
materialProcesses.Searcher.MaterialCode = Entity.MaterialCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DoAdd()
|
public override void DoAdd()
|
||||||
|
|||||||
@@ -2,21 +2,31 @@
|
|||||||
@inject IStringLocalizer<Program> Localizer;
|
@inject IStringLocalizer<Program> Localizer;
|
||||||
|
|
||||||
<wt:form vm="@Model">
|
<wt:form vm="@Model">
|
||||||
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||||
<wt:textbox field="Entity.MaterialCode" disabled/>
|
<wt:textbox field="Entity.MaterialCode" disabled/>
|
||||||
<wt:textbox field="Entity.MaterialType" disabled/>
|
<wt:textbox field="Entity.MaterialType" disabled/>
|
||||||
<wt:textbox field="Entity.MaterialName" />
|
<wt:textbox field="Entity.MaterialName" />
|
||||||
<wt:textbox field="Entity.MaterialSpec" />
|
<wt:textbox field="Entity.MaterialSpec" />
|
||||||
<wt:textbox field="Entity.MaterialUnit" />
|
<wt:textbox field="Entity.MaterialUnit" />
|
||||||
<wt:textbox field="Entity.Batch" />
|
<wt:textbox field="Entity.Batch" />
|
||||||
<wt:textbox field="Entity.Lot" />
|
<wt:textbox field="Entity.Lot" />
|
||||||
<wt:textbox field="Entity.CompanyCode" />
|
<wt:textbox field="Entity.CompanyCode" />
|
||||||
<wt:textbox field="Entity.SupplierCode" />
|
<wt:textbox field="Entity.SupplierCode" />
|
||||||
<wt:textbox field="Entity.Qty" />
|
<wt:textbox field="Entity.Qty" />
|
||||||
</wt:row>
|
</wt:row>
|
||||||
<wt:hidden field="Entity.ID" />
|
<wt:hidden field="Entity.ID" />
|
||||||
<wt:row align="AlignEnum.Right">
|
<wt:row align="AlignEnum.Right">
|
||||||
<wt:submitbutton />
|
<wt:submitbutton />
|
||||||
<wt:closebutton />
|
<wt:closebutton />
|
||||||
|
<wt:submitbutton click="test2()" text="刷新"/>
|
||||||
</wt:row>
|
</wt:row>
|
||||||
</wt:form>
|
</wt:form>
|
||||||
|
<wt:grid vm="@Model.materialProcesses" id="materialProcesses" hidden-checkbox="true" hidden-panel="true" use-local-data="true" height="400" />
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function test2(){
|
||||||
|
let code = $('[name="Entity.MaterialCode"]').val()
|
||||||
|
console.log(1,code)
|
||||||
|
layui.table.reload('materialProcesses', { where: { "Searcher.MaterialCode": code } });
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -5,8 +5,8 @@
|
|||||||
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||||
<wt:textbox field="Entity.MaterialCode" disabled/>
|
<wt:textbox field="Entity.MaterialCode" disabled/>
|
||||||
<wt:textbox field="Entity.ProcessOrder" />
|
<wt:textbox field="Entity.ProcessOrder" />
|
||||||
<wt:textbox field="Entity.ProcessName" />
|
<wt:combobox field="Entity.ProcessName" items="Processes" />
|
||||||
<wt:textbox field="Entity.ProcessCode" />
|
<wt:hidden field="Entity.ProcessCode" />
|
||||||
<wt:textbox field="Entity.Weight" />
|
<wt:textbox field="Entity.Weight" />
|
||||||
<wt:textbox field="Entity.Description" />
|
<wt:textbox field="Entity.Description" />
|
||||||
<wt:switch field="Entity.IsActive" />
|
<wt:switch field="Entity.IsActive" />
|
||||||
@@ -17,3 +17,7 @@
|
|||||||
<wt:closebutton />
|
<wt:closebutton />
|
||||||
</wt:row>
|
</wt:row>
|
||||||
</wt:form>
|
</wt:form>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
@@ -380,134 +380,142 @@ namespace HHWMS.Web.Controllers
|
|||||||
[ActionDescription("TaskType.Out")]
|
[ActionDescription("TaskType.Out")]
|
||||||
public ActionResult InvOut2(InventoryVM vm)
|
public ActionResult InvOut2(InventoryVM vm)
|
||||||
{
|
{
|
||||||
var id = vm.Entity.ID;
|
try
|
||||||
// 校验参数
|
|
||||||
if (string.IsNullOrWhiteSpace(vm.OutPort))
|
|
||||||
{
|
{
|
||||||
return FFResult().Alert("出口必选,请选择后重试!");
|
var id = vm.Entity.ID;
|
||||||
|
// 校验参数
|
||||||
|
if (string.IsNullOrWhiteSpace(vm.OutPort))
|
||||||
|
{
|
||||||
|
return FFResult().Alert("出口必选,请选择后重试!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验库存
|
||||||
|
var inv = _unitWork.FindSingle<Inventory>(x => x.ID == id);
|
||||||
|
if (inv == null)
|
||||||
|
{
|
||||||
|
return FFResult().CloseDialog().Alert("所选库存不存在,请检查后重试!").RefreshGrid();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inv.TaskStatus == InventoryTaskStatusEnum.Locked)
|
||||||
|
{
|
||||||
|
return FFResult().CloseDialog().Alert("所选库存已被锁定!,请检查后重试!").RefreshGrid();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验容器
|
||||||
|
var container = _unitWork.FindSingle<Container>(x => x.Code == inv.ContainerCode);
|
||||||
|
if (container == null)
|
||||||
|
{
|
||||||
|
return FFResult().CloseDialog().Alert("所选库存的容器不存在,请检查后重试!").RefreshGrid();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (container.IsLock == ContainerLockEnum.任务锁)
|
||||||
|
{
|
||||||
|
return FFResult().CloseDialog().Alert("库存所在容器已被锁定!,请检查后重试!").RefreshGrid();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验库位
|
||||||
|
var location = _unitWork.FindSingle<Location>(x => x.Code == inv.LocationCode);
|
||||||
|
if (location == null)
|
||||||
|
{
|
||||||
|
return FFResult().CloseDialog().Alert("所选库存不在库内,请检查后重试!").RefreshGrid();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (location.Status == LocationStatusEnum.锁定)
|
||||||
|
{
|
||||||
|
return FFResult().CloseDialog().Alert("库存所在仓位已被锁定!,请检查后重试!").RefreshGrid();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建任务
|
||||||
|
var task = new TaskHeader()
|
||||||
|
{
|
||||||
|
TaskNo = _unitWork.GetSerialNumber("Out", 6),
|
||||||
|
ZoneId = inv.ZoneId,
|
||||||
|
TaskType = TaskTypeEnum.出库,
|
||||||
|
FromLocation = inv.LocationCode,
|
||||||
|
ToLocation = vm.OutPort,
|
||||||
|
ContainerCode = inv.ContainerCode,
|
||||||
|
RoadWay = 2,
|
||||||
|
Status = TaskStatusEnum.新建,
|
||||||
|
CreateBy = Wtm.LoginUserInfo.ITCode,
|
||||||
|
CreateTime = DateTime.Now
|
||||||
|
};
|
||||||
|
|
||||||
|
var locationVm = Wtm.CreateVM<LocationVM>();
|
||||||
|
var result = locationVm.SendWcsTask(task);
|
||||||
|
if (result.Status)
|
||||||
|
{
|
||||||
|
// 更新库存
|
||||||
|
inv.TaskStatus = InventoryTaskStatusEnum.Locked;
|
||||||
|
inv.UpdateTime = DateTime.Now;
|
||||||
|
_unitWork.Update(inv);
|
||||||
|
|
||||||
|
// 更新容器
|
||||||
|
container.IsLock = ContainerLockEnum.任务锁;
|
||||||
|
container.UpdateTime = DateTime.Now;
|
||||||
|
_unitWork.Update(container);
|
||||||
|
|
||||||
|
// 更新库位
|
||||||
|
location.Status = LocationStatusEnum.锁定;
|
||||||
|
location.UpdateTime = DateTime.Now;
|
||||||
|
_unitWork.Update(location);
|
||||||
|
return FFResult().CloseDialog().Message("出库任务创建成功").RefreshGrid();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return FFResult().CloseDialog().Message(result.Message ?? "WCS任务下发失败").RefreshGrid();
|
||||||
|
}
|
||||||
|
// 6. 调用WCS接口下发任务
|
||||||
|
|
||||||
|
/*
|
||||||
|
var wcsTaskModel = new WCSTaskModel
|
||||||
|
{
|
||||||
|
TaskNo = task.TaskNo,
|
||||||
|
PalletNo = task.ContainerCode,
|
||||||
|
FromLocation = task.FromLocation, // 入库任务起始位置为空
|
||||||
|
ToLocation = task.ToLocation,
|
||||||
|
};
|
||||||
|
|
||||||
|
//调用WCS任务下发接口
|
||||||
|
var wcsResult = Wtm.CallAPI<WCSTaskResponse>("WCSCP", "TaskAssign", HttpMethodEnum.POST, wcsTaskModel).Result.Data;
|
||||||
|
|
||||||
|
if (wcsResult != null && wcsResult.Success)
|
||||||
|
{
|
||||||
|
// WCS任务下发成功
|
||||||
|
task.Status = TaskStatusEnum.已下发;
|
||||||
|
_unitWork.Add(task);
|
||||||
|
|
||||||
|
// 更新库存
|
||||||
|
inv.TaskStatus = InventoryTaskStatusEnum.Locked;
|
||||||
|
inv.UpdateTime = DateTime.Now;
|
||||||
|
_unitWork.Update(inv);
|
||||||
|
|
||||||
|
// 更新容器
|
||||||
|
// _unitWork.BatchUpdate<Container>(x => x.Code == task.ContainerCode, x => new Container()
|
||||||
|
// {
|
||||||
|
// IsLock = ContainerLockEnum.任务锁,
|
||||||
|
// UpdateTime = DateTime.Now
|
||||||
|
// });
|
||||||
|
container.IsLock = ContainerLockEnum.任务锁;
|
||||||
|
container.UpdateTime = DateTime.Now;
|
||||||
|
_unitWork.Update(container);
|
||||||
|
|
||||||
|
// 更新库位
|
||||||
|
location.Status = LocationStatusEnum.锁定;
|
||||||
|
location.UpdateTime = DateTime.Now;
|
||||||
|
_unitWork.Update(location);
|
||||||
|
|
||||||
|
return FFResult().CloseDialog().Message("出库任务创建成功").RefreshGrid();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// WCS任务下发失败
|
||||||
|
return FFResult().CloseDialog().Message(wcsResult?.Msg ?? "WCS任务下发失败").RefreshGrid();
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
// 校验库存
|
catch (Exception ex)
|
||||||
var inv = _unitWork.FindSingle<Inventory>(x => x.ID == id);
|
|
||||||
if (inv == null)
|
|
||||||
{
|
{
|
||||||
return FFResult().CloseDialog().Alert("所选库存不存在,请检查后重试!").RefreshGrid();
|
return FFResult().CloseDialog().Alert(ex.Message).RefreshGrid();
|
||||||
}
|
}
|
||||||
if (inv.TaskStatus == InventoryTaskStatusEnum.Locked)
|
|
||||||
{
|
|
||||||
return FFResult().CloseDialog().Alert("所选库存已被锁定!,请检查后重试!").RefreshGrid();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 校验容器
|
|
||||||
var container = _unitWork.FindSingle<Container>(x => x.Code == inv.ContainerCode);
|
|
||||||
if (container == null)
|
|
||||||
{
|
|
||||||
return FFResult().CloseDialog().Alert("所选库存的容器不存在,请检查后重试!").RefreshGrid();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (container.IsLock == ContainerLockEnum.任务锁)
|
|
||||||
{
|
|
||||||
return FFResult().CloseDialog().Alert("库存所在容器已被锁定!,请检查后重试!").RefreshGrid();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 校验库位
|
|
||||||
var location = _unitWork.FindSingle<Location>(x => x.Code == inv.LocationCode);
|
|
||||||
if (location == null)
|
|
||||||
{
|
|
||||||
return FFResult().CloseDialog().Alert("所选库存不在库内,请检查后重试!").RefreshGrid();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (location.Status == LocationStatusEnum.锁定)
|
|
||||||
{
|
|
||||||
return FFResult().CloseDialog().Alert("库存所在仓位已被锁定!,请检查后重试!").RefreshGrid();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建任务
|
|
||||||
var task = new TaskHeader()
|
|
||||||
{
|
|
||||||
TaskNo = _unitWork.GetSerialNumber("Out", 6),
|
|
||||||
ZoneId = inv.ZoneId,
|
|
||||||
TaskType = TaskTypeEnum.出库,
|
|
||||||
FromLocation = inv.LocationCode,
|
|
||||||
ToLocation = vm.OutPort,
|
|
||||||
ContainerCode = inv.ContainerCode,
|
|
||||||
RoadWay = 2,
|
|
||||||
Status = TaskStatusEnum.新建,
|
|
||||||
CreateBy = Wtm.LoginUserInfo.ITCode,
|
|
||||||
CreateTime = DateTime.Now
|
|
||||||
};
|
|
||||||
|
|
||||||
var locationVm = Wtm.CreateVM<LocationVM>();
|
|
||||||
var result = locationVm.SendWcsTask(task);
|
|
||||||
if (result.Status)
|
|
||||||
{
|
|
||||||
// 更新库存
|
|
||||||
inv.TaskStatus = InventoryTaskStatusEnum.Locked;
|
|
||||||
inv.UpdateTime = DateTime.Now;
|
|
||||||
_unitWork.Update(inv);
|
|
||||||
|
|
||||||
// 更新容器
|
|
||||||
container.IsLock = ContainerLockEnum.任务锁;
|
|
||||||
container.UpdateTime = DateTime.Now;
|
|
||||||
_unitWork.Update(container);
|
|
||||||
|
|
||||||
// 更新库位
|
|
||||||
location.Status = LocationStatusEnum.锁定;
|
|
||||||
location.UpdateTime = DateTime.Now;
|
|
||||||
_unitWork.Update(location);
|
|
||||||
return FFResult().CloseDialog().Message("出库任务创建成功").RefreshGrid();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return FFResult().CloseDialog().Message(result.Message?? "WCS任务下发失败").RefreshGrid();
|
|
||||||
}
|
|
||||||
// 6. 调用WCS接口下发任务
|
|
||||||
|
|
||||||
/*
|
|
||||||
var wcsTaskModel = new WCSTaskModel
|
|
||||||
{
|
|
||||||
TaskNo = task.TaskNo,
|
|
||||||
PalletNo = task.ContainerCode,
|
|
||||||
FromLocation = task.FromLocation, // 入库任务起始位置为空
|
|
||||||
ToLocation = task.ToLocation,
|
|
||||||
};
|
|
||||||
|
|
||||||
//调用WCS任务下发接口
|
|
||||||
var wcsResult = Wtm.CallAPI<WCSTaskResponse>("WCSCP", "TaskAssign", HttpMethodEnum.POST, wcsTaskModel).Result.Data;
|
|
||||||
|
|
||||||
if (wcsResult != null && wcsResult.Success)
|
|
||||||
{
|
|
||||||
// WCS任务下发成功
|
|
||||||
task.Status = TaskStatusEnum.已下发;
|
|
||||||
_unitWork.Add(task);
|
|
||||||
|
|
||||||
// 更新库存
|
|
||||||
inv.TaskStatus = InventoryTaskStatusEnum.Locked;
|
|
||||||
inv.UpdateTime = DateTime.Now;
|
|
||||||
_unitWork.Update(inv);
|
|
||||||
|
|
||||||
// 更新容器
|
|
||||||
// _unitWork.BatchUpdate<Container>(x => x.Code == task.ContainerCode, x => new Container()
|
|
||||||
// {
|
|
||||||
// IsLock = ContainerLockEnum.任务锁,
|
|
||||||
// UpdateTime = DateTime.Now
|
|
||||||
// });
|
|
||||||
container.IsLock = ContainerLockEnum.任务锁;
|
|
||||||
container.UpdateTime = DateTime.Now;
|
|
||||||
_unitWork.Update(container);
|
|
||||||
|
|
||||||
// 更新库位
|
|
||||||
location.Status = LocationStatusEnum.锁定;
|
|
||||||
location.UpdateTime = DateTime.Now;
|
|
||||||
_unitWork.Update(location);
|
|
||||||
|
|
||||||
return FFResult().CloseDialog().Message("出库任务创建成功").RefreshGrid();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// WCS任务下发失败
|
|
||||||
return FFResult().CloseDialog().Message(wcsResult?.Msg ?? "WCS任务下发失败").RefreshGrid();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ namespace HHWMS.Web
|
|||||||
.CheckContain(Searcher.SourceCode, x=>x.SourceCode)
|
.CheckContain(Searcher.SourceCode, x=>x.SourceCode)
|
||||||
.CheckContain(Searcher.CompanyCode, x=>x.CompanyCode)
|
.CheckContain(Searcher.CompanyCode, x=>x.CompanyCode)
|
||||||
.CheckContain(Searcher.Batch, x=>x.Batch)
|
.CheckContain(Searcher.Batch, x=>x.Batch)
|
||||||
|
.CheckContain(Searcher.Lot, x=>x.Lot)
|
||||||
.CheckContain(Searcher.Status, x=>x.Status)
|
.CheckContain(Searcher.Status, x=>x.Status)
|
||||||
.CheckEqual(Searcher.TaskStatus, x=>x.TaskStatus)
|
.CheckEqual(Searcher.TaskStatus, x=>x.TaskStatus)
|
||||||
.DPWhere(Wtm,x => x.ZoneId)
|
.DPWhere(Wtm,x => x.ZoneId)
|
||||||
|
|||||||
@@ -156,6 +156,12 @@ namespace HHWMS.Web.Controllers
|
|||||||
{
|
{
|
||||||
return Json(new { Code = 500, Msg = "容器不存在" });
|
return Json(new { Code = 500, Msg = "容器不存在" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(container.LocationCode))
|
||||||
|
{
|
||||||
|
return Json(new { Code = 400, Msg = $"{container.Code} 容器状态不正确!已存在任务或者已在库内" });
|
||||||
|
}
|
||||||
|
|
||||||
var materialProcessList = _unitWork.Find<MaterialProcess>(m => m.MaterialCode == material.MaterialCode);
|
var materialProcessList = _unitWork.Find<MaterialProcess>(m => m.MaterialCode == material.MaterialCode);
|
||||||
|
|
||||||
var materialProcess = _unitWork.FindSingle<MaterialProcess>(m => m.ID == model.ProcessId);
|
var materialProcess = _unitWork.FindSingle<MaterialProcess>(m => m.ID == model.ProcessId);
|
||||||
|
|||||||
@@ -222,6 +222,11 @@ namespace HHWMS.Web.Controllers
|
|||||||
return JsonMore(null, 500, $"库内没有编码为 {containerCode} 的容器!");
|
return JsonMore(null, 500, $"库内没有编码为 {containerCode} 的容器!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(container.LocationCode))
|
||||||
|
{
|
||||||
|
return JsonMore(null,500, $"{container.Code} 容器状态不正确!已存在任务或者已在库内" );
|
||||||
|
}
|
||||||
|
|
||||||
// 查询容器的库存
|
// 查询容器的库存
|
||||||
var inventories = _unitWork.Find<Inventory>(x => x.ContainerCode == containerCode).ToList();
|
var inventories = _unitWork.Find<Inventory>(x => x.ContainerCode == containerCode).ToList();
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
<a-form :model="form" :rules="rules" ref="formRef" auto-label-width>
|
<a-form :model="form" :rules="rules" ref="formRef" auto-label-width>
|
||||||
<a-form-item label="托盘码" field="palletCode">
|
<a-form-item label="托盘码" field="palletCode">
|
||||||
<a-input v-model="form.palletCode" ref="palletCodeRef" placeholder="请扫描托盘码"
|
<a-input v-model="form.palletCode" ref="palletCodeRef" placeholder="请扫描托盘码"
|
||||||
|
@@keyup.enter="validateContainer"
|
||||||
@@keyup.enter="validateContainer" />
|
@@blur="validateContainer" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item label="物料码" field="materialCode">
|
<a-form-item label="物料码" field="materialCode">
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
placeholder="扫描托盘号"
|
placeholder="扫描托盘号"
|
||||||
allow-clear
|
allow-clear
|
||||||
@@keyup.enter="validateContainer"
|
@@keyup.enter="validateContainer"
|
||||||
|
@@blur="validateContainer"
|
||||||
ref="containerInput"/>
|
ref="containerInput"/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item field="materialCode" label="物料信息">
|
<a-form-item field="materialCode" label="物料信息">
|
||||||
|
|||||||
Reference in new issue
Block a user