ソースを参照

后端: 资质配置级别变更更新资质表

baichengfei 4 年 前
コミット
1e713f81de

+ 29 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/goodsaptitude.go

@@ -1090,11 +1090,40 @@ func (this *OilGoodsAptitudeController) UpdateCodeEntity() {
 		}
 	}
 
+	//var originModel goodsaptitude.OilGoodsAptitude
+	//svc.GetEntityByWhere(OilGoodsAptitudeName, "ClassId = "+id, &originModel)
+
 	var model1 goodsaptitude.OilGoodsAptitude
 	colsGoods := []string{"GoodsLevel"}
 	model1.GoodsLevel = goodsLevel.GoodsLevel
 	svc.UpdateEntityBywheretbl(OilGoodsAptitudeName, &model1, colsGoods, "ClassId = "+id)
 
+	//if originModel.GoodsLevel != goodsLevel.GoodsLevel {
+	//	certSubSvc := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
+	//	var certSubModel suppliercertsub.OilSupplierCertSub
+	//	certSubModel.GoodsLevel = goodsLevel.GoodsLevel
+	//	if model1.GoodsLevel == "2" {
+	//		// 变为二级
+	//		certSubSvc.UpdateEntityBywheretbl("OilSupplierCertSub", &certSubModel, colsGoods, " SupplierTypeCode = '01' and SubClassId = " + id)
+	//	} else {
+	//		// 变为一级
+	//		var supplierCertSubList []suppliercertsub.OilSupplierCertSub
+	//		certSubSvc.GetEntitysByWhere("OilSupplierCertSub", " SupplierTypeCode = '01' and SubClassId = " + id, &supplierCertSubList)
+	//		supSvc := supplier.GetOilSupplierService(utils.DBE)
+	//		for _, sub := range supplierCertSubList {
+	//			var supplierEntity supplier.OilSupplier
+	//			supSvc.GetEntityById(sub.SupplierId, &supplierEntity)
+	//			if supplierEntity.Grade == "1" {
+	//				// 公司是一级, 将二级物资变为一级, 直接更新
+	//				certSubSvc.UpdateEntityByIdCols(sub.Id, &certSubModel, colsGoods)
+	//			} else {
+	//				// 公司是二级, 将二级物资变为一级--- 不允许, 直接删除
+	//				certSubSvc.DeleteEntityById(sub.Id, &sub)
+	//			}
+	//		}
+	//	}
+	//}
+
 	if err == nil {
 		errinfo.Message = "修改成功!"
 		errinfo.Code = 0