Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.96 KB | None | 0 0
  1. ----------------------------WP_ShohinTypeItiran----------------------------
  2. Event Start
  3. Do 'LoadGridItem'
  4.  
  5. Endevent
  6.  
  7. Event Grid1.Load
  8. &ActionDelete.FromImage(ActionDelete)
  9.  
  10. EndEvent
  11.  
  12. Event 'SaveGrid'
  13. &Message.SetEmpty()
  14.  
  15. Do 'ValidateGrid'
  16. If not &Message.IsEmpty()
  17. Msg(&Message)
  18. Else
  19. //更新処理
  20. Prc_ShohinTypeItiranUpdate(&SDT_ShohinType, &Delete_SDT_ShohinType)
  21.  
  22. Msg(!"データが更新されました。")
  23. Do 'LoadGridItem'
  24. EndIf
  25.  
  26. Endevent
  27.  
  28. Event 'AddRow'
  29. &SDT_ShohinTypeItem = New()
  30. &SDT_ShohinType.Add(&SDT_ShohinTypeItem)
  31. Endevent
  32.  
  33. Event 'ActionDelete'
  34. If not &SDT_ShohinType.CurrentItem.EditBeforeShohinTypeId.IsEmpty()
  35. //既存のデータの削除
  36. For each Shohin
  37. Where ShohinTypeId = &SDT_ShohinType.CurrentItem.ShohinTypeId
  38. Msg(!"商品区分" + &SDT_ShohinType.CurrentItem.ShohinTypeId.ToString().Trim() + !"は商品マスタで使用中です。")
  39. When none
  40. &SDT_ShohinTypeItem = &SDT_ShohinType.CurrentItem
  41. &Delete_SDT_ShohinType.Add(&SDT_ShohinTypeItem)
  42. &SDT_ShohinType.Remove(&SDT_ShohinType.IndexOf(&SDT_ShohinTypeItem))
  43. Endfor
  44. Else
  45. //新規データの削除
  46. &SDT_ShohinTypeItem = &SDT_ShohinType.CurrentItem
  47. &SDT_ShohinType.Remove(&SDT_ShohinType.IndexOf(&SDT_ShohinTypeItem))
  48. Endif
  49. EndEvent
  50.  
  51. Sub 'ValidateGrid'
  52. //キーが未入植の項目が存在しないか
  53. For &SDT_ShohinTypeItem in &SDT_ShohinType
  54. if &SDT_ShohinTypeItem.ShohinTypeId.IsEmpty()
  55. &Message = !"商品区分番号が未入力のデータが存在します。"
  56. //Return
  57. Endif
  58. Endfor
  59.  
  60. //名称が未入植の項目が存在しないか
  61. For &SDT_ShohinTypeItem in &SDT_ShohinType
  62. if &SDT_ShohinTypeItem.ShohinTypeName.IsEmpty()
  63. &Message = !"商品区分名称が未入力のデータが存在します。"
  64. //Return
  65. Endif
  66. Endfor
  67.  
  68. //キー項目が変更されていないか
  69. For &SDT_ShohinTypeItem in &SDT_ShohinType
  70. if not &SDT_ShohinTypeItem.EditBeforeShohinTypeId.IsEmpty()
  71. if not &SDT_ShohinTypeItem.EditBeforeShohinTypeId = &SDT_ShohinTypeItem.ShohinTypeId
  72. &Message = !"商品区分番号" + &SDT_ShohinTypeItem.ShohinTypeId.ToString().Trim() + !"(変更前:" + &SDT_ShohinTypeItem.EditBeforeShohinTypeId.ToString().Trim() + !")" + !"の商品区分番号は変更できません。"
  73. //Return
  74. Endif
  75. Endif
  76. Endfor
  77.  
  78. //キーが重複していないか
  79. &Tmp_SDT_ShohinType.Clear()
  80. For &SDT_ShohinTypeItem in &SDT_ShohinType
  81. For &Tmp_SDT_ShohinTypeItem in &Tmp_SDT_ShohinType
  82. If &Tmp_SDT_ShohinTypeItem.ShohinTypeId = &SDT_ShohinTypeItem.ShohinTypeId
  83. &Message = !"商品区分番号" + &SDT_ShohinTypeItem.ShohinTypeId.ToString().Trim() + !"が複数入力されています。"
  84. //Return
  85. Endif
  86. Endfor
  87. &Tmp_SDT_ShohinType.Add(&SDT_ShohinTypeItem)
  88. Endfor
  89.  
  90. //削除するデータが使用されているか
  91. For &SDT_ShohinTypeItem in &Delete_SDT_ShohinType
  92. For each Shohin
  93. Where ShohinTypeId = &SDT_ShohinTypeItem.ShohinTypeId
  94. &Message = !"商品区分番号" + &SDT_ShohinTypeItem.ShohinTypeId.ToString().Trim() + !"は商品マスタで使用中です。"
  95. //Return
  96. Endfor
  97. Endfor
  98.  
  99. EndSub
  100.  
  101. Sub 'LoadGridItem'
  102. &Delete_SDT_ShohinType = New()
  103. &SDT_ShohinType = New()
  104. For each
  105. &SDT_ShohinTypeItem = New()
  106. &SDT_ShohinTypeItem.EditBeforeShohinTypeId = ShohinTypeId
  107. &SDT_ShohinTypeItem.ShohinTypeId = ShohinTypeId
  108. &SDT_ShohinTypeItem.ShohinTypeName = ShohinTypeName
  109. &SDT_ShohinType.Add(&SDT_ShohinTypeItem)
  110. Endfor
  111. EndSub
  112.  
  113.  
  114. ----------------------------Prc_ShohinTypeItiranUpdate----------------------------
  115. For &SDT_ShohinTypeItem in &Delete_SDT_ShohinType
  116. For each Shohin
  117. Where ShohinTypeId = &SDT_ShohinTypeItem.ShohinTypeId
  118. When none
  119. For each ShohinType
  120. Where ShohinTypeId = &SDT_ShohinTypeItem.ShohinTypeId
  121. Delete
  122. Endfor
  123. Endfor
  124. Endfor
  125.  
  126. for &SDT_ShohinTypeItem in &pSDT_ShohinType
  127. For each
  128. Where ShohinTypeId = &SDT_ShohinTypeItem.ShohinTypeId
  129. ShohinTypeName = &SDT_ShohinTypeItem.ShohinTypeName
  130. when none
  131. New
  132. ShohinTypeId = &SDT_ShohinTypeItem.ShohinTypeId
  133. ShohinTypeName = &SDT_ShohinTypeItem.ShohinTypeName
  134. Endnew
  135. Endfor
  136. Endfor
  137.  
  138. Commit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement