|
@@ -43,6 +43,27 @@ namespace wms.service.Service
|
|
|
private readonly ISXDataService _sxtDataService;
|
|
|
private static object lockerPalletizingPackTask = new object();
|
|
|
private static object lockerApplyLoc = new object();
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 包材-托盘重量
|
|
|
+ /// </summary>
|
|
|
+ private static decimal TuoPan { get => 12.6M; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 包材-塑料袋重量
|
|
|
+ /// </summary>
|
|
|
+ private static decimal SuLiaoDai { get => 1.03M; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 包材-隔板重量
|
|
|
+ /// </summary>
|
|
|
+ private static decimal GeBan { get => 0.77M; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 包材-纸箱重量
|
|
|
+ /// </summary>
|
|
|
+ private static decimal ZhiXiang { get => 1.09M; }
|
|
|
+
|
|
|
//static object lockerMoveTake = new object();
|
|
|
|
|
|
public SXService(IMapper mapper, ILogger<SXService> logger, ISXDataService sxtDataService)
|
|
@@ -754,7 +775,7 @@ namespace wms.service.Service
|
|
|
foreach (var item in reqDto.listinfo)
|
|
|
{
|
|
|
var boxrule = _boxrulerepository.AsQueryable().Where(x => x.DocsNo.Contains(item)).ToList();
|
|
|
- var boxruleId= boxrule.Where(x => x.ZXStateCode == 0).Select(x=>x.Id).ToList();
|
|
|
+ var boxruleId = boxrule.Where(x => x.ZXStateCode == 0).Select(x => x.Id).ToList();
|
|
|
if (boxruleId.Any())
|
|
|
{
|
|
|
_db.BeginTran();
|
|
@@ -3263,39 +3284,43 @@ namespace wms.service.Service
|
|
|
}
|
|
|
var packinfo = _packInforepository.GetList(p => p.MatCode == boxcode.TrayCode).First();
|
|
|
var packlist = _packInforepository.GetList(p => p.PackCode == boxcode.Dryer);
|
|
|
- decimal wqty = 0;
|
|
|
- if (packlist.Any())
|
|
|
- {
|
|
|
- decimal tuopanqty = 0;
|
|
|
- decimal packsqty = 0;
|
|
|
- decimal dituoqty = 0;
|
|
|
- decimal gebanqty = 0;
|
|
|
- if (packlist.Any(p => p.MatCode == "C06-02-09-0043"))
|
|
|
- {
|
|
|
- var tuopan = packlist.Where(p => p.MatCode == "C06-02-09-0043").FirstOrDefault();
|
|
|
- tuopanqty = tuopan.Count * tuopan.Weight / 1000;
|
|
|
- }
|
|
|
- if (packlist.Any(p => p.MatCode == "C12-01-08-0004"))
|
|
|
- {
|
|
|
- var packs = packlist.Where(p => p.MatCode == "C12-01-08-0004").FirstOrDefault();
|
|
|
- packsqty = packs.Count * packs.Weight / 1000;
|
|
|
- }
|
|
|
- if (packlist.Any(p => p.MatCode == "C12-01-10-0003"))
|
|
|
- {
|
|
|
- var dituo = packlist.Where(p => p.MatCode == "C12-01-10-0003").FirstOrDefault();
|
|
|
- dituoqty = dituo.Count * dituo.Weight / 1000;
|
|
|
- }
|
|
|
- if (packlist.Any(p => p.MatCode == "C12-01-09-0003"))
|
|
|
- {
|
|
|
- var geban = packlist.Where(p => p.MatCode == "C12-01-09-0003").FirstOrDefault();
|
|
|
- gebanqty = 1 * geban.Weight / 1000;
|
|
|
- }
|
|
|
- wqty = tuopanqty + packsqty + dituoqty + gebanqty;
|
|
|
- }
|
|
|
- if (wqty == 0)
|
|
|
+ decimal wqty = boxcode.BaoCaiWeight;
|
|
|
+ if (wqty == null || wqty <= 0)
|
|
|
{
|
|
|
- wqty = 16;
|
|
|
+ wqty = TuoPan + SuLiaoDai + GeBan + ZhiXiang;
|
|
|
}
|
|
|
+ //if (packlist.Any())
|
|
|
+ //{
|
|
|
+ // decimal tuopanqty = 0;
|
|
|
+ // decimal packsqty = 0;
|
|
|
+ // decimal dituoqty = 0;
|
|
|
+ // decimal gebanqty = 0;
|
|
|
+ // if (packlist.Any(p => p.MatCode == "C06-02-09-0043"))
|
|
|
+ // {
|
|
|
+ // var tuopan = packlist.Where(p => p.MatCode == "C06-02-09-0043").FirstOrDefault();
|
|
|
+ // tuopanqty = tuopan.Count * tuopan.Weight / 1000;
|
|
|
+ // }
|
|
|
+ // if (packlist.Any(p => p.MatCode == "C12-01-08-0004"))
|
|
|
+ // {
|
|
|
+ // var packs = packlist.Where(p => p.MatCode == "C12-01-08-0004").FirstOrDefault();
|
|
|
+ // packsqty = packs.Count * packs.Weight / 1000;
|
|
|
+ // }
|
|
|
+ // if (packlist.Any(p => p.MatCode == "C12-01-10-0003"))
|
|
|
+ // {
|
|
|
+ // var dituo = packlist.Where(p => p.MatCode == "C12-01-10-0003").FirstOrDefault();
|
|
|
+ // dituoqty = dituo.Count * dituo.Weight / 1000;
|
|
|
+ // }
|
|
|
+ // if (packlist.Any(p => p.MatCode == "C12-01-09-0003"))
|
|
|
+ // {
|
|
|
+ // var geban = packlist.Where(p => p.MatCode == "C12-01-09-0003").FirstOrDefault();
|
|
|
+ // gebanqty = 1 * geban.Weight / 1000;
|
|
|
+ // }
|
|
|
+ // wqty = tuopanqty + packsqty + dituoqty + gebanqty;
|
|
|
+ //}
|
|
|
+ //if (wqty == 0)
|
|
|
+ //{
|
|
|
+ // wqty = 16;
|
|
|
+ //}
|
|
|
|
|
|
//判断托盘号是否一致
|
|
|
//var wcstask = _wcstaskoldrepository.AsQueryable().Where(p => p.Id == palletizing.TaskNum).SplitTable(tabs => tabs.Take(2)).First(); ;
|
|
@@ -5324,7 +5349,8 @@ namespace wms.service.Service
|
|
|
if (solcount <= 0)
|
|
|
{
|
|
|
solcount = 0;
|
|
|
- };
|
|
|
+ }
|
|
|
+ ;
|
|
|
solderinvlist = invlist2.Where(p => p.SolderCount <= rule.PerSolderMaxCount && p.SolderCount > 0).OrderBy(p => p.ProductTime).ThenByDescending(p => p.SolderCount).Take(solcount).ToList();
|
|
|
invlist2 = invlist2.Where(p => p.SolderCount == 0);
|
|
|
}
|
|
@@ -6427,7 +6453,7 @@ namespace wms.service.Service
|
|
|
//判断缓存工位2是否有空余,并且缓存工位1的托盘要到位
|
|
|
var equlist = HttpUtil.PostRequest("http://10.30.43.1:8080/api/Wcs/GetDevicePalletizingEquip", JsonConvert.SerializeObject(""));
|
|
|
var devices1 = JsonConvert.DeserializeObject<List<DevincePh1>>(equlist);
|
|
|
- var huancun1list = new List<string>() { "8089", "8091", "8095", "8097","8306" };
|
|
|
+ var huancun1list = new List<string>() { "8089", "8091", "8095", "8097", "8306" };
|
|
|
if (!devices1.Where(p => huancun1list.Contains(p.deviceCode) && p.TaskCode > 0).Any())
|
|
|
{
|
|
|
RedisHelper.Set("Sx:WMSErrorInfo:ControlOut4", new RedisErrorInfo() { Equip = "ControlOut4", Con = "没有空闲的码垛工位及缓存工位", Time = DateTime.Now });
|
|
@@ -6502,7 +6528,7 @@ namespace wms.service.Service
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- var robotlist = new List<string>() { "Robot1", "Robot2","Robot3" };
|
|
|
+ var robotlist = new List<string>() { "Robot1", "Robot2", "Robot3" };
|
|
|
sxSysConfig palletequip = null;
|
|
|
foreach (var robot in robotlist)
|
|
|
{
|
|
@@ -7175,7 +7201,8 @@ namespace wms.service.Service
|
|
|
if (solcount <= 0)
|
|
|
{
|
|
|
solcount = 0;
|
|
|
- };
|
|
|
+ }
|
|
|
+ ;
|
|
|
solderinvlist = invlist2.Where(p => p.SolderCount <= rule.PerSolderMaxCount && p.SolderCount > 0).OrderBy(p => p.ProductTime).ThenByDescending(p => p.SolderCount).Take(solcount).ToList();
|
|
|
invlist2 = invlist2.Where(p => p.SolderCount == 0);
|
|
|
}
|
|
@@ -7708,80 +7735,80 @@ namespace wms.service.Service
|
|
|
|
|
|
#region 重绕盘老规则
|
|
|
|
|
|
-//找到重绕盘,拼接进去,重绕盘不需要扭转
|
|
|
-//var invlistchongrao = from loc in _basewarecellrepository.GetList(p => p.IsStop == LocationStop.LocationInvoke.GetHashCode() && p.StateNum == LocationState.LocationState_Full)
|
|
|
-// join stock in _billInvnowrepository.GetList(p => p.InvStateCode == InvState.InvEcecState_In.ToString() && p.ExecStateCode == InvLockState.InvState_Normal.ToString() && p.Grade == "A" && (p.InDocsNo.StartsWith("CHA")) && string.IsNullOrEmpty(p.PreStock) && p.ContUsageQty <= 0
|
|
|
-// && item.Key.StartsWith(p.MatCode) && p.Wind == rule.Wind && (DateTime.Now - p.OneInTime).TotalHours < timeOutHoldHours)
|
|
|
-// on loc.ContGrpBarCode equals stock.ContGrpBarCode
|
|
|
-// where rule.SkuCode.StartsWith(stock.MatCode) && stock.HWTypeCode == rule.SpoolType
|
|
|
-// select new StockTemp
|
|
|
-// {
|
|
|
-// MatCode = stock.MatCode,
|
|
|
-// InvBarCode = stock.InvBarCode,
|
|
|
-// Grade = stock.Grade,
|
|
|
-// InvStateCode = stock.InvStateCode,
|
|
|
-// ProductTime = stock.ProductTime,
|
|
|
-// WbGroupCode = stock.WbGroupCode,
|
|
|
-// IsTorsChk = stock.IsTorsChk,
|
|
|
-// TorsChkQty = stock.TorsChkQty,
|
|
|
-// TorsChkValue = stock.TorsChkValue,
|
|
|
-// HoldTime = stock.HoldTime,
|
|
|
-// InDocsNo = stock.InDocsNo,
|
|
|
-// ProductMachCode = stock.ProductMachCode,
|
|
|
-// IsControlpanel = stock.IsControlpanel,
|
|
|
-// HWTypeCode = stock.HWTypeCode,
|
|
|
-// SolderCount = stock.SolderCount,
|
|
|
-// IsRework = stock.IsRework,
|
|
|
-// IsBlack = stock.IsBlack,
|
|
|
-// Col = loc.Col,
|
|
|
-// Layer = loc.Layer,
|
|
|
-// Shelf = loc.Shelf,
|
|
|
-// Depth = loc.Depth,
|
|
|
-// Code = loc.Code,
|
|
|
-// Tunnel = loc.Tunnel,
|
|
|
-// SCRel = loc.SCRel,
|
|
|
-// Floor = loc.Floor,
|
|
|
-// WarehouseCode = loc.WarehouseCode,
|
|
|
-// ContGrpBarCode = loc.ContGrpBarCode,
|
|
|
-// ContGrpId = loc.ContGrpId,
|
|
|
-// Id = loc.Id,
|
|
|
-// StateNum = loc.StateNum,
|
|
|
-// SkuCode = "",
|
|
|
-// Wind = stock.Wind
|
|
|
-// };
|
|
|
-//过滤重饶盘被禁用的巷道
|
|
|
-//invlistchongrao = invlistchongrao.Distinct();
|
|
|
-//if (tunlist.Any())
|
|
|
-//{
|
|
|
-// if (tunlist.Where(p => p.Default2 == "1").Any())
|
|
|
-// {
|
|
|
-// var inv1 = invlistchongrao.Where(p => p.Floor == 1 && tunlist.Where(x => x.Default2 == "1").Select(x => x.Default1).ToList().Contains(p.Tunnel.ToString()));
|
|
|
-// var inv2 = inv1.Select(p => p.ContGrpBarCode).ToList();
|
|
|
-// invlistchongrao = invlistchongrao.Where(p => !inv2.Contains(p.ContGrpBarCode)); //过滤1层被禁用的出库巷道
|
|
|
-// }
|
|
|
-// if (tunlist.Where(p => p.Default2 == "2").Any())
|
|
|
-// {
|
|
|
-// var inv1 = invlistchongrao.Where(p => p.Floor == 2 && tunlist.Where(x => x.Default2 == "2").Select(x => x.Default1).ToList().Contains(p.Tunnel.ToString()));
|
|
|
-// var inv2 = inv1.Select(p => p.ContGrpBarCode).ToList();
|
|
|
-// invlistchongrao = invlistchongrao.Where(p => !inv2.Contains(p.ContGrpBarCode)); //过滤2层被禁用的出库巷道
|
|
|
-// }
|
|
|
-// if (tunlist.Where(p => p.Default2 == "3").Any())
|
|
|
-// {
|
|
|
-// var inv1 = invlistchongrao.Where(p => p.Floor == 3 && tunlist.Where(x => x.Default2 == "3").Select(x => x.Default1).ToList().Contains(p.Tunnel.ToString()));
|
|
|
-// var inv2 = inv1.Select(p => p.ContGrpBarCode).ToList();
|
|
|
-// invlistchongrao = invlistchongrao.Where(p => !inv2.Contains(p.ContGrpBarCode)); //过滤3层被禁用的出库巷道
|
|
|
-// }
|
|
|
-//}
|
|
|
-
|
|
|
-//重绕盘数量限制BS80 10个(30%);BS60 21个(30%);BS40 21个(30%)
|
|
|
-//if (rule.SpoolType == "BS60" || rule.SpoolType == "BS40")
|
|
|
-//{
|
|
|
-// invlistchongrao = invlistchongrao.Take(21);
|
|
|
-//}
|
|
|
-//else
|
|
|
-//{
|
|
|
-// invlistchongrao = invlistchongrao.Take(10);
|
|
|
-//}
|
|
|
+ //找到重绕盘,拼接进去,重绕盘不需要扭转
|
|
|
+ //var invlistchongrao = from loc in _basewarecellrepository.GetList(p => p.IsStop == LocationStop.LocationInvoke.GetHashCode() && p.StateNum == LocationState.LocationState_Full)
|
|
|
+ // join stock in _billInvnowrepository.GetList(p => p.InvStateCode == InvState.InvEcecState_In.ToString() && p.ExecStateCode == InvLockState.InvState_Normal.ToString() && p.Grade == "A" && (p.InDocsNo.StartsWith("CHA")) && string.IsNullOrEmpty(p.PreStock) && p.ContUsageQty <= 0
|
|
|
+ // && item.Key.StartsWith(p.MatCode) && p.Wind == rule.Wind && (DateTime.Now - p.OneInTime).TotalHours < timeOutHoldHours)
|
|
|
+ // on loc.ContGrpBarCode equals stock.ContGrpBarCode
|
|
|
+ // where rule.SkuCode.StartsWith(stock.MatCode) && stock.HWTypeCode == rule.SpoolType
|
|
|
+ // select new StockTemp
|
|
|
+ // {
|
|
|
+ // MatCode = stock.MatCode,
|
|
|
+ // InvBarCode = stock.InvBarCode,
|
|
|
+ // Grade = stock.Grade,
|
|
|
+ // InvStateCode = stock.InvStateCode,
|
|
|
+ // ProductTime = stock.ProductTime,
|
|
|
+ // WbGroupCode = stock.WbGroupCode,
|
|
|
+ // IsTorsChk = stock.IsTorsChk,
|
|
|
+ // TorsChkQty = stock.TorsChkQty,
|
|
|
+ // TorsChkValue = stock.TorsChkValue,
|
|
|
+ // HoldTime = stock.HoldTime,
|
|
|
+ // InDocsNo = stock.InDocsNo,
|
|
|
+ // ProductMachCode = stock.ProductMachCode,
|
|
|
+ // IsControlpanel = stock.IsControlpanel,
|
|
|
+ // HWTypeCode = stock.HWTypeCode,
|
|
|
+ // SolderCount = stock.SolderCount,
|
|
|
+ // IsRework = stock.IsRework,
|
|
|
+ // IsBlack = stock.IsBlack,
|
|
|
+ // Col = loc.Col,
|
|
|
+ // Layer = loc.Layer,
|
|
|
+ // Shelf = loc.Shelf,
|
|
|
+ // Depth = loc.Depth,
|
|
|
+ // Code = loc.Code,
|
|
|
+ // Tunnel = loc.Tunnel,
|
|
|
+ // SCRel = loc.SCRel,
|
|
|
+ // Floor = loc.Floor,
|
|
|
+ // WarehouseCode = loc.WarehouseCode,
|
|
|
+ // ContGrpBarCode = loc.ContGrpBarCode,
|
|
|
+ // ContGrpId = loc.ContGrpId,
|
|
|
+ // Id = loc.Id,
|
|
|
+ // StateNum = loc.StateNum,
|
|
|
+ // SkuCode = "",
|
|
|
+ // Wind = stock.Wind
|
|
|
+ // };
|
|
|
+ //过滤重饶盘被禁用的巷道
|
|
|
+ //invlistchongrao = invlistchongrao.Distinct();
|
|
|
+ //if (tunlist.Any())
|
|
|
+ //{
|
|
|
+ // if (tunlist.Where(p => p.Default2 == "1").Any())
|
|
|
+ // {
|
|
|
+ // var inv1 = invlistchongrao.Where(p => p.Floor == 1 && tunlist.Where(x => x.Default2 == "1").Select(x => x.Default1).ToList().Contains(p.Tunnel.ToString()));
|
|
|
+ // var inv2 = inv1.Select(p => p.ContGrpBarCode).ToList();
|
|
|
+ // invlistchongrao = invlistchongrao.Where(p => !inv2.Contains(p.ContGrpBarCode)); //过滤1层被禁用的出库巷道
|
|
|
+ // }
|
|
|
+ // if (tunlist.Where(p => p.Default2 == "2").Any())
|
|
|
+ // {
|
|
|
+ // var inv1 = invlistchongrao.Where(p => p.Floor == 2 && tunlist.Where(x => x.Default2 == "2").Select(x => x.Default1).ToList().Contains(p.Tunnel.ToString()));
|
|
|
+ // var inv2 = inv1.Select(p => p.ContGrpBarCode).ToList();
|
|
|
+ // invlistchongrao = invlistchongrao.Where(p => !inv2.Contains(p.ContGrpBarCode)); //过滤2层被禁用的出库巷道
|
|
|
+ // }
|
|
|
+ // if (tunlist.Where(p => p.Default2 == "3").Any())
|
|
|
+ // {
|
|
|
+ // var inv1 = invlistchongrao.Where(p => p.Floor == 3 && tunlist.Where(x => x.Default2 == "3").Select(x => x.Default1).ToList().Contains(p.Tunnel.ToString()));
|
|
|
+ // var inv2 = inv1.Select(p => p.ContGrpBarCode).ToList();
|
|
|
+ // invlistchongrao = invlistchongrao.Where(p => !inv2.Contains(p.ContGrpBarCode)); //过滤3层被禁用的出库巷道
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+
|
|
|
+ //重绕盘数量限制BS80 10个(30%);BS60 21个(30%);BS40 21个(30%)
|
|
|
+ //if (rule.SpoolType == "BS60" || rule.SpoolType == "BS40")
|
|
|
+ //{
|
|
|
+ // invlistchongrao = invlistchongrao.Take(21);
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // invlistchongrao = invlistchongrao.Take(10);
|
|
|
+ //}
|
|
|
|
|
|
#endregion 重绕盘老规则
|
|
|
|
|
@@ -7822,7 +7849,8 @@ namespace wms.service.Service
|
|
|
if (solcount <= 0)
|
|
|
{
|
|
|
solcount = 0;
|
|
|
- };
|
|
|
+ }
|
|
|
+ ;
|
|
|
solderinvlist = invlist2.Where(p => p.SolderCount <= rule.PerSolderMaxCount && p.SolderCount > 0).OrderBy(p => p.ProductTime).ThenByDescending(p => p.SolderCount).Take(solcount).ToList();
|
|
|
invlist2 = invlist2.Where(p => p.SolderCount == 0);
|
|
|
}
|
|
@@ -13166,134 +13194,151 @@ namespace wms.service.Service
|
|
|
public SRes<int> TorsChkFloor(TorsChkFloorRequest reqDto)
|
|
|
{
|
|
|
var res = new SRes<int>();
|
|
|
- if (reqDto.Count <= 0)
|
|
|
+ try
|
|
|
{
|
|
|
- res.ResCode = ResponseStatusCodeEnum.ErrParam.GetHashCode();
|
|
|
- res.ResMsg = ResponseStatusCodeEnum.ErrParam.GetDescription() + "任务数量不能为0";
|
|
|
- RedisHelper.Set("Sx:WMSErrorInfo:TorsChkEquip6", new RedisErrorInfo() { Equip = "TorsChkEquip6", Con = "参数错误,请求任务数量不能为0", Time = DateTime.Now });
|
|
|
- return res;
|
|
|
- }
|
|
|
- var floorTaskCount = int.Parse(_sysconfigrepository.GetFirst(p => p.Code == "FloorTaskCount").SContent);
|
|
|
- var bar = _taskrepository.AsQueryable().With(SqlWith.NoLock).Where(p => p.Type == TaskType.EnterDepot && p.Status < TaskStatus.Finish && p.BusType == "扭转回库").OrderByDescending(p => p.AddTime).First();
|
|
|
- var stock = _billInvnowrepository.AsQueryable().With(SqlWith.NoLock).Where(p => p.ContGrpBarCode == bar.BarCode && p.InvStateCode == "InvEcecState_BuildUp").First();
|
|
|
- var currentTime = stock.ProductTime;
|
|
|
+ if (reqDto.Count <= 0)
|
|
|
+ {
|
|
|
+ res.ResCode = ResponseStatusCodeEnum.ErrParam.GetHashCode();
|
|
|
+ res.ResMsg = ResponseStatusCodeEnum.ErrParam.GetDescription() + "任务数量不能为0";
|
|
|
+ RedisHelper.Set("Sx:WMSErrorInfo:TorsChkEquip6", new RedisErrorInfo() { Equip = "TorsChkEquip6", Con = "参数错误,请求任务数量不能为0", Time = DateTime.Now });
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ var floorTaskCount = int.Parse(_sysconfigrepository.GetFirst(p => p.Code == "FloorTaskCount").SContent);
|
|
|
+ var bar = _taskrepository.AsQueryable().With(SqlWith.NoLock).Where(p => p.Type == TaskType.EnterDepot && p.Status < TaskStatus.Finish && p.BusType == "扭转回库").OrderByDescending(p => p.AddTime).First();
|
|
|
+ if (bar == null)
|
|
|
+ {
|
|
|
+ res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
|
|
|
+ res.ResMsg = "没有扭转回库任务需要分配楼层";
|
|
|
+ RedisHelper.Set("Sx:WMSErrorInfo:TorsChkEquip6", new RedisErrorInfo() { Equip = "TorsChkEquip6", Con = "没有扭转回库任务需要分配楼层,请检查扭转回库位置任务实际是否有货", Time = DateTime.Now });
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ var stock = _billInvnowrepository.AsQueryable().With(SqlWith.NoLock).Where(p => p.ContGrpBarCode == bar.BarCode && p.InvStateCode == "InvEcecState_BuildUp").First();
|
|
|
+ var currentTime = stock.ProductTime;
|
|
|
|
|
|
- var startTime = currentTime.Hour >= 13 ? currentTime.Date.AddHours(13) : currentTime.Date.AddDays(-1).AddHours(13);
|
|
|
- var endTime = currentTime.Hour >= 13 ? currentTime.Date.AddDays(1).AddHours(8) : currentTime.Date.AddHours(8);
|
|
|
+ var startTime = currentTime.Hour >= 13 ? currentTime.Date.AddHours(13) : currentTime.Date.AddDays(-1).AddHours(13);
|
|
|
+ var endTime = currentTime.Hour >= 13 ? currentTime.Date.AddDays(1).AddHours(8) : currentTime.Date.AddHours(8);
|
|
|
|
|
|
- //今天这一批次的扭转入库的分配楼层数量
|
|
|
- var existstock = _billInvnowrepository.AsQueryable().With(SqlWith.NoLock).Where(p => p.InvStateCode == InvState.InvEcecState_In.ToString() && p.IsTorsChk == true && p.TorsChkQty == 1 && p.ProductTime >= startTime && p.ProductTime <= endTime).ToList();
|
|
|
- int row = 8;
|
|
|
- var cellfloor1stockcount = existstock.Where(p => p.PutLayer >= 1 && p.PutLayer <= 4 && p.PutRow > row).Count(); //1楼层同规格数量
|
|
|
- var cellfloor2stockcount = existstock.Where(p => p.PutLayer >= 5 && p.PutLayer <= 8 && p.PutRow > row).Count(); //2楼层同规格数量
|
|
|
- var cellfloor3stockcount = existstock.Where(p => p.PutLayer >= 9 && p.PutLayer <= 12 && p.PutRow > row).Count(); //3楼层同规格数量
|
|
|
+ //今天这一批次的扭转入库的分配楼层数量
|
|
|
+ var existstock = _billInvnowrepository.AsQueryable().With(SqlWith.NoLock).Where(p => p.InvStateCode == InvState.InvEcecState_In.ToString() && p.IsTorsChk == true && p.TorsChkQty == 1 && p.ProductTime >= startTime && p.ProductTime <= endTime).ToList();
|
|
|
+ int row = 8;
|
|
|
+ var cellfloor1stockcount = existstock.Where(p => p.PutLayer >= 1 && p.PutLayer <= 4 && p.PutRow > row).Count(); //1楼层同规格数量
|
|
|
+ var cellfloor2stockcount = existstock.Where(p => p.PutLayer >= 5 && p.PutLayer <= 8 && p.PutRow > row).Count(); //2楼层同规格数量
|
|
|
+ var cellfloor3stockcount = existstock.Where(p => p.PutLayer >= 9 && p.PutLayer <= 12 && p.PutRow > row).Count(); //3楼层同规格数量
|
|
|
|
|
|
- //bool isTobeTors = false;
|
|
|
- int tun = 2;
|
|
|
- //int row = 8;
|
|
|
- var cell = _basewarecellrepository.AsQueryable().With(SqlWith.NoLock).Where(p => p.IsStop == LocationStop.LocationInvoke.GetHashCode() && p.StateNum == LocationState.LocationState_Empty).ToList();
|
|
|
+ //bool isTobeTors = false;
|
|
|
+ int tun = 2;
|
|
|
+ //int row = 8;
|
|
|
+ var cell = _basewarecellrepository.AsQueryable().With(SqlWith.NoLock).Where(p => p.IsStop == LocationStop.LocationInvoke.GetHashCode() && p.StateNum == LocationState.LocationState_Empty).ToList();
|
|
|
|
|
|
- var disabletunnels = _sysconfigrepository.GetList(p => p.SType == "InStop" && !string.IsNullOrEmpty(p.SContent));
|
|
|
- if (disabletunnels != null && disabletunnels.Any())
|
|
|
- {
|
|
|
- foreach (var item in disabletunnels)
|
|
|
+ var disabletunnels = _sysconfigrepository.GetList(p => p.SType == "InStop" && !string.IsNullOrEmpty(p.SContent));
|
|
|
+ if (disabletunnels != null && disabletunnels.Any())
|
|
|
{
|
|
|
- var distun = int.Parse(item.Default1);
|
|
|
- var disfloor = int.Parse(item.Default2);
|
|
|
- var disids = cell.Where(p => p.Floor == disfloor && p.Tunnel == distun).Select(p => p.Id);
|
|
|
- cell = cell.Where(p => !disids.Contains(p.Id)).ToList();
|
|
|
+ foreach (var item in disabletunnels)
|
|
|
+ {
|
|
|
+ var distun = int.Parse(item.Default1);
|
|
|
+ var disfloor = int.Parse(item.Default2);
|
|
|
+ var disids = cell.Where(p => p.Floor == disfloor && p.Tunnel == distun).Select(p => p.Id);
|
|
|
+ cell = cell.Where(p => !disids.Contains(p.Id)).ToList();
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- var cellfloor1count = cell.Where(p => p.Floor == 1 && p.Tunnel > tun).Count(); //1楼层可用的货位数
|
|
|
- var cellfloor2count = cell.Where(p => p.Floor == 2 && p.Tunnel > tun).Count(); //2楼层可用的货位数
|
|
|
- var cellfloor3count = cell.Where(p => p.Floor == 3 && p.Tunnel > tun).Count(); //3楼层可用的货位数
|
|
|
+ var cellfloor1count = cell.Where(p => p.Floor == 1 && p.Tunnel > tun).Count(); //1楼层可用的货位数
|
|
|
+ var cellfloor2count = cell.Where(p => p.Floor == 2 && p.Tunnel > tun).Count(); //2楼层可用的货位数
|
|
|
+ var cellfloor3count = cell.Where(p => p.Floor == 3 && p.Tunnel > tun).Count(); //3楼层可用的货位数
|
|
|
|
|
|
- var forbidlayer = wms.util.AppSettings.GetConfig("ForbidLayer");//禁用的楼层
|
|
|
- if (!string.IsNullOrEmpty(forbidlayer))
|
|
|
- {
|
|
|
- if (forbidlayer.Contains("1")) cellfloor1count = 0;
|
|
|
- if (forbidlayer.Contains("2")) cellfloor2count = 0;
|
|
|
- if (forbidlayer.Contains("3")) cellfloor3count = 0;
|
|
|
- }
|
|
|
+ var forbidlayer = wms.util.AppSettings.GetConfig("ForbidLayer");//禁用的楼层
|
|
|
+ if (!string.IsNullOrEmpty(forbidlayer))
|
|
|
+ {
|
|
|
+ if (forbidlayer.Contains("1")) cellfloor1count = 0;
|
|
|
+ if (forbidlayer.Contains("2")) cellfloor2count = 0;
|
|
|
+ if (forbidlayer.Contains("3")) cellfloor3count = 0;
|
|
|
+ }
|
|
|
|
|
|
- var tempcells = new List<Tuple<int, int, double>>() {
|
|
|
+ var tempcells = new List<Tuple<int, int, double>>() {
|
|
|
new Tuple<int, int,double>(1,cellfloor1count,cellfloor1stockcount / (cellfloor1count * 1.0)),
|
|
|
new Tuple<int, int,double>(2,cellfloor2count,cellfloor2stockcount / (cellfloor2count * 1.0)),
|
|
|
new Tuple<int, int,double>(3,cellfloor3count,cellfloor3stockcount / (cellfloor3count * 1.0)),
|
|
|
};
|
|
|
- //tempcells = tempcells.OrderByDescending(p => p.Item2).ToList();
|
|
|
- tempcells = tempcells.OrderBy(p => p.Item3).ToList();//按照同规则物料少的排序
|
|
|
+ //tempcells = tempcells.OrderByDescending(p => p.Item2).ToList();
|
|
|
+ tempcells = tempcells.OrderBy(p => p.Item3).ToList();//按照同规则物料少的排序
|
|
|
|
|
|
- //每个扫码固定楼层,如果固定楼层设备坏了或者库存满了,再换楼层
|
|
|
- var taskcount = _taskrepository.AsQueryable().With(SqlWith.NoLock).Where(p => p.Type == TaskType.EnterDepot && p.Status < TaskStatus.Finish && p.Floor != 0).ToList();
|
|
|
+ //每个扫码固定楼层,如果固定楼层设备坏了或者库存满了,再换楼层
|
|
|
+ var taskcount = _taskrepository.AsQueryable().With(SqlWith.NoLock).Where(p => p.Type == TaskType.EnterDepot && p.Status < TaskStatus.Finish && p.Floor != 0).ToList();
|
|
|
|
|
|
- if (tempcells[0].Item2 > (reqDto.Count + 10))
|
|
|
- {
|
|
|
- if (taskcount.Where(p => p.Floor == tempcells[0].Item1).Count() > floorTaskCount || tempcells[0].Item2 == 0)
|
|
|
+ if (tempcells[0].Item2 > (reqDto.Count + 10))
|
|
|
{
|
|
|
- if (taskcount.Where(p => p.Floor == tempcells[1].Item1).Count() > floorTaskCount || tempcells[1].Item2 == 0)
|
|
|
+ if (taskcount.Where(p => p.Floor == tempcells[0].Item1).Count() > floorTaskCount || tempcells[0].Item2 == 0)
|
|
|
{
|
|
|
- if (taskcount.Where(p => p.Floor == tempcells[2].Item1).Count() > floorTaskCount || tempcells[2].Item2 == 0)
|
|
|
+ if (taskcount.Where(p => p.Floor == tempcells[1].Item1).Count() > floorTaskCount || tempcells[1].Item2 == 0)
|
|
|
{
|
|
|
- res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
|
|
|
- res.ResMsg = reqDto.Count + "扭转回库申请楼层失败,当前环线三个楼层执行中的任务数已满,不允许分配楼层";
|
|
|
- res.ResData = 0;
|
|
|
- return res;
|
|
|
+ if (taskcount.Where(p => p.Floor == tempcells[2].Item1).Count() > floorTaskCount || tempcells[2].Item2 == 0)
|
|
|
+ {
|
|
|
+ res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
|
|
|
+ res.ResMsg = reqDto.Count + "扭转回库申请楼层失败,当前环线三个楼层执行中的任务数已满,不允许分配楼层";
|
|
|
+ res.ResData = 0;
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ res.ResData = tempcells[2].Item1;
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- res.ResData = tempcells[2].Item1;
|
|
|
+ res.ResData = tempcells[1].Item1;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- res.ResData = tempcells[1].Item1;
|
|
|
+ res.ResData = tempcells[0].Item1;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- res.ResData = tempcells[0].Item1;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (tempcells[1].Item2 > (reqDto.Count + 10))
|
|
|
- {
|
|
|
- if (taskcount.Where(p => p.Floor == tempcells[1].Item1).Count() > floorTaskCount || tempcells[1].Item2 == 0)
|
|
|
+ if (tempcells[1].Item2 > (reqDto.Count + 10))
|
|
|
{
|
|
|
- if (taskcount.Where(p => p.Floor == tempcells[2].Item1).Count() > floorTaskCount || tempcells[2].Item2 == 0)
|
|
|
+ if (taskcount.Where(p => p.Floor == tempcells[1].Item1).Count() > floorTaskCount || tempcells[1].Item2 == 0)
|
|
|
{
|
|
|
- res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
|
|
|
- res.ResMsg = reqDto.Count + "扭转回库申请楼层失败,当前环线三个楼层执行中的任务数已满,不允许分配楼层";
|
|
|
- res.ResData = 0;
|
|
|
- return res;
|
|
|
+ if (taskcount.Where(p => p.Floor == tempcells[2].Item1).Count() > floorTaskCount || tempcells[2].Item2 == 0)
|
|
|
+ {
|
|
|
+ res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
|
|
|
+ res.ResMsg = reqDto.Count + "扭转回库申请楼层失败,当前环线三个楼层执行中的任务数已满,不允许分配楼层";
|
|
|
+ res.ResData = 0;
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ res.ResData = tempcells[2].Item1;
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- res.ResData = tempcells[2].Item1;
|
|
|
+ res.ResData = tempcells[1].Item1;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- res.ResData = tempcells[1].Item1;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (taskcount.Where(p => p.Floor == tempcells[2].Item1).Count() < floorTaskCount && tempcells[2].Item2 > 30)
|
|
|
- {
|
|
|
- res.ResData = tempcells[2].Item1;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
|
|
|
- res.ResMsg = reqDto.Count + "扭转回库申请楼层失败,当前环线三个楼层执行中的任务数已满,不允许分配楼层";
|
|
|
- res.ResData = 0;
|
|
|
- return res;
|
|
|
+ if (taskcount.Where(p => p.Floor == tempcells[2].Item1).Count() < floorTaskCount && tempcells[2].Item2 > 30)
|
|
|
+ {
|
|
|
+ res.ResData = tempcells[2].Item1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
|
|
|
+ res.ResMsg = reqDto.Count + "扭转回库申请楼层失败,当前环线三个楼层执行中的任务数已满,不允许分配楼层";
|
|
|
+ res.ResData = 0;
|
|
|
+ return res;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
|
|
|
+ res.ResMsg = ex.StackTrace;
|
|
|
+ res.ResData = 0;
|
|
|
+ return res;
|
|
|
+ }
|
|
|
return res;
|
|
|
}
|
|
|
|