liujiandao
2023-09-26 67cf4fc49fdea5dcdd8007a94227f8486881c6bb
部分功能修改
8个文件已修改
195 ■■■■■ 已修改文件
api/v1/purchase/quality_inspection.go 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/test/product.go 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/docs.go 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.json 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.yaml 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
router/purchase/purchase.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/purchase/purchase.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/test/supplier.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/purchase/quality_inspection.go
@@ -86,6 +86,29 @@
}
//
//// QualityTest
//// @Tags      QualityInspect
//// @Summary   QualityTest
//// @Security  ApiKeyAuth
//// @accept    application/json
//// @Produce   application/json
//// @Success   200   {object}  response.Response{data=response.PageResult,msg=string}  "分页获取质检单列表,返回包括列表,总数,页码,每页数量"
//// @Router    /purchase/qualityTest [get]
//func (e *QualityInspectApi) QualityTest(c *gin.Context) {
//    client := quality.NewQualityServiceClient(qualityinspect.Conn)
//    list, err := client.GetQualityStatusList(context.Background(), &quality.QualityStatusRequest{WorkOrderId: []string{"GD-0116", "GD-0117", "GD-0156"}})
//    if err != nil {
//        fmt.Println(err)
//        response.FailWithMessage("内部错误", c)
//        return
//    }
//    for _, status := range list.List {
//        fmt.Println(status)
//    }
//    response.Ok(c)
//}
//
//// GetQualityInspect
//// @Tags      QualityInspect
//// @Summary   获取单一质检单信息
api/v1/test/product.go
@@ -36,6 +36,19 @@
        response.FailWithMessage(err.Error(), c)
        return
    }
    for _, t := range p.List {
        var num int64
        db := global.GVA_DB.Model(&test.Product{})
        err := db.Where("number = ?", t.Number).Where("supplier_id = ?", t.SupplierId).Count(&num).Error
        if err != nil {
            response.FailWithMessage(err.Error(), c)
            return
        }
        if num > 0 {
            response.FailWithMessage("当前供应商已经提供此产品", c)
            return
        }
    }
    if err := pService.CreateProduct(p.List); err != nil {
        global.GVA_LOG.Error("创建失败!", zap.Error(err))
        response.FailWithMessage("创建失败", c)
docs/docs.go
@@ -4281,6 +4281,11 @@
                    },
                    {
                        "type": "string",
                        "name": "supplierName",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "name": "unit",
                        "in": "query"
                    },
@@ -4415,6 +4420,11 @@
                    {
                        "type": "integer",
                        "name": "supplierId",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "name": "supplierName",
                        "in": "query"
                    },
                    {
@@ -4558,6 +4568,11 @@
                    {
                        "type": "integer",
                        "name": "supplierId",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "name": "supplierName",
                        "in": "query"
                    },
                    {
@@ -5016,6 +5031,48 @@
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "分页获取质检单列表,返回包括列表,总数,页码,每页数量",
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/definitions/response.Response"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/definitions/response.PageResult"
                                        },
                                        "msg": {
                                            "type": "string"
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        },
        "/purchase/qualityTest": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "QualityInspect"
                ],
                "summary": "QualityTest",
                "responses": {
                    "200": {
                        "description": "分页获取质检单列表,返回包括列表,总数,页码,每页数量",
@@ -10413,6 +10470,9 @@
                "supplierId": {
                    "type": "integer"
                },
                "supplierName": {
                    "type": "string"
                },
                "unit": {
                    "type": "string"
                },
docs/swagger.json
@@ -4272,6 +4272,11 @@
                    },
                    {
                        "type": "string",
                        "name": "supplierName",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "name": "unit",
                        "in": "query"
                    },
@@ -4406,6 +4411,11 @@
                    {
                        "type": "integer",
                        "name": "supplierId",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "name": "supplierName",
                        "in": "query"
                    },
                    {
@@ -4549,6 +4559,11 @@
                    {
                        "type": "integer",
                        "name": "supplierId",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "name": "supplierName",
                        "in": "query"
                    },
                    {
@@ -5007,6 +5022,48 @@
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "分页获取质检单列表,返回包括列表,总数,页码,每页数量",
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/definitions/response.Response"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/definitions/response.PageResult"
                                        },
                                        "msg": {
                                            "type": "string"
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        },
        "/purchase/qualityTest": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "QualityInspect"
                ],
                "summary": "QualityTest",
                "responses": {
                    "200": {
                        "description": "分页获取质检单列表,返回包括列表,总数,页码,每页数量",
@@ -10404,6 +10461,9 @@
                "supplierId": {
                    "type": "integer"
                },
                "supplierName": {
                    "type": "string"
                },
                "unit": {
                    "type": "string"
                },
docs/swagger.yaml
@@ -1957,6 +1957,8 @@
        $ref: '#/definitions/test.Supplier'
      supplierId:
        type: integer
      supplierName:
        type: string
      unit:
        type: string
      updated_at:
@@ -4482,6 +4484,9 @@
        name: supplierId
        type: integer
      - in: query
        name: supplierName
        type: string
      - in: query
        name: unit
        type: string
      - in: query
@@ -4565,6 +4570,9 @@
      - in: query
        name: supplierId
        type: integer
      - in: query
        name: supplierName
        type: string
      - in: query
        name: supplierNumber
        type: string
@@ -4652,6 +4660,9 @@
      - in: query
        name: supplierId
        type: integer
      - in: query
        name: supplierName
        type: string
      - in: query
        name: supplierNumber
        type: string
@@ -4933,6 +4944,29 @@
      summary: 分页获取质检单列表
      tags:
      - QualityInspect
  /purchase/qualityTest:
    get:
      consumes:
      - application/json
      produces:
      - application/json
      responses:
        "200":
          description: 分页获取质检单列表,返回包括列表,总数,页码,每页数量
          schema:
            allOf:
            - $ref: '#/definitions/response.Response'
            - properties:
                data:
                  $ref: '#/definitions/response.PageResult'
                msg:
                  type: string
              type: object
      security:
      - ApiKeyAuth: []
      summary: QualityTest
      tags:
      - QualityInspect
  /purchase/submit/{id}:
    post:
      consumes:
router/purchase/purchase.go
@@ -24,6 +24,7 @@
    {
        //qualityInspectRouter.GET("purchase/:id", qualityInspectApi.GetPurchase)             // 获取单一采购单信息
        qualityInspectRouter.GET("qualityInspectList", qualityInspectApi.GetQualityInspectList) // 获取采购单列表
        //qualityInspectRouter.GET("qualityTest", qualityInspectApi.QualityTest)                  // 测试
    }
}
service/purchase/purchase.go
@@ -273,7 +273,7 @@
        for _, item := range list {
            if item.ID != 0 {
                err = tx.Save(item).Error
                err = tx.Where("id = ?", item.ID).Updates(item).Error
                if err != nil {
                    return err
                }
service/test/supplier.go
@@ -83,7 +83,7 @@
        return
    }
    err = db.Debug().Limit(limit).Offset(offset).Preload("Contract").Find(&ss).Error
    err = db.Debug().Limit(limit).Offset(offset).Order("created_at desc").Preload("Contract").Find(&ss).Error
    return ss, total, err
}