|
@@ -5184,7 +5184,7 @@ func FpdImportExcel(c *gin.Context) {
|
|
|
// }
|
|
// }
|
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
- // /*
|
|
|
|
|
|
|
+ /*
|
|
|
_, err = tx.SQL(` update lpplandtl1 set lweight = 0 where pastureid = ? and lppid in(select id from lpplan where pastureid = ? )
|
|
_, err = tx.SQL(` update lpplandtl1 set lweight = 0 where pastureid = ? and lppid in(select id from lpplan where pastureid = ? )
|
|
|
and find_in_set(barid,(select barid from feedp where barname = ? )) `, pastureid, pastureid, barname).Execute()
|
|
and find_in_set(barid,(select barid from feedp where barname = ? )) `, pastureid, pastureid, barname).Execute()
|
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -5197,7 +5197,7 @@ func FpdImportExcel(c *gin.Context) {
|
|
|
logs.Error(err)
|
|
logs.Error(err)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- // */
|
|
|
|
|
|
|
+ */
|
|
|
updateFpdetailByBar(pastureid, barname, v)
|
|
updateFpdetailByBar(pastureid, barname, v)
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
@@ -10659,13 +10659,7 @@ func FpdBatchEditGrfd(pastureid string, barList []map[string]string) {
|
|
|
// dataexcel["6"] = barFsions.Get("times6").ValueStr()
|
|
// dataexcel["6"] = barFsions.Get("times6").ValueStr()
|
|
|
|
|
|
|
|
// /*
|
|
// /*
|
|
|
- // ftexist, err := tx.SQL(` select id from feedp where barname = ? and pastureid = ? and ftname = ? `, dataexcel["barname"], pastureid, dataexcel["ftname"]).Exist()
|
|
|
|
|
- // if err != nil {
|
|
|
|
|
- // logs.Error(err)
|
|
|
|
|
- // return
|
|
|
|
|
- // }
|
|
|
|
|
- // if !ftexist {
|
|
|
|
|
- // fmt.Println(dataexcel["barname"], pastureid, dataexcel["ftname"])
|
|
|
|
|
|
|
+
|
|
|
tx.SQL(` update lpplandtl1 set lweight = 0 where barid = (select id from bar where bname = ? ) and pastureid = ? `, dataexcel["barname"], pastureid).Exist()
|
|
tx.SQL(` update lpplandtl1 set lweight = 0 where barid = (select id from bar where bname = ? ) and pastureid = ? `, dataexcel["barname"], pastureid).Exist()
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
logs.Error(err)
|
|
logs.Error(err)
|
|
@@ -10676,49 +10670,11 @@ func FpdBatchEditGrfd(pastureid string, barList []map[string]string) {
|
|
|
logs.Error(err)
|
|
logs.Error(err)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- // _, err = tx.SQL(` update lpplandtl1 set lweight = 0 where pastureid = ? and lppid in(select id from lpplan where pastureid = ? and times = ? )
|
|
|
|
|
- // and find_in_set(barid,(select barid from feedp where id = ? )) `, pastureid, pastureid, ftmap["times"], id).Execute()
|
|
|
|
|
- // if err != nil {
|
|
|
|
|
- // tx.Rollback()
|
|
|
|
|
- // logs.Error(err)
|
|
|
|
|
- // appG.Response(http.StatusInternalServerError, e.ERROR, err)
|
|
|
|
|
- // return
|
|
|
|
|
- // }
|
|
|
|
|
- // _, err = tx.SQL(` UPDATE fpdetail SET ptuse=0,ptsuse=0
|
|
|
|
|
- // WHERE pastureid=? and find_in_set(barid,(select barid from feedp where id = ? ) ) and times = ? `, pastureid, id, ftmap["times"]).Execute()
|
|
|
|
|
- // if err != nil {
|
|
|
|
|
- // tx.Rollback()
|
|
|
|
|
- // logs.Error(err)
|
|
|
|
|
- // appG.Response(http.StatusInternalServerError, e.ERROR, err)
|
|
|
|
|
- // return
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
- // 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 {
|
|
|
|
|
- // _, err = tx.SQL(` update lpplandtl1 set lweight = 0 where pastureid = ? and lppid in(select id from lpplan where pastureid = ? and times = ? )
|
|
|
|
|
- // and find_in_set(barid,(select barid from feedp where id = ? )) `, pastureid, pastureid, ftmap["times"], id).Execute()
|
|
|
|
|
- // if err != nil {
|
|
|
|
|
- // tx.Rollback()
|
|
|
|
|
- // logs.Error(err)
|
|
|
|
|
-
|
|
|
|
|
- // appG.Response(http.StatusInternalServerError, e.ERROR, err)
|
|
|
|
|
- // return
|
|
|
|
|
- // }
|
|
|
|
|
- // _, err = tx.SQL(` UPDATE fpdetail SET ptuse=0,ptsuse=0
|
|
|
|
|
- // WHERE pastureid=? and find_in_set(barid,(select barid from feedp where id = ? ) ) and times = ? `, pastureid, id, ftmap["times"]).Execute()
|
|
|
|
|
- // if err != nil {
|
|
|
|
|
- // tx.Rollback()
|
|
|
|
|
- // logs.Error(err)
|
|
|
|
|
- // appG.Response(http.StatusInternalServerError, e.ERROR, err)
|
|
|
|
|
- // return
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
|
|
+
|
|
|
// */
|
|
// */
|
|
|
|
|
|
|
|
exist, err := tx.SQL(` select id from feedp where barid = (select id from bar where bname = ? ) and pastureid = ? `, dataexcel["barname"], pastureid).Exist()
|
|
exist, err := tx.SQL(` select id from feedp where barid = (select id from bar where bname = ? ) and pastureid = ? `, dataexcel["barname"], pastureid).Exist()
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
- fmt.Println("1111111111111111111")
|
|
|
|
|
logs.Error(err)
|
|
logs.Error(err)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
@@ -10726,7 +10682,6 @@ func FpdBatchEditGrfd(pastureid string, barList []map[string]string) {
|
|
|
_, err := tx.SQL(` insert into feedp(pastureid,barid,barname,ccount)values(?,(select id from bar where bname = ? and pastureid = ? ),?,?) `,
|
|
_, err := tx.SQL(` insert into feedp(pastureid,barid,barname,ccount)values(?,(select id from bar where bname = ? and pastureid = ? ),?,?) `,
|
|
|
pastureid, dataexcel["barname"], pastureid, dataexcel["barname"], 0).Execute()
|
|
pastureid, dataexcel["barname"], pastureid, dataexcel["barname"], 0).Execute()
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
- fmt.Println("1111111111111111111")
|
|
|
|
|
logs.Error(err)
|
|
logs.Error(err)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
@@ -12692,3 +12647,4 @@ func GetLyUdData(c *gin.Context) {
|
|
|
|
|
|
|
|
// appG.Response(http.StatusOK, e.SUCCESS, fpdetailFnameList)
|
|
// appG.Response(http.StatusOK, e.SUCCESS, fpdetailFnameList)
|
|
|
}
|
|
}
|
|
|
|
|
+
|