WorkPiece.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using System;
  2. using Curtain.Log;
  3. using Curtain.WCF.Proxy;
  4. namespace PLC_S.Proxy
  5. {
  6. public class WorkPiece
  7. {
  8. /// <summary>
  9. /// 自动工序计件
  10. /// </summary>
  11. /// <param name="barcode"></param>
  12. public static void AddWorkPiece(string barcode, string text)
  13. {
  14. //if (MESInfo == null ||
  15. // string.IsNullOrWhiteSpace(MESInfo.IP) ||
  16. // string.IsNullOrWhiteSpace(MESInfo.Port) ||
  17. // string.IsNullOrWhiteSpace(MESInfo.AccountCode) ||
  18. // string.IsNullOrWhiteSpace(MESInfo.UserCode)
  19. // )
  20. //{
  21. // return;
  22. //}
  23. try
  24. {
  25. //string userPassword = (string.IsNullOrWhiteSpace(ConnSetting.MESInfo.Password) ?
  26. // text : ConnSetting.MESInfo.Password);
  27. //int procedureID = Convert.ToInt32(ConnSetting.MESInfo.Procedures[0]);
  28. //SmartDeviceProxy.Instance.Invoke(p => p.AddWorkPiece("dongke",
  29. // "P18", "1", 1, barcode));
  30. }
  31. catch (Exception ex)
  32. {
  33. Logger.Error(ex, null, "MES");
  34. }
  35. }
  36. /// <summary>
  37. /// 自动工序计件
  38. /// </summary>
  39. /// <param name="barcode"></param>
  40. public static string AddWorkPieceByStatus(string barcode, string text, string remarks)
  41. {
  42. //if (MESInfo == null ||
  43. // string.IsNullOrWhiteSpace(MESInfo.IP) ||
  44. // string.IsNullOrWhiteSpace(MESInfo.Port) ||
  45. // string.IsNullOrWhiteSpace(MESInfo.AccountCode) ||
  46. // string.IsNullOrWhiteSpace(MESInfo.UserCode)
  47. // )
  48. //{
  49. // return "E1";
  50. //}
  51. WCFProxySetting.DefaultSetting.ResetRemoteAddress("127.0.0.1", "1234", "DKService");
  52. try
  53. {
  54. //string userPassword = (string.IsNullOrWhiteSpace(ConnSetting.MESInfo.Password) ?
  55. // text : ConnSetting.MESInfo.Password);
  56. //int procedureID = Convert.ToInt32(ConnSetting.MESInfo.Procedures[0]);
  57. //string scode = SmartDeviceProxy.Instance.Invoke<string>(
  58. // p => p.AddWorkPieceByStatus("dongke", "P1", "11", 1, barcode, remarks));
  59. return "OK";
  60. }
  61. catch (Exception ex)
  62. {
  63. Logger.Error(ex, null, "MES");
  64. return "E0";
  65. }
  66. }
  67. }
  68. }