1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using Newtonsoft.Json;
- using ServiceCenter.Extensions;
- using ServiceCenter.Redis;
- using System.ComponentModel;
- using WCS.Core;
- using WCS.WorkEngineering.Extensions;
- using WCS.WorkEngineering.Worlds;
- namespace WCS.WorkEngineering.Systems
- {
- /// <summary>
- /// 主线分流
- /// </summary>
- [BelongTo(typeof(MainWorld))]
- [Description("主线分流点")]
- public class 主线分流点 : DeviceSystem<Station>
- {
- protected override bool ParallelDo => true;
- protected override bool SaveLogsToFile => true;
- public override void Do(Station obj)
- {
- obj.入库站点是否满足执行条件();
- //获取条码
- var bcr = obj.GetBarCode(World);
- //获取到仓库Id
- var mainlineDiversion = JsonConvert.DeserializeObject<MainlineDiversion>(RedisHub.WMS.Get($"MainlineDiversion{bcr}"));
- //更具仓库ID来分配目标地址
- int nextAdd = 0;
- switch (mainlineDiversion.WarehouseId)
- {
- case 1:
- nextAdd = 0;
- break;
- case 2:
- nextAdd = 0;
- break;
- case 3:
- nextAdd = 0;
- break;
- case 4:
- nextAdd = 0;
- break;
- case 5:
- nextAdd = 0;
- break;
- case 6:
- nextAdd = 0;
- break;
- }
- obj.Data.GoodsStart = obj.Entity.Code.ToShort();
- obj.Data.GoodsEnd = nextAdd.ToShort();
- obj.Data.TaskNumber = mainlineDiversion.TaskId;
- obj.Data.VoucherNo++;
- }
- public override bool Select(Device dev)
- {
- return dev.HasFlag(Extensions.DeviceFlags.主线分流点);
- }
- }
- /// <summary>
- /// 主线分流
- /// </summary>
- public class MainlineDiversion
- {
- /// <summary>
- /// 任务号
- /// </summary>
- public int TaskId { get; set; }
- /// <summary>
- /// 仓库号
- /// </summary>
- public int WarehouseId { get; set; }
- }
- }
|