| | |
| | | ) |
| | | |
| | | 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 { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/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": [ |
| | |
| | | "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" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/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": [ |
| | |
| | | "$ref": "#/definitions/gorm.DeletedAt" |
| | | }, |
| | | "fineness": { |
| | | "description": "纤度", |
| | | "type": "number" |
| | | }, |
| | | "finenessRegisterID": { |
| | |
| | | "type": "integer" |
| | | }, |
| | | "position": { |
| | | "description": "车号", |
| | | "type": "integer" |
| | | }, |
| | | "quantity": { |
| | | "description": "数量", |
| | | "type": "number" |
| | | }, |
| | | "sum": { |
| | | "description": "纤度合计", |
| | | "type": "number" |
| | | }, |
| | | "updatedAt": { |
| | |
| | | "models.FinenessRegister": { |
| | | "type": "object", |
| | | "properties": { |
| | | "circle": { |
| | | "description": "回数", |
| | | "type": "integer" |
| | | }, |
| | | "createdAt": { |
| | | "type": "string" |
| | | }, |
| | | "deletedAt": { |
| | | "$ref": "#/definitions/gorm.DeletedAt" |
| | | }, |
| | | "endCircle": { |
| | | "description": "结束回数", |
| | | "type": "integer" |
| | | }, |
| | | "finenessList": { |
| | | "type": "array", |
| | |
| | | "description": "规格", |
| | | "type": "string" |
| | | }, |
| | | "startCircle": { |
| | | "description": "开始回数", |
| | | "type": "integer" |
| | | }, |
| | | "sumFineness": { |
| | | "type": "number" |
| | | }, |
| | | "sumQuantity": { |
| | | "type": "number" |
| | | }, |
| | | "totalCircle": { |
| | | "description": "总回数", |
| | | "type": "integer" |
| | | }, |
| | | "updatedAt": { |
| | | "type": "string" |
| | |
| | | } |
| | | } |
| | | }, |
| | | "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": { |
| | |
| | | "request.AddFinenessRegister": { |
| | | "type": "object", |
| | | "properties": { |
| | | "endCircle": { |
| | | "description": "结束回数", |
| | | "circle": { |
| | | "description": "回数", |
| | | "type": "integer" |
| | | }, |
| | | "finenessList": { |
| | | "description": "纤度数组", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/request.FinenessItem" |
| | |
| | | "description": "规格", |
| | | "type": "string" |
| | | }, |
| | | "startCircle": { |
| | | "description": "开始回数", |
| | | "type": "integer" |
| | | }, |
| | | "sumFineness": { |
| | | "description": "合计纤度", |
| | | "type": "number" |
| | | }, |
| | | "sumQuantity": { |
| | | "description": "合计数量", |
| | | "type": "number" |
| | | }, |
| | | "totalCircle": { |
| | | "description": "总回数", |
| | | "type": "integer" |
| | | }, |
| | | "workshopGroup": { |
| | | "description": "车组", |
| | |
| | | "type": "object", |
| | | "properties": { |
| | | "fineness": { |
| | | "description": "纤度", |
| | | "type": "number" |
| | | }, |
| | | "position": { |
| | | "description": "车号", |
| | | "type": "integer" |
| | | }, |
| | | "quantity": { |
| | | "description": "数量", |
| | | "type": "number" |
| | | }, |
| | | "sum": { |
| | | "description": "合计", |
| | | "type": "number" |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/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": [ |
| | |
| | | "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" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/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": [ |
| | |
| | | "$ref": "#/definitions/gorm.DeletedAt" |
| | | }, |
| | | "fineness": { |
| | | "description": "纤度", |
| | | "type": "number" |
| | | }, |
| | | "finenessRegisterID": { |
| | |
| | | "type": "integer" |
| | | }, |
| | | "position": { |
| | | "description": "车号", |
| | | "type": "integer" |
| | | }, |
| | | "quantity": { |
| | | "description": "数量", |
| | | "type": "number" |
| | | }, |
| | | "sum": { |
| | | "description": "纤度合计", |
| | | "type": "number" |
| | | }, |
| | | "updatedAt": { |
| | |
| | | "models.FinenessRegister": { |
| | | "type": "object", |
| | | "properties": { |
| | | "circle": { |
| | | "description": "回数", |
| | | "type": "integer" |
| | | }, |
| | | "createdAt": { |
| | | "type": "string" |
| | | }, |
| | | "deletedAt": { |
| | | "$ref": "#/definitions/gorm.DeletedAt" |
| | | }, |
| | | "endCircle": { |
| | | "description": "结束回数", |
| | | "type": "integer" |
| | | }, |
| | | "finenessList": { |
| | | "type": "array", |
| | |
| | | "description": "规格", |
| | | "type": "string" |
| | | }, |
| | | "startCircle": { |
| | | "description": "开始回数", |
| | | "type": "integer" |
| | | }, |
| | | "sumFineness": { |
| | | "type": "number" |
| | | }, |
| | | "sumQuantity": { |
| | | "type": "number" |
| | | }, |
| | | "totalCircle": { |
| | | "description": "总回数", |
| | | "type": "integer" |
| | | }, |
| | | "updatedAt": { |
| | | "type": "string" |
| | |
| | | } |
| | | } |
| | | }, |
| | | "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": { |
| | |
| | | "request.AddFinenessRegister": { |
| | | "type": "object", |
| | | "properties": { |
| | | "endCircle": { |
| | | "description": "结束回数", |
| | | "circle": { |
| | | "description": "回数", |
| | | "type": "integer" |
| | | }, |
| | | "finenessList": { |
| | | "description": "纤度数组", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/request.FinenessItem" |
| | |
| | | "description": "规格", |
| | | "type": "string" |
| | | }, |
| | | "startCircle": { |
| | | "description": "开始回数", |
| | | "type": "integer" |
| | | }, |
| | | "sumFineness": { |
| | | "description": "合计纤度", |
| | | "type": "number" |
| | | }, |
| | | "sumQuantity": { |
| | | "description": "合计数量", |
| | | "type": "number" |
| | | }, |
| | | "totalCircle": { |
| | | "description": "总回数", |
| | | "type": "integer" |
| | | }, |
| | | "workshopGroup": { |
| | | "description": "车组", |
| | |
| | | "type": "object", |
| | | "properties": { |
| | | "fineness": { |
| | | "description": "纤度", |
| | | "type": "number" |
| | | }, |
| | | "position": { |
| | | "description": "车号", |
| | | "type": "integer" |
| | | }, |
| | | "quantity": { |
| | | "description": "数量", |
| | | "type": "number" |
| | | }, |
| | | "sum": { |
| | | "description": "合计", |
| | | "type": "number" |
| | | } |
| | | } |
| | |
| | | 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 |
| | |
| | | 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' |
| | |
| | | spec: |
| | | description: 规格 |
| | | type: string |
| | | startCircle: |
| | | description: 开始回数 |
| | | type: integer |
| | | sumFineness: |
| | | type: number |
| | | sumQuantity: |
| | | type: number |
| | | totalCircle: |
| | | description: 总回数 |
| | | type: integer |
| | | updatedAt: |
| | | type: string |
| | | workshopGroup: |
| | |
| | | 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: |
| | |
| | | type: object |
| | | request.AddFinenessRegister: |
| | | properties: |
| | | endCircle: |
| | | description: 结束回数 |
| | | circle: |
| | | description: 回数 |
| | | type: integer |
| | | finenessList: |
| | | description: 纤度数组 |
| | | items: |
| | | $ref: '#/definitions/request.FinenessItem' |
| | | type: array |
| | |
| | | spec: |
| | | description: 规格 |
| | | type: string |
| | | startCircle: |
| | | description: 开始回数 |
| | | type: integer |
| | | sumFineness: |
| | | description: 合计纤度 |
| | | type: number |
| | | sumQuantity: |
| | | description: 合计数量 |
| | | type: number |
| | | totalCircle: |
| | | description: 总回数 |
| | | type: integer |
| | | workshopGroup: |
| | | description: 车组 |
| | | type: string |
| | |
| | | request.FinenessItem: |
| | | properties: |
| | | fineness: |
| | | description: 纤度 |
| | | type: number |
| | | position: |
| | | description: 车号 |
| | | type: integer |
| | | quantity: |
| | | description: 数量 |
| | | type: number |
| | | sum: |
| | | description: 合计 |
| | | type: number |
| | | type: object |
| | | request.UpdateDict: |
| | |
| | | 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: |
| | |
| | | /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: |
| | |
| | | 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" |
| | |
| | | Dict{}, |
| | | FinenessRegister{}, |
| | | FinenessItem{}, |
| | | FinenessCheck{}, |
| | | ) |
| | | return err |
| | | } |
| | |
| | | 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"` |
New file |
| | |
| | | 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:纤度登记表ID" json:"finenessRegisterID"` //纤度登记表ID |
| | | 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 |
| | | } |
New file |
| | |
| | | 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:纤度登记表ID" json:"finenessRegisterID"` //纤度登记表ID |
| | | 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 |
| | | } |
| | |
| | | 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 { |