|
@ -1534,7 +1534,7 @@ func (impl *CustDemandVerHeadServiceImplement) BulkImportFile(user *global.User, |
|
|
//记录版本信息
|
|
|
//记录版本信息
|
|
|
var headVersionId string |
|
|
var headVersionId string |
|
|
//物料 查询
|
|
|
//物料 查询
|
|
|
articleMap := make(map[string]int) |
|
|
|
|
|
|
|
|
articleMap := make(map[string]*baseModel.Article) |
|
|
articleDao := basedal.NewArticleDAO(session, user.PlantNr, user.UserId) |
|
|
articleDao := basedal.NewArticleDAO(session, user.PlantNr, user.UserId) |
|
|
bomDao := meDal.NewBomHeadDAO(session, user.PlantNr, user.UserId) |
|
|
bomDao := meDal.NewBomHeadDAO(session, user.PlantNr, user.UserId) |
|
|
for k, row := range rows { |
|
|
for k, row := range rows { |
|
@ -1551,7 +1551,10 @@ func (impl *CustDemandVerHeadServiceImplement) BulkImportFile(user *global.User, |
|
|
//判断物料bom是否需要维护
|
|
|
//判断物料bom是否需要维护
|
|
|
if _, ok := articleMap[ArtId]; !ok { |
|
|
if _, ok := articleMap[ArtId]; !ok { |
|
|
//查询物料
|
|
|
//查询物料
|
|
|
_article, _ := articleDao.SelectOne(ArtId) |
|
|
|
|
|
|
|
|
_article, err := articleDao.SelectOne(ArtId) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return err |
|
|
|
|
|
} |
|
|
if _article == nil { |
|
|
if _article == nil { |
|
|
errInfo := new(model.ErrorDatalst) |
|
|
errInfo := new(model.ErrorDatalst) |
|
|
errInfo.ErrorInfo = "物料不存在 物料编号:" + ArtId |
|
|
errInfo.ErrorInfo = "物料不存在 物料编号:" + ArtId |
|
@ -1559,11 +1562,14 @@ func (impl *CustDemandVerHeadServiceImplement) BulkImportFile(user *global.User, |
|
|
errInfo.ErrorStatus = "error" |
|
|
errInfo.ErrorStatus = "error" |
|
|
errInfo.TargetSource = savePath |
|
|
errInfo.TargetSource = savePath |
|
|
_ = errDao.InsertOne(errInfo) |
|
|
_ = errDao.InsertOne(errInfo) |
|
|
articleMap[ArtId] = 1 |
|
|
|
|
|
|
|
|
continue |
|
|
} else { |
|
|
} else { |
|
|
if _article.ArtSize1 != "1" { |
|
|
if _article.ArtSize1 != "1" { |
|
|
//查询bom
|
|
|
//查询bom
|
|
|
_bom, _ := bomDao.SelectOne(ArtId) |
|
|
|
|
|
|
|
|
_bom, err := bomDao.SelectOne(ArtId) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return err |
|
|
|
|
|
} |
|
|
if _bom == nil { |
|
|
if _bom == nil { |
|
|
errInfo := new(model.ErrorDatalst) |
|
|
errInfo := new(model.ErrorDatalst) |
|
|
errInfo.ErrorInfo = "bom未配置 物料编号:" + ArtId |
|
|
errInfo.ErrorInfo = "bom未配置 物料编号:" + ArtId |
|
@ -1571,12 +1577,10 @@ func (impl *CustDemandVerHeadServiceImplement) BulkImportFile(user *global.User, |
|
|
errInfo.ErrorStatus = "error" |
|
|
errInfo.ErrorStatus = "error" |
|
|
errInfo.TargetSource = savePath |
|
|
errInfo.TargetSource = savePath |
|
|
_ = errDao.InsertOne(errInfo) |
|
|
_ = errDao.InsertOne(errInfo) |
|
|
articleMap[ArtId] = 1 |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
articleMap[ArtId] = 2 |
|
|
|
|
|
|
|
|
articleMap[ArtId] = _article |
|
|
} |
|
|
} |
|
|
//判断客户是否存在
|
|
|
//判断客户是否存在
|
|
|
customerId := utils.ValueToString(row[2], "") |
|
|
customerId := utils.ValueToString(row[2], "") |
|
@ -1677,10 +1681,25 @@ func (impl *CustDemandVerHeadServiceImplement) BulkImportFile(user *global.User, |
|
|
errInfo := new(model.ErrorDatalst) |
|
|
errInfo := new(model.ErrorDatalst) |
|
|
errInfo.ErrorInfo = fmt.Sprintf("客户%s物料号%s没有维护!", custInfo.CustomerId, ArtId) |
|
|
errInfo.ErrorInfo = fmt.Sprintf("客户%s物料号%s没有维护!", custInfo.CustomerId, ArtId) |
|
|
errInfo.ErrorType = "BulkImportFile" |
|
|
errInfo.ErrorType = "BulkImportFile" |
|
|
errInfo.ErrorStatus = "error" |
|
|
|
|
|
|
|
|
errInfo.ErrorStatus = "ok" |
|
|
errInfo.TargetSource = savePath |
|
|
errInfo.TargetSource = savePath |
|
|
_ = errDao.InsertOne(errInfo) |
|
|
_ = errDao.InsertOne(errInfo) |
|
|
continue |
|
|
|
|
|
|
|
|
//插入客户物料维护关系
|
|
|
|
|
|
if val, ok := articleMap[ArtId]; ok { |
|
|
|
|
|
//插入客户物料维护关系
|
|
|
|
|
|
artCust := new(model.CustArtlst) |
|
|
|
|
|
artCust.PlantNr = user.PlantNr |
|
|
|
|
|
artCust.ArtId = ArtId |
|
|
|
|
|
artCust.CustomerId = customerId |
|
|
|
|
|
artCust.Descr1 = val.Descr1 |
|
|
|
|
|
artCust.Descr2 = val.Descr2 |
|
|
|
|
|
artCust.CustArtId = val.CustArtId |
|
|
|
|
|
err = artListDao.InsertOne(artCust) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return err |
|
|
|
|
|
} |
|
|
|
|
|
artInfo = artCust |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
//数据长度:保存多少周的数据
|
|
|
//数据长度:保存多少周的数据
|
|
|
lenData := mInfo.DemandWeeks |
|
|
lenData := mInfo.DemandWeeks |
|
|