baishaojie 9 сар өмнө
parent
commit
920ec023da
35 өөрчлөгдсөн 252 нэмэгдсэн , 45 устгасан
  1. BIN
      TMRWatchComm
  2. BIN
      __debug_bin.exe
  3. 1 1
      conf/app.ini
  4. BIN
      dist-tmr-测试-20240611-2.zip
  5. 0 0
      dist-tmr240510-04/dist/index.html
  6. 0 0
      dist-tmr240510-04/dist/static/css/app.09ac1af7.css
  7. 0 0
      dist-tmr240510-04/dist/static/css/chunk-elementUI.c1c3b808.css
  8. 0 0
      dist-tmr240510-04/dist/static/css/chunk-libs.f403b559.css
  9. BIN
      dist-tmr240510-04/dist/static/fonts/element-icons.535877f5.woff
  10. BIN
      dist-tmr240510-04/dist/static/fonts/element-icons.732389de.ttf
  11. BIN
      dist-tmr240510-04/dist/static/img/404.a57b6f31.png
  12. BIN
      dist-tmr240510-04/dist/static/img/404_cloud.0f4bc32b.png
  13. BIN
      dist-tmr240510-04/dist/static/img/guiji2.9dc0addf.jpeg
  14. 0 28
      dist-tmr240510-04/dist/static/img/iconfont.0ddaba12.svg
  15. BIN
      dist-tmr240510-04/dist/static/img/logo.afed751a.png
  16. BIN
      dist-tmr240510-04/dist/static/img/logo1.0121925c.png
  17. BIN
      dist-tmr240510-04/dist/static/img/logo_u3.3c77f543.png
  18. BIN
      dist-tmr240510-04/dist/static/img/nlogin-bg1.77301f56.jpg
  19. BIN
      dist-tmr240510-04/dist/static/img/row-bg3.b3be7548.png
  20. BIN
      dist-tmr240510-04/dist/static/img/topBg.69ecd1e1.png
  21. 0 0
      dist-tmr240510-04/dist/static/js/app.a3eebc8f.js
  22. 0 0
      dist-tmr240510-04/dist/static/js/chunk-4ab5740d.fd41fff9.js
  23. 0 0
      dist-tmr240510-04/dist/static/js/chunk-52ecc0ac.6e6c1552.js
  24. 0 0
      dist-tmr240510-04/dist/static/js/chunk-5c4dc4a9.8801e0b1.js
  25. 0 0
      dist-tmr240510-04/dist/static/js/chunk-b702d234.4563c788.js
  26. 0 0
      dist-tmr240510-04/dist/static/js/chunk-elementUI.c961dc79.js
  27. 0 0
      dist-tmr240510-04/dist/static/js/chunk-libs.de4daf58.js
  28. 0 0
      dist/index.html
  29. 0 0
      dist/static/css/app.09ac1af7.css
  30. 0 0
      dist/static/css/app.9a093396.css
  31. 0 0
      dist/static/js/app.93efc0d5.js
  32. 0 0
      dist/static/js/app.a3eebc8f.js
  33. 105 5
      http/handle/api/ops.go
  34. 98 11
      http/handle/api/upload.go
  35. 48 0
      module/post_data.go

BIN
TMRWatchComm


BIN
__debug_bin.exe


+ 1 - 1
conf/app.ini

@@ -73,7 +73,7 @@ Host = 192.168.1.93:3326
 #Name = tmrgo
 #Password = kepaiteng!QAZ
 #Host = 222.73.129.15:31306
-Name = yq2
+Name = tmrwatch5
 TablePrefix =
 
 ShowXormlog = false

BIN
dist-tmr-测试-20240611-2.zip


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist-tmr240510-04/dist/index.html


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist-tmr240510-04/dist/static/css/app.09ac1af7.css


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist-tmr240510-04/dist/static/css/chunk-elementUI.c1c3b808.css


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist-tmr240510-04/dist/static/css/chunk-libs.f403b559.css


BIN
dist-tmr240510-04/dist/static/fonts/element-icons.535877f5.woff


BIN
dist-tmr240510-04/dist/static/fonts/element-icons.732389de.ttf


