import play.api.mvc._
import play.api.data._
import play.api.data.Forms._
+import controllers.services._
import models.services._
import forms._
+import beans._
import org.squeryl._
import org.squeryl.PrimitiveTypeMode._
import org.squeryl.annotations.Column
+import scala.collection.mutable.ArrayBuffer
object DesignChangeController extends Controller{
val Home = Redirect(routes.DesignChangeController.list(0,""))
)
}
- def designChangeCoverModify(id: Long) = Action { implicit request =>
+ def designChangeCoverModify(designChangeId: Long, dcSeq: Long, message: String) = Action { implicit request =>
inTransaction {
- val designChange = DesignChangeManager().getById(id)
+ var partBuffer = ArrayBuffer[PartsListBean]()
+ val designChange = DesignChangeManager().getById(designChangeId)
val designChangeForm = DesignChangeForm(designChange.dcNo, designChange.dcDescription)
val designChangeBuffer = DesignChangeManager().getDesinChangeInformation(designChange)
- Ok(views.html.updateDesignChangeForm(designChangeRegistForm.fill(designChangeForm), id, designChangeBuffer, designChange.addPartRelation))
+ if(dcSeq != 0) {
+ val delRelation = designChange.delPartRelation.where(pr => pr.dcSeq === dcSeq).head
+ PartRecursion().up(delRelation.child.head, partBuffer, 1)
+ }
+ Ok(views.html.updateDesignChangeForm(designChangeRegistForm.fill(designChangeForm), designChangeId, designChangeBuffer, designChange.addPartRelation, partBuffer, dcSeq, message))
}
}
def designChangeCoverModification(id: Long) = Action{ implicit request =>
designChangeRegistForm.bindFromRequest.fold(
- formWithErrors => BadRequest(views.html.updateDesignChangeForm(formWithErrors, id, null, null)),
+ formWithErrors => BadRequest(views.html.updateDesignChangeForm(formWithErrors, id, null, null, null, 0, null)),
designChange => {
inTransaction {
DesignChangeManager().update(id, designChange)
}
def designChangeCancel(id: Long) = Action {
- inTransaction {
- DesignChangeManager().designChangeCancel(id)
- Redirect(routes.DesignChangeController.designChangeCoverModify(id))
- }
+ inTransaction {
+ DesignChangeManager().designChangeCancel(id)
+ Redirect(routes.DesignChangeController.designChangeCoverModify(id, 0, ""))
+ }
+ }
+
+ def designChangeAppend(designChangeId: Long, dcSeq: Long, targetParentName: String) = Action {
+ inTransaction {
+ val designChange = DesignChangeManager().getById(designChangeId)
+ val delRelation =designChange.delPartRelation.where(pr => pr.dcSeq === dcSeq).head
+ val addRelation =designChange.addPartRelation.where(pr => pr.dcSeq === dcSeq).head
+ val delPart = delRelation.child.head
+ val addPart = addRelation.child.head
+ val ParentPart = PartManager().getByName(targetParentName)
+ val delPartsListBean = PartsListBean(ParentPart.name, delPart.name, delRelation.quantity)
+ val addPartsListBean = PartsListBean(ParentPart.name, addPart.name, addRelation.quantity)
+ val data = DesignChangeRelationForm(delPartsListBean, addPartsListBean, designChange.dcNo)
+ val message = Check().loopCheckDc(data)
+ if(message == null) {
+ DesignChangeManager().designChange(data)
+ Redirect(routes.DesignChangeController.designChangeCoverModify(designChangeId, dcSeq, ""))
+ } else {
+ Redirect(routes.DesignChangeController.designChangeCoverModify(designChangeId, dcSeq, message))
+ }
+ }
}
-
}
\ No newline at end of file
}
for (cancelDelRelation <- cancelDesignChange.delPartRelation) {
cancelDelRelation.delDcId = 0L
+ cancelDelRelation.dcSeq = 0L
PartsListDb.partRelations.update(cancelDelRelation)
}
}
<tbody>
@for(designChange <- designChanges) {
<tr><td>@designChange.id</td>
- <td><a href="/designChangeCoverModify?id=@designChange.id">@designChange.dcNo</a></td>
- <td><a href="/designChangeCoverModify?id=@designChange.id">@designChange.dcDescription</a></td>
+ <td><a href="/designChangeCoverModify?designChangeId=@designChange.id&dcSeq=0&message=">@designChange.dcNo</a></td>
+ <td><a href="/designChangeCoverModify?designChangeId=@designChange.id&dcSeq=0&message=">@designChange.dcDescription</a></td>
</tr>
}
</tbody>
-@(designChangeForm: Form[forms.DesignChangeForm], id: Long, delRelations: scala.collection.mutable.ArrayBuffer[beans.DesignChangeListBean], addRelations: org.squeryl.Query[PartRelation])(implicit lang: Lang)
+@(designChangeForm: Form[forms.DesignChangeForm], id: Long, delRelations: scala.collection.mutable.ArrayBuffer[beans.DesignChangeListBean], addRelations: org.squeryl.Query[PartRelation], partBuffer: scala.collection.mutable.ArrayBuffer[beans.PartsListBean], dcSeq: Long, message: String)(implicit lang: Lang)
@import helper._
@implicitFieldConstructor = @{ FieldConstructor(twitterBootstrapInput.f) }
@main("update Design Change by Play 2.1") {
<h1>@Messages("title22")</h1>
+ @Messages(message)
+ <br>
<a href="/designchangelist?page=0&key=">@Messages("title21")@Messages("title15")</a>
 
<a href="/designChangeNotifylist?page=0&designChangeId=@id¬ifyType=3&state=9">@Messages("notify.type0")@Messages("list.link19")</a>
@for(delRelation <- delRelations.sortBy(dcb => dcb.dcSeq)) {
<tr>
<td>@delRelation.parentBefore</td>
- <td>@delRelation.childBefore</td>
+ <td><a href="/designChangeCoverModify?designChangeId=@id&dcSeq=@delRelation.dcSeq&message=">@delRelation.childBefore</a></td>
<td>@delRelation.parentAfter</td>
<td>@delRelation.childAfter</td>
</tr>
}
</tbody>
</table>
+ @if(partBuffer.size != 0) {
+ <hr />
+ @Messages("title24")
+ <table>
+ <thead>
+ <tr>
+ <th>@Messages("list.header1")</th><th></th>
+ </tr>
+ </thead>
+ <tbody>
+ @for(target <- partBuffer) {
+ <tr>
+ <td>@target.child</td>
+ <td><a href="/designChangeAppend?designChangeId=@id&dcSeq=@dcSeq&parentName=@target.child">@Messages("list.link18")</a></td>
+ </tr>
+ }
+ </tbody>
+ </table>
+ }
<br />
+ <table>
@form(routes.DesignChangeController.designChangeCancel(id: Long)) {
<input type="hidden" id="id" value=designChangeForm("id") >
<input type="submit" class="btn success" value=@Messages("btn.label5") >
}
+  
@form(routes.NotifyController.createNotify(0, id, 3)) {
<input type="submit" value=@Messages("btn.label2") class="btn success">
}
+  
@form(routes.NotifyController.createNotify(0, id, 4)) {
<input type="submit" value=@Messages("btn.label3") class="btn success">
}
+ </table>
<br />
<a href="/designchangelist?page=0&key=">@Messages("title21")@Messages("title15")</a>
 
 
<a href="/notifylist?page=0&partId=@part.id¬ifyType=1&state=9">@Messages("notify.type1")@Messages("list.link19")</a>
- @form(routes.PartsMasterController.partModification(id:Long), 'enctype -> "multipart/form-data") {
- @commonPartForm(partForm)
- }
@form(routes.PartsMasterController.partDelete(id), 'class -> "topRight") {
<input type="submit" value=@Messages("list.link7") class="btn danger">
}
+ @form(routes.PartsMasterController.partModification(id:Long), 'enctype -> "multipart/form-data") {
+ @commonPartForm(partForm)
+ }
+ <table>
@form(routes.NotifyController.createNotify(part.id, 0, 0)) {
<input type="submit" value=@Messages("btn.label2") class="btn success">
}
+  
@form(routes.NotifyController.createNotify(part.id, 0, 1)) {
<input type="submit" value=@Messages("btn.label3") class="btn success">
}
+ </table>
<table>
<tr><th>@Messages("form.header2")</th><th></th></tr>
@for(atach <- part.atachs) {
<a href="multi_uppartslist?key=&page=0">@Messages("list.link12")</a>
 
<a href="top_uppartslist?key=Part&page=0">@Messages("list.link13")</a>
+ <br />
+  
+ <a href="/">@Messages("link.title1")</a>
+
}
title21=Design Change
title22=Modify Design Change
title23=Design Change Contents
+title24=Target Unit
btn.label1=search
btn.label2=Notification
btn.label3=Request
title21=Design Change
title22=Modify Design Change
title23=Design Change Contents
+title24=Target Unit
btn.label1=search
btn.label2=Notification
btn.label3=Request
title21=設計変更
title22=設計変更更新
title23=変更内容
+title24=変更対象ユニット
btn.label1=検索
btn.label2=通知
btn.label3=依頼
title21=設計変更
title22=設計変更更新
title23=変更内容
+title24=変更対象ユニット
btn.label1=検索
btn.label2=通知
btn.label3=依頼
POST /designChange controllers.PartsListController.designChange
GET /designChangeCoverForm controllers.DesignChangeController.create
POST /designChangeCover controllers.DesignChangeController.designChangeCoverRegistration
-GET /designChangeCoverModify controllers.DesignChangeController.designChangeCoverModify(id:Long)
+GET /designChangeCoverModify controllers.DesignChangeController.designChangeCoverModify(designChangeId:Long, dcSeq:Long, message:String)
POST /designChangeCoverModification controllers.DesignChangeController.designChangeCoverModification(id: Long)
POST /designChangeCancel controllers.DesignChangeController.designChangeCancel(id:Long)
+GET /designChangeAppend controllers.DesignChangeController.designChangeAppend(designChangeId:Long, dcSeq:Long, parentName:String)
GET /projectCreate controllers.ProjectController.createProject
POST /projectSave controllers.ProjectController.projectRegistration()
GET /projectModify controllers.ProjectController.updateProject(id:Long)