Преглед изворни кода

导入Excel,无部位明细时应可导入

MaiXinRong пре 5 година
родитељ
комит
54ca9acb01
2 измењених фајлова са 5 додато и 3 уклоњено
  1. 3 1
      app/service/ledger.js
  2. 2 2
      app/service/ledger_revise.js

+ 3 - 1
app/service/ledger.js

@@ -840,7 +840,9 @@ module.exports = app => {
                 await this._importCacheTreeNodes(transaction, cacheTree.items);
                 await this._importCacheTreeNodes(transaction, cacheTree.items);
                 //console.timeEnd('insertBills');
                 //console.timeEnd('insertBills');
                 //console.time('insertPos');
                 //console.time('insertPos');
-                await transaction.insert(this.ctx.service.pos.tableName, cacheTree.pos);
+                if (cacheTree.pos && cacheTree.pos.length > 0) {
+                    await transaction.insert(this.ctx.service.pos.tableName, cacheTree.pos);
+                }
                 //console.timeEnd('insertPos');
                 //console.timeEnd('insertPos');
                 await transaction.commit();
                 await transaction.commit();
                 this.cache.set(cacheKey, cacheTree.items.length + 1, 'EX', this.ctx.app.config.cacheTime);
                 this.cache.set(cacheKey, cacheTree.items.length + 1, 'EX', this.ctx.app.config.cacheTime);

+ 2 - 2
app/service/ledger_revise.js

@@ -100,9 +100,9 @@ module.exports = app => {
         async _initRevisePos(transaction, tid) {
         async _initRevisePos(transaction, tid) {
             const sql = 'Insert Into ' + this.ctx.service.revisePos.tableName +
             const sql = 'Insert Into ' + this.ctx.service.revisePos.tableName +
                 '  (id, tid, lid, name, drawing_code, quantity, add_stage, add_times, add_user,' +
                 '  (id, tid, lid, name, drawing_code, quantity, add_stage, add_times, add_user,' +
-                '     sgfh_qty, sjcl_qty, qtcl_qty, crid, porder)' +
+                '     sgfh_qty, sjcl_qty, qtcl_qty, crid, in_time, porder)' +
                 '  Select id, tid, lid, name, drawing_code, quantity, add_stage, add_times, add_user,' +
                 '  Select id, tid, lid, name, drawing_code, quantity, add_stage, add_times, add_user,' +
-                '     sgfh_qty, sjcl_qty, qtcl_qty, crid, porder' +
+                '     sgfh_qty, sjcl_qty, qtcl_qty, crid, in_time, porder' +
                 '  From ' + this.ctx.service.pos.tableName +
                 '  From ' + this.ctx.service.pos.tableName +
                 '  Where `tid` = ?';
                 '  Where `tid` = ?';
             const sqlParam = [tid];
             const sqlParam = [tid];