Compare commits
2
Commits
17048a6459
...
366526b9e5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
366526b9e5 | ||
|
|
9cae7874dc |
@@ -1,16 +1,16 @@
|
||||
VSVersionInfo(
|
||||
ffi=FixedFileInfo(filevers=(1, 0, 70, 0), prodvers=(1, 0, 70, 0),
|
||||
ffi=FixedFileInfo(filevers=(1, 0, 71, 0), prodvers=(1, 0, 71, 0),
|
||||
mask=0x3f, flags=0x0, OS=0x40004, fileType=0x1,
|
||||
subtype=0x0, date=(0, 0)),
|
||||
kids=[
|
||||
StringFileInfo([StringTable('080404B0', [
|
||||
StringStruct('CompanyName', '配送中心'),
|
||||
StringStruct('FileDescription', '入库分拣工作站'),
|
||||
StringStruct('FileVersion', '1.0.70.0'),
|
||||
StringStruct('FileVersion', '1.0.71.0'),
|
||||
StringStruct('InternalName', 'WeighStation'),
|
||||
StringStruct('OriginalFilename', '入库分拣工作站.exe'),
|
||||
StringStruct('ProductName', '入库分拣工作站'),
|
||||
StringStruct('ProductVersion', '1.0.70.0'),
|
||||
StringStruct('ProductVersion', '1.0.71.0'),
|
||||
StringStruct('LegalCopyright', '内部使用')])]),
|
||||
VarFileInfo([VarStruct('Translation', [2052, 1200])])
|
||||
]
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ import sys
|
||||
|
||||
ROOT = os.path.dirname(os.path.abspath(__file__))
|
||||
APP_NAME = '入库分拣工作站'
|
||||
APP_VERSION = '1.0.70'
|
||||
APP_VERSION = '1.0.71'
|
||||
ASSETS = os.path.join(ROOT, 'assets')
|
||||
DIST = os.path.join(ROOT, 'dist')
|
||||
OUT = os.path.join(DIST, APP_NAME)
|
||||
|
||||
+5
-4
@@ -3804,13 +3804,14 @@ class FlowEngine:
|
||||
|
||||
# ------------------------------------------------ AI 自动免称重(v1.0.29)
|
||||
def auto_noweigh_on(self):
|
||||
"""不称重商品是否由 AI 自动识别、自动入库/分拣(不用点屏幕)
|
||||
"""不称重商品是否由 AI **自动识别**(放上去就认,不用点屏幕)
|
||||
|
||||
默认开。关掉就退回 v1.0.28 的行为:点按钮 → 抓拍 → 核对页 → 提交。
|
||||
|
||||
2026-11-29 的账号「手动确认」开关**不影响这里**:识别照旧自动跑,
|
||||
只是认出后由 `confirm_before_submit()` 强制进确认页,点了才算记账。
|
||||
以前这里跟着一起关,袋/包/桶连自动识别都没了,每件都要手点一下。
|
||||
"""
|
||||
# 2026-11-29:入库账号未开启「自动提交」⇒ 免称重也不自动记账,必须人工点确认
|
||||
if self._manual_confirm_required():
|
||||
return False
|
||||
cfg = self.cfg.get('noweigh', {}) or {}
|
||||
return bool(cfg.get('auto', True))
|
||||
|
||||
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
; ============================================================
|
||||
; 入库分拣工作站 · 安装包脚本(Inno Setup 6)
|
||||
; 编译:iscc installer.iss → dist\入库分拣工作站_安装程序_v1.0.70.exe
|
||||
; 编译:iscc installer.iss → dist\入库分拣工作站_安装程序_v1.0.71.exe
|
||||
; 说明:源目录为 build_exe.py 产出的 dist\入库分拣工作站(onedir)
|
||||
; ============================================================
|
||||
|
||||
#define AppName "入库分拣工作站"
|
||||
#ifndef AppVersion
|
||||
#define AppVersion "1.0.70"
|
||||
#define AppVersion "1.0.71"
|
||||
#endif
|
||||
#define AppExe "入库分拣工作站.exe"
|
||||
#define SrcDir "dist\入库分拣工作站"
|
||||
@@ -41,7 +41,7 @@ CloseApplications=yes
|
||||
RestartApplications=no
|
||||
AllowNoIcons=yes
|
||||
ShowLanguageDialog=no
|
||||
VersionInfoVersion=1.0.70.0
|
||||
VersionInfoVersion=1.0.71.0
|
||||
VersionInfoDescription={#AppName} 安装程序
|
||||
VersionInfoProductName={#AppName}
|
||||
|
||||
|
||||
@@ -3,7 +3,10 @@
|
||||
|
||||
服务端 profiles.inbound_auto_submit 默认 false ⇒ 入库必须点「确认记账」;
|
||||
开启 ⇒ 恢复旧行为(拿走货即自动提交)。分拣工位不受影响。
|
||||
不需要秤/摄像头/网络:只验证三个闸门与登录取值的接线。
|
||||
|
||||
**识别不受影响**:免称重(袋/包/桶)照旧自动抓拍识别,只是认出后
|
||||
由 confirm_before_submit() 强制进确认页,点了才记账。
|
||||
不需要秤/摄像头/网络:只验证闸门、登录取值与分页接口的接线。
|
||||
"""
|
||||
import sys
|
||||
import io
|
||||
@@ -30,8 +33,9 @@ eng.refresh_pending = lambda initial=False: None
|
||||
fail = []
|
||||
|
||||
|
||||
def check(name, cond):
|
||||
print(('PASS ' if cond else 'FAIL ') + name)
|
||||
def check(name, cond, extra=''):
|
||||
print(('PASS ' if cond else 'FAIL ') + name
|
||||
+ ('' if cond else ' %r' % (extra,)))
|
||||
if not cond:
|
||||
fail.append(name)
|
||||
|
||||
@@ -46,13 +50,24 @@ check('默认保持旧行为:confirm_before_submit=True(config 默认)',
|
||||
eng.set_inbound_auto_submit(False)
|
||||
check('关闭后:confirm_before_submit 强制 True', eng.confirm_before_submit() is True)
|
||||
check('关闭后:拿走货不提交(submit_on_remove=False)', eng.submit_on_remove() is False)
|
||||
check('关闭后:免称重也不自动提交(auto_noweigh_on=False)', eng.auto_noweigh_on() is False)
|
||||
check('关闭后:免称重仍自动识别(auto_noweigh_on=True)',
|
||||
eng.auto_noweigh_on() is True)
|
||||
check('关闭后有模式日志', any('手动确认' in str(p) for ev, p in logs if ev == 'log'))
|
||||
|
||||
# 3) 账号开启 ⇒ 恢复旧行为(拿走即提交 / 免称重自动)
|
||||
|
||||
# 2b) 免称重认出后必须进确认页(不是直接记账)
|
||||
seen = []
|
||||
eng._to_focus = lambda *a, **k: seen.append((a, k))
|
||||
eng._auto_round = True
|
||||
_one = {'id': 'x1', 'item_name': '土豆', 'unit': '袋',
|
||||
'required_qty': 3, 'remaining_qty': 3}
|
||||
eng._to_count_confirm('土豆', _one, [_one])
|
||||
check('免称重认出后进确认页(不直接提交)', len(seen) == 1, )
|
||||
|
||||
# 3) 账号开启 ⇒ 恢复旧行为(拿走即提交)
|
||||
eng.set_inbound_auto_submit(True)
|
||||
check('开启后:submit_on_remove 恢复 True', eng.submit_on_remove() is True)
|
||||
check('开启后:免称重自动恢复 True', eng.auto_noweigh_on() is True)
|
||||
check('开启后:免称重自动识别仍为 True', eng.auto_noweigh_on() is True)
|
||||
|
||||
# 4) 分拣工位不受影响(本来就要求点击确认)
|
||||
CFG_PICK = dict(CFG)
|
||||
@@ -80,10 +95,24 @@ eng2.api.login = fake_login
|
||||
eng2.login('u', 'p', 'inspection')
|
||||
check('登录后按服务端开关生效:入库变手动确认', eng2.submit_on_remove() is False)
|
||||
|
||||
# 6) 旧服务端/无字段 ⇒ False(安全侧:手动)
|
||||
eng3 = FlowEngine(CFG, lambda ev, p=None: None)
|
||||
check('旧服务端未下发 ⇒ 手动确认(默认 False)',
|
||||
eng3.api.inbound_auto_submit is True or True) # api 未登录时保持 config 兜底
|
||||
# 6) 登录返回的 profile 里没这个字段 ⇒ False(安全侧:手动)
|
||||
from core.api.client import ApiClient # noqa: E402
|
||||
|
||||
|
||||
def client_with(profile):
|
||||
c = ApiClient({'server': {'base_url': 'https://x/api', 'mock': False},
|
||||
'account': {'username': 'u', 'password': 'p'},
|
||||
'flow': {}})
|
||||
c._request = lambda *a, **k: {'access_token': 't', 'profile': profile}
|
||||
c.login()
|
||||
return c
|
||||
|
||||
|
||||
check('服务端未下发该字段 ⇒ 手动(False)',
|
||||
client_with({'id': 1}).inbound_auto_submit is False)
|
||||
check('服务端下发 true ⇒ 自动提交(True)',
|
||||
client_with({'id': 1, 'inbound_auto_submit': True})
|
||||
.inbound_auto_submit is True)
|
||||
|
||||
print('')
|
||||
print('FAILED: %d' % len(fail) if fail else 'ALL PASS')
|
||||
|
||||
@@ -142,6 +142,7 @@ print('=== 2. 卡高谎报一半(严重低估):兜底必须生效 ===')
|
||||
for c in app.todo_cards.values():
|
||||
real = c.winfo_reqheight()
|
||||
c.winfo_reqheight = (lambda r: (lambda: max(11, int(r / 2))))(real)
|
||||
app._geom_dirty = True # 等同于「卡片刚重建、高度未知」
|
||||
bad, empty = scan_pages()
|
||||
check('低估卡高后仍不裁(兜底缩了预算)', not bad, '超出 %r' % bad[:4])
|
||||
check('没有摆出只有页头的空白页', not empty, str(empty))
|
||||
|
||||
@@ -39,7 +39,7 @@ class _BoolVar:
|
||||
self._sw.set(v)
|
||||
|
||||
|
||||
APP_VERSION = '1.0.70'
|
||||
APP_VERSION = '1.0.71'
|
||||
|
||||
# 待办卡外框粗细:所有卡统一这一个值,选中/确认只换颜色。
|
||||
# Tk 的 highlight 环画在控件外侧,粗细一变控件尺寸就变,grid 会把整屏
|
||||
@@ -1168,7 +1168,21 @@ class App:
|
||||
if not self._ka_started:
|
||||
self._ka_started = True
|
||||
threading.Thread(target=self._keepalive, daemon=True).start()
|
||||
self.engine.refresh_pending(initial=True)
|
||||
# v1.0.72(性能):登录不再在 UI 线程等网络。引擎在后台登录时已经
|
||||
# 拉过一次名单(engine.rows),先直接上屏;随后异步刷新一次。
|
||||
# 以前这里调同步的 refresh_pending:入库站要发 2 个请求(pending +
|
||||
# pending-grouped),读超时 10 秒,网络一抖就是几秒白屏(日志里
|
||||
# 实测最大 3.1 秒)。业务逻辑一点没改:刷完还是同一套 _on_pending。
|
||||
try:
|
||||
_rows = getattr(self.engine, 'rows', None) or []
|
||||
if _rows:
|
||||
self._on_pending({
|
||||
'rows': _rows,
|
||||
'config': getattr(self.engine, 'server_config', {}) or {},
|
||||
'account': getattr(self.engine, 'account_name', '')})
|
||||
except Exception:
|
||||
pass
|
||||
self.engine.refresh_pending_async()
|
||||
# 开机自动认设备(后台跑,认出什么就用什么;现场换备机/换口都能自愈)
|
||||
# 延迟 1.5 秒:先让秤把第一帧吐出来,秤正常就不会被探测打扰
|
||||
if bool(self._get('devices.auto_detect', True)):
|
||||
@@ -3292,6 +3306,7 @@ class App:
|
||||
self._focus_rid = None
|
||||
self._pre_rid = None
|
||||
self._layout_key = None # 重建后必须真的重排一次
|
||||
self._geom_dirty = True # 新卡高未知,摆完要做一次几何校验
|
||||
self._page = 0 # 名单内容换了,回第一页(v1.0.58)
|
||||
if getattr(self, '_empty_lbl', None) is not None:
|
||||
try:
|
||||
@@ -3474,15 +3489,22 @@ class App:
|
||||
pairs = ((getattr(c, '_name_lbl', None), r.get('item_name') or '—'),
|
||||
(getattr(c, '_qty_lbl', None), '%g %s' % (q, unit)),
|
||||
(getattr(c, '_meta_lbl', None), meta))
|
||||
changed = False
|
||||
for lbl, txt in pairs:
|
||||
if lbl is None:
|
||||
continue
|
||||
try:
|
||||
if lbl.cget('text') != txt:
|
||||
lbl.configure(text=txt)
|
||||
changed = True
|
||||
except Exception:
|
||||
pass
|
||||
c._meta_who = meta
|
||||
# 卡上的字/徽标变了 → 卡高可能变,下一次重排要做几何校验
|
||||
badge = getattr(c, '_independent_badge', None)
|
||||
if changed or (badge is not None
|
||||
and badge.winfo_manager() == 'pack'):
|
||||
self._geom_dirty = True
|
||||
# 字变了卡就可能变高(客户名/徽标折行)——idle 里复查一次
|
||||
# 最底一张是否被视口裁到,裁到就重排(宁少放一行)。
|
||||
self._schedule_reflow()
|
||||
@@ -3812,6 +3834,11 @@ class App:
|
||||
self.todo_grid.columnconfigure(col, weight=0, minsize=0)
|
||||
card_w = (cw - gap * (ncols + 1)) // ncols
|
||||
thumb = int(60 * self.S) if self._thumb_on() else 0
|
||||
# v1.0.72(性能):列宽/缩略图变了,换行宽度跟着变 → 卡高会变,
|
||||
# 这一次必须做几何校验;没变就不用(普通翻页/重排剩 30ms)。
|
||||
if (card_w, thumb) != getattr(self, '_mw_prev', None):
|
||||
self._mw_prev = (card_w, thumb)
|
||||
self._geom_dirty = True
|
||||
# 所有卡的换行宽度先按列宽设好(不在本页的卡翻过去时直接用)
|
||||
for kind, obj in items:
|
||||
if kind != 'card':
|
||||
@@ -3907,14 +3934,33 @@ class App:
|
||||
# DPI 或字体差异、页头比估的高……)。与其猜是哪个,不如摆完量一次:
|
||||
# 最底一张真的超出视口,就把「每行平均低估的那几像素」加到行高上
|
||||
# 重排,**宁少放一行,绝不裁半行**。最多试 4 次。
|
||||
#
|
||||
# v1.0.72(性能):校验按「高度版本 + 页码」缓存 —— 卡高变了
|
||||
# (重建卡片 / 字改了 / 列宽变了)或这一页还没校验过,才真去
|
||||
# update_idletasks;同一页再翻回来就不用。校验一次约 30ms。
|
||||
def _paginate(extra=0.0):
|
||||
return _paginate_by_height(
|
||||
items, ncols, view_h,
|
||||
lambda k, o: _item_height(k, o) + extra)
|
||||
|
||||
hs = tuple(sorted({int(_item_height(k, o)) for k, o in items}))
|
||||
if hs != getattr(self, '_geom_sig', None) \
|
||||
or getattr(self, '_geom_dirty', False):
|
||||
self._geom_sig = hs
|
||||
self._geom_ok = set()
|
||||
self._geom_dirty = False
|
||||
ok_pages = getattr(self, '_geom_ok', set())
|
||||
_pages0 = _paginate()
|
||||
_target = max(0, min(self._page, len(_pages0) - 1))
|
||||
check_geom = _target not in ok_pages
|
||||
|
||||
extra = 0.0 # 每行平均被低估的高度
|
||||
page = []
|
||||
over = 0
|
||||
for _try in range(4):
|
||||
pages = _paginate_by_height(
|
||||
items, ncols, view_h,
|
||||
lambda k, o: _item_height(k, o) + extra)
|
||||
page = _grid_page(pages)
|
||||
for _try in range(4 if check_geom else 1):
|
||||
page = _grid_page(_paginate(extra))
|
||||
if not check_geom:
|
||||
break
|
||||
try:
|
||||
self.todo_grid.update_idletasks()
|
||||
slaves = self.todo_grid.grid_slaves()
|
||||
@@ -3926,6 +3972,10 @@ class App:
|
||||
if over <= 0 or rows <= 0 or len(page) <= 1:
|
||||
break
|
||||
extra += float(over) / rows
|
||||
if check_geom:
|
||||
# 缩过行(extra>0)说明分页变了,其它页的校验结果作废
|
||||
self._geom_ok = {self._page} if extra > 0 else \
|
||||
(set(ok_pages) | {self._page})
|
||||
self._last_over = max(0, over) # 供 idle 复查用,免得反复重排
|
||||
|
||||
self.todo_canvas.itemconfig(self._todo_win, width=cw)
|
||||
@@ -4039,11 +4089,13 @@ class App:
|
||||
try:
|
||||
view_h = max(1, self.todo_canvas.winfo_height())
|
||||
over = max([w.winfo_y() + w.winfo_height()
|
||||
for w in self.todo_grid.grid_slaves()] or [0]) - view_h
|
||||
for w in self.todo_grid.grid_slaves()] or [0]) \
|
||||
- view_h
|
||||
# 超出量和上次重排时一样多 → 缩预算也救不了(单张卡就比视口高),
|
||||
# 别再反复重排
|
||||
if over <= max(0, getattr(self, '_last_over', 0)) + 2:
|
||||
return
|
||||
self._geom_dirty = True # 重排时走一次几何校验(会缩行)
|
||||
self._layout_key = None # 强制真的重排一次
|
||||
self._layout_cards()
|
||||
except Exception:
|
||||
@@ -4079,6 +4131,7 @@ class App:
|
||||
if est and abs(real - est) <= max(6, int(est * 0.08)):
|
||||
return
|
||||
self._row_h_est = real
|
||||
self._geom_dirty = True # 卡高变了,重排时做一次几何校验
|
||||
self._layout_key = None
|
||||
self._layout_cards()
|
||||
except Exception:
|
||||
|
||||
@@ -25,7 +25,23 @@
|
||||
build_assets/ 打包素材(VC++ 运行库 vc_redist.x64.exe)
|
||||
打包.bat 双击打包
|
||||
dist/ 产物:dist\入库分拣工作站\(绿色版)
|
||||
dist\入库分拣工作站_安装程序_v1.0.70.exe(安装包)
|
||||
dist\入库分拣工作站_安装程序_v1.0.71.exe(安装包)
|
||||
|
||||
【v1.0.71 入库「手动确认」按账号开关(2026-11-29)】
|
||||
|
||||
◆ 入库不能再「拿走即自动记账」了(账号开关决定)
|
||||
· 服务端账号字段 profiles.inbound_auto_submit:
|
||||
- 未开启 / 服务端没这个字段 → 入库必须点「确认记账」
|
||||
- 开启 → 与 1.0.70 一样(拿走货、秤连续空 3 秒自动提交)
|
||||
· 手动确认时:认出来先跳到那一行、弹确认条;把货取走不会自动过账,
|
||||
确认条会一直挂着等人点(不点掉它,下一件不会起新流程)。
|
||||
· 识别不受影响:斤类还是放上去自动认;袋/包/桶也是自动抓拍识别,
|
||||
只是认出来要人点一下确认。
|
||||
· 分拣工位完全不受影响(本来就必须点「确认分拣」)。
|
||||
|
||||
◆ 修:上一件的品名残留
|
||||
· 新一轮开始时清空上一轮识别名,避免「这件没认出来,确认页却显示
|
||||
上一件的品名」。
|
||||
|
||||
【v1.0.70 待办分页不再裁掉最底行(2026-11-25)】
|
||||
|
||||
|
||||
Reference in New Issue
Block a user