diff --git a/dao/om/implments/SerialOrder.dao.impl.go b/dao/om/implments/SerialOrder.dao.impl.go index daea90b..9bbcccd 100644 --- a/dao/om/implments/SerialOrder.dao.impl.go +++ b/dao/om/implments/SerialOrder.dao.impl.go @@ -512,7 +512,7 @@ func (impl *SerialOrderDAOImplement) SelectOrderByResource(resourceId string, st if err != nil { return grmi.EmptyPagingResult, err } - orderBy := " order by " + meta.SerialOrder_PlantNr.ColumnName + ", " + meta.SerialOrder_SchedKey.ColumnName + orderBy := " order by " + meta.SerialOrder_PlantNr.ColumnName + ", " + meta.SerialOrder_SchedKey.ColumnName + ", " + meta.SerialOrder_OrderType.ColumnName + " desc" data := make([]model.VOmSerialorder, 0, 10) parameters = append(parameters, (pageNumber-1)*pageSize, pageSize) err = impl.session.Table(impl.meta.TableName).SQL(fmt.Sprintf(" select %s.*, %s.* from "+impl.meta.TableName+joinStr+" where "+where+orderBy+" offset ? row fetch next ? row only", diff --git a/services/me/implments/Product.service.impl.go b/services/me/implments/Product.service.impl.go index 889af40..8c50866 100644 --- a/services/me/implments/Product.service.impl.go +++ b/services/me/implments/Product.service.impl.go @@ -13,6 +13,7 @@ import ( meta "LAPP_ACURA_MOM_BACKEND/meta/me" baseModel "LAPP_ACURA_MOM_BACKEND/models/base" model "LAPP_ACURA_MOM_BACKEND/models/me" + "fmt" ) /****************************************************************************** @@ -708,6 +709,9 @@ func (impl *ProductServiceImplement) GenerateSnr(user *global.User, productId st if product == nil { return grmi.NewBusinessError("总成不存在") } + if product.MachineCode == "" { + return grmi.NewBusinessError(fmt.Sprintf("总成%s的机种代码为空", product.ProductId)) + } snrDao := baseDal.NewSnrDAO(session, user.PlantNr, user.UserId) snr, err := snrDao.SelectOne(conf.DbConfig.StandardSerialOrderSnr) if err != nil { @@ -717,9 +721,20 @@ func (impl *ProductServiceImplement) GenerateSnr(user *global.User, productId st return grmi.NewBusinessError("标准流水号不存在") } newSnr := snr - snrId := productId + "_" + projectId + "_SerialOrderSnr" - newSnr.SnrId = snrId + snrId := product.MachineCode + "_SerialOrderSnr" product.SerialOrderSnr = snrId + existSnr, err := snrDao.SelectOne(snrId) + if err != nil { + return grmi.NewBusinessError("查询流水号失败, 错误:" + err.Error()) + } + if existSnr != nil { + err = dao.UpdateOne(product) + if err != nil { + return grmi.NewBusinessError("更新总成数据失败, 错误:" + err.Error()) + } + return nil + } + newSnr.SnrId = snrId if err = session.Begin(); err != nil { return grmi.NewBusinessError("开启事务失败, 错误:" + err.Error()) } @@ -739,6 +754,4 @@ func (impl *ProductServiceImplement) GenerateSnr(user *global.User, productId st return grmi.NewBusinessError("保存流水号失败,错误:" + err.Error()) } return nil - - } \ No newline at end of file diff --git a/services/pln/implments/CustOrderLogic.service.impl.go b/services/pln/implments/CustOrderLogic.service.impl.go index c1da43c..318a8da 100644 --- a/services/pln/implments/CustOrderLogic.service.impl.go +++ b/services/pln/implments/CustOrderLogic.service.impl.go @@ -339,6 +339,7 @@ func (impl *CustOrderServiceImplement) AnalysisPlanFromExcel(user *global.User, custOrderWorkLineMap[workLineId] = custOrderLi } endDate = endDate.AddDate(0, 0, 2) + startDate = startDate.AddDate(0, 0, -2) for workLineId, custOrderLi := range custOrderWorkLineMap { sortCustOrderLi, err := impl.AutoScheduler(user, session, workLineId, startDate, endDate, custOrderLi) if err != nil { diff --git a/services/pln/implments/ToyotaCalloff.service.impl.go b/services/pln/implments/ToyotaCalloff.service.impl.go index 4f03e70..dd0fce4 100644 --- a/services/pln/implments/ToyotaCalloff.service.impl.go +++ b/services/pln/implments/ToyotaCalloff.service.impl.go @@ -356,6 +356,36 @@ func (impl *ToyotaCalloffServiceImplement) SelectAndPaging(user *global.User, ur } predicates = append(predicates, p) } + _, exist = urlParameters["seqStart"] + if exist { + seqStart, err := strconv.Atoi(urlParameters["seqStart"]) + if err != nil { + return grmi.EmptyPagingResult, err + } + p := grmi.Predicate{ + ColumnName: meta.ToyotaCalloff_CheckSequence.ColumnName, + PredicateType: func(predicate grmi.Predicate) (string, error) { + return fmt.Sprintf(" and %s >= ?", predicate.ColumnName), nil + }, + Values: []interface{}{seqStart}, + } + predicates = append(predicates, p) + } + _, exist = urlParameters["seqEnd"] + if exist { + seqEnd, err := strconv.Atoi(urlParameters["seqEnd"]) + if err != nil { + return grmi.EmptyPagingResult, err + } + p := grmi.Predicate{ + ColumnName: meta.ToyotaCalloff_CheckSequence.ColumnName, + PredicateType: func(predicate grmi.Predicate) (string, error) { + return fmt.Sprintf(" and %s <= ?", predicate.ColumnName), nil + }, + Values: []interface{}{seqEnd}, + } + predicates = append(predicates, p) + } dao := dal.NewToyotaCalloffDAO(session, user.PlantNr, user.UserId) condition.Fill(urlParameters) result, err := dao.SelectAndPaging(condition.Paging, predicates, condition.OrderByFields)