| | |
| | | // @Tags SalesDetails |
| | | // @Summary 更新销售明细状态 |
| | | // @Produce application/json |
| | | // @Param object body request.UpdateSalesDetails true "查询参数" |
| | | // @Param object body request.UpdateSalesDetailsStatus true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/salesDetails/update [post] |
| | | // @Router /api/salesDetails/updateStatus [post] |
| | | func (s *SalesDetailsApi) UpdateStatus(c *gin.Context) { |
| | | var params request.UpdateSalesDetails |
| | | var params request.UpdateSalesDetailsStatus |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | m := make(map[string]interface{}) |
| | | m["status"] = params.SalesDetails.Status |
| | | m["status"] = params.Status |
| | | err := model.NewSalesDetailsSearch().SetId(params.Id).UpdateByMap(m) |
| | | if err != nil { |
| | | ctx.FailWithMsg(ecode.UnknownErr, "更新失败") |
| | |
| | | if !ok { |
| | | return |
| | | } |
| | | m := make(map[string]interface{}) |
| | | m["status"] = params.Status |
| | | err := model.NewSalesDetailsSearch().SetNumber(params.Number).UpdateByMap(m) |
| | | if err != nil { |
| | | ctx.FailWithMsg(ecode.UnknownErr, "状态更新失败") |
| | | return |
| | | } |
| | | |
| | | client := product_inventory.NewProductInventoryServiceClient(ProductInventoryServiceConn) |
| | | products := make([]*product_inventory.InventoryProduct, 0) |
| | |
| | | p.Amount = product.Amount.String() |
| | | products = append(products, &p) |
| | | } |
| | | _, err := client.CreateOperation(ctx.GetCtx(), &product_inventory.CreateOperationRequest{ |
| | | _, err = client.CreateOperation(ctx.GetCtx(), &product_inventory.CreateOperationRequest{ |
| | | Number: params.Number, |
| | | Addressee: params.Addressee, |
| | | Address: params.Address, |