From 8f750b461a4f442825e516016bf78d05ed66afcb Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期一, 14 八月 2023 18:14:50 +0800
Subject: [PATCH] 添加bom查询
---
report/task.go | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/report/task.go b/report/task.go
new file mode 100644
index 0000000..f0011d1
--- /dev/null
+++ b/report/task.go
@@ -0,0 +1,51 @@
+package report
+
+import (
+ "context"
+ "time"
+
+ "kingdee-dbapi/config"
+ "kingdee-dbapi/logger"
+)
+
+var ctx context.Context
+var cancel context.CancelFunc
+
+func Start() {
+ ctx, cancel = context.WithCancel(context.Background())
+ go queryTasks(ctx)
+}
+
+func RestartReport() {
+ cancel()
+
+ Start()
+}
+
+func queryTasks(c context.Context) {
+ logger.Debug("鍚姩鏁版嵁涓婃姤浠诲姟")
+ for {
+ select {
+ case <-c.Done():
+ logger.Debug("鍋滄涓婃姤")
+ return
+ default:
+ // 涓婃姤璁㈠崟
+ if config.Options.OrderTopic != "" {
+ SendOrder()
+ }
+
+ // 涓婃姤鍗虫椂搴撳瓨
+ if config.Options.InventoryTopic != "" {
+ SendInventory()
+ }
+
+ // 涓婃姤bom
+ if config.Options.BomTopic != "" {
+ SendBom(true)
+ }
+
+ time.Sleep(time.Duration(config.Options.SyncInterval) * time.Second)
+ }
+ }
+}
--
Gitblit v1.8.0