| | |
| | | } |
| | | |
| | | // |
| | | //// 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 获取单一质检单信息 |
| | |
| | | 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) |
| | |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "name": "supplierName", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "name": "unit", |
| | | "in": "query" |
| | | }, |
| | |
| | | { |
| | | "type": "integer", |
| | | "name": "supplierId", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "name": "supplierName", |
| | | "in": "query" |
| | | }, |
| | | { |
| | |
| | | { |
| | | "type": "integer", |
| | | "name": "supplierId", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "name": "supplierName", |
| | | "in": "query" |
| | | }, |
| | | { |
| | |
| | | "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": "分页获取质检单列表,返回包括列表,总数,页码,每页数量", |
| | |
| | | "supplierId": { |
| | | "type": "integer" |
| | | }, |
| | | "supplierName": { |
| | | "type": "string" |
| | | }, |
| | | "unit": { |
| | | "type": "string" |
| | | }, |
| | |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "name": "supplierName", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "name": "unit", |
| | | "in": "query" |
| | | }, |
| | |
| | | { |
| | | "type": "integer", |
| | | "name": "supplierId", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "name": "supplierName", |
| | | "in": "query" |
| | | }, |
| | | { |
| | |
| | | { |
| | | "type": "integer", |
| | | "name": "supplierId", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "name": "supplierName", |
| | | "in": "query" |
| | | }, |
| | | { |
| | |
| | | "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": "分页获取质检单列表,返回包括列表,总数,页码,每页数量", |
| | |
| | | "supplierId": { |
| | | "type": "integer" |
| | | }, |
| | | "supplierName": { |
| | | "type": "string" |
| | | }, |
| | | "unit": { |
| | | "type": "string" |
| | | }, |
| | |
| | | $ref: '#/definitions/test.Supplier' |
| | | supplierId: |
| | | type: integer |
| | | supplierName: |
| | | type: string |
| | | unit: |
| | | type: string |
| | | updated_at: |
| | |
| | | name: supplierId |
| | | type: integer |
| | | - in: query |
| | | name: supplierName |
| | | type: string |
| | | - in: query |
| | | name: unit |
| | | type: string |
| | | - in: query |
| | |
| | | - in: query |
| | | name: supplierId |
| | | type: integer |
| | | - in: query |
| | | name: supplierName |
| | | type: string |
| | | - in: query |
| | | name: supplierNumber |
| | | type: string |
| | |
| | | - in: query |
| | | name: supplierId |
| | | type: integer |
| | | - in: query |
| | | name: supplierName |
| | | type: string |
| | | - in: query |
| | | name: supplierNumber |
| | | type: string |
| | |
| | | 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: |
| | |
| | | { |
| | | //qualityInspectRouter.GET("purchase/:id", qualityInspectApi.GetPurchase) // 获取单一采购单信息 |
| | | qualityInspectRouter.GET("qualityInspectList", qualityInspectApi.GetQualityInspectList) // 获取采购单列表 |
| | | //qualityInspectRouter.GET("qualityTest", qualityInspectApi.QualityTest) // 测试 |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | 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 |
| | | } |
| | |
| | | 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 |
| | | } |
| | | |