You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

95 lines
3.6 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using HBLConsole.Abstract;
  7. using BPA.Message;
  8. using HBLConsole.Model;
  9. using HBLConsole.Service;
  10. using BPA.Message.Enum;
  11. using HBLConsole.GVL;
  12. using BPA.Utility;
  13. using Newtonsoft.Json;
  14. namespace HBLConsole.Business.MessageServer
  15. {
  16. public class Base : AbstractMessageServer
  17. {
  18. public override void AddOrder<T>(T orderInfo)
  19. {
  20. if (orderInfo == null) return;
  21. if (orderInfo is MorkOrderPush morkOrderpush)
  22. {
  23. Json<MorkOrderPushPar>.GetInstance.Base.morkOrderPushes.Add(new OrderData()
  24. {
  25. OrderStatus = ORDER_STATUS.WAIT,
  26. IsSelected = true,
  27. OrderPush = morkOrderpush
  28. });
  29. ActionManagerment.GetInstance.Send("AddOrder", morkOrderpush);
  30. ActionManagerment.GetInstance.Send("MorksParse", morkOrderpush);
  31. }
  32. }
  33. public override void GetBatchingInfo<T>(T batchingInfo)
  34. {
  35. if (batchingInfo == null) return;
  36. if (batchingInfo is OrderMaterialDelivery BatchingInfos)
  37. {
  38. Json<BatchingInfoPar>.GetInstance.Base.orderMaterialDelivery = BatchingInfos;
  39. }
  40. }
  41. public override void GetBatchingInfo(int ClientId)
  42. {
  43. string result = string.Empty;
  44. try
  45. {
  46. var jsondata = new { ClientId };
  47. string header = $"[{InternetInfo.GetInstance.StockServer}/GetItemInfo]_[{DateTime.Now.Ticks}]".AESEncrypt();
  48. string url = $"{InternetInfo.GetInstance.ApiAddress}{InternetInfo.GetInstance.StockServer}/GetItemInfo";
  49. result = APIHelper.GetInstance.HttpRequest(url, header, jsondata, RequestType.POST);
  50. }
  51. catch (Exception ex)
  52. {
  53. MessageLog.GetInstance.Show(ex.ToString());
  54. }
  55. Json<BatchingInfoPar>.GetInstance.Base.orderMaterialDelivery = JsonConvert.DeserializeObject<OrderMaterialDelivery>(result);
  56. MessageLog.GetInstance.Show("【物料信息】");
  57. Json<BatchingInfoPar>.GetInstance.Base.orderMaterialDelivery?.BatchingInfo?.ForEach(x =>
  58. {
  59. MessageLog.GetInstance.Show($"{x.BatchingLoc}号位置:{x.BatchingCount}");
  60. });
  61. }
  62. public override void GetRecipeBom<T>(T recipeBomInfo)
  63. {
  64. if (recipeBomInfo == null) return;
  65. if (recipeBomInfo is RecipeBoms recipeBom)
  66. {
  67. Json<BatchingInfoPar>.GetInstance.Base.recipeBoms = recipeBom;
  68. }
  69. }
  70. public override bool OrderStatusChange(string subOrderId, ORDER_STATUS status)
  71. {
  72. string result = string.Empty;
  73. OrderStatusChange orderStatusChange = new OrderStatusChange() { CookingStatus = status, SuborderId = subOrderId };
  74. try
  75. {
  76. string header = $"[{InternetInfo.GetInstance.OrderServer}/order/robotstatuschange]_[{DateTime.Now.Ticks}]".AESEncrypt();
  77. string url = $"{InternetInfo.GetInstance.ApiAddress}{InternetInfo.GetInstance.OrderServer}/order/robotstatuschange";
  78. result = APIHelper.GetInstance.HttpRequest(url, header, orderStatusChange, RequestType.POST);
  79. }
  80. catch (Exception ex)
  81. {
  82. MessageLog.GetInstance.Show(ex.ToString());
  83. }
  84. var res = JsonConvert.DeserializeObject<OrderStatusChangeRsp>(result);
  85. return res?.Result == 2;
  86. }
  87. }
  88. }