添加工序配置

修改入库页面,任务完成,库存页面等
This commit is contained in:
Mac mini git server 2025-08-31 15:57:46 +08:00
parent c2b039ea47
commit 5a04ca9d59
41 changed files with 1151 additions and 84 deletions

View File

@ -32,8 +32,6 @@ namespace HHWMS.Web
private readonly IMapper _mapper;
private readonly IMemoryCache _cache;
private const int DEBOUNCE_INTERVAL_MS = 1000; // 防抖间隔1秒
private int ContainerWeight = 500;
private int SmallContainerWeight = 50;
public IWCSController(IUnitWork unitWork, IMapper mapper, IMemoryCache cache)
{
@ -95,16 +93,14 @@ namespace HHWMS.Web
public IActionResult FullIn(WcsRequest request)
{
var task = _unitWork.FindSingle<TaskHeader>(x => x.TaskNo == request.TaskNo
&& x.Status != TaskStatusEnum.完成);
&& x.Status != TaskStatusEnum.完成
&& x.TaskType != TaskTypeEnum.出库);
if (task == null)
{
return ApiResultError(msg: "未找到任务!");
}
//查找新仓位
var locationVm = Wtm.CreateVM<LocationVM>();
// 更新旧仓位
var oldLoc = _unitWork.FindSingle<Location>(x => x.Code == task.ToLocation);
oldLoc.ContainerCode = "FullIn";
@ -112,7 +108,31 @@ namespace HHWMS.Web
oldLoc.UpdateTime = DateTime.Now;
_unitWork.Update(oldLoc);
return ApiResult();
//查找新仓位
var locationVm = Wtm.CreateVM<LocationVM>();
var res = locationVm.GetMoveLocation(oldLoc);
if (res.Status)
{
string code = res.Data.LocationCode;
var newLoc = _unitWork.FindSingle<Location>(x => x.Code == code);
newLoc.ContainerCode = task.ContainerCode;
newLoc.Status = oldLoc.Status;
newLoc.ContainerStatus = oldLoc.ContainerStatus;
newLoc.Status = LocationStatusEnum.锁定;
newLoc.UpdateTime = DateTime.Now;
_unitWork.Update(newLoc);
task.ToLocation = newLoc.Code;
task.UpdateBy = "FullIn";
task.UpdateTime = DateTime.Now;
_unitWork.Update(task);
return ApiResult(new { LocationCode = res.Data.LocationCode });
}
else
{
return ApiResultError(msg:res.Message);
}
}
@ -129,10 +149,101 @@ namespace HHWMS.Web
{
return ApiResultError(msg: "未找到任务!");
}
//1. 更新容器
var container = _unitWork.FindSingle<Container>(x => x.Code == task.ContainerCode);
container.UpdateBy = "EmptyOut";
container.UpdateTime = DateTime.Now;
_unitWork.Update(container);
//2. 更新库位
var location = _unitWork.FindSingle<Location>(x => x.Code == task.FromLocation);
location.UpdateBy = "EmptyOut";
location.UpdateTime = DateTime.Now;
location.ContainerStatus = LocationStatus.空仓位;
_unitWork.Update(location);
//3. 更新任务
task.UpdateBy = "EmptyOut";
task.UpdateTime = DateTime.Now;
task.ErrorMsg = "空出";
var taskHistory = _mapper.Map<TaskHeaderHistory>(task);
_unitWork.Add(taskHistory);
_unitWork.Delete(task);
//4. 更新库存
_unitWork.BatchUpdate<Inventory>(x => x.ContainerCode == task.ContainerCode,x => new Inventory()
{
LocationCode = "空出",
UpdateBy = "EmptyOut",
UpdateTime = DateTime.Now
});
return ApiResult();
}
/// <summary>
/// 取货错处理
/// </summary>
[HttpPost]
public IActionResult PickError(WcsRequest request)
{
var task = _unitWork.FindSingle<TaskHeader>(x => x.TaskNo == request.TaskNo
&& x.Status != TaskStatusEnum.完成);
if (task == null)
{
return ApiResultError(msg: "未找到任务!");
}
var outLoc = _unitWork.FindSingle<Location>(x => x.Code == task.FromLocation);
var outTask = _unitWork.FindSingle<TaskHeader>(x => x.FromLocation == outLoc.ContiguousCode);
if (outTask != null)
{
return ApiResultError(msg: $"外侧仓位 {outLoc.Code} 已有出库任务!");
}
// 生成外侧仓位的移库任务
var locationVm = Wtm.CreateVM<LocationVM>();
var moveLocRes = locationVm.GetMoveLocation(outLoc);
if (moveLocRes.Status)
{
var taskHeader = new TaskHeader()
{
ZoneId = task.ZoneId,
TaskNo = _unitWork.GetSerialNumber("Move"),
TaskType = TaskTypeEnum.移库,
ContainerCode = outLoc.ContainerCode,
RoadWay = 2,
FromLocation = outLoc.Code,
ToLocation = moveLocRes.Data.LocationCode,
Status = TaskStatusEnum.新建,
CreateBy = "PickError",
CreateTime = DateTime.Now,
};
var sendTaskRes = locationVm.SendWcsTask(taskHeader);
if (sendTaskRes.Status)
{
string code = sendTaskRes.Data.LocationCode;
var moveLoc = _unitWork.FindSingle<Location>(x => x.Code == code);
moveLoc.Status = LocationStatusEnum.锁定;
moveLoc.UpdateBy = "PickError";
moveLoc.UpdateTime = DateTime.Now;
_unitWork.Update(moveLoc);
}
else
{
return ApiResultError(msg: sendTaskRes.Message);
}
}
else
{
return ApiResultError(msg: moveLocRes.Message);
}
return ApiResult();
}
/// <summary>
/// 状态返回(带防抖)
/// </summary>
@ -269,9 +380,15 @@ namespace HHWMS.Web
{
if (task.TaskType == TaskTypeEnum.入库)
{
var containerconfig = _unitWork.Find<SysDictData>(x => x.DictType == "ContainerConfig")
.ToList();
int ContainerWeight = int.Parse(containerconfig.FirstOrDefault(x => x.DictLabelUs.ToLower() == "container")?.DictValue);
int SmallContainerWeight = int.Parse(containerconfig.FirstOrDefault(x => x.ID == inventory.Flag)?.DictValue);
var material =
_unitWork.FindSingle<Material>(x => x.MaterialCode == inventory.MaterialCode);
inventory.Qty = (request.Weight - ContainerWeight - inventory.TaskQty * SmallContainerWeight) / (material.Qty ?? 5);
inventory.Qty = (request.Weight * 100 - ContainerWeight - inventory.TaskQty * SmallContainerWeight) / (material.Qty ?? 1);
inventory.Qty = inventory.Qty > 0 ? inventory.Qty : 0;
}
if (task.TaskType != TaskTypeEnum.移库)
@ -333,8 +450,16 @@ namespace HHWMS.Web
{
_unitWork.BatchAdd(invTrans);
}
_unitWork.BatchUpdate(inventories);
if (task.TaskType == TaskTypeEnum.出库 && task.ZoneId == 1027)
{
// 线边库出库删掉库存
_unitWork.BatchDelete(inventories);
}
else
{
_unitWork.BatchUpdate(inventories);
}
// 更新容器状态
var container = _unitWork.FindSingle<Container>(x => x.Code == task.ContainerCode);

View File

@ -249,6 +249,13 @@ namespace HHWMS.Web.Controllers
return PartialView(vm);
}
[HttpPost]
[ActionDescription("Sys.Print")]
public ActionResult Print(ContainerVM vm)
{
return Ok();
}
[HttpPost]
[ActionDescription("Container.AddContainer")]
public ActionResult AddContainer(ContainerVM vm)
@ -265,8 +272,10 @@ namespace HHWMS.Web.Controllers
vm.MSD.AddModelError(vm.Entity.BatchError, "数量和类型必填,且数量要大于0!");
return PartialView(vm);
}
var maxContainer = _unitwork.Find<Container>(x => x.Type == vm.Entity.Type).ToList().MaxBy(x => x.Code);
int maxNum = 1;
var zoneid = _unitwork.FindSingle<LocationZone>(x => x.ZoneCode == vm.Entity.Type).ID;
var maxContainer = _unitwork.Find<Container>(x => x.Type == vm.Entity.Type).ToList().MaxBy(x => x.ID);
int maxNum = 0;
if (maxContainer != null)
int.TryParse(maxContainer?.Code.Substring(1, 4), out maxNum);
// 查询已有的最大托盘值 在此基础上累加
@ -281,7 +290,8 @@ namespace HHWMS.Web.Controllers
Status = ContainerStatus.空,
Length = vm.Entity.Length,
Width = vm.Entity.Width,
Height = vm.Entity.Height
Height = vm.Entity.Height,
ZoneId = zoneid
});
}
_unitwork.BatchAdd<Container>(containerList.ToArray());

