库位表重新生成,一些数据使用enum type status

加上数据权限zoneCode
This commit is contained in:
zhougf committed 2025-04-30 19:59:47 +08:00
1 parent b0a6dcc035
commit b005422b01
25 files changed
+361 -541

No files matched your search

+24 -129
View File
@@ -30,14 +30,12 @@ namespace HHWMS.Web
private readonly IMapper _mapper;
private readonly IMemoryCache _cache;
private const int DEBOUNCE_INTERVAL_MS = 1000; // 防抖间隔1秒
private readonly PLCHelper _plcHelper;
public IWCSController(IUnitWork unitWork, IMapper mapper, IMemoryCache cache, PLCHelper plcHelper)
public IWCSController(IUnitWork unitWork, IMapper mapper, IMemoryCache cache)
{
_unitWork = unitWork;
_mapper = mapper;
_cache = cache;
_plcHelper = plcHelper;
}
/// <summary>
@@ -108,14 +106,6 @@ namespace HHWMS.Web
private async Task ProcessRequestIn(WcsRequest request)
{
// TODO: 实现具体的入库处理逻辑
var t = 0;
var plc = new SiemensS7Net( SiemensPLCS.S1200, "10.211.55.4" );
var read = await plc.ReadInt32Async( "V2634" );
if (read.IsSuccess)
{
t = read.Content;
}
var write = await plc.WriteAsync( "V2634", t + 1 );
await Task.Delay(1000); // 模拟异步处理
}
@@ -150,19 +140,36 @@ namespace HHWMS.Web
var code = vm.GetLocation(request);
if (code.Status)
{
UpdateLocationAndContainer(code.Data.LocationCode, request.PalletNo);
return Task.FromResult<IActionResult>(ApiResult(code.Data));
var updateResult = UpdateLocationAndContainer(code.Data.LocationCode, request.PalletNo);
return Task.FromResult<IActionResult>(updateResult);
}
return Task.FromResult<IActionResult>(ApiResultError("没有符合条件的可用库位"));
});
}
/// <summary>
/// 更新库位和容器
/// </summary>
/// <param name="locationCode"></param>
/// <param name="palletNo"></param>
/// <returns></returns>
private IActionResult UpdateLocationAndContainer(string locationCode, string palletNo)
{
var location = _unitWork.Find<Location>(x => x.Code == locationCode).FirstOrDefault();
location.ContainerCode = palletNo;
location.Status = LocationStatus.任务锁;
_unitWork.Update(location);
var resultNum = _unitWork.BatchUpdate<Location>(x => x.Code == locationCode && x.Version == location.Version,
x => new Location()
{
ContainerCode = palletNo,
// Status = LocationStatus.任务锁,
UpdateTime = DateTime.Now,
UpdateBy = "WMS",
Version = Guid.NewGuid()
});
if (resultNum == 0)
{
//失败
return ApiResult(ApiResultError("更新仓位失败!请重新请求!"));
}
var container = _unitWork.Find<Container>(x => x.Code == palletNo).FirstOrDefault();
if (container != null)
@@ -173,117 +180,5 @@ namespace HHWMS.Web
return ApiResult(new { LocationCode = location.Code });
}
/// <summary>
/// PLC通信测试接口
/// </summary>
/// <param name="request">通信参数</param>
[HttpPost]
public async Task<IActionResult> CommunicateWithPLC(PlcCommunicationRequest request)
{
if (request == null)
{
return ApiResultError("请求参数不能为空");
}
try
{
// 连接PLC
if (!_plcHelper.Connect(PlcType.Siemens, request.IpAddress))
{
return ApiResultError(msg:"PLC连接失败");
}
try
{
// 根据操作类型执行不同的读写操作
switch (request.OperationType)
{
case "ReadInt32":
var value = _plcHelper.ReadInt32(request.Address);
return ApiResult(new { Value = value });
case "WriteInt16":
if (!short.TryParse(request.Value, out short shortValue))
{
return ApiResultError(msg: "无效的数值");
}
var writeResult = _plcHelper.WriteInt16(request.Address, shortValue);
return ApiResult(new { Success = writeResult });
case "ReadBool":
var boolValue = _plcHelper.ReadBool(request.Address);
return ApiResult(new { Value = boolValue });
case "WriteBool":
if (!bool.TryParse(request.Value, out bool boolWriteValue))
{
return ApiResultError("无效的布尔值");
}
var boolWriteResult = _plcHelper.WriteBool(request.Address, boolWriteValue);
return ApiResult(new { Success = boolWriteResult });
case "ReadString":
if (!ushort.TryParse(request.StringLength, out ushort length))
{
return ApiResultError("无效的字符串长度");
}
var stringValue = _plcHelper.ReadString(request.Address, length);
return ApiResult(new { Value = stringValue });
case "WriteString":
if (!ushort.TryParse(request.StringLength, out ushort writeLength))
{
return ApiResultError("无效的字符串长度");
}
var stringWriteResult = _plcHelper.WriteString(request.Address, request.Value, writeLength);
return ApiResult(new { Success = stringWriteResult });
default:
return ApiResultError("不支持的操作类型");
}
}
finally
{
// 确保操作完成后断开连接
_plcHelper.Disconnect();
}
}
catch (Exception ex)
{
return ApiResultError($"PLC操作失败: {ex.Message}");
}
}
/// <summary>
/// PLC通信请求参数类
/// </summary>
public class PlcCommunicationRequest
{
/// <summary>
/// PLC的IP地址
/// </summary>
public string IpAddress { get; set; }
/// <summary>
/// 操作类型(ReadInt16, WriteInt16, ReadBool, WriteBool, ReadString, WriteString)
/// </summary>
public string OperationType { get; set; }
/// <summary>
/// PLC地址(例如"DB1.0")
/// </summary>
public string Address { get; set; }
/// <summary>
/// 要写入的值(用于写操作)
/// </summary>
public string Value { get; set; }
/// <summary>
/// 字符串长度(用于字符串操作)
/// </summary>
public string StringLength { get; set; }
}
}
}
@@ -1,11 +1,11 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Mvc;
using WalkingTec.Mvvm.Core.Extensions;
using HHWMS.Web;
using System.Collections.Generic;
using HHWMS.Web.Models;
namespace HHWMS.Web.Controllers
@@ -14,11 +14,13 @@ namespace HHWMS.Web.Controllers
[ActionDescription("库位管理")]
public partial class LocationController : BaseController
{
private readonly IUnitWork _unitwork;
private readonly IUnitWork _unitWork;
public LocationController(IUnitWork unitWork)
{
_unitwork = unitWork;
_unitWork = unitWork;
}
#region Search
[ActionDescription("Sys.Search")]
public ActionResult Index()
@@ -140,7 +142,6 @@ namespace HHWMS.Web.Controllers
public ActionResult Details(string id)
{
var vm = Wtm.CreateVM<LocationVM>(id);
vm.Inventorys.SearcherMode = ListVMSearchModeEnum.MasterDetail;
return PartialView(vm);
}
#endregion
@@ -259,16 +260,16 @@ namespace HHWMS.Web.Controllers
locationList.Add(new Location
{
Code = $"{vm.Entity.Type}{vm.Entity.RoadWay.ToString().PadLeft(2, '0')}-{row.ToString().PadLeft(2, '0')}-{line.ToString().PadLeft(2, '0')}-{layer.ToString().PadLeft(2, '0')}",
ZoneCode = vm.Entity.ZoneCode,
LocationZoneId = vm.Entity.LocationZoneId,
Type = vm.Entity.Type,
RoadWay = vm.Entity.RoadWay,
Row = row,
Line = line,
Layer = layer,
RowFlag = (short?)(vm.RoadwayType == 1 || vm.RoadwayType == 2 ? 0 : (row == 1 || row == 4 ? 1 : 0)),
RowFlag = (vm.RoadwayType == 1 || vm.RoadwayType == 2 ? RowFlagEnum.Outer : (row == 1 || row == 4 ? RowFlagEnum.Inner : RowFlagEnum.Outer)),
ContiguousCode = vm.RoadwayType == 4 ? $"{vm.Entity.Type}{vm.Entity.RoadWay.ToString().PadLeft(2, '0')}-{(row % 2 == 0?row-1:row+1) .ToString().PadLeft(2, '0')}-{line.ToString().PadLeft(2, '0')}-{layer.ToString().PadLeft(2, '0')}" : null,
IsStop = false,
Status = LocationStatus.空仓位,
Status = LocationStatusEnum.Empty,
Length = vm.Entity.Length,
Width = vm.Entity.Width,
Height = vm.Entity.Height
@@ -276,16 +277,11 @@ namespace HHWMS.Web.Controllers
}
}
}
_unitwork.BatchAdd(locationList.ToArray());
_unitWork.BatchAdd(locationList.ToArray());
return FFResult().CloseDialog().RefreshGrid();
}
}
#endregion 新增库位
[ActionDescription("Sys.Print")]
public ActionResult Print()
{
return Ok();
}
}
}
@@ -1,5 +1,12 @@
using HHWMS.Web.Models;
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
{
@@ -10,15 +17,19 @@ namespace HHWMS.Web
ListVM = new LocationListVM();
LinkedVM = new Location_BatchEdit();
}
}
/// <summary>
/// <summary>
/// Class to define batch edit fields
/// </summary>
public class Location_BatchEdit : BaseVM
{
protected override void InitVM()
{
}
}
}
@@ -1,59 +1,58 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using HHWMS.Web.Models;
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 LocationTemplateVM : BaseTemplateVM
{
public ExcelPropety LocationZone_Excel = ExcelPropety.CreateProperty<Location>(x => x.LocationZoneId);
[Display(Name = "Location.Code")]
public ExcelPropety Code_Excel = ExcelPropety.CreateProperty<Location>(x => x.Code);
[Display(Name = "Location.Type")]
public ExcelPropety Type_Excel = ExcelPropety.CreateProperty<Location>(x => x.Type);
[Display(Name = "Location.Status")]
public ExcelPropety Status_Excel = ExcelPropety.CreateProperty<Location>(x => x.Status);
[Display(Name = "Location.Row")]
public ExcelPropety Row_Excel = ExcelPropety.CreateProperty<Location>(x => x.Row);
[Display(Name = "Location.Line")]
public ExcelPropety Line_Excel = ExcelPropety.CreateProperty<Location>(x => x.Line);
[Display(Name = "Location.Layer")]
public ExcelPropety Layer_Excel = ExcelPropety.CreateProperty<Location>(x => x.Layer);
[Display(Name = "Location.RoadWay")]
public ExcelPropety RoadWay_Excel = ExcelPropety.CreateProperty<Location>(x => x.RoadWay);
[Display(Name = "Location.Row")]
public ExcelPropety Row_Excel = ExcelPropety.CreateProperty<Location>(x => x.Row);
[Display(Name = "Location.Line")]
public ExcelPropety Line_Excel = ExcelPropety.CreateProperty<Location>(x => x.Line);
[Display(Name = "Location.Layer")]
public ExcelPropety Layer_Excel = ExcelPropety.CreateProperty<Location>(x => x.Layer);
[Display(Name = "Location.RowFlag")]
public ExcelPropety RowFlag_Excel = ExcelPropety.CreateProperty<Location>(x => x.RowFlag);
[Display(Name = "Location.ContainerCode")]
public ExcelPropety ContainerCode_Excel = ExcelPropety.CreateProperty<Location>(x => x.ContainerCode);
[Display(Name = "Location.ZoneCode")]
public ExcelPropety ZoneCode_Excel = ExcelPropety.CreateProperty<Location>(x => x.ZoneCode);
[Display(Name = "Location.IsStop")]
public ExcelPropety IsStop_Excel = ExcelPropety.CreateProperty<Location>(x => x.IsStop);
[Display(Name = "System.Length")]
public ExcelPropety Length_Excel = ExcelPropety.CreateProperty<Location>(x => x.Length);
[Display(Name = "System.Width")]
public ExcelPropety Width_Excel = ExcelPropety.CreateProperty<Location>(x => x.Width);
[Display(Name = "System.Height")]
public ExcelPropety Height_Excel = ExcelPropety.CreateProperty<Location>(x => x.Height);
[Display(Name = "Location.ContiguousCode")]
public ExcelPropety ContiguousCode_Excel = ExcelPropety.CreateProperty<Location>(x => x.ContiguousCode);
protected override void InitVM()
protected override void InitVM()
{
LocationZone_Excel.DataType = ColumnDataType.ComboBox;
LocationZone_Excel.ListItems = DC.Set<LocationZone>().GetSelectListItems(Wtm, y => y.Name);
}
}
public class LocationImportVM : BaseImportVM<LocationTemplateVM, Location>
{
}
}
@@ -1,25 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using HHWMS.Web.Models;
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 LocationListVM : BasePagedListVM<Location_View, LocationSearcher>
{
public List<ComboSelectListItem> ZoneCodes { get; set; }
public List<ComboSelectListItem> Types { get; set; }
public List<ComboSelectListItem> LocationStatus { get; set; }
protected override void InitVM()
{
var vm = Wtm.CreateVM<LocationVM>();
ZoneCodes = vm.ZoneCodes;
Types = vm.Types;
LocationStatus = vm.LocationStatus;
}
protected override List<GridAction> InitGridAction()
{
return new List<GridAction>
@@ -33,40 +26,25 @@ 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","Print",Localizer["Sys.Print"],Localizer["Sys.Print"],GridActionParameterTypesEnum.MultiIds,"configs")
.SetShowDialog(false).SetOnClickScript("print"),
this.MakeAction("Location","Print",Localizer["Sys.Print"],"",GridActionParameterTypesEnum.MultiIds,"configs")
.SetShowDialog(false).SetOnClickScript("print"),
};
}
protected override IEnumerable<IGridColumn<Location_View>> InitGridHeader()
{
InitVM();
return new List<GridColumn<Location_View>>{
this.MakeGridHeader(x => x.ZoneCode)
.SetFormat((a, b) =>
{
var data = ZoneCodes.FirstOrDefault(x => x.Value.ToString() == a.ZoneCode);
return data?.Text ?? a.ZoneCode;
}),
this.MakeGridHeader(x => x.Code, 120),
this.MakeGridHeader(x => x.Type)
.SetFormat((a, b) =>
{
var data = Types.FirstOrDefault(x => x.Value.ToString() == a.Type);
return data?.Text ?? a.Type;
}),
this.MakeGridHeader(x => x.Status)
.SetFormat((a, b) =>
{
var data = LocationStatus.FirstOrDefault(x => x.Value.ToString() == a.Status);
return data?.Text ?? a.Status;
}),
this.MakeGridHeader(x => x.Row),
this.MakeGridHeader(x => x.Line),
this.MakeGridHeader(x => x.Layer),
this.MakeGridHeader(x => x.RoadWay).SetHide(),
this.MakeGridHeader(x => x.Name_view),
this.MakeGridHeader(x => x.Code),
this.MakeGridHeader(x => x.Type),
this.MakeGridHeader(x => x.Status),
this.MakeGridHeader(x => x.ContainerCode),
this.MakeGridHeader(x => x.RoadWay),
this.MakeGridHeader(x => x.Row).SetHide(),
this.MakeGridHeader(x => x.Line).SetHide(),
this.MakeGridHeader(x => x.Layer).SetHide(),
this.MakeGridHeader(x => x.RowFlag).SetHide(),
this.MakeGridHeader(x => x.IsStop),
this.MakeGridHeader(x => x.Length).SetHide(),
this.MakeGridHeader(x => x.Width).SetHide(),
@@ -79,29 +57,27 @@ namespace HHWMS.Web
public override IOrderedQueryable<Location_View> GetSearchQuery()
{
var query = DC.Set<Location>()
.CheckContain(Searcher.Code, x => x.Code)
.CheckContain(Searcher.Type, x => x.Type)
.CheckContain(Searcher.Status, x => x.Status)
.CheckEqual(Searcher.Row, x => x.Row)
.CheckEqual(Searcher.Line, x => x.Line)
.CheckEqual(Searcher.Layer, x => x.Layer)
.CheckEqual(Searcher.RoadWay, x => x.RoadWay)
.CheckContain(Searcher.ContainerCode, x => x.ContainerCode)
.CheckContain(Searcher.ZoneCode, x => x.ZoneCode)
.CheckEqual(Searcher.IsStop, x => x.IsStop)
.CheckContain(Searcher.ContiguousCode, x => x.ContiguousCode)
.CheckEqual(Searcher.LocationZoneId, x=>x.LocationZoneId)
.CheckContain(Searcher.Code, x=>x.Code)
.CheckEqual(Searcher.Type, x=>x.Type)
.CheckEqual(Searcher.Status, x=>x.Status)
.CheckEqual(Searcher.RoadWay, x=>x.RoadWay)
.CheckEqual(Searcher.RowFlag, x=>x.RowFlag)
.CheckContain(Searcher.ContainerCode, x=>x.ContainerCode)
.CheckEqual(Searcher.IsStop, x=>x.IsStop)
.Select(x => new Location_View
{
ID = x.ID,
ID = x.ID,
Name_view = x.LocationZone.Name,
Code = x.Code,
Type = x.Type,
Status = x.Status,
RoadWay = x.RoadWay,
Row = x.Row,
Line = x.Line,
Layer = x.Layer,
RoadWay = x.RoadWay,
RowFlag = x.RowFlag,
ContainerCode = x.ContainerCode,
ZoneCode = x.ZoneCode,
IsStop = x.IsStop,
Length = x.Length,
Width = x.Width,
@@ -111,9 +87,12 @@ namespace HHWMS.Web
.OrderBy(x => x.ID);
return query;
}
}
public class Location_View : Location
{
public class Location_View : Location{
[Display(Name = "Location.ZoneCode")]
public String Name_view { get; set; }
}
}
@@ -1,46 +1,39 @@
using System;
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 LocationSearcher : BaseSearcher
{
public List<ComboSelectListItem> AllLocationZones { get; set; }
[Display(Name = "Location.ZoneCode")]
public int? LocationZoneId { get; set; }
[Display(Name = "Location.Code")]
public String Code { get; set; }
[Display(Name = "Location.Type")]
public String Type { get; set; }
public LocationTypeEnum? Type { get; set; }
[Display(Name = "Location.Status")]
public String Status { get; set; }
[Display(Name = "Location.Row")]
public Int16? Row { get; set; }
[Display(Name = "Location.Line")]
public Int16? Line { get; set; }
[Display(Name = "Location.Layer")]
public Int16? Layer { get; set; }
public LocationStatusEnum? Status { get; set; }
[Display(Name = "Location.RoadWay")]
public Int16? RoadWay { get; set; }
[Display(Name = "Location.RowFlag")]
public RowFlagEnum? RowFlag { get; set; }
[Display(Name = "Location.ContainerCode")]
public String ContainerCode { get; set; }
[Display(Name = "Location.ZoneCode")]
public String ZoneCode { get; set; }
[Display(Name = "Location.IsStop")]
public Boolean? IsStop { get; set; }
[Display(Name = "Location.ContiguousCode")]
public String ContiguousCode { get; set; }
protected override void InitVM()
{
AllLocationZones = DC.Set<LocationZone>().GetSelectListItems(Wtm, y => y.Name);
}
}
}
@@ -1,79 +1,52 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using HHWMS.Web.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.SqlServer.Query.Internal;
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 LocationVM : BaseCRUDVM<Location>
{
public LocationVM()
{
}
public InventoryListVM Inventorys { get; set; } = new InventoryListVM();
public List<ComboSelectListItem> AllLocationZones { get; set; }
[Display(Name = "Location.BeginLine", Description = "起始列")]
[Required(ErrorMessage = "Validate.{0}required")]
public short BeginLine { get; set; }
[Display(Name = "Location.BeginLayer", Description = "起始层")]
[Required(ErrorMessage = "Validate.{0}required")]
public short BeginLayer { get; set; }
[Display(Name = "Location.RoadwayType", Description = "巷道类型")]
[Required(ErrorMessage = "Validate.{0}required")]
public short RoadwayType { get; set; }
private IUnitWork _unitWork { get; set; }
public List<ComboSelectListItem> RoadwayTypes { get; set; }
public List<ComboSelectListItem> ZoneCodes { get; set; }
public List<ComboSelectListItem> Types { get; set; }
public List<ComboSelectListItem> LocationStatus { get; set; }
public LocationVM()
{
SetInclude(x => x.LocationZone);
}
protected override void InitVM()
{
Inventorys.CopyContext(this);
Inventorys.Searcher.LocationCode = Entity.Code;
AllLocationZones = DC.Set<LocationZone>().GetSelectListItems(Wtm, y => y.Name);
var currentCulture = Wtm.CurrentCulture;
var dictData = DC.Set<SysDictData>().ToList();
RoadwayTypes = dictData.Where(x => x.DictType == "RoadwayType").Select(x => new ComboSelectListItem
{
Text = currentCulture == "zh" ? x.DictLabel : x.DictLabelUs,
Value = x.DictValue
}).ToList();
//var tt = DC.Set<TaskHeader>().Where(x => x.ID > 1).Include(x => x.TaskDetails);
//_unitWork = new UnitWork(Wtm);
//var task = _unitWork.Find<TaskHeader>(x => x.ID > 1)
// .Include(x => x.TaskDetails)
// .FirstOrDefault();
//var details = task.TaskDetails;
var CurrentCulture = Wtm.CurrentCulture;
var dictDatas = DC.Set<SysDictData>().ToList();
RoadwayTypes = dictDatas.Where(x => x.DictType == "RoadwayType").Select(x => new ComboSelectListItem
{
Text = CurrentCulture == "zh" ? x.DictLabel : x.DictLabelUs,
Value = x.DictValue
}).ToList();
ZoneCodes = dictDatas.Where(x => x.DictType == "ZoneCode").Select(x => new ComboSelectListItem
{
Text = CurrentCulture == "zh" ? x.DictLabel : x.DictLabelUs,
Value = x.DictValue
}).ToList();
Types = dictDatas.Where(x => x.DictType == "LocationType").Select(x => new ComboSelectListItem
{
Text = CurrentCulture == "zh" ? x.DictLabel : x.DictLabelUs,
Value = x.DictValue
}).ToList();
LocationStatus = dictDatas.Where(x => x.DictType == "LocationStatus").Select(x => new ComboSelectListItem
{
Text = CurrentCulture == "zh" ? x.DictLabel : x.DictLabelUs,
Value = x.DictValue
}).ToList();
}
public override void DoAdd()
{
{
base.DoAdd();
}
@@ -94,7 +67,7 @@ namespace HHWMS.Web
{
var locations = DC.Set<Location>()
.Where(l => l.RoadWay == roadway
&& l.Status == "empty"
&& l.Status == LocationStatusEnum.Empty
&& l.RowFlag == 0) // 单伸位只查找外仓位
.OrderBy(l => l.Layer)
.ThenBy(l => l.Line)
@@ -124,10 +97,10 @@ namespace HHWMS.Web
// 1. 优先查找里外仓位都为空的里仓位
var emptyInnerLocation = locationPairs.Values
.Where(l => l.RowFlag == 1
&& l.Status == "empty"
.Where(l => l.RowFlag == RowFlagEnum.Inner
&& l.Status == LocationStatusEnum.Empty
&& locationPairs.TryGetValue(l.ContiguousCode, out var outer)
&& outer.Status == "empty")
&& outer.Status == LocationStatusEnum.Empty)
.OrderBy(l => l.Layer)
.ThenBy(l => l.Line)
.FirstOrDefault();
@@ -140,9 +113,9 @@ namespace HHWMS.Web
// 2. 查找里仓位有货,外仓位为空的外仓位
var availableOuterLocation = locationPairs.Values
.Where(l => l.RowFlag == 0
&& l.Status == "empty"
&& l.Status == LocationStatusEnum.Empty
&& locationPairs.TryGetValue(l.ContiguousCode, out var inner)
&& inner.Status == "some")
&& inner.Status == LocationStatusEnum.Some)
.OrderBy(l => l.Layer)
.ThenBy(l => l.Line)
.FirstOrDefault();
@@ -240,8 +213,7 @@ namespace HHWMS.Web
l.RowFlag,
l.Layer,
l.Line,
l.RoadWay,
l.ZoneCode
l.RoadWay
})
.ToDictionary(l => l.Code);
@@ -265,13 +237,12 @@ namespace HHWMS.Web
{
case "2": // 单伸位
var singleLocations = roadwayLocations
.Where(l => l.RowFlag == 0 && l.Status == "empty")
.Where(l => l.RowFlag == 0 && l.Status == LocationStatusEnum.Empty)
.OrderBy(l => l.Layer)
.ThenBy(l => l.Line)
.Select(l => new
{
LocationCode = l.Code,
l.ZoneCode,
l.RoadWay,
l.Layer,
l.Line,
@@ -283,16 +254,15 @@ namespace HHWMS.Web
case "4": // 双伸位
// 1. 查找里外都为空的里仓位
var emptyInnerLocations = roadwayLocations
.Where(l => l.RowFlag == 1
&& l.Status == "empty"
.Where(l => l.RowFlag == RowFlagEnum.Inner
&& l.Status == LocationStatusEnum.Empty
&& allLocations.TryGetValue(l.ContiguousCode, out var outer)
&& outer.Status == "empty")
&& outer.Status == LocationStatusEnum.Empty)
.OrderBy(l => l.Layer)
.ThenBy(l => l.Line)
.Select(l => new
{
LocationCode = l.Code,
l.ZoneCode,
l.RoadWay,
l.Layer,
l.Line,
@@ -303,15 +273,14 @@ namespace HHWMS.Web
// 2. 查找里仓位有货,外仓位为空的外仓位
var availableOuterLocations = roadwayLocations
.Where(l => l.RowFlag == 0
&& l.Status == "empty"
&& l.Status == LocationStatusEnum.Empty
&& allLocations.TryGetValue(l.ContiguousCode, out var inner)
&& inner.Status == "some")
&& inner.Status == LocationStatusEnum.Some)
.OrderBy(l => l.Layer)
.ThenBy(l => l.Line)
.Select(l => new
{
LocationCode = l.Code,
l.ZoneCode,
l.RoadWay,
l.Layer,
l.Line,
@@ -2,19 +2,20 @@
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:combobox field="Entity.ZoneCode" items="ZoneCodes" />
<wt:combobox field="RoadwayType" items="RoadwayTypes" />
<wt:combobox field="Entity.Type" items="Types" />
<wt:textbox field="BeginLine" />
<wt:textbox field="Entity.Line" label-text=@Localizer["Location.EndLine"] />
<wt:textbox field="BeginLayer" />
<wt:textbox field="Entity.Layer" label-text=@Localizer["Location.EndLayer"] />
<wt:textbox field="Entity.RoadWay" />
<wt:textbox field="Entity.Length" />
<wt:textbox field="Entity.Width" />
<wt:textbox field="Entity.Height" />
</wt:row>
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:combobox field="Entity.LocationZoneId" items="AllLocationZones" empty-text="@Localizer["Sys.All"]"/>
<wt:combobox field="RoadwayType" items="RoadwayTypes" empty-text="@Localizer["Sys.All"]"/>
<wt:combobox field="Entity.Type" empty-text="@Localizer["Sys.All"]"/>
<wt:textbox field="BeginLine"/>
<wt:textbox field="Entity.Line" label-text=@Localizer["Location.EndLine"]/>
<wt:textbox field="BeginLayer"/>
<wt:textbox field="Entity.Layer" label-text=@Localizer["Location.EndLayer"]/>
<wt:textbox field="Entity.RoadWay"/>
<wt:textbox field="Entity.Length"/>
<wt:textbox field="Entity.Width"/>
<wt:textbox field="Entity.Height"/>
</wt:row>
<wt:row align="AlignEnum.Right">
<wt:submitbutton />
<wt:closebutton />
@@ -3,15 +3,16 @@
<wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:combobox field="Entity.LocationZoneId" items="AllLocationZones"/>
<wt:textbox field="Entity.Code" />
<wt:textbox field="Entity.Type" />
<wt:textbox field="Entity.Status" />
<wt:combobox field="Entity.Type" />
<wt:combobox field="Entity.Status" />
<wt:textbox field="Entity.RoadWay" />
<wt:textbox field="Entity.Row" />
<wt:textbox field="Entity.Line" />
<wt:textbox field="Entity.Layer" />
<wt:textbox field="Entity.RoadWay" />
<wt:combobox field="Entity.RowFlag" />
<wt:textbox field="Entity.ContainerCode" />
<wt:textbox field="Entity.ZoneCode" />
<wt:switch field="Entity.IsStop" />
<wt:textbox field="Entity.Length" />
<wt:textbox field="Entity.Width" />
@@ -4,15 +4,16 @@
<wt:form vm="@Model">
<wt:quote>@Localizer["Sys.DeleteConfirm"]</wt:quote>
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:display field="Entity.LocationZone.Name" />
<wt:display field="Entity.Code" />
<wt:display field="Entity.Type" />
<wt:display field="Entity.Status" />
<wt:display field="Entity.RoadWay" />
<wt:display field="Entity.Row" />
<wt:display field="Entity.Line" />
<wt:display field="Entity.Layer" />
<wt:display field="Entity.RoadWay" />
<wt:display field="Entity.RowFlag" />
<wt:display field="Entity.ContainerCode" />
<wt:display field="Entity.ZoneCode" />
<wt:display field="Entity.IsStop" />
<wt:display field="Entity.Length" />
<wt:display field="Entity.Width" />
@@ -1,26 +1,24 @@
@model HHWMS.Web.LocationVM
@model HHWMS.Web.LocationVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:display field="Entity.LocationZone.Name" />
<wt:display field="Entity.Code" />
@* <wt:display field="Entity.Type" />
<wt:display field="Entity.Type" />
<wt:display field="Entity.Status" />
<wt:display field="Entity.RoadWay" />
<wt:display field="Entity.Row" />
<wt:display field="Entity.Line" />
<wt:display field="Entity.Layer" />
<wt:display field="Entity.RoadWay" />
<wt:display field="Entity.RowFlag" />
<wt:display field="Entity.ContainerCode" />
<wt:display field="Entity.ZoneCode" />
<wt:display field="Entity.IsStop" />
<wt:display field="Entity.Length" />
<wt:display field="Entity.Width" />
<wt:display field="Entity.Height" />
<wt:display field="Entity.ContiguousCode" /> *@
<wt:display field="Entity.ContiguousCode" />
</wt:row>
<wt:grid vm="@Model.Inventorys" height="300" hidden-checkbox="true" hidden-grid-index="true" use-local-data="true" hidden-panel="true"/>
<wt:row align="AlignEnum.Right">
<wt:closebutton />
</wt:row>
@@ -1,17 +1,18 @@
@model HHWMS.Web.LocationVM
@model HHWMS.Web.LocationVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:combobox field="Entity.LocationZoneId" items="AllLocationZones"/>
<wt:textbox field="Entity.Code" />
<wt:combobox field="Entity.Type" items="Types" />
<wt:combobox field="Entity.Status" items="LocationStatus" />
<wt:combobox field="Entity.Type" />
<wt:combobox field="Entity.Status" />
<wt:textbox field="Entity.RoadWay" />
<wt:textbox field="Entity.Row" />
<wt:textbox field="Entity.Line" />
<wt:textbox field="Entity.Layer" />
<wt:textbox field="Entity.RoadWay" />
<wt:combobox field="Entity.RowFlag" />
<wt:textbox field="Entity.ContainerCode" />
<wt:combobox field="Entity.ZoneCode" items="ZoneCodes"/>
<wt:switch field="Entity.IsStop" />
<wt:textbox field="Entity.Length" />
<wt:textbox field="Entity.Width" />
@@ -1,22 +1,20 @@
@model HHWMS.Web.LocationListVM
@model HHWMS.Web.LocationListVM
@inject IStringLocalizer<Program> Localizer;
<wt:searchpanel vm="@Model" reset-btn="true">
<wt:row items-per-row="ItemsPerRowEnum.Three">
<wt:combobox field="Searcher.ZoneCode" items="ZoneCodes" />
<wt:combobox field="Searcher.LocationZoneId" items="Searcher.AllLocationZones" empty-text="@Localizer["Sys.All"]" />
<wt:textbox field="Searcher.Code" />
@* <wt:combobox field="Searcher.Type" items="Types" />
<wt:combobox field="Searcher.Status" items="LocationStatus" />
<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:combobox field="Searcher.Type" empty-text="@Localizer["Sys.All"]" />
<wt:combobox field="Searcher.Status" empty-text="@Localizer["Sys.All"]" />
<wt:textbox field="Searcher.RoadWay" />
<wt:combobox field="Searcher.IsStop" empty-text="@Localizer["Sys.All"]" />
<wt:combobox field="Searcher.RowFlag" empty-text="@Localizer["Sys.All"]" />
</wt:row>
</wt:searchpanel>
<wt:grid vm="@Model" url="/configs/Location/Search"/>
<script>
let template = {
"panels": [
@@ -144,7 +144,7 @@ namespace HHWMS.Web.Controllers
}
else
{
return FFResult().CloseDialog().RefreshGridRow(vm.Entity.ID);
return FFResult().CloseDialog().RefreshGrid(index: 1);
}
}
}
@@ -21,8 +21,6 @@ namespace HHWMS.Web
protected override void InitVM()
{
var vm = Wtm.CreateVM<LocationVM>();
ZoneCodes = vm.ZoneCodes;
}
public override void DoAdd()