| | |
| | | util.ResponseFormat(c, code.RequestParamError, "单位不能为空") |
| | | return |
| | | } |
| | | if params.BarCode == "" { |
| | | if params.BarCode != "" { |
| | | m, err := models.NewMaterialSearch().SetBarCode(params.BarCode).First() |
| | | if err != nil || m != nil { //查出物料表是物料已存在 |
| | | if err == nil && m.ID != "" { //查出物料表是物料已存在 |
| | | util.ResponseFormat(c, code.RequestParamError, "条形码已经被使用") |
| | | return |
| | | } |
| | |
| | | util.ResponseFormat(c, code.RequestParamError, "单位不能为空") |
| | | return |
| | | } |
| | | if params.BarCode == "" { |
| | | if params.BarCode != "" { |
| | | m, err := models.NewMaterialSearch().SetBarCode(params.BarCode).First() |
| | | if err != nil || (m != nil && m.ID != params.ID) { //查出物料且ID不一样, |
| | | if err == nil && m.ID != params.ID { //查出物料且ID不一样, |
| | | util.ResponseFormat(c, code.RequestParamError, "条形码已经被使用") |
| | | return |
| | | } |