|
@@ -8416,32 +8416,32 @@ func DelFeedTemplet(c *gin.Context) {
|
|
|
dataByte, _ := ioutil.ReadAll(c.Request.Body)
|
|
|
fsions := gofasion.NewFasion(string(dataByte))
|
|
|
ftId := fsions.Get("ftId").ValueStr()
|
|
|
- userId := fsions.Get("userId").ValueStr()
|
|
|
+ // userId := fsions.Get("userId").ValueStr()
|
|
|
tx := restful.Engine.NewSession()
|
|
|
defer tx.Close()
|
|
|
|
|
|
- _, err := tx.Exec(` update feedtemplet set enable = 1 and isdelete = 1 where id = ? `, ftId)
|
|
|
+ _, err := tx.Exec(` update feedtemplet set enable = 1 , isdelete = 1 where id = ? `, ftId)
|
|
|
if err != nil {
|
|
|
logs.Error(err)
|
|
|
appG.Response(http.StatusOK, e.ERROR, errors.New("删除失败!!!"))
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- barIdList, err := tx.SQL(`select barid from feedp where ftid = ? `, ftId).QueryString()
|
|
|
- if err != nil {
|
|
|
- logs.Error(err)
|
|
|
- appG.Response(http.StatusOK, e.ERROR, errors.New("删除失败!!!"))
|
|
|
- return
|
|
|
- }
|
|
|
+ // barIdList, err := tx.SQL(`select barid from feedp where ftid = ? `, ftId).QueryString()
|
|
|
+ // if err != nil {
|
|
|
+ // logs.Error(err)
|
|
|
+ // appG.Response(http.StatusOK, e.ERROR, errors.New("删除失败!!!"))
|
|
|
+ // return
|
|
|
+ // }
|
|
|
|
|
|
- _, err = tx.Exec(` update feedp set ftid = 0 and ftname = '',feedweight = 0,ftweight = 0, where ftid = ? `, ftId)
|
|
|
+ _, err = tx.Exec(` update feedp set ftid = 0 , ftname = '',feedweight = 0,ftweight = 0 where ftid = ? `, ftId)
|
|
|
if err != nil {
|
|
|
logs.Error(err)
|
|
|
appG.Response(http.StatusOK, e.ERROR, errors.New("删除栏舍配方失败"))
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- _, err = tx.Exec(` update fpdetail set weight = ? ,ptid = 0,ptuse= 0 where ftid = ? `, ftId)
|
|
|
+ _, err = tx.Exec(` update fpdetail set weight = 0 ,ptid = 0,ptuse= 0 where ptid = ? `, ftId)
|
|
|
if err != nil {
|
|
|
logs.Error(err)
|
|
|
appG.Response(http.StatusOK, e.ERROR, errors.New("删除栏舍配方失败"))
|
|
@@ -8464,56 +8464,56 @@ func DelFeedTemplet(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- var barIdStr []string
|
|
|
- for _, bar := range barIdList {
|
|
|
- barIdStr = append(barIdStr, bar["barid"])
|
|
|
- }
|
|
|
+ // var barIdStr []string
|
|
|
+ // for _, bar := range barIdList {
|
|
|
+ // barIdStr = append(barIdStr, bar["barid"])
|
|
|
+ // }
|
|
|
|
|
|
- if len(barIdStr) > 0 {
|
|
|
+ // if len(barIdStr) > 0 {
|
|
|
|
|
|
- newFpdDataList, err := tx.Table("fpdetail").In(`barid`, barIdStr).Query().List()
|
|
|
- if err != nil {
|
|
|
- logs.Error(err)
|
|
|
- appG.Response(http.StatusOK, e.ERROR, errors.New("删除失败!!!"))
|
|
|
- return
|
|
|
- }
|
|
|
+ // newFpdDataList, err := tx.Table("fpdetail").Where(`barid in(?)`, barIdStr).Query().List()
|
|
|
+ // if err != nil {
|
|
|
+ // logs.Error(err)
|
|
|
+ // appG.Response(http.StatusOK, e.ERROR, errors.New("删除失败!!!"))
|
|
|
+ // return
|
|
|
+ // }
|
|
|
|
|
|
- newFeedpList, err := tx.Table("feedp").In(`barid`, barIdStr).Query().List()
|
|
|
- if err != nil {
|
|
|
- logs.Error(err)
|
|
|
- appG.Response(http.StatusOK, e.ERROR, errors.New("删除失败!!!"))
|
|
|
- return
|
|
|
- }
|
|
|
+ // newFeedpList, err := tx.Table("feedp").Where(`barid in(?)`, barIdStr).Query().List()
|
|
|
+ // if err != nil {
|
|
|
+ // logs.Error(err)
|
|
|
+ // appG.Response(http.StatusOK, e.ERROR, errors.New("删除失败!!!"))
|
|
|
+ // return
|
|
|
+ // }
|
|
|
|
|
|
- now := time.Now()
|
|
|
- for _, newFpd := range newFpdDataList {
|
|
|
- _, err := tx.SQL(` insert into fpdetailhistory(pastureid,barid,barname,times,tratio,weight,ptsrate,cowcount,ccountradio,ptid,ptsid,ptuse,ptsuse,supplement,createdate,userId)
|
|
|
- values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`, newFpd["pastureid"], newFpd["barid"], newFpd["barname"], newFpd["times"],
|
|
|
- newFpd["tratio"], newFpd["weight"], newFpd["ptsrate"], newFpd["cowcount"], newFpd["ccountradio"],
|
|
|
- newFpd["ptid"], newFpd["ptsid"], newFpd["ptuse"], newFpd["ptsuse"], newFpd["supplement"], now, userId).Execute()
|
|
|
- if err != nil {
|
|
|
- logs.Error(err)
|
|
|
- appG.Response(http.StatusOK, e.ERROR, false)
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
+ // now := time.Now()
|
|
|
+ // for _, newFpd := range newFpdDataList {
|
|
|
+ // _, err := tx.SQL(` insert into fpdetailhistory(pastureid,barid,barname,times,tratio,weight,ptsrate,cowcount,ccountradio,ptid,ptsid,ptuse,ptsuse,supplement,createdate,userId)
|
|
|
+ // values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`, newFpd["pastureid"], newFpd["barid"], newFpd["barname"], newFpd["times"],
|
|
|
+ // newFpd["tratio"], newFpd["weight"], newFpd["ptsrate"], newFpd["cowcount"], newFpd["ccountradio"],
|
|
|
+ // newFpd["ptid"], newFpd["ptsid"], newFpd["ptuse"], newFpd["ptsuse"], newFpd["supplement"], now, userId).Execute()
|
|
|
+ // if err != nil {
|
|
|
+ // logs.Error(err)
|
|
|
+ // appG.Response(http.StatusOK, e.ERROR, false)
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
- for _, newFeedp := range newFeedpList {
|
|
|
- _, err := tx.SQL(` insert into feedphistory(pastureid,barname,barid,softccount,ccount,ratio,ccountratio,ftid,
|
|
|
- ftname,ptsfid,ptsfname,feedweight,ftweight,supplyweight,owner,createdate,userId)
|
|
|
- values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`,
|
|
|
- newFeedp["pastureid"], newFeedp["barname"], newFeedp["barid"],
|
|
|
- newFeedp["softccount"], newFeedp["ccount"], newFeedp["ratio"],
|
|
|
- newFeedp["ccountratio"], newFeedp["ftid"], newFeedp["ftname"],
|
|
|
- newFeedp["ptsfid"], newFeedp["ptsfname"], newFeedp["feedweight"],
|
|
|
- newFeedp["ftweight"], newFeedp["supplyweight"], newFeedp["owner"], now, userId).Execute()
|
|
|
- if err != nil {
|
|
|
- logs.Error(err)
|
|
|
- appG.Response(http.StatusOK, e.ERROR, false)
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // for _, newFeedp := range newFeedpList {
|
|
|
+ // _, err := tx.SQL(` insert into feedphistory(pastureid,barname,barid,softccount,ccount,ratio,ccountratio,ftid,
|
|
|
+ // ftname,ptsfid,ptsfname,feedweight,ftweight,supplyweight,owner,createdate,userId)
|
|
|
+ // values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`,
|
|
|
+ // newFeedp["pastureid"], newFeedp["barname"], newFeedp["barid"],
|
|
|
+ // newFeedp["softccount"], newFeedp["ccount"], newFeedp["ratio"],
|
|
|
+ // newFeedp["ccountratio"], newFeedp["ftid"], newFeedp["ftname"],
|
|
|
+ // newFeedp["ptsfid"], newFeedp["ptsfname"], newFeedp["feedweight"],
|
|
|
+ // newFeedp["ftweight"], newFeedp["supplyweight"], newFeedp["owner"], now, userId).Execute()
|
|
|
+ // if err != nil {
|
|
|
+ // logs.Error(err)
|
|
|
+ // appG.Response(http.StatusOK, e.ERROR, false)
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
appG.Response(http.StatusOK, e.SUCCESS, "ok")
|
|
|
}
|
|
|
|