zhangqian
2024-04-29 12ead07c578158b98f7403aaaa2f96eb12b93f26
纤度登记检查车间车号配置
8个文件已修改
147 ■■■■■ 已修改文件
controllers/fineness.go 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/request/fineness.go 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/workshop_manage_controller.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/docs.go 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.json 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.yaml 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
models/fineness.go 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/fineness.go 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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(&params, isNew)
    err = service.FinenessCheck(&params, silkStandard, endCarMap, isNew)
    if err != nil {
        logx.Errorf("service.FinenessCheck err:%v, finenessRegister:%+v", err, params)
        util.ResponseFormat(c, code.RequestParamError, "生成检验表失败")
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 {
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 {
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"
                }
            }
        },
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"
                }
            }
        },
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:
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 != "" {
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