|
@@ -3,8 +3,11 @@ package new_mobile_api_controllers
|
3
|
3
|
import (
|
4
|
4
|
"XT_New/controllers"
|
5
|
5
|
"XT_New/enums"
|
|
6
|
+ "XT_New/models"
|
6
|
7
|
"XT_New/service"
|
|
8
|
+ "encoding/json"
|
7
|
9
|
"fmt"
|
|
10
|
+ "time"
|
8
|
11
|
)
|
9
|
12
|
|
10
|
13
|
type CommonApiController struct {
|
|
@@ -49,19 +52,40 @@ func (this *CommonApiController) GetInspectionRange() {
|
49
|
52
|
})
|
50
|
53
|
}
|
51
|
54
|
|
52
|
|
-func (this *CommonApiController) SaveInspection() {
|
|
55
|
+func (this *CommonApiController) SaveInspectionTwo() {
|
|
56
|
+ adminInfo := this.GetAdminUserInfo()
|
|
57
|
+ orgid := adminInfo.CurrentOrgId
|
53
|
58
|
fmt.Println("触发-------------------0")
|
54
|
|
- //dataBody := make(map[string]interface{}, 0)
|
55
|
|
- //err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
56
|
|
- //fmt.Println("err",err)
|
57
|
|
- //inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
|
58
|
|
- //fmt.Println("大项",inspectionmajor)
|
59
|
|
- //inspectionMinor := int64(dataBody["inspectionMinor"].(float64))
|
60
|
|
- //fmt.Println("小项",inspectionMinor)
|
61
|
|
- //minrange := dataBody["min_range"].(string)
|
62
|
|
- //fmt.Println("minragne",minrange)
|
63
|
|
- //largerange := dataBody["large_range"].(string)
|
64
|
|
- //fmt.Println("largerange",largerange)
|
65
|
|
- //sort := dataBody["sort"].(string)
|
66
|
|
- //fmt.Println("sort",sort)
|
|
59
|
+ dataBody := make(map[string]interface{}, 0)
|
|
60
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
|
61
|
+ fmt.Println("err", err)
|
|
62
|
+ inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
|
|
63
|
+ fmt.Println("大项", inspectionmajor)
|
|
64
|
+ inspectionMinor := int64(dataBody["inspectionMinor"].(float64))
|
|
65
|
+ fmt.Println("小项", inspectionMinor)
|
|
66
|
+ minrange := dataBody["min_range"].(string)
|
|
67
|
+ fmt.Println("minragne", minrange)
|
|
68
|
+ largerange := dataBody["large_range"].(string)
|
|
69
|
+ fmt.Println("largerange", largerange)
|
|
70
|
+ sort := dataBody["sort"].(string)
|
|
71
|
+ fmt.Println("sort", sort)
|
|
72
|
+ standard := models.XtQualityControlStandard{
|
|
73
|
+ InspectionMajor: inspectionmajor,
|
|
74
|
+ InspectionMinor: inspectionMinor,
|
|
75
|
+ MinRange: minrange,
|
|
76
|
+ LargeRange: largerange,
|
|
77
|
+ Sort: sort,
|
|
78
|
+ UserOrgId: orgid,
|
|
79
|
+ Status: 1,
|
|
80
|
+ CreatedTime: time.Now().Unix(),
|
|
81
|
+ }
|
|
82
|
+ fmt.Println(standard)
|
|
83
|
+ err = service.SaveInspection(&standard)
|
|
84
|
+ if err != nil {
|
|
85
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
86
|
+ return
|
|
87
|
+ }
|
|
88
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
89
|
+ "standard": standard,
|
|
90
|
+ })
|
67
|
91
|
}
|