diff --git a/dao/ods/ArtRouteOdsLst.dao.go b/dao/ods/ArtRouteOdsLst.dao.go index a969279..64a1b9c 100644 --- a/dao/ods/ArtRouteOdsLst.dao.go +++ b/dao/ods/ArtRouteOdsLst.dao.go @@ -248,6 +248,27 @@ type ArtRouteOdsLstDAO interface { * ******************************************************************************/ UpdateWhere([]grmi.Predicate, *model.ArtRouteOdsLst, ...string) error + /****************************************************************************** + * + * @Function Name : SelectByArtId + *----------------------------------------------------------------------------- + * + * @Description : 按条件查询ArtRouteStepOdsLst + * + * @Function Parameters : 查询条件 + * + * @Function Parameters : 排序字段 + * + * @Return Value : 查询结果 + * + * @Return Value : 执行时发生的错误 + * + * @Author : 娄文智 + * + * @Date : 2021-05-21 09:53:49 + * + ******************************************************************************/ + SelectByArtId(string) ([]model.ArtRouteOdsLst, error) } /****************************************************************************** diff --git a/dao/ods/implments/ArtRouteOdsLst.dao.impl.go b/dao/ods/implments/ArtRouteOdsLst.dao.impl.go index 6ea751b..358d092 100644 --- a/dao/ods/implments/ArtRouteOdsLst.dao.impl.go +++ b/dao/ods/implments/ArtRouteOdsLst.dao.impl.go @@ -319,3 +319,17 @@ func (impl *ArtRouteOdsLstDAOImplement) UpdateWhere(predicates []grmi.Predicate, } return nil } +/****************************************************************************** + * + * @Reference LAPP_GAAS_GFrame_BACKEND/dao/ods/ArtRouteOdsLstDAO.SelectByArtId + * + ******************************************************************************/ +func (impl *ArtRouteOdsLstDAOImplement) SelectByArtId(artId string) ([]model.ArtRouteOdsLst, error) { + + data := make([]model.ArtRouteOdsLst, 0) + err := impl.session.Table(impl.meta.TableName).Where("PlantNr = ? and ArtId = ?",impl.plantNr,artId).Find(&data) + if err != nil { + return nil, grmi.NewDataBaseError(err) + } + return data, nil +} \ No newline at end of file diff --git a/services/ods/ArtRouteOdsLst.service.go b/services/ods/ArtRouteOdsLst.service.go index 5b92723..ba63037 100644 --- a/services/ods/ArtRouteOdsLst.service.go +++ b/services/ods/ArtRouteOdsLst.service.go @@ -202,6 +202,27 @@ type ArtRouteOdsLstService interface { * ******************************************************************************/ Update(*models.Usertab, *[]model.ArtRouteOdsLst) error + /****************************************************************************** + * + * @Function Name : SelectByArtId + *----------------------------------------------------------------------------- + * + * @Description : 查询ArtRouteStepOdsLst + * + * @Function Parameters : 当前访问人员信息 + * + * @Function Parameters : 查询参数 + * + * @Return Value : 查询结果 + * + * @Return Value : 执行时发生的错误 + * + * @Author : 娄文智 + * + * @Date : 2021-05-21 09:20:31 + * + ******************************************************************************/ + SelectByArtId(*models.Usertab, string) (interface{}, error) } /****************************************************************************** diff --git a/services/ods/implments/ArtRouteOdsLst.service.impl.go b/services/ods/implments/ArtRouteOdsLst.service.impl.go index 1b49bf1..c64bdcd 100644 --- a/services/ods/implments/ArtRouteOdsLst.service.impl.go +++ b/services/ods/implments/ArtRouteOdsLst.service.impl.go @@ -411,3 +411,23 @@ func (impl *ArtRouteOdsLstServiceImplement) Update(user *models.Usertab, entitie } return nil } +/****************************************************************************** + * + * @Reference LAPP_GAAS_GFrame_BACKEND/services/ods/ArtRouteStepOdsLstService.SelectByArtId + * + ******************************************************************************/ +func (impl *ArtRouteOdsLstServiceImplement) SelectByArtId(user *models.Usertab, artId string) (interface{}, error) { + + grmi.Log(user, "/services/ods/implments/ArtRouteOdsLst.service.impl.go", "SelectByArtId", "查询ArtRouteStepOdsLst") + + engine := db.Eloquent.Master() + session := engine.NewSession() + defer session.Close() + dao := dal.NewArtRouteOdsLstDAO(session, user.Pid, user.Userid) + result, err := dao.SelectByArtId(artId) + if err != nil { + return nil, err + } + return result, nil + +} diff --git a/web/controllers/ods/ArtRouteOdsLst.rest.go b/web/controllers/ods/ArtRouteOdsLst.rest.go index 099060b..7c8b4ee 100644 --- a/web/controllers/ods/ArtRouteOdsLst.rest.go +++ b/web/controllers/ods/ArtRouteOdsLst.rest.go @@ -4,11 +4,13 @@ package ods import ( model "LAPP_GAAS_GFrame_BACKEND/models/ods" + "LAPP_GAAS_GFrame_BACKEND/utils" "LAPP_GAAS_GFrame_BACKEND/web/middleware/jwts" "LAPP_GAAS_GFrame_BACKEND/web/models" "LAPP_GAAS_GFrame_BACKEND/web/supports" "github.com/kataras/iris/v12" "github.com/kataras/iris/v12/core/router" + "strings" ) /****************************************************************************** @@ -324,6 +326,54 @@ func RegisterMultiArtRouteOdsLst(party router.Party, httpMethod string, path str }) } + +/****************************************************************************** + * + * @Function Name : RegisterSelectOneArtRouteOdsLstByArtId + *----------------------------------------------------------------------------- + * + * @Description : 为一个查询ArtRouteStepOdsLst的方法注册路由 + * + * @Function Parameters : 路由分组 + * + * @Function Parameters : 路径 + * + * @Function Parameters : 实际处理请求的方法 + * + * @Author : 代码生成器创建 + * + * @Date : 2021-03-18 22:49:12 + * + ******************************************************************************/ +func RegisterSelectOneArtRouteOdsLstByArtId(party router.Party, path string, method func(*models.Usertab, string) (interface{}, error)) { + + party.Get(path, func(ctx iris.Context) { + user, ok := jwts.ParseToken(ctx) + if !ok { + supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil) + return + } + orderId := ctx.URLParam("artid") + //截取物料id + if utils.ValueIsEmpty(orderId){ + supports.Error(ctx, iris.StatusBadRequest, "序列订单流水号为空!", nil) + return + } + orderIds := strings.Split(orderId,"GAAS") + if len(orderIds) < 2{ + supports.Error(ctx, iris.StatusBadRequest, "序列订单流水号错误!", nil) + return + } + artId := orderIds[0] + result, err := method(user, artId) + if err != nil { + supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil) + return + } + supports.Ok(ctx, supports.OptionSuccess, result) + }) +} + /****************************************************************************** * * @Function Name : RegisterInsertArtRouteOdsLst diff --git a/web/controllers/ods/ods.go b/web/controllers/ods/ods.go index d0eb836..dec81e2 100644 --- a/web/controllers/ods/ods.go +++ b/web/controllers/ods/ods.go @@ -103,6 +103,8 @@ func RegisterRoutes() { RegisterSelectOneArtRouteOdsLst(artrouteodslst, "/get", serviceOfArtRouteOdsLst.SelectOne) // ArtRouteOdsLst查询byplaceid RegisterSelectOneArtRouteOdsLstByWorkPlaceId(artrouteodslst, "/getbyplaceid", serviceOfArtRouteOdsLst.SelectOneByWorkPlaceId) + // ArtRouteStepOdsLst查询多条,通过物料号 + RegisterSelectOneArtRouteOdsLstByArtId(artrouteodslst, "/selectbyartid", serviceOfArtRouteOdsLst.SelectByArtId) // ArtRouteOdsLst修改一条 RegisterUpdateOneArtRouteOdsLst(artrouteodslst, "/updateone", serviceOfArtRouteOdsLst.UpdateOne) // ArtRouteOdsLst修改多条