product_plan_controller.go
4.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productPlan/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productPlan/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productPlan/service"
)
type ProductPlanController struct {
beego.BaseController
}
func (controller *ProductPlanController) CreateProductPlan() {
productPlanService := service.NewProductPlanService(nil)
createProductPlanCommand := &command.CreateProductPlanCommand{}
controller.Unmarshal(createProductPlanCommand)
data, err := productPlanService.CreateProductPlan(createProductPlanCommand)
controller.Response(data, err)
}
func (controller *ProductPlanController) UpdateProductPlan() {
productPlanService := service.NewProductPlanService(nil)
updateProductPlanCommand := &command.UpdateProductPlanCommand{}
controller.Unmarshal(updateProductPlanCommand)
productPlanId, _ := controller.GetInt(":productPlanId")
updateProductPlanCommand.ProductPlanId = productPlanId
data, err := productPlanService.UpdateProductPlan(updateProductPlanCommand)
controller.Response(data, err)
}
func (controller *ProductPlanController) GetProductPlan() {
productPlanService := service.NewProductPlanService(nil)
getProductPlanQuery := &query.GetProductPlanQuery{}
productPlanId, _ := controller.GetInt(":productPlanId")
getProductPlanQuery.ProductPlanId = productPlanId
data, err := productPlanService.GetProductPlan(getProductPlanQuery)
controller.Response(data, err)
}
func (controller *ProductPlanController) RemoveProductPlan() {
productPlanService := service.NewProductPlanService(nil)
removeProductPlanCommand := &command.RemoveProductPlanCommand{}
controller.Unmarshal(removeProductPlanCommand)
productPlanId, _ := controller.GetInt(":productPlanId")
removeProductPlanCommand.ProductPlanId = productPlanId
data, err := productPlanService.RemoveProductPlan(removeProductPlanCommand)
controller.Response(data, err)
}
func (controller *ProductPlanController) ListProductPlan() {
productPlanService := service.NewProductPlanService(nil)
listProductPlanQuery := &query.ListProductPlanQuery{}
offset, _ := controller.GetInt("offset")
listProductPlanQuery.Offset = offset
limit, _ := controller.GetInt("limit")
listProductPlanQuery.Limit = limit
data, err := productPlanService.ListProductPlan(listProductPlanQuery)
controller.Response(data, err)
}
func (controller *ProductPlanController) ReceiveMaterial() {
productPlanService := service.NewProductPlanService(nil)
receiveMaterialCommand := &command.ReceiveMaterialCommand{}
controller.Unmarshal(receiveMaterialCommand)
data, err := productPlanService.ReceiveMaterial(receiveMaterialCommand)
controller.Response(data, err)
}
func (controller *ProductPlanController) ReturnMaterial() {
productPlanService := service.NewProductPlanService(nil)
returnMaterialCommand := &command.ReturnMaterialCommand{}
controller.Unmarshal(returnMaterialCommand)
data, err := productPlanService.ReturnMaterial(returnMaterialCommand)
controller.Response(data, err)
}
func (controller *ProductPlanController) SetOnline() {
productPlanService := service.NewProductPlanService(nil)
setOnlineCommand := &command.SetOnlineCommand{}
controller.Unmarshal(setOnlineCommand)
data, err := productPlanService.SetOnline(setOnlineCommand)
controller.Response(data, err)
}
func (controller *ProductPlanController) Switch() {
productPlanService := service.NewProductPlanService(nil)
switchCommand := &command.SwitchCommand{}
controller.Unmarshal(switchCommand)
data, err := productPlanService.Switch(switchCommand)
controller.Response(data, err)
}
func (controller *ProductPlanController) SubmitProductRecord() {
productPlanService := service.NewProductPlanService(nil)
submitProductRecordCommand := &command.SubmitProductRecordCommand{}
controller.Unmarshal(submitProductRecordCommand)
data, err := productPlanService.SubmitProductRecord(submitProductRecordCommand)
controller.Response(data, err)
}