xxxxxx
This commit is contained in:
parent
449725e03c
commit
87e159b8bb
35
Seyounth.Hyosung.Data/Entities/StorageBinEntity.cs
Normal file
35
Seyounth.Hyosung.Data/Entities/StorageBinEntity.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Seyounth.Hyosung.Data.Entities;
|
||||||
|
|
||||||
|
public class StorageBinEntity
|
||||||
|
{
|
||||||
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public string BinName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public string LowerBinCode { get; set; }
|
||||||
|
|
||||||
|
[SugarColumn(IsNullable = true)] public string? UpperBinCode { get; set; }
|
||||||
|
|
||||||
|
public bool IsDouble { get; set; }
|
||||||
|
|
||||||
|
public int BinStatus { get; set; }
|
||||||
|
|
||||||
|
public int LowerCtnrCode { get; set; }
|
||||||
|
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int UpperCtnrCode { get; set; }
|
||||||
|
|
||||||
|
[SugarColumn(IsNullable = true)] public bool NeedSameLot { get; set; } = false;
|
||||||
|
|
||||||
|
public int BindLot { get; set; } = 0;
|
||||||
|
|
||||||
|
|
||||||
|
public int BinPosition { get; set; }
|
||||||
|
|
||||||
|
public int Sort { get; set; }
|
||||||
|
}
|
@ -93,4 +93,6 @@ public class VarietyEntity
|
|||||||
[SugarColumn(IsNullable =true)]
|
[SugarColumn(IsNullable =true)]
|
||||||
public double? GrossWeight { get; set; }
|
public double? GrossWeight { get; set; }
|
||||||
|
|
||||||
|
[SugarColumn(IsNullable =true)]
|
||||||
|
public bool NeedSameStack { get; set; }
|
||||||
}
|
}
|
@ -70,6 +70,8 @@ public class Variety
|
|||||||
|
|
||||||
public double? GrossWeight { get; set; }
|
public double? GrossWeight { get; set; }
|
||||||
|
|
||||||
|
public bool NeedSameStack { get; set; }
|
||||||
|
|
||||||
public static Variety Create(VarietyEntity entity, List<PalletEntity> pallets)
|
public static Variety Create(VarietyEntity entity, List<PalletEntity> pallets)
|
||||||
{
|
{
|
||||||
var variety = new Variety()
|
var variety = new Variety()
|
||||||
@ -101,7 +103,8 @@ public class Variety
|
|||||||
HasBox = entity.HasBox,
|
HasBox = entity.HasBox,
|
||||||
LastNo = entity.LastNo,
|
LastNo = entity.LastNo,
|
||||||
NetWeight = entity.NetWeight,
|
NetWeight = entity.NetWeight,
|
||||||
GrossWeight = entity.GrossWeight
|
GrossWeight = entity.GrossWeight,
|
||||||
|
NeedSameStack = entity.NeedSameStack
|
||||||
};
|
};
|
||||||
if (entity.PaperTrayId != null && entity.PaperTrayId != 0)
|
if (entity.PaperTrayId != null && entity.PaperTrayId != 0)
|
||||||
variety.PaperTray = Pallet.FromEntity(pallets.First(x => x.Id == entity.PaperTrayId));
|
variety.PaperTray = Pallet.FromEntity(pallets.First(x => x.Id == entity.PaperTrayId));
|
||||||
@ -141,7 +144,8 @@ public class Variety
|
|||||||
HasBox = HasBox,
|
HasBox = HasBox,
|
||||||
LastNo = LastNo,
|
LastNo = LastNo,
|
||||||
NetWeight = NetWeight,
|
NetWeight = NetWeight,
|
||||||
GrossWeight = GrossWeight
|
GrossWeight = GrossWeight,
|
||||||
|
NeedSameStack = NeedSameStack
|
||||||
};
|
};
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
11
Seyounth.Hyosung.Data/Services/IStorageBinService.cs
Normal file
11
Seyounth.Hyosung.Data/Services/IStorageBinService.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using Seyounth.Hyosung.Data.Entities;
|
||||||
|
using Seyounth.Hyosung.Data.Models;
|
||||||
|
|
||||||
|
namespace Seyounth.Hyosung.Data.Services;
|
||||||
|
|
||||||
|
public interface IStorageBinService
|
||||||
|
{
|
||||||
|
Task<StorageBinEntity> GetAvailableBin(Tray tray, Variety variety);
|
||||||
|
|
||||||
|
Task BindAsync(StorageBinEntity entity);
|
||||||
|
}
|
@ -29,21 +29,9 @@ public interface ITrayService
|
|||||||
|
|
||||||
Task<Tray> GetIsPacking();
|
Task<Tray> GetIsPacking();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 生成控制号
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="trayCode"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task StorageAsync(string trayCode);
|
|
||||||
|
|
||||||
/// <summary>
|
Task StorageAsync(string trayCode);
|
||||||
/// 打印托盘
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="trayCode"></param>
|
|
||||||
/// <param name="stackHeight"></param>
|
|
||||||
/// <param name="controlNo"></param>
|
|
||||||
/// <param name="itemInfo"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<Tray> PrintTrayAsync(string trayCode, MST_ITEM_2240_V itemInfo,Variety variety);
|
Task<Tray> PrintTrayAsync(string trayCode, MST_ITEM_2240_V itemInfo,Variety variety);
|
||||||
|
|
||||||
Task UpdateHeightAsync(string trayCode, int height);
|
Task UpdateHeightAsync(string trayCode, int height);
|
||||||
|
66
Seyounth.Hyosung.Data/Services/StorageBinService.cs
Normal file
66
Seyounth.Hyosung.Data/Services/StorageBinService.cs
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
using Seyounth.Hyosung.Data.Entities;
|
||||||
|
using Seyounth.Hyosung.Data.Models;
|
||||||
|
using Seyounth.Hyosung.Data.Repositories;
|
||||||
|
|
||||||
|
namespace Seyounth.Hyosung.Data.Services;
|
||||||
|
|
||||||
|
public class StorageBinService(IRepository<StorageBinEntity> repository)
|
||||||
|
:IStorageBinService
|
||||||
|
{
|
||||||
|
public async Task<StorageBinEntity> GetAvailableBin(Tray tray, Variety variety)
|
||||||
|
{
|
||||||
|
StorageBinEntity bin;
|
||||||
|
var db = repository.CopyNew();
|
||||||
|
if (tray.StackHeight >= 180)
|
||||||
|
{
|
||||||
|
bin = await db.AsQueryable()
|
||||||
|
.Where(x => !x.IsDouble && x.BinStatus == 0)
|
||||||
|
.OrderBy(x => x.Sort).FirstAsync() ?? await db.AsQueryable()
|
||||||
|
.Where(x => x.BinStatus == 0)
|
||||||
|
.OrderBy(x => x.Sort).FirstAsync();
|
||||||
|
}
|
||||||
|
else if (variety.NeedSameStack)
|
||||||
|
{
|
||||||
|
bin = await db.AsQueryable()
|
||||||
|
.Where(x => x.BinStatus == 1 && x.IsDouble && x.BindLot == variety.Lot)
|
||||||
|
.OrderBy(x => x.Sort).FirstAsync() ?? await db.AsQueryable()
|
||||||
|
.Where(x => x.BinStatus == 0)
|
||||||
|
.OrderBy(x => x.Sort).FirstAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bin = await db.AsQueryable()
|
||||||
|
.Where(x => x.BinStatus == 1 && !x.NeedSameLot)
|
||||||
|
.OrderBy(x => x.Sort).FirstAsync() ?? await db.AsQueryable()
|
||||||
|
.Where(x => x.BinStatus == 0)
|
||||||
|
.OrderBy(x => x.Sort).FirstAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bin.BinName == "B10")
|
||||||
|
{
|
||||||
|
await db.AsUpdateable()
|
||||||
|
.Where(x => x.BinPosition == 2)
|
||||||
|
.SetColumns(x => x.BinStatus, 0)
|
||||||
|
.SetColumns(x => x.BindLot, 0)
|
||||||
|
.SetColumns(x => x.NeedSameLot, false)
|
||||||
|
.ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
else if (bin.BinName == "B32")
|
||||||
|
{
|
||||||
|
await db.AsUpdateable()
|
||||||
|
.Where(x => x.BinPosition == 1)
|
||||||
|
.SetColumns(x => x.BinStatus, 0)
|
||||||
|
.SetColumns(x => x.BindLot, 0)
|
||||||
|
.SetColumns(x => x.NeedSameLot, false)
|
||||||
|
.ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
return bin;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task BindAsync(StorageBinEntity entity)
|
||||||
|
{
|
||||||
|
await repository.AsUpdateable(entity).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
}
|
@ -425,7 +425,7 @@ public class HyosungRuntime(
|
|||||||
var version=await hyosungWmsService.GetItemInfoByItemCode(variety.Code);
|
var version=await hyosungWmsService.GetItemInfoByItemCode(variety.Code);
|
||||||
// await varietyService.SetLastNo(variety.Id, tray.ControlNo.Value);
|
// await varietyService.SetLastNo(variety.Id, tray.ControlNo.Value);
|
||||||
//await hyosungWmsService.UpdateControlNo(variety, tray.ControlNo.Value);
|
//await hyosungWmsService.UpdateControlNo(variety, tray.ControlNo.Value);
|
||||||
// await hyosungWmsService.AddLabelResult(new LabelResult(tray, variety));
|
await hyosungWmsService.AddLabelResult(new LabelResult(tray, variety));
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.LogInformation($"plc request print label success");
|
logger.LogInformation($"plc request print label success");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user