|
@@ -84,13 +84,35 @@ func praseReportform(sqlnamestr string, parammaps *gofasion.Fasion, tx *xorm.Ses
|
|
case "judgenurFTReportDetail":
|
|
case "judgenurFTReportDetail":
|
|
queryData, err = getAccuracyV8(queryList)
|
|
queryData, err = getAccuracyV8(queryList)
|
|
case "downloadPl":
|
|
case "downloadPl":
|
|
- queryData, err = getAccuracyV9(queryList) //投料简打、累加
|
|
|
|
|
|
+ var sql2, p2 string
|
|
|
|
+ s_params2 := make([]interface{}, 0)
|
|
|
|
+ if sqlnamestr == "downloadPlanSFJD" {
|
|
|
|
+ sql2, p2 = restful.GetSqlByNameDBT("countfl", tx)
|
|
|
|
+ //s_params1 := make([]interface{}, 0)
|
|
|
|
+ if sql2 != "" {
|
|
|
|
+ paramslist1 := strings.Split(p2, ",")
|
|
|
|
+ if len(paramslist1) > 0 && p != "" {
|
|
|
|
+ for _, value := range paramslist1 {
|
|
|
|
+ s_params2 = append(s_params2, parammaps.Get(strings.Trim(value, " ")).ValueStr())
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ queryList2, _ := tx.SQL(sql2, s_params2...).Query().List()
|
|
|
|
+ var flleight string
|
|
|
|
+ if len(queryList2) > 0 {
|
|
|
|
+ flleight, _ = queryList2[0]["flcount"].(string)
|
|
|
|
+ fmt.Println(flleight)
|
|
|
|
+ }
|
|
|
|
+ flleightint, _ := strconv.Atoi(flleight)
|
|
|
|
+ queryData, err = getAccuracyV9(queryList, sqlnamestr, flleightint) //投料简打、累加
|
|
default:
|
|
default:
|
|
queryData, err = nil, nil
|
|
queryData, err = nil, nil
|
|
}
|
|
}
|
|
return
|
|
return
|
|
}
|
|
}
|
|
-func getAccuracyV9(queryList []map[string]interface{}) (map[string]interface{}, error) {
|
|
|
|
|
|
+
|
|
|
|
+func getAccuracyV9(queryList []map[string]interface{}, sqlnamestr string, flleightint int) (map[string]interface{}, error) {
|
|
queryData := make(map[string]interface{})
|
|
queryData := make(map[string]interface{})
|
|
|
|
|
|
chartData := make(map[string]interface{})
|
|
chartData := make(map[string]interface{})
|
|
@@ -107,37 +129,39 @@ func getAccuracyV9(queryList []map[string]interface{}) (map[string]interface{},
|
|
mapc3["prop"] = "tmrtname"
|
|
mapc3["prop"] = "tmrtname"
|
|
data1 = append(data1, mapc3)
|
|
data1 = append(data1, mapc3)
|
|
mapc3 = make(map[string]interface{})
|
|
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{})
|
|
|
|
|
|
+ //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{})
|
|
mtem := make(map[interface{}]interface{})
|
|
var stem []string
|
|
var stem []string
|
|
for i := 0; i < len(queryList); i++ { // 获取所有饲料种类
|
|
for i := 0; i < len(queryList); i++ { // 获取所有饲料种类
|
|
@@ -149,7 +173,22 @@ func getAccuracyV9(queryList []map[string]interface{}) (map[string]interface{},
|
|
|
|
|
|
}
|
|
}
|
|
sort.Strings(stem)
|
|
sort.Strings(stem)
|
|
- for _, va := range stem {
|
|
|
|
|
|
+ fmt.Println(stem)
|
|
|
|
+ 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, aa...)
|
|
|
|
+ //fmt.Println(stemEnd)
|
|
|
|
+ } else {
|
|
|
|
+ stemEnd = stem
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //logging.Info("导出数据 ",stemEnd )
|
|
|
|
+
|
|
|
|
+ fmt.Println(stemEnd)
|
|
|
|
+ for _, va := range stemEnd {
|
|
mapc3["label"] = va
|
|
mapc3["label"] = va
|
|
mapc3["prop"] = va
|
|
mapc3["prop"] = va
|
|
data1 = append(data1, mapc3)
|
|
data1 = append(data1, mapc3)
|
|
@@ -168,9 +207,9 @@ func getAccuracyV9(queryList []map[string]interface{}) (map[string]interface{},
|
|
if i == 0 {
|
|
if i == 0 {
|
|
tem = queryList[i]["projname"]
|
|
tem = queryList[i]["projname"]
|
|
mapc2 = queryList[i]
|
|
mapc2 = queryList[i]
|
|
- //for key:= range mtem {
|
|
|
|
- // mapc2[xorm.String(key)] = ""
|
|
|
|
- //}
|
|
|
|
|
|
+ for key := range mtem {
|
|
|
|
+ mapc2[xorm.String(key)] = "0"
|
|
|
|
+ }
|
|
mapc2[xorm.String(queryList[i]["fname"])] = queryList[i]["lweight"]
|
|
mapc2[xorm.String(queryList[i]["fname"])] = queryList[i]["lweight"]
|
|
}
|
|
}
|
|
if tem == queryList[i]["projname"] {
|
|
if tem == queryList[i]["projname"] {
|
|
@@ -179,9 +218,9 @@ func getAccuracyV9(queryList []map[string]interface{}) (map[string]interface{},
|
|
data2 = append(data2, mapc2)
|
|
data2 = append(data2, mapc2)
|
|
tem = queryList[i]["projname"]
|
|
tem = queryList[i]["projname"]
|
|
mapc2 = queryList[i]
|
|
mapc2 = queryList[i]
|
|
- //for key := range mtem {
|
|
|
|
- // mapc2[xorm.String(key)] = ""
|
|
|
|
- //}
|
|
|
|
|
|
+ for key := range mtem {
|
|
|
|
+ mapc2[xorm.String(key)] = "0"
|
|
|
|
+ }
|
|
mapc2[xorm.String(queryList[i]["fname"])] = queryList[i]["lweight"]
|
|
mapc2[xorm.String(queryList[i]["fname"])] = queryList[i]["lweight"]
|
|
|
|
|
|
}
|
|
}
|
|
@@ -190,9 +229,7 @@ func getAccuracyV9(queryList []map[string]interface{}) (map[string]interface{},
|
|
data2 = append(data2, mapc2)
|
|
data2 = append(data2, mapc2)
|
|
chartData["data1"] = data1
|
|
chartData["data1"] = data1
|
|
chartData["data2"] = data2
|
|
chartData["data2"] = data2
|
|
-
|
|
|
|
queryData["list"] = chartData
|
|
queryData["list"] = chartData
|
|
-
|
|
|
|
queryData["code"] = 0
|
|
queryData["code"] = 0
|
|
queryData["message"] = "ok"
|
|
queryData["message"] = "ok"
|
|
queryData["data"] = queryList
|
|
queryData["data"] = queryList
|