|
@@ -83,6 +83,7 @@ type fpdetailQueryInfo struct {
|
|
Fttypeid int64 `xorm:"fttypeid"`
|
|
Fttypeid int64 `xorm:"fttypeid"`
|
|
Times int64 `xorm:"times"`
|
|
Times int64 `xorm:"times"`
|
|
Ptid int64 `xorm:"ptid"`
|
|
Ptid int64 `xorm:"ptid"`
|
|
|
|
+ Background string `xorm:"background"`
|
|
}
|
|
}
|
|
|
|
|
|
type lpplandtl1 struct {
|
|
type lpplandtl1 struct {
|
|
@@ -440,7 +441,7 @@ func autogeneration(typeIN int64, pastureid string, tx *xorm.Session) error {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
fpdetaillist := make([]*fpdetailQueryInfo, 0)
|
|
fpdetaillist := make([]*fpdetailQueryInfo, 0)
|
|
- err = tx.SQL(`SELECT fpd.ptid,ft.fttypeid,fpd.cowcount,fpd.ccountradio,fpd.id as fpdid,times,tratio,ROUND((1-fpd.ptsrate)*fpd.weight,2)-fpd.ptuse weight,TRIM(fpd.barid) barid,TRIM(fpd.pastureid) pastureid,TRIM(fpd.ptid) ptid,TRIM(fpd.ptsid ) ptsid ,
|
|
|
|
|
|
+ err = tx.SQL(`SELECT ft.tcolor background,fpd.ptid,ft.fttypeid,fpd.cowcount,fpd.ccountradio,fpd.id as fpdid,times,tratio,ROUND((1-fpd.ptsrate)*fpd.weight,2)-fpd.ptuse weight,TRIM(fpd.barid) barid,TRIM(fpd.pastureid) pastureid,TRIM(fpd.ptid) ptid,TRIM(fpd.ptsid ) ptsid ,
|
|
(select bname from bar where pastureid =fpd.pastureid and id = fpd.barid ) barname,cowcount,ccountradio,0 isfill FROM fpdetail fpd
|
|
(select bname from bar where pastureid =fpd.pastureid and id = fpd.barid ) barname,cowcount,ccountradio,0 isfill FROM fpdetail fpd
|
|
join feedp fp on fp.ftid = fpd.ptid and fp.pastureid = fpd.pastureid
|
|
join feedp fp on fp.ftid = fpd.ptid and fp.pastureid = fpd.pastureid
|
|
inner join feedtemplet ft on ft.id = fp.ftid and ft.pastureid = fpd.pastureid
|
|
inner join feedtemplet ft on ft.id = fp.ftid and ft.pastureid = fpd.pastureid
|
|
@@ -516,7 +517,7 @@ func autogeneration(typeIN int64, pastureid string, tx *xorm.Session) error {
|
|
Tmrname: lpplan.Tmrname,
|
|
Tmrname: lpplan.Tmrname,
|
|
Cowcount: lpplan.Cowcount,
|
|
Cowcount: lpplan.Cowcount,
|
|
Ccountradio: lpplan.Ccountradio,
|
|
Ccountradio: lpplan.Ccountradio,
|
|
- Background: lpplan.Background,
|
|
|
|
|
|
+ Background: fpdetail.Background,
|
|
Lweighthis: insertlweight,
|
|
Lweighthis: insertlweight,
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -578,7 +579,7 @@ func autogeneration(typeIN int64, pastureid string, tx *xorm.Session) error {
|
|
}
|
|
}
|
|
|
|
|
|
supplement := tx.Table("fpdetail").Alias("fpd")
|
|
supplement := tx.Table("fpdetail").Alias("fpd")
|
|
- supplement.Select("fpd.id as fpdid,fpd.barid,ft.id as temid, fpd.times,ROUND(fpd.ptsrate*fpd.weight,2)-fpd.ptsuse weight,TRIM(fpd.pastureid) pastureid,TRIM(fpd.ptid) ptid,TRIM(fpd.ptsid ) ptsid ,cowcount")
|
|
|
|
|
|
+ supplement.Select("ft.tcolor background,fpd.id as fpdid,fpd.barid,ft.id as temid, fpd.times,ROUND(fpd.ptsrate*fpd.weight,2)-fpd.ptsuse weight,TRIM(fpd.pastureid) pastureid,TRIM(fpd.ptid) ptid,TRIM(fpd.ptsid ) ptsid ,cowcount")
|
|
supplement.Join("inner", []string{"feedp", "fp"}, "fp.ptsfid = fpd.ptsid").And("fp.pastureid = fpd.pastureid")
|
|
supplement.Join("inner", []string{"feedp", "fp"}, "fp.ptsfid = fpd.ptsid").And("fp.pastureid = fpd.pastureid")
|
|
supplement.Join("inner", []string{"feedtemplet", "ft"}, "ft.id = fp.ftid").And("ft.pastureid = fpd.pastureid")
|
|
supplement.Join("inner", []string{"feedtemplet", "ft"}, "ft.id = fp.ftid").And("ft.pastureid = fpd.pastureid")
|
|
supplement.Where("fpd.pastureid = ?", pastureid).And("fpd.ptsuse< ROUND(fpd.ptsrate*fpd.weight,2)").And("fpd.ptsid > 0")
|
|
supplement.Where("fpd.pastureid = ?", pastureid).And("fpd.ptsuse< ROUND(fpd.ptsrate*fpd.weight,2)").And("fpd.ptsid > 0")
|
|
@@ -680,7 +681,7 @@ func autogeneration(typeIN int64, pastureid string, tx *xorm.Session) error {
|
|
Tmrname: lpplan.Tmrname,
|
|
Tmrname: lpplan.Tmrname,
|
|
Cowcount: lpplan.Cowcount,
|
|
Cowcount: lpplan.Cowcount,
|
|
Ccountradio: lpplan.Ccountradio,
|
|
Ccountradio: lpplan.Ccountradio,
|
|
- Background: lpplan.Background,
|
|
|
|
|
|
+ Background: fpdetail.Background,
|
|
Lweighthis: insertlweight,
|
|
Lweighthis: insertlweight,
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -748,8 +749,8 @@ func GetSpillage(c *gin.Context) {
|
|
pastureid := parammaps.Get("pastureid").ValueInt64()
|
|
pastureid := parammaps.Get("pastureid").ValueInt64()
|
|
times := parammaps.Get("times").ValueInt64()
|
|
times := parammaps.Get("times").ValueInt64()
|
|
|
|
|
|
|
|
+ // refresh 0 全部 , 1 车次信息, 2 班次
|
|
refresh := parammaps.Get("refresh").ValueInt64()
|
|
refresh := parammaps.Get("refresh").ValueInt64()
|
|
- fmt.Println(pastureid, times)
|
|
|
|
tx := restful.Engine.NewSession()
|
|
tx := restful.Engine.NewSession()
|
|
defer tx.Close()
|
|
defer tx.Close()
|
|
|
|
|
|
@@ -792,7 +793,6 @@ func GetSpillage(c *gin.Context) {
|
|
arrList := make([]map[string]interface{}, 0)
|
|
arrList := make([]map[string]interface{}, 0)
|
|
arrid := ft["arrid"].(string)
|
|
arrid := ft["arrid"].(string)
|
|
for _, detail := range ftDetailList {
|
|
for _, detail := range ftDetailList {
|
|
- // var ptsid, ptid string
|
|
|
|
if _, ok := detail["ptid"]; ok {
|
|
if _, ok := detail["ptid"]; ok {
|
|
if arrid == detail["ptid"].(string) && ft["isfill"].(int64) == detail["isfill"].(int64) {
|
|
if arrid == detail["ptid"].(string) && ft["isfill"].(int64) == detail["isfill"].(int64) {
|
|
detail["background"] = ft["background"]
|
|
detail["background"] = ft["background"]
|
|
@@ -804,7 +804,6 @@ func GetSpillage(c *gin.Context) {
|
|
arrList = append(arrList, detail)
|
|
arrList = append(arrList, detail)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
if len(arrList) > 0 {
|
|
if len(arrList) > 0 {
|
|
ft["arrList"] = arrList
|
|
ft["arrList"] = arrList
|
|
@@ -847,7 +846,7 @@ ORDER BY lpplan.sort`, pastureid).Query().List()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- arrList, _ := tx.SQL(`SELECT
|
|
|
|
|
|
+ arrList, err := tx.SQL(`SELECT
|
|
trim(lpplandtl1.lppid) lppid,lweight,
|
|
trim(lpplandtl1.lppid) lppid,lweight,
|
|
lpplandtl1.lweight weight,lpplandtl1.sort,
|
|
lpplandtl1.lweight weight,lpplandtl1.sort,
|
|
(select bname from bar where pastureid =lpplandtl1.pastureid and id = lpplandtl1.barid ) barname,
|
|
(select bname from bar where pastureid =lpplandtl1.pastureid and id = lpplandtl1.barid ) barname,
|
|
@@ -871,6 +870,11 @@ ORDER BY lpplan.sort`, pastureid).Query().List()
|
|
on lpplandtl1.fpdid= fpdetail.id and lpplandtl1.pastureid = fpdetail.pastureid
|
|
on lpplandtl1.fpdid= fpdetail.id and lpplandtl1.pastureid = fpdetail.pastureid
|
|
WHERE lpplandtl1.pastureid = ? and lpplandtl1.lweight>0
|
|
WHERE lpplandtl1.pastureid = ? and lpplandtl1.lweight>0
|
|
ORDER BY lpplandtl1.sort`, pastureid).QueryString() //获取
|
|
ORDER BY lpplandtl1.sort`, pastureid).QueryString() //获取
|
|
|
|
+ if err != nil {
|
|
|
|
+ log.Println("GetSpillage-error-2: ", err)
|
|
|
|
+ appG.Response(http.StatusOK, e.ERROR, nil)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
|
|
for _, query := range lppList {
|
|
for _, query := range lppList {
|
|
list := make([]map[string]string, 0)
|
|
list := make([]map[string]string, 0)
|