DocCheck.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using UFSoft.UBF.Business;
  7. namespace UFIDA.U9.Cust.Kusi.CJJ.Plugin.BE.TransferIn
  8. {
  9. public class DocCheck : UFSoft.UBF.Eventing.IEventSubscriber
  10. {
  11. public void Notify(params object[] args)
  12. {
  13. #region 从事件参数中取得当前业务实体
  14. if (args == null || args.Length == 0 || !(args[0] is UFSoft.UBF.Business.EntityEvent))
  15. return;
  16. BusinessEntity.EntityKey key = ((UFSoft.UBF.Business.EntityEvent)args[0]).EntityKey;
  17. if (key == null)
  18. return;
  19. UFIDA.U9.InvDoc.TransferIn.TransferIn holder = key.GetEntity() as UFIDA.U9.InvDoc.TransferIn.TransferIn;
  20. if (holder == null)
  21. return;
  22. #endregion
  23. foreach (var line in holder.TransInLines)
  24. {
  25. if (holder.TransferInType.Value == 1 && line.TransInWh != null && line.TransInWh.DescFlexField.PrivateDescSeg1.ToUpper().Equals("FALSE"))
  26. {
  27. continue;
  28. }
  29. else
  30. {
  31. if (line.TransInWh != null)
  32. {
  33. if (line.TransInWh.DescFlexField.PrivateDescSeg1.ToUpper().Equals("TRUE") && !Base.Context.LoginUser.Contains("PDA"))
  34. {
  35. throw new Exception(string.Format("单号{0},{1}行的存储地点为条码管理,请扫码出货。", holder.DocNo, line.DocLineNo));
  36. }
  37. }
  38. foreach (var subLine in line.TransInSubLines)
  39. {
  40. if (subLine.TransOutWh != null)
  41. {
  42. if (subLine.TransOutWh.DescFlexField.PrivateDescSeg1.ToUpper().Equals("TRUE") && !Base.Context.LoginUser.Contains("PDA"))
  43. {
  44. throw new Exception(string.Format("单号{0},{1}行的存储地点为条码管理,请扫码出货。", holder.DocNo, line.DocLineNo));
  45. }
  46. }
  47. }
  48. }
  49. }
  50. }
  51. }
  52. }