From 58a28e1faa15f638a136fefdcfcd0b3106c1fa16 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 24 六月 2020 10:18:54 +0800
Subject: [PATCH] 2020-06-24

---
 src/utils/utils.js |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/utils/utils.js b/src/utils/utils.js
index dcd0f4f..80c6139 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -1042,7 +1042,7 @@
     // 鍒濆鍖栧嚟璇佸強鐢ㄦ埛淇℃伅瀛楁
     _sql += `
         /* 鍑瘉鍙婄敤鎴蜂俊鎭垵濮嬪寲璧嬪�� */
-        select @BVoucher='',@FIBVoucherDate='',@FiYear='',@ErrorCode='',@retmsg='',@UserName='${userName}', @FullName='${fullName}'
+        select @BVoucher='',@FIBVoucherDate='',@FiYear='',@ErrorCode='',@retmsg='',@UserName='${userName}', @FullName='${fullName}', @BillCode='', @ModularDetailCode=''
         `
 
     if (_initCustomScript) {
@@ -1162,16 +1162,16 @@
       let datasource = setting.dataresource
       if (/\s/.test(datasource)) { // 鎷兼帴鍒悕
         datasource = '(' + datasource + ') tb'
+      } else {
+        datasource = datasource + ' tb'
       }
 
       verify.uniques.forEach(item => {
-        let _primaryKey = item.field.split(',').includes(primaryKey) ? '' : ',' + primaryKey
-
         _sql += `
         /* 鍚岀被鏁版嵁楠岃瘉 */
         Set @tbid=''
 
-        Select top 1 @tbid='X' from (select ${item.field}${_primaryKey},1 as n from ${datasource} ) tb  inner join (select ID from  dbo.SplitComma(@ID@)) sp on tb.${primaryKey}=sp.ID group by ${item.field} having sum(n)>1
+        Select top 1 @tbid='X' from (select distinct ${item.field},1 as n from ${datasource} inner join (select ID from  dbo.SplitComma(@ID@)) sp on tb.${primaryKey}=sp.ID ) a having sum(n)>1
         
         If @tbid!=''
         Begin

--
Gitblit v1.8.0