|
@@ -8874,3 +8874,73 @@ func ddmmtoddd(lng, lat float64) (float64, float64) {
|
|
|
b, _ := strconv.ParseFloat(latStr, 64)
|
|
|
return coordtransform.WGS84toGCJ02(b, a)
|
|
|
}
|
|
|
+
|
|
|
+func EditDownloadedplanExecWeight(c *gin.Context) {
|
|
|
+ appG := app.Gin{C: c}
|
|
|
+ dataByte, _ := ioutil.ReadAll(c.Request.Body)
|
|
|
+ fsions := gofasion.NewFasion(string(dataByte))
|
|
|
+ pid := fsions.Get("pid").ValueStr()
|
|
|
+ sort := fsions.Get("sort").ValueStr()
|
|
|
+ weight := fsions.Get("weight").ValueStr()
|
|
|
+
|
|
|
+ tx := restful.Engine.NewSession()
|
|
|
+ defer tx.Close()
|
|
|
+ tx.Begin()
|
|
|
+
|
|
|
+ _, err := tx.Exec(` update downloadplandtl1_exec set actualweight = ? where pid = ? and sort = ? `, weight, pid, sort)
|
|
|
+ if err != nil {
|
|
|
+ logs.Error(err)
|
|
|
+ appG.Response(http.StatusOK, e.ERROR, "修改计划重量失败!"+err.Error())
|
|
|
+ tx.Rollback()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ _, err = tx.Exec(` update downloadplandtl1 set actualweight = lweight / (select sum(lweight) from downloadplandtl1 where pid = ? and sort = ? ) * ? where pid = ? and sort = ? `, pid, sort, weight, pid, sort)
|
|
|
+ if err != nil {
|
|
|
+ logs.Error(err)
|
|
|
+ appG.Response(http.StatusOK, e.ERROR, "修改计划重量失败!"+err.Error())
|
|
|
+ tx.Rollback()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ err = tx.Commit()
|
|
|
+ if err != nil {
|
|
|
+ logs.Error(err)
|
|
|
+ appG.Response(http.StatusOK, e.ERROR, "修改计划重量失败!"+err.Error())
|
|
|
+ tx.Rollback()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ appG.Response(http.StatusOK, e.SUCCESS, true)
|
|
|
+}
|
|
|
+
|
|
|
+func EditDownloadplandtl2Weight(c *gin.Context) {
|
|
|
+ appG := app.Gin{C: c}
|
|
|
+ dataByte, _ := ioutil.ReadAll(c.Request.Body)
|
|
|
+ fsions := gofasion.NewFasion(string(dataByte))
|
|
|
+ pid := fsions.Get("pid").ValueStr()
|
|
|
+ sort := fsions.Get("sort").ValueStr()
|
|
|
+ weight := fsions.Get("weight").ValueStr()
|
|
|
+
|
|
|
+ tx := restful.Engine.NewSession()
|
|
|
+ defer tx.Close()
|
|
|
+ tx.Begin()
|
|
|
+
|
|
|
+ _, err := tx.Exec(` update downloadplandtl2 set actualweight = ? where pid = ? and sort = ? `, weight, pid, sort)
|
|
|
+ if err != nil {
|
|
|
+ logs.Error(err)
|
|
|
+ appG.Response(http.StatusOK, e.ERROR, "修改计划重量失败!"+err.Error())
|
|
|
+ tx.Rollback()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ err = tx.Commit()
|
|
|
+ if err != nil {
|
|
|
+ logs.Error(err)
|
|
|
+ appG.Response(http.StatusOK, e.ERROR, "修改计划重量失败!"+err.Error())
|
|
|
+ tx.Rollback()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ appG.Response(http.StatusOK, e.SUCCESS, true)
|
|
|
+}
|