Merge branch 'master' of http://192.168.5.5:10010/r/aps/WMS
| | |
| | | if v.ProductId == "" { |
| | | return errors.New("productID为空") |
| | | } |
| | | if v.ProductName == "" { |
| | | return errors.New("产品名称异常") |
| | | } |
| | | //if v.ProductName == "" { |
| | | // return errors.New("产品名称异常") |
| | | //} |
| | | if v.Amount.IsNegative() { |
| | | return errors.New("产品数量出错") |
| | | } |
| | |
| | | "github.com/gin-gonic/gin" |
| | | "github.com/spf13/cast" |
| | | "gorm.io/gorm" |
| | | "strconv" |
| | | "wms/constvar" |
| | | "wms/extend/code" |
| | | "wms/extend/util" |
| | | "wms/models" |
| | |
| | | // @Summary 查询作业类型列表 |
| | | // @Produce application/json |
| | | // @Param object query request.GetOperationTypeList true "查询参数" |
| | | // @Success 200 {object} util.ResponseList{data=[]models.OperationType} "成功" |
| | | // @Success 200 {object} util.ResponseList "成功" |
| | | // @Router /api-wms/v1/operationType/operationType [get] |
| | | func (slf OperationTypeController) List(c *gin.Context) { |
| | | var params request.GetOperationTypeList |
| | |
| | | } |
| | | list, total, err := models.NewOperationTypeSearch().SetPage(params.Page, params.PageSize).SetKeyword(params.Keyword).SetOrder("id desc").SetPreload(true).Find() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "查找失败") |
| | | util.ResponseFormat(c, code.RequestError, "查找失败") |
| | | return |
| | | } |
| | | |
| | | util.ResponseFormatList(c, code.Success, list, cast.ToInt(total)) |
| | | var idList []int |
| | | for _, v := range list { |
| | | idList = append(idList, v.Id) |
| | | } |
| | | statistics, err := models.NewOperationTypeSearch().ListByStatusAndCount(idList) |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestError, err.Error()) |
| | | return |
| | | } |
| | | mapStatistics := make(map[string]*models.OperationTypeByStatus, 0) |
| | | for _, v := range statistics { |
| | | mapStatistics[strconv.Itoa(v.Id)+string(v.Status)] = v |
| | | } |
| | | for k, v := range list { |
| | | if value, ok := mapStatistics[strconv.Itoa(v.Id)+string(constvar.OperationStatus_Ready)]; ok { |
| | | list[k].ReadyCount = value.Count |
| | | } |
| | | if value, ok := mapStatistics[strconv.Itoa(v.Id)+string(constvar.OperationStatus_Finish)]; ok { |
| | | list[k].FinishCount = value.Count |
| | | } |
| | | } |
| | | util.ResponseFormatListWithPage(c, code.Success, list, cast.ToInt(total), params.Page, params.PageSize) |
| | | } |
| | | |
| | | // Delete |
| | |
| | | return |
| | | } |
| | | detail := &models.OperationDetails{ |
| | | ProductId: params.ProductId, |
| | | ProductName: params.ProductName, |
| | | Amount: params.Amount, |
| | | Unit: params.Unit, |
| | | ProductId: params.ProductId, |
| | | //ProductName: params.ProductName, |
| | | Amount: params.Amount, |
| | | //Unit: params.Unit, |
| | | } |
| | | operation := models.Operation{ |
| | | Number: strconv.FormatInt(time.Now().Unix(), 10), |
| | |
| | | return |
| | | } |
| | | |
| | | db := models.NewOperationSearch().Orm.Table("wms_operation").Select("wms_operation.id,wms_operation.number,wms_operation.source_number,wms_operation.status,wms_operation.from_location_id,wms_operation.to_location_id,wms_operation.operation_date,wms_operation.contacter_id,wms_operation.contacter_name,wms_operation.company_id,wms_operation.company_name,wms_operation.comment,wms_operation_details.product_id,wms_operation_details.product_name,wms_operation_details.unit,wms_operation_details.amount").InnerJoins("inner join wms_operation_details on wms_operation_details.operation_id=wms_operation.id") |
| | | //db := models.NewOperationSearch().Orm.Table("wms_operation").Select("wms_operation.id,wms_operation.number,wms_operation.source_number,wms_operation.status,wms_operation.from_location_id,wms_operation.to_location_id,wms_operation.operation_date,wms_operation.contacter_id,wms_operation.contacter_name,wms_operation.company_id,wms_operation.company_name,wms_operation.comment,wms_operation_details.product_id,wms_operation_details.product_name,wms_operation_details.unit,wms_operation_details.amount").InnerJoins("inner join wms_operation_details on wms_operation_details.operation_id=wms_operation.id") |
| | | |
| | | db := models.NewOperationSearch().Orm.Table("wms_operation").Select("wms_operation.id,wms_operation.number,wms_operation.source_number,wms_operation.status,wms_operation.from_location_id,wms_operation.to_location_id,wms_operation.operation_date,wms_operation.contacter_id,wms_operation.contacter_name,wms_operation.company_id,wms_operation.company_name,wms_operation.comment,wms_operation_details.product_id,material.name as product_name,material.unit,wms_operation_details.amount").InnerJoins("inner join wms_operation_details on wms_operation_details.operation_id=wms_operation.id").InnerJoins("inner join material on material.id=wms_operation_details.product_id") |
| | | |
| | | if params.SourceNumber != "" { |
| | | db = db.Where("wms_operation.source_number like ?", fmt.Sprintf("%%%v%%", params.SourceNumber)) |
| | |
| | | return |
| | | } |
| | | detail := &models.OperationDetails{ |
| | | ProductId: params.ProductId, |
| | | ProductName: params.ProductName, |
| | | Amount: params.Amount, |
| | | Unit: params.Unit, |
| | | ProductId: params.ProductId, |
| | | //ProductName: params.ProductName, |
| | | Amount: params.Amount, |
| | | //Unit: params.Unit, |
| | | } |
| | | operation := models.Operation{ |
| | | Id: params.Id, |
| | |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/util.ResponseList" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.OperationType" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | "$ref": "#/definitions/util.ResponseList" |
| | | } |
| | | } |
| | | } |
| | |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "description": "数量", |
| | | "description": "ProductName string ` + "`" + `json:\"productName\" gorm:\"type:varchar(255);not null;comment:产品名称\"` + "`" + ` //产品名称", |
| | | "type": "number" |
| | | }, |
| | | "createTime": { |
| | |
| | | "description": "操作id", |
| | | "type": "integer" |
| | | }, |
| | | "product": { |
| | | "description": "Unit string ` + "`" + `json:\"unit\" gorm:\"type:varchar(31);comment:单位\"` + "`" + ` //单位", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/models.Material" |
| | | } |
| | | ] |
| | | }, |
| | | "productId": { |
| | | "description": "产品id", |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "description": "产品名称", |
| | | "type": "string" |
| | | }, |
| | | "unit": { |
| | | "type": "string" |
| | | }, |
| | | "updateTime": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "models.OperationType": { |
| | | "type": "object", |
| | | "properties": { |
| | | "ReservationDaysBeforePriority": { |
| | | "description": "在优先级的前几天", |
| | | "type": "integer" |
| | | }, |
| | | "baseOperationType": { |
| | | "description": "基础作业类型", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.BaseOperationType" |
| | | } |
| | | ] |
| | | }, |
| | | "company": { |
| | | "description": "公司", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/models.Company" |
| | | } |
| | | ] |
| | | }, |
| | | "companyId": { |
| | | "description": "公司id", |
| | | "type": "integer" |
| | | }, |
| | | "createBackorder": { |
| | | "description": "创建欠单", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.WhetherType" |
| | | } |
| | | ] |
| | | }, |
| | | "createTime": { |
| | | "type": "string" |
| | | }, |
| | | "defaultLocationDest": { |
| | | "description": "默认目标位置", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/models.Location" |
| | | } |
| | | ] |
| | | }, |
| | | "defaultLocationDestId": { |
| | | "description": "默认目标位置id", |
| | | "type": "integer" |
| | | }, |
| | | "defaultLocationSrc": { |
| | | "description": "默认源位置", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/models.Location" |
| | | } |
| | | ] |
| | | }, |
| | | "defaultLocationSrcId": { |
| | | "description": "默认源位置id", |
| | | "type": "integer" |
| | | }, |
| | | "earlyOperations": { |
| | | "description": "预填写作业详情", |
| | | "type": "boolean" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "description": "仓库名称", |
| | | "type": "string" |
| | | }, |
| | | "prefix": { |
| | | "description": "前缀", |
| | | "type": "string" |
| | | }, |
| | | "printLabel": { |
| | | "description": "是否打印标签", |
| | | "type": "boolean" |
| | | }, |
| | | "reservationDaysBefore": { |
| | | "description": "收货前几天", |
| | | "type": "integer" |
| | | }, |
| | | "reservationMethod": { |
| | | "description": "保留方式", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.ReservationMethod" |
| | | } |
| | | ] |
| | | }, |
| | | "returnOperationType": { |
| | | "description": "退货类型名称", |
| | | "type": "string" |
| | | }, |
| | | "returnOperationTypeID": { |
| | | "description": "退货类型ID", |
| | | "type": "integer" |
| | | }, |
| | | "showOperations": { |
| | | "description": "显示作业详情", |
| | | "type": "boolean" |
| | | }, |
| | | "updateTime": { |
| | | "type": "string" |
| | | }, |
| | | "warehouse": { |
| | | "description": "仓库", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/models.Warehouse" |
| | | } |
| | | ] |
| | | }, |
| | | "warehouseId": { |
| | | "description": "仓库id", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "description": "ProductName string ` + "`" + `json:\"productName\"` + "`" + `", |
| | | "type": "number" |
| | | }, |
| | | "fromLocationId": { |
| | |
| | | "productId": { |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "type": "string" |
| | | }, |
| | | "sourceNumber": { |
| | | "type": "string" |
| | | }, |
| | | "toLocationId": { |
| | | "type": "integer" |
| | | }, |
| | | "unit": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "type": "integer" |
| | | }, |
| | | "amount": { |
| | | "description": "数量", |
| | | "description": "ProductName string ` + "`" + `json:\"productName\" gorm:\"type:varchar(255);not null;comment:产品名称\"` + "`" + ` //产品名称", |
| | | "type": "number" |
| | | }, |
| | | "productId": { |
| | | "description": "产品id", |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "description": "产品名称", |
| | | "type": "string" |
| | | }, |
| | | "unit": { |
| | | "type": "string" |
| | | } |
| | | } |
| | |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "description": "ProductName string ` + "`" + `json:\"productName\"` + "`" + `", |
| | | "type": "number" |
| | | }, |
| | | "fromLocationId": { |
| | |
| | | "type": "integer" |
| | | }, |
| | | "number": { |
| | | "description": "Unit string ` + "`" + `json:\"unit\"` + "`" + `", |
| | | "type": "string" |
| | | }, |
| | | "operationDate": { |
| | | "type": "string" |
| | | }, |
| | | "productId": { |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "type": "string" |
| | | }, |
| | | "sourceNumber": { |
| | |
| | | }, |
| | | "toLocationId": { |
| | | "type": "integer" |
| | | }, |
| | | "unit": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/util.ResponseList" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.OperationType" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | "$ref": "#/definitions/util.ResponseList" |
| | | } |
| | | } |
| | | } |
| | |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "description": "数量", |
| | | "description": "ProductName string `json:\"productName\" gorm:\"type:varchar(255);not null;comment:产品名称\"` //产品名称", |
| | | "type": "number" |
| | | }, |
| | | "createTime": { |
| | |
| | | "description": "操作id", |
| | | "type": "integer" |
| | | }, |
| | | "product": { |
| | | "description": "Unit string `json:\"unit\" gorm:\"type:varchar(31);comment:单位\"` //单位", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/models.Material" |
| | | } |
| | | ] |
| | | }, |
| | | "productId": { |
| | | "description": "产品id", |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "description": "产品名称", |
| | | "type": "string" |
| | | }, |
| | | "unit": { |
| | | "type": "string" |
| | | }, |
| | | "updateTime": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "models.OperationType": { |
| | | "type": "object", |
| | | "properties": { |
| | | "ReservationDaysBeforePriority": { |
| | | "description": "在优先级的前几天", |
| | | "type": "integer" |
| | | }, |
| | | "baseOperationType": { |
| | | "description": "基础作业类型", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.BaseOperationType" |
| | | } |
| | | ] |
| | | }, |
| | | "company": { |
| | | "description": "公司", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/models.Company" |
| | | } |
| | | ] |
| | | }, |
| | | "companyId": { |
| | | "description": "公司id", |
| | | "type": "integer" |
| | | }, |
| | | "createBackorder": { |
| | | "description": "创建欠单", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.WhetherType" |
| | | } |
| | | ] |
| | | }, |
| | | "createTime": { |
| | | "type": "string" |
| | | }, |
| | | "defaultLocationDest": { |
| | | "description": "默认目标位置", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/models.Location" |
| | | } |
| | | ] |
| | | }, |
| | | "defaultLocationDestId": { |
| | | "description": "默认目标位置id", |
| | | "type": "integer" |
| | | }, |
| | | "defaultLocationSrc": { |
| | | "description": "默认源位置", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/models.Location" |
| | | } |
| | | ] |
| | | }, |
| | | "defaultLocationSrcId": { |
| | | "description": "默认源位置id", |
| | | "type": "integer" |
| | | }, |
| | | "earlyOperations": { |
| | | "description": "预填写作业详情", |
| | | "type": "boolean" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "description": "仓库名称", |
| | | "type": "string" |
| | | }, |
| | | "prefix": { |
| | | "description": "前缀", |
| | | "type": "string" |
| | | }, |
| | | "printLabel": { |
| | | "description": "是否打印标签", |
| | | "type": "boolean" |
| | | }, |
| | | "reservationDaysBefore": { |
| | | "description": "收货前几天", |
| | | "type": "integer" |
| | | }, |
| | | "reservationMethod": { |
| | | "description": "保留方式", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.ReservationMethod" |
| | | } |
| | | ] |
| | | }, |
| | | "returnOperationType": { |
| | | "description": "退货类型名称", |
| | | "type": "string" |
| | | }, |
| | | "returnOperationTypeID": { |
| | | "description": "退货类型ID", |
| | | "type": "integer" |
| | | }, |
| | | "showOperations": { |
| | | "description": "显示作业详情", |
| | | "type": "boolean" |
| | | }, |
| | | "updateTime": { |
| | | "type": "string" |
| | | }, |
| | | "warehouse": { |
| | | "description": "仓库", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/models.Warehouse" |
| | | } |
| | | ] |
| | | }, |
| | | "warehouseId": { |
| | | "description": "仓库id", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "description": "ProductName string `json:\"productName\"`", |
| | | "type": "number" |
| | | }, |
| | | "fromLocationId": { |
| | |
| | | "productId": { |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "type": "string" |
| | | }, |
| | | "sourceNumber": { |
| | | "type": "string" |
| | | }, |
| | | "toLocationId": { |
| | | "type": "integer" |
| | | }, |
| | | "unit": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "type": "integer" |
| | | }, |
| | | "amount": { |
| | | "description": "数量", |
| | | "description": "ProductName string `json:\"productName\" gorm:\"type:varchar(255);not null;comment:产品名称\"` //产品名称", |
| | | "type": "number" |
| | | }, |
| | | "productId": { |
| | | "description": "产品id", |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "description": "产品名称", |
| | | "type": "string" |
| | | }, |
| | | "unit": { |
| | | "type": "string" |
| | | } |
| | | } |
| | |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "description": "ProductName string `json:\"productName\"`", |
| | | "type": "number" |
| | | }, |
| | | "fromLocationId": { |
| | |
| | | "type": "integer" |
| | | }, |
| | | "number": { |
| | | "description": "Unit string `json:\"unit\"`", |
| | | "type": "string" |
| | | }, |
| | | "operationDate": { |
| | | "type": "string" |
| | | }, |
| | | "productId": { |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "type": "string" |
| | | }, |
| | | "sourceNumber": { |
| | |
| | | }, |
| | | "toLocationId": { |
| | | "type": "integer" |
| | | }, |
| | | "unit": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | models.OperationDetails: |
| | | properties: |
| | | amount: |
| | | description: 数量 |
| | | description: ProductName string `json:"productName" gorm:"type:varchar(255);not |
| | | null;comment:产品名称"` //产品名称 |
| | | type: number |
| | | createTime: |
| | | type: string |
| | |
| | | operationId: |
| | | description: 操作id |
| | | type: integer |
| | | product: |
| | | allOf: |
| | | - $ref: '#/definitions/models.Material' |
| | | description: Unit string `json:"unit" gorm:"type:varchar(31);comment:单位"` //单位 |
| | | productId: |
| | | description: 产品id |
| | | type: string |
| | | productName: |
| | | description: 产品名称 |
| | | type: string |
| | | unit: |
| | | type: string |
| | | updateTime: |
| | | type: string |
| | | type: object |
| | | models.OperationType: |
| | | properties: |
| | | ReservationDaysBeforePriority: |
| | | description: 在优先级的前几天 |
| | | type: integer |
| | | baseOperationType: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.BaseOperationType' |
| | | description: 基础作业类型 |
| | | company: |
| | | allOf: |
| | | - $ref: '#/definitions/models.Company' |
| | | description: 公司 |
| | | companyId: |
| | | description: 公司id |
| | | type: integer |
| | | createBackorder: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.WhetherType' |
| | | description: 创建欠单 |
| | | createTime: |
| | | type: string |
| | | defaultLocationDest: |
| | | allOf: |
| | | - $ref: '#/definitions/models.Location' |
| | | description: 默认目标位置 |
| | | defaultLocationDestId: |
| | | description: 默认目标位置id |
| | | type: integer |
| | | defaultLocationSrc: |
| | | allOf: |
| | | - $ref: '#/definitions/models.Location' |
| | | description: 默认源位置 |
| | | defaultLocationSrcId: |
| | | description: 默认源位置id |
| | | type: integer |
| | | earlyOperations: |
| | | description: 预填写作业详情 |
| | | type: boolean |
| | | id: |
| | | type: integer |
| | | name: |
| | | description: 仓库名称 |
| | | type: string |
| | | prefix: |
| | | description: 前缀 |
| | | type: string |
| | | printLabel: |
| | | description: 是否打印标签 |
| | | type: boolean |
| | | reservationDaysBefore: |
| | | description: 收货前几天 |
| | | type: integer |
| | | reservationMethod: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.ReservationMethod' |
| | | description: 保留方式 |
| | | returnOperationType: |
| | | description: 退货类型名称 |
| | | type: string |
| | | returnOperationTypeID: |
| | | description: 退货类型ID |
| | | type: integer |
| | | showOperations: |
| | | description: 显示作业详情 |
| | | type: boolean |
| | | updateTime: |
| | | type: string |
| | | warehouse: |
| | | allOf: |
| | | - $ref: '#/definitions/models.Warehouse' |
| | | description: 仓库 |
| | | warehouseId: |
| | | description: 仓库id |
| | | type: integer |
| | | type: object |
| | | models.ProductCategory: |
| | | properties: |
| | |
| | | request.AddDisuse: |
| | | properties: |
| | | amount: |
| | | description: ProductName string `json:"productName"` |
| | | type: number |
| | | fromLocationId: |
| | | type: integer |
| | | productId: |
| | | type: string |
| | | productName: |
| | | type: string |
| | | sourceNumber: |
| | | type: string |
| | | toLocationId: |
| | | type: integer |
| | | unit: |
| | | type: string |
| | | type: object |
| | | request.AddOperation: |
| | | properties: |
| | |
| | | description: 操作id |
| | | type: integer |
| | | amount: |
| | | description: 数量 |
| | | description: ProductName string `json:"productName" gorm:"type:varchar(255);not |
| | | null;comment:产品名称"` //产品名称 |
| | | type: number |
| | | productId: |
| | | description: 产品id |
| | | type: string |
| | | productName: |
| | | description: 产品名称 |
| | | type: string |
| | | unit: |
| | | type: string |
| | | type: object |
| | | request.OperationList: |
| | |
| | | request.UpdateDisuse: |
| | | properties: |
| | | amount: |
| | | description: ProductName string `json:"productName"` |
| | | type: number |
| | | fromLocationId: |
| | | type: integer |
| | | id: |
| | | type: integer |
| | | number: |
| | | description: Unit string `json:"unit"` |
| | | type: string |
| | | operationDate: |
| | | type: string |
| | | productId: |
| | | type: string |
| | | productName: |
| | | type: string |
| | | sourceNumber: |
| | | type: string |
| | |
| | | $ref: '#/definitions/constvar.OperationStatus' |
| | | toLocationId: |
| | | type: integer |
| | | unit: |
| | | type: string |
| | | type: object |
| | | request.UpdateOperation: |
| | | properties: |
| | |
| | | "200": |
| | | description: 成功 |
| | | schema: |
| | | allOf: |
| | | - $ref: '#/definitions/util.ResponseList' |
| | | - properties: |
| | | data: |
| | | items: |
| | | $ref: '#/definitions/models.OperationType' |
| | | type: array |
| | | type: object |
| | | $ref: '#/definitions/util.ResponseList' |
| | | summary: 查询作业类型列表 |
| | | tags: |
| | | - 业务类型 |
| | |
| | | } |
| | | |
| | | if slf.Preload { |
| | | db = db.Model(&Operation{}).Preload("Details").Preload("FromLocation").Preload("ToLocation") |
| | | db = db.Model(&Operation{}).Preload("Details").Preload("Details.Product").Preload("FromLocation").Preload("ToLocation") |
| | | } |
| | | |
| | | if slf.Disuse { |
| | |
| | | // OperationDetails 操作明细表 |
| | | OperationDetails struct { |
| | | WmsModel |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | OperationID int `json:"operationId" gorm:"type:int;not null;comment:操作记录id"` //操作id |
| | | ProductId string `json:"productId" gorm:"type:varchar(191);not null;comment:产品id"` //产品id |
| | | ProductName string `json:"productName" gorm:"type:varchar(255);not null;comment:产品名称"` //产品名称 |
| | | Amount decimal.Decimal `json:"amount" gorm:"type:decimal(20,2);not null;comment:数量"` //数量 |
| | | Unit string `json:"unit" gorm:"type:varchar(31);comment:单位"` |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | OperationID int `json:"operationId" gorm:"type:int;not null;comment:操作记录id"` //操作id |
| | | ProductId string `json:"productId" gorm:"type:varchar(191);not null;comment:产品id"` //产品id |
| | | //ProductName string `json:"productName" gorm:"type:varchar(255);not null;comment:产品名称"` //产品名称 |
| | | Amount decimal.Decimal `json:"amount" gorm:"type:decimal(20,2);not null;comment:数量"` //数量 |
| | | //Unit string `json:"unit" gorm:"type:varchar(31);comment:单位"` //单位 |
| | | Product Material `json:"product" gorm:"foreignKey:ProductId;references:ID"` |
| | | } |
| | | |
| | | OperationDetailsSearch struct { |
| | |
| | | CreateBackorder constvar.WhetherType `json:"createBackorder" gorm:"column:create_backorder"` //创建欠单 |
| | | ReturnOperationTypeID int `json:"returnOperationTypeID" gorm:"column:return_job_type_id"` //退货类型ID |
| | | ReturnOperationType string `json:"returnOperationType" gorm:"-"` //退货类型名称 |
| | | ReadyCount int `json:"readyCount" gorm:"-"` //就绪数量 |
| | | FinishCount int `json:"finishCount" gorm:"-"` //完成数量 |
| | | } |
| | | |
| | | OperationTypeSearch struct { |
| | |
| | | Keyword string |
| | | Orm *gorm.DB |
| | | Preload bool |
| | | } |
| | | |
| | | OperationTypeByStatus struct { |
| | | Id int `gorm:"column:id"` |
| | | Status constvar.OperationStatus `gorm:"column:status"` |
| | | Count int `gorm:"column:count"` |
| | | } |
| | | ) |
| | | |
| | |
| | | |
| | | return records, nil |
| | | } |
| | | |
| | | func (slf *OperationTypeSearch) ListByStatusAndCount(idList []int) ([]*OperationTypeByStatus, error) { |
| | | var ( |
| | | records = make([]*OperationTypeByStatus, 0) |
| | | db = slf.Orm |
| | | ) |
| | | db = db.Table("wms_job_type").Select("wms_job_type.id,wms_operation.status,count(wms_operation.id) as count").InnerJoins("inner join wms_operation on wms_operation.operation_type_id=wms_job_type.id").Group("wms_job_type.id,wms_operation.status") |
| | | if len(idList) > 0 { |
| | | db = db.Where("wms_job_type.id IN ?", idList) |
| | | } |
| | | |
| | | if err := db.Find(&records).Error; err != nil { |
| | | return records, fmt.Errorf("func ListByStatusAndCount err: %v, ", err) |
| | | } |
| | | |
| | | return records, nil |
| | | } |
| | |
| | | } |
| | | |
| | | type OperationDetails struct { |
| | | OperationId int `json:"OperationId" gorm:"type:int;not null;comment:操作记录id"` //操作id |
| | | ProductId string `json:"productId" gorm:"type:varchar(191);not null;comment:产品id"` //产品id |
| | | ProductName string `json:"productName" gorm:"type:varchar(255);not null;comment:产品名称"` //产品名称 |
| | | Amount decimal.Decimal `json:"amount" gorm:"type:decimal(20,2);not null;comment:数量"` //数量 |
| | | Unit string `json:"unit" gorm:"type:varchar(31);comment:单位"` |
| | | OperationId int `json:"OperationId" gorm:"type:int;not null;comment:操作记录id"` //操作id |
| | | ProductId string `json:"productId" gorm:"type:varchar(191);not null;comment:产品id"` //产品id |
| | | //ProductName string `json:"productName" gorm:"type:varchar(255);not null;comment:产品名称"` //产品名称 |
| | | Amount decimal.Decimal `json:"amount" gorm:"type:decimal(20,2);not null;comment:数量"` //数量 |
| | | //Unit string `json:"unit" gorm:"type:varchar(31);comment:单位"` //单位 |
| | | //Product models.Material `json:"product" gorm:"foreignKey:ProductId;references:ID"` |
| | | } |
| | | |
| | | type OperationList struct { |
| | |
| | | } |
| | | |
| | | type AddDisuse struct { |
| | | ProductId string `json:"productId"` |
| | | ProductName string `json:"productName"` |
| | | ProductId string `json:"productId"` |
| | | //ProductName string `json:"productName"` |
| | | Amount decimal.Decimal `json:"amount"` |
| | | FromLocationId int `json:"fromLocationId"` |
| | | ToLocationId int `json:"toLocationId"` |
| | | SourceNumber string `json:"sourceNumber"` |
| | | Unit string `json:"unit"` |
| | | //Unit string `json:"unit"` |
| | | } |
| | | |
| | | type QueryDisuseList struct { |
| | |
| | | } |
| | | |
| | | type UpdateDisuse struct { |
| | | Id int `json:"id"` |
| | | ProductId string `json:"productId"` |
| | | ProductName string `json:"productName"` |
| | | Amount decimal.Decimal `json:"amount"` |
| | | FromLocationId int `json:"fromLocationId"` |
| | | ToLocationId int `json:"toLocationId"` |
| | | SourceNumber string `json:"sourceNumber"` |
| | | Unit string `json:"unit"` |
| | | Number string `json:"number"` |
| | | Status constvar.OperationStatus `json:"status"` |
| | | OperationDate string `json:"operationDate"` |
| | | Id int `json:"id"` |
| | | ProductId string `json:"productId"` |
| | | //ProductName string `json:"productName"` |
| | | Amount decimal.Decimal `json:"amount"` |
| | | FromLocationId int `json:"fromLocationId"` |
| | | ToLocationId int `json:"toLocationId"` |
| | | SourceNumber string `json:"sourceNumber"` |
| | | //Unit string `json:"unit"` |
| | | Number string `json:"number"` |
| | | Status constvar.OperationStatus `json:"status"` |
| | | OperationDate string `json:"operationDate"` |
| | | } |