浏览代码

修复变更新增部位bug

laiguoran 3 年之前
父节点
当前提交
773eb7b7df
共有 3 个文件被更改,包括 11 次插入5 次删除
  1. 3 3
      app/service/change_audit_list.js
  2. 1 1
      app/view/measure/stage_modal.ejs
  3. 7 1
      sql/update.sql

+ 3 - 3
app/service/change_audit_list.js

@@ -829,7 +829,7 @@ module.exports = app => {
 
         async _findParents(transaction, tid, id, result) {
             const info = await transaction.get(this.ctx.service.changeLedger.tableName, { tender_id: tid, ledger_id: id });
-            if (info && this._.findIndex(result, { ledger_id: info.id }) === -1) {
+            if (info && this._.findIndex(result, { ledger_id: info.ledger_id }) === -1) {
                 result.push(info);
                 await this._findParents(transaction, tid, info.ledger_pid, result);
             } else {
@@ -868,7 +868,7 @@ module.exports = app => {
                 const insertPosArr = [];
                 for (const p of posList) {
                     const insertp = [
-                        p.id, p.tid, p.lid, p.name, p.drawing_code, p.quantity, p.add_stage, p.add_times,
+                        p.id, p.tid, p.lid, p.name, p.drawing_code, p.quantity, p.add_stage, p.add_stage_order, p.add_times,
                         p.add_user, p.sgfh_qty, p.sjcl_qty, p.qtcl_qty, p.crid, p.porder, p.position,
                         p.sgfh_expr, p.sjcl_expr, p.qtcl_expr, p.real_qty,
                         p.gxby_status, p.dagl_status, p.dagl_url, p.gxby_limit, p.dagl_limit,
@@ -882,7 +882,7 @@ module.exports = app => {
                 const pSql =
                     'Insert Into ' +
                     this.ctx.service.pos.tableName +
-                    '  (id, tid, lid, name, drawing_code, quantity, add_stage, add_times, add_user,' +
+                    '  (id, tid, lid, name, drawing_code, quantity, add_stage, add_stage_order, add_times, add_user,' +
                     '     sgfh_qty, sjcl_qty, qtcl_qty, crid, porder, position, ' +
                     '     sgfh_expr, sjcl_expr, qtcl_expr, real_qty,' +
                     '     gxby_status, dagl_status, dagl_url, gxby_limit,  dagl_limit,' +

+ 1 - 1
app/view/measure/stage_modal.ejs

@@ -176,4 +176,4 @@
 });
 </script>
 <script src="/public/js/moment/moment.min.js"></script>
-<script src="/public/js/measure_stage.js"></script>
+<script src="/public/js/measure_stage.js?20220110"></script>

+ 7 - 1
sql/update.sql

@@ -203,10 +203,16 @@ Update zh_revise_pos_19 p Left Join zh_stage s ON p.add_stage = s.id Set p.add_s
 CREATE TABLE `zh_change_revise_log`  (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `tid` int(11) NOT NULL,
-  `cid` int(11) NOT NULL COMMENT '变更令id',
+  `cid` VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '变更令id',
   `lid` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '插入的清单uuid',
   `pid` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '插入的计量单元uuid',
   `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '清单名称或计量单元编号',
   `create_time` datetime NOT NULL COMMENT '入库时间',
   PRIMARY KEY (`id`) USING BTREE
 ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_unicode_ci COMMENT = '变更新增部位记录表';
+
+ALTER TABLE `zh_change_pos`
+MODIFY COLUMN `add_stage`  int(11) NOT NULL COMMENT '新增期id' AFTER `quantity`,
+ADD COLUMN `add_stage_order`  tinyint(4) NOT NULL DEFAULT 0 COMMENT '新增期序号' AFTER `add_stage`;
+
+Update zh_change_pos p Left Join zh_stage s ON p.add_stage = s.id Set p.add_stage_order = s.order where p.add_stage_order > 0;