Browse Source

金蝶更新

pull/196/head
yehongyang 3 years ago
parent
commit
e3707ca1ea
1 changed files with 41 additions and 29 deletions
  1. +41
    -29
      services/ap/implments/Balance.service.impl.go

+ 41
- 29
services/ap/implments/Balance.service.impl.go View File

@ -615,7 +615,7 @@ func (impl *BalanceServiceImplement) SaveCustomerArticleDemand(user *global.User
var (
//mainselectArticleDemandList []model.ArticleDemand
resouceId string
resouceId string
)
//data_ArticleResource := make([]model.ArticleResource, 0, 10)
@ -649,14 +649,13 @@ func (impl *BalanceServiceImplement) SaveCustomerArticleDemand(user *global.User
//保存
for _, mapInfo := range mapList {
data_ArticleDemand_new, _, err := impl.RefreshCustomerArticleDemand(user, mapInfo["AP_ArticleDemand-ArtId"], mapList)
if err != nil {
return nil, err
}
err = dao_ArticleDemand.Update(&data_ArticleDemand_new)
data_ArticleDemand_new, _, err := impl.RefreshCustomerArticleDemand(user, mapInfo["AP_ArticleDemand-ArtId"], mapList)
if err != nil {
return nil, err
}
err = dao_ArticleDemand.Update(&data_ArticleDemand_new)
}
//data_ArticleResource, err = dao_ArticleResource.Select([]grmi.Predicate{meta.ArticleResource_PlantNr.NewPredicate(grmi.Equal, user.PlantNr), meta.ArticleResource_ResourceId.NewPredicate(grmi.Equal, resouceId)}, nil)
//if err != nil {
// return nil, grmi.NewDataBaseError(err)
@ -2822,7 +2821,7 @@ func (impl *BalanceServiceImplement) PublishMpsPlan(user *global.User, version s
Key: utils.ValueToString(prePlanOrderVersion.PlanOrderId, ""),
Info: *prePlanOrderVersion,
})
} else {
} else {
log, _ := logger.NewLogger(user.UserId, "Balance")
log.Error("前一半发布计划已取消, 前一半计划ID:" + prePlanOrderVersion.PlanOrderId)
}
@ -2895,13 +2894,13 @@ func (impl *BalanceServiceImplement) PublishMpsPlan(user *global.User, version s
}
planOrder := model.PlanOrder{
PlanOrderId: planOrderId,
Pos: pos,
PlantNr: user.PlantNr,
ArtId: info.ArtId,
VersionNr: data_PlanOrderVersion.VersionNr,
DemandKey: info.DemandKey,
ProjectId: info.ProjectId,
CustomerId: info.CustomerId,
Pos: pos,
PlantNr: user.PlantNr,
ArtId: info.ArtId,
VersionNr: data_PlanOrderVersion.VersionNr,
DemandKey: info.DemandKey,
ProjectId: info.ProjectId,
CustomerId: info.CustomerId,
//Descr
PlanDate: date,
PlanYear: info.DemandYear,
@ -3249,6 +3248,7 @@ func (impl *BalanceServiceImplement) RefreshBalanceData(user *global.User) error
MinCoverPeriodType: "W",
ResourceId: resourceId,
}
firstDemandList = append(firstDemandList, firstArticleDemand)
}
}
@ -3257,21 +3257,33 @@ func (impl *BalanceServiceImplement) RefreshBalanceData(user *global.User) error
//聚合
keyArtIdMap := make(map[string]map[string]model.ArticleDemand)
for index, _ := range firstDemandList {
_, isIn := keyArtIdMap[firstDemandList[index].ArtId]
if !isIn {
keyArtIdMap[firstDemandList[index].ArtId] = make(map[string]model.ArticleDemand)
keyArtIdMap[firstDemandList[index].ArtId][firstDemandList[index].DemandKey] = firstDemandList[index]
} else {
_, isIn := keyArtIdMap[firstDemandList[index].ArtId][firstDemandList[index].DemandKey]
if !isIn {
keyArtIdMap[firstDemandList[index].ArtId][firstDemandList[index].DemandKey] = firstDemandList[index]
for index, v := range firstDemandList {
if info, ok := keyArtIdMap[v.ArtId]; ok {
if _info, _ok := info[v.DemandKey]; _ok {
_info.ForecastDemandQty += v.ForecastDemandQty
keyArtIdMap[firstDemandList[index].ArtId][firstDemandList[index].DemandKey] = _info
} else {
value := keyArtIdMap[firstDemandList[index].ArtId][firstDemandList[index].DemandKey]
value.ForecastDemandQty += firstDemandList[index].ForecastDemandQty
keyArtIdMap[firstDemandList[index].ArtId][firstDemandList[index].DemandKey] = value
keyArtIdMap[v.ArtId][v.DemandKey] = v
}
}
} else {
keyArtIdMap[v.ArtId] = make(map[string]model.ArticleDemand)
keyArtIdMap[v.ArtId][v.DemandKey] = v
}
//_, isIn := keyArtIdMap[firstDemandList[index].ArtId]
//if !isIn {
// keyArtIdMap[firstDemandList[index].ArtId] = make(map[string]model.ArticleDemand)
// keyArtIdMap[firstDemandList[index].ArtId][firstDemandList[index].DemandKey] = firstDemandList[index]
//} else {
// _, isIn := keyArtIdMap[firstDemandList[index].ArtId][firstDemandList[index].DemandKey]
// if !isIn {
// keyArtIdMap[firstDemandList[index].ArtId][firstDemandList[index].DemandKey] = firstDemandList[index]
// } else {
// value := keyArtIdMap[firstDemandList[index].ArtId][firstDemandList[index].DemandKey]
// value.ForecastDemandQty += firstDemandList[index].ForecastDemandQty
// keyArtIdMap[firstDemandList[index].ArtId][firstDemandList[index].DemandKey] = value
// }
//}
}
for _, value1 := range keyArtIdMap {
@ -3557,4 +3569,4 @@ func (impl *BalanceServiceImplement) MpsPlanExport(user *global.User, CustArtSto
return "", grmi.NewBusinessError("导出失败,请重试")
}
return pathLi[1], nil
}
}

Loading…
Cancel
Save