Browse Source

Merge branch 'master' of baishaojie/tmrgo into develop

baishaojie 3 days ago
parent
commit
00af262507
5 changed files with 5 additions and 28 deletions
  1. BIN
      TMRWatchComm
  2. BIN
      TMRWatchComm.zip
  3. 2 25
      http/handle/api/scheduled.go
  4. 3 3
      http/handle/ymy/ymy.go
  5. BIN
      tmr-watch.exe

BIN
TMRWatchComm


BIN
TMRWatchComm.zip


+ 2 - 25
http/handle/api/scheduled.go

@@ -47,31 +47,6 @@ func CronScheduled(ctx context.Context) {
 		return
 	}
 
-	// duetimecst, _ := time.ParseInLocation("15:04:05", "00:10:00", time.Local)
-	// duetimecst1, _ := time.ParseInLocation("15:04:05", "00:00:00", time.Local)
-	// spec := fmt.Sprintf("@every %v", duetimecst.Sub(duetimecst1))
-
-	// c := cron.New()
-	// c.AddFunc(spec, func() {
-	// 	tx1 := restful.Engine.NewSession()
-	// 	defer tx1.Close()
-	// 	exist, err := tx1.Table("notice").Where("status = 1").And("content = ? ", "downloadedplan_log").Exist()
-	// 	if err != nil {
-	// 		logs.Error("CronScheduled-error-1:", err)
-	// 		return
-	// 	}
-
-	// 	if exist {
-	// 		_, err := tx.SQL(`update notice set status = 0  where content =  ? `, "downloadedplan_log").Execute()
-	// 		if err != nil {
-	// 			logs.Error("CronScheduled-error-2:", err)
-	// 			return
-	// 		}
-	// 		Scheduled(ctx, tx1, pastureinfo)
-	// 	}
-
-	// })
-	// c.Start()
 	//消息提醒
 	duetimecst2, _ := time.ParseInLocation("15:04:05", "00:01:00", time.Local)
 	duetimecst3, _ := time.ParseInLocation("15:04:05", "00:00:00", time.Local)
@@ -547,6 +522,8 @@ func UpdatePush(ctx context.Context, tx *xorm.Session, auto bool, idList []strin
 					} else if targetdata == "idlist" {
 						// args = append(args, strings.Join(idList, ","))
 						item.Datasql = strings.ReplaceAll(item.Datasql, "idlist", strings.Join(idList, ","))
+					} else if targetdata == "date" {
+						args = append(args, date)
 					}
 				}
 

+ 3 - 3
http/handle/ymy/ymy.go

@@ -233,8 +233,8 @@ func YmyFeedtempletPush(pastureId, farmId, date string) error {
 	dataList, err := tx.SQL(`SELECT
 	ft.tcode AS recipeId,
 	ft.TNAME AS recipeName,
-	f.feedcode   AS ingId,
-		f.feedcode   AS feedCode,
+	ifnull(f.feedcode,f.id)   AS ingId,
+		''   AS feedCode,
 	ifnull(f.udname,f.fname) AS ingName,
 	round( fn.dry * ftd.FWEIGHT, 2 ) AS dmQty,
 	ftd.FWEIGHT AS afQty,
@@ -286,7 +286,7 @@ func YmyUtirPush(pastureId, farmId, date string) error {
 		now = time.Now().AddDate(0, 0, -1).Format("2006-01-02")
 	}
 
-	dataList, err := tx.SQL(`select  MD5(CONCAT(d.pid, d.mydate)) loadId , date_format(d1.date,'%Y-%m-%d')  dropDate,date_format(d1.date,'%Y-%m-%d')  loadDate,d.times loadShift,d.id  tmrNo,ft.tcode recipeId,ft.ccname recipeName,'' ingId,'' feedCode ,ifnull(f.fname,ftd.fname)  ingName,
+	dataList, err := tx.SQL(`select  MD5(CONCAT(d.pid, d.mydate)) loadId , date_format(d1.date,'%Y-%m-%d')  dropDate,date_format(d1.date,'%Y-%m-%d')  loadDate,d.times loadShift,d.id  tmrNo,ft.tcode recipeId,ft.ccname recipeName,ifnull(f.feedcode,d1.fid) ingId,'' feedCode ,ifnull(f.fname,ftd.fname)  ingName,
 	ifnull(ifnull(fc.fcname,(select fcname from feedclass fc1 join feed f1 on f1.fclassid = fc1.id where f1.id =ftd.fid )),'饲料') ingType,
 	ifnull(f.dry * d1.actualweightminus,0)  dmPct,d1.sort mixNo,ifnull(d1.feedallowratio,0) allowableError , if(f.fname is not null, ifnull(d1.lweight,''),	ifnull(ftd.fweight / (select sum(fweight)  from ftdetaildate  where  date =  d1.date and ftid = d1.fid ) *  d1.lweight,"") )  expWeight,
 	

BIN
tmr-watch.exe