Yikoo 5 lat temu
rodzic
commit
a78c8ab95d

+ 6 - 3
src/dashoo.cn/backend/api/business/oilcontract/contract/contract.go

@@ -15,7 +15,7 @@ type OilContract struct {
 	ProjectType          string    `json:"ProjectType" xorm:"comment('项目类别') VARCHAR(50) 'ProjectType'"`
 	ContractClass        string    `json:"ContractClass" xorm:"comment('合同类别') VARCHAR(50) 'ContractClass'"`
 	ContractMode         string    `json:"ContractMode" xorm:"comment('合同模式') VARCHAR(50) 'ContractMode'"`
-	Amount               string    `json:"Amount" xorm:"comment('合同总金额(万元)') DECIMAL(11,2) 'Amount'"`
+	Amount               string    `json:"Amount" xorm:"comment('合同总金额(万元)') VARCHAR(255) 'Amount'"`
 	ContractPeriod       string    `json:"ContractPeriod" xorm:"comment('合同总工期(天)') VARCHAR(50) 'ContractPeriod'"`
 	OpenDate             time.Time `json:"OpenDate" xorm:"comment('开工日期') DATETIME 'OpenDate'"`
 	PlanFinishDate       time.Time `json:"PlanFinishDate" xorm:"comment('计划竣工时间') DATETIME 'PlanFinishDate'"`
@@ -53,8 +53,8 @@ type OilContract struct {
 	ChooseWay            string    `json:"ChooseWay" xorm:"comment('选商方式') VARCHAR(500) 'ChooseWay'"`
 	ContractMark         string    `json:"ContractMark" xorm:"comment('合同标的') VARCHAR(500) 'ContractMark'"`
 	Currency             string    `json:"Currency" xorm:"comment('币种') VARCHAR(500) 'Currency'"`
-	BudgetAmount         string    `json:"BudgetAmount" xorm:"comment('预算金额') DECIMAL(11,2) 'BudgetAmount'"`
-	PerformAmount        string    `json:"PerformAmount" xorm:"comment('履行金额') DECIMAL(11,2) 'PerformAmount'"`
+	BudgetAmount         string    `json:"BudgetAmount" xorm:"comment('预算金额') VARCHAR(255) 'BudgetAmount'"`
+	PerformAmount        string    `json:"PerformAmount" xorm:"comment('履行金额') VARCHAR(255) 'PerformAmount'"`
 	IsInternal           int       `json:"IsInternal" xorm:"default 0 comment('是否内部合同') INT(11) 'IsInternal'"`
 	IsForeign            int       `json:"IsForeign" xorm:"default 0 comment('是否涉外合同') INT(11) 'IsForeign'"`
 	IsDeal               int       `json:"IsDeal" xorm:"default 0 comment('是否关联交易') INT(11) 'IsDeal'"`
@@ -68,4 +68,7 @@ type OilContract struct {
 	SubmitDate           time.Time `json:"SubmitDate" xorm:"comment('提交日期') DATETIME 'SubmitDate'"`
 	SealName             string    `json:"SealName" xorm:"comment('用章名称') VARCHAR(500) 'SealName'"`
 	PoNumber             string    `json:"PoNumber" xorm:"comment('po编码') VARCHAR(500) 'PoNumber'"`
+}
+type OilContractItems struct {
+	Items		   []OilContract
 }

+ 4 - 1
src/dashoo.cn/backend/api/business/oilcontract/contractSumScore/contractSumScore.go

@@ -11,7 +11,6 @@ type OilContractSumScore struct {
 	ContractClass    string    `json:"ContractClass" xorm:"comment('合同类别') VARCHAR(255) 'ContractClass'"`
 	Year             string    `json:"Year" xorm:"VARCHAR(255) 'Year'"`
 	ConclusionReason string    `json:"ConclusionReason" xorm:"comment('不合格原因') VARCHAR(255) 'ConclusionReason'"`
-	Conclusion       int       `json:"Conclusion" xorm:"default 0 comment('0不合格,1观察使用,2合格,3优秀') INT(11) 'Conclusion'"`
 	WorkflowId     	 string    `json:"WorkflowId" xorm:"default '0' comment('工作流的ID') VARCHAR(50) 'WorkflowId'"`
 	Businesskey      string    `json:"BusinessKey" xorm:"VARCHAR(255) 'BusinessKey'"`
 	Processkey     	 string    `json:"ProcessKey" xorm:"comment('工作流名称') VARCHAR(255) 'ProcessKey'"`
@@ -99,6 +98,10 @@ type OilContractSumScoreVo struct {
 	B6       int       `json:"B6" xorm:"default 0 comment('B6') INT(11) 'B6'"`
 	B7       int       `json:"B7" xorm:"default 0 comment('B7') INT(11) 'B7'"`
 	B8       int       `json:"B8" xorm:"default 0 comment('B8') INT(11) 'B8'"`
+
+	Result1     	 string    `json:"Result1" xorm:"comment('业绩评价结果') VARCHAR(255) 'Result1'"`
+	Result2     	 string    `json:"Result2" xorm:"comment('基本条件评价结果') VARCHAR(255) 'Result2'"`
+
 }
 type OilContractComputeSumScoreVo struct {
 	SupplierId    int       `json:"SupplierId"`

+ 10 - 10
src/dashoo.cn/backend/api/business/oilcontract/contractSumScore/contractSumScoreService.go

@@ -64,7 +64,7 @@ func (s *OilContractSumScoreService) GetPagingComputeEntitiesWithOrderBytbl(page
 	sqlCount += ` ) t `
 
 	var sql string
-	sql =  `select YEAR(NOW()) as Year,contract.ContractClass,contract.SupplierId,contract.SupplierName,count(review.id) as count,ROUND(sum(items.Score)/count(review.id),2) as Score, `
+	sql =  `select YEAR(NOW()) as Year,contract.ContractClass,contract.SupplierId,contract.SupplierName,count(review.id) as count,ROUND(sum(items.Score)/count(review.id)/2,2) as Score, `
 
 	sql += ` sum(case when items.SequenceNo in  ('1') AND items.Type = 2 AND items.Value > 0 then 1 else 0 end )  B1, `
 	sql += ` sum(case when items.SequenceNo in  ('2') AND items.Type = 2 AND items.Value > 0 then 1 else 0 end )  B2, `
@@ -75,15 +75,15 @@ func (s *OilContractSumScoreService) GetPagingComputeEntitiesWithOrderBytbl(page
 	sql += ` sum(case when items.SequenceNo in  ('7') AND items.Type = 2 AND items.Value > 0 then 1 else 0 end )  B7, `
 	sql += ` sum(case when items.SequenceNo in  ('8') AND items.Type = 2 AND items.Value > 0 then 1 else 0 end )  B8, `
 
-	sql += ` ROUND(sum(case when items.SequenceNo in  ('1') AND items.Type =1 then items.Score else 0 end)/count(review.id),2) Score1,  `
-	sql += ` ROUND(sum(case when items.SequenceNo in  ('2') AND items.Type =1 then items.Score else 0 end)/count(review.id),2) Score2,  `
-	sql += ` ROUND(sum(case when items.SequenceNo in  ('3') AND items.Type =1 then items.Score else 0 end)/count(review.id),2) Score3,  `
-	sql += ` ROUND(sum(case when items.SequenceNo in  ('4') AND items.Type =1 then items.Score else 0 end)/count(review.id),2) Score4,  `
-	sql += ` ROUND(sum(case when items.SequenceNo in  ('5') AND items.Type =1 then items.Score else 0 end)/count(review.id),2) Score5,  `
-	sql += ` ROUND(sum(case when items.SequenceNo in  ('6') AND items.Type =1 then items.Score else 0 end)/count(review.id),2) Score6,  `
-	sql += ` ROUND(sum(case when items.SequenceNo in  ('7') AND items.Type =1 then items.Score else 0 end)/count(review.id),2) Score7,  `
-	sql += ` ROUND(sum(case when items.SequenceNo in  ('8') AND items.Type =1 then items.Score else 0 end)/count(review.id),2) Score8,  `
-	sql += ` ROUND(sum(case when items.SequenceNo in  ('9') AND items.Type =1 then items.Score else 0 end)/count(review.id),2) Score9,  `
+	sql += ` ROUND(sum(case when items.SequenceNo in  ('1') AND items.Type =1 then items.Score else 0 end)/count(review.id)/2,2) Score1,  `
+	sql += ` ROUND(sum(case when items.SequenceNo in  ('2') AND items.Type =1 then items.Score else 0 end)/count(review.id)/2,2) Score2,  `
+	sql += ` ROUND(sum(case when items.SequenceNo in  ('3') AND items.Type =1 then items.Score else 0 end)/count(review.id)/2,2) Score3,  `
+	sql += ` ROUND(sum(case when items.SequenceNo in  ('4') AND items.Type =1 then items.Score else 0 end)/count(review.id)/2,2) Score4,  `
+	sql += ` ROUND(sum(case when items.SequenceNo in  ('5') AND items.Type =1 then items.Score else 0 end)/count(review.id)/2,2) Score5,  `
+	sql += ` ROUND(sum(case when items.SequenceNo in  ('6') AND items.Type =1 then items.Score else 0 end)/count(review.id)/2,2) Score6,  `
+	sql += ` ROUND(sum(case when items.SequenceNo in  ('7') AND items.Type =1 then items.Score else 0 end)/count(review.id)/2,2) Score7,  `
+	sql += ` ROUND(sum(case when items.SequenceNo in  ('8') AND items.Type =1 then items.Score else 0 end)/count(review.id)/2,2) Score8,  `
+	sql += ` ROUND(sum(case when items.SequenceNo in  ('9') AND items.Type =1 then items.Score else 0 end)/count(review.id)/2,2) Score9,  `
 	sql += ` case when sum(items.Score)/count(review.id) <60 then 3 when sum(items.Score)/count(review.id) <80 then 2 else 1 end as Evaluate `
 	sql += ` from ` + controllers.OilContractReviewName + ` review `
 	sql += ` left join ` + controllers.OilContractName + ` contract on review.ContractId=contract.id `

+ 3 - 0
src/dashoo.cn/backend/api/business/oilcontract/contractSumScoreItems/contractSumScoreItems.go

@@ -49,4 +49,7 @@ type OilContractSumScoreItems struct{
 	B7       int       `json:"B7" xorm:"default 0 comment('B7') INT(11) 'B7'"`
 	B8       int       `json:"B8" xorm:"default 0 comment('B8') INT(11) 'B8'"`
 
+	Result1    	 string    `json:"Result1" xorm:"default '0' comment('业绩评价结果') VARCHAR(50) 'Result1'"`
+	Result2    	 string    `json:"Result2" xorm:"default '0' comment('基本条件评价结果') VARCHAR(50) 'Result2'"`
+
 }

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

@@ -519,11 +519,13 @@ func (this *OilContractController) ImportExcel() {
 		tmp["ContractNo"]    = sheet.Rows[i].Cells[0].String()
 		tmp["ContractName"]  = sheet.Rows[i].Cells[1].String()
 		tmp["Amount"]        = sheet.Rows[i].Cells[2].String()
-		tmp["ContractClass"]    = sheet.Rows[i].Cells[3].String()
+		tmp["SourceContractClass"]    = sheet.Rows[i].Cells[3].String()
+
 		tmp["ContractSonClass"] = sheet.Rows[i].Cells[4].String()
 		tmp["SmallClass"]    = sheet.Rows[i].Cells[5].String()
 		tmp["SignedDate"]    = convertToFormatDay(sheet.Rows[i].Cells[6].Value)
-		tmp["SupplierName"]  = sheet.Rows[i].Cells[7].String()
+		tmp["SourceSupplierName"]  = sheet.Rows[i].Cells[7].String()
+
 		tmp["People"]        = sheet.Rows[i].Cells[8].String()
 		tmp["Number"]        = sheet.Rows[i].Cells[9].String()
 		tmp["ChooseWay"]     = sheet.Rows[i].Cells[10].String()
@@ -570,6 +572,110 @@ func (this *OilContractController) ImportExcel() {
 		this.ServeJSON()
 	}
 }
+// @Title get 导入批量保存
+// @Description 数据存入
+// @Success 200 {object} controllers.Request
+// @router /importbatchsave [post]
+func (this *OilContractController) ImportBatchSave(){
+	var model contract.OilContractItems
+	var jsonBlob = this.Ctx.Input.RequestBody
+	json.Unmarshal(jsonBlob, &model)
+	var errinfo ErrorInfo
+	svc := contract.GetOilContractService(utils.DBE)
+	// 新增配置项
+	for i,v := range model.Items{
+		fmt.Print(i)
+		if v.SupplierName == "" || v.SupplierId == 0 {
+			errinfo.Message = "操作失败!未选择供应商名称,行号:" + strconv.Itoa (i + 1)
+			errinfo.Code = -2
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+			return
+		}
+		if v.ContractClass == "" {
+			errinfo.Message = "操作失败!未选择合同分类,行号:" + strconv.Itoa (i + 1)
+			errinfo.Code = -2
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+			return
+		}
+		if v.ContractNo == "" {
+			errinfo.Message = "操作失败!合同编号不能为空,行号:" + strconv.Itoa (i + 1)
+			errinfo.Code = -2
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+			return
+		}
+		if v.ContractName == "" {
+			errinfo.Message = "操作失败!合同名称不能为空,行号:" + strconv.Itoa (i + 1)
+			errinfo.Code = -2
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+			return
+		}
+
+		var noCount   = 0
+		var nameCount = 0
+		for ii,vv := range model.Items{
+			fmt.Print(ii)
+			if vv.ContractNo == v.ContractNo {
+				noCount ++
+			}
+			if vv.ContractName == v.ContractName {
+				nameCount ++
+			}
+		}
+		if noCount >= 2{
+			errinfo.Message = "操作失败!合同编号已存在,行号:" + strconv.Itoa (i + 1)
+			errinfo.Code = -2
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+			return
+		}
+		if nameCount >= 2{
+			errinfo.Message = "操作失败!合同名称已存在,行号:" + strconv.Itoa (i + 1)
+			errinfo.Code = -2
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+			return
+		}
+
+		var contract contract.OilContract
+		tempCount,_:= svc.GetCount(&contract,"ContractNo='" + v.ContractNo + "'")
+		if tempCount > 0 {
+			errinfo.Message = "操作失败!合同编号已存在,行号:" + strconv.Itoa (i + 1)
+			errinfo.Code = -2
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+			return
+		}
+
+		tempCount2,_:= svc.GetCount(&contract,"ContractName='" + v.ContractName + "'")
+		if tempCount2 > 0 {
+			errinfo.Message = "操作失败!合同名称已存在,行号:" + strconv.Itoa (i + 1)
+			errinfo.Code = -2
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+			return
+		}
+
+	}
+	_ , err := svc.DBE.Insert(model.Items)
+	if err == nil {
+		errinfo.Message = "导入成功!"
+		errinfo.Code = 0
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	} else {
+		errinfo.Message = "导入失败!" + utils.AlertProcess(err.Error())
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	}
+}
+
+
+
 // excel日期字段格式化 yyyy-mm-dd
 func convertToFormatDay(excelDaysString string)string{
 	// 2006-01-02 距离 1900-01-01的天数

+ 58 - 0
src/dashoo.cn/backend/api/controllers/oilcontract/contractSumScore.go

@@ -175,6 +175,9 @@ func (this *OilContractSumScoreController) GetComputeEntityList(){
 	//	}
 	//}
 
+	// 审核通过的参与核算
+	where = where + " and review.Status='8' "
+
 	svc := contractSumScore.GetOilContractSumScoreService(utils.DBE)
 	var list []contractSumScore.OilContractComputeSumScoreVo
 	total := svc.GetPagingComputeEntitiesWithOrderBytbl(page.CurrentPage, page.Size, orderby, asc, &list, where)
@@ -244,16 +247,28 @@ func (this *OilContractSumScoreController) GetEntity() {
 	result.Content3     = item.Content3
 	result.Content4     = item.Content4
 	result.Content5     = item.Content5
+	result.Content6     = item.Content6
+	result.Content7     = item.Content7
+	result.Content8     = item.Content8
+
 	result.SumScore1    = item.SumScore1
 	result.SumScore2    = item.SumScore2
 	result.SumScore3    = item.SumScore3
 	result.SumScore4    = item.SumScore4
 	result.SumScore5    = item.SumScore5
+	result.SumScore6    = item.SumScore6
+	result.SumScore7    = item.SumScore7
+	result.SumScore8    = item.SumScore8
+
 	result.NormalSumScore1 = item.NormalSumScore1
 	result.NormalSumScore2 = item.NormalSumScore2
 	result.NormalSumScore3 = item.NormalSumScore3
 	result.NormalSumScore4 = item.NormalSumScore4
 	result.NormalSumScore5 = item.NormalSumScore5
+	result.NormalSumScore6 = item.NormalSumScore6
+	result.NormalSumScore7 = item.NormalSumScore7
+	result.NormalSumScore8 = item.NormalSumScore8
+
 	result.Note = item.Note
 	result.Conclusion = item.Conclusion
 
@@ -265,6 +280,9 @@ func (this *OilContractSumScoreController) GetEntity() {
 	result.B6 = item.B6
 	result.B7 = item.B7
 	result.B8 = item.B8
+
+	result.Result1 = item.Result1
+	result.Result2 = item.Result2
 	this.Data["json"] = &result
 	this.ServeJSON()
 }
@@ -336,6 +354,9 @@ func (this *OilContractSumScoreController) AddEntity() {
 	item.B7 = model.B7
 	item.B8 = model.B8
 
+	item.Result1 = model.Result1
+	item.Result2 = model.Result2
+
 	var item2 contractSumScoreItems.OilContractSumScoreItems
 	item2.SumScoreId = entity.Id
 	item2.Category   = 1                      // 二级单位创建
@@ -378,6 +399,9 @@ func (this *OilContractSumScoreController) AddEntity() {
 	item2.B7 = model.B7
 	item2.B8 = model.B8
 
+	item2.Result1 = model.Result1
+	item2.Result2 = model.Result2
+
 	itemSvc := contractSumScoreItems.GetOilContractSumScoreItemsService(utils.DBE)
 	_, err2 := itemSvc.InsertEntityBytbl(OilContractSumScoreItemsName, &item)
 	_, err3 := itemSvc.InsertEntityBytbl(OilContractSumScoreItemsName, &item2)
@@ -456,6 +480,16 @@ func (this *OilContractSumScoreController) UpdateEntity() {
 	item.Content5   = model.Content5
 	item.NormalSumScore5 = model.NormalSumScore5
 	item.SumScore5  = model.SumScore5
+	item.Content6   = model.Content6
+	item.NormalSumScore6 = model.NormalSumScore6
+	item.SumScore6  = model.SumScore6
+	item.Content7   = model.Content7
+	item.NormalSumScore7 = model.NormalSumScore7
+	item.SumScore7  = model.SumScore7
+	item.Content8   = model.Content8
+	item.NormalSumScore8 = model.NormalSumScore8
+	item.SumScore8  = model.SumScore8
+	item.Conclusion = model.Conclusion
 	item.Note       = model.Note
 	item.ModifiedOn   = time.Now()
 	item.ModifiedBy   = this.User.Realname
@@ -469,6 +503,9 @@ func (this *OilContractSumScoreController) UpdateEntity() {
 	item.B7 = model.B7
 	item.B8 = model.B8
 
+	item.Result1 = model.Result1
+	item.Result2 = model.Result2
+
 	cols2 := []string{
 		"Category",
 		"SumScore",
@@ -496,6 +533,7 @@ func (this *OilContractSumScoreController) UpdateEntity() {
 		"SumScore6",
 		"SumScore7",
 		"SumScore8",
+		"Conclusion",
 		"Note",
 		"ModifiedOn",
 		"ModifiedBy",
@@ -508,6 +546,8 @@ func (this *OilContractSumScoreController) UpdateEntity() {
 		"B6",
 		"B7",
 		"B8",
+		"Result1",
+		"Result2",
 	}
 	err2 := itemSvc.UpdateEntityBytbl(OilContractSumScoreItemsName,item.Id,&item,cols2)
 
@@ -533,6 +573,16 @@ func (this *OilContractSumScoreController) UpdateEntity() {
 	item3.Content5   = model.Content5
 	item3.NormalSumScore5 = model.NormalSumScore5
 	item3.SumScore5  = model.SumScore5
+	item3.Content6   = model.Content6
+	item3.NormalSumScore6 = model.NormalSumScore6
+	item3.SumScore6  = model.SumScore6
+	item3.Content7   = model.Content7
+	item3.NormalSumScore7 = model.NormalSumScore7
+	item3.SumScore7  = model.SumScore7
+	item3.Content8   = model.Content8
+	item3.NormalSumScore8 = model.NormalSumScore8
+	item3.SumScore8  = model.SumScore8
+	item3.Conclusion = model.Conclusion
 	item3.Note       = model.Note
 	item3.ModifiedOn   = time.Now()
 	item3.ModifiedBy   = this.User.Realname
@@ -545,6 +595,8 @@ func (this *OilContractSumScoreController) UpdateEntity() {
 	item3.B6 = model.B6
 	item3.B7 = model.B7
 	item3.B8 = model.B8
+	item3.Result1 = model.Result1
+	item3.Result2 = model.Result2
 
 	cols3 := []string{
 		"Category",
@@ -573,6 +625,7 @@ func (this *OilContractSumScoreController) UpdateEntity() {
 		"SumScore6",
 		"SumScore7",
 		"SumScore8",
+		"Conclusion",
 		"Note",
 		"ModifiedOn",
 		"ModifiedBy",
@@ -585,6 +638,8 @@ func (this *OilContractSumScoreController) UpdateEntity() {
 		"B6",
 		"B7",
 		"B8",
+		"Result1",
+		"Result2",
 	}
 	err3 := itemSvc.UpdateEntityBytbl(OilContractSumScoreItemsName,item3.Id,&item3,cols3)
 
@@ -670,6 +725,9 @@ func (this *OilContractSumScoreController) SaveScoreItemsBySec(){
 	item.B7 = model.B7
 	item.B8 = model.B8
 
+	item.Result1 = model.Result1
+	item.Result2 = model.Result2
+
 	_,err := itemSvc.InsertEntityBytbl(OilContractSumScoreItemsName, &item)
 
 	if err == nil {

+ 5 - 1
src/dashoo.cn/backend/api/controllers/oilsupplier/annualaudit.go

@@ -231,7 +231,11 @@ func (this *AnnualAuditController) GetSupplierList() {
 	//		where = where + " and a.CreateUserId = '" + this.User.Id + "'"
 	//	}
 	//}
-	where = where + " and b.SupplierTypeCode='" + code + "' and b.Status='" + suppliercert.STORE_STATUS + "'"
+
+	if code != ""{
+		where = where + " and b.SupplierTypeCode='" + code + "' "
+	}
+	where = where + " and b.Status='" + suppliercert.STORE_STATUS + "' "
 	supplierlist = svc.GetSupplierList(""+OilSupplierName, where)
 	var datainfo DataInfo
 	datainfo.Items = supplierlist