| | |
| | | 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 |
| | | } |
| | | |
| | |
| | | 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, "生成检验表失败") |
| | |
| | | ) |
| | | |
| | | 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 { |
| | |
| | | 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 { |
| | |
| | | 5, |
| | | 6, |
| | | 7, |
| | | 8 |
| | | 8, |
| | | 9, |
| | | 10 |
| | | ], |
| | | "x-enum-comments": { |
| | | "Absenteeism": "缺勤", |
| | | "EarlyWarningDay": "预警天数", |
| | | "InspectionWayType": "质检方式类型", |
| | | "MiniDictTypeBomVersionType": "Bom版本类型", |
| | |
| | | "OutsourcingSupplierCreditGrade": "信用等级", |
| | | "OutsourcingSupplierRange": "供货范围", |
| | | "OutsourcingSupplierType": "委外供应商类型", |
| | | "SalaryType": "嘉联薪资类型" |
| | | "SalaryType": "嘉联薪资类型", |
| | | "WildSilk": "野纤" |
| | | }, |
| | | "x-enum-varnames": [ |
| | | "MiniDictTypePlcBrand", |
| | |
| | | "OutsourcingSupplierType", |
| | | "OutsourcingSupplierCreditGrade", |
| | | "OutsourcingSupplierRange", |
| | | "SalaryType" |
| | | "SalaryType", |
| | | "WildSilk", |
| | | "Absenteeism" |
| | | ] |
| | | }, |
| | | "constvar.WorkerStatus": { |
| | |
| | | "description": "庄口", |
| | | "type": "string" |
| | | }, |
| | | "name": { |
| | | "description": "车间", |
| | | "type": "string" |
| | | }, |
| | | "number": { |
| | | "description": "编号", |
| | | "type": "string" |
| | |
| | | "workshopGroup": { |
| | | "description": "车组", |
| | | "type": "integer" |
| | | }, |
| | | "workshopName": { |
| | | "type": "string" |
| | | }, |
| | | "workshopNumber": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "description": "庄口", |
| | | "type": "string" |
| | | }, |
| | | "name": { |
| | | "description": "车间", |
| | | "type": "string" |
| | | }, |
| | | "number": { |
| | | "description": "编号", |
| | | "type": "string" |
| | |
| | | "workshopGroup": { |
| | | "description": "车组", |
| | | "type": "integer" |
| | | }, |
| | | "workshopName": { |
| | | "type": "string" |
| | | }, |
| | | "workshopNumber": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | 5, |
| | | 6, |
| | | 7, |
| | | 8 |
| | | 8, |
| | | 9, |
| | | 10 |
| | | ], |
| | | "x-enum-comments": { |
| | | "Absenteeism": "缺勤", |
| | | "EarlyWarningDay": "预警天数", |
| | | "InspectionWayType": "质检方式类型", |
| | | "MiniDictTypeBomVersionType": "Bom版本类型", |
| | |
| | | "OutsourcingSupplierCreditGrade": "信用等级", |
| | | "OutsourcingSupplierRange": "供货范围", |
| | | "OutsourcingSupplierType": "委外供应商类型", |
| | | "SalaryType": "嘉联薪资类型" |
| | | "SalaryType": "嘉联薪资类型", |
| | | "WildSilk": "野纤" |
| | | }, |
| | | "x-enum-varnames": [ |
| | | "MiniDictTypePlcBrand", |
| | |
| | | "OutsourcingSupplierType", |
| | | "OutsourcingSupplierCreditGrade", |
| | | "OutsourcingSupplierRange", |
| | | "SalaryType" |
| | | "SalaryType", |
| | | "WildSilk", |
| | | "Absenteeism" |
| | | ] |
| | | }, |
| | | "constvar.WorkerStatus": { |
| | |
| | | "description": "庄口", |
| | | "type": "string" |
| | | }, |
| | | "name": { |
| | | "description": "车间", |
| | | "type": "string" |
| | | }, |
| | | "number": { |
| | | "description": "编号", |
| | | "type": "string" |
| | |
| | | "workshopGroup": { |
| | | "description": "车组", |
| | | "type": "integer" |
| | | }, |
| | | "workshopName": { |
| | | "type": "string" |
| | | }, |
| | | "workshopNumber": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "description": "庄口", |
| | | "type": "string" |
| | | }, |
| | | "name": { |
| | | "description": "车间", |
| | | "type": "string" |
| | | }, |
| | | "number": { |
| | | "description": "编号", |
| | | "type": "string" |
| | |
| | | "workshopGroup": { |
| | | "description": "车组", |
| | | "type": "integer" |
| | | }, |
| | | "workshopName": { |
| | | "type": "string" |
| | | }, |
| | | "workshopNumber": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | - 6 |
| | | - 7 |
| | | - 8 |
| | | - 9 |
| | | - 10 |
| | | type: integer |
| | | x-enum-comments: |
| | | Absenteeism: 缺勤 |
| | | EarlyWarningDay: 预警天数 |
| | | InspectionWayType: 质检方式类型 |
| | | MiniDictTypeBomVersionType: Bom版本类型 |
| | |
| | | OutsourcingSupplierRange: 供货范围 |
| | | OutsourcingSupplierType: 委外供应商类型 |
| | | SalaryType: 嘉联薪资类型 |
| | | WildSilk: 野纤 |
| | | x-enum-varnames: |
| | | - MiniDictTypePlcBrand |
| | | - MiniDictTypeBomVersionType |
| | |
| | | - OutsourcingSupplierCreditGrade |
| | | - OutsourcingSupplierRange |
| | | - SalaryType |
| | | - WildSilk |
| | | - Absenteeism |
| | | constvar.WorkerStatus: |
| | | enum: |
| | | - 1 |
| | |
| | | market: |
| | | description: 庄口 |
| | | type: string |
| | | name: |
| | | description: 车间 |
| | | type: string |
| | | number: |
| | | description: 编号 |
| | | type: string |
| | |
| | | workshopGroup: |
| | | description: 车组 |
| | | type: integer |
| | | workshopName: |
| | | type: string |
| | | workshopNumber: |
| | | type: string |
| | | type: object |
| | | models.FinenessRoundingItem: |
| | | properties: |
| | |
| | | market: |
| | | description: 庄口 |
| | | type: string |
| | | name: |
| | | description: 车间 |
| | | type: string |
| | | number: |
| | | description: 编号 |
| | | type: string |
| | |
| | | workshopGroup: |
| | | description: 车组 |
| | | type: integer |
| | | workshopName: |
| | | type: string |
| | | workshopNumber: |
| | | type: string |
| | | type: object |
| | | request.AddMentorRequest: |
| | | properties: |
| | |
| | | // 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"` //规格 |
| | |
| | | return slf |
| | | } |
| | | |
| | | func (slf *FinenessRegisterSearch) SetWorkshop(workshop string) *FinenessRegisterSearch { |
| | | slf.Workshop = workshop |
| | | func (slf *FinenessRegisterSearch) SetWorkshopName(workshop string) *FinenessRegisterSearch { |
| | | slf.WorkshopName = workshop |
| | | return slf |
| | | } |
| | | |
| | |
| | | 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 != "" { |
| | |
| | | "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 |
| | |
| | | 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 |