baishaojie 1 tydzień temu
rodzic
commit
57da11ea72
5 zmienionych plików z 22 dodań i 9 usunięć
  1. BIN
      TMRWatchComm
  2. BIN
      TMRWatchComm.zip
  3. 6 7
      http/handle/api/ops.go
  4. 16 2
      http/handle/restful/sql_utils.go
  5. BIN
      tmr-watch.exe

BIN
TMRWatchComm


BIN
TMRWatchComm.zip


+ 6 - 7
http/handle/api/ops.go

@@ -244,30 +244,25 @@ func GetDataByName(c *gin.Context) {
 					nowstr := now.AddDate(0, 0, -i).Format("2006-01-02")
 					go func(nowstr string) {
 						defer wg.Done()
-						fmt.Println(nowstr)
 						sqlstr := `select ifnull( getSLtimeDiffSINGEL ( ?, ? ), 0.0 ) as montime`
 						slTimeList, _ := restful.QueryByMap(sqlstr, 0, 0, []interface{}{pastureid, nowstr})
-						fmt.Println(nowstr)
 						if len(slTimeList.(map[string]interface{})["list"].([]map[string]interface{})) > 0 {
 							m, _ := strconv.ParseFloat(slTimeList.(map[string]interface{})["list"].([]map[string]interface{})[0]["montime"].(string), 64)
 							montimeList = append(montimeList, m)
 						}
 					}(nowstr)
 				}
-				fmt.Println(time.Now())
 				queryData, err := getDataBySqlT(sql, offset, pagecount, returntype, s_params, tx)
 				if err != nil {
 					logging.Error("GetDataByName  err: ", err)
 					msg := geterrmsg(err.Error())
 					appG.Response(http.StatusOK, e.ERROR, msg)
 				}
-				fmt.Println(time.Now())
 				wg.Wait()
 				for _, m := range montimeList {
 					montime += m
 				}
 				queryData.(map[string]interface{})["list"].([]map[string]interface{})[0]["montime"] = Decimal(montime / 30)
-				fmt.Println(time.Now())
 				appG.Response(http.StatusOK, e.SUCCESS, queryData)
 				return
 			}
@@ -3655,7 +3650,7 @@ func UpdateFpdetailBar(c *gin.Context) {
 		ftmap["ptid"] = list.Get("ptid").ValueStr()
 		ftmap["ptsid"] = list.Get("ptsid").ValueStr()
 		// fmt.Println(ftmap)
-		/*
+		// /*
 		count, err := tx.SQL(` select count(1) from lpplandtl1 where pastureid = ? and  lppid in(select  id from lpplan where pastureid = ? and times = ?  )
 		and find_in_set(barid,(select barid from feedp where id = ?  ))  and lweight > 0 `, pastureid, pastureid, ftmap["times"], id).Count()
 		if count == 1 {
@@ -3676,7 +3671,7 @@ func UpdateFpdetailBar(c *gin.Context) {
 				return
 			}
 		}
-		*/
+		// */
 
 		fpdDataList, err := tx.SQL(`
 			SELECT TRIM(id) id,times,tratio,ifnull(ROUND((1-ptsrate)*weight,2)-ptuse,"") weight,TRIM(barid) barid,TRIM(pastureid) pastureid,TRIM((select ftid from feedp where barid =fpdetail.barid)) ptid,TRIM(ifnull(ptsid,-1) ) ptsid ,
@@ -5210,6 +5205,7 @@ func FpdImportExcel(c *gin.Context) {
 				return
 			}
 			// */
+
 			updateFpdetailByBar(pastureid, barname, v)
 		}
 	} else {
@@ -12667,3 +12663,6 @@ func GetLyUdData(c *gin.Context) {
 }
 
 
+
+
+

+ 16 - 2
http/handle/restful/sql_utils.go

@@ -474,8 +474,22 @@ func QueryByMapT(sqlstr string, offset, count int, params []interface{}, tx *xor
 				}
 			}
 
-			tt, err := tx.SQL("select count(1) count from bar where pastureid = ? and enable=1 ", params1[0]).Query().List()
-		if err != nil {
+			tt, err := tx.SQL(` select count(DISTINCT bar.id )  count from  bar 
+LEFT JOIN feedp fp
+ON bar.id = fp.barid  AND fp.pastureid=?
+LEFT JOIN fpdetail fpd
+ON fp.barid = fpd.barid  AND fpd.times<=(SELECT inforvalue FROM sysopt 
+WHERE sysopt.pastureid= ? AND sysopt.inforname= 'times')  AND fpd.pastureid=?
+LEFT JOIN feedtemplet ft
+ON ft.id = fp.ftid  and  ft.pastureid=bar.pastureid
+LEFT JOIN feedtemplet ft1
+ON ft1.id = fp.ptsfid and  ft1.pastureid=bar.pastureid
+WHERE bar.pastureid=?  AND bar.enable=1
+AND (bar.id = ? or ? = '')
+AND (bar.pen = ? or ? = '')
+AND (ft.tname like concat("%",?,"%") or ? = '')  `, params1[0],params1[0],params1[0],params1[0],params1[5],params1[5],params1[7],params1[7],params1[9],params1[9]).Query().List()
+	fmt.Println( params1[0],params1[0],params1[0],params1[0],params1[5],params1[5],params1[7],params1[7],params1[9],params1[9])
+if err != nil {
 			fmt.Println("s1", err)
 			return nil, err
 		}

BIN
tmr-watch.exe