@whyshu/argent-engine 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MANIFEST.json +64 -29
- package/engine/VERSION +1 -1
- package/engine/core/contracts/argent.contracts.json +1 -1
- package/engine/scripts/base-bootstrap.sh +2 -1
- package/engine/scripts/billing-mode-daily.sh +2 -1
- package/engine/scripts/build-engine-package.mjs +5 -2
- package/engine/scripts/capability-packs.lock.json +31 -31
- package/engine/scripts/check-billing-mode.sh +2 -1
- package/engine/scripts/collect-evidence.mjs +50 -0
- package/engine/scripts/customer-readiness.sh +2 -1
- package/engine/scripts/daily-report.sh +2 -1
- package/engine/scripts/dev-window.sh +2 -1
- package/engine/scripts/drill-clean-room.sh +32 -0
- package/engine/scripts/final-check.mjs +44 -0
- package/engine/scripts/flow-requirements.json +30 -10
- package/engine/scripts/flow-timers-plist.sh +2 -1
- package/engine/scripts/flow-timers.sh +3 -1
- package/engine/scripts/flow_config.py +2 -1
- package/engine/scripts/init-ml.sh +5 -2
- package/engine/scripts/invoice-table.sh +2 -1
- package/engine/scripts/lib/argent-datadir.sh +18 -0
- package/engine/scripts/lib/argent_datadir.py +23 -0
- package/engine/scripts/poll-fulfillment.sh +4 -2
- package/engine/scripts/poll-invoice.sh +4 -2
- package/engine/scripts/provider-select.sh +2 -1
- package/engine/scripts/release-argent.sh +1 -1
- package/engine/scripts/retire-inventory.mjs +40 -0
- package/engine/scripts/run-tests.sh +2 -1
- package/engine/scripts/s1-audit.mjs +85 -0
- package/engine/scripts/usage-anchor.sh +3 -2
- package/engine/scripts/wenyao-browser.sh +3 -2
- package/engine/scripts/wenyao-login.sh +3 -2
- package/engine/scripts/ziniao-keepalive.sh +2 -1
- package/engine/scripts/ziniao-post-upgrade-check.sh +2 -1
- package/engine/scripts/ziniao-windows.sh +2 -1
- package/engine/skills/README.md +86 -0
- package/engine/skills/argent-dev/SKILL.md +41 -0
- package/engine/skills/internal.json +37 -0
- package/engine/skills/lktop-pm/SKILL.md +35 -0
- package/engine/skills/lktopapp-dev/SKILL.md +34 -0
- package/engine/skills/ml-config-guide/SKILL.md +50 -0
- package/engine/skills/ml-fulfillment-sop/SKILL.md +178 -0
- package/engine/skills/ml-fulfillment-sop/references/andes-components.md +69 -0
- package/engine/skills/ml-fulfillment-sop/references/cdp-port-mapping.md +35 -0
- package/engine/skills/ml-fulfillment-sop/references/feishu-base-fulfillment-schema.md +136 -0
- package/engine/skills/ml-fulfillment-sop/references/multi-window-concurrency.md +69 -0
- package/engine/skills/ml-fulfillment-sop/references/pitfalls.md +77 -0
- package/engine/skills/ml-fulfillment-sop/references/selectors.md +243 -0
- package/engine/skills/ml-fulfillment-sop/scripts/fulfillment.js +586 -0
- package/engine/skills/ml-fulfillment-sop/scripts/poll-and-execute.sh +271 -0
- package/engine/skills/ml-fulfillment-sop/templates/report.md +55 -0
- package/engine/skills/ml-invoice/SKILL.md +506 -0
- package/engine/skills/ml-invoice/references/pitfalls.md +268 -0
- package/engine/skills/ml-invoice/references/portal-flow.md +360 -0
- package/engine/skills/ml-invoice/references/template-fill-contract.md +133 -0
- package/engine/skills/ml-invoice-xzh/SKILL.md +133 -0
- package/engine/skills/ml-invoice-xzh/references/pitfalls.md +230 -0
- package/engine/skills/ml-store-daily-report/SKILL.md +224 -0
- package/engine/skills/ml-store-daily-report/scripts/README.md +25 -0
- package/engine/skills/ml-store-daily-report/scripts/extract.js +691 -0
- package/engine/skills/ml-store-daily-report/scripts/generate.js +299 -0
- package/engine/skills/pet-dev/SKILL.md +42 -0
- package/engine/skills/whyshu-pm/SKILL.md +35 -0
- package/engine/skills/whyshu-web-dev/SKILL.md +50 -0
- package/engine/version.mjs +1 -1
- package/engine/verticals/mercadolibre/flows.json +37 -5
- package/package.json +3 -2
- package/requirements.txt +5 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Argent FULL 货件自动化 — 飞书多维表格驱动
|
|
3
|
+
# 轮询逻辑:检测 状态=Pending && 就绪=true → 自动执行全流程
|
|
4
|
+
# 使用前请通过环境变量配置(见 .env.example 或各变量注释)
|
|
5
|
+
|
|
6
|
+
# ── 必填:运行前配置(勿提交真实值到版本库)──
|
|
7
|
+
BASE_TOKEN="${FEISHU_BASE_TOKEN:?请设置环境变量 FEISHU_BASE_TOKEN(飞书多维表格 Base Token)}"
|
|
8
|
+
TABLE_ID="${FEISHU_TABLE_ID:?请设置环境变量 FEISHU_TABLE_ID}"
|
|
9
|
+
STORE_ID="${ML_STORE_ID:?请设置环境变量 ML_STORE_ID}"
|
|
10
|
+
STORE_NAME="${ML_STORE_NAME:?请设置环境变量 ML_STORE_NAME}"
|
|
11
|
+
FEISHU_USER="${FEISHU_USER_ID:?请设置环境变量 FEISHU_USER_ID}"
|
|
12
|
+
ZINIAO_DL="${ZINIAO_DL:-$HOME/Library/Application Support/ziniaobrowserdatas/ziniao browser}"
|
|
13
|
+
|
|
14
|
+
# ── 工具函数 ──
|
|
15
|
+
update_field() {
|
|
16
|
+
local record_id=$1 field=$2 value=$3
|
|
17
|
+
lark-cli base +record-batch-update \
|
|
18
|
+
--base-token "$BASE_TOKEN" --table-id "$TABLE_ID" \
|
|
19
|
+
--record-ids "$record_id" \
|
|
20
|
+
--json "{\"fields\":{\"$field\":$value}}" 2>/dev/null
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
update_step() {
|
|
24
|
+
local record_id=$1 step=$2
|
|
25
|
+
update_field "$record_id" "当前步骤" "\"$step\""
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
push_feishu() {
|
|
29
|
+
local msg=$1
|
|
30
|
+
lark-cli im +messages-send --user-id "$FEISHU_USER" --text "$msg" 2>/dev/null
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
upload_file() {
|
|
34
|
+
local record_id=$1 field=$2 file=$3
|
|
35
|
+
cd "$ZINIAO_DL"
|
|
36
|
+
lark-cli base +record-upload-attachment \
|
|
37
|
+
--base-token "$BASE_TOKEN" --table-id "$TABLE_ID" \
|
|
38
|
+
--record-id "$record_id" --field-id "$field" --file "$file" 2>/dev/null
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
# ── 主循环 ──
|
|
42
|
+
echo "🔍 Argent FULL 轮询启动..."
|
|
43
|
+
push_feishu "🔍 Argent FULL 货件轮询已启动"
|
|
44
|
+
|
|
45
|
+
while true; do
|
|
46
|
+
# 查询 Pending 且就绪的记录
|
|
47
|
+
echo "📋 轮询..."
|
|
48
|
+
RECORDS=$(lark-cli base +record-list \
|
|
49
|
+
--base-token "$BASE_TOKEN" --table-id "$TABLE_ID" \
|
|
50
|
+
--filter 'CurrentValue.[状态]="Pending"' 2>/dev/null | \
|
|
51
|
+
python3 -c "
|
|
52
|
+
import sys,json
|
|
53
|
+
try:
|
|
54
|
+
d=json.load(sys.stdin)
|
|
55
|
+
for r in d['data']['items']:
|
|
56
|
+
f=r['fields']
|
|
57
|
+
if f.get('就绪')==True:
|
|
58
|
+
print(r['_record_id'])
|
|
59
|
+
print(f.get('SKU',''))
|
|
60
|
+
print(f.get('品名',''))
|
|
61
|
+
print(str(f.get('数量','')))
|
|
62
|
+
print(str(f.get('箱数','')))
|
|
63
|
+
break
|
|
64
|
+
except: pass
|
|
65
|
+
")
|
|
66
|
+
|
|
67
|
+
if [ -z "$RECORDS" ]; then
|
|
68
|
+
sleep 30
|
|
69
|
+
continue
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
# 解析记录
|
|
73
|
+
RECORD_ID=$(echo "$RECORDS" | head -1)
|
|
74
|
+
SKU=$(echo "$RECORDS" | head -2 | tail -1)
|
|
75
|
+
NAME=$(echo "$RECORDS" | head -3 | tail -1)
|
|
76
|
+
QTY=$(echo "$RECORDS" | head -4 | tail -1)
|
|
77
|
+
BOX=$(echo "$RECORDS" | head -5 | tail -1)
|
|
78
|
+
|
|
79
|
+
echo "🚀 开始处理: $SKU $NAME ${QTY}件 ${BOX}箱"
|
|
80
|
+
push_feishu "🚀 FULL 货件启动: $SKU $NAME ${QTY}件 ${BOX}箱"
|
|
81
|
+
update_field "$RECORD_ID" "状态" '"运行中"'
|
|
82
|
+
update_step "$RECORD_ID" "步骤1:打开店铺"
|
|
83
|
+
|
|
84
|
+
# ── 步骤1-3:前期准备+选品 ──
|
|
85
|
+
ziniao-cli store open --name "$STORE_NAME" --headless 2>/dev/null
|
|
86
|
+
ziniao-cli page visit --store-id "$STORE_ID" \
|
|
87
|
+
--url "https://myaccount.mercadolibre.com.mx/shipping/inbounds" --wait-until networkidle 2>/dev/null
|
|
88
|
+
|
|
89
|
+
# 点击 Enviar productos
|
|
90
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
91
|
+
(function(){var l=document.querySelectorAll('a.andes-button');for(var i=0;i<l.length;i++){if(l[i].textContent.trim()==='Enviar productos'){l[i].click();break;}}return'ok';})();
|
|
92
|
+
" 2>/dev/null
|
|
93
|
+
|
|
94
|
+
sleep 5
|
|
95
|
+
|
|
96
|
+
# 搜索SKU
|
|
97
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
98
|
+
(function(){var i=document.querySelector('input[placeholder*=\"搜索\"]');if(!i)return;var ns=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,'value').set;ns.call(i,'$SKU');i.dispatchEvent(new Event('input',{bubbles:true}));i.dispatchEvent(new KeyboardEvent('keydown',{key:'Enter',bubbles:true}));return'searched';})();
|
|
99
|
+
" 2>/dev/null
|
|
100
|
+
|
|
101
|
+
sleep 3
|
|
102
|
+
|
|
103
|
+
# 填数量
|
|
104
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
105
|
+
(function(){var inputs=document.querySelectorAll('input[id^=\"_r_\"]');var q=null;inputs.forEach(function(x){if(!x.placeholder&&x.getBoundingClientRect().top>500)q=x;});if(q){q.click();q.focus();var ns=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,'value').set;ns.call(q,'$QTY');q.dispatchEvent(new Event('input',{bubbles:true}));}return'ok';})();
|
|
106
|
+
" 2>/dev/null
|
|
107
|
+
|
|
108
|
+
# 点击 Continuar
|
|
109
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
110
|
+
(function(){var b=document.querySelectorAll('button');for(var i=0;i<b.length;i++){if(b[i].textContent.trim()==='Continuar'||b[i].textContent.trim()==='继续'){b[i].click();break;}}return'ok';})();
|
|
111
|
+
" 2>/dev/null
|
|
112
|
+
|
|
113
|
+
sleep 4
|
|
114
|
+
|
|
115
|
+
# 弹窗关闭
|
|
116
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
117
|
+
(function(){var b=document.querySelectorAll('button');for(var i=0;i<b.length;i++){if(b[i].textContent.includes('Mantener')||b[i].textContent.includes('维持')||b[i].textContent.includes('seguir')){b[i].click();break;}}return'ok';})();
|
|
118
|
+
" 2>/dev/null
|
|
119
|
+
|
|
120
|
+
sleep 3
|
|
121
|
+
|
|
122
|
+
# 获取货件号
|
|
123
|
+
SHIPMENT=$(ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
124
|
+
(function(){var m=location.href.match(/inbounds\\/(\d+)/);return m?m[1]:'unknown';})();
|
|
125
|
+
" 2>/dev/null | python3 -c "import sys,json;print(json.load(sys.stdin)['data']['data']['result'])" 2>/dev/null)
|
|
126
|
+
|
|
127
|
+
update_field "$RECORD_ID" "货件号" "\"$SHIPMENT\""
|
|
128
|
+
update_step "$RECORD_ID" "步骤4:预约时间"
|
|
129
|
+
|
|
130
|
+
push_feishu "✅ 步骤1-3完成: 货件 #$SHIPMENT $SKU ${QTY}件"
|
|
131
|
+
|
|
132
|
+
# ── 步骤4:预约 ──
|
|
133
|
+
# 进入预约页
|
|
134
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
135
|
+
(function(){
|
|
136
|
+
var c=document.querySelector('[role=combobox]');var r=c.getBoundingClientRect(),x=r.left+r.width/2,y=r.top+r.height/2;
|
|
137
|
+
c.dispatchEvent(new PointerEvent('pointerover',{bubbles:true,clientX:x,clientY:y,pointerId:1,pointerType:'mouse'}));
|
|
138
|
+
c.dispatchEvent(new PointerEvent('pointerenter',{bubbles:true,clientX:x,clientY:y,pointerId:1,pointerType:'mouse'}));
|
|
139
|
+
c.dispatchEvent(new PointerEvent('pointerdown',{bubbles:true,clientX:x,clientY:y,pointerId:1,pointerType:'mouse',button:0,buttons:1}));
|
|
140
|
+
c.dispatchEvent(new PointerEvent('pointerup',{bubbles:true,clientX:x,clientY:y,pointerId:1,pointerType:'mouse',button:0,buttons:0}));
|
|
141
|
+
c.dispatchEvent(new MouseEvent('click',{bubbles:true,cancelable:true,clientX:x,clientY:y,button:0,view:window}));
|
|
142
|
+
return'ok';
|
|
143
|
+
})();" 2>/dev/null
|
|
144
|
+
sleep 1
|
|
145
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
146
|
+
(function(){var o=document.querySelectorAll('[role=option]');for(var i=0;i<o.length;i++){if(o[i].textContent.includes('Vehículo')){o[i].click();break;}}return'ok';})();
|
|
147
|
+
" 2>/dev/null
|
|
148
|
+
sleep 1
|
|
149
|
+
# 开日历
|
|
150
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
151
|
+
(function(){var i=document.querySelector('input[readonly][id^=\"_R_\"]');var r=i.getBoundingClientRect(),x=r.left+r.width/2,y=r.top+r.height/2;i.dispatchEvent(new PointerEvent('pointerover',{bubbles:true,clientX:x,clientY:y,pointerId:1,pointerType:'mouse'}));i.dispatchEvent(new PointerEvent('pointerenter',{bubbles:true,clientX:x,clientY:y,pointerId:1,pointerType:'mouse'}));i.dispatchEvent(new PointerEvent('pointerdown',{bubbles:true,clientX:x,clientY:y,pointerId:1,pointerType:'mouse',button:0,buttons:1}));i.dispatchEvent(new PointerEvent('pointerup',{bubbles:true,clientX:x,clientY:y,pointerId:1,pointerType:'mouse',button:0,buttons:0}));i.dispatchEvent(new MouseEvent('click',{bubbles:true,cancelable:true,clientX:x,clientY:y,button:0,view:window}));return'ok';})();
|
|
152
|
+
" 2>/dev/null
|
|
153
|
+
sleep 1
|
|
154
|
+
# 翻月
|
|
155
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
156
|
+
(function(){var n=document.querySelector('[aria-label=\"next month\"]');var r=n.getBoundingClientRect(),x=r.left+r.width/2,y=r.top+r.height/2;n.dispatchEvent(new PointerEvent('pointerover',{bubbles:true,clientX:x,clientY:y,pointerId:1,pointerType:'mouse'}));n.dispatchEvent(new PointerEvent('pointerenter',{bubbles:true,clientX:x,clientY:y,pointerId:1,pointerType:'mouse'}));n.dispatchEvent(new PointerEvent('pointerdown',{bubbles:true,clientX:x,clientY:y,pointerId:1,pointerType:'mouse',button:0,buttons:1}));n.dispatchEvent(new PointerEvent('pointerup',{bubbles:true,clientX:x,clientY:y,pointerId:1,pointerType:'mouse',button:0,buttons:0}));n.dispatchEvent(new MouseEvent('click',{bubbles:true,cancelable:true,clientX:x,clientY:y,button:0,view:window}));return'ok';})();
|
|
157
|
+
" 2>/dev/null
|
|
158
|
+
sleep 1
|
|
159
|
+
# 选日+选时+确认
|
|
160
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
161
|
+
(function(){var g=document.querySelector('div.day--current');var a=Array.from(document.querySelectorAll('div.day'));var t=a.indexOf(g)+31;var d=a[t];var r=d.getBoundingClientRect(),x=r.left+r.width/2,y=r.top+r.height/2;d.dispatchEvent(new PointerEvent('pointerdown',{bubbles:true,clientX:x,clientY:y,pointerId:1,pointerType:'mouse',button:0,buttons:1}));d.dispatchEvent(new PointerEvent('pointerup',{bubbles:true,clientX:x,clientY:y,pointerId:1,pointerType:'mouse',button:0,buttons:0}));d.dispatchEvent(new MouseEvent('click',{bubbles:true,cancelable:true,clientX:x,clientY:y,button:0,view:window}));return'd='+d.textContent;})();
|
|
162
|
+
" 2>/dev/null
|
|
163
|
+
sleep 1
|
|
164
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
165
|
+
(function(){var h=document.querySelector('div.hour');var r=h.getBoundingClientRect(),x=r.left+r.width/2,y=r.top+r.height/2;h.dispatchEvent(new PointerEvent('pointerdown',{bubbles:true,clientX:x,clientY:y,pointerId:1,pointerType:'mouse',button:0,buttons:1}));h.dispatchEvent(new PointerEvent('pointerup',{bubbles:true,clientX:x,clientY:y,pointerId:1,pointerType:'mouse',button:0,buttons:0}));h.dispatchEvent(new MouseEvent('click',{bubbles:true,cancelable:true,clientX:x,clientY:y,button:0,view:window}));return'ok';})();
|
|
166
|
+
" 2>/dev/null
|
|
167
|
+
sleep 1
|
|
168
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
169
|
+
(function(){var b=document.querySelectorAll('button');for(var i=0;i<b.length;i++){if(b[i].textContent.trim()==='Confirmar'&&!b[i].disabled){b[i].click();}}return'ok';})();
|
|
170
|
+
" 2>/dev/null
|
|
171
|
+
sleep 5
|
|
172
|
+
|
|
173
|
+
update_step "$RECORD_ID" "步骤5-6:包装+标签"
|
|
174
|
+
push_feishu "✅ 步骤4完成: #$SHIPMENT"
|
|
175
|
+
|
|
176
|
+
# ── 步骤5-6:包装确认+标签下载 ──
|
|
177
|
+
# 包装
|
|
178
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
179
|
+
(function(){var c=document.querySelectorAll('[role=button]');for(var i=0;i<c.length;i++){if(c[i].textContent.includes('Revisa')){c[i].click();break;}}return'ok';})();
|
|
180
|
+
" 2>/dev/null
|
|
181
|
+
sleep 2
|
|
182
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
183
|
+
(function(){var cbs=document.querySelectorAll('input[type=checkbox]');cbs.forEach(function(cb){cb.dispatchEvent(new MouseEvent('click',{bubbles:true,cancelable:true,view:window}));});var b=document.querySelectorAll('button');for(var i=0;i<b.length;i++){if(b[i].textContent.trim()==='Confirmar'){b[i].click();break;}}return'ok';})();
|
|
184
|
+
" 2>/dev/null
|
|
185
|
+
sleep 3
|
|
186
|
+
|
|
187
|
+
# 标签
|
|
188
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
189
|
+
(function(){var c=document.querySelectorAll('[role=button]');for(var i=0;i<c.length;i++){if(c[i].textContent.includes('etiquetas')&&!c[i].textContent.includes('bultos')){c[i].click();break;}}return'ok';})();
|
|
190
|
+
" 2>/dev/null
|
|
191
|
+
sleep 3
|
|
192
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
193
|
+
(function(){var b=document.querySelectorAll('button');for(var i=0;i<b.length;i++){if(b[i].textContent.trim()==='Producto'){b[i].click();break;}}document.querySelectorAll('[data-andes-checkbox-container]').forEach(function(c){var k=Object.keys(c).find(function(x){return x.startsWith('__reactFiber')});if(!k)return;var n=c[k];for(var j=0;j<15&&n;j++){if(n.memoizedProps&&n.memoizedProps.onChange){n.memoizedProps.onChange({target:{checked:true},preventDefault:function(){},stopPropagation:function(){}});break;}n=n.return;}});var btn=document.querySelectorAll('button');for(var i=0;i<btn.length;i++){if(btn[i].textContent.trim()==='Descargar etiquetas'&&!btn[i].disabled){btn[i].click();break;}}return'ok';})();
|
|
194
|
+
" 2>/dev/null
|
|
195
|
+
sleep 2
|
|
196
|
+
# Modal Normal + Download
|
|
197
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
198
|
+
(function(){var a=document.querySelectorAll('*');for(var i=0;i<a.length;i++){if(a[i].textContent.trim()==='Normal'&&a[i].children.length===0){a[i].click();break;}}var b=document.querySelectorAll('button');for(var i=0;i<b.length;i++){if(b[i].textContent.trim()==='Descargar etiquetas'&&b[i].closest('[role=dialog]')){b[i].click();break;}}return'ok';})();
|
|
199
|
+
" 2>/dev/null
|
|
200
|
+
sleep 2
|
|
201
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
202
|
+
(function(){var b=document.querySelectorAll('button');for(var i=0;i<b.length;i++){if(b[i].textContent.trim()==='Confirmar'&&!b[i].disabled){b[i].click();break;}}return'ok';})();
|
|
203
|
+
" 2>/dev/null
|
|
204
|
+
sleep 3
|
|
205
|
+
|
|
206
|
+
# 上传产品标签
|
|
207
|
+
LABEL_FILE=$(ls -t "$ZINIAO_DL"/Etiquetas-de-producto-*.pdf 2>/dev/null | head -1)
|
|
208
|
+
if [ -n "$LABEL_FILE" ]; then
|
|
209
|
+
LABEL_NAME=$(basename "$LABEL_FILE")
|
|
210
|
+
upload_file "$RECORD_ID" "产品标签" "$LABEL_NAME"
|
|
211
|
+
push_feishu "✅ 步骤6完成: 标签已上传"
|
|
212
|
+
fi
|
|
213
|
+
|
|
214
|
+
update_step "$RECORD_ID" "步骤7:箱唛打印"
|
|
215
|
+
|
|
216
|
+
# ── 步骤7:箱唛 ──
|
|
217
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
218
|
+
(function(){var c=document.querySelectorAll('[role=button]');for(var i=0;i<c.length;i++){if(c[i].textContent.includes('bultos')){c[i].click();break;}}return'ok';})();
|
|
219
|
+
" 2>/dev/null
|
|
220
|
+
sleep 3
|
|
221
|
+
# 填10箱 + No enviaré
|
|
222
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
223
|
+
(function(){var c=document.getElementById('checkVolumesId');if(c)c.dispatchEvent(new MouseEvent('click',{bubbles:true,cancelable:true,view:window}));var q=document.getElementById('labelsQuantity');if(q){q.click();q.focus();var ns=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,'value').set;ns.call(q,'$BOX');q.dispatchEvent(new Event('input',{bubbles:true}));}document.querySelectorAll('[data-andes-checkbox-container]').forEach(function(cb,i){var k=Object.keys(cb).find(function(x){return x.startsWith('__reactFiber')});if(!k)return;var n=cb[k];for(var j=0;j<15&&n;j++){if(n.memoizedProps&&n.memoizedProps.onChange){n.memoizedProps.onChange({target:{checked:i>=1},preventDefault:function(){},stopPropagation:function(){}});break;}n=n.return;}});return'ok';})();
|
|
224
|
+
" 2>/dev/null
|
|
225
|
+
sleep 1
|
|
226
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
227
|
+
(function(){var b=document.querySelectorAll('button');for(var i=0;i<b.length;i++){if(b[i].textContent.trim()==='Generar etiquetas'&&!b[i].disabled){b[i].click();return'generated';}}return'fail';})();
|
|
228
|
+
" 2>/dev/null
|
|
229
|
+
sleep 5
|
|
230
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
231
|
+
(function(){var b=document.querySelectorAll('button');for(var i=0;i<b.length;i++){if(b[i].textContent.includes('Descarga todas')){b[i].click();break;}}return'ok';})();
|
|
232
|
+
" 2>/dev/null
|
|
233
|
+
sleep 2
|
|
234
|
+
# Modal
|
|
235
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
236
|
+
(function(){var a=document.querySelectorAll('*');for(var i=0;i<a.length;i++){if(a[i].textContent.trim()==='Normal'&&a[i].children.length===0){a[i].click();break;}}var b=document.querySelectorAll('button');for(var i=0;i<b.length;i++){if(b[i].textContent.trim()==='Descargar etiquetas'&&!!b[i].closest('[role=dialog]')){b[i].click();break;}}return'ok';})();
|
|
237
|
+
" 2>/dev/null
|
|
238
|
+
sleep 3
|
|
239
|
+
|
|
240
|
+
# 上传箱唛
|
|
241
|
+
BOX_FILE=$(ls -t "$ZINIAO_DL"/Envio-*-Etiquetas-de-bultos.pdf 2>/dev/null | head -1)
|
|
242
|
+
if [ -n "$BOX_FILE" ]; then
|
|
243
|
+
BOX_NAME=$(basename "$BOX_FILE")
|
|
244
|
+
upload_file "$RECORD_ID" "箱唛" "$BOX_NAME"
|
|
245
|
+
fi
|
|
246
|
+
|
|
247
|
+
update_step "$RECORD_ID" "步骤8:取消预约"
|
|
248
|
+
push_feishu "✅ 步骤7完成: 箱唛已上传"
|
|
249
|
+
|
|
250
|
+
# ── 步骤8:取消预约 ──
|
|
251
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
252
|
+
(function(){var l=document.querySelectorAll('a');var c=0;for(var i=0;i<l.length;i++){if(l[i].textContent.trim()==='Editar'){c++;if(c===2){l[i].click();break;}}}return'ok';})();
|
|
253
|
+
" 2>/dev/null
|
|
254
|
+
sleep 3
|
|
255
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
256
|
+
(function(){window.scrollTo(0,1500);var b=document.querySelectorAll('button');for(var i=0;i<b.length;i++){if(b[i].textContent.trim()==='Cancelar reserva'){b[i].click();return'ok';}}return'fail';})();
|
|
257
|
+
" 2>/dev/null
|
|
258
|
+
sleep 1
|
|
259
|
+
ziniao-cli page exec --store-id "$STORE_ID" --script "
|
|
260
|
+
(function(){var b=document.querySelectorAll('button');for(var i=0;i<b.length;i++){if(b[i].textContent.trim()==='Cancelar cita'){b[i].click();break;}}return'ok';})();
|
|
261
|
+
" 2>/dev/null
|
|
262
|
+
|
|
263
|
+
# ── 完成 ──
|
|
264
|
+
update_field "$RECORD_ID" "状态" '"已完成"'
|
|
265
|
+
update_step "$RECORD_ID" "全部完成"
|
|
266
|
+
update_field "$RECORD_ID" "就绪" "false" # 取消勾选,防止重复触发
|
|
267
|
+
ziniao-cli store close --id "$STORE_ID" 2>/dev/null
|
|
268
|
+
|
|
269
|
+
push_feishu "🎉 FULL 货件完成!\nSKU: $SKU $NAME\n货件: #$SHIPMENT\n数量: ${QTY}件 / ${BOX}箱\n文件已上传到飞书多维表格"
|
|
270
|
+
echo "✅ $SKU 完成"
|
|
271
|
+
done
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# FULL 货件操作报告
|
|
2
|
+
|
|
3
|
+
**操作时间**: {{created_at}}
|
|
4
|
+
**货件 ID**: {{shipment_id}}
|
|
5
|
+
**店铺**: {{store}}
|
|
6
|
+
**状态**: {{status}}
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 货件摘要
|
|
11
|
+
|
|
12
|
+
| SKU | 数量 | 状态 |
|
|
13
|
+
|-----|------|------|
|
|
14
|
+
{{#each skus}}
|
|
15
|
+
| {{sku}} | {{qty}} | {{status}} |
|
|
16
|
+
{{/each}}
|
|
17
|
+
|
|
18
|
+
**总件数**: {{total_units}}
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 操作记录
|
|
23
|
+
|
|
24
|
+
| 步骤 | 名称 | 状态 | 备注 |
|
|
25
|
+
|------|------|------|------|
|
|
26
|
+
| 1 | 前期准备 | {{step1}} | |
|
|
27
|
+
| 2 | 进入创建入口 | {{step2}} | |
|
|
28
|
+
| 3 | 选择产品与数量 | {{step3}} | |
|
|
29
|
+
| 4 | 预约时间 | {{step4}} | {{appointment}} |
|
|
30
|
+
| 5 | 包装确认 | {{step5}} | |
|
|
31
|
+
| 6 | 标签下载 | {{step6}} | |
|
|
32
|
+
| 7 | 打印箱唛 | {{step7}} | |
|
|
33
|
+
| 8 | 取消预约 | {{step8}} | 预约已取消 |
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 警告
|
|
38
|
+
|
|
39
|
+
{{#if warnings}}
|
|
40
|
+
{{#each warnings}}
|
|
41
|
+
- ⚠️ {{this}}
|
|
42
|
+
{{/each}}
|
|
43
|
+
{{else}}
|
|
44
|
+
✅ 无异常
|
|
45
|
+
{{/if}}
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 下次建议
|
|
50
|
+
|
|
51
|
+
{{next_action}}
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
*本报告由 Argent 美客多 FULL 货件管理 Skill 自动生成*
|