BIN
dist-tmr240510-04/dist/static/img/404.a57b6f31.png


BIN
dist-tmr240510-04/dist/static/img/404_cloud.0f4bc32b.png


BIN
dist-tmr240510-04/dist/static/img/guiji2.9dc0addf.jpeg


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 28
dist-tmr240510-04/dist/static/img/iconfont.0ddaba12.svg


BIN
dist-tmr240510-04/dist/static/img/logo.afed751a.png


BIN
dist-tmr240510-04/dist/static/img/logo1.0121925c.png


BIN
dist-tmr240510-04/dist/static/img/logo_u3.3c77f543.png


BIN
dist-tmr240510-04/dist/static/img/nlogin-bg1.77301f56.jpg


BIN
dist-tmr240510-04/dist/static/img/row-bg3.b3be7548.png


BIN
dist-tmr240510-04/dist/static/img/topBg.69ecd1e1.png


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist-tmr240510-04/dist/static/js/app.a3eebc8f.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist-tmr240510-04/dist/static/js/chunk-4ab5740d.fd41fff9.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist-tmr240510-04/dist/static/js/chunk-52ecc0ac.6e6c1552.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist-tmr240510-04/dist/static/js/chunk-5c4dc4a9.8801e0b1.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist-tmr240510-04/dist/static/js/chunk-b702d234.4563c788.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist-tmr240510-04/dist/static/js/chunk-elementUI.c961dc79.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist-tmr240510-04/dist/static/js/chunk-libs.de4daf58.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/index.html


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/css/app.09ac1af7.css


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/css/app.9a093396.css


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/app.93efc0d5.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/app.a3eebc8f.js


+ 105 - 5
http/handle/api/ops.go

@@ -1041,7 +1041,7 @@ func PostDataByName(c *gin.Context) {
 	var err error
 	queryData, err := module.PostDataByName(c, fsion)
 	if err != nil {
-		appG.Response(http.StatusOK, e.ERROR, err)
+		appG.Response(http.StatusOK, e.ERROR, err.Error())
 		return
 	}
 
@@ -1063,6 +1063,7 @@ func PostDataByName(c *gin.Context) {
 		err = module.GroupCategoryDelete(keyWord, fsion)
 	case "updateFT":
 		FtdetailSurplus(fsion)
+
 	case "updateFeed":
 		FeedSurplus(fsion)
 	default:
@@ -3429,6 +3430,23 @@ func UpdateFTdetail(c *gin.Context) {
 			return
 		}
 	}
+	// ,,parammaps["ftid"])
+	// surplus, surplusId, id, pastureId string
+	// FtdetailSurplusFt(parammaps["ftid"].)
+	ftList1, err := tx.SQL(` SELECT
+	f.id,
+	f.surplus surplusId,
+	f.pastureid,
+	s.surplus 
+FROM
+	feedtemplet f
+	 JOIN surplus s  ON s.id = f.surplus
+WHERE
+	f.id = ?`, parammaps["ftid"]).QueryString()
+
+	for _, ft := range ftList1 {
+		FtdetailSurplusFt(ft["surplus"], ft["surplusId"], ft["id"], ft["pastureid"])
+	}
 
 	appG.Response(http.StatusOK, e.SUCCESS, true)
 }
@@ -8952,7 +8970,7 @@ func EditDownloadplandtl2Weight(c *gin.Context) {
 	appG.Response(http.StatusOK, e.SUCCESS, true)
 }
 
