From b0d1319422f0c0bf3c0a4d2ba2a91aaf5c9ae2da Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期五, 08 三月 2024 10:48:51 +0800 Subject: [PATCH] 纤度检验数据结构 --- models/fineness_check_item.go | 259 +++++++++++ models/fineness_check.go | 253 +++++++++++ models/fineness.go | 4 models/db.go | 1 controllers/request/fineness.go | 32 docs/swagger.yaml | 182 +++++++ docs/docs.go | 270 +++++++++++- docs/swagger.json | 270 +++++++++++- models/fineness_item.go | 8 9 files changed, 1,195 insertions(+), 84 deletions(-) diff --git a/controllers/request/fineness.go b/controllers/request/fineness.go index e8121f9..76757a5 100644 --- a/controllers/request/fineness.go +++ b/controllers/request/fineness.go @@ -5,25 +5,25 @@ ) type AddFinenessRegister struct { - ID uint `json:"id"` //id 娣诲姞鏃朵紶0 - Number string `gorm:"type:varchar(255);not null;comment:缂栧彿" json:"number"` //缂栧彿 - FinishDate string `gorm:"type:varchar(255);not null;comment:钀戒笣鏃堕棿" json:"finishDate"` //钀戒笣鏃堕棿 - Workshop string `gorm:"type:varchar(255);not null;comment:杞﹂棿" json:"name"` //杞﹂棿 - WorkshopGroup string `gorm:"type:varchar(255);not null;comment:杞︾粍" json:"workshopGroup"` //杞︾粍 - Market string `gorm:"type:varchar(255);not null;comment:搴勫彛" json:"market"` //搴勫彛 - Spec string `gorm:"type:varchar(255);not null;comment:瑙勬牸" json:"spec"` //瑙勬牸 - StartCircle uint8 `gorm:"type:varchar(255);not null;comment:寮�濮嬪洖鏁�" json:"startCircle"` //寮�濮嬪洖鏁� - EndCircle uint8 `gorm:"type:varchar(255);not null;comment:缁撴潫鍥炴暟" json:"endCircle"` //缁撴潫鍥炴暟 - FinenessList []FinenessItem `json:"finenessList"` - SumFineness decimal.Decimal `gorm:"type:decimal(12,2);not null;comment:鍚堣绾ゅ害" json:"sumFineness"` - SumQuantity decimal.Decimal `gorm:"type:decimal(12,2);not null;comment:鍚堣鏁伴噺" json:"sumQuantity"` + ID uint `json:"id"` //id 娣诲姞鏃朵紶0 + Number string `gorm:"type:varchar(255);not null;comment:缂栧彿" json:"number"` //缂栧彿 + FinishDate string `gorm:"type:varchar(255);not null;comment:钀戒笣鏃堕棿" json:"finishDate"` //钀戒笣鏃堕棿 + Workshop string `gorm:"type:varchar(255);not null;comment:杞﹂棿" json:"name"` //杞﹂棿 + WorkshopGroup string `gorm:"type:varchar(255);not null;comment:杞︾粍" json:"workshopGroup"` //杞︾粍 + Market string `gorm:"type:varchar(255);not null;comment:搴勫彛" json:"market"` //搴勫彛 + Spec string `gorm:"type:varchar(255);not null;comment:瑙勬牸" json:"spec"` //瑙勬牸 + Circle uint8 `gorm:"not null;comment:鍥炴暟" json:"circle"` //鍥炴暟 + TotalCircle uint8 `gorm:"not null;comment:鎬诲洖鏁�" json:"totalCircle"` //鎬诲洖鏁� + FinenessList []FinenessItem `json:"finenessList"` //绾ゅ害鏁扮粍 + SumFineness decimal.Decimal `gorm:"type:decimal(12,2);not null;comment:鍚堣绾ゅ害" json:"sumFineness"` //鍚堣绾ゅ害 + SumQuantity decimal.Decimal `gorm:"type:decimal(12,2);not null;comment:鍚堣鏁伴噺" json:"sumQuantity"` //鍚堣鏁伴噺 } type FinenessItem struct { - Position int8 `json:"position"` - Fineness decimal.Decimal `json:"fineness"` - Quantity decimal.Decimal `json:"quantity"` - Sum decimal.Decimal `json:"sum"` + Position int8 `json:"position"` //杞﹀彿 + Fineness decimal.Decimal `json:"fineness"` //绾ゅ害 + Quantity decimal.Decimal `json:"quantity"` //鏁伴噺 + Sum decimal.Decimal `json:"sum"` //鍚堣 } type GetFinenessRegisterList struct { diff --git a/docs/docs.go b/docs/docs.go index b085057..9dd3fd8 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -158,6 +158,62 @@ } } }, + "/api-jl/v1/system/deletePriceStandard/{id}": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "绯荤粺璁剧疆/鐢熶笣瀹氫环鏍囧噯" + ], + "summary": "鍒犻櫎鐢熶笣瀹氫环鏍囧噯", + "parameters": [ + { + "type": "string", + "description": "id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "$ref": "#/definitions/util.Response" + } + } + } + } + }, + "/api-jl/v1/system/deleteWorkshopManage/{id}": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "绯荤粺璁剧疆/杞﹂棿绠$悊" + ], + "summary": "鍒犻櫎杞﹂棿绠$悊", + "parameters": [ + { + "type": "string", + "description": "id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "$ref": "#/definitions/util.Response" + } + } + } + } + }, "/api-jl/v1/system/dict": { "get": { "produces": [ @@ -325,20 +381,96 @@ "summary": "鑾峰彇鐢熶笣瀹氫环鏍囧噯", "parameters": [ { - "description": "鍙傛暟", - "name": "object", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/models.RawSilkPriceStandard" - } + "type": "string", + "name": "keyWord", + "in": "query" + }, + { + "type": "integer", + "description": "椤电爜", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "姣忛〉澶у皬", + "name": "pageSize", + "in": "query" } ], "responses": { "200": { "description": "鎴愬姛", "schema": { - "$ref": "#/definitions/util.Response" + "allOf": [ + { + "$ref": "#/definitions/util.ResponseList" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/models.RawSilkPriceStandard" + } + } + } + } + ] + } + } + } + } + }, + "/api-jl/v1/system/getWorkshopManageList": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "绯荤粺璁剧疆/杞﹂棿绠$悊" + ], + "summary": "鑾峰彇杞﹂棿绠$悊鍒楄〃", + "parameters": [ + { + "type": "string", + "name": "keyWord", + "in": "query" + }, + { + "type": "integer", + "description": "椤电爜", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "姣忛〉澶у皬", + "name": "pageSize", + "in": "query" + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/util.ResponseList" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/models.WorkshopManage" + } + } + } + } + ] } } } @@ -373,9 +505,57 @@ } } } + }, + "/api-jl/v1/system/saveWorkshopManage": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "绯荤粺璁剧疆/杞﹂棿绠$悊" + ], + "summary": "淇濆瓨杞﹂棿绠$悊", + "parameters": [ + { + "description": "鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.WorkshopManage" + } + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "$ref": "#/definitions/util.Response" + } + } + } + } } }, "definitions": { + "constvar.CarFlag": { + "type": "integer", + "enum": [ + 1, + 2, + 3 + ], + "x-enum-comments": { + "AllCar": "鍏ㄨ溅", + "LeftHalfCar": "宸﹀崐杞�", + "RightHalfCar": "鍙冲崐杞�" + }, + "x-enum-varnames": [ + "LeftHalfCar", + "RightHalfCar", + "AllCar" + ] + }, "constvar.DictType": { "type": "integer", "enum": [ @@ -456,6 +636,7 @@ "$ref": "#/definitions/gorm.DeletedAt" }, "fineness": { + "description": "绾ゅ害", "type": "number" }, "finenessRegisterID": { @@ -465,12 +646,15 @@ "type": "integer" }, "position": { + "description": "杞﹀彿", "type": "integer" }, "quantity": { + "description": "鏁伴噺", "type": "number" }, "sum": { + "description": "绾ゅ害鍚堣", "type": "number" }, "updatedAt": { @@ -481,15 +665,15 @@ "models.FinenessRegister": { "type": "object", "properties": { + "circle": { + "description": "鍥炴暟", + "type": "integer" + }, "createdAt": { "type": "string" }, "deletedAt": { "$ref": "#/definitions/gorm.DeletedAt" - }, - "endCircle": { - "description": "缁撴潫鍥炴暟", - "type": "integer" }, "finenessList": { "type": "array", @@ -520,15 +704,15 @@ "description": "瑙勬牸", "type": "string" }, - "startCircle": { - "description": "寮�濮嬪洖鏁�", - "type": "integer" - }, "sumFineness": { "type": "number" }, "sumQuantity": { "type": "number" + }, + "totalCircle": { + "description": "鎬诲洖鏁�", + "type": "integer" }, "updatedAt": { "type": "string" @@ -571,6 +755,41 @@ } } }, + "models.WorkshopManage": { + "type": "object", + "properties": { + "carFlag": { + "$ref": "#/definitions/constvar.CarFlag" + }, + "createdAt": { + "type": "string" + }, + "deletedAt": { + "$ref": "#/definitions/gorm.DeletedAt" + }, + "endCarNumber": { + "type": "integer" + }, + "groupNumber": { + "type": "integer" + }, + "id": { + "type": "integer" + }, + "notes": { + "type": "string" + }, + "startCarNumber": { + "type": "integer" + }, + "updatedAt": { + "type": "string" + }, + "workshopNumber": { + "type": "string" + } + } + }, "request.AddDict": { "type": "object", "properties": { @@ -599,11 +818,12 @@ "request.AddFinenessRegister": { "type": "object", "properties": { - "endCircle": { - "description": "缁撴潫鍥炴暟", + "circle": { + "description": "鍥炴暟", "type": "integer" }, "finenessList": { + "description": "绾ゅ害鏁扮粍", "type": "array", "items": { "$ref": "#/definitions/request.FinenessItem" @@ -633,15 +853,17 @@ "description": "瑙勬牸", "type": "string" }, - "startCircle": { - "description": "寮�濮嬪洖鏁�", - "type": "integer" - }, "sumFineness": { + "description": "鍚堣绾ゅ害", "type": "number" }, "sumQuantity": { + "description": "鍚堣鏁伴噺", "type": "number" + }, + "totalCircle": { + "description": "鎬诲洖鏁�", + "type": "integer" }, "workshopGroup": { "description": "杞︾粍", @@ -653,15 +875,19 @@ "type": "object", "properties": { "fineness": { + "description": "绾ゅ害", "type": "number" }, "position": { + "description": "杞﹀彿", "type": "integer" }, "quantity": { + "description": "鏁伴噺", "type": "number" }, "sum": { + "description": "鍚堣", "type": "number" } } diff --git a/docs/swagger.json b/docs/swagger.json index f41e17b..51c491c 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -146,6 +146,62 @@ } } }, + "/api-jl/v1/system/deletePriceStandard/{id}": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "绯荤粺璁剧疆/鐢熶笣瀹氫环鏍囧噯" + ], + "summary": "鍒犻櫎鐢熶笣瀹氫环鏍囧噯", + "parameters": [ + { + "type": "string", + "description": "id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "$ref": "#/definitions/util.Response" + } + } + } + } + }, + "/api-jl/v1/system/deleteWorkshopManage/{id}": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "绯荤粺璁剧疆/杞﹂棿绠$悊" + ], + "summary": "鍒犻櫎杞﹂棿绠$悊", + "parameters": [ + { + "type": "string", + "description": "id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "$ref": "#/definitions/util.Response" + } + } + } + } + }, "/api-jl/v1/system/dict": { "get": { "produces": [ @@ -313,20 +369,96 @@ "summary": "鑾峰彇鐢熶笣瀹氫环鏍囧噯", "parameters": [ { - "description": "鍙傛暟", - "name": "object", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/models.RawSilkPriceStandard" - } + "type": "string", + "name": "keyWord", + "in": "query" + }, + { + "type": "integer", + "description": "椤电爜", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "姣忛〉澶у皬", + "name": "pageSize", + "in": "query" } ], "responses": { "200": { "description": "鎴愬姛", "schema": { - "$ref": "#/definitions/util.Response" + "allOf": [ + { + "$ref": "#/definitions/util.ResponseList" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/models.RawSilkPriceStandard" + } + } + } + } + ] + } + } + } + } + }, + "/api-jl/v1/system/getWorkshopManageList": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "绯荤粺璁剧疆/杞﹂棿绠$悊" + ], + "summary": "鑾峰彇杞﹂棿绠$悊鍒楄〃", + "parameters": [ + { + "type": "string", + "name": "keyWord", + "in": "query" + }, + { + "type": "integer", + "description": "椤电爜", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "姣忛〉澶у皬", + "name": "pageSize", + "in": "query" + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/util.ResponseList" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/models.WorkshopManage" + } + } + } + } + ] } } } @@ -361,9 +493,57 @@ } } } + }, + "/api-jl/v1/system/saveWorkshopManage": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "绯荤粺璁剧疆/杞﹂棿绠$悊" + ], + "summary": "淇濆瓨杞﹂棿绠$悊", + "parameters": [ + { + "description": "鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.WorkshopManage" + } + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "$ref": "#/definitions/util.Response" + } + } + } + } } }, "definitions": { + "constvar.CarFlag": { + "type": "integer", + "enum": [ + 1, + 2, + 3 + ], + "x-enum-comments": { + "AllCar": "鍏ㄨ溅", + "LeftHalfCar": "宸﹀崐杞�", + "RightHalfCar": "鍙冲崐杞�" + }, + "x-enum-varnames": [ + "LeftHalfCar", + "RightHalfCar", + "AllCar" + ] + }, "constvar.DictType": { "type": "integer", "enum": [ @@ -444,6 +624,7 @@ "$ref": "#/definitions/gorm.DeletedAt" }, "fineness": { + "description": "绾ゅ害", "type": "number" }, "finenessRegisterID": { @@ -453,12 +634,15 @@ "type": "integer" }, "position": { + "description": "杞﹀彿", "type": "integer" }, "quantity": { + "description": "鏁伴噺", "type": "number" }, "sum": { + "description": "绾ゅ害鍚堣", "type": "number" }, "updatedAt": { @@ -469,15 +653,15 @@ "models.FinenessRegister": { "type": "object", "properties": { + "circle": { + "description": "鍥炴暟", + "type": "integer" + }, "createdAt": { "type": "string" }, "deletedAt": { "$ref": "#/definitions/gorm.DeletedAt" - }, - "endCircle": { - "description": "缁撴潫鍥炴暟", - "type": "integer" }, "finenessList": { "type": "array", @@ -508,15 +692,15 @@ "description": "瑙勬牸", "type": "string" }, - "startCircle": { - "description": "寮�濮嬪洖鏁�", - "type": "integer" - }, "sumFineness": { "type": "number" }, "sumQuantity": { "type": "number" + }, + "totalCircle": { + "description": "鎬诲洖鏁�", + "type": "integer" }, "updatedAt": { "type": "string" @@ -559,6 +743,41 @@ } } }, + "models.WorkshopManage": { + "type": "object", + "properties": { + "carFlag": { + "$ref": "#/definitions/constvar.CarFlag" + }, + "createdAt": { + "type": "string" + }, + "deletedAt": { + "$ref": "#/definitions/gorm.DeletedAt" + }, + "endCarNumber": { + "type": "integer" + }, + "groupNumber": { + "type": "integer" + }, + "id": { + "type": "integer" + }, + "notes": { + "type": "string" + }, + "startCarNumber": { + "type": "integer" + }, + "updatedAt": { + "type": "string" + }, + "workshopNumber": { + "type": "string" + } + } + }, "request.AddDict": { "type": "object", "properties": { @@ -587,11 +806,12 @@ "request.AddFinenessRegister": { "type": "object", "properties": { - "endCircle": { - "description": "缁撴潫鍥炴暟", + "circle": { + "description": "鍥炴暟", "type": "integer" }, "finenessList": { + "description": "绾ゅ害鏁扮粍", "type": "array", "items": { "$ref": "#/definitions/request.FinenessItem" @@ -621,15 +841,17 @@ "description": "瑙勬牸", "type": "string" }, - "startCircle": { - "description": "寮�濮嬪洖鏁�", - "type": "integer" - }, "sumFineness": { + "description": "鍚堣绾ゅ害", "type": "number" }, "sumQuantity": { + "description": "鍚堣鏁伴噺", "type": "number" + }, + "totalCircle": { + "description": "鎬诲洖鏁�", + "type": "integer" }, "workshopGroup": { "description": "杞︾粍", @@ -641,15 +863,19 @@ "type": "object", "properties": { "fineness": { + "description": "绾ゅ害", "type": "number" }, "position": { + "description": "杞﹀彿", "type": "integer" }, "quantity": { + "description": "鏁伴噺", "type": "number" }, "sum": { + "description": "鍚堣", "type": "number" } } diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 5a82bcc..2370fa4 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1,4 +1,18 @@ definitions: + constvar.CarFlag: + enum: + - 1 + - 2 + - 3 + type: integer + x-enum-comments: + AllCar: 鍏ㄨ溅 + LeftHalfCar: 宸﹀崐杞� + RightHalfCar: 鍙冲崐杞� + x-enum-varnames: + - LeftHalfCar + - RightHalfCar + - AllCar constvar.DictType: enum: - 0 @@ -55,29 +69,33 @@ deletedAt: $ref: '#/definitions/gorm.DeletedAt' fineness: + description: 绾ゅ害 type: number finenessRegisterID: type: integer id: type: integer position: + description: 杞﹀彿 type: integer quantity: + description: 鏁伴噺 type: number sum: + description: 绾ゅ害鍚堣 type: number updatedAt: type: string type: object models.FinenessRegister: properties: + circle: + description: 鍥炴暟 + type: integer createdAt: type: string deletedAt: $ref: '#/definitions/gorm.DeletedAt' - endCircle: - description: 缁撴潫鍥炴暟 - type: integer finenessList: items: $ref: '#/definitions/models.FinenessItem' @@ -99,13 +117,13 @@ spec: description: 瑙勬牸 type: string - startCircle: - description: 寮�濮嬪洖鏁� - type: integer sumFineness: type: number sumQuantity: type: number + totalCircle: + description: 鎬诲洖鏁� + type: integer updatedAt: type: string workshopGroup: @@ -133,6 +151,29 @@ updatedAt: type: string type: object + models.WorkshopManage: + properties: + carFlag: + $ref: '#/definitions/constvar.CarFlag' + createdAt: + type: string + deletedAt: + $ref: '#/definitions/gorm.DeletedAt' + endCarNumber: + type: integer + groupNumber: + type: integer + id: + type: integer + notes: + type: string + startCarNumber: + type: integer + updatedAt: + type: string + workshopNumber: + type: string + type: object request.AddDict: properties: dictType: @@ -151,10 +192,11 @@ type: object request.AddFinenessRegister: properties: - endCircle: - description: 缁撴潫鍥炴暟 + circle: + description: 鍥炴暟 type: integer finenessList: + description: 绾ゅ害鏁扮粍 items: $ref: '#/definitions/request.FinenessItem' type: array @@ -176,13 +218,15 @@ spec: description: 瑙勬牸 type: string - startCircle: - description: 寮�濮嬪洖鏁� - type: integer sumFineness: + description: 鍚堣绾ゅ害 type: number sumQuantity: + description: 鍚堣鏁伴噺 type: number + totalCircle: + description: 鎬诲洖鏁� + type: integer workshopGroup: description: 杞︾粍 type: string @@ -190,12 +234,16 @@ request.FinenessItem: properties: fineness: + description: 绾ゅ害 type: number position: + description: 杞﹀彿 type: integer quantity: + description: 鏁伴噺 type: number sum: + description: 鍚堣 type: number type: object request.UpdateDict: @@ -326,6 +374,42 @@ summary: 绾ゅ害鐧昏璇︽儏 tags: - 绾ゅ害鐧昏 + /api-jl/v1/system/deletePriceStandard/{id}: + delete: + parameters: + - description: id + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 鎴愬姛 + schema: + $ref: '#/definitions/util.Response' + summary: 鍒犻櫎鐢熶笣瀹氫环鏍囧噯 + tags: + - 绯荤粺璁剧疆/鐢熶笣瀹氫环鏍囧噯 + /api-jl/v1/system/deleteWorkshopManage/{id}: + delete: + parameters: + - description: id + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 鎴愬姛 + schema: + $ref: '#/definitions/util.Response' + summary: 鍒犻櫎杞﹂棿绠$悊 + tags: + - 绯荤粺璁剧疆/杞﹂棿绠$悊 /api-jl/v1/system/dict: get: parameters: @@ -430,22 +514,65 @@ /api-jl/v1/system/getPriceStandardList: get: parameters: - - description: 鍙傛暟 - in: body - name: object - required: true - schema: - $ref: '#/definitions/models.RawSilkPriceStandard' + - in: query + name: keyWord + type: string + - description: 椤电爜 + in: query + name: page + type: integer + - description: 姣忛〉澶у皬 + in: query + name: pageSize + type: integer produces: - application/json responses: "200": description: 鎴愬姛 schema: - $ref: '#/definitions/util.Response' + allOf: + - $ref: '#/definitions/util.ResponseList' + - properties: + data: + items: + $ref: '#/definitions/models.RawSilkPriceStandard' + type: array + type: object summary: 鑾峰彇鐢熶笣瀹氫环鏍囧噯 tags: - 绯荤粺璁剧疆/鐢熶笣瀹氫环鏍囧噯 + /api-jl/v1/system/getWorkshopManageList: + get: + parameters: + - in: query + name: keyWord + type: string + - description: 椤电爜 + in: query + name: page + type: integer + - description: 姣忛〉澶у皬 + in: query + name: pageSize + type: integer + produces: + - application/json + responses: + "200": + description: 鎴愬姛 + schema: + allOf: + - $ref: '#/definitions/util.ResponseList' + - properties: + data: + items: + $ref: '#/definitions/models.WorkshopManage' + type: array + type: object + summary: 鑾峰彇杞﹂棿绠$悊鍒楄〃 + tags: + - 绯荤粺璁剧疆/杞﹂棿绠$悊 /api-jl/v1/system/savePriceStandard: post: parameters: @@ -465,4 +592,23 @@ summary: 淇濆瓨鐢熶笣瀹氫环鏍囧噯 tags: - 绯荤粺璁剧疆/鐢熶笣瀹氫环鏍囧噯 + /api-jl/v1/system/saveWorkshopManage: + post: + parameters: + - description: 鍙傛暟 + in: body + name: object + required: true + schema: + $ref: '#/definitions/models.WorkshopManage' + produces: + - application/json + responses: + "200": + description: 鎴愬姛 + schema: + $ref: '#/definitions/util.Response' + summary: 淇濆瓨杞﹂棿绠$悊 + tags: + - 绯荤粺璁剧疆/杞﹂棿绠$悊 swagger: "2.0" diff --git a/models/db.go b/models/db.go index acec2fd..c57b80a 100644 --- a/models/db.go +++ b/models/db.go @@ -76,6 +76,7 @@ Dict{}, FinenessRegister{}, FinenessItem{}, + FinenessCheck{}, ) return err } diff --git a/models/fineness.go b/models/fineness.go index e8e7238..9767bc8 100644 --- a/models/fineness.go +++ b/models/fineness.go @@ -17,8 +17,8 @@ WorkshopGroup string `gorm:"type:varchar(255);not null;comment:杞︾粍" json:"workshopGroup"` //杞︾粍 Market string `gorm:"type:varchar(255);not null;comment:搴勫彛" json:"market"` //搴勫彛 Spec string `gorm:"type:varchar(255);not null;comment:瑙勬牸" json:"spec"` //瑙勬牸 - StartCircle uint8 `gorm:"type:varchar(255);not null;comment:寮�濮嬪洖鏁�" json:"startCircle"` //寮�濮嬪洖鏁� - EndCircle uint8 `gorm:"type:varchar(255);not null;comment:缁撴潫鍥炴暟" json:"endCircle"` //缁撴潫鍥炴暟 + Circle uint8 `gorm:"not null;comment:鍥炴暟" json:"circle"` //鍥炴暟 + TotalCircle uint8 `gorm:"not null;comment:鎬诲洖鏁�" json:"totalCircle"` //鎬诲洖鏁� FinenessList []FinenessItem `gorm:"foreignkey:FinenessRegisterID;references:ID" json:"finenessList"` SumFineness decimal.Decimal `gorm:"type:decimal(12,2);not null;comment:鍚堣绾ゅ害" json:"sumFineness"` SumQuantity decimal.Decimal `gorm:"type:decimal(12,2);not null;comment:鍚堣鏁伴噺" json:"sumQuantity"` diff --git a/models/fineness_check.go b/models/fineness_check.go new file mode 100644 index 0000000..3bdecfe --- /dev/null +++ b/models/fineness_check.go @@ -0,0 +1,253 @@ +package models + +import ( + "fmt" + "github.com/shopspring/decimal" + "gorm.io/gorm" + "silkserver/pkg/mysqlx" +) + +type ( + // FinenessCheck 绾ゅ害妫�楠� + FinenessCheck struct { + gorm.Model + FinenessRegisterID uint `gorm:"not null;comment:绾ゅ害鐧昏琛↖D" json:"finenessRegisterID"` //绾ゅ害鐧昏琛↖D + FinenessRegister FinenessRegister `gorm:"foreignkey:FinenessRegisterID;" json:"finenessRegister"` //绾ゅ害鐧昏 + AverageFineness decimal.Decimal `gorm:"type:decimal(12,2);not null;comment:骞冲潎绾ゅ害" json:"averageFineness"` //骞冲潎绾ゅ害 + MeasureFineness decimal.Decimal `gorm:"type:decimal(12,2);not null;comment:鍏噺绾ゅ害" json:"measureFineness"` //鍏噺绾ゅ害 + Deviation decimal.Decimal `gorm:"type:decimal(12,2);not null;comment:鍋忓樊" json:"deviation"` //鍋忓樊 + TotalDeviation decimal.Decimal `gorm:"type:decimal(12,2);not null;comment:鎬诲樊" json:"totalDeviation"` //鎬诲樊 + FinenessGrade string `gorm:"type:varchar(255);not null;comment:绾ゅ害绛夌骇" json:"finenessGrade"` //绾ゅ害绛夌骇 + Cleanliness string `gorm:"type:varchar(255);not null;comment:娓呮磥搴�" json:"cleanliness"` //娓呮磥搴� + Purity string `gorm:"type:varchar(255);not null;comment:娲佸噣搴�" json:"purity"` //娲佸噣搴� + TwiceChange string `gorm:"type:varchar(255);not null;comment:浜屽害鍙樺寲" json:"twiceChange"` //浜屽害鍙樺寲 + MarketProcessOrderNumber string `gorm:"type:varchar(255);not null;comment:搴勫彛宸ヨ壓鍗曠紪鍙�" json:"marketProcessOrderNumber"` //搴勫彛宸ヨ壓鍗曠紪鍙� + Inspector string `gorm:"type:varchar(255);not null;comment:妫�楠屽憳" json:"inspector"` //妫�楠屽憳 + } + FinenessCheckSearch struct { + FinenessCheck + Order string + PageNum int + PageSize int + Orm *gorm.DB + Preload bool + } +) + +func (slf *FinenessCheck) TableName() string { + return "fineness_check" +} + +func NewFinenessCheckSearch() *FinenessCheckSearch { + return &FinenessCheckSearch{Orm: mysqlx.GetDB()} +} + +func (slf *FinenessCheckSearch) SetOrm(tx *gorm.DB) *FinenessCheckSearch { + slf.Orm = tx + return slf +} + +func (slf *FinenessCheckSearch) SetPage(page, size int) *FinenessCheckSearch { + slf.PageNum, slf.PageSize = page, size + return slf +} + +func (slf *FinenessCheckSearch) SetOrder(order string) *FinenessCheckSearch { + slf.Order = order + return slf +} + +func (slf *FinenessCheckSearch) SetPreload() *FinenessCheckSearch { + slf.Preload = true + return slf +} + +func (slf *FinenessCheckSearch) SetID(id uint) *FinenessCheckSearch { + slf.ID = id + return slf +} + +func (slf *FinenessCheckSearch) build() *gorm.DB { + var db = slf.Orm.Table(slf.TableName()) + + if slf.ID != 0 { + db = db.Where("id = ?", slf.ID) + } + + if slf.Order != "" { + db = db.Order(slf.Order) + } + if slf.Preload { + db = db.Model(&FinenessCheck{}).Preload("FinenessRegister") + } + + return db +} + +// Create 鍗曟潯鎻掑叆 +func (slf *FinenessCheckSearch) Create(record *FinenessCheck) error { + var db = slf.build() + + if err := db.Create(record).Error; err != nil { + return fmt.Errorf("create err: %v, record: %+v", err, record) + } + + return nil +} + +// CreateBatch 鎵归噺鎻掑叆 +func (slf *FinenessCheckSearch) CreateBatch(records []*FinenessCheck) error { + var db = slf.build() + + if err := db.Create(&records).Error; err != nil { + return fmt.Errorf("create batch err: %v, records: %+v", err, records) + } + + return nil +} + +func (slf *FinenessCheckSearch) Save(record *FinenessCheck) error { + var db = slf.build() + + if err := db.Omit("CreatedAt").Save(record).Error; err != nil { + return fmt.Errorf("save err: %v, record: %+v", err, record) + } + + return nil +} + +func (slf *FinenessCheckSearch) Update(record *FinenessCheck) error { + var db = slf.build() + + if err := db.Updates(record).Error; err != nil { + return fmt.Errorf("save err: %v, record: %+v", err, record) + } + + return nil +} + +func (slf *FinenessCheckSearch) UpdateByMap(upMap map[string]interface{}) error { + var ( + db = slf.build() + ) + + if err := db.Updates(upMap).Error; err != nil { + return fmt.Errorf("update by map err: %v, upMap: %+v", err, upMap) + } + + return nil +} + +func (slf *FinenessCheckSearch) UpdateByQuery(query string, args []interface{}, upMap map[string]interface{}) error { + var ( + db = slf.Orm.Table(slf.TableName()).Where(query, args...) + ) + + if err := db.Updates(upMap).Error; err != nil { + return fmt.Errorf("update by query err: %v, query: %s, args: %+v, upMap: %+v", err, query, args, upMap) + } + + return nil +} + +func (slf *FinenessCheckSearch) Delete() error { + var db = slf.build() + + if err := db.Unscoped().Delete(&FinenessCheck{}).Error; err != nil { + return err + } + + return nil +} + +func (slf *FinenessCheckSearch) First() (*FinenessCheck, error) { + var ( + record = new(FinenessCheck) + db = slf.build() + ) + + if err := db.First(record).Error; err != nil { + return record, err + } + + return record, nil +} + +func (slf *FinenessCheckSearch) Find() ([]*FinenessCheck, int64, error) { + var ( + records = make([]*FinenessCheck, 0) + total int64 + db = slf.build() + ) + + if err := db.Count(&total).Error; err != nil { + return records, total, fmt.Errorf("find count err: %v", err) + } + if slf.PageNum*slf.PageSize > 0 { + db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) + } + if err := db.Find(&records).Error; err != nil { + return records, total, fmt.Errorf("find records err: %v", err) + } + + return records, total, nil +} + +func (slf *FinenessCheckSearch) FindAll() ([]*FinenessCheck, error) { + var ( + records = make([]*FinenessCheck, 0) + db = slf.build() + ) + + if slf.PageNum*slf.PageSize > 0 { + db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) + } + if err := db.Find(&records).Error; err != nil { + return records, fmt.Errorf("find records err: %v", err) + } + + return records, nil +} + +// FindByQuery 鎸囧畾鏉′欢鏌ヨ. +func (slf *FinenessCheckSearch) FindByQuery(query string, args []interface{}) ([]*FinenessCheck, int64, error) { + var ( + records = make([]*FinenessCheck, 0) + total int64 + db = slf.Orm.Table(slf.TableName()).Where(query, args...) + ) + + if err := db.Count(&total).Error; err != nil { + return records, total, fmt.Errorf("find by query count err: %v", err) + } + if slf.PageNum*slf.PageSize > 0 { + db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) + } + if err := db.Find(&records).Error; err != nil { + return records, total, fmt.Errorf("find by query records err: %v, query: %s, args: %+v", err, query, args) + } + + return records, total, nil +} + +// FindByQueryNotTotal 鎸囧畾鏉′欢鏌ヨ&涓嶆煡璇㈡�绘潯鏁�. +func (slf *FinenessCheckSearch) FindByQueryNotTotal(query string, args []interface{}) ([]*FinenessCheck, error) { + var ( + records = make([]*FinenessCheck, 0) + db = slf.Orm.Table(slf.TableName()).Where(query, args...) + ) + + if slf.PageNum*slf.PageSize > 0 { + db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) + } + if err := db.Find(&records).Error; err != nil { + return records, fmt.Errorf("find by query records err: %v, query: %s, args: %+v", err, query, args) + } + + return records, nil +} + +// InitDefaultData 鍒濆鍖栨暟鎹� +func (slf *FinenessCheckSearch) InitDefaultData() error { + return nil +} diff --git a/models/fineness_check_item.go b/models/fineness_check_item.go new file mode 100644 index 0000000..0efd875 --- /dev/null +++ b/models/fineness_check_item.go @@ -0,0 +1,259 @@ +package models + +import ( + "fmt" + "github.com/shopspring/decimal" + "gorm.io/gorm" + "silkserver/pkg/mysqlx" +) + +type ( + // FinenessCheckItem 绾ゅ害妫�楠屾槑缁� + FinenessCheckItem struct { + gorm.Model + FinenessRegisterID uint `gorm:"not null;comment:绾ゅ害鐧昏琛↖D" json:"finenessRegisterID"` //绾ゅ害鐧昏琛↖D + FinenessCheckID uint `gorm:"not null;comment:绾ゅ害妫�楠岃〃ID" json:"finenessCheckID"` //绾ゅ害妫�楠岃〃ID + Position int8 `json:"position"` //杞﹀彿 + FinenessRoundingItem FinenessRoundingItem + AverageFineness decimal.Decimal `gorm:"type:decimal(12,2);not null;comment:骞冲潎绾ゅ害" json:"averageFineness"` //骞冲潎绾ゅ害 + MeasureFineness decimal.Decimal `gorm:"type:decimal(12,2);not null;comment:鍏噺绾ゅ害" json:"measureFineness"` //鍏噺绾ゅ害 + Deviation decimal.Decimal `gorm:"type:decimal(12,2);not null;comment:鍋忓樊" json:"deviation"` //鍋忓樊 + TotalDeviation decimal.Decimal `gorm:"type:decimal(12,2);not null;comment:鎬诲樊" json:"totalDeviation"` //鎬诲樊 + FinenessGrade string `gorm:"type:varchar(255);not null;comment:绾ゅ害绛夌骇" json:"finenessGrade"` //绾ゅ害绛夌骇 + Cleanliness string `gorm:"type:varchar(255);not null;comment:娓呮磥搴�" json:"cleanliness"` //娓呮磥搴� + Purity string `gorm:"type:varchar(255);not null;comment:娲佸噣搴�" json:"purity"` //娲佸噣搴� + TwiceChange string `gorm:"type:varchar(255);not null;comment:浜屽害鍙樺寲" json:"twiceChange"` //浜屽害鍙樺寲 + Remark string `gorm:"type:varchar(255);not null;comment:澶囨敞" json:"remark"` //澶囨敞 + } + + FinenessRoundingItem struct { + Fineness decimal.Decimal `json:"fineness"` //绾ゅ害 + Quantity decimal.Decimal `json:"quantity"` //鏁伴噺 + } + FinenessCheckItemSearch struct { + FinenessCheckItem + Order string + PageNum int + PageSize int + Orm *gorm.DB + Preload bool + } +) + +func (slf *FinenessCheckItem) TableName() string { + return "fineness_check" +} + +func NewFinenessCheckItemSearch() *FinenessCheckItemSearch { + return &FinenessCheckItemSearch{Orm: mysqlx.GetDB()} +} + +func (slf *FinenessCheckItemSearch) SetOrm(tx *gorm.DB) *FinenessCheckItemSearch { + slf.Orm = tx + return slf +} + +func (slf *FinenessCheckItemSearch) SetPage(page, size int) *FinenessCheckItemSearch { + slf.PageNum, slf.PageSize = page, size + return slf +} + +func (slf *FinenessCheckItemSearch) SetOrder(order string) *FinenessCheckItemSearch { + slf.Order = order + return slf +} + +func (slf *FinenessCheckItemSearch) SetPreload() *FinenessCheckItemSearch { + slf.Preload = true + return slf +} + +func (slf *FinenessCheckItemSearch) SetID(id uint) *FinenessCheckItemSearch { + slf.ID = id + return slf +} + +func (slf *FinenessCheckItemSearch) build() *gorm.DB { + var db = slf.Orm.Table(slf.TableName()) + + if slf.ID != 0 { + db = db.Where("id = ?", slf.ID) + } + + if slf.Order != "" { + db = db.Order(slf.Order) + } + if slf.Preload { + db = db.Model(&FinenessCheckItem{}).Preload("FinenessRegister") + } + + return db +} + +// Create 鍗曟潯鎻掑叆 +func (slf *FinenessCheckItemSearch) Create(record *FinenessCheckItem) error { + var db = slf.build() + + if err := db.Create(record).Error; err != nil { + return fmt.Errorf("create err: %v, record: %+v", err, record) + } + + return nil +} + +// CreateBatch 鎵归噺鎻掑叆 +func (slf *FinenessCheckItemSearch) CreateBatch(records []*FinenessCheckItem) error { + var db = slf.build() + + if err := db.Create(&records).Error; err != nil { + return fmt.Errorf("create batch err: %v, records: %+v", err, records) + } + + return nil +} + +func (slf *FinenessCheckItemSearch) Save(record *FinenessCheckItem) error { + var db = slf.build() + + if err := db.Omit("CreatedAt").Save(record).Error; err != nil { + return fmt.Errorf("save err: %v, record: %+v", err, record) + } + + return nil +} + +func (slf *FinenessCheckItemSearch) Update(record *FinenessCheckItem) error { + var db = slf.build() + + if err := db.Updates(record).Error; err != nil { + return fmt.Errorf("save err: %v, record: %+v", err, record) + } + + return nil +} + +func (slf *FinenessCheckItemSearch) UpdateByMap(upMap map[string]interface{}) error { + var ( + db = slf.build() + ) + + if err := db.Updates(upMap).Error; err != nil { + return fmt.Errorf("update by map err: %v, upMap: %+v", err, upMap) + } + + return nil +} + +func (slf *FinenessCheckItemSearch) UpdateByQuery(query string, args []interface{}, upMap map[string]interface{}) error { + var ( + db = slf.Orm.Table(slf.TableName()).Where(query, args...) + ) + + if err := db.Updates(upMap).Error; err != nil { + return fmt.Errorf("update by query err: %v, query: %s, args: %+v, upMap: %+v", err, query, args, upMap) + } + + return nil +} + +func (slf *FinenessCheckItemSearch) Delete() error { + var db = slf.build() + + if err := db.Unscoped().Delete(&FinenessCheckItem{}).Error; err != nil { + return err + } + + return nil +} + +func (slf *FinenessCheckItemSearch) First() (*FinenessCheckItem, error) { + var ( + record = new(FinenessCheckItem) + db = slf.build() + ) + + if err := db.First(record).Error; err != nil { + return record, err + } + + return record, nil +} + +func (slf *FinenessCheckItemSearch) Find() ([]*FinenessCheckItem, int64, error) { + var ( + records = make([]*FinenessCheckItem, 0) + total int64 + db = slf.build() + ) + + if err := db.Count(&total).Error; err != nil { + return records, total, fmt.Errorf("find count err: %v", err) + } + if slf.PageNum*slf.PageSize > 0 { + db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) + } + if err := db.Find(&records).Error; err != nil { + return records, total, fmt.Errorf("find records err: %v", err) + } + + return records, total, nil +} + +func (slf *FinenessCheckItemSearch) FindAll() ([]*FinenessCheckItem, error) { + var ( + records = make([]*FinenessCheckItem, 0) + db = slf.build() + ) + + if slf.PageNum*slf.PageSize > 0 { + db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) + } + if err := db.Find(&records).Error; err != nil { + return records, fmt.Errorf("find records err: %v", err) + } + + return records, nil +} + +// FindByQuery 鎸囧畾鏉′欢鏌ヨ. +func (slf *FinenessCheckItemSearch) FindByQuery(query string, args []interface{}) ([]*FinenessCheckItem, int64, error) { + var ( + records = make([]*FinenessCheckItem, 0) + total int64 + db = slf.Orm.Table(slf.TableName()).Where(query, args...) + ) + + if err := db.Count(&total).Error; err != nil { + return records, total, fmt.Errorf("find by query count err: %v", err) + } + if slf.PageNum*slf.PageSize > 0 { + db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) + } + if err := db.Find(&records).Error; err != nil { + return records, total, fmt.Errorf("find by query records err: %v, query: %s, args: %+v", err, query, args) + } + + return records, total, nil +} + +// FindByQueryNotTotal 鎸囧畾鏉′欢鏌ヨ&涓嶆煡璇㈡�绘潯鏁�. +func (slf *FinenessCheckItemSearch) FindByQueryNotTotal(query string, args []interface{}) ([]*FinenessCheckItem, error) { + var ( + records = make([]*FinenessCheckItem, 0) + db = slf.Orm.Table(slf.TableName()).Where(query, args...) + ) + + if slf.PageNum*slf.PageSize > 0 { + db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) + } + if err := db.Find(&records).Error; err != nil { + return records, fmt.Errorf("find by query records err: %v, query: %s, args: %+v", err, query, args) + } + + return records, nil +} + +// InitDefaultData 鍒濆鍖栨暟鎹� +func (slf *FinenessCheckItemSearch) InitDefaultData() error { + return nil +} diff --git a/models/fineness_item.go b/models/fineness_item.go index 2db1931..e6cc5db 100644 --- a/models/fineness_item.go +++ b/models/fineness_item.go @@ -12,10 +12,10 @@ FinenessItem struct { gorm.Model FinenessRegisterID uint `json:"finenessRegisterID"` - Position int8 `json:"position"` - Fineness decimal.Decimal `json:"fineness"` - Quantity decimal.Decimal `json:"quantity"` - Sum decimal.Decimal `json:"sum"` + Position int8 `json:"position"` //杞﹀彿 + Fineness decimal.Decimal `json:"fineness"` //绾ゅ害 + Quantity decimal.Decimal `json:"quantity"` //鏁伴噺 + Sum decimal.Decimal `json:"sum"` //绾ゅ害鍚堣 } FinenessItemSearch struct { -- Gitblit v1.8.0