|
@@ -2018,83 +2018,78 @@ func (this *MachineApiController) SaveRepair() {
|
2018
|
2018
|
loc, _ := time.LoadLocation("Local")
|
2019
|
2019
|
adminUserInfo := this.GetAdminUserInfo()
|
2020
|
2020
|
id, _ := this.GetInt64("id")
|
2021
|
|
- fmt.Println("id", id)
|
|
2021
|
+
|
2022
|
2022
|
addmacher, _ := service.GetBedId(id)
|
2023
|
2023
|
OrgID := adminUserInfo.CurrentOrgId
|
2024
|
|
- fmt.Println("orgid", OrgID)
|
|
2024
|
+
|
2025
|
2025
|
dataBody := make(map[string]interface{}, 0)
|
2026
|
2026
|
err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
2027
|
2027
|
fmt.Println("err", err)
|
2028
|
2028
|
gua_date := dataBody["guarantee_date"].(string)
|
2029
|
|
- fmt.Println("保修日期", gua_date)
|
|
2029
|
+
|
2030
|
2030
|
inLocation, _ := time.ParseInLocation(timeLayout+" 15:04:05", gua_date+" 00:00:00", loc)
|
2031
|
2031
|
guaDate := inLocation.Unix()
|
2032
|
|
- fmt.Println("保修日期", guaDate)
|
2033
|
2032
|
|
2034
|
2033
|
startDateStr := dataBody["start_time"].(string)
|
2035
|
|
- fmt.Println("出发时间", startDateStr)
|
|
2034
|
+
|
2036
|
2035
|
startDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", startDateStr)
|
2037
|
|
- fmt.Println("触发事件", startDate.Unix())
|
2038
|
2036
|
|
2039
|
2037
|
arriveDateStr := dataBody["arrive_time"].(string)
|
2040
|
|
- fmt.Println("到达时间", arriveDateStr)
|
|
2038
|
+
|
2041
|
2039
|
arriveDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", arriveDateStr)
|
2042
|
|
- fmt.Println("到达时间", arriveDate.Unix())
|
2043
|
2040
|
|
2044
|
2041
|
finishDateStr := dataBody["finish_time"].(string)
|
2045
|
|
- fmt.Println("完成时间", finishDateStr)
|
|
2042
|
+
|
2046
|
2043
|
finishDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", finishDateStr)
|
2047
|
|
- fmt.Println("完成时间", finishDate.Unix())
|
2048
|
2044
|
|
2049
|
2045
|
totaldistance := dataBody["total_distance"].(string)
|
2050
|
|
- fmt.Println("总公里输", totaldistance)
|
2051
|
2046
|
|
2052
|
2047
|
failurestate := int64(dataBody["failure_stage"].(float64))
|
2053
|
|
- fmt.Println("故事范式阶段", failurestate)
|
2054
|
2048
|
|
2055
|
2049
|
codeInformation := dataBody["code_information"].(string)
|
2056
|
|
- fmt.Println("故事提示信息及代码", codeInformation)
|
2057
|
2050
|
|
2058
|
2051
|
faultdescription := dataBody["fault_description"].(string)
|
2059
|
|
- fmt.Println("故障描述", faultdescription)
|
2060
|
2052
|
|
2061
|
2053
|
causeAnalysis := dataBody["cause_analysis"].(string)
|
2062
|
|
- fmt.Println("原因分析", causeAnalysis)
|
2063
|
2054
|
|
2064
|
2055
|
treatmentprocess := dataBody["treatment_process"].(string)
|
2065
|
|
- fmt.Println("处理过程", treatmentprocess)
|
2066
|
2056
|
|
2067
|
2057
|
images := dataBody["images"].(string)
|
2068
|
|
- fmt.Println("上传图片", images)
|
2069
|
2058
|
|
2070
|
2059
|
exclude := int64(dataBody["exclude"].(float64))
|
2071
|
|
- fmt.Println("故障是否排除", exclude)
|
2072
|
2060
|
|
2073
|
2061
|
reason := dataBody["reason"].(string)
|
2074
|
|
- fmt.Println("原因", reason)
|
2075
|
2062
|
|
2076
|
2063
|
imageName := dataBody["imageName"].(string)
|
2077
|
2064
|
|
|
2065
|
+ function_accessories_inspection := dataBody["function_accessories_inspection"].(string)
|
|
2066
|
+
|
|
2067
|
+ other_information := dataBody["other_information"].(string)
|
|
2068
|
+
|
|
2069
|
+ admin_user_id := int64(dataBody["admin_user_id"].(float64))
|
2078
|
2070
|
repair := models.DeviceRepair{
|
2079
|
|
- BedId: addmacher.BedId,
|
2080
|
|
- EquitmentId: id,
|
2081
|
|
- GuaranteeDate: guaDate,
|
2082
|
|
- StartTime: startDate.Unix(),
|
2083
|
|
- ArriveTime: arriveDate.Unix(),
|
2084
|
|
- FinishTime: finishDate.Unix(),
|
2085
|
|
- TotalDistance: totaldistance,
|
2086
|
|
- FailureStage: failurestate,
|
2087
|
|
- FaultDescription: faultdescription,
|
2088
|
|
- CauseAnalysis: causeAnalysis,
|
2089
|
|
- TreatmentProcess: treatmentprocess,
|
2090
|
|
- Images: images,
|
2091
|
|
- Exclude: exclude,
|
2092
|
|
- Reason: reason,
|
2093
|
|
- Status: 1,
|
2094
|
|
- UserOrgId: OrgID,
|
2095
|
|
- Ctime: time.Now().Unix(),
|
2096
|
|
- CodeInformation: codeInformation,
|
2097
|
|
- ImageName: imageName,
|
|
2071
|
+ BedId: addmacher.BedId,
|
|
2072
|
+ EquitmentId: id,
|
|
2073
|
+ GuaranteeDate: guaDate,
|
|
2074
|
+ StartTime: startDate.Unix(),
|
|
2075
|
+ ArriveTime: arriveDate.Unix(),
|
|
2076
|
+ FinishTime: finishDate.Unix(),
|
|
2077
|
+ TotalDistance: totaldistance,
|
|
2078
|
+ FailureStage: failurestate,
|
|
2079
|
+ FaultDescription: faultdescription,
|
|
2080
|
+ CauseAnalysis: causeAnalysis,
|
|
2081
|
+ TreatmentProcess: treatmentprocess,
|
|
2082
|
+ Images: images,
|
|
2083
|
+ Exclude: exclude,
|
|
2084
|
+ Reason: reason,
|
|
2085
|
+ Status: 1,
|
|
2086
|
+ UserOrgId: OrgID,
|
|
2087
|
+ Ctime: time.Now().Unix(),
|
|
2088
|
+ CodeInformation: codeInformation,
|
|
2089
|
+ ImageName: imageName,
|
|
2090
|
+ FunctionAccessoriesInspection: function_accessories_inspection,
|
|
2091
|
+ OtherInformation: other_information,
|
|
2092
|
+ AdminUserId: admin_user_id,
|
2098
|
2093
|
}
|
2099
|
2094
|
err = service.CreateRepair(&repair)
|
2100
|
2095
|
if err != nil {
|
|
@@ -2111,27 +2106,38 @@ func (this *MachineApiController) GetAllRepair() {
|
2111
|
2106
|
page, _ := this.GetInt64("page")
|
2112
|
2107
|
adminUser := this.GetAdminUserInfo()
|
2113
|
2108
|
orgID := adminUser.CurrentOrgId
|
|
2109
|
+ appId := adminUser.CurrentAppId
|
2114
|
2110
|
repair, total, err := service.GetAllRepair(orgID, limit, page)
|
|
2111
|
+
|
|
2112
|
+ addmacher, _ := service.GetAllMachineByOrgId(orgID)
|
|
2113
|
+
|
|
2114
|
+ docList, _ := service.GetAllDoctor(orgID, appId)
|
2115
|
2115
|
if err != nil {
|
2116
|
2116
|
this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
|
2117
|
2117
|
return
|
2118
|
2118
|
}
|
2119
|
2119
|
this.ServeSuccessJSON(map[string]interface{}{
|
2120
|
|
- "repair": repair,
|
2121
|
|
- "total": total,
|
|
2120
|
+ "repair": repair,
|
|
2121
|
+ "total": total,
|
|
2122
|
+ "macherList": addmacher,
|
|
2123
|
+ "docList": docList,
|
2122
|
2124
|
})
|
2123
|
2125
|
}
|
2124
|
2126
|
|
2125
|
2127
|
func (this *MachineApiController) EditRepair() {
|
2126
|
2128
|
id, _ := this.GetInt64("id")
|
2127
|
|
- fmt.Println("id", id)
|
|
2129
|
+
|
|
2130
|
+ appId := this.GetAdminUserInfo().CurrentAppId
|
|
2131
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
2128
|
2132
|
repair, err := service.EditRepair(id)
|
|
2133
|
+ docList, _ := service.GetAllDoctor(orgId, appId)
|
2129
|
2134
|
if err != nil {
|
2130
|
2135
|
this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
|
2131
|
2136
|
return
|
2132
|
2137
|
}
|
2133
|
2138
|
this.ServeSuccessJSON(map[string]interface{}{
|
2134
|
|
- "repair": repair,
|
|
2139
|
+ "repair": repair,
|
|
2140
|
+ "docList": docList,
|
2135
|
2141
|
})
|
2136
|
2142
|
}
|
2137
|
2143
|
|
|
@@ -2194,21 +2200,30 @@ func (this *MachineApiController) UpdateRepair() {
|
2194
|
2200
|
fmt.Println("原因", reason)
|
2195
|
2201
|
|
2196
|
2202
|
imageName := dataBody["image_name"].(string)
|
|
2203
|
+
|
|
2204
|
+ function_accessories_inspection := dataBody["function_accessories_inspection"].(string)
|
|
2205
|
+
|
|
2206
|
+ other_information := dataBody["other_information"].(string)
|
|
2207
|
+
|
|
2208
|
+ admin_user_id := int64(dataBody["admin_user_id"].(float64))
|
2197
|
2209
|
deviceRepair := models.DeviceRepair{
|
2198
|
|
- GuaranteeDate: guaDate,
|
2199
|
|
- StartTime: startDate.Unix(),
|
2200
|
|
- ArriveTime: arriveDate.Unix(),
|
2201
|
|
- FinishTime: finishDate.Unix(),
|
2202
|
|
- TotalDistance: totaldistance,
|
2203
|
|
- FailureStage: failurestate,
|
2204
|
|
- FaultDescription: faultdescription,
|
2205
|
|
- CauseAnalysis: causeAnalysis,
|
2206
|
|
- TreatmentProcess: treatmentprocess,
|
2207
|
|
- Images: images,
|
2208
|
|
- Exclude: exclude,
|
2209
|
|
- Reason: reason,
|
2210
|
|
- CodeInformation: codeInformation,
|
2211
|
|
- ImageName: imageName,
|
|
2210
|
+ GuaranteeDate: guaDate,
|
|
2211
|
+ StartTime: startDate.Unix(),
|
|
2212
|
+ ArriveTime: arriveDate.Unix(),
|
|
2213
|
+ FinishTime: finishDate.Unix(),
|
|
2214
|
+ TotalDistance: totaldistance,
|
|
2215
|
+ FailureStage: failurestate,
|
|
2216
|
+ FaultDescription: faultdescription,
|
|
2217
|
+ CauseAnalysis: causeAnalysis,
|
|
2218
|
+ TreatmentProcess: treatmentprocess,
|
|
2219
|
+ Images: images,
|
|
2220
|
+ Exclude: exclude,
|
|
2221
|
+ Reason: reason,
|
|
2222
|
+ CodeInformation: codeInformation,
|
|
2223
|
+ ImageName: imageName,
|
|
2224
|
+ FunctionAccessoriesInspection: function_accessories_inspection,
|
|
2225
|
+ OtherInformation: other_information,
|
|
2226
|
+ AdminUserId: admin_user_id,
|
2212
|
2227
|
}
|
2213
|
2228
|
err = service.UpdateRepair(id, OrgID, &deviceRepair)
|
2214
|
2229
|
if err != nil {
|