添加项目文件。
This commit is contained in:
1 parent
05e131ca4e
commit
514d6f5255
1162 files changed
+81255
No files matched your search
@@ -0,0 +1,197 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using HHWMS.Web.Models;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using WalkingTec.Mvvm.Core.Extensions;
|
||||
|
||||
namespace HHWMS.Web
|
||||
{
|
||||
public partial class LocationVM : BaseCRUDVM<Location>
|
||||
{
|
||||
[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()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void InitVM()
|
||||
{
|
||||
_unitWork = new UnitWork(Wtm);
|
||||
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();
|
||||
}
|
||||
|
||||
public override void DoEdit(bool updateAllFields = false)
|
||||
{
|
||||
base.DoEdit(updateAllFields);
|
||||
}
|
||||
|
||||
public override void DoDelete()
|
||||
{
|
||||
base.DoDelete();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找库位
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ResponseResult<dynamic> GetLocation(WcsRequest request)
|
||||
{
|
||||
var res = ResponseResult<dynamic>.Success(new {LocationCode = "test"});
|
||||
return res;
|
||||
//return GetOutEmptyLocation(request);
|
||||
/*if (request.RoadWay == null)
|
||||
{
|
||||
// 根据条件查询巷道 (巷道均分,根据托盘类型分)
|
||||
request.RoadWay = SelectRoadWay(request);
|
||||
if(SelectRoadWay(request) == 0)
|
||||
{
|
||||
return ResponseResult<dynamic>.Error("未找到可用巷道!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 查询该巷道类型 调用不同的方法
|
||||
return GetLocationByOne(request);
|
||||
}
|
||||
return "";*/
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 单伸位 查找仓位
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string GetLocationByOne(WcsRequest request)
|
||||
{
|
||||
// 根据托盘类型/传入的长宽高 查找库位
|
||||
var locationList = _unitWork.Find<Location>(x => x.RoadWay == request.RoadWay);
|
||||
locationList = locationList.WhereIf(request.Length > 0, x => x.Length == request.Length)
|
||||
.WhereIf(request.Width > 0, x => x.Width == request.Width)
|
||||
.WhereIf(request.Height > 0, x => x.Height >= request.Height)
|
||||
.OrderBy(x => x.Height);
|
||||
var location = locationList.OrderBy(x => x.Layer)
|
||||
.ThenBy(x => x.Line)
|
||||
.FirstOrDefault();
|
||||
return location?.Code;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 双伸位 查找仓位
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string GetLocationByTwo(WcsRequest request)
|
||||
{
|
||||
// 根据托盘类型 查找库位 todo
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 双伸位,获取里仓位有货,外仓位无货的仓位
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string GetOutEmptyLocation(WcsRequest request)
|
||||
{
|
||||
int roadWay = (int)request.RoadWay;
|
||||
var locationList = _unitWork.Find<Location>(x => x.RoadWay == roadWay)
|
||||
.Join(_unitWork.Find<Location>(x => x.RoadWay == roadWay),
|
||||
a => a.ContiguousCode, g => g.Code,
|
||||
(a, g) => new
|
||||
{
|
||||
a.Code,
|
||||
a.Status,
|
||||
a.RowFlag,
|
||||
a.Layer,
|
||||
a.Line,
|
||||
ContiguousCode = g.Code,
|
||||
Status1 = g.Status
|
||||
}).ToList();
|
||||
var location = locationList.Where(x => x.RowFlag == 0 && x.Status == "empty" && x.Status1 == "some")
|
||||
.OrderBy(x => x.Layer)
|
||||
.ThenBy(x => x.Line)
|
||||
.FirstOrDefault()?.Code;
|
||||
return location;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 双伸位,获取里外仓位都为空的仓位
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="rowFlag">0 返回外仓位,1返回里仓位</param>
|
||||
/// <returns></returns>
|
||||
public string GetAllEmptyLocation(WcsRequest request, int rowFlag)
|
||||
{
|
||||
int roadWay = (int)request.RoadWay;
|
||||
var locationList = _unitWork.Find<Location>(x => x.RoadWay == roadWay)
|
||||
.Join(_unitWork.Find<Location>(x => x.RoadWay == roadWay),
|
||||
a => a.ContiguousCode, g => g.Code,
|
||||
(a, g) => new
|
||||
{
|
||||
a.Code,
|
||||
a.Status,
|
||||
a.RowFlag,
|
||||
a.Layer,
|
||||
a.Line,
|
||||
ContiguousCode = g.Code,
|
||||
Status1 = g.Status
|
||||
}).ToList();
|
||||
var location = locationList.Where(x => x.RowFlag == rowFlag && x.Status == "empty" && x.Status1 == "empty")
|
||||
.OrderBy(x => x.Layer)
|
||||
.ThenBy(x => x.Line)
|
||||
.FirstOrDefault()?.Code;
|
||||
return location;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据传入条件,查找可利用巷道
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public int SelectRoadWay(WcsRequest request)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user