Pārlūkot izejas kodu

后:二级单位名成

dubch 4 gadi atpakaļ
vecāks
revīzija
6fd1710c7e

+ 1 - 0
src/dashoo.cn/backend/api/business/oilcontract/contract/contract.go

@@ -76,6 +76,7 @@ type OilContract struct {
 	IsYear               int       `json:"IsYear" xorm:"comment('0未跨年,1跨年') int(2) 'IsYear'"`
 	ImportSecondUnit     string    `json:"ImportSecondUnit" xorm:"comment('导入二级单位') VARCHAR(255) 'ImportSecondUnit'"`
 	ClassName     	 	 string    `json:"ClassName" xorm:"comment('类别') VARCHAR(255) 'ClassName'"`
+	SecondUnitName     	 string    `json:"SecondUnitName" xorm:"comment('二级单位名') VARCHAR(255) 'SecondUnitName'"`
 }
 type OilContractMoney struct {
 	Id                   int       `json:"Id" xorm:"not null pk autoincr INT(11) 'Id'"`

+ 5 - 2
src/dashoo.cn/backend/api/controllers/oilcontract/contract.go

@@ -573,6 +573,7 @@ func (this *OilContractController) ImportExcel() {
 			svc.GetEntityByWhere("Base_Organize", "FullName = '"+sheet.Rows[i].Cells[7].String()+"'", &org)
 			if org.Id > 0 {
 				con.SecondUnit = org.Id
+				con.SecondUnitName = org.Fullname
 			}
 			con.Number = sheet.Rows[i].Cells[9].String()
 			con.ChooseWay = sheet.Rows[i].Cells[10].String()
@@ -719,12 +720,14 @@ func (this *OilContractController) ImportUpdate() {
 	}
 
 	if Column == "SecondUnit" {
+		var org organize.Base_Organize
+		svc.GetEntityByWhere("Base_Organize", "Id = " + Value, &org)
 		if Id != "" {
 			where += " and Id = " + Id + " and ImportStatus = 0 and ImportSecondUnit = '" + Class + "'"
-			sql = "update OilContract set SupplierName = '" + supp.SupplierName + "', " + Column + " = " + Value + " where " + where
+			sql = "update OilContract set SecondUnitName = '" + org.Fullname + "',SupplierName = '" + supp.SupplierName + "', " + Column + " = " + Value + " where " + where
 		} else {
 			where += " and ImportStatus = 0 and ImportSecondUnit = '" + Class + "' and " + Column + " = 0"
-			sql = "update OilContract set " + Column + " = " + Value + " where " + where
+			sql = "update OilContract set SecondUnitName = '" + org.Fullname + "'," + Column + " = " + Value + " where " + where
 		}
 		_, err = utils.DBE.Query(sql)
 	}