View File

@ -1,10 +1,12 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Linq;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Mvc;
using WalkingTec.Mvvm.Core.Extensions;
using HHWMS.Web;
using HHWMS.Web.Models;
namespace HHWMS.Web.Controllers
{
@ -63,6 +65,15 @@ namespace HHWMS.Web.Controllers
}
else
{
if (DC.Set<Material>().Any(x => x.MaterialCode == vm.Entity.MaterialCode))
{
return FFResult().Alert($"已存在 物料编码 为{vm.Entity.MaterialCode}的数据");
}
if (DC.Set<Material>().Any(x => x.MaterialType == vm.Entity.MaterialType))
{
return FFResult().Alert($"已存在 图号 为{vm.Entity.MaterialType}的数据");
}
vm.DoAdd();
if (!ModelState.IsValid)
{

View File

@ -1,10 +1,12 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Linq;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Mvc;
using WalkingTec.Mvvm.Core.Extensions;
using HHWMS.Web;
using HHWMS.Web.Models;
namespace HHWMS.Web.Controllers
{
@ -63,6 +65,20 @@ namespace HHWMS.Web.Controllers
}
else
{
if (!DC.Set<Material>().Any(x => x.MaterialCode == vm.Entity.MaterialCode))
{
return FFResult().Alert($"物料编码 为{vm.Entity.MaterialCode}的物料基础数据不存在!请先添加物料基础数据!");
}
if (DC.Set<MaterialProcess>().Any(x => x.MaterialCode == vm.Entity.MaterialCode
&& x.ProcessOrder == vm.Entity.ProcessOrder))
{
return FFResult().Alert($"已存在 工序顺序 为{vm.Entity.ProcessOrder}的数据!");
}
if (DC.Set<MaterialProcess>().Any(x => x.MaterialCode == vm.Entity.MaterialCode
&& x.ProcessCode == vm.Entity.ProcessCode))
{
return FFResult().Alert($"已存在 工序编码 为{vm.Entity.ProcessCode}的数据!");
}
vm.DoAdd();
if (!ModelState.IsValid)
{

View File

@ -0,0 +1,238 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Linq;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Mvc;
using WalkingTec.Mvvm.Core.Extensions;
using HHWMS.Web;
using HHWMS.Web.Models;
namespace HHWMS.Web.Controllers
{
[Area("configs")]
[ActionDescription("工序配置")]
public partial class ProcessConfigController : BaseController
{
private readonly IUnitWork _unitWork;
public ProcessConfigController(IUnitWork unitWork)
{
_unitWork = unitWork;
}
#region Search
[ActionDescription("Sys.Search")]
public ActionResult Index()
{
var vm = Wtm.CreateVM<ProcessConfigListVM>();
return PartialView(vm);
}
[ActionDescription("Sys.Search")]
[HttpPost]
public string Search(ProcessConfigSearcher searcher)
{
var vm = Wtm.CreateVM<ProcessConfigListVM>(passInit: true);
if (ModelState.IsValid)
{
vm.Searcher = searcher;
return vm.GetJson(false);
}
else
{
return vm.GetError();
}
}
#endregion
#region Create
[ActionDescription("Sys.Create")]
public ActionResult Create()
{
var vm = Wtm.CreateVM<ProcessConfigVM>();
return PartialView(vm);
}
[HttpPost]
[ActionDescription("Sys.Create")]
public ActionResult Create(ProcessConfigVM vm)
{
if (!ModelState.IsValid)
{
return PartialView(vm);
}
else
{
if (DC.Set<ProcessConfig>().Any(x => x.Code == vm.Entity.Code))
{
return FFResult().Alert($"已存在 工序编码 为{vm.Entity.Code}的数据");
}
if (DC.Set<ProcessConfig>().Any(x => x.Name == vm.Entity.Name))
{
return FFResult().Alert($"已存在 工序名称 为{vm.Entity.Name}的数据");
}
vm.DoAdd();
if (!ModelState.IsValid)
{
vm.DoReInit();
return PartialView(vm);
}
else
{
return FFResult().CloseDialog().RefreshGrid();
}
}
}
#endregion
#region Edit
[ActionDescription("Sys.Edit")]
public ActionResult Edit(string id)
{
var vm = Wtm.CreateVM<ProcessConfigVM>(id);
return PartialView(vm);
}
[ActionDescription("Sys.Edit")]
[HttpPost]
[ValidateFormItemOnly]
public ActionResult Edit(ProcessConfigVM vm)
{
if (!ModelState.IsValid)
{
return PartialView(vm);
}
else
{
vm.DoEdit();
if (!ModelState.IsValid)
{
vm.DoReInit();
return PartialView(vm);
}
else
{
return FFResult().CloseDialog().RefreshGridRow(vm.Entity.ID);
}
}
}
#endregion
#region Delete
[ActionDescription("Sys.Delete")]
public ActionResult Delete(string id)
{
var vm = Wtm.CreateVM<ProcessConfigVM>(id);
return PartialView(vm);
}
[ActionDescription("Sys.Delete")]
[HttpPost]
public ActionResult Delete(string id, IFormCollection nouse)
{
var vm = Wtm.CreateVM<ProcessConfigVM>(id);
vm.DoDelete();
if (!ModelState.IsValid)
{
return PartialView(vm);
}
else
{
return FFResult().CloseDialog().RefreshGrid();
}
}
#endregion
#region Details
[ActionDescription("Sys.Details")]
public ActionResult Details(string id)
{
var vm = Wtm.CreateVM<ProcessConfigVM>(id);
return PartialView(vm);
}
#endregion
#region BatchEdit
[HttpPost]
[ActionDescription("Sys.BatchEdit")]
public ActionResult BatchEdit(string[] IDs)
{
var vm = Wtm.CreateVM<ProcessConfigBatchVM>(Ids: IDs);
return PartialView(vm);
}
[HttpPost]
[ActionDescription("Sys.BatchEdit")]
public ActionResult DoBatchEdit(ProcessConfigBatchVM vm, IFormCollection nouse)
{
if (!ModelState.IsValid || !vm.DoBatchEdit())
{
return PartialView("BatchEdit",vm);
}
else
{
return FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.BatchEditSuccess", vm.Ids.Length]);
}
}
#endregion
#region BatchDelete
[HttpPost]
[ActionDescription("Sys.BatchDelete")]
public ActionResult BatchDelete(string[] IDs)
{
var vm = Wtm.CreateVM<ProcessConfigBatchVM>(Ids: IDs);
return PartialView(vm);
}
[HttpPost]
[ActionDescription("Sys.BatchDelete")]
public ActionResult DoBatchDelete(ProcessConfigBatchVM vm, IFormCollection nouse)
{
if (!ModelState.IsValid || !vm.DoBatchDelete())
{
return PartialView("BatchDelete",vm);
}
else
{
return FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.BatchDeleteSuccess", vm.Ids.Length]);
}
}
#endregion
#region Import
[ActionDescription("Sys.Import")]
public ActionResult Import()
{
var vm = Wtm.CreateVM<ProcessConfigImportVM>();
return PartialView(vm);
}
[HttpPost]
[ActionDescription("Sys.Import")]
public ActionResult Import(ProcessConfigImportVM vm, IFormCollection nouse)
{
if (vm.ErrorListVM.EntityList.Count > 0 || !vm.BatchSaveData())
{
return PartialView(vm);
}
else
{
return FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.ImportSuccess", vm.EntityList.Count.ToString()]);
}
}
#endregion
#region Export
[ActionDescription("Sys.Export")]
[HttpPost]
public IActionResult ExportExcel(ProcessConfigListVM vm)
{
return vm.GetExportData();
}
#endregion
}
}

View File

@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using HHWMS.Web.Models;
using WalkingTec.Mvvm.Core;
@ -40,6 +42,7 @@ namespace HHWMS.Web
{
InitVM();
return new List<GridColumn<Container_View>>{
this.MakeGridHeader(x => x.Name_view).SetWidth(80),
this.MakeGridHeader(x => x.Code),
this.MakeGridHeader(x => x.Type)
.SetFormat((a, b) =>
@ -65,6 +68,7 @@ namespace HHWMS.Web
public override IOrderedQueryable<Container_View> GetSearchQuery()
{
var query = DC.Set<Container>()
.CheckEqual(Searcher.ZoneId, x=>x.ZoneId)
.CheckContain(Searcher.Code, x => x.Code)
.CheckContain(Searcher.Type, x => x.Type)
.CheckEqual(Searcher.IsLock, x => x.IsLock)
@ -73,8 +77,10 @@ namespace HHWMS.Web
.CheckEqual(Searcher.Length, x => x.Length)
.CheckEqual(Searcher.Width, x => x.Width)
.CheckEqual(Searcher.Height, x => x.Height)
.DPWhere(Wtm,x => x.ZoneId)
.Select(x => new Container_View
{
Name_view = x.Zone.Name,
ID = x.ID,
Code = x.Code,
Type = x.Type,
@ -92,5 +98,7 @@ namespace HHWMS.Web
public class Container_View : Container
{
[Display(Name = "Location.ZoneName")]
public String Name_view { get; set; }
}
}

View File

@ -1,12 +1,18 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using HHWMS.Web.Models;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
namespace HHWMS.Web
{
public partial class ContainerSearcher : BaseSearcher
{
public List<ComboSelectListItem> AllZones { get; set; }
[Display(Name = "Location.ZoneCode")]
public int? ZoneId { get; set; }
[Display(Name = "Container.Code")]
public String Code { get; set; }
@ -33,6 +39,7 @@ namespace HHWMS.Web
protected override void InitVM()
{
AllZones = DC.Set<LocationZone>().GetSelectListItems(Wtm, y => y.Name);
}
}
}

View File

@ -65,6 +65,7 @@ namespace HHWMS.Web
.CheckEqual(Searcher.RowFlag, x=>x.RowFlag)
.CheckContain(Searcher.ContainerCode, x=>x.ContainerCode)
.CheckEqual(Searcher.IsStop, x=>x.IsStop)
.DPWhere(Wtm,x => x.ZoneId)
.Select(x => new Location_View
{
ID = x.ID,

View File

@ -461,6 +461,10 @@ namespace HHWMS.Web
return moveloc;
}
}
else if (outter != null && outter.Status == LocationStatusEnum.锁定)
{
return ResponseResult<dynamic>.Error("外侧仓位已被锁定!请稍后再尝试!");
}
}
}
@ -532,7 +536,7 @@ namespace HHWMS.Web
&& l.ContainerStatus == LocationStatus.空仓位
&& locationPairs.TryGetValue(l.ContiguousCode, out var outer)
&& outer.ContainerStatus == LocationStatus.空仓位)
.OrderBy(l => l.Height)
.OrderBy(l => Math.Abs((decimal)outter.Height - (decimal)l.Height))
.ThenBy(l => Math.Abs(outter.RoadWay - l.RoadWay))
.ThenBy(l => Math.Abs(outter.Line - l.Line))
.ThenBy(l => l.Layer)

View File

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using HHWMS.Web.Models;
namespace HHWMS.Web
{
public partial class ProcessConfigBatchVM : BaseBatchVM<ProcessConfig, ProcessConfig_BatchEdit>
{
public ProcessConfigBatchVM()
{
ListVM = new ProcessConfigListVM();
LinkedVM = new ProcessConfig_BatchEdit();
}
}
/// <summary>
/// Class to define batch edit fields
/// </summary>
public class ProcessConfig_BatchEdit : BaseVM
{
protected override void InitVM()
{
}
}
}

View File

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using HHWMS.Web.Models;
namespace HHWMS.Web
{
public partial class ProcessConfigTemplateVM : BaseTemplateVM
{
[Display(Name = "Process.Code")]
public ExcelPropety Code_Excel = ExcelPropety.CreateProperty<ProcessConfig>(x => x.Code);
[Display(Name = "Process.Name")]
public ExcelPropety Name_Excel = ExcelPropety.CreateProperty<ProcessConfig>(x => x.Name);
[Display(Name = "Process.Zone")]
public ExcelPropety Zone_Excel = ExcelPropety.CreateProperty<ProcessConfig>(x => x.Zone);
[Display(Name = "Process.Port")]
public ExcelPropety Port_Excel = ExcelPropety.CreateProperty<ProcessConfig>(x => x.Port);
[Display(Name = "Sys.spare")]
public ExcelPropety Spare1_Excel = ExcelPropety.CreateProperty<ProcessConfig>(x => x.Spare1);
[Display(Name = "Sys.spare")]
public ExcelPropety Spare2_Excel = ExcelPropety.CreateProperty<ProcessConfig>(x => x.Spare2);
[Display(Name = "Sys.spare")]
public ExcelPropety Spare3_Excel = ExcelPropety.CreateProperty<ProcessConfig>(x => x.Spare3);
protected override void InitVM()
{
}
}
public class ProcessConfigImportVM : BaseImportVM<ProcessConfigTemplateVM, ProcessConfig>
{
}
}

View File

@ -0,0 +1,97 @@
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 ProcessConfigListVM : BasePagedListVM<ProcessConfig_View, ProcessConfigSearcher>
{
public List<ComboSelectListItem> AllZones { get; set; }
public List<ComboSelectListItem> AllOutPorts { get; set; }
protected override void InitVM()
{
var vm = Wtm.CreateVM<ProcessConfigVM>();
AllZones = vm.AllZones;
AllOutPorts = vm.AllOutPorts;
}
protected override List<GridAction> InitGridAction()
{
return new List<GridAction>
{
this.MakeStandardAction("ProcessConfig", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"configs", dialogWidth: 800),
this.MakeStandardAction("ProcessConfig", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "configs", dialogWidth: 800),
this.MakeStandardAction("ProcessConfig", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "configs", dialogWidth: 800),
this.MakeStandardAction("ProcessConfig", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "configs", dialogWidth: 800),
this.MakeStandardAction("ProcessConfig", GridActionStandardTypesEnum.BatchEdit, Localizer["Sys.BatchEdit"], "configs", dialogWidth: 800),
this.MakeStandardAction("ProcessConfig", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "configs", dialogWidth: 800),
this.MakeStandardAction("ProcessConfig", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "configs", dialogWidth: 800),
this.MakeStandardAction("ProcessConfig", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "configs"),
};
}
protected override IEnumerable<IGridColumn<ProcessConfig_View>> InitGridHeader()
{
InitVM();
return new List<GridColumn<ProcessConfig_View>>{
this.MakeGridHeader(x => x.Code),
this.MakeGridHeader(x => x.Name),
this.MakeGridHeader(x => x.Zone)
.SetFormat((a, b) =>
{
var data = AllZones.FirstOrDefault(x => x.Value.ToString() == a.Zone);
return data?.Text ?? a.Zone;
}),
this.MakeGridHeader(x => x.Port)
.SetFormat((a, b) =>
{
var data = AllOutPorts.FirstOrDefault(x => x.Value.ToString() == a.Port);
return data?.Text ?? a.Port;
}),
this.MakeGridHeader(x => x.Spare1).SetHide(),
this.MakeGridHeader(x => x.Spare2).SetHide(),
this.MakeGridHeader(x => x.Spare3).SetHide(),
this.MakeGridHeaderAction(width: 200)
};
}
public override IOrderedQueryable<ProcessConfig_View> GetSearchQuery()
{
var query = DC.Set<ProcessConfig>()
.CheckContain(Searcher.Code, x=>x.Code)
.CheckContain(Searcher.Name, x=>x.Name)
.CheckContain(Searcher.Zone, x=>x.Zone)
.CheckContain(Searcher.Port, x=>x.Port)
.CheckContain(Searcher.Spare1, x=>x.Spare1)
.CheckContain(Searcher.Spare2, x=>x.Spare2)
.CheckContain(Searcher.Spare3, x=>x.Spare3)
.Select(x => new ProcessConfig_View
{
ID = x.ID,
Code = x.Code,
Name = x.Name,
Zone = x.Zone,
Port = x.Port,
Spare1 = x.Spare1,
Spare2 = x.Spare2,
Spare3 = x.Spare3,
})
.OrderBy(x => x.ID);
return query;
}
}
public class ProcessConfig_View : ProcessConfig{
}
}

View File

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using HHWMS.Web.Models;
namespace HHWMS.Web
{
public partial class ProcessConfigSearcher : BaseSearcher
{
[Display(Name = "Process.Code")]
public String Code { get; set; }
[Display(Name = "Process.Name")]
public String Name { get; set; }
[Display(Name = "Process.Zone")]
public String Zone { get; set; }
[Display(Name = "Process.Port")]
public String Port { get; set; }
[Display(Name = "Sys.Spare")]
public String Spare1 { get; set; }
[Display(Name = "Sys.Spare")]
public String Spare2 { get; set; }
[Display(Name = "Sys.Spare")]
public String Spare3 { get; set; }
protected override void InitVM()
{
}
}
}

View File

@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using HHWMS.Web.Models;
namespace HHWMS.Web
{
public partial class ProcessConfigVM : BaseCRUDVM<ProcessConfig>
{
public List<ComboSelectListItem> AllZones { get; set; }
public List<ComboSelectListItem> AllOutPorts { get; set; }
public ProcessConfigVM()
{
}
protected override void InitVM()
{
var vm = Wtm.CreateVM<InventoryVM>();
AllZones = new List<ComboSelectListItem>
{
new ComboSelectListItem { Text = "区域1", Value = "Zone1" },
new ComboSelectListItem { Text = "区域2", Value = "Zone2" },
new ComboSelectListItem { Text = "区域3", Value = "Zone3" },
};
AllOutPorts = vm.AllOutPorts;
}
public override void DoAdd()
{
base.DoAdd();
}
public override void DoEdit(bool updateAllFields = false)
{
base.DoEdit(updateAllFields);
}
public override void DoDelete()
{
base.DoDelete();
}
}
}

View File

@ -3,6 +3,7 @@
<wt:searchpanel vm="@Model" reset-btn="true">
<wt:row items-per-row="ItemsPerRowEnum.Three">
<wt:combobox field="Searcher.ZoneId" items="Searcher.AllZones" empty-text="@Localizer["Sys.All"]" />
<wt:textbox field="Searcher.Code"/>
<wt:combobox field="Searcher.Type" items="ContainerType"/>
<wt:combobox field="Searcher.IsLock"/>
@ -22,7 +23,6 @@
let printData = [];
function print(ids, datas) {
console.log(datas)
datas.forEach(function (value, index, arr) {
printData.push({code: value.Code})
});

View File

@ -3,8 +3,8 @@
<wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:textbox field="Entity.MaterialCode" />
<wt:textbox field="Entity.MaterialType" />
<wt:textbox field="Entity.MaterialCode" disabled/>
<wt:textbox field="Entity.MaterialType" disabled/>
<wt:textbox field="Entity.MaterialName" />
<wt:textbox field="Entity.MaterialSpec" />
<wt:textbox field="Entity.MaterialUnit" />

View File

@ -3,7 +3,7 @@
<wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:textbox field="Entity.MaterialCode" />
<wt:textbox field="Entity.MaterialCode" disabled/>
<wt:textbox field="Entity.ProcessOrder" />
<wt:textbox field="Entity.ProcessName" />
<wt:textbox field="Entity.ProcessCode" />

View File

@ -0,0 +1,12 @@
@model HHWMS.Web.ProcessConfigBatchVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:quote>@Localizer["Sys.BatchDeleteConfirm"]</wt:quote>
<wt:hidden field="Ids" />
<wt:grid vm="ListVM" use-local-data="true" height="300" hidden-checkbox="true" hidden-panel="true"/>
<wt:row align="AlignEnum.Right">
<wt:submitbutton theme=" ButtonThemeEnum.Warm" text="@Localizer["Sys.Delete"]"/>
<wt:closebutton />
</wt:row>
</wt:form>

View File

@ -0,0 +1,14 @@
@model HHWMS.Web.ProcessConfigBatchVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<div style="margin-bottom:10px">@Localizer["Sys.BatchEditConfirm"] </div>
<wt:row items-per-row="ItemsPerRowEnum.Two">
</wt:row>
<wt:hidden field="Ids" />
<wt:grid vm="ListVM" use-local-data="true" height="300" hidden-checkbox="true" hidden-panel="true"/>
<wt:row align="AlignEnum.Right">
<wt:submitbutton />
<wt:closebutton />
</wt:row>
</wt:form>

View File

@ -0,0 +1,18 @@
@model HHWMS.Web.ProcessConfigVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:textbox field="Entity.Code" />
<wt:textbox field="Entity.Name" />
<wt:combobox field="Entity.Zone" items="AllZones"/>
<wt:combobox field="Entity.Port" items="AllOutPorts"/>
<wt:textbox field="Entity.Spare1" />
<wt:textbox field="Entity.Spare2" />
<wt:textbox field="Entity.Spare3" />
</wt:row>
<wt:row align="AlignEnum.Right">
<wt:submitbutton />
<wt:closebutton />
</wt:row>
</wt:form>

View File

@ -0,0 +1,20 @@
@model HHWMS.Web.ProcessConfigVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:quote>@Localizer["Sys.DeleteConfirm"]</wt:quote>
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:display field="Entity.Code" />
<wt:display field="Entity.Name" />
<wt:display field="Entity.Zone" />
<wt:display field="Entity.Port" />
<wt:display field="Entity.Spare1" />
<wt:display field="Entity.Spare2" />
<wt:display field="Entity.Spare3" />
</wt:row>
<wt:hidden field="Entity.ID" />
<wt:row align="AlignEnum.Right">
<wt:submitbutton theme=" ButtonThemeEnum.Warm" text="@Localizer["Sys.Delete"]"/>
<wt:closebutton />
</wt:row>
</wt:form>

View File

@ -0,0 +1,17 @@
@model HHWMS.Web.ProcessConfigVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:display field="Entity.Code" />
<wt:display field="Entity.Name" />
<wt:display field="Entity.Zone" />
<wt:display field="Entity.Port" />
<wt:display field="Entity.Spare1" />
<wt:display field="Entity.Spare2" />
<wt:display field="Entity.Spare3" />
</wt:row>
<wt:row align="AlignEnum.Right">
<wt:closebutton />
</wt:row>
</wt:form>

View File

@ -0,0 +1,19 @@
@model HHWMS.Web.ProcessConfigVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:textbox field="Entity.Code" disabled/>
<wt:textbox field="Entity.Name" disabled/>
<wt:combobox field="Entity.Zone" items="AllZones"/>
<wt:combobox field="Entity.Port" items="AllOutPorts"/>
<wt:textbox field="Entity.Spare1" />
<wt:textbox field="Entity.Spare2" />
<wt:textbox field="Entity.Spare3" />
</wt:row>
<wt:hidden field="Entity.ID" />
<wt:row align="AlignEnum.Right">
<wt:submitbutton />
<wt:closebutton />
</wt:row>
</wt:form>

View File

@ -0,0 +1,14 @@
@model HHWMS.Web.ProcessConfigImportVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:row align="AlignEnum.Right">
<wt:downloadTemplateButton vm="@Model" />
</wt:row>
<wt:upload field="UploadFileId" label-text="@Model.Localizer["Sys.UploadTemplate"]" upload-type="ExcelFile" />
<wt:grid vm="ErrorListVM" use-local-data="true" hidden-checkbox="true" hidden-grid-index="true" hidden-panel="true" height="300"/>
<wt:row align="AlignEnum.Right">
<wt:submitbutton />
<wt:closebutton />
</wt:row>
</wt:form>

View File

@ -0,0 +1,12 @@
@model HHWMS.Web.ProcessConfigListVM
@inject IStringLocalizer<Program> Localizer;
<wt:searchpanel vm="@Model" reset-btn="true">
<wt:row items-per-row="ItemsPerRowEnum.Three">
<wt:textbox field="Searcher.Code" />
<wt:textbox field="Searcher.Name" />
<wt:combobox field="Searcher.Zone" items="AllZones"/>
<wt:combobox field="Searcher.Port" items="AllOutPorts"/>
</wt:row>
</wt:searchpanel>
<wt:grid vm="@Model" url="/configs/ProcessConfig/Search"/>

View File

@ -226,7 +226,7 @@ namespace HHWMS.Web.Controllers
#endregion
#region InvOut 出库
[ActionDescription("TaskType.Out")]
/*[ActionDescription("TaskType.Out")]
public ActionResult InvOut(string id)
{
var vm = Wtm.CreateVM<InventoryVM>(id);
@ -234,54 +234,67 @@ namespace HHWMS.Web.Controllers
{
return FFResult().Alert("所选库存已被锁定!,请检查后重试!").RefreshGrid();
}
return PartialView(vm);
}
[HttpPost]
[ActionDescription("TaskType.Out")]
public ActionResult InvOut(InventoryVM vm)
{
var id = vm.Entity.ID;
// 校验参数
if (string.IsNullOrWhiteSpace(vm.OutPort))
// 判断是否存在出口配置
var processConfig = _unitWork.FindSingle<ProcessConfig>(m =>
m.Name == vm.Entity.Lot);
if (processConfig == null)
{
return FFResult().Alert("出口必选,请选择后重试!");
return FFResult().Alert("所选库存下道工序出口未配置!,请检查后重试!").RefreshGrid();
}
return PartialView(vm);
}*/
[ActionDescription("TaskType.Out")]
public ActionResult InvOut(string id)
{
// var vm = Wtm.CreateVM<InventoryVM>(id);
// 校验参数
// if (string.IsNullOrWhiteSpace(vm.OutPort))
// {
// return FFResult().Alert("出口必选,请选择后重试!");
// }
// 校验库存
var inv = _unitWork.FindSingle<Inventory>(x => x.ID == id);
var inv = _unitWork.FindSingle<Inventory>(x => x.ID == int.Parse(id));
if (inv == null)
{
return FFResult().CloseDialog().Alert("所选库存不存在,请检查后重试!").RefreshGrid();
return FFResult().Alert("所选库存不存在,请检查后重试!").RefreshGrid();
}
if (inv.TaskStatus == InventoryTaskStatusEnum.Locked)
{
return FFResult().CloseDialog().Alert("所选库存已被锁定!,请检查后重试!").RefreshGrid();
return FFResult().Alert("所选库存已被锁定!,请检查后重试!").RefreshGrid();
}
// 校验容器
var container = _unitWork.FindSingle<Container>(x => x.Code == inv.ContainerCode);
if (container == null)
{
return FFResult().CloseDialog().Alert("所选库存的容器不存在,请检查后重试!").RefreshGrid();
return FFResult().Alert("所选库存的容器不存在,请检查后重试!").RefreshGrid();
}
if (container.IsLock == ContainerLockEnum.任务锁)
{
return FFResult().CloseDialog().Alert("库存所在容器已被锁定!,请检查后重试!").RefreshGrid();
return FFResult().Alert("库存所在容器已被锁定!,请检查后重试!").RefreshGrid();
}
// 校验库位
var location = _unitWork.FindSingle<Location>(x => x.Code == inv.LocationCode);
if (location == null)
{
return FFResult().CloseDialog().Alert("所选库存不在库内,请检查后重试!").RefreshGrid();
return FFResult().Alert("所选库存不在库内,请检查后重试!").RefreshGrid();
}
if (location.Status == LocationStatusEnum.锁定)
{
return FFResult().CloseDialog().Alert("库存所在仓位已被锁定!,请检查后重试!").RefreshGrid();
return FFResult().Alert("库存所在仓位已被锁定!,请检查后重试!").RefreshGrid();
}
// 判断是否存在出口配置
var processConfig = _unitWork.FindSingle<ProcessConfig>(m =>
m.Name == inv.Lot);
if (processConfig == null)
{
return FFResult().Alert("所选库存下道工序出口未配置!,请检查后重试!").RefreshGrid();
}
// 创建任务
var task = new TaskHeader()
{
@ -289,7 +302,7 @@ namespace HHWMS.Web.Controllers
ZoneId = inv.ZoneId,
TaskType = TaskTypeEnum.出库,
FromLocation = inv.LocationCode,
ToLocation = vm.OutPort,
ToLocation = processConfig.Port,
ContainerCode = inv.ContainerCode,
RoadWay = 1,
Status = TaskStatusEnum.新建,
@ -335,12 +348,12 @@ namespace HHWMS.Web.Controllers
location.UpdateTime = DateTime.Now;
_unitWork.Update(location);
return FFResult().CloseDialog().Message("出库任务创建成功").RefreshGrid();
return FFResult().Message("出库任务创建成功").RefreshGrid();
}
else
{
// WCS任务下发失败
return FFResult().CloseDialog().Message(wcsResult?.Msg ?? "WCS任务下发失败").RefreshGrid();
return FFResult().Message(wcsResult?.Msg ?? "WCS任务下发失败").RefreshGrid();
}
}
@ -358,6 +371,11 @@ namespace HHWMS.Web.Controllers
return PartialView(vm);
}
/// <summary>
/// 成品出库
/// </summary>
/// <param name="vm"></param>
/// <returns></returns>
[HttpPost]
[ActionDescription("TaskType.Out")]
public ActionResult InvOut2(InventoryVM vm)

View File

@ -26,7 +26,8 @@ namespace HHWMS.Web
this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "inventory", dialogWidth: 800),
this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "inventory"),
this.MakeAction("Inventory","InvOut",Localizer["TaskType.Out"],"",GridActionParameterTypesEnum.SingleId,"inventory")
.SetSize(500,400),
.SetSize(500,400)
.SetShowDialog(false),
this.MakeAction("Inventory","InvOut2",Localizer["TaskType.Out1"],"",GridActionParameterTypesEnum.SingleId,"inventory")
.SetSize(500,400),
};
@ -42,6 +43,16 @@ namespace HHWMS.Web
this.MakeGridHeader(x => x.MaterialCode).SetWidth(90),
this.MakeGridHeader(x => x.MaterialType).SetWidth(100),
this.MakeGridHeader(x => x.SupplierCode).SetWidth(100),
this.MakeGridHeader(x => x.Batch).SetWidth(100),
this.MakeGridHeader(x => x.Lot).SetWidth(100),
this.MakeGridHeader(x => x.TaskStatus).SetWidth(100)
.SetBackGroundFunc((a)=>{
if(a.TaskStatus == InventoryTaskStatusEnum.Locked )
{
return "#FF0000";
}
return "";
}),
this.MakeGridHeader(x => x.MaterialName).SetWidth(100),
this.MakeGridHeader(x => x.CompanyCode).SetWidth(150),
this.MakeGridHeader(x => x.SourceCode).SetWidth(150),
@ -53,21 +64,11 @@ namespace HHWMS.Web
{
return (int?)a.Qty ?? 0;
}),
this.MakeGridHeader(x => x.Batch).SetWidth(100),
this.MakeGridHeader(x => x.Lot).SetHide(),
this.MakeGridHeader(x => x.ManufactureDate).SetHide(),
this.MakeGridHeader(x => x.ExpirationDate).SetHide(),
this.MakeGridHeader(x => x.ReceiptCode).SetHide(),
this.MakeGridHeader(x => x.ReceiptDetailId).SetHide(),
this.MakeGridHeader(x => x.Status).SetWidth(100),
this.MakeGridHeader(x => x.TaskStatus).SetWidth(100)
.SetBackGroundFunc((a)=>{
if(a.TaskStatus == InventoryTaskStatusEnum.Locked )
{
return "#FF0000";
}
return "";
}),
this.MakeGridHeaderAction(width: 200)
};
}

