|
@@ -28,7 +28,7 @@ const checkStage = async function(stage, decimal, preStage) {
|
|
|
if (history) {
|
|
|
for (const h of history) {
|
|
|
const sbFilter = stageBills.filter(x => {
|
|
|
- return x.times < h.times || (x.times = h.times && x.order <= h.order);
|
|
|
+ return x.times < h.times || (x.times === h.times && x.order <= h.order);
|
|
|
});
|
|
|
const sbLatest = BaseUtil.filterLastestData(sbFilter, ['lid']);
|
|
|
history.positive_qc_tp = 0;
|
|
@@ -195,14 +195,38 @@ const doComplete = async function() {
|
|
|
const info = await querySql('Select * From zh_tender_info where tid = ?', [t.id]);
|
|
|
const decimal = info[0].decimal ? JSON.parse(info[0].decimal) : defaultInfo.parseInfo.decimal;
|
|
|
|
|
|
- // const changes = await querySql('Select * From zh_change where tid = ?', [t.id]);
|
|
|
- // for (const c of changes) {
|
|
|
- // await checkChange(c, decimal);
|
|
|
- // }
|
|
|
+ const changes = await querySql('Select * From zh_change where tid = ?', [t.id]);
|
|
|
+ for (const c of changes) {
|
|
|
+ await checkChange(c, decimal);
|
|
|
+ }
|
|
|
+ const stage = await querySql('Select * From zh_stage where tid = ? order by `order` asc', [t.id]);
|
|
|
+ for (const [i, s] of stage.entries()) {
|
|
|
+ await checkStagePos(s, decimal, i > 0 ? stage[i-1] : null);
|
|
|
+ await checkStageBills(s, decimal, i > 0 ? stage[i-1] : null);
|
|
|
+ await checkStage(s, decimal, i > 0 ? stage[i-1] : null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ console.log(err);
|
|
|
+ }
|
|
|
+ BaseUtil.closePool();
|
|
|
+};
|
|
|
+const doCompleteTest = async function(tid) {
|
|
|
+ try {
|
|
|
+ const tender = await querySql('Select * From zh_tender where id = ?', [tid]);
|
|
|
+ for (const t of tender) {
|
|
|
+ console.log(`Update Tender ${t.id}:`);
|
|
|
+ const info = await querySql('Select * From zh_tender_info where tid = ?', [t.id]);
|
|
|
+ const decimal = info[0].decimal ? JSON.parse(info[0].decimal) : defaultInfo.parseInfo.decimal;
|
|
|
+
|
|
|
+ const changes = await querySql('Select * From zh_change where tid = ?', [t.id]);
|
|
|
+ for (const c of changes) {
|
|
|
+ await checkChange(c, decimal);
|
|
|
+ }
|
|
|
const stage = await querySql('Select * From zh_stage where tid = ? order by `order` asc', [t.id]);
|
|
|
for (const [i, s] of stage.entries()) {
|
|
|
- // await checkStagePos(s, decimal, i > 0 ? stage[i-1] : null);
|
|
|
- // await checkStageBills(s, decimal, i > 0 ? stage[i-1] : null);
|
|
|
+ await checkStagePos(s, decimal, i > 0 ? stage[i-1] : null);
|
|
|
+ await checkStageBills(s, decimal, i > 0 ? stage[i-1] : null);
|
|
|
await checkStage(s, decimal, i > 0 ? stage[i-1] : null);
|
|
|
}
|
|
|
}
|
|
@@ -211,29 +235,9 @@ const doComplete = async function() {
|
|
|
}
|
|
|
BaseUtil.closePool();
|
|
|
};
|
|
|
-doComplete();
|
|
|
-// const doCompleteTest = async function() {
|
|
|
-// try {
|
|
|
-// const tender = await querySql('Select * From zh_tender where id = 860');
|
|
|
-// for (const t of tender) {
|
|
|
-// console.log(`Update Tender ${t.id}:`);
|
|
|
-// const info = await querySql('Select * From zh_tender_info where tid = ?', [t.id]);
|
|
|
-// const decimal = info[0].decimal ? JSON.parse(info[0].decimal) : defaultInfo.parseInfo.decimal;
|
|
|
-//
|
|
|
-// const changes = await querySql('Select * From zh_change where tid = ?', [t.id]);
|
|
|
-// for (const c of changes) {
|
|
|
-// await checkChange(c, decimal);
|
|
|
-// }
|
|
|
-// const stage = await querySql('Select * From zh_stage where tid = ? order by `order` asc', [t.id]);
|
|
|
-// for (const [i, s] of stage.entries()) {
|
|
|
-// await checkStagePos(s, decimal, i > 1 ? stage[i-1] : null);
|
|
|
-// await checkStageBills(s, decimal, i > 1 ? stage[i-1] : null);
|
|
|
-// await checkStage(s, decimal, i > 1 ? stage[i-1] : null);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// } catch (err) {
|
|
|
-// console.log(err);
|
|
|
-// }
|
|
|
-// BaseUtil.closePool();
|
|
|
-// };
|
|
|
-// doCompleteTest();
|
|
|
+const tenderId = process.argv[3];
|
|
|
+if (tenderId) {
|
|
|
+ doCompleteTest(tenderId);
|
|
|
+} else {
|
|
|
+ doComplete()
|
|
|
+}
|