From 0a932e56960fc8d39eb9cb04e16cac2249445062 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 16 一月 2025 16:35:56 +0800
Subject: [PATCH] 2025-01-16

---
 src/menu/debug/index.jsx |   54 ++++++++++++++++++++++++++++--------------------------
 1 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/src/menu/debug/index.jsx b/src/menu/debug/index.jsx
index 2631cf0..d398ea2 100644
--- a/src/menu/debug/index.jsx
+++ b/src/menu/debug/index.jsx
@@ -637,9 +637,12 @@
     if (!_prev) return _back
 
     let tbs = []
-    _prev.replace(/\n|\r/g, ' ').split(/\sdeclare\s/ig).forEach(line => {
-      if (!/^\s*(@|#)[a-zA-Z0-9_]+\s+table\s+\(/ig.test(line)) return
-      let tb = line.match(/(@|#)[a-zA-Z0-9_]+\s+table\s+\(.+(\)|date|datetime)\s*\)/ig)
+    _prev.replace(/\/\*[^/*]+\*\//g, '').replace(/\n|\r/g, ' ').split(/\sdeclare\s+|\screate\s+table\s+/ig).forEach(line => {
+      if (/^\s*(@|#)[a-zA-Z0-9_]+\s+table\s+\(/ig.test(line)) {
+        line = line.replace(/\s+table\s+\(/, '(')
+      }
+      if (!/^\s*(@|#)[a-zA-Z0-9_]+\s*\(/ig.test(line)) return
+      let tb = line.match(/(@|#)[a-zA-Z0-9_]+\s*\(.+(\)|date|datetime)\s*\)/ig)
 
       if (tb && tb.length === 1) {
         tbs.push(tb[0])
@@ -651,7 +654,7 @@
 
       if (!tbName) return
 
-      let content = tb.replace(/(@|#)[a-zA-Z0-9_]+\s+table\s+\(\s*/, '').replace(/\s*\)$/, '')
+      let content = tb.replace(/(@|#)[a-zA-Z0-9_]+\s*\(\s*/, '').replace(/\s*\)$/, '')
       content = content.replace(/decimal\(\s*\d+\s*,\s*\d+\s*\)/ig, 'decimal')
 
       let keys = []
@@ -1154,17 +1157,6 @@
   
     // 鍞竴鎬ч獙璇侊紝蹇呴』瀛樺湪琛ㄥ崟锛堣〃鍗曞瓨鍦ㄦ椂锛屼富閿潎涓哄崟鍊硷級,蹇呴』濉啓鏁版嵁婧愶紝澶氳鎷兼帴鏃朵笉鍙敤
     if (formdata && verify.uniques && verify.uniques.length > 0 && btn.Ot !== 'requiredOnce') {
-      let dateForms = []
-      let numForms = []
-      formdata.forEach(form => {
-        let _key = form.key.toLowerCase()
-        if (form.type === 'date') {
-          dateForms.push(_key)
-        } else if (form.type === 'number' || form.type === 'rate') {
-          numForms.push(_key)
-        }
-      })
-
       verify.uniques.forEach(item => {
         let _fieldValue = []                     // 琛ㄥ崟閿�煎field=value
         let _value = []                          // 琛ㄥ崟鍊硷紝鐢ㄤ簬閿欒鎻愮ず
@@ -1174,21 +1166,26 @@
         item.field.split(',').forEach((_field, index) => {
           let _key = _field.toLowerCase()
           let _val = ''
+          let _val2 = ''
   
           arr.push(_key)
-          if (_key === 'bid') { // 琛ㄥ崟涓病鏈塨id鍒欎娇鐢ㄧ郴缁焍id鍙橀噺
-            _val = BID
-          } else if (numForms.includes(_key)) {
-            _val = '1'
-          } else if (dateForms.includes(_key)) {
-            _val = '1949-10-01'
+          if (_key === 'bid') {
+            _val = `'${BID}'`
+          } else {
+            _val = `@${_field}`
           }
 
-          _fieldValue.push(`${_key}='${_val}'`)
-          _value.push(`${_labels[index] || ''}锛�${_val || ''}`)
+          if (_key === 'bid') {
+            _val2 = BID
+          } else {
+            _val2 = `' + @${_field} + '`
+          }
+
+          _fieldValue.push(`${_key}=${_val}`)
+          _value.push(`${_labels[index] || ''}锛�${_val2}`)
         })
   
-        if (!arr.includes(primaryKey.toLowerCase())) {
+        if (!arr.includes(primaryKey.toLowerCase()) && btn.Ot !== 'notRequired') {
           _fieldValue.push(`${primaryKey} !='${primaryId}'`)
         }
   
@@ -1239,7 +1236,7 @@
     let hasvoucher = false
   
     // 鍑瘉-鏄剧ず鍒椾腑閫夊彇,蹇呴』閫夎
-    if (verify.voucher && verify.voucher.enabled && btn.Ot !== 'requiredOnce') {
+    if (verify.voucher && verify.voucher.enabled && btn.Ot !== 'notRequired') {
       let _voucher = verify.voucher
   
       hasvoucher = true
@@ -1247,7 +1244,7 @@
       _sql += `
         /* 鍒涘缓鍑瘉 */
         exec s_BVoucher_Create
-          @Bill ='0',
+          @Bill = @${_voucher.linkField},
           @BVoucherType ='${_voucher.BVoucherType}',
           @VoucherTypeOne ='${_voucher.VoucherTypeOne}',
           @VoucherTypeTwo ='${_voucher.VoucherTypeTwo}',
@@ -2072,6 +2069,11 @@
       { reg: /@datam@/ig, value: `''` },
     ]
 
+    let process = this.props.config.process === 'true'
+    if (process) {
+      regs.push({ reg: /@works_flow_code@/ig, value: `'1949-10-01 15:00:00'` })
+    }
+
     let sql = this.formatDataSource(item, regs)
 
     return sql

--
Gitblit v1.8.0