| | |
| | | FileTemplateCategory_Selfmade FileTemplateCategory = iota + 1 //入库-自制 |
| | | FileTemplateCategory_Output //出库 |
| | | ) |
| | | |
| | | type CodeStandardType string |
| | | |
| | | const ( |
| | | CodeStandardType_Material CodeStandardType = "物料编码" |
| | | CodeStandardType_Incoming CodeStandardType = "入库编码" |
| | | CodeStandardType_Outgoing CodeStandardType = "出库编码" |
| | | CodeStandardType_Internal CodeStandardType = "调拨编码" |
| | | CodeStandardType_Disuse CodeStandardType = "报废编码" |
| | | ) |
| | |
| | | import ( |
| | | "github.com/gin-gonic/gin" |
| | | "github.com/spf13/cast" |
| | | "wms/constvar" |
| | | cd "wms/extend/code" |
| | | "wms/extend/util" |
| | | "wms/models" |
| | |
| | | id = 0 |
| | | err error |
| | | ) |
| | | switch params.Type { |
| | | case "物料编码": |
| | | switch constvar.CodeStandardType(params.Type) { |
| | | case constvar.CodeStandardType_Material: |
| | | id, err = models.NewMaterialSearch().MaxAutoIncr() |
| | | case constvar.CodeStandardType_Incoming: |
| | | id, err = models.NewOperationSearch().SetBaseOperationType(constvar.BaseOperationTypeIncoming).MaxAutoIncr() |
| | | case constvar.CodeStandardType_Outgoing: |
| | | id, err = models.NewOperationSearch().SetBaseOperationType(constvar.BaseOperationTypeOutgoing).MaxAutoIncr() |
| | | case constvar.CodeStandardType_Internal: |
| | | id, err = models.NewOperationSearch().SetBaseOperationType(constvar.BaseOperationTypeInternal).MaxAutoIncr() |
| | | case constvar.CodeStandardType_Disuse: |
| | | id, err = models.NewOperationSearch().SetBaseOperationType(constvar.BaseOperationTypeDisuse).MaxAutoIncr() |
| | | default: |
| | | util.ResponseFormat(c, cd.RequestError, "编码规则不存在") |
| | | return |
| | |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.OperationAllList" |
| | | "$ref": "#/definitions/request.OperationCondition" |
| | | } |
| | | } |
| | | ], |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.OperationCondition": { |
| | | "type": "object", |
| | | "properties": { |
| | | "condition": { |
| | | "type": "string" |
| | | }, |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | | }, |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "request.OperationDetails": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.OperationAllList" |
| | | "$ref": "#/definitions/request.OperationCondition" |
| | | } |
| | | } |
| | | ], |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.OperationCondition": { |
| | | "type": "object", |
| | | "properties": { |
| | | "condition": { |
| | | "type": "string" |
| | | }, |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | | }, |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "request.OperationDetails": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | sourceNumber: |
| | | type: string |
| | | type: object |
| | | request.OperationCondition: |
| | | properties: |
| | | condition: |
| | | type: string |
| | | page: |
| | | description: 页码 |
| | | type: integer |
| | | pageSize: |
| | | description: 每页大小 |
| | | type: integer |
| | | type: object |
| | | request.OperationDetails: |
| | | properties: |
| | | OperationId: |
| | |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.OperationAllList' |
| | | $ref: '#/definitions/request.OperationCondition' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | |
| | | |
| | | return records, nil |
| | | } |
| | | |
| | | func (slf *OperationSearch) MaxAutoIncr() (int, error) { |
| | | var ( |
| | | db = slf.build() |
| | | total int64 |
| | | ) |
| | | |
| | | if err := db.Count(&total).Error; err != nil { |
| | | return int(total), fmt.Errorf("max err: %v", err) |
| | | } |
| | | return int(total), nil |
| | | } |