-func FtdetailSurplus(fasion *gofasion.Fasion) {
+func FtdetailSurplus(fasion *gofasion.Fasion) error {
 	params := fasion.Get("parammaps")
 	surplus := params.Get("surplus").ValueStr()
 	surplusId := params.Get("surplusId").ValueStr()
@@ -8964,7 +8982,7 @@ func FtdetailSurplus(fasion *gofasion.Fasion) {
 		dataList, err := tx.Table("ftdetail").Where("ftid = ? ", params.Get("id").ValueStr()).QueryString()
 		if err != nil {
 			log.Println("PostDataByName-error-1: ", err)
-			return
+			return errors.New("配方修改失败!")
 		}
 
 		type ftdetail struct {
@@ -8981,7 +8999,7 @@ func FtdetailSurplus(fasion *gofasion.Fasion) {
 			sort, err := strconv.ParseInt(data["sort"], 10, 64)
 			if err != nil {
 				log.Println("PostDataByName-error-2: ", err)
-				return
+				return err
 			}
 			ft.Sort = sort
 			ftList = append(ftList, ft)
@@ -9003,6 +9021,7 @@ func FtdetailSurplus(fasion *gofasion.Fasion) {
 					break
 				}
 			}
+
 			if sort == 0 {
 				for _, ft := range ftList {
 					ft.Sort = ft.Sort + 1
@@ -9023,11 +9042,12 @@ func FtdetailSurplus(fasion *gofasion.Fasion) {
 			if err != nil {
 				log.Println("PostDataByName-error-1: ", err)
 				fmt.Println(err)
-				return
+				return errors.New("配方修改失败!")
 			}
 
 		}
 	}
+	return nil
 }
 
 func FeedSurplus(fasion *gofasion.Fasion) {
@@ -9039,3 +9059,83 @@ func FeedSurplus(fasion *gofasion.Fasion) {
 	tx.Exec(` update surplus set surplus = (select fname from feed where id = ? )  where feedId = ? `, feedId, feedId)
 	tx.Exec(` update feed set fname = concat((select id from surplus    where feedId = ? ) ,'_剩料')  where backup3 = (select id from surplus    where feedId = ? )`, feedId, feedId)
 }
+
+func FtdetailSurplusFt(surplus, surplusId, id, pastureId string) error {
+	// params := fasion.Get("parammaps")
+	// surplus := params.Get("surplus").ValueStr()
+	// surplusId := params.Get("surplusId").ValueStr()
+
+	tx := restful.Engine.NewSession()
+	defer tx.Close()
+	tx.Exec(` delete from ftdetail where ftid  = ?  and is_surplus = 1 `, id)
+	if surplusId != "0" {
+		dataList, err := tx.Table("ftdetail").Where("ftid = ? ", id).QueryString()
+		if err != nil {
+			log.Println("PostDataByName-error-1: ", err)
+			return errors.New("配方修改失败!")
+		}
+
+		type ftdetail struct {
+			Id    string
+			Fname string
+			Sort  int64
+		}
+		ftList := make([]*ftdetail, 0)
+		for _, data := range dataList {
+			ft := new(ftdetail)
+			ft.Fname = data["fname"]
+			ft.Id = data["id"]
+
+			sort, err := strconv.ParseInt(data["sort"], 10, 64)
+			if err != nil {
+				log.Println("PostDataByName-error-2: ", err)
+				return err
+			}
+			ft.Sort = sort
+			ftList = append(ftList, ft)
+		}
+
+		if surplus == "日粮" {
+			for _, ft := range ftList {
+				tx.Exec(` update ftdetail set sort = ? where id = ? `, ft.Sort+1, ft.Id)
+			}
+			_, err = tx.Exec(` insert into ftdetail(pastureid,ftid,fid,fname,sort,is_surplus,is_show,feedgroup,fweight)
+ values(?,?,(select id from feed where backup3 = ? ),(select fname from feed where backup3 = ? ),0,1,2,(select fname from feed where backup3 = ? ),0)`,
+				pastureId, id, surplusId, surplusId, surplusId)
+			fmt.Println(err)
+		} else {
+			var sort int64
+			for _, ft := range ftList {
+				if ft.Fname == surplus {
+					sort = ft.Sort
+					break
+				}
+			}
+
+			if sort == 0 {
+				for _, ft := range ftList {
+					ft.Sort = ft.Sort + 1
+				}
+			} else {
+				for _, ft := range ftList {
+					if ft.Sort >= sort {
+						ft.Sort = ft.Sort + 1
+					}
+				}
+			}
+			for _, ft := range ftList {
+				tx.Exec(` update ftdetail set sort = ? where id = ? `, ft.Sort, ft.Id)
+			}
+			_, err = tx.Exec(` insert into ftdetail(ftid,fid,fname,sort,is_surplus,is_show,feedgroup,fweight,pastureid)
+ values(?,(select id from feed where backup3 = ? ),(select fname from feed where backup3 = ? ),?,1,2,(select fname from feed where backup3 = ? ),0,?)`,
+				id, surplusId, surplusId, sort, surplusId, pastureId)
+			if err != nil {
+				log.Println("PostDataByName-error-1: ", err)
+				fmt.Println(err)
+				return errors.New("配方修改失败!")
+			}
+
+		}
+	}
+	return nil
+}

+ 98 - 11
http/handle/api/upload.go

@@ -726,13 +726,26 @@ func GetBarfeedremainExcel(c *gin.Context) {
 	var sheet *xlsx.Sheet
 	var row *xlsx.Row
 	var cell *xlsx.Cell
+
+	redFont := xlsx.Font{
+		Bold:  true,
+		Name:  "宋体", // 字体名称
+		Size:  11,   // 字体大小
+		Color: "FF0000",
+	}
+
+	font := xlsx.Font{
+		Bold:  true,
+		Name:  "宋体", // 字体名称
+		Size:  11,   // 字体大小
+		Color: "000000",
+	}
+
 	style := xlsx.NewStyle()
 	style.ApplyBorder = true
 	border := *xlsx.NewBorder("thin", "thin", "thin", "thin")
 
 	style.Border = border
-
-	style.Font.Size = 11
 	style.Alignment = xlsx.Alignment{
 		Horizontal: "center",
 		Vertical:   "center",
@@ -740,10 +753,26 @@ func GetBarfeedremainExcel(c *gin.Context) {
 		// ShrinkToFit: true,
 
 	}
+	style.Font = font
 	style.ApplyBorder = true
 
+	style1 := xlsx.NewStyle()
+	style1.ApplyBorder = true
+
+	style1.Border = border
+	style1.Alignment = xlsx.Alignment{
+		Horizontal: "center",
+		Vertical:   "center",
+		WrapText:   true,
+		// ShrinkToFit: true,
+	}
+
+	style1.Font = redFont
+	style1.ApplyBorder = true
+
 	file = xlsx.NewFile()
 	sheet, _ = file.AddSheet("Sheet1")
+	sheet.SetColWidth(8, 8, 50)
 	// row = sheet.AddRow()
 	// cell = row.AddCell()
 
@@ -751,33 +780,46 @@ func GetBarfeedremainExcel(c *gin.Context) {
 	cell = row.AddCell()
 	cell.Value = "栏舍名称"
 	// cell.Merge(0, 1)
-	cell.SetStyle(style)
+	// style.Font = redFont
+	cell.SetStyle(style1)
 	cell = row.AddCell()
 
 	cell.SetValue("剩料量(kg)")
-	cell.SetStyle(style)
+	cell.SetStyle(style1)
 	cell = row.AddCell()
 
 	cell.SetValue("干物质")
+	// style.Font = font
+	// style.Font.Color = ""
 	cell.SetStyle(style)
 	cell = row.AddCell()
 
-	cell.SetValue("班次(一天/第一班/第二班/第三班)")
-	cell.SetStyle(style)
+	cell.SetValue("班次收集(一天/第一班/第二班/第三班)")
+	// style.Font.Color = "#FF0000"
+	// style.Font = redFont
+	cell.SetStyle(style1)
 	cell = row.AddCell()
-
+	// style.Font.Color = ""
 	cell.SetValue("收集时间")
-	cell.SetStyle(style)
+	cell.SetStyle(style1)
 	cell = row.AddCell()
 
-	cell.SetValue("原料所属时间")
+	cell.SetValue("原料所属时间")
 	cell.SetStyle(style)
 	cell = row.AddCell()
 
 	cell.SetValue("操作人")
-	cell.SetStyle(style)
+	cell.SetStyle(style1)
 	cell = row.AddCell()
 
+	// cell.SetValue("")
+	// cell.SetStyle(style1)
+	// cell = row.AddCell()
+
+	// cell.SetValue("红色为必填项")
+	// cell.SetStyle(style1)
+	// cell = row.AddCell()
+
 	tx := restful.Engine.NewSession()
 	defer tx.Close()
 
@@ -788,11 +830,56 @@ func GetBarfeedremainExcel(c *gin.Context) {
 		return
 	}
 
-	for _, data := range dataList {
+	for i, data := range dataList {
 		row = sheet.AddRow()
 		cell = row.AddCell()
 		cell.SetValue(data["bname"])
 		cell.SetStyle(style)
+		cell = row.AddCell()
+		if i == 0 {
+			cell.SetValue("100")
+			cell.SetStyle(style)
+			cell = row.AddCell()
+
+			cell.SetValue("10")
+			cell.SetStyle(style)
+			cell = row.AddCell()
+
+			cell.SetValue("第一班")
+			cell.SetStyle(style)
+			cell = row.AddCell()
+
+			// cell.SetStyle()
+			cell.SetValue("2024-01-01")
+			cell.SetStyle(style)
+			// style.Font.
+			cell = row.AddCell()
+
+			cell.SetValue("2024-01-01")
+			cell.SetStyle(style)
+			cell = row.AddCell()
+
+			cell.SetValue("管理员")
+			cell.SetStyle(style)
+			cell = row.AddCell()
+
+			cell.SetValue("")
+			cell.SetStyle(style1)
+			cell = row.AddCell()
+
+			cell.SetValue(`注:1,红色为必填项,以上为示例数据,导入时请及时删除!
+			2,由于excel兼容性的问题,收集时间/原剩料所属时间,提交时会出现兼容性错误,需要在收集时间/原剩料所属时间的表头右击鼠标,设置单元格格式 选择“文本”格式 `)
+			cell.SetStyle(style1)
+			cell = row.AddCell()
+
+			// cell.SetValue("")
+			// cell.SetStyle(style1)
+			// cell = row.AddCell()
+
+			// cell.SetValue("注:由于excel兼容性的问题,收集时间/原剩料所属时间,提交时会出现兼容性错误,需要在收集时间/原剩料所属时间的表头右击鼠标,设置单元格格式 选择“文本”格式 ")
+			// cell.SetStyle(style1)
+			// cell = row.AddCell()
+		}
 	}
 
 	c.Header("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")

+ 48 - 0
module/post_data.go

@@ -47,6 +47,53 @@ func PostDataByName(c *gin.Context, fashion *gofasion.Fasion) (interface{}, erro
 			tx.Close()
 		}
 	}()
+
+	if sqlnamestr == "updateFT" {
+		params := fashion.Get("parammaps")
+		surplus := params.Get("surplus").ValueStr()
+		surplusId := params.Get("surplusId").ValueStr()
+
+		tx.Exec(` delete from ftdetail where ftid  = ?  and is_surplus = 1 `, params.Get("id").ValueStr())
+		if surplus != "日粮" {
+			if surplusId != "0" {
+				dataList, err := tx.Table("ftdetail").Where("ftid = ? ", params.Get("id").ValueStr()).QueryString()
+				if err != nil {
+					return nil, err
+				}
+
+				type ftdetail struct {
+					Id    string
+					Fname string
+					Sort  int64
+				}
+				ftList := make([]*ftdetail, 0)
+				for _, data := range dataList {
+					ft := new(ftdetail)
+					ft.Fname = data["fname"]
+					ft.Id = data["id"]
+
+					sort, err := strconv.ParseInt(data["sort"], 10, 64)
+					if err != nil {
+						return nil, err
+					}
+					ft.Sort = sort
+					ftList = append(ftList, ft)
+				}
+
+				exist := false
+				for _, ft := range ftList {
+					if ft.Fname == surplus {
+						exist = true
+						break
+					}
+				}
+				if !exist {
+					return nil, errors.New(fmt.Sprintf("%s不存在", surplus))
+				}
+			}
+		}
+	}
+
 	sql, p := restful.GetSqlByNameDBT(sqlnamestr, tx)
 	if sql != "" {
 		if fashion.HasKey("parammaps") {
@@ -99,6 +146,7 @@ func PostDataByName(c *gin.Context, fashion *gofasion.Fasion) (interface{}, erro
 			return queryData, nil
 		}
 	}
+
 	return nil, nil
 }
 

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно