From 12ead07c578158b98f7403aaaa2f96eb12b93f26 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期一, 29 四月 2024 15:16:24 +0800 Subject: [PATCH] 纤度登记检查车间车号配置 --- service/fineness.go | 7 - controllers/fineness.go | 10 ++ models/fineness.go | 17 +++-- controllers/request/fineness.go | 27 ++++---- docs/swagger.yaml | 20 ++++-- docs/docs.go | 32 +++++++--- docs/swagger.json | 32 +++++++--- controllers/workshop_manage_controller.go | 2 8 files changed, 90 insertions(+), 57 deletions(-) diff --git a/controllers/fineness.go b/controllers/fineness.go index 714ca28..7e1ed5b 100644 --- a/controllers/fineness.go +++ b/controllers/fineness.go @@ -39,9 +39,15 @@ return } - _, err := service.GetSilkRankStandard() + silkStandard, err := service.GetSilkRankStandard() if err != nil { util.ResponseFormat(c, code.RequestParamError, err.Error()) + return + } + + endCarMap, err := service.GetWorkshopEndCarMap(params.WorkshopNumber, params.WorkshopGroup) + if len(endCarMap) == 0 { + util.ResponseFormat(c, code.RequestParamError, "璇峰厛閰嶇疆瀵瑰簲杞﹂棿鐨勮溅鍙�") return } @@ -68,7 +74,7 @@ util.ResponseFormat(c, code.RequestParamError, "淇濆瓨澶辫触") } - err = service.FinenessCheck(¶ms, isNew) + err = service.FinenessCheck(¶ms, silkStandard, endCarMap, isNew) if err != nil { logx.Errorf("service.FinenessCheck err:%v, finenessRegister:%+v", err, params) util.ResponseFormat(c, code.RequestParamError, "鐢熸垚妫�楠岃〃澶辫触") diff --git a/controllers/request/fineness.go b/controllers/request/fineness.go index 026ff9c..47c5aa9 100644 --- a/controllers/request/fineness.go +++ b/controllers/request/fineness.go @@ -5,19 +5,20 @@ ) 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 int `gorm:"type:int(11);not null;default:0;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"` //鍚堣鏁伴噺 - Position int `gorm:"not null;default:0;comment:杞﹀彿" json:"position"` //鏈�鍚庝竴涓溅鍙� + 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"` //钀戒笣鏃堕棿 + WorkshopNumber string `json:"workshopNumber" gorm:"type:varchar(255);comment:杞﹂棿缂栧彿"` + WorkshopName string `json:"workshopName" gorm:"type:varchar(255);comment:杞﹂棿鍚嶇О"` + WorkshopGroup int `gorm:"type:int(11);not null;default:0;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"` //鍚堣鏁伴噺 + Position int `gorm:"not null;default:0;comment:杞﹀彿" json:"position"` //鏈�鍚庝竴涓溅鍙� } type FinenessItem struct { diff --git a/controllers/workshop_manage_controller.go b/controllers/workshop_manage_controller.go index 8cf5c99..07df3f0 100644 --- a/controllers/workshop_manage_controller.go +++ b/controllers/workshop_manage_controller.go @@ -172,7 +172,7 @@ util.ResponseFormat(c, code.RequestParamError, "鏌ユ壘澶辫触") return } - fineness, err := models.NewFinenessRegisterSearch().SetWorkshop(params.WorkshopName).SetWorkshopGroup(params.GroupNumber). + fineness, err := models.NewFinenessRegisterSearch().SetWorkshopName(params.WorkshopName).SetWorkshopGroup(params.GroupNumber). SetMarket(params.MarketName).First() if err != nil { if err == gorm.ErrRecordNotFound { diff --git a/docs/docs.go b/docs/docs.go index 17b211f..f56fb3f 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -2369,9 +2369,12 @@ 5, 6, 7, - 8 + 8, + 9, + 10 ], "x-enum-comments": { + "Absenteeism": "缂哄嫟", "EarlyWarningDay": "棰勮澶╂暟", "InspectionWayType": "璐ㄦ鏂瑰紡绫诲瀷", "MiniDictTypeBomVersionType": "Bom鐗堟湰绫诲瀷", @@ -2379,7 +2382,8 @@ "OutsourcingSupplierCreditGrade": "淇$敤绛夌骇", "OutsourcingSupplierRange": "渚涜揣鑼冨洿", "OutsourcingSupplierType": "濮斿渚涘簲鍟嗙被鍨�", - "SalaryType": "鍢夎仈钖祫绫诲瀷" + "SalaryType": "鍢夎仈钖祫绫诲瀷", + "WildSilk": "閲庣氦" }, "x-enum-varnames": [ "MiniDictTypePlcBrand", @@ -2389,7 +2393,9 @@ "OutsourcingSupplierType", "OutsourcingSupplierCreditGrade", "OutsourcingSupplierRange", - "SalaryType" + "SalaryType", + "WildSilk", + "Absenteeism" ] }, "constvar.WorkerStatus": { @@ -2753,10 +2759,6 @@ "description": "搴勫彛", "type": "string" }, - "name": { - "description": "杞﹂棿", - "type": "string" - }, "number": { "description": "缂栧彿", "type": "string" @@ -2785,6 +2787,12 @@ "workshopGroup": { "description": "杞︾粍", "type": "integer" + }, + "workshopName": { + "type": "string" + }, + "workshopNumber": { + "type": "string" } } }, @@ -3359,10 +3367,6 @@ "description": "搴勫彛", "type": "string" }, - "name": { - "description": "杞﹂棿", - "type": "string" - }, "number": { "description": "缂栧彿", "type": "string" @@ -3390,6 +3394,12 @@ "workshopGroup": { "description": "杞︾粍", "type": "integer" + }, + "workshopName": { + "type": "string" + }, + "workshopNumber": { + "type": "string" } } }, diff --git a/docs/swagger.json b/docs/swagger.json index 2e1c8b7..63085e3 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -2357,9 +2357,12 @@ 5, 6, 7, - 8 + 8, + 9, + 10 ], "x-enum-comments": { + "Absenteeism": "缂哄嫟", "EarlyWarningDay": "棰勮澶╂暟", "InspectionWayType": "璐ㄦ鏂瑰紡绫诲瀷", "MiniDictTypeBomVersionType": "Bom鐗堟湰绫诲瀷", @@ -2367,7 +2370,8 @@ "OutsourcingSupplierCreditGrade": "淇$敤绛夌骇", "OutsourcingSupplierRange": "渚涜揣鑼冨洿", "OutsourcingSupplierType": "濮斿渚涘簲鍟嗙被鍨�", - "SalaryType": "鍢夎仈钖祫绫诲瀷" + "SalaryType": "鍢夎仈钖祫绫诲瀷", + "WildSilk": "閲庣氦" }, "x-enum-varnames": [ "MiniDictTypePlcBrand", @@ -2377,7 +2381,9 @@ "OutsourcingSupplierType", "OutsourcingSupplierCreditGrade", "OutsourcingSupplierRange", - "SalaryType" + "SalaryType", + "WildSilk", + "Absenteeism" ] }, "constvar.WorkerStatus": { @@ -2741,10 +2747,6 @@ "description": "搴勫彛", "type": "string" }, - "name": { - "description": "杞﹂棿", - "type": "string" - }, "number": { "description": "缂栧彿", "type": "string" @@ -2773,6 +2775,12 @@ "workshopGroup": { "description": "杞︾粍", "type": "integer" + }, + "workshopName": { + "type": "string" + }, + "workshopNumber": { + "type": "string" } } }, @@ -3347,10 +3355,6 @@ "description": "搴勫彛", "type": "string" }, - "name": { - "description": "杞﹂棿", - "type": "string" - }, "number": { "description": "缂栧彿", "type": "string" @@ -3378,6 +3382,12 @@ "workshopGroup": { "description": "杞︾粍", "type": "integer" + }, + "workshopName": { + "type": "string" + }, + "workshopNumber": { + "type": "string" } } }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 2f13f68..e685d01 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -88,8 +88,11 @@ - 6 - 7 - 8 + - 9 + - 10 type: integer x-enum-comments: + Absenteeism: 缂哄嫟 EarlyWarningDay: 棰勮澶╂暟 InspectionWayType: 璐ㄦ鏂瑰紡绫诲瀷 MiniDictTypeBomVersionType: Bom鐗堟湰绫诲瀷 @@ -98,6 +101,7 @@ OutsourcingSupplierRange: 渚涜揣鑼冨洿 OutsourcingSupplierType: 濮斿渚涘簲鍟嗙被鍨� SalaryType: 鍢夎仈钖祫绫诲瀷 + WildSilk: 閲庣氦 x-enum-varnames: - MiniDictTypePlcBrand - MiniDictTypeBomVersionType @@ -107,6 +111,8 @@ - OutsourcingSupplierCreditGrade - OutsourcingSupplierRange - SalaryType + - WildSilk + - Absenteeism constvar.WorkerStatus: enum: - 1 @@ -357,9 +363,6 @@ market: description: 搴勫彛 type: string - name: - description: 杞﹂棿 - type: string number: description: 缂栧彿 type: string @@ -381,6 +384,10 @@ workshopGroup: description: 杞︾粍 type: integer + workshopName: + type: string + workshopNumber: + type: string type: object models.FinenessRoundingItem: properties: @@ -762,9 +769,6 @@ market: description: 搴勫彛 type: string - name: - description: 杞﹂棿 - type: string number: description: 缂栧彿 type: string @@ -786,6 +790,10 @@ workshopGroup: description: 杞︾粍 type: integer + workshopName: + type: string + workshopNumber: + type: string type: object request.AddMentorRequest: properties: diff --git a/models/fineness.go b/models/fineness.go index 4ea1e11..18e6461 100644 --- a/models/fineness.go +++ b/models/fineness.go @@ -11,10 +11,11 @@ // FinenessRegister 绾ゅ害鐧昏 FinenessRegister struct { gorm.Model - Number string `gorm:"type:varchar(255);not null;comment:缂栧彿" json:"number"` //缂栧彿 - FinenessCheckID uint `gorm:"not null;comment:绾ゅ害妫�楠岃〃ID" json:"finenessCheckID"` //绾ゅ害妫�楠岃〃ID - FinishDate string `gorm:"type:varchar(255);not null;comment:钀戒笣鏃堕棿" json:"finishDate"` //钀戒笣鏃堕棿 - Workshop string `gorm:"type:varchar(255);not null;comment:杞﹂棿" json:"name"` //杞﹂棿 + Number string `gorm:"type:varchar(255);not null;comment:缂栧彿" json:"number"` //缂栧彿 + FinenessCheckID uint `gorm:"not null;comment:绾ゅ害妫�楠岃〃ID" json:"finenessCheckID"` //绾ゅ害妫�楠岃〃ID + FinishDate string `gorm:"type:varchar(255);not null;comment:钀戒笣鏃堕棿" json:"finishDate"` //钀戒笣鏃堕棿 + WorkshopNumber string `json:"workshopNumber" gorm:"type:varchar(255);comment:杞﹂棿缂栧彿"` + WorkshopName string `json:"workshopName" gorm:"type:varchar(255);comment:杞﹂棿鍚嶇О"` WorkshopGroup int `gorm:"type:int(11);not null;default:0;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"` //瑙勬牸 @@ -79,8 +80,8 @@ return slf } -func (slf *FinenessRegisterSearch) SetWorkshop(workshop string) *FinenessRegisterSearch { - slf.Workshop = workshop +func (slf *FinenessRegisterSearch) SetWorkshopName(workshop string) *FinenessRegisterSearch { + slf.WorkshopName = workshop return slf } @@ -117,8 +118,8 @@ db = db.Where("number like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) } - if slf.Workshop != "" { - db = db.Where("workshop = ?", slf.Workshop) + if slf.WorkshopName != "" { + db = db.Where("workshop_name = ?", slf.WorkshopName) } if slf.Market != "" { diff --git a/service/fineness.go b/service/fineness.go index 52ea7f8..2a27671 100644 --- a/service/fineness.go +++ b/service/fineness.go @@ -10,7 +10,7 @@ "sort" ) -func FinenessCheck(finenessRegister *models.FinenessRegister, isNew bool) (err error) { +func FinenessCheck(finenessRegister *models.FinenessRegister, silkStandard map[string]*Standard, endCarMap map[int]bool, isNew bool) (err error) { standardMap, err := GetSilkRankStandard() if err != nil { return err @@ -20,10 +20,7 @@ var allFinenessList []decimal.Decimal var personFinenessList []decimal.Decimal var carCheckNumber = 0 //鍗曚釜car宸叉鏌ユ牱鏈暟 - endCarMap, err := GetWorkshopEndCarMap(finenessRegister.Workshop, finenessRegister.WorkshopGroup) - if err != nil { - return err - } + var item *models.FinenessCheckItem var deviation decimal.Decimal var finenessGrade string -- Gitblit v1.8.0