Last active
January 12, 2024 06:12
Revisions
-
cpuwolf revised this gist
Jan 12, 2024 . 1 changed file with 14 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -24,8 +24,8 @@ function fetchAllRecords() { let records = sheet.Record.GetRecords({ ViewId: view.viewId, Offset: offset, MaxRecords: 1, Fields: ["编号","状态", "日期"], Filter: {"mode": "AND", "criteria": [{ "field": "状态", "op": "Equals", @@ -44,4 +44,15 @@ function fetchAllRecords() { } const recs = fetchAllRecords() console.log(recs) for(var i=0; i< recs.length; i++) { const upded = sheet.Record.UpdateRecords({ Records: [{ id: recs[i].id, fields: { "状态": "已取消", } }], }) console.log(upded); } -
cpuwolf revised this gist
Jan 12, 2024 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,7 @@ var d = new Date(); // Set it to one month ago d.setMonth(d.getMonth() - 1); d.setDate(1) // Zero the time component d.setHours(0, 0, 0, 0); // Get the time value in milliseconds and convert to seconds -
cpuwolf revised this gist
Jan 12, 2024 . 1 changed file with 9 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,11 +7,12 @@ d.setMonth(d.getMonth() - 1); // Zero the time component d.setHours(0, 0, 0, 0); // Get the time value in milliseconds and convert to seconds datestr = d.toLocaleDateString("zh-CN") console.log(datestr); // 获取当前工作表 const currentSheet = ActiveSheet console.log(Application.ActiveSheet.Name) Application.Sheets.Item('国外订单自动化').Activate() const sheet = Application.ActiveSheet function fetchAllRecords() { const view = sheet.Selection.GetActiveView() @@ -24,11 +25,15 @@ function fetchAllRecords() { Offset: offset, MaxRecords: 5, Fields: ["状态", "日期"], Filter: {"mode": "AND", "criteria": [{ "field": "状态", "op": "Equals", "values": ["待付款"] },{ "field": "日期", "op": "Less", "values": [datestr] },]} }) offset = records.offset all = all.concat(records.records) -
cpuwolf created this gist
Jan 12, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ // // Get a date object for the current time var d = new Date(); // Set it to one month ago d.setMonth(d.getMonth() - 1); // Zero the time component d.setHours(0, 0, 0, 0); // Get the time value in milliseconds and convert to seconds console.log(d); // 获取当前工作表 const currentSheet = ActiveSheet console.log(Application.ActiveSheet.Name) Application.Sheets.Item('cccc').Activate() const sheet = Application.ActiveSheet function fetchAllRecords() { const view = sheet.Selection.GetActiveView() let all = [] let offset = null; while (all.length === 0 || offset) { let records = sheet.Record.GetRecords({ ViewId: view.viewId, Offset: offset, MaxRecords: 5, Fields: ["状态", "日期"], Filter: {"criteria": [{ "field": "状态", "op": "Equals", "values": ["待付款"] }]} }) offset = records.offset all = all.concat(records.records) } console.log(all.length) return all } const recs = fetchAllRecords() console.log(recs)