From 80c8e74c7428329f06d1aa3b70b95b46da732b0a Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期四, 27 六月 2024 20:09:03 +0800
Subject: [PATCH] 保存库存结算时间点重启定时任务

---
 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