From ed51b59774e99b410e9db18d246850bbfc81ee07 Mon Sep 17 00:00:00 2001 From: louwenzhi Date: Wed, 12 May 2021 14:28:47 +0800 Subject: [PATCH] =?UTF-8?q?calloff=20bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/Pln_calloffdata_landing.go | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/db/Pln_calloffdata_landing.go b/db/Pln_calloffdata_landing.go index 65a35c3..d8e0132 100644 --- a/db/Pln_calloffdata_landing.go +++ b/db/Pln_calloffdata_landing.go @@ -143,18 +143,35 @@ func (t *Pln_calloffdata_landing) GetUnparsedLandingData() (cflandtablst []Pln_c //按照calloff导入的数据,生成对应的导入文件数组 func (t *Pln_calloffdata_landing) ExistUnParsedCfByProjectOemorderPf(projnr, oemorder, pfid string) (exist bool, err error) { - var cflandtablst []Pln_calloffdata_landing + var ( + cflandtab Pln_calloffdata_landing + cflandtablst []Pln_calloffdata_landing + ) e := G_DbEngine exist = false - if err = e.Where("finr = ? and projnr = ? and oemordernr = ? and partfamilyid = ? and parsed != ? and handlestatus != ?", - G_FINR, projnr, oemorder, pfid, common.EDI_PARSE_YES, common.CO_PARSE_STATUS_OK).Find(&cflandtablst); err != nil { + + // 判断同客户订单指定PF的CALLOFF是否已进来 + if err = e.Where("finr = ? and projnr = ? and oemordernr = ? and partfamilyid = ?", + G_FINR, projnr, oemorder, pfid).Find(&cflandtablst); err != nil { return } - if len(cflandtablst) > 0 { + if len(cflandtablst) <= 0 { exist = true return } + // 判断是否存在未解析或解析错误的calloff + for _, cflandtab = range cflandtablst { + if cflandtab.Parsed != common.EDI_PARSE_YES { + exist = true + return + } + if cflandtab.Handlestatus != common.CO_PARSE_STATUS_OK { + exist = true + return + } + } + return }