主线分流点.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using Newtonsoft.Json;
  2. using ServiceCenter.Extensions;
  3. using ServiceCenter.Redis;
  4. using System.ComponentModel;
  5. using WCS.Core;
  6. using WCS.WorkEngineering.Extensions;
  7. using WCS.WorkEngineering.Worlds;
  8. namespace WCS.WorkEngineering.Systems
  9. {
  10. /// <summary>
  11. /// 主线分流
  12. /// </summary>
  13. [BelongTo(typeof(MainWorld))]
  14. [Description("主线分流点")]
  15. public class 主线分流点 : DeviceSystem<Station>
  16. {
  17. protected override bool ParallelDo => true;
  18. protected override bool SaveLogsToFile => true;
  19. public override void Do(Station obj)
  20. {
  21. obj.入库站点是否满足执行条件();
  22. //获取条码
  23. var bcr = obj.GetBarCode(World);
  24. //获取到仓库Id
  25. var mainlineDiversion = JsonConvert.DeserializeObject<MainlineDiversion>(RedisHub.WMS.Get($"MainlineDiversion{bcr}"));
  26. //更具仓库ID来分配目标地址
  27. int nextAdd = 0;
  28. switch (mainlineDiversion.WarehouseId)
  29. {
  30. case 1:
  31. nextAdd = 0;
  32. break;
  33. case 2:
  34. nextAdd = 0;
  35. break;
  36. case 3:
  37. nextAdd = 0;
  38. break;
  39. case 4:
  40. nextAdd = 0;
  41. break;
  42. case 5:
  43. nextAdd = 0;
  44. break;
  45. case 6:
  46. nextAdd = 0;
  47. break;
  48. }
  49. obj.Data.GoodsStart = obj.Entity.Code.ToShort();
  50. obj.Data.GoodsEnd = nextAdd.ToShort();
  51. obj.Data.TaskNumber = mainlineDiversion.TaskId;
  52. obj.Data.VoucherNo++;
  53. }
  54. public override bool Select(Device dev)
  55. {
  56. return dev.HasFlag(Extensions.DeviceFlags.主线分流点);
  57. }
  58. }
  59. /// <summary>
  60. /// 主线分流
  61. /// </summary>
  62. public class MainlineDiversion
  63. {
  64. /// <summary>
  65. /// 任务号
  66. /// </summary>
  67. public int TaskId { get; set; }
  68. /// <summary>
  69. /// 仓库号
  70. /// </summary>
  71. public int WarehouseId { get; set; }
  72. }
  73. }