From 47878f10e573eb05c2041e497aae0c7d2c5bac7a Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@smartai.com> Date: 星期四, 29 六月 2023 19:06:44 +0800 Subject: [PATCH] 添加生产任务单接口 --- report/tasks.go | 26 +++++++++++++++++++++++--- 1 files changed, 23 insertions(+), 3 deletions(-) diff --git a/report/tasks.go b/report/tasks.go index 7d23605..f735c2d 100644 --- a/report/tasks.go +++ b/report/tasks.go @@ -3,12 +3,12 @@ import ( "encoding/json" "io/ioutil" - "kingdee-dbapi/logger" "time" "kingdee-dbapi/cache" "kingdee-dbapi/config" "kingdee-dbapi/kingdee" + "kingdee-dbapi/logger" "kingdee-dbapi/models" "kingdee-dbapi/nsqclient" ) @@ -56,7 +56,7 @@ //ok := nsqclient.HttpPost(config.Options.OrderTopic, b) if len(list) == 0 { - logger.Debug("娌℃湁鏂扮殑璁㈠崟闇�瑕佷笂鎶�") + logger.Debug("娌℃湁鏂扮殑璁㈠崟鏁版嵁") return } @@ -113,6 +113,21 @@ logger.Debug("鏌ヨ鍒�%d鏉″簱瀛樻暟鎹�", len(list)) + // 鍏堣繃婊や竴閬嶆暟鎹�, 鏍肩憺绫冲彂鐜版湁鍚屼竴涓骇鍝佸悓鎵瑰彿鍚屼粨搴�, 鏈夊鏉″簱瀛樿褰曠殑鎯呭喌 + // 灏嗙被浼肩殑鏁版嵁搴撳瓨鏁扮疮璁″埌涓�璧� + var filterMap = make(map[string]float64, 0) + for i := 0; i < len(list); { + cacheKey := list[i].FNumber + list[i].FBatchNo + list[i].FStockNo + if qty, ok := filterMap[cacheKey]; ok { + filterMap[cacheKey] = list[i].FUnitQty + qty + list = append(list[:i], list[i+1:]...) + } else { + filterMap[cacheKey] = list[i].FUnitQty + i++ + } + } + + // 杩囨护鏁版嵁, 鍒ゆ柇鏄惁宸茬粡涓婃姤杩� for i := 0; i < len(list); { cacheKey := list[i].FNumber + list[i].FBatchNo + list[i].FStockNo if qty, ok := invReportedCache[cacheKey]; ok && qty == list[i].FUnitQty { @@ -122,9 +137,14 @@ i++ } } + + if len(list) == 0 { + logger.Debug("娌℃湁瑕佹洿鏂扮殑搴撳瓨鏁版嵁.") + return + } } - // 姣忔鍙� 100 鏉� + // 姣忔鍙� 1000 鏉� successCnt := 0 for i := 0; i < len(list); i += 1000 { end := i + 1000 -- Gitblit v1.8.0