// Copyright (c) Shenyang Leading Edge Intelligent Technology Co., Ltd. All rights reserved.
|
|
|
|
package wm
|
|
|
|
import (
|
|
"LAPP_ACURA_MOM_BACKEND/global"
|
|
model "LAPP_ACURA_MOM_BACKEND/models/wm"
|
|
"LAPP_ACURA_MOM_BACKEND/web/middleware/jwts"
|
|
"LAPP_ACURA_MOM_BACKEND/web/supports"
|
|
"github.com/kataras/iris/v12"
|
|
"github.com/kataras/iris/v12/core/router"
|
|
)
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterOneInventoryCheckHead
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个处理单条InventoryCheckHead的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : HTTP方法
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-29 10:57:04
|
|
*
|
|
******************************************************************************/
|
|
func RegisterOneInventoryCheckHead(party router.Party, httpMethod string, path string, method func(*global.User, *model.InventoryCheckHead) error) {
|
|
|
|
party.Handle(httpMethod, path, func(ctx iris.Context) {
|
|
user, ok := jwts.ParseToken(ctx)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
var err error = nil
|
|
|
|
entity := new(model.InventoryCheckHead)
|
|
if ctx.GetContentLength() > 0 {
|
|
err := ctx.ReadJSON(entity)
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
} else {
|
|
entity = nil
|
|
}
|
|
|
|
err = method(user, entity)
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
supports.Ok(ctx, supports.OptionSuccess, nil)
|
|
})
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterIDOfInventoryCheckHead
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个通过主键处理单条InventoryCheckHead的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : HTTP方法
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-29 10:57:04
|
|
*
|
|
******************************************************************************/
|
|
func RegisterIDOfInventoryCheckHead(party router.Party, httpMethod string, path string, method func(*global.User, string) error) {
|
|
|
|
party.Handle(httpMethod, path, func(ctx iris.Context) {
|
|
user, ok := jwts.ParseToken(ctx)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
var err error = nil
|
|
inventoryCheckId := ctx.Params().GetString("inventoryCheckId")
|
|
|
|
err = method(user, inventoryCheckId)
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
supports.Ok(ctx, supports.OptionSuccess, nil)
|
|
})
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterInsertOneInventoryCheckHead
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个插入单条InventoryCheckHead的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-29 10:57:04
|
|
*
|
|
******************************************************************************/
|
|
func RegisterInsertOneInventoryCheckHead(party router.Party, path string, method func(*global.User, *model.InventoryCheckHead) error) {
|
|
|
|
RegisterOneInventoryCheckHead(party, "POST", path, method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterDeleteOneInventoryCheckHead
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个删除单条InventoryCheckHead的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-29 10:57:04
|
|
*
|
|
******************************************************************************/
|
|
func RegisterDeleteOneInventoryCheckHead(party router.Party, path string, method func(*global.User, string) error) {
|
|
|
|
RegisterIDOfInventoryCheckHead(party, "DELETE", path+"/{inventoryCheckId:string}", method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterSelectOneInventoryCheckHead
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个查找单条InventoryCheckHead的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-29 10:57:04
|
|
*
|
|
******************************************************************************/
|
|
func RegisterSelectOneInventoryCheckHead(party router.Party, path string, method func(*global.User, string) (*model.InventoryCheckHead, error)) {
|
|
|
|
party.Get(path+"/{inventoryCheckId:string}", func(ctx iris.Context) {
|
|
user, ok := jwts.ParseToken(ctx)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
inventoryCheckId := ctx.Params().GetString("inventoryCheckId")
|
|
result, err := method(user, inventoryCheckId)
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
if result == nil {
|
|
supports.Error(ctx, iris.StatusNotFound, supports.NotFound, nil)
|
|
return
|
|
}
|
|
supports.Ok(ctx, supports.OptionSuccess, result)
|
|
})
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterUpdateOneInventoryCheckHead
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个修改单条InventoryCheckHead的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-29 10:57:04
|
|
*
|
|
******************************************************************************/
|
|
func RegisterUpdateOneInventoryCheckHead(party router.Party, path string, method func(*global.User, *model.InventoryCheckHead) error) {
|
|
|
|
RegisterOneInventoryCheckHead(party, "PUT", path, method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterMultiInventoryCheckHead
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个处理多条InventoryCheckHead的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : HTTP方法
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-29 10:57:04
|
|
*
|
|
******************************************************************************/
|
|
func RegisterMultiInventoryCheckHead(party router.Party, httpMethod string, path string, method func(*global.User, *[]model.InventoryCheckHead) error) {
|
|
|
|
party.Handle(httpMethod, path, func(ctx iris.Context) {
|
|
user, ok := jwts.ParseToken(ctx)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
entities := make([]model.InventoryCheckHead, 0, 10)
|
|
err := ctx.ReadJSON(&entities)
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
|
|
err = method(user, &entities)
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
supports.Ok(ctx, supports.OptionSuccess, nil)
|
|
})
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterInsertInventoryCheckHead
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个插入多条InventoryCheckHead的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-29 10:57:04
|
|
*
|
|
******************************************************************************/
|
|
func RegisterInsertInventoryCheckHead(party router.Party, path string, method func(*global.User, *[]model.InventoryCheckHead) error) {
|
|
|
|
RegisterMultiInventoryCheckHead(party, "POST", path, method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterDeleteInventoryCheckHead
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个删除多条InventoryCheckHead的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-29 10:57:04
|
|
*
|
|
******************************************************************************/
|
|
func RegisterDeleteInventoryCheckHead(party router.Party, path string, method func(*global.User, *[]model.InventoryCheckHead) error) {
|
|
|
|
RegisterMultiInventoryCheckHead(party, "DELETE", path, method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterSelectInventoryCheckHead
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个查询InventoryCheckHead的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-29 10:57:04
|
|
*
|
|
******************************************************************************/
|
|
func RegisterSelectInventoryCheckHead(party router.Party, path string, method func(*global.User, map[string]string) (interface{}, error)) {
|
|
|
|
party.Get(path, func(ctx iris.Context) {
|
|
user, ok := jwts.ParseToken(ctx)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
result, err := method(user, ctx.URLParams())
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
supports.Ok(ctx, supports.OptionSuccess, result)
|
|
})
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterUpdateInventoryCheckHead
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个修改多条InventoryCheckHead的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-29 10:57:04
|
|
*
|
|
******************************************************************************/
|
|
func RegisterUpdateInventoryCheckHead(party router.Party, path string, method func(*global.User, *[]model.InventoryCheckHead) error) {
|
|
|
|
RegisterMultiInventoryCheckHead(party, "PUT", path, method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterAccomplishInventoryCheckHead
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 完成盘点单的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : zhangxin
|
|
*
|
|
* @Date : 2021-07-08
|
|
*
|
|
******************************************************************************/
|
|
func RegisterAccomplishInventoryCheckHead(party router.Party, path string, method func(*global.User, *model.InventoryCheckHead) error) {
|
|
|
|
party.Post(path, func(ctx iris.Context) {
|
|
user, ok := jwts.ParseToken(ctx)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
var entity model.InventoryCheckHead
|
|
if err := ctx.ReadJSON(&entity); err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
err := method(user, &entity)
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
supports.Ok(ctx, supports.OptionSuccess, nil)
|
|
})
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterExportInventoryCheckHead
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 导出excel
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 徐腾飞
|
|
*
|
|
* @Date : 2021-07-19
|
|
*
|
|
******************************************************************************/
|
|
func RegisterExportInventoryCheckHead(party router.Party, path string, method func(*global.User, map[string]string) (interface{}, error)) {
|
|
|
|
party.Get(path, func(ctx iris.Context) {
|
|
user, ok := jwts.ParseToken(ctx)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
result, err := method(user, ctx.URLParams())
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
supports.Ok(ctx, supports.OptionSuccess, result)
|
|
})
|
|
}
|