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.

78 lines
2.6 KiB

3 years ago
  1. using Aborlen.Model;
  2. using FrameWork.Log;
  3. using Monitor.FrameWork;
  4. using SqlSugar;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using WorkStationBase;
  11. namespace Aborlen.WorkStation
  12. {
  13. public partial class WorkStation05 : StationBase
  14. {
  15. public void PalletNum(string stationCode, object value, DateTime triggerTime)
  16. {
  17. try
  18. {
  19. LogHelper.WriteLog(stationCode + "到位托盘号" + Convert.ToInt32(value));
  20. PalletCode = Convert.ToInt32(value);
  21. if (PalletCode != 0)
  22. {
  23. //托盘到达,更新条码验证规则 查询产品型号
  24. //查询订单
  25. var deploydata = Deploy_Data.Query().Where(p => p.tuopan_id == Convert.ToInt32(value) && p.process_state == 1).OrderBy(p=>p.Id,OrderByType.Desc);
  26. if (deploydata.Count() > 0)
  27. {
  28. PresentOrder = ProductOrder.Query().Where(p => p.plan_id == deploydata.First().plan_id).First();
  29. }
  30. else
  31. {
  32. PresentOrder = ProductOrder.Query().OrderBy(p => p.id, OrderByType.Desc).First();
  33. }
  34. ProductTypeCode = Convert.ToInt32(PresentOrder.product_id);
  35. //初始化界面
  36. ViewInit();
  37. //更新产量
  38. View.NokNum = Deploy_Data.Query().Where(p => p.plan_id == PresentOrder.plan_id && p.op50_time != null).Count(); //当前工站数量
  39. SendMsg.SendMsgToStation(StationInfo.StationCode, "NokNum", View.NokNum);
  40. }
  41. else
  42. {
  43. ProductCycleTime = ExecDateDiff(ArrivedTime, DateTime.Now);
  44. ArrivedTime = DateTime.Now;
  45. //托盘离开,清空界面
  46. ViewClear();
  47. SendMsg.SendMsgToStation(StationInfo.StationCode, "",new CommonView());
  48. SendMsg.SendMsgToStation(StationInfo.StationCode, "NokNum", View.NokNum);
  49. SendMsg.SendMsgToStation(StationInfo.StationCode, "OkNum", View.OkNum);
  50. SendMsg.SendMsgToStation(StationInfo.StationCode, "AlarmMsg", "");
  51. }
  52. }
  53. catch (Exception ex)
  54. {
  55. LogHelper.WriteLog(LogHelper.GetMethodInfo(), ex);
  56. }
  57. }
  58. }
  59. }