|
@@ -7,6 +7,7 @@ import (
|
7
|
7
|
"XT_New/service"
|
8
|
8
|
"encoding/json"
|
9
|
9
|
"fmt"
|
|
10
|
+ "strconv"
|
10
|
11
|
"time"
|
11
|
12
|
)
|
12
|
13
|
|
|
@@ -28,7 +29,6 @@ func (this *CommonApiController) GetInspectionMajor() {
|
28
|
29
|
|
29
|
30
|
func (this *CommonApiController) GetInspectionMinor() {
|
30
|
31
|
id, _ := this.GetInt64("id")
|
31
|
|
- fmt.Println("id----------------------------------------", id)
|
32
|
32
|
minor, err := service.GetInspectionMinor(id)
|
33
|
33
|
if err != nil {
|
34
|
34
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
@@ -55,8 +55,6 @@ func (this *CommonApiController) GetInspectionRange() {
|
55
|
55
|
func (this *CommonApiController) SaveConfiguration() {
|
56
|
56
|
adminInfo := this.GetAdminUserInfo()
|
57
|
57
|
orgid := adminInfo.CurrentOrgId
|
58
|
|
- fmt.Println(orgid)
|
59
|
|
- fmt.Println("触发-------------------0")
|
60
|
58
|
dataBody := make(map[string]interface{}, 0)
|
61
|
59
|
err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
62
|
60
|
fmt.Println("err", err)
|
|
@@ -69,13 +67,14 @@ func (this *CommonApiController) SaveConfiguration() {
|
69
|
67
|
largerange := dataBody["large_range"].(string)
|
70
|
68
|
fmt.Println("largerange", largerange)
|
71
|
69
|
sort := dataBody["sort"].(string)
|
|
70
|
+ sorts, err := strconv.ParseInt(sort, 10, 64)
|
72
|
71
|
fmt.Println("sort", sort)
|
73
|
72
|
standard := models.XtQualityControlStandard{
|
74
|
73
|
InspectionMajor: inspectionmajor,
|
75
|
74
|
InspectionMinor: inspectionMinor,
|
76
|
75
|
MinRange: minrange,
|
77
|
76
|
LargeRange: largerange,
|
78
|
|
- Sort: sort,
|
|
77
|
+ Sort: sorts,
|
79
|
78
|
UserOrgId: orgid,
|
80
|
79
|
Status: 1,
|
81
|
80
|
CreatedTime: time.Now().Unix(),
|
|
@@ -106,3 +105,74 @@ func (this *CommonApiController) GetConfigurationlist() {
|
106
|
105
|
"total": total,
|
107
|
106
|
})
|
108
|
107
|
}
|
|
108
|
+
|
|
109
|
+func (this *CommonApiController) GetConfigurationDetail() {
|
|
110
|
+ id, _ := this.GetInt64("id")
|
|
111
|
+ fmt.Println("id是", id)
|
|
112
|
+ detail, err := service.GetConfigurationDetail(id)
|
|
113
|
+ if err != nil {
|
|
114
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
115
|
+ return
|
|
116
|
+ }
|
|
117
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
118
|
+ "configurationdetail": detail,
|
|
119
|
+ })
|
|
120
|
+}
|
|
121
|
+
|
|
122
|
+func (this *CommonApiController) GetAllInspectionminor() {
|
|
123
|
+
|
|
124
|
+ minor, err := service.GetAllInspectionMinor(0)
|
|
125
|
+ if err != nil {
|
|
126
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
127
|
+ return
|
|
128
|
+ }
|
|
129
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
130
|
+ "minor": minor,
|
|
131
|
+ })
|
|
132
|
+}
|
|
133
|
+
|
|
134
|
+func (this *CommonApiController) UpdateConfiguration() {
|
|
135
|
+ id, _ := this.GetInt64("id")
|
|
136
|
+ fmt.Println("id", id)
|
|
137
|
+ dataBody := make(map[string]interface{}, 0)
|
|
138
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
|
139
|
+ fmt.Println("err", err)
|
|
140
|
+ inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
|
|
141
|
+ fmt.Println("大项", inspectionmajor)
|
|
142
|
+ inspectionMinor := int64(dataBody["inspectionMinor"].(float64))
|
|
143
|
+ fmt.Println("小项", inspectionMinor)
|
|
144
|
+ minrange := dataBody["min_range"].(string)
|
|
145
|
+ fmt.Println("minragne", minrange)
|
|
146
|
+ largerange := dataBody["large_range"].(string)
|
|
147
|
+ fmt.Println("largerange", largerange)
|
|
148
|
+ sort := int64(dataBody["sort"].(float64))
|
|
149
|
+
|
|
150
|
+ standard := models.XtQualityControlStandard{
|
|
151
|
+ InspectionMajor: inspectionmajor,
|
|
152
|
+ InspectionMinor: inspectionMinor,
|
|
153
|
+ MinRange: minrange,
|
|
154
|
+ LargeRange: largerange,
|
|
155
|
+ Sort: sort,
|
|
156
|
+ }
|
|
157
|
+ err = service.UpdarteConfiguration(&standard, id)
|
|
158
|
+ if err != nil {
|
|
159
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
160
|
+ return
|
|
161
|
+ }
|
|
162
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
163
|
+ "standard": standard,
|
|
164
|
+ })
|
|
165
|
+}
|
|
166
|
+
|
|
167
|
+func (this *CommonApiController) DeleteConfiguration() {
|
|
168
|
+ id, _ := this.GetInt64("id")
|
|
169
|
+ err := service.DeleteConfiguration(id)
|
|
170
|
+ if err != nil {
|
|
171
|
+ this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
|
|
172
|
+ return
|
|
173
|
+ }
|
|
174
|
+ returnData := make(map[string]interface{}, 0)
|
|
175
|
+ returnData["msg"] = "ok"
|
|
176
|
+ this.ServeSuccessJSON(returnData)
|
|
177
|
+ return
|
|
178
|
+}
|