|
@@ -167,11 +167,23 @@ func praseReportform(sqlnamestr string, parammaps *gofasion.Fasion, tx *xorm.Ses
|
|
|
// fmt.Println(flleight)
|
|
|
}
|
|
|
flleightint, _ := strconv.Atoi(flleight)
|
|
|
- if sqlnamestr == "downloadPlanTSLJD" {
|
|
|
- queryData, err = getAccuracyV9(queryList, sqlnamestr, flleightint, feednamesort3)
|
|
|
+ // getAccuracyV9English
|
|
|
+ languageStatus := GetLanguageStatus()
|
|
|
+
|
|
|
+ if languageStatus == "0" {
|
|
|
+ if sqlnamestr == "downloadPlanTSLJD" {
|
|
|
+ queryData, err = getAccuracyV9(queryList, sqlnamestr, flleightint, feednamesort3)
|
|
|
+ } else {
|
|
|
+ queryData, err = getAccuracyV9(queryList, sqlnamestr, flleightint, feednamesort) //投料简打、累加
|
|
|
+ }
|
|
|
} else {
|
|
|
- queryData, err = getAccuracyV9(queryList, sqlnamestr, flleightint, feednamesort) //投料简打、累加
|
|
|
+ if sqlnamestr == "downloadPlanTSLJD" {
|
|
|
+ queryData, err = getAccuracyV9English(queryList, sqlnamestr, flleightint, feednamesort3)
|
|
|
+ } else {
|
|
|
+ queryData, err = getAccuracyV9English(queryList, sqlnamestr, flleightint, feednamesort) //投料简打、累加
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
default:
|
|
|
queryData, err = nil, nil
|
|
|
}
|
|
@@ -359,6 +371,189 @@ func getAccuracyV9(queryList []map[string]interface{}, sqlnamestr string, flleig
|
|
|
queryData["data"] = queryList
|
|
|
return queryData, nil
|
|
|
}
|
|
|
+
|
|
|
+func getAccuracyV9English(queryList []map[string]interface{}, sqlnamestr string, flleightint int, feednamesort []string) (map[string]interface{}, error) {
|
|
|
+ queryData := make(map[string]interface{})
|
|
|
+
|
|
|
+ chartData := make(map[string]interface{})
|
|
|
+ mapc3 := make(map[string]interface{})
|
|
|
+ data2 := []interface{}{}
|
|
|
+ data1 := []interface{}{}
|
|
|
+
|
|
|
+ mapc3["label"] = "Batch"
|
|
|
+ mapc3["prop"] = "projname"
|
|
|
+ data1 = append(data1, mapc3)
|
|
|
+ mapc3 = make(map[string]interface{})
|
|
|
+
|
|
|
+ mapc3["label"] = "TMR"
|
|
|
+ mapc3["prop"] = "tmrtname"
|
|
|
+ data1 = append(data1, mapc3)
|
|
|
+ mapc3 = make(map[string]interface{})
|
|
|
+ //if sqlnamestr == "downloadPlanSFJD":
|
|
|
+
|
|
|
+ //mapc3["label"] = "时间"
|
|
|
+ //mapc3["prop"] = "plantime"
|
|
|
+ //data1 = append(data1, mapc3)
|
|
|
+ //mapc3 = make(map[string]interface{})
|
|
|
+ //
|
|
|
+ //mapc3["label"] = "班组"
|
|
|
+ //mapc3["prop"] = "times"
|
|
|
+ //data1 = append(data1, mapc3)
|
|
|
+ //mapc3 = make(map[string]interface{})
|
|
|
+ //
|
|
|
+ //mapc3["label"] = "驾驶员"
|
|
|
+ //mapc3["prop"] = "driver"
|
|
|
+ //data1 = append(data1, mapc3)
|
|
|
+ //mapc3 = make(map[string]interface{})
|
|
|
+ //
|
|
|
+ //mapc3["label"] = "日系数比例"
|
|
|
+ //mapc3["prop"] = "rate"
|
|
|
+ //data1 = append(data1, mapc3)
|
|
|
+ //mapc3 = make(map[string]interface{})
|
|
|
+ //
|
|
|
+ //mapc3["label"] = "牛头数"
|
|
|
+ //mapc3["prop"] = "feedpcount"
|
|
|
+ //data1 = append(data1, mapc3)
|
|
|
+ //mapc3 = make(map[string]interface{})
|
|
|
+ //
|
|
|
+ //mapc3["label"] = "配方模板"
|
|
|
+ //mapc3["prop"] = "templetname"
|
|
|
+ //data1 = append(data1, mapc3)
|
|
|
+ //mapc3 = make(map[string]interface{})
|
|
|
+
|
|
|
+ //#######################################################################################
|
|
|
+ mtem := make(map[interface{}]interface{})
|
|
|
+ var stem, feedNames []string
|
|
|
+
|
|
|
+ for _, feed := range feednamesort {
|
|
|
+ feed = strings.ReplaceAll(feed, " ", "")
|
|
|
+ mtem[feed] = struct{}{}
|
|
|
+ // fmt.Println(feed)
|
|
|
+ stem = append(stem, feed)
|
|
|
+ }
|
|
|
+
|
|
|
+ for i := 0; i < len(queryList); i++ { // 获取所有饲料种类
|
|
|
+ // if _, ok := mtem[queryList[i]["fname"]]; ok {
|
|
|
+ // continue
|
|
|
+ // }
|
|
|
+
|
|
|
+ // stem = append(stem, queryList[i]["fname"].(string))
|
|
|
+ // mtem[queryList[i]["fname"]] = struct{}{}
|
|
|
+ feedNames = append(feedNames, queryList[i]["fname"].(string))
|
|
|
+
|
|
|
+ }
|
|
|
+ sort.Strings(feedNames)
|
|
|
+ for _, feed := range feedNames {
|
|
|
+ if _, ok := mtem[feed]; ok {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ // fmt.Println(feed)
|
|
|
+ stem = append(stem, feed)
|
|
|
+ mtem[feed] = struct{}{}
|
|
|
+ }
|
|
|
+
|
|
|
+ stemEnd := []string{}
|
|
|
+ if sqlnamestr == "downloadPlanSFJD" {
|
|
|
+ bb := stem[len(stem)-flleightint : len(stem) : len(stem)]
|
|
|
+ //aa := stem[0 : len(stem)-flleightint : len(stem)]
|
|
|
+ stemEnd = append(stemEnd, bb...)
|
|
|
+ stemEnd = append(stemEnd, feednamesort...)
|
|
|
+ //fmt.Println(stemEnd)
|
|
|
+ } else {
|
|
|
+ stemEnd = stem
|
|
|
+ }
|
|
|
+
|
|
|
+ //logging.Info("导出数据 ",stemEnd )
|
|
|
+
|
|
|
+ for _, va := range stemEnd {
|
|
|
+ mapc3["label"] = va
|
|
|
+ mapc3["prop"] = va
|
|
|
+ data1 = append(data1, mapc3)
|
|
|
+ mapc3 = make(map[string]interface{})
|
|
|
+ }
|
|
|
+ if queryList[0]["sumlweight"] != nil {
|
|
|
+ mapc3["label"] = "Sum"
|
|
|
+ mapc3["prop"] = "sumlweight"
|
|
|
+ }
|
|
|
+ data1 = append(data1, mapc3)
|
|
|
+ mapc3 = make(map[string]interface{})
|
|
|
+ var tem interface{}
|
|
|
+ mapc2 := make(map[string]interface{})
|
|
|
+ for i := 0; i < len(queryList); i++ { // 获取所有饲料种类
|
|
|
+
|
|
|
+ if i == 0 {
|
|
|
+ tem = queryList[i]["projname"]
|
|
|
+ mapc2 = queryList[i]
|
|
|
+ if mapc2["sumlweight"] != nil {
|
|
|
+ var sumlweight float64
|
|
|
+ sumlweight, _ = strconv.ParseFloat(mapc2["sumlweight"].(string), 64)
|
|
|
+ mapc2["sumlweight"] = sumlweight
|
|
|
+ }
|
|
|
+
|
|
|
+ for key := range mtem {
|
|
|
+ mapc2[xorm.String(key)] = 0
|
|
|
+ }
|
|
|
+ // var lweight float64
|
|
|
+ if queryList[i]["lweight"] != nil {
|
|
|
+ // var error errors.Error
|
|
|
+ lweight, err := strconv.ParseFloat(queryList[i]["lweight"].(string), 64)
|
|
|
+ if err == nil {
|
|
|
+ mapc2[xorm.String(queryList[i]["fname"])] = lweight
|
|
|
+ } else {
|
|
|
+ mapc2[xorm.String(queryList[i]["fname"])] = queryList[i]["lweight"]
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ mapc2[xorm.String(queryList[i]["fname"])] = queryList[i]["lweight"]
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ if tem == queryList[i]["projname"] {
|
|
|
+ // var lweight float64
|
|
|
+ if queryList[i]["lweight"] != nil {
|
|
|
+ lweight, err := strconv.ParseFloat(queryList[i]["lweight"].(string), 64)
|
|
|
+ if err == nil {
|
|
|
+ mapc2[xorm.String(queryList[i]["fname"])] = lweight
|
|
|
+ } else {
|
|
|
+ mapc2[xorm.String(queryList[i]["fname"])] = queryList[i]["lweight"]
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ mapc2[xorm.String(queryList[i]["fname"])] = queryList[i]["lweight"]
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ data2 = append(data2, mapc2)
|
|
|
+ tem = queryList[i]["projname"]
|
|
|
+ mapc2 = queryList[i]
|
|
|
+ if mapc2["sumlweight"] != nil {
|
|
|
+ var sumlweight float64
|
|
|
+ sumlweight, _ = strconv.ParseFloat(mapc2["sumlweight"].(string), 64)
|
|
|
+ mapc2["sumlweight"] = sumlweight
|
|
|
+ }
|
|
|
+ for key := range mtem {
|
|
|
+ mapc2[xorm.String(key)] = 0
|
|
|
+ }
|
|
|
+ if queryList[i]["lweight"] != nil {
|
|
|
+ lweight, err := strconv.ParseFloat(queryList[i]["lweight"].(string), 64)
|
|
|
+ if err == nil {
|
|
|
+ mapc2[xorm.String(queryList[i]["fname"])] = lweight
|
|
|
+ } else {
|
|
|
+ mapc2[xorm.String(queryList[i]["fname"])] = queryList[i]["lweight"]
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ mapc2[xorm.String(queryList[i]["fname"])] = queryList[i]["lweight"]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ data2 = append(data2, mapc2)
|
|
|
+ chartData["data1"] = data1
|
|
|
+ chartData["data2"] = data2
|
|
|
+ queryData["list"] = chartData
|
|
|
+ queryData["code"] = 0
|
|
|
+ queryData["message"] = "ok"
|
|
|
+ queryData["data"] = queryList
|
|
|
+ return queryData, nil
|
|
|
+}
|
|
|
+
|
|
|
func getAccuracyV8(queryList []map[string]interface{}) (map[string]interface{}, error) {
|
|
|
queryData := make(map[string]interface{})
|
|
|
chartData := make(map[string]interface{})
|