}
}
- def updateState(id: Long, partId: Long, designChangeId: Long, notifyType: Long, state: Long) = Action {
+ def updateState(id: Long, partId: Long, designChangeId: Long, notifyType: Long, state: Long) = Action { implicit request =>
inTransaction {
val notify = NotifyManager().getById(id)
notify.state = 1
var i:Int =0
notifyBuffer += NotifyBean(i, notify.message, notify.user.head.name, notify.id, Messages("notify.state" + notify.state), notify.atachs)
for(reply <- notify.replies) {
- ReplyRecursion().down(reply, notifyBuffer, i)
+// ReplyRecursion().down(reply, notifyBuffer, i)
+ for(returnNotifyBuffer <- ReplyRecursion().down(reply, i)) {
+ notifyBuffer += returnNotifyBuffer
+ }
}
}
Ok(views.html.notifylist(notifyBuffer.drop(page*row).take(row), notifyBuffer.size, partId, 0, notifyPart.name, page, notifyType, state))
var i:Int =0
notifyBuffer += NotifyBean(i, notify.message, notify.user.assign(notify.user.head).name, notify.id, Messages("notify.state" + notify.state), notify.atachs)
for(reply <- notify.replies) {
- ReplyRecursion().down(reply, notifyBuffer, i)
+ for(returnNotifyBuffer <- ReplyRecursion().down(reply, i)) {
+ notifyBuffer += returnNotifyBuffer
+ }
}
}
Ok(views.html.notifylist(notifyBuffer.drop(page*row).take(row), notifyBuffer.size, 0, designChange.id, designChange.dcNo, page, notifyType, state))
}
}
+
}
\ No newline at end of file
import play.api.i18n._
import org.squeryl._
import org.squeryl.PrimitiveTypeMode._
+import models._
import models.services._
import beans._
import forms._
var partBuffer = ArrayBuffer[PartsListBean]()
inTransaction {
for (parentPart <- PartManager().getByLikeName(key)) {
- PartRecursion().down(parentPart, partBuffer, opt)
+ for(returnPartBuffer <- PartRecursion().down(parentPart, opt)) {
+ partBuffer += returnPartBuffer
+ }
}
}
val row = Integer.decode(Messages("list.row"))
PartsListBean(parentNo, childNo, PartManager().getByName(parentNo).partRelation(PartManager().getByName(childNo).id).quantity)
}
}
-
+
}
\ No newline at end of file
var message:String = null
var partBuffer = ArrayBuffer[PartsListBean]()
for (parentPart <- PartsListDb.parts.where(p => p.name === child )) {
- PartRecursion().down(parentPart, partBuffer, 1)
+// PartRecursion().down(parentPart, partBuffer, 1)
+ for(returnPartBuffer <- PartRecursion().down(parentPart, 1)) {
+ partBuffer += returnPartBuffer
+ }
}
// 親品番逆展開配列
var upPartBuffer = ArrayBuffer[PartsListBean]()
import models._
import beans._
import scala.collection.mutable.ArrayBuffer
-case class PartRecursion() {
+case class PartRecursion(){
- def down(parentPart: Part, partBuffer: ArrayBuffer[PartsListBean], opt: Int):Unit = {
+/* def down(parentPart: Part, partBuffer: ArrayBuffer[PartsListBean], opt: Int):Unit = {
for(child <-parentPart.parts) {
if(parentPart.partRelation(child.id).delDcId==0) {
if(opt!=3 || opt==3 && child.name.startsWith("Unit")) {
}
}
}
- }
+ }*/
+ def down(parentPart: Part, opt: Int):ArrayBuffer[PartsListBean] = {
+ val partBuffer = ArrayBuffer[PartsListBean]()
+ for(child <-parentPart.parts) {
+ if(parentPart.partRelation(child.id).delDcId==0) {
+ if(opt!=3 || opt==3 && child.name.startsWith("Unit")) {
+ partBuffer += PartsListBean(parentPart.name, child.name, parentPart.partRelation(child.id).quantity)
+ }
+ if(opt==1 || opt==2 && !child.name.startsWith("Part") || opt==3) {
+ val partBuffers = PartRecursion().down(child, opt)
+ for (returnPartBuffer <- partBuffers) {
+ partBuffer += returnPartBuffer
+ }
+ }
+ }
+ }
+ return partBuffer
+ }
+
def up(childPart: Part, partBuffer: ArrayBuffer[PartsListBean], opt: Int):Unit = {
if(childPart.parentParts.size == 0 && opt == 2) {
partBuffer += PartsListBean("", childPart.name,0)
import play.api.i18n._
import scala.collection.mutable.ArrayBuffer
-case class ReplyRecursion() {
- def down(reply: Reply, notifyBuffer: ArrayBuffer[NotifyBean], i: Int):Unit ={
+case class ReplyRecursion(){
+/* def down(reply: Reply, notifyBuffer: ArrayBuffer[NotifyBean], i: Int):Unit ={
var level = i+1
notifyBuffer += NotifyBean(level, reply.message, reply.user.assign(reply.user.head).name, reply.id, Messages("notify.state9"), reply.atachs)
for( childReply <- reply.childReplies) {
ReplyRecursion().down(childReply, notifyBuffer, level)
}
+ }*/
+
+ def down(reply: Reply, i: Int): ArrayBuffer[NotifyBean] ={
+ val notifyBuffer = ArrayBuffer[NotifyBean]()
+ var level = i+1
+ notifyBuffer += NotifyBean(level, reply.message, reply.user.assign(reply.user.head).name, reply.id, Messages("notify.state9"), reply.atachs)
+ for( childReply <- reply.childReplies) {
+ for(returnNotifyBuffer <- ReplyRecursion().down(childReply, level)) {
+ notifyBuffer += returnNotifyBuffer
+ }
+ }
+ return notifyBuffer
}
def up(reply: Reply):Reply = {
if(reply.parentReply.size == 0) {
return reply
} else {
- println("Messages " + reply.message)
ReplyRecursion().up(reply.parentReply.head)
}
@if(partId != 0) {
<a href="/partModify?id=@partId">@Messages("list.link6")</a>
} else {
- <a href="/designChangeCoverModify?id=@designChangeId">@Messages("title22")</a>
+ <a href="/designChangeCoverModify?designChangeId=@designChangeId&dcSeq=0&message=">@Messages("title22")</a>
}
}