| | |
| | | return |
| | | } |
| | | |
| | | //更新在库的产品类型 |
| | | if params.CategoryId > 0 { |
| | | find, _ := models.NewLocationProductAmountSearch().SetProductId(params.ID).Find() |
| | | if len(find) > 0 { |
| | | var ids []int |
| | | for _, f := range find { |
| | | if f.ProductCategoryID != params.CategoryId { |
| | | ids = append(ids, f.Id) |
| | | } |
| | | } |
| | | m := make(map[string]interface{}) |
| | | m["productCategoryId"] = params.CategoryId |
| | | _ = models.NewLocationProductAmountSearch().SetIds(ids).UpdateByMap(m) |
| | | } |
| | | } |
| | | |
| | | materialAttachmentList := []*models.MaterialAttachment{} |
| | | for _, v := range params.AttachmentIDs { |
| | | ma := &models.MaterialAttachment{MaterialID: params.ID, AttachmentID: v} |
| | |
| | | return |
| | | } |
| | | |
| | | first, err := models.NewProductCategorySearch().SetID(cast.ToUint(id)).First() |
| | | first, err := models.NewProductCategorySearch().SetID(cast.ToInt(id)).First() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "查找失败") |
| | | return |
| | |
| | | util.ResponseFormat(c, code.RequestParamError, "产品类型名称不能为空") |
| | | return |
| | | } |
| | | err := models.NewProductCategorySearch().SetID(params.ID).Save(¶ms) |
| | | err := models.NewProductCategorySearch().SetID(params.Id).Save(¶ms) |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "产品类型信息更新失败") |
| | | return |
| | |
| | | util.ResponseFormat(c, code.RequestParamError, "无效id") |
| | | return |
| | | } |
| | | err := models.NewProductCategorySearch().SetID(cast.ToUint(id)).Delete() |
| | | err := models.NewProductCategorySearch().SetID(cast.ToInt(id)).Delete() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "删除失败") |
| | | return |