Files
ww-jst/wmsjst/JSMachine.WMS.Business/StockIn/ServiceImpl/Strategy/StrategyFactory.cs
T

43 lines
1.7 KiB
C#
Raw Normal View History

2026-09-02 16:31:50 +08:00
using JSMachine.WMS.App.Dto.Enum;
using JSMachine.WMS.App.Dto;
using JSMachine.WMS.Business.StockIn.IService;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JSMachine.WMS.Common;
using JSMachine.WMS.Infrastructure;
using JSMachine.WMS.App.IService;
namespace JSMachine.WMS.Business.StockIn.ServiceImpl.Strategy
{
/// <summary>
/// 根据楼层和配置的混放模式选择入库库位计算策略。
/// </summary>
public class StrategyFactory
{
/// <summary>
/// 0-完全不混放 1-混合模式,优先同批次放一列,没有空库位再混放 2-完全混放模式,不用批次货物放一起
/// </summary>
/// <param name="startArea">入库起始区域。</param>
/// <param name="floor">目标楼层。</param>
/// <param name="materiaBatch">物料批次。</param>
/// <returns>与当前入库条件匹配的库位计算策略。</returns>
public static IStockInStrategy CreateStockInStrategy(TransportEnum startArea, FloorEnum floor, string materiaBatch)
{
switch (floor == FloorEnum.FirstFloor ? 0 : Global.AppSettings.PlcaementMod)
{
case 0:
return new NoMixingStrategy(startArea, floor, materiaBatch);
case 1:
return new MixedModeStrategy(startArea, floor, materiaBatch);
case 2:
return new CompleteMixingStrategy(startArea, floor, materiaBatch);
default:
return new NoMixingStrategy(startArea, floor, materiaBatch);
}
}
}
}