浏览代码

sap资产更新

baishaojie 1 年之前
父节点
当前提交
6203791f2e

+ 55 - 18
apiserver/model/http/asset.go

@@ -13,25 +13,26 @@ type Asset struct {
 	SonCode     string `json:"ANLN2"` //资产子编号  默认0
 	Quantity    string `json:"MENGE"` //数量
 
-	Name       string `json:"TXT50"` //资产名称
-	AssetCode  string `json:"ANLN1"` //资产编码
-	Type       string `json:"ANLKL"` //资产类型
-	Model      string `json:"TXA50"` //资产规格
-	CostCenter string `json:"KOSTL"` //成本中心
+	Name      string `json:"TXT50"` //资产名称
+	AssetCode string `json:"ANLN1"` //资产编码
+	Type      string `json:"ANLKL"` //资产类型
+	Model     string `json:"TXA50"` //资产规格
+	//CostCenter string `json:"KOSTL"` //成本中心
+	CostCenter string `json:"KOSTLV"` //责任成本中心
 
-	Unit             string `json:"MEINS"`  //计量单位
-	ProfitCenter     string `json:"PRCTR"`  //利润中心
-	BuyDate          string `json:"ZUGDT"`  //购买日期
-	BuyValue         string `json:"KANSW"`  //购买价值
-	Salvage          string `json:"AHPROZ"` //残值率  百分比
-	Udate            string `json:"UDATE"`  //更新日期
-	Utime            string `json:"UTIME"`  //更新时间
-	NDPER            string `json:"NDPER"`  //计划 使用时间
-	Dflag            string `json:"XSPEB"`  // 删除标记
-	DepreciationYear string `json:"NDJAR"`  //折旧年限
-	Supplier         string `json:"LIFNR"`  //供应商
-	TransferFlag     string `json:"ORD44"`  //传输Y/不传输N ,删除X
-	ORD41            string `json:"ORD41"`  // 资产状态 A3 为报废
+	Unit             string `json:"MEINS"` //计量单位
+	ProfitCenter     string `json:"PRCTR"` //利润中心
+	BuyDate          string `json:"ZUGDT"` //购买日期
+	BuyValue         string `json:"KANSW"` //购买价值
+	Salvage          string `json:"EXT01"` //残值率  百分比
+	Udate            string `json:"UDATE"` //更新日期
+	Utime            string `json:"UTIME"` //更新时间
+	NDPER            string `json:"NDPER"` //计划 使用时间
+	Dflag            string `json:"XSPEB"` // 删除标记
+	DepreciationYear string `json:"NDJAR"` //折旧年限
+	Supplier         string `json:"LIFNR"` //供应商
+	TransferFlag     string `json:"ORD44"` //传输Y/不传输N ,删除X
+	ORD41            string `json:"ORD41"` // 资产状态 A3 为报废
 
 	Segment string `json:"SEGMENT"` //细分	段
 	ORD42   string `json:"ORD42"`   //资产变动方式	出售/购入/其他/其他减少/其他增加/调拨/在建工程转入
@@ -67,3 +68,39 @@ type ORD41 struct {
 type ZUGDT struct {
 	ZUGDT string `json:"ZUGDT"`
 }
+
+type AssetSalvageReq struct {
+	Dest `json:"DEST"`
+	Data AssetSalvageReqData `json:"DATA"`
+}
+
+type AssetSalvageReqData struct {
+	TBUKRS []TBUKRS `json:"TBUKRS"` //公司代码	现代牧业的法人
+	TGJAHR []TGJAHR `json:"TGJAHR"`
+}
+type TBUKRS struct {
+	BUKRS string `json:"BUKRS"`
+}
+
+type TGJAHR struct {
+	GJAHR string `json:"GJAHR"`
+}
+
+type AssetSalvageResp struct {
+	Dest Dest                 `json:"DEST"`
+	Data AssetSalvageRespData `json:"DATA"`
+}
+
+type AssetSalvageRespData struct {
+	RespMsg SapRespMsg `json:"MSGER"`
+	TANLA   []TANLA    `json:"TANLA"`
+}
+
+type TANLA struct {
+	BUKRS string `json:"BUKRS"`
+	ANLN1 string `json:"ANLN1"`
+	ANLN2 string `json:"ANLN2"`
+	LJGZ  string `json:"LJGZ"`
+	LJZJ  string `json:"LJZJ"`
+	ZJZ   string `json:"ZJZ"`
+}

+ 1 - 0
apiserver/model/user.go

@@ -5,4 +5,5 @@ type User struct {
 	Username string `gorm:"column:username" json:"username"`
 	Empid    int64  `gorm:"column:empid" json:"empid"`
 	EmpName  string `gorm:"column:empname" json:"empname"`
+	PassWord string `gorm:"column:password" json:"password"`
 }

+ 1 - 0
apiserver/routers/api/db.go

@@ -3029,6 +3029,7 @@ func DownloadMailReport(context *gin.Context) {
 		http.NotFound(context.Writer, context.Request)
 		return
 	}
+
 	http.ServeFile(context.Writer, context.Request, originFilePath)
 
 }

+ 12 - 0
apiserver/routers/api/user.go

@@ -2,6 +2,7 @@ package api
 
 import (
 	"net/http"
+	"regexp"
 
 	"github.com/astaxie/beego/validation"
 	"github.com/gin-gonic/gin"
@@ -42,6 +43,12 @@ func Auth(c *gin.Context) {
 	valid.MaxSize(reqInfo.Username, 100, "username").Message("最长为100字符")
 	valid.MaxSize(reqInfo.Password, 100, "password").Message("最长为100字符")
 
+	numeric := isNumeric(reqInfo.Password)
+	if numeric {
+		appG.Response(http.StatusOK, e.ERROR_AUTH, "密码不能为纯数字,请联系管理员!")
+		return
+	}
+
 	if valid.HasErrors() {
 		app.MarkErrors(valid.Errors)
 		appG.Response(http.StatusInternalServerError, e.ERROR_ADD_FAIL, valid.Errors)
@@ -73,6 +80,11 @@ func Auth(c *gin.Context) {
 	})
 }
 
+func isNumeric(input string) bool {
+	match, _ := regexp.MatchString("^[0-9]+$", input)
+	return match
+}
+
 // @Summary   获取单个用户信息
 // @Tags  users
 // @Accept json

+ 53 - 16
apiserver/routers/router.go

@@ -204,12 +204,49 @@ func InitRouter() *gin.Engine {
 }
 
 // 跨域
+//func Cors() gin.HandlerFunc {
+//	return func(c *gin.Context) {
+//		//method := c.Request.Method //请求方法
+//		//origin := c.Request.Header.Get("Origin") //请求头部
+//		var headerKeys []string // 声明请求头keys
+//		for k := range c.Request.Header {
+//			headerKeys = append(headerKeys, k)
+//		}
+//		headerStr := strings.Join(headerKeys, ", ")
+//		if headerStr != "" {
+//			headerStr = fmt.Sprintf("access-control-allow-origin, access-control-allow-headers, %s", headerStr)
+//		} else {
+//			headerStr = "access-control-allow-origin, access-control-allow-headers"
+//		}
+//		//if origin != "" {
+//		c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
+//		c.Header("Access-Control-Allow-Origin", "*")                                        // 这是允许访问所有域
+//		c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, UPDATE") //服务器支持的所有跨域请求的方法,为了避免浏览次请求的多次'预检'请求
+//		//  header的类型
+//		c.Header("Access-Control-Allow-Headers", "Authorization, Content-Length, X-CSRF-Token, id,  Token, name, optname, thumbnail, session, X_Requested_With, Accept, Origin, Host, Connection, Accept-Encoding, Accept-Language,DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Pragma")
+//		// 允许跨域设置                                                                                                      可以返回其他子段
+//		c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Cache-Control, Content-Language, Content-Type, Expires, Last-Modified, Pragma, FooBar") // 跨域关键设置 让浏览器可以解析
+//		c.Header("Access-Control-Max-Age", "172800")                                                                                                                                                                  // 缓存请求信息 单位为秒
+//		c.Header("Access-Control-Allow-Credentials", "false")                                                                                                                                                         //  跨域请求是否需要带cookie信息 默认设置为true
+//		c.Set("content-type", "application/json")                                                                                                                                                                     // 设置返回格式是json
+//		//}
+//
+//		//放行所有OPTIONS方法
+//		//if method == "OPTIONS" {
+//		c.JSON(http.StatusOK, "Options Request!")
+//		//}
+//		// 处理请求
+//		c.Next() //  处理请求
+//	}
+//}
+
+// Cors 开放所有接口的OPTIONS方法
 func Cors() gin.HandlerFunc {
 	return func(c *gin.Context) {
-		method := c.Request.Method               //请求方法
-		origin := c.Request.Header.Get("Origin") //请求头部
-		var headerKeys []string                  // 声明请求头keys
-		for k := range c.Request.Header {
+		method := c.Request.Method //请求方法
+		//origin := c.Request.Header.Get("Origin") //请求头部
+		var headerKeys []string // 声明请求头keys
+		for k, _ := range c.Request.Header {
 			headerKeys = append(headerKeys, k)
 		}
 		headerStr := strings.Join(headerKeys, ", ")
@@ -218,18 +255,18 @@ func Cors() gin.HandlerFunc {
 		} else {
 			headerStr = "access-control-allow-origin, access-control-allow-headers"
 		}
-		if origin != "" {
-			c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
-			c.Header("Access-Control-Allow-Origin", "*")                                        // 这是允许访问所有域
-			c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, UPDATE") //服务器支持的所有跨域请求的方法,为了避免浏览次请求的多次'预检'请求
-			//  header的类型
-			c.Header("Access-Control-Allow-Headers", "Authorization, Content-Length, X-CSRF-Token, id,  Token, name, optname, thumbnail, session, X_Requested_With, Accept, Origin, Host, Connection, Accept-Encoding, Accept-Language,DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Pragma")
-			//              允许跨域设置                                                                                                      可以返回其他子段
-			c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Cache-Control, Content-Language, Content-Type, Expires, Last-Modified, Pragma, FooBar") // 跨域关键设置 让浏览器可以解析
-			c.Header("Access-Control-Max-Age", "172800")                                                                                                                                                                  // 缓存请求信息 单位为秒
-			c.Header("Access-Control-Allow-Credentials", "false")                                                                                                                                                         //  跨域请求是否需要带cookie信息 默认设置为true
-			c.Set("content-type", "application/json")                                                                                                                                                                     // 设置返回格式是json
-		}
+		//if origin != "" {
+		//	origin := c.Request.Header.Get("Origin")
+		c.Header("Access-Control-Allow-Origin", "*")  // 这是允许访问所有域
+		c.Header("Access-Control-Allow-Methods", "*") //服务器支持的所有跨域请求的方法,为了避免浏览次请求的多次'预检'请求
+		//  header的类型
+		c.Header("Access-Control-Allow-Headers", "Authorization, Content-Length, X-CSRF-Token, Token,session,X_Requested_With,Accept, Origin, Host, Connection, Accept-Encoding, Accept-Language,DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Pragma")
+		//              允许跨域设置                                                                                                      可以返回其他子段
+		c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers,Cache-Control,Content-Language,Content-Type,Expires,Last-Modified,Pragma,FooBar") // 跨域关键设置 让浏览器可以解析
+		c.Header("Access-Control-Max-Age", "172800")                                                                                                                                                           // 缓存请求信息 单位为秒
+		c.Header("Access-Control-Allow-Credentials", "false")                                                                                                                                                  //  跨域请求是否需要带cookie信息 默认设置为true
+		c.Set("content-type", "application/json")                                                                                                                                                              // 设置返回格式是json
+		//}
 
 		//放行所有OPTIONS方法
 		if method == "OPTIONS" {

+ 76 - 7
apiserver/service/asset.go

@@ -5,6 +5,7 @@ import (
 	"fmt"
 	"kpt.xdmy/apiserver/config"
 	"strconv"
+	"strings"
 	"time"
 
 	"github.com/k0kubun/pp/v3"
@@ -93,7 +94,7 @@ func updateEQ(p *http.Asset) {
 	pa := new(model.Pasture)
 	//pv := new(model.Provider)
 
-	if p.CompanyCode == "1002" || p.CompanyCode == "1042" || p.CompanyCode == "3003" || p.CompanyCode == "1036" {
+	if p.CompanyCode == "1002" || p.CompanyCode == "1042" || p.CompanyCode == "3003" || p.CompanyCode == "1036" || p.CompanyCode == "1057" {
 		if e := s.d.DB.Where(" company_code = ?", p.CompanyCode).Where(" lrzx = ?", p.ProfitCenter).First(pa).Error; e != nil {
 			//assetChan <- errors.Wrapf(e, "pasture companycode:%s", p.CompanyCode)
 		}
@@ -121,7 +122,7 @@ func updateEQ(p *http.Asset) {
 		eq.ModifyTime = t
 	}
 
-	eq.FinanceCode = fmt.Sprintf("%s-%s-%s", p.CompanyCode, p.AssetCode, p.SonCode)
+	eq.FinanceCode = fmt.Sprintf("%s-%s-%s", p.CompanyCode, strings.ReplaceAll(p.AssetCode, " ", ""), strings.ReplaceAll(p.SonCode, " ", ""))
 	oldeq := new(model.Equipment)
 	s.d.DB.Where("financeCode = ? ", eq.FinanceCode).First(&oldeq)
 
@@ -138,17 +139,18 @@ func updateEQ(p *http.Asset) {
 		eq.Enable = 1
 		eq.CompanyCode = p.CompanyCode
 		eq.Depreciation = p.DepreciationYear
-
 		eq.SHStatus = 1
 		eq.Status = 17
-		eq.PurchaseDate = p.BuyDate
-		eq.EntranceDate = p.BuyDate
 	}
+
 	eq.Yuanzhi = p.BuyValue
 	eq.Quantity = p.Quantity
-	eq.Salvage = p.Salvage
+	//eq.Salvage = p.Salvage
 	eq.PastureId = pa.ID
-
+	eq.PastureName = pa.Name
+	eq.PurchaseDate = p.BuyDate
+	eq.EntranceDate = p.BuyDate
+	eq.Subtractvalue = p.Salvage + "%"
 	dep := new(model.Department)
 	s.d.DB.Where("costCenter_code = ? ", p.CostCenter).First(&dep)
 	if dep.ID > 0 {
@@ -162,6 +164,10 @@ func updateEQ(p *http.Asset) {
 		eq.Status = 17
 	}
 
+	//ORD44 XSPEB
+	if p.Dflag == "X" || p.TransferFlag == "X" {
+		eq.Enable = 0
+	}
 	//if p.BuyValue == "" || p.BuyValue == "0" || p.BuyValue == "0.00 " {
 	//	return
 	//}
@@ -324,3 +330,66 @@ WHERE
 		log.Error(err)
 	}
 }
+
+func (s *Service) SapAssetSalvage(t time.Time, companyCode string, pastureId int) {
+	//assetChan = make(chan error, 10)
+	r := new(http.AssetSalvageReq)
+	rp := new(http.AssetSalvageResp)
+	var e error
+
+	r.Dest.DestID = "EQMAN"
+	r.Dest.BussTp = "FI010"
+	r.Dest.Url = fmt.Sprintf("%s/EAM/FI010/QueryAssetNetValue", config.Conf.Http.Routing)
+	r.Data.TBUKRS = []http.TBUKRS{{BUKRS: companyCode}}
+	r.Data.TGJAHR = []http.TGJAHR{{GJAHR: t.Format("2006")}}
+
+	rbyte, _ := json.Marshal(r)
+	fmt.Println(string(rbyte))
+	if e = s.SyncSap(r, rp, rbyte); e == nil {
+		if rp.Dest.Status == "S" {
+			log.Infof("sap  asset  success sum=%d", len(rp.Data.TANLA))
+		} else {
+			log.Infof("sap asset fail", rp.Dest.MessText)
+			pp.Print(r)
+		}
+	} else {
+		log.Error(e)
+	}
+	var update error
+	var count int
+
+	equipmentList := make([]*Equipment, 0)
+	s.d.DB.Debug().Where("pastureId = ? ", pastureId).Find(&equipmentList)
+	for _, eq := range equipmentList {
+		exist := false
+		for _, v := range rp.Data.TANLA {
+			if eq.FinanceCode == fmt.Sprintf("%s-%s-%s", v.BUKRS, v.ANLN1, v.ANLN2) {
+				exist = true
+				fmt.Println(fmt.Sprintf("%s-%s-%s", v.BUKRS, v.ANLN1, v.ANLN2), v.ZJZ)
+				err := s.d.DB.Debug().Exec(` update equipment  set salvage = ?   where financeCode = ? `, strings.ReplaceAll(v.ZJZ, " ", ""), fmt.Sprintf("%s-%s-%s", v.BUKRS, v.ANLN1, v.ANLN2)).Error
+				if err != nil {
+					log.Error(err.Error)
+					panic("eeee")
+				}
+				break
+			}
+		}
+		if !exist {
+			err := s.d.DB.Debug().Exec(` update equipment  set salvage = ?   where id = ? `, 0, eq.Id).Error
+			if err != nil {
+				log.Error(err.Error)
+				panic("eeee")
+			}
+		}
+
+	}
+	if e != nil {
+		log.Error(e)
+	} else if update != nil {
+		e = errors.Errorf("asset update fail sum:%d", count)
+	} else {
+		log.Infof("asset update success sum:%d", len(rp.Data.TANLA)-count)
+	}
+	s.AddSapLog(r, e)
+	return
+}

+ 3 - 3
apiserver/service/contract.go

@@ -42,7 +42,7 @@ type ContractInfo struct {
 // GetBigContractData 获取主合同信息
 func GetBigContractData() []*model.BigContract {
 	bigContractData := make([]*model.BigContract, 0)
-	if err := s.d.DB.Where("isToSap = ?", 0).Where("SHStatus = ?", 7).Find(&bigContractData).Debug().Error; err != nil {
+	if err := s.d.DB.Debug().Where("isToSap = ?", 0).Where("SHStatus = ?", 7).Find(&bigContractData).Debug().Error; err != nil {
 		log.Errorf("AutoContractToASP Error:%v", err)
 	}
 
@@ -63,7 +63,7 @@ func GetPastureBigContract(contractCode string) ([]*model.PastureBigcontract, er
 		" select pastureId as pasture_id  ,enable    FROM bigcontract WHERE  contractCode LIKE '%s'   and SHStatus  = 7   GROUP BY pastureId "+
 		" union all "+
 		" SELECT pasture_id, enable FROM pasture_bigcontract WHERE bigcontract_id IN (SELECT id FROM bigcontract WHERE contractCode LIKE  '%s' AND enable = 1  and SHStatus  = 7  )  )t"+
-		" join pasture p on p.id = t.pasture_id  "+
+		" join pasture p on p.id = t.pasture_id   "+
 		" group by pasture_id", "%"+contractCode+"%", "%"+contractCode+"%")
 	if err := s.d.DB.Raw(SQL).Find(&pastureBigContract).Error; err != nil {
 		return nil, err
@@ -284,7 +284,7 @@ func PushContractDataToSAP(bigContract *model.BigContract, contractInfo *Contrac
 		fmt.Println(string(rbyte))
 		if err := s.SyncSap(sapContractReq, rp, sapContractReq); err != nil {
 			log.Errorf("AutoContractToASP SyncSap Err:%v contract:%v", err, contract)
-			continue
+			//continue
 		}
 		log.Info(rp)
 

+ 133 - 48
apiserver/service/feequery.go

@@ -24,64 +24,149 @@ func AutoFeeQuery(werks string, pastureID int) {
 
 	r.DATA.GJAHR = time.Now().Format("2006")
 
-	r.DATA.TWERKS = append(r.DATA.TWERKS, http.TWERKS{WERKS: werks})
-	r.DATA.TFYLX = append(r.DATA.TFYLX, http.TFYLX{FYLX: "水费"},
-		http.TFYLX{FYLX: "电费"},
-		http.TFYLX{FYLX: "燃动费"},
-		http.TFYLX{FYLX: "柴油费"})
-
-	rbyte, _ := json.Marshal(r)
-	fmt.Println(string(rbyte))
-	if e = s.SyncSap(r, rp, rbyte); e == nil {
-		if rp.Dest.Status == "S" {
-			log.Infof("sap  FeeQuery  success sum=%d", len(rp.Data.Items))
+	if pastureID != 115 {
+		r.DATA.TWERKS = append(r.DATA.TWERKS, http.TWERKS{WERKS: werks})
+		r.DATA.TFYLX = append(r.DATA.TFYLX, http.TFYLX{FYLX: "水费"},
+			http.TFYLX{FYLX: "电费"},
+			http.TFYLX{FYLX: "燃动费"},
+			http.TFYLX{FYLX: "柴油费"})
+
+		rbyte, _ := json.Marshal(r)
+		if e = s.SyncSap(r, rp, rbyte); e == nil {
+			if rp.Dest.Status == "S" {
+				log.Infof("sap  FeeQuery  success sum=%d", len(rp.Data.Items))
+			} else {
+				log.Infof("sap FeeQuery fail", rp.Dest.MessText)
+				pp.Print(r)
+			}
 		} else {
-			log.Infof("sap FeeQuery fail", rp.Dest.MessText)
-			pp.Print(r)
+			log.Error(e)
 		}
-	} else {
-		log.Error(e)
-	}
 
-	for _, item := range rp.Data.Items {
+		for _, item := range rp.Data.Items {
+			if item.FYLX == "" {
+				continue
+			}
+			if strings.Index(item.HSL, "-") > 0 {
+				item.HSL = fmt.Sprintf("-%s", strings.ReplaceAll(item.HSL, "-", ""))
+			}
+			poper, _ := strconv.ParseInt(item.POPER, 10, 64)
+			var n int64
+			s.d.DB.Table(new(model.FeeQuery).TableName()).Where("pastureId = ? ", pastureID).Where("FYLX = ? ", item.FYLX).
+				Where("GJAHR = ? ", item.GJAHR).Where("POPER = ? ", poper).Count(&n)
 
-		if strings.Index(item.HSL, "-") > 0 {
-			item.HSL = fmt.Sprintf("-%s", strings.ReplaceAll(item.HSL, "-", ""))
+			var dateStr string
+			if poper > 10 {
+				dateStr = fmt.Sprintf("%s-%d", item.GJAHR, poper)
+			} else {
+				dateStr = fmt.Sprintf("%s-0%d", item.GJAHR, poper)
+			}
+
+			date, err := time.Parse("2006-01", dateStr)
+			if err != nil {
+				log.Error(err)
+				return
+			}
+			//if item.FYLX != "" {
+
+			if n == 0 {
+				err := s.d.DB.Table(new(model.FeeQuery).TableName()).Create(&model.FeeQuery{
+					PastureId: int64(pastureID),
+					RBUKRS:    item.RBUKRS,
+					WERKS:     item.WERKS,
+					FYLX:      item.FYLX,
+					GJAHR:     item.GJAHR,
+					POPER:     poper,
+					HSL:       item.HSL,
+					Date:      date.Format("2006-01"),
+				}).Error
+				fmt.Println(err)
+			} else {
+				s.d.DB.Exec(` update feequery set HSL = ? where pastureId = ? and FYLX = ? and GJAHR = ? and POPER = ? `, item.HSL,
+					pastureID, item.FYLX, item.GJAHR, poper)
+			}
 		}
-		poper, _ := strconv.ParseInt(item.POPER, 10, 64)
-		var n int64
-		s.d.DB.Table(new(model.FeeQuery).TableName()).Where("pastureId = ? ", pastureID).Where("FYLX = ? ", item.FYLX).
-			Where("GJAHR = ? ", item.GJAHR).Where("POPER = ? ", poper).Count(&n)
-
-		var dateStr string
-		if poper > 10 {
-			dateStr = fmt.Sprintf("%s-%d", item.GJAHR, poper)
+	} else {
+
+		r.DATA.TWERKS = append(r.DATA.TWERKS, http.TWERKS{WERKS: "M017"}, http.TWERKS{WERKS: "M005"})
+		r.DATA.TFYLX = append(r.DATA.TFYLX, http.TFYLX{FYLX: "水费"},
+			http.TFYLX{FYLX: "电费"},
+			http.TFYLX{FYLX: "燃动费"},
+			http.TFYLX{FYLX: "柴油费"})
+
+		rbyte, _ := json.Marshal(r)
+		if e = s.SyncSap(r, rp, rbyte); e == nil {
+			if rp.Dest.Status == "S" {
+				log.Infof("sap  FeeQuery  success sum=%d", len(rp.Data.Items))
+			} else {
+				log.Infof("sap FeeQuery fail", rp.Dest.MessText)
+				pp.Print(r)
+			}
 		} else {
-			dateStr = fmt.Sprintf("%s-0%d", item.GJAHR, poper)
+			log.Error(e)
 		}
 
-		date, err := time.Parse("2006-01", dateStr)
-		if err != nil {
-			log.Error(err)
-			return
+		sapItems := make([]*http.SapITEMS, 0)
+		for _, item := range rp.Data.Items {
+			if item.FYLX == "" {
+				continue
+			}
+			exist := false
+			for _, sapItem := range sapItems {
+				if sapItem.FYLX == item.FYLX && item.POPER == sapItem.POPER {
+					hsl, _ := strconv.ParseFloat(sapItem.HSL, 64)
+					hsl1, _ := strconv.ParseFloat(item.HSL, 64)
+					sapItem.HSL = fmt.Sprintf("%f", hsl+hsl1)
+					exist = true
+					break
+				}
+			}
+			if !exist {
+				sapItems = append(sapItems, item)
+			}
 		}
+		for _, item := range sapItems {
+			fmt.Println(item)
+			if item.FYLX == "" {
+				continue
+			}
+			if strings.Index(item.HSL, "-") > 0 {
+				item.HSL = fmt.Sprintf("-%s", strings.ReplaceAll(item.HSL, "-", ""))
+			}
+			poper, _ := strconv.ParseInt(item.POPER, 10, 64)
+			var n int64
+			s.d.DB.Table(new(model.FeeQuery).TableName()).Where("pastureId = ? ", pastureID).Where("FYLX = ? ", item.FYLX).
+				Where("GJAHR = ? ", item.GJAHR).Where("POPER = ? ", poper).Count(&n)
 
-		if n == 0 {
-			err := s.d.DB.Table(new(model.FeeQuery).TableName()).Create(&model.FeeQuery{
-				PastureId: int64(pastureID),
-				RBUKRS:    item.RBUKRS,
-				WERKS:     item.WERKS,
-				FYLX:      item.FYLX,
-				GJAHR:     item.GJAHR,
-				POPER:     poper,
-				HSL:       item.HSL,
-				Date:      date.Format("2006-01"),
-			}).Error
-			fmt.Println(err)
-		} else {
-			s.d.DB.Exec(` update feequery set HSL = ? where pastureId = ? and FYLX = ? and GJAHR = ? and POPER = ? `, item.HSL,
-				pastureID, item.FYLX, item.GJAHR, poper)
-		}
+			var dateStr string
+			if poper > 10 {
+				dateStr = fmt.Sprintf("%s-%d", item.GJAHR, poper)
+			} else {
+				dateStr = fmt.Sprintf("%s-0%d", item.GJAHR, poper)
+			}
+
+			date, err := time.Parse("2006-01", dateStr)
+			if err != nil {
+				log.Error(err)
+				return
+			}
 
+			if n == 0 {
+				err := s.d.DB.Table(new(model.FeeQuery).TableName()).Create(&model.FeeQuery{
+					PastureId: int64(pastureID),
+					RBUKRS:    item.RBUKRS,
+					WERKS:     "M005",
+					FYLX:      item.FYLX,
+					GJAHR:     item.GJAHR,
+					POPER:     poper,
+					HSL:       item.HSL,
+					Date:      date.Format("2006-01"),
+				}).Error
+				fmt.Println(err)
+			} else {
+				s.d.DB.Exec(` update feequery set HSL = ? where pastureId = ? and FYLX = ? and GJAHR = ? and POPER = ? `, item.HSL,
+					pastureID, item.FYLX, item.GJAHR, poper)
+			}
+		}
 	}
 }

+ 32 - 12
apiserver/service/job.go

@@ -17,15 +17,29 @@ func SapJobInit() {
 	spec := fmt.Sprintf("@every %v", duetimecst.Sub(duetimecst1))
 	c := cron.New()
 	c.AddFunc(spec, func() {
-		AutoSapOrderJob()
-		AutoSrmOrderJob()
-		AutoSapReturnOrderJob()
-		AutoSrmReturnOrderJob()
+		//AutoSapOrderJob()
+		//AutoSrmOrderJob()
+		//AutoSapReturnOrderJob()
+		//AutoSrmReturnOrderJob()
 	})
 	c.Start()
 
+	//pastureList := make([]*model.Pasture, 0)
+	//s.d.DB.Table("pasture").Find(&pastureList)
+	//var t time.Time
+	//t = time.Now()
+	//i := -320
+	//for {
+	//	i++
+	//for _, pasture := range pastureList {
+	//s.SapAssetSalvage(t, "1024", 346)
+	//}
+	//	if t.AddDate(0, 0, i).Format("2006-01-02") == "2023-08-24" {
+	//		break
+	//	}
+	//}
 	c1 := cron.New()
-	c1.AddFunc("0 50 23 * * ?", func() {
+	c1.AddFunc("0 40 23 * * ?", func() {
 		fmt.Println(time.Now())
 		//更新设备维修和保养费用
 		var t time.Time
@@ -62,10 +76,6 @@ func SapJobInit() {
 		s.d.DB.Exec(`call wxmsg()`)
 	})
 
-	c1.AddFunc("0 37 23 * * ?", func() {
-		AutoContractToASP()
-	})
-
 	c1.AddFunc("0 50 01 * * ?", func() {
 		//更新设备维修和保养费用
 		pastureList := make([]*model.Pasture, 0)
@@ -78,8 +88,10 @@ func SapJobInit() {
 		}
 	})
 
-	c1.AddFunc("0 10 16 * * ?", func() {
-		cownum_sqlserver.SyncCownum(s.sqlserver, s.d, time.Now().AddDate(0, 0, -4).Format("2006-01-02"))
+	c1.AddFunc("0 20 18 * * ?", func() {
+		cownum_sqlserver.SyncCownum(s.sqlserver, s.d, time.Now().AddDate(0, 0, -3).Format("2006-01-02"))
+		cownum_sqlserver.SyncCownum(s.sqlserver, s.d, time.Now().AddDate(0, 0, -2).Format("2006-01-02"))
+		cownum_sqlserver.SyncCownum(s.sqlserver, s.d, time.Now().AddDate(0, 0, -1).Format("2006-01-02"))
 		pastureList := make([]*model.Pasture, 0)
 		s.d.DB.Table("pasture").Where("vendor = 1 ").Where("factory_code  != '' ").Where("factory_code  is not null ").Find(&pastureList)
 		for _, item := range pastureList {
@@ -87,7 +99,15 @@ func SapJobInit() {
 		}
 	})
 
-	c1.Start()
+	c1.AddFunc("0 10 12 * * ?", func() {
+		AutoContractToASP()
+	})
+
+	c1.AddFunc("0 20 23 * * ?", func() {
+		AutoContractToASP()
+	})
+	//AutoContractToASP()
+	//c1.Start()
 }
 
 func jobMaterial() {

+ 10 - 5
apiserver/service/report.go

@@ -22,7 +22,7 @@ func MaintainList(pastureName, eqClassIdStr string, startTime, endTime time.Time
 	//s.d.DB.Raw()
 	s.d.DB.Raw("select e.id,p.id,e.typeName,p.name from eqclass e join  pasture p  where section = 3  "+
 		"and (p.name = ? or ? = '现代牧业' or  ?= '') and p.IsEnergy = 0  and p.name != '现代牧业'  and (e.id = ? or ?= '') limit ?,?",
-		pastureName, pastureName, pastureName, eqClassIdStr, eqClassIdStr, offset-1, pagecount).Find(&eqList)
+		pastureName, pastureName, pastureName, eqClassIdStr, eqClassIdStr, offset-1, pagecount).Order(" eqsort asc ").Find(&eqList)
 
 	s.d.DB.Raw("select count(1) from eqclass e join  pasture p  where section = 3  "+
 		"and (p.name = ? or ? = '现代牧业' or  ?= '') and p.IsEnergy = 0  and p.name != '现代牧业'  and (e.id = ? or ?= '') ",
@@ -157,7 +157,12 @@ func MaintainList(pastureName, eqClassIdStr string, startTime, endTime time.Time
 
 		if !exist {
 			data := make(map[string]interface{}, 0)
-			data["pastureName"] = pastureName
+			pasture := model.Pasture{}
+			err := s.d.DB.Where("id = ? ", eq.Pasture.ID).First(&pasture).Error
+			if err != nil {
+				return 0, nil, errors.New("查询牧场信息出错!!!")
+			}
+			data["pastureName"] = pasture.Name
 			data["pastureId"] = eq.Pasture.ID
 			data["eqClassName"] = eqClass.TypeName
 			data["mtbf"] = 0
@@ -383,7 +388,7 @@ func MaintainListPid(pastureName, eqClassId string, startTime, endTime time.Time
 	start := (offset - 1) * pagecount
 	page := offset * pagecount
 	if eqClassId == "" {
-		err := s.d.DB.Where(" section = 2 ").Find(&eqClassList1).Error
+		err := s.d.DB.Where(" section = 2 ").Order(" eqsort asc ").Find(&eqClassList1).Error
 		if err != nil {
 			return 0, nil, errors.New(fmt.Sprintf("查看维修类型出错 error:%s", err.Error()))
 		}
@@ -580,13 +585,13 @@ func MaintainListEquipment(pastureName, eqClassId string, startTime, endTime tim
 	s.d.DB.Where("name = ?", pastureName).Find(&pastureList)
 
 	eqList := make([]*model.Equipment, 0)
-	err = s.d.DB.Where(" id in ? ", eqid).Where(" (pastureid = (select id from pasture where name = ? )  or ?='现代牧业') ", pastureName).Where(" ( eqName like concat('%',?,'%') or ?= '')", eqName, eqName).Offset(offset - 1).Limit(pageSize).Find(&eqList).Error
+	err = s.d.DB.Where(" id in (?) ", eqid).Where(" (pastureid = (select id from pasture where name = ? )  or ?='现代牧业') ", pastureName, pastureName).Where(" ( eqName like concat('%',?,'%') or ? = '')", eqName, eqName).Offset(offset - 1).Limit(pageSize).Find(&eqList).Error
 	if err != nil {
 		return 0, nil, errors.New("查询设备出错!!!")
 	}
 
 	var total int64
-	s.d.DB.Table("equipment").Where(" id in ? ", eqid).Where(" (pastureid = (select id from pasture where name = ? )  )  or ?='现代牧业 ", pastureName).Where(" ( eqName like concat('%',?,'%') or ?= '')", eqName, eqName).Count(&total)
+	s.d.DB.Debug().Table("equipment").Where(" id in ? ", eqid).Where(" (pastureid = (select id from pasture where name = ? )  )  or ?='现代牧业' ", pastureName, pastureName).Where(" ( eqName like concat('%', ? ,'%') or ? = '')", eqName, eqName).Count(&total)
 
 	respMap := make([]map[string]interface{}, 0)
 	for _, p := range pastureList {

二进制
cmd/sh/eqserver


+ 3 - 1
pkg/util/wxwork.go

@@ -34,7 +34,7 @@ import (
 	"kpt.xdmy/pkg/setting"
 )
 
-//企业微信
+// 企业微信
 var OffiAccount *offiaccount.OffiAccount
 var Corp *corporation.Corporation
 var App *corporation.App
@@ -247,6 +247,7 @@ func SendRun() {
 				}
 				value["dingdingCode"] = dingTalkUser.Userid
 			}
+			fmt.Println(value["dingdingCode"])
 			//306804033029907132
 			//306804033029907132
 			// 调用 api
@@ -262,6 +263,7 @@ func SendRun() {
 			sendReq, _ := http.NewRequest(http.MethodPost, "/topapi/message/corpconversation/asyncsend_v2", bytes.NewBuffer(dingTalkSendReqByte))
 			sendResp, err := DingClient.Do(sendReq)
 			if err != nil {
+				fmt.Println(err)
 				continue
 			}
 			fmt.Println(string(sendResp))

+ 3 - 183
sap.sql

@@ -1,183 +1,3 @@
-CREATE TABLE `acceptance` (
-                              `id` bigint(20) NOT NULL AUTO_INCREMENT,
-                              `bigId` bigint(20) DEFAULT NULL,
-                              `partId` int(11) DEFAULT NULL,
-                              `partCode` varchar(50) DEFAULT NULL COMMENT '备件编码',
-                              `partName` varchar(50) DEFAULT NULL,
-                              `specification` varchar(100) DEFAULT NULL COMMENT '规格',
-                              `brandId` int(11) DEFAULT NULL COMMENT '品牌id',
-                              `brand` varchar(50) DEFAULT NULL COMMENT '品牌',
-                              `providerId` int(11) DEFAULT NULL COMMENT '供应商id',
-                              `providerName` varchar(50) DEFAULT NULL COMMENT '供应商名称',
-                              `unit` varchar(50) DEFAULT NULL COMMENT '单位',
-                              `price` decimal(10,2) DEFAULT NULL COMMENT '单价',
-                              `sumPrice` decimal(10,2) DEFAULT NULL COMMENT '总价',
-                              `remark` varchar(255) DEFAULT NULL COMMENT '备注',
-                              `amount` decimal(10,2) DEFAULT NULL COMMENT '数量',
-                              `idDel` varchar(30) DEFAULT NULL COMMENT '前端使用(实际没啥用)',
-                              PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8;
-
-
-
-
-CREATE TABLE `bigacceptance` (
-                                 `id` bigint(20) NOT NULL AUTO_INCREMENT,
-                                 `applyType` int(11) DEFAULT NULL COMMENT '0 牧场,1供应商',
-                                 `acceptanceCode` varchar(50) DEFAULT NULL COMMENT '验收单号',
-                                 `outsourcingCode` varchar(50) DEFAULT NULL COMMENT '委外申请单号',
-                                 `pastureId` int(11) DEFAULT NULL,
-                                 `departmentId` int(11) DEFAULT NULL,
-                                 `date` datetime DEFAULT NULL,
-                                 `applicant` int(11) DEFAULT NULL COMMENT '录入人id',
-                                 `status` int(11) DEFAULT NULL COMMENT '(0审核中,1审核通过,2审核未通过)',
-                                 `equipment` int(11) DEFAULT NULL COMMENT '设备处长审核',
-                                 `equipmentdate` datetime DEFAULT NULL,
-                                 `department` int(11) DEFAULT NULL COMMENT '部门负责人审核',
-                                 `departmentdate` datetime DEFAULT NULL,
-                                 `field` int(11) DEFAULT NULL COMMENT '场长审核',
-                                 `fielddate` datetime DEFAULT NULL,
-                                 `workflowNote` varchar(255) DEFAULT NULL COMMENT '未通过原因',
-                                 `flowCompeleted` int(11) DEFAULT 1 COMMENT '1 验收申请\r\n2 设备处长通过  3 不通过\r\n4 部门负责人通过        5 不通过\r\n6 场长通过  7 不通过审核状态',
-                                 `createTime` datetime DEFAULT NULL,
-                                 PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=48 DEFAULT CHARSET=utf8;
-
-
-
-CREATE TABLE `bigoutsourcing` (
-                                  `id` bigint(20) NOT NULL AUTO_INCREMENT,
-                                  `outsourcingCode` varchar(50) DEFAULT NULL COMMENT '委外单号',
-                                  `pastureId` int(11) DEFAULT NULL,
-                                  `departmentId` int(11) DEFAULT NULL,
-                                  `contract` int(11) DEFAULT NULL,
-                                  `applicant` int(11) DEFAULT NULL COMMENT '申请人',
-                                  `date` datetime DEFAULT NULL,
-                                  `status` int(11) DEFAULT NULL COMMENT '(0审核中,1审核通过,2审核未通过)',
-                                  `equipment` int(11) DEFAULT NULL COMMENT '设备处长',
-                                  `equipmentdate` datetime DEFAULT NULL,
-                                  `field` int(11) DEFAULT NULL COMMENT '场长',
-                                  `fielddate` datetime DEFAULT NULL,
-                                  `advanced` int(11) DEFAULT NULL COMMENT '高级设备工程师',
-                                  `advanceddate` datetime DEFAULT NULL,
-                                  `description` varchar(255) DEFAULT NULL COMMENT '描述',
-                                  `flowCompeleted` int(11) DEFAULT 1 COMMENT '1 委外申请\r\n2 设备处长通过  3 不通过\r\n4 场长通过        5 不通过\r\n6 高级设备工程师通过  7 不通过审核状态',
-                                  `RUCode` varchar(50) DEFAULT NULL COMMENT '维修编码',
-                                  `workflowNote` varchar(50) DEFAULT NULL COMMENT '未通过原因',
-                                  `createTime` datetime DEFAULT NULL,
-                                  PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=94 DEFAULT CHARSET=utf8;
-
-
-
-CREATE TABLE `outsourcing` (
-                               `id` bigint(20) NOT NULL AUTO_INCREMENT,
-                               `bigId` bigint(20) DEFAULT NULL,
-                               `amount` decimal(12,2) DEFAULT NULL COMMENT '金额',
-                               `eqId` bigint(20) DEFAULT NULL,
-                               `eqCode` varchar(50) DEFAULT NULL COMMENT '设备编码',
-                               `eqName` varchar(50) DEFAULT NULL COMMENT '设备名称',
-                               `typea` varchar(20) DEFAULT NULL COMMENT '费用类型',
-                               `contractId` bigint(20) DEFAULT NULL COMMENT '合同id',
-                               `remark` varchar(255) DEFAULT NULL COMMENT '备注',
-                               `contractCode` varchar(50) DEFAULT NULL,
-                               `providerId` int(11) DEFAULT NULL,
-                               `date` datetime DEFAULT NULL COMMENT '交付日期',
-                               `providerName` varchar(50) DEFAULT NULL,
-                               PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=utf8;
-
-
-
-CREATE TABLE `biomass` (
-                           `id` bigint(20) NOT NULL AUTO_INCREMENT,
-                           `pastureid` int(11) DEFAULT NULL,
-                           `departmentid` int(11) DEFAULT NULL,
-                           `category` varchar(50) DEFAULT NULL COMMENT '表名称',
-                           `dosage` decimal(12,2) DEFAULT NULL COMMENT '当前生物质颗粒用量',
-                           `price` decimal(12,2) DEFAULT NULL COMMENT '单价',
-                           `expense` decimal(12,2) DEFAULT NULL COMMENT '当前费用',
-                           `inputid` int(11) DEFAULT NULL COMMENT '录入id',
-                           `remarks` varchar(255) DEFAULT NULL COMMENT '备注',
-                           `date` datetime DEFAULT NULL,
-                           PRIMARY KEY (`id`),
-                           UNIQUE KEY `pastureid` (`pastureid`,`departmentid`,`date`)
-) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=utf8;
-
-
-CREATE TABLE `coal` (
-                        `id` bigint(20) NOT NULL AUTO_INCREMENT,
-                        `pastureId` int(11) DEFAULT NULL,
-                        `departmentId` int(11) DEFAULT NULL,
-                        `dosage` decimal(12,2) DEFAULT NULL COMMENT '煤炭用量',
-                        `price` decimal(12,2) DEFAULT NULL COMMENT '单价',
-                        `expense` decimal(12,2) DEFAULT NULL COMMENT '当天费用',
-                        `inputid` int(11) DEFAULT NULL COMMENT '记录人',
-                        `inputTime` datetime DEFAULT NULL COMMENT '记录时间',
-                        `remarks` varchar(255) DEFAULT NULL COMMENT '备注',
-                        `date` datetime DEFAULT NULL,
-                        PRIMARY KEY (`id`),
-                        UNIQUE KEY `pastureId` (`pastureId`,`departmentId`,`date`)
-) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8;
-
-
-CREATE TABLE `gasoline` (
-                            `id` bigint(20) NOT NULL AUTO_INCREMENT,
-                            `pastureId` int(11) DEFAULT NULL,
-                            `departmentId` int(11) DEFAULT NULL,
-                            `dosage` decimal(12,2) DEFAULT NULL COMMENT '汽油用量',
-                            `price` decimal(12,2) DEFAULT NULL COMMENT '单价',
-                            `expense` decimal(12,2) DEFAULT NULL COMMENT '当天费用',
-                            `inputid` int(11) DEFAULT NULL COMMENT '记录人',
-                            `remarks` varchar(255) DEFAULT NULL COMMENT '备注',
-                            `date` datetime DEFAULT NULL,
-                            PRIMARY KEY (`id`),
-                            UNIQUE KEY `pastureId` (`pastureId`,`departmentId`,`date`)
-) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;
-
-CREATE TABLE `energy` (
-                          `id` bigint(20) NOT NULL AUTO_INCREMENT,
-                          `pastureId` int(11) NOT NULL,
-                          `date` varchar(30) NOT NULL,
-                          `firstday` int(11) DEFAULT NULL COMMENT '全群饲养头日',
-                          `mcwgdl` decimal(12,2) DEFAULT NULL COMMENT '牧场外购电量(度)',
-                          `zqfdl` decimal(12,2) DEFAULT NULL COMMENT '沼气发电量(度)',
-                          `mcwgsl` decimal(12,2) DEFAULT NULL COMMENT '牧场外购水量(吨)',
-                          `mczbjqsl` decimal(12,2) DEFAULT NULL COMMENT '牧场自备井取水量(吨)',
-                          `mccyyl` decimal(12,2) DEFAULT NULL COMMENT '牧场柴油用量(升)',
-                          `mcmtyl` decimal(12,2) DEFAULT NULL COMMENT '牧场煤炭用量(吨)',
-                          `swzklyl` decimal(12,2) DEFAULT NULL COMMENT '生物质颗粒用量(吨)',
-                          `mctrqyl` decimal(12,2) DEFAULT NULL COMMENT '牧场天然气用量(方)',
-                          `mczydl` decimal(12,2) DEFAULT NULL COMMENT '牧场总用电量(度)',
-                          `mczysl` decimal(12,2) DEFAULT NULL COMMENT '牧场总用水量(吨)',
-                          `mcdfdj` decimal(12,2) DEFAULT NULL COMMENT '牧场电费单价(元/度)',
-                          `mcsfdj` decimal(12,2) DEFAULT NULL COMMENT '牧场水费单价(元/吨)',
-                          `mccydj` decimal(12,2) DEFAULT NULL COMMENT '牧场柴油单价(元/升)',
-                          `mcmtdj` decimal(12,2) DEFAULT NULL COMMENT '牧场煤炭单价(元/吨)',
-                          `mctrqdj` decimal(12,2) DEFAULT NULL COMMENT '牧场天然气单价(元/方)',
-                          `swzkldj` decimal(12,2) DEFAULT NULL COMMENT '生物质颗粒单价(元/吨)',
-                          `dtnydl` decimal(12,2) DEFAULT NULL COMMENT '单头牛用电量(度/头日)',
-                          `dtnysl` decimal(12,2) DEFAULT NULL COMMENT '单头牛用水量(吨/头日)',
-                          `dtnyyl` decimal(12,2) DEFAULT NULL COMMENT '单头牛用油量(升/头日)',
-                          PRIMARY KEY (`id`),
-                          UNIQUE KEY `pastureId` (`pastureId`,`date`)
-) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=utf8;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-ALTER TABLE `eq230508`.`bigpartrefund`
-    ADD COLUMN `sterilisation` tinyint(1) NOT NULL DEFAULT 0 COMMENT '冲销状态' AFTER `purchaseId`;
-
-ALTER TABLE `eq230508`.`partrefund`
-    ADD COLUMN `hasTicket` varchar(50) NULL AFTER `dflag`;
+ALTER TABLE `eq230508`.`bigpartpurchase`
+    ADD COLUMN `financeId` int NULL COMMENT '财务审核id' AFTER `funder_id`,
+ADD COLUMN `financedate` datetime NULL COMMENT '财务审核时间' AFTER `financeId`