作者 yangfu

fix: 查询修改

... ... @@ -92,18 +92,20 @@ func (cmd *HistoryProductRecordQuery) Valid(validation *validation.Validation) {
cmd.ProductBeginTime = t
cmd.ProductEndTime = t.AddDate(0, 0, 1)
}
if cmd.Status == domain.ProductRecordNotApprove {
cmd.Status = domain.ProductRecordNotApprove
if xtime.IsZero(cmd.ProductBeginTime) || xtime.BeforeEqual(cmd.ProductBeginTime, xtime.BeginningOfDay()) {
cmd.ProductBeginTime = xtime.BeginningOfDay()
}
} else if cmd.Status == domain.ProductRecordLogged {
cmd.Status = domain.ProductRecordNotApprove
if len(cmd.Date) == 0 && xtime.IsZero(cmd.ProductEndTime) {
cmd.ProductEndTime = xtime.BeginningOfDay()
}
if len(cmd.Date) > 0 && !xtime.BeforeEqual(cmd.ProductEndTime, xtime.BeginningOfDay()) {
cmd.Status = domain.ProductRecordLogged
if cmd.ProductRecordType == domain.RecordTypeReceiveMaterial && cmd.ProductRecordType == domain.RecordTypeReturnMaterial {
if cmd.Status == domain.ProductRecordNotApprove {
cmd.Status = domain.ProductRecordNotApprove
if xtime.IsZero(cmd.ProductBeginTime) || xtime.BeforeEqual(cmd.ProductBeginTime, xtime.BeginningOfDay()) {
cmd.ProductBeginTime = xtime.BeginningOfDay()
}
} else if cmd.Status == domain.ProductRecordLogged {
cmd.Status = domain.ProductRecordNotApprove
if len(cmd.Date) == 0 && xtime.IsZero(cmd.ProductEndTime) {
cmd.ProductEndTime = xtime.BeginningOfDay()
}
if len(cmd.Date) > 0 && !xtime.BeforeEqual(cmd.ProductEndTime, xtime.BeginningOfDay()) {
cmd.Status = domain.ProductRecordLogged
}
}
}
}
... ...