|
@@ -1090,39 +1090,39 @@ func (this *OilGoodsAptitudeController) UpdateCodeEntity() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //var originModel goodsaptitude.OilGoodsAptitude
|
|
|
|
|
- //svc.GetEntityByWhere(OilGoodsAptitudeName, "ClassId = "+id, &originModel)
|
|
|
|
|
|
|
+ var originModel goodsaptitude.OilGoodsAptitude
|
|
|
|
|
+ svc.GetEntityByWhere(OilGoodsAptitudeName, "ClassId = "+id, &originModel)
|
|
|
|
|
|
|
|
var model1 goodsaptitude.OilGoodsAptitude
|
|
var model1 goodsaptitude.OilGoodsAptitude
|
|
|
colsGoods := []string{"GoodsLevel"}
|
|
colsGoods := []string{"GoodsLevel"}
|
|
|
model1.GoodsLevel = goodsLevel.GoodsLevel
|
|
model1.GoodsLevel = goodsLevel.GoodsLevel
|
|
|
svc.UpdateEntityBywheretbl(OilGoodsAptitudeName, &model1, colsGoods, "ClassId = "+id)
|
|
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 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 {
|
|
if err == nil {
|
|
|
errinfo.Message = "修改成功!"
|
|
errinfo.Message = "修改成功!"
|