liujiandao
2023-11-17 7a3a9a739392d048655efac6a28592410a8809c2
controllers/product_controller.go
@@ -214,6 +214,22 @@
      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}