DeleteBarCodeUsed.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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.RcvLine
  8. {
  9. public class DeleteBarCodeUsed : 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.PM.Rcv.RcvLine holder = key.GetEntity() as UFIDA.U9.PM.Rcv.RcvLine;
  20. if (holder == null)
  21. return;
  22. #endregion
  23. BarCodeUpdater.Update(holder.ID, "UFIDA.U9.PM.Rcv.RcvLine");
  24. //using (ISession session = Session.Open())
  25. //{
  26. // UFIDA.U9.BC.BaseData.BarCodeUsed.EntityList list = UFIDA.U9.BC.BaseData.BarCodeUsed.Finder.FindAll("UseDocLine.EntityID=@ID and UseDocLine.EntityType=@EntityType and CurQty>0 order by CreatedOn desc"
  27. // , new UFSoft.UBF.PL.OqlParam[]
  28. // {
  29. // new UFSoft.UBF.PL.OqlParam(holder.ID),
  30. // new UFSoft.UBF.PL.OqlParam("UFIDA.U9.PM.Rcv.RcvLine")
  31. // });
  32. // if (list != null && list.Count > 0)
  33. // {
  34. // foreach (var barCodeUsed in list)
  35. // {
  36. // if (barCodeUsed.IsUpdateWh)
  37. // {
  38. // if (barCodeUsed.Direct == UFIDA.U9.BC.Common.DirectEnum.Rcv)
  39. // {
  40. // barCodeUsed.BarCodeMaster.WhQty = barCodeUsed.BarCodeMaster.WhQty - barCodeUsed.CurQty;
  41. // if (barCodeUsed.BarCodeMaster.WhQty < 0)
  42. // {
  43. // throw new Exception("不能删除,删除后条码现场量将小于0");
  44. // }
  45. // }
  46. // else if (barCodeUsed.Direct == UFIDA.U9.BC.Common.DirectEnum.Shipment)
  47. // {
  48. // barCodeUsed.BarCodeMaster.WhQty = barCodeUsed.BarCodeMaster.WhQty + barCodeUsed.CurQty;
  49. // }
  50. // }
  51. // barCodeUsed.Remove();
  52. // }
  53. // }
  54. // session.Commit();
  55. //}
  56. }
  57. }
  58. }