合流入库.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using DBHelper;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using WCS.Core;
  8. using WCS.Entity;
  9. using WCS.Entity.Protocol;
  10. using WCS.Service.Extensions;
  11. using WCS.Service.Helpers;
  12. using WCS.Service.Log;
  13. namespace WCS.Service.Works.Station
  14. {
  15. //[WorkTitle(typeof(ProductHandler), "合流入库")]
  16. //internal class 合流入库 : DeviceWork<Device<IStation520, IStation521,IStation523>>
  17. //{
  18. // protected override void Do(Device<IStation520, IStation521,IStation523> dev)
  19. // {
  20. // if (Ltc.Do(dev, v => v.Data2.VoucherNo != v.Data.VoucherNo)) throw new WarnException($"等待任务执行--凭证号不一致");
  21. // if (Ltc.Do(dev,v => v.Data3.Status.HasFlag(StationStatus.运行状态位))) throw new WarnException($"设备运行中");
  22. // if (Ltc.Do(dev, v => v.Data2.Status.HasFlag(IstationStatus.光电状态) == false)) return;
  23. // if (Ltc.Do(dev, v => v.Data2.Tasknum < 10000)) return;
  24. // var bcr = dev.Entity.BCR();
  25. // var barcode = bcr.Content.Trim('\r');
  26. // if (barcode == "")
  27. // {
  28. // InfoLog.INFO_WarnDb($"{dev.Entity.CODE}--扫码失败,内容为空", dev.Entity.CODE, WCS_EXCEPTIONTYPE.设备异常);
  29. // return;
  30. // };
  31. // var res = WMS.GetSingleOrDouble(barcode,dev.Entity.CODE);
  32. // if (res == null) throw new WarnException($"{dev.Entity.CODE}: WMS未返回结果");
  33. // DB.Do(db =>
  34. // {
  35. // if (!db.Default.Set<WCS_TASK>().Any(v => v.ID == dev.Data2.Tasknum)) throw new Exception($"任务号不存在");
  36. // dev.Data.Tasknum = dev.Data2.Tasknum;
  37. // dev.Data.Goodscode = res.Root;
  38. // dev.Data.VoucherNo++;
  39. // });
  40. // }
  41. // protected override bool SelectDevice(WCS_DEVICE dev)
  42. // {
  43. // return new string[] { "3047","3163" }.Contains(dev.CODE);
  44. // }
  45. //}
  46. }