From 260b3fbc34b4e9ae2ee53e4a7917abb72ef848a7 Mon Sep 17 00:00:00 2001
From: dsmzx <dsmzx@123.com>
Date: 星期二, 02 七月 2024 15:44:15 +0800
Subject: [PATCH] 出库/入库打印 修改bug

---
 controllers/product_controller.go |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/controllers/product_controller.go b/controllers/product_controller.go
index 9877d21..0a0bc3f 100644
--- a/controllers/product_controller.go
+++ b/controllers/product_controller.go
@@ -54,9 +54,9 @@
 		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
 		}
@@ -360,9 +360,9 @@
 		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) { //鏌ュ嚭鐗╂枡涓擨D涓嶄竴鏍�,
+		if err == nil && m.ID != params.ID { //鏌ュ嚭鐗╂枡涓擨D涓嶄竴鏍�,
 			util.ResponseFormat(c, code.RequestParamError, "鏉″舰鐮佸凡缁忚浣跨敤")
 			return
 		}

--
Gitblit v1.8.0