View File

@ -5,7 +5,7 @@
<wt:row items-per-row="ItemsPerRowEnum.One">
<wt:hidden field="Entity.ZoneId" />
<wt:hidden field="Entity.ID" />
<wt:combobox field="OutPort" items="AllOutPorts"/>
<wt:hidden field="OutPort" items="AllOutPorts"/>
</wt:row>
<wt:row align="AlignEnum.Right">
<wt:submitbutton />

View File

@ -24,9 +24,9 @@ namespace HHWMS.Web.Controllers
_unitWork = unitwork;
_materialZones = new Dictionary<string, LineRange>
{
{ "zone1", new LineRange { BeginLine = 1, EndLine = 25 } },
{ "zone2", new LineRange { BeginLine = 26, EndLine = 57 } },
{ "zone3", new LineRange { BeginLine = 58, EndLine = 96 } },
{ "Zone1", new LineRange { BeginLine = 1, EndLine = 25 } },
{ "Zone2", new LineRange { BeginLine = 26, EndLine = 57 } },
{ "Zone3", new LineRange { BeginLine = 58, EndLine = 96 } },
};
}
@ -121,6 +121,21 @@ namespace HHWMS.Web.Controllers
return Json(new { Code = 200, Data = orders });
}
[Public]
[HttpGet]
public IActionResult GetTrayTypes()
{
var containerconfig = _unitWork.Find<SysDictData>(x => x.DictType == "ContainerConfig"
&& x.DictLabelUs.ToLower() != "container")
.Select(x => new
{
value = x.ID,
label = x.DictLabel,
})
.ToList();
return Json(new { Code = 200, Data = containerconfig });
}
[HttpPost]
public IActionResult SubmitReceipt([FromBody] ReceiptInModel model)
{
@ -141,15 +156,28 @@ namespace HHWMS.Web.Controllers
{
return Json(new { Code = 500, Msg = "容器不存在" });
}
var materialProcessList = _unitWork.Find<MaterialProcess>(m => m.MaterialCode == material.MaterialCode);
var materialProcess = _unitWork.FindSingle<MaterialProcess>(m => m.ID == model.ProcessId);
if (materialProcess == null)
{
return Json(new { Code = 500, Msg = "未找到此工序配置" });
return Json(new { Code = 500, Msg = "未找到此物料工序配置" });
}
// 下一道工序
var nextProcess = materialProcessList
// 筛选同一物料
.Where(p => p.MaterialCode == material.MaterialCode)
// 筛选顺序大于当前工序的工序
.Where(p => p.ProcessOrder > materialProcess.ProcessOrder)
// 按工序顺序升序排列(取最小的一个,即下一道)
.OrderBy(p => p.ProcessOrder)
// 取第一个(下一道工序)
.FirstOrDefault();
// 从字典查询工序对应的区域
var zoneName = _unitWork.FindSingle<SysDictData>(x => x.DictType == "ProcessZone"
&& x.DictLabel == materialProcess.ProcessCode)?.DictValue;
var zoneName = _unitWork.FindSingle<ProcessConfig>(x =>
x.Code == nextProcess.ProcessCode)?.Zone;
if (string.IsNullOrEmpty(zoneName))
{
@ -180,7 +208,7 @@ namespace HHWMS.Web.Controllers
TaskType = TaskTypeEnum.入库,
FromLocation = "",
ToLocation = locationCode,
ContainerCode = model.PalletCode,
ContainerCode = container.Code,
RoadWay = 1,
Status = TaskStatusEnum.新建,
CreateBy = model.OperatorId,
@ -193,18 +221,21 @@ namespace HHWMS.Web.Controllers
var inventory = new Inventory
{
ZoneId = zone.ID,
ContainerCode = model.PalletCode,
ContainerCode = taskHeader.ContainerCode,
LocationCode = locationCode,
MaterialCode = model.MaterialCode,
MaterialType = material.MaterialType,
MaterialName = material.MaterialName,
MaterialSpec = material.MaterialSpec,
MaterialUnit = material.MaterialUnit,
SupplierCode = material.SupplierCode,
SourceCode = model.SourceCode,
Batch = materialProcess.ProcessName,
Lot = materialProcess.ProcessCode,
Lot = nextProcess?.ProcessName,
Status = model.IsQualified ? "合格" : "不合格",
TaskStatus = InventoryTaskStatusEnum.Locked,
TaskQty = model.Qty,
TaskQty = model.Qty,//小托盘数量
Flag = model.Type,//小托盘类型
CreateBy = model.OperatorId,
ReceiptCode = model.OperatorInfo, //校验员
CreateTime = DateTime.Now
@ -226,7 +257,7 @@ namespace HHWMS.Web.Controllers
{
Status = LocationStatusEnum.锁定,
ContainerStatus = LocationStatus.有货,
ContainerCode = model.PalletCode,
ContainerCode = taskHeader.ContainerCode,
UpdateTime = DateTime.Now,
UpdateBy = "WMS",
Version = Guid.NewGuid()
@ -243,7 +274,7 @@ namespace HHWMS.Web.Controllers
var wcsTaskModel = new WCSTaskModel
{
TaskNo = taskNo,
PalletNo = model.PalletCode,
PalletNo = taskHeader.ContainerCode,
FromLocation = "", // 入库任务起始位置为空
ToLocation = locationCode,
};
@ -295,7 +326,7 @@ namespace HHWMS.Web.Controllers
// 1. 查找可用库位信息
var locationVm = Wtm.CreateVM<LocationVM>();
var locationCode = locationVm.GetEmptyLocationFromXb(_materialZones["zone1"].BeginLine, _materialZones["zone1"].EndLine);
var locationCode = locationVm.GetEmptyLocationFromXb(_materialZones["Zone1"].BeginLine, _materialZones["Zone1"].EndLine);
if (string.IsNullOrWhiteSpace(locationCode))
{
@ -317,7 +348,7 @@ namespace HHWMS.Web.Controllers
TaskType = TaskTypeEnum.入库,
FromLocation = "",
ToLocation = locationCode,
ContainerCode = model.PalletCode,
ContainerCode = container.Code,
RoadWay = 1,
Status = TaskStatusEnum.新建,
CreateBy = model.OperatorId,
@ -358,7 +389,7 @@ namespace HHWMS.Web.Controllers
var wcsTaskModel = new WCSTaskModel
{
TaskNo = taskNo,
PalletNo = model.PalletCode,
PalletNo = taskHeader.ContainerCode,
FromLocation = "", // 入库任务起始位置为空
ToLocation = locationCode,
};
@ -387,6 +418,58 @@ namespace HHWMS.Web.Controllers
}
}}
/// <summary>
/// 空托盘出库
/// </summary>
/// <returns></returns>
[HttpPost]
public IActionResult EmptyPalletOut()
{
var container = _unitWork.FindSingle<Container>(x => x.Status == ContainerStatus.空
&& x.IsLock == ContainerLockEnum.未锁
&& !string.IsNullOrEmpty(x.LocationCode));
if (container == null)
{
return Json(new { Code = 500, Msg = "库内不存在可用空容器!"} );
}
//创建出库任务
var location = _unitWork.FindSingle<Location>(x => x.Code == container.LocationCode);
var outPort = _unitWork.FindSingle<ProcessConfig>(x => x.Code == "00")?.Port;
if (string.IsNullOrEmpty(outPort))
{
return Json(new { Code = 500, Msg = "未配置空托盘出库口,请配置后重新呼叫出库任务!"} );
}
var task = new TaskHeader()
{
ZoneId = location.ZoneId,
TaskNo = _unitWork.GetSerialNumber("Out", 6),
TaskType = TaskTypeEnum.出库,
ContainerCode = container.Code,
FromLocation = container.LocationCode,
ToLocation = outPort,
Status = TaskStatusEnum.新建
};
var vm = Wtm.CreateVM<LocationVM>();
var result = vm.SendWcsTask(task);
if (!result.Status)
{
return Json(new { Code = 500, Msg =result.Message});
}
location.Status = LocationStatusEnum.锁定;
location.UpdateTime = DateTime.Now;
_unitWork.Update(location);
container.IsLock = ContainerLockEnum.任务锁;
container.UpdateTime = DateTime.Now;
_unitWork.Update(container);
return Json(new { Code = 200, Msg = "提交成功" });
}
/// <summary>
/// 搜索物料
/// </summary>
@ -425,11 +508,13 @@ namespace HHWMS.Web.Controllers
public class ReceiptInModel
{
public string PalletCode { get; set; }
public string SourceCode { get; set; }
public string MaterialCode { get; set; }
public string OrderId { get; set; }
public string OperatorId { get; set; }
public int ProcessId { get; set; }
public string ProcessName { get; set; }
public int Type { get; set; }
public int Qty { get; set; }
public bool IsQualified { get; set; }
public string OperatorInfo { get; set; }

View File

@ -163,7 +163,7 @@ namespace HHWMS.Web.Controllers
var inventory = new Inventory()
{
ZoneId = zone.ID,
ContainerCode = containerCode,
ContainerCode = container.Code,
MaterialCode = material.MaterialCode,
MaterialName = material.MaterialName,
MaterialType = material.MaterialType,
@ -186,7 +186,7 @@ namespace HHWMS.Web.Controllers
MaterialCode = material.MaterialCode,
MaterialName = material.MaterialName,
MaterialUnit = material.MaterialUnit,
ContainerCode = containerCode,
ContainerCode = container.Code,
CompanyCode = inventory.CompanyCode,
SourceCode = inventory.SourceCode,
SupplierCode = inventory.SupplierCode,
@ -249,7 +249,7 @@ namespace HHWMS.Web.Controllers
TaskNo = _unitWork.GetSerialNumber("In"),
TaskType = TaskTypeEnum.入库,
RoadWay = 2,
ContainerCode = containerCode,
ContainerCode = container.Code,
FromLocation = "Enter_0000",
ToLocation = "",
Status = TaskStatusEnum.待下发,
@ -452,7 +452,7 @@ namespace HHWMS.Web.Controllers
TaskNo = _unitWork.GetSerialNumber("In"),
TaskType = TaskTypeEnum.入库,
RoadWay = 2,
ContainerCode = containerCode,
ContainerCode = container.Code,
FromLocation = "Enter_0000",
ToLocation = "",
Status = TaskStatusEnum.待下发,

View File

@ -39,6 +39,21 @@
<a-input v-model="form.processName" />
</a-form-item>
<a-form-item field="sourceCode" label="单号">
<a-input v-model="form.sourceCode" style="width: 100%" ref="sourceCodeRef" @@keydown.enter="focusNext('numInput')"/>
</a-form-item>
<a-form-item field="type" label="小托盘类型" >
<a-radio-group v-model="form.type" type="button">
<a-radio
v-for="item in trayTypeOptions"
:key="item.value"
:value="item.value">
{{ item.label }}
</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item field="qty" label="小托盘数量">
<a-input-number v-model="form.qty" :min="0" style="width: 100%" ref="numInput" @@keydown.enter="focusNext('operatorIdRef')"/>
</a-form-item>
@ -57,9 +72,10 @@
<a-form-item>
<a-space>
<a-button type="primary" @@click="submitForm" :loading="loading">上架入库</a-button>
<a-button type="success" @@click="submitEmptyPallet" :loading="loading">空托盘入库</a-button>
<a-button @@click="resetForm">重置</a-button>
<a-button type="primary" status="success" @@click="submitForm" :loading="loading">上架入库</a-button>
<a-button type="primary" status="warning" @@click="submitEmptyPallet" :loading="loading">空托盘入库</a-button>
<a-button type="primary" status="danger" @@click="emptyPalletOut" :loading="loading">空托盘出库</a-button>
<a-button type="outline" @@click="resetForm">重置</a-button>
</a-space>
</a-form-item>
</a-form>
@ -79,13 +95,16 @@
const palletCodeRef = ref(null);
const materialCodeRef = ref(null);
const sourceCodeRef = ref(null);
const numInput = ref(null);
const operatorIdRef = ref(null);
const operatorInfoRef = ref(null);
const trayTypeOptions = ref([]);
const inputRefs = {
palletCodeRef,
materialCodeRef,
sourceCodeRef,
numInput,
operatorIdRef,
operatorInfoRef
@ -101,11 +120,13 @@
const form = reactive({
palletCode: '',
materialCode: '',
sourceCode:'',
orderId: '',
operatorId: '',
processId: '',
processName:'',
name:'',
type:'',
qty:null,
isQualified: true,
operatorInfo: ''
@ -157,7 +178,7 @@
const processSelect = (value) => {
form.processName = processOptions.value.find(item => item.value === value).processName;
focusNext('numInput');
focusNext('sourceCodeRef');
}
// 加载工序列表
@ -358,6 +379,35 @@
});
};
// 呼叫空托盘出库
const emptyPalletOut = () => {
loading.value = true;
$.ajax({
type: "post",
dataType: "json",
contentType: "application/json",
url: "/receipt/ReceiptIn/EmptyPalletOut",
success: (json) => {
if (json.Code == 200) {
Message.success('空托盘出库任务创建成功!');
resetForm();
} else {
Message.error({
content: json.Msg || '空托盘出库任务创建失败!',
duration: 5000
});
}
},
error: (xhr, status, error) => {
Message.error('提交失败:' + error);
},
complete: () => {
loading.value = false;
}
});
};
// 重置表单
const resetForm = () => {
formRef.value.resetFields();
@ -369,6 +419,29 @@
}, 100);
};
// 从后端获取托盘类型列表
const loadTrayTypes = () => {
// 调用后端接口获取数据
axios.get('/receipt/ReceiptIn/GetTrayTypes')
.then(response => {
const result = response.data;
console.log(result)
if (result.Code == 200) {
// 假设后端返回格式:[{value: 'mini', label: 'Mini'}, ...]
trayTypeOptions.value = result.Data;
// 可选:设置默认值(取第一个选项)
if (trayTypeOptions.value.length > 0) {
form.type = trayTypeOptions.value[0].value;
}
} else {
Message.error('获取托盘类型失败:' + result.Msg);
}
})
.catch(error => {
Message.error('请求失败:' + error.message);
});
};
// 生命周期钩子
onMounted(() => {
@ -378,6 +451,8 @@
palletCodeRef.value.focus();
}
}, 100);
loadTrayTypes();
});
return {
@ -391,19 +466,22 @@
scanMaterial,
submitForm,
submitEmptyPallet,
emptyPalletOut,
resetForm,
materialOptions,
handleMaterialSearch,
handleMaterialSelect,
palletCodeRef,
materialCodeRef,
sourceCodeRef,
numInput,
operatorIdRef,
operatorInfoRef,
focusNext,
loadProcesses,
loadProcessesByMaterial,
processSelect
processSelect,
trayTypeOptions
};
}
});

View File

@ -28,7 +28,7 @@ namespace HHWMS.Web.Controllers
/// 提交WCS任务
/// </summary>
[HttpPost]
public async Task<IActionResult> SubmitTask([FromBody] WCSTaskModel model)
public IActionResult SubmitTask([FromBody] WCSTaskModel model)
{
try
{

View File

@ -57,6 +57,7 @@ namespace HHWMS.Web
public DbSet<PrintConfig> PrintConfigs { get; set; }
public DbSet<LocationZone> LocationZones { get; set; }
public DbSet<Customer> Customers { get; set; }
public DbSet<ProcessConfig> ProcessConfigs { get; set; }
public override async Task<bool> DataInit(object allModules, bool IsSpa)
{
var state = await base.DataInit(allModules, IsSpa);

View File

@ -11,6 +11,10 @@ namespace HHWMS.Web.Models
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public new int ID { get; set; }
public LocationZone Zone { get; set; }
[Display(Name = "Location.ZoneCode", Description = "库区")]
public int ZoneId { get; set; }
[Display(Name = "Container.Code", Description = "容器编码")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Code { get; set; }

View File

@ -12,6 +12,7 @@ namespace HHWMS.Web.Models
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public new int ID { get; set; }
[Required(ErrorMessage = "Validate.{0}required")]
[Display(Name = "Customer.Code", Description = "编码")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Code { get; set; }
@ -20,6 +21,7 @@ namespace HHWMS.Web.Models
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Type { get; set; }
[Required(ErrorMessage = "Validate.{0}required")]
[Display(Name = "Customer.Name", Description = "名称")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Name { get; set; }

View File

@ -13,10 +13,12 @@ namespace HHWMS.Web.Models
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public new int ID { get; set; }
[Required(ErrorMessage = "Validate.{0}required")]
[Display(Name = "Inventory.MaterialCode", Description = "物料编码")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string MaterialCode { get; set; }
[Required(ErrorMessage = "Validate.{0}required")]
[Display(Name = "Inventory.MaterialType", Description = "物料类型")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string MaterialType { get; set; }
@ -48,7 +50,8 @@ namespace HHWMS.Web.Models
[StringLength(100, ErrorMessage = "Validate.{0}stringmax{1}")]
public string SupplierCode { get; set; }
[Display(Name = "Inventory.Qty", Description = "数量")]
[Required(ErrorMessage = "Validate.{0}required")]
[Display(Name = "MaterialProcess.Weight", Description = "数量")]
[Column(TypeName = "decimal(12,4)")]
public decimal? Qty { get; set; }
}

View File

@ -12,20 +12,25 @@ namespace HHWMS.Web.Models
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public new int ID { get; set; }
[Required(ErrorMessage = "Validate.{0}required")]
[Display(Name = "MaterialProcess.MaterialCode", Description = "物料编码")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string MaterialCode { get; set; }
[Display(Name = "MaterialProcess.ProcessOrder", Description = "工序顺序")]
public int ProcessOrder { get; set; }
[Required(ErrorMessage = "Validate.{0}required")]
[RegularExpression("[0-9]{2}", ErrorMessage = "{0}必须是2位数字")]
[Display(Name = "MaterialProcess.ProcessCode", Description = "工序编码")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string ProcessCode { get; set; }
[Required(ErrorMessage = "Validate.{0}required")]
[Display(Name = "MaterialProcess.ProcessName", Description = "工序名称")]
[StringLength(100, ErrorMessage = "Validate.{0}stringmax{1}")]
public string ProcessName { get; set; }
[Display(Name = "MaterialProcess.ProcessCode", Description = "工序编码")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string ProcessCode { get; set; }
[Required(ErrorMessage = "Validate.{0}required")]
[Display(Name = "MaterialProcess.ProcessOrder", Description = "工序顺序")]
public int ProcessOrder { get; set; }
[Display(Name = "MaterialProcess.Weight", Description = "毛重")]
[Required]

View File

@ -0,0 +1,49 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using WalkingTec.Mvvm.Core;
namespace HHWMS.Web.Models
{
[Table("ProcessConfig")]
public class ProcessConfig : BasePoco
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public new int ID { get; set; }
[Display(Name = "Process.Code", Description = "工序编码")]
[Required(ErrorMessage = "Validate.{0}required")]
[RegularExpression("[0-9]{2}", ErrorMessage = "{0}必须是2位数字")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Code { get; set; }
[Display(Name = "Process.Name", Description = "工序名称")]
[Required(ErrorMessage = "Validate.{0}required")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Name { get; set; }
[Display(Name = "Process.Zone", Description = "存放区域")]
[Required(ErrorMessage = "Validate.{0}required")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Zone { get; set; }
[Display(Name = "Process.Port", Description = "出口")]
[Required(ErrorMessage = "Validate.{0}required")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Port { get; set; }
[Display(Name = "Sys.Spare", Description = "备用1")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Spare1 { get; set; }
[Display(Name = "Sys.Spare", Description = "备用2")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Spare2 { get; set; }
[Display(Name = "Sys.Spare", Description = "备用3")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Spare3 { get; set; }
}
}

View File

@ -41,7 +41,9 @@ builder.Services.AddMvc(options =>
options.UseWtmMvcOptions();
})
.AddJsonOptions(options => {
// 禁用 Unicode 转义(确保中文正常显示)
options.UseWtmJsonOptions();
options.JsonSerializerOptions.Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping;
})
.ConfigureApiBehaviorOptions(options =>
{

View File

@ -1219,7 +1219,7 @@
<value>工序</value>
</data>
<data name="Inventory.Lot" xml:space="preserve">
<value>格</value>
<value>下道工序</value>
</data>
<data name="Inventory.ManufactureDate" xml:space="preserve">
<value>生产日期</value>
@ -1479,4 +1479,19 @@
<data name="Customer.Name" xml:space="preserve">
<value>名称</value>
</data>
<data name="Process.Code" xml:space="preserve">
<value>工序编码</value>
</data>
<data name="Process.Name" xml:space="preserve">
<value>工序名称</value>
</data>
<data name="Process.Zone" xml:space="preserve">
<value>存放区域</value>
</data>
<data name="Process.Port" xml:space="preserve">
<value>出库口</value>
</data>
<data name="Sys.Spare" xml:space="preserve">
<value>备用</value>
</data>
</root>

View File

@ -29,7 +29,7 @@
}
],
"CookiePre": "HHWMS", //cookie前缀
"IsQuickDebug": true, //是否启用debug模式
"IsQuickDebug": false, //是否启用debug模式
"EnableTenant": false, //是否启动多租户
"SyncDb": true, //是否自动同步数据库
"EncryptKey": "", //加密密钥