|
|
@ -766,29 +766,29 @@ func (impl *ArtDemandLstServiceImplement) ChangeArtDemandLstStatus(user *models. |
|
|
|
artDemandLstList := make([]model.ArtDemandLst, len(records)) |
|
|
|
// 校验每个ArtDemandLst的状态 再修改status
|
|
|
|
for index, record := range records { |
|
|
|
artDemandLst, err := dao.SelectOne(record.ArtId, record.Pos) |
|
|
|
artDemandLst, err := dao.SelectOne(record.DemandId, record.Pos) |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
if artDemandLst == nil { |
|
|
|
return grmi.NewBusinessError(fmt.Sprintf("该条数据不存在, artId: %s, Pos: %d", record.ArtId, record.Pos)) |
|
|
|
return grmi.NewBusinessError(fmt.Sprintf("该条数据不存在, demandId: %s, Pos: %d", record.DemandId, record.Pos)) |
|
|
|
} |
|
|
|
switch operateType { |
|
|
|
case "receive": |
|
|
|
if artDemandLst.Status != model.WaitReceivingStatus { |
|
|
|
return grmi.NewBusinessError(fmt.Sprintf("计划明细状态与您的操作不相符, artId: %s, Pos: %d", record.ArtId, record.Pos)) |
|
|
|
return grmi.NewBusinessError(fmt.Sprintf("计划明细状态与您的操作不相符, demandId: %s, Pos: %d", record.DemandId, record.Pos)) |
|
|
|
} |
|
|
|
artDemandLst.Status = model.ReceivedStatus |
|
|
|
artDemandLst.DemandRecieveTime = grmi.DateTime(time.Now()) |
|
|
|
case "confirm": |
|
|
|
if artDemandLst.Status != model.ReceivedStatus { |
|
|
|
return grmi.NewBusinessError(fmt.Sprintf("计划明细状态与您的操作不相符, artId: %s, Pos: %d", record.ArtId, record.Pos)) |
|
|
|
return grmi.NewBusinessError(fmt.Sprintf("计划明细状态与您的操作不相符, demandId: %s, Pos: %d", record.DemandId, record.Pos)) |
|
|
|
} |
|
|
|
artDemandLst.Status = model.ConfirmedStatus |
|
|
|
artDemandLst.DemandConfirmTime = grmi.DateTime(time.Now()) |
|
|
|
case "accomplish": |
|
|
|
if artDemandLst.Status != model.ConfirmedStatus { |
|
|
|
return grmi.NewBusinessError(fmt.Sprintf("计划明细状态与您的操作不相符, artId: %s, Pos: %d", record.ArtId, record.Pos)) |
|
|
|
return grmi.NewBusinessError(fmt.Sprintf("计划明细状态与您的操作不相符, demandId: %s, Pos: %d", record.DemandId, record.Pos)) |
|
|
|
} |
|
|
|
artDemandLst.Status = model.AccomplishedStatus |
|
|
|
artDemandLst.DemandCloseTime = grmi.DateTime(time.Now()) |
|
|
|