| | |
| | | // @Security ApiKeyAuth |
| | | // @accept application/json |
| | | // @Produce application/json |
| | | // @Param data body purchaserequest.GetQualityInspectionInfo true "参数" |
| | | // @Param data body purchaserequest.SaveQualityInspectionInfo true "参数" |
| | | // @Success 200 {object} response.Response{data=[]purchase.PurchaseProductConfirm} "获取确认信息" |
| | | // @Router /purchase/savePurchaseQualityInspectionInfo [post] |
| | | func (e *PurchaseApi) SavePurchaseQualityInspectionInfo(c *gin.Context) { |
| | |
| | | return |
| | | } |
| | | } |
| | | |
| | | err = server.UpdatePurchaseStatus(params.PurchaseId, purchase.WaitInspection) |
| | | if err != nil { |
| | | global.GVA_LOG.Error("状态更新失败!", zap.Error(err)) |
| | | response.FailWithMessage("状态更新失败", c) |
| | | return |
| | | } |
| | | response.OkWithMessage("质检成功", c) |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/purchase/savePurchaseQualityInspectionInfo": { |
| | | "post": { |
| | | "security": [ |
| | | { |
| | | "ApiKeyAuth": [] |
| | | } |
| | | ], |
| | | "consumes": [ |
| | | "application/json" |
| | | ], |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "Purchase" |
| | | ], |
| | | "summary": "保存采购质检信息信息", |
| | | "parameters": [ |
| | | { |
| | | "description": "参数", |
| | | "name": "data", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/purchaserequest.SaveQualityInspectionInfo" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "获取确认信息", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/response.Response" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/purchase.PurchaseProductConfirm" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/purchase/submit": { |
| | | "post": { |
| | | "security": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "purchaserequest.SaveQualityInspectionInfo": { |
| | | "type": "object", |
| | | "properties": { |
| | | "ids": { |
| | | "type": "array", |
| | | "items": { |
| | | "type": "integer" |
| | | } |
| | | }, |
| | | "purchaseId": { |
| | | "type": "integer" |
| | | }, |
| | | "status": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "purchaserequest.UpdatePurchase": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/purchase/savePurchaseQualityInspectionInfo": { |
| | | "post": { |
| | | "security": [ |
| | | { |
| | | "ApiKeyAuth": [] |
| | | } |
| | | ], |
| | | "consumes": [ |
| | | "application/json" |
| | | ], |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "Purchase" |
| | | ], |
| | | "summary": "保存采购质检信息信息", |
| | | "parameters": [ |
| | | { |
| | | "description": "参数", |
| | | "name": "data", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/purchaserequest.SaveQualityInspectionInfo" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "获取确认信息", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/response.Response" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/purchase.PurchaseProductConfirm" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/purchase/submit": { |
| | | "post": { |
| | | "security": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "purchaserequest.SaveQualityInspectionInfo": { |
| | | "type": "object", |
| | | "properties": { |
| | | "ids": { |
| | | "type": "array", |
| | | "items": { |
| | | "type": "integer" |
| | | } |
| | | }, |
| | | "purchaseId": { |
| | | "type": "integer" |
| | | }, |
| | | "status": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "purchaserequest.UpdatePurchase": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | description: 排序 |
| | | type: integer |
| | | type: object |
| | | purchaserequest.SaveQualityInspectionInfo: |
| | | properties: |
| | | ids: |
| | | items: |
| | | type: integer |
| | | type: array |
| | | purchaseId: |
| | | type: integer |
| | | status: |
| | | type: integer |
| | | type: object |
| | | purchaserequest.UpdatePurchase: |
| | | properties: |
| | | productList: |
| | |
| | | summary: 确认收货 |
| | | tags: |
| | | - Purchase |
| | | /purchase/savePurchaseQualityInspectionInfo: |
| | | post: |
| | | consumes: |
| | | - application/json |
| | | parameters: |
| | | - description: 参数 |
| | | in: body |
| | | name: data |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/purchaserequest.SaveQualityInspectionInfo' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: 获取确认信息 |
| | | schema: |
| | | allOf: |
| | | - $ref: '#/definitions/response.Response' |
| | | - properties: |
| | | data: |
| | | items: |
| | | $ref: '#/definitions/purchase.PurchaseProductConfirm' |
| | | type: array |
| | | type: object |
| | | security: |
| | | - ApiKeyAuth: [] |
| | | summary: 保存采购质检信息信息 |
| | | tags: |
| | | - Purchase |
| | | /purchase/submit: |
| | | post: |
| | | consumes: |
| | |
| | | err := global.GVA_DB.Model(&purchase.PurchaseQualityInspection{}).Where("id in (?)", ids).Find(&list).Error |
| | | return list, err |
| | | } |
| | | |
| | | func (slf *PurchaseService) UpdatePurchaseStatus(purchaseId uint, status int) error { |
| | | var total int64 |
| | | err := global.GVA_DB.Model(&purchase.PurchaseQualityInspection{}).Where("status = ?", status).Count(&total).Error |
| | | if err != nil { |
| | | return err |
| | | } |
| | | if total == 0 { |
| | | err = global.GVA_DB.Model(&purchase.Purchase{}).Where("id = ?", purchaseId).Updates(map[string]interface{}{"status": purchase.OrderStatusReceived}).Error |
| | | if err != nil { |
| | | return err |
| | | } |
| | | } |
| | | return nil |
| | | } |