From 5f127c6c4fff366b7c45a45e8ecf2bdf1c4e2182 Mon Sep 17 00:00:00 2001 From: zhu-mengmeng <15588200382@163.com> Date: Sun, 22 Jun 2025 02:21:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=89=98=E7=9B=98?= =?UTF-8?q?=E6=A1=A3=E6=A1=88=E4=BF=9D=E5=AD=98=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8C=85=E8=A3=85=E5=8F=B7=E5=92=8C=E5=B1=82?= =?UTF-8?q?=E6=95=B0=E7=9A=84=E8=AE=B0=E5=BD=95=E4=B8=8E=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96=E5=8A=A0=E8=BD=BD=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E6=A1=86=E7=9A=84=E4=BA=A4=E4=BA=92=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dao/pallet_type_dao.py | 56 ++++++++++++++++++++++++++++++- db/jtDB.db | Bin 77824 -> 77824 bytes utils/pallet_type_manager.py | 22 ++++++++++-- widgets/loading_dialog_widget.py | 27 +++++++++++++++ 4 files changed, 101 insertions(+), 4 deletions(-) diff --git a/dao/pallet_type_dao.py b/dao/pallet_type_dao.py index e5f5b34..bc29b07 100644 --- a/dao/pallet_type_dao.py +++ b/dao/pallet_type_dao.py @@ -444,4 +444,58 @@ class PalletTypeDAO: return pallet_types except Exception as e: logging.error(f"获取托盘类型失败: {str(e)}") - return {} \ No newline at end of file + return {} + + def save_pallet_archives(self, pallet_code, tier, user_id, user_name): + """保存托盘档案 + + Args: + pallet_code: 包装号 + tier: 托盘料层数 + user_id: 用户ID + user_name: 用户名(已废弃,保留参数兼容性) + + Returns: + bool: 是否保存成功 + """ + try: + current_time = datetime.now() + + # 检查是否已存在相同的包装号记录 + sql = """ + SELECT id FROM wsbz_pallet_archives + WHERE pallet_code = ? AND is_deleted = FALSE + """ + self.db.cursor.execute(sql, (pallet_code,)) + existing_record = self.db.cursor.fetchone() + + if existing_record: + # 更新现有记录 + update_sql = """ + UPDATE wsbz_pallet_archives + SET tier = ?, + update_time = ?, + update_by = ? + WHERE id = ? + """ + params = (tier, current_time, user_id, existing_record[0]) + self.db.execute_update(update_sql, params) + logging.info(f"更新托盘档案记录:包装号={pallet_code}, 层数={tier}") + else: + # 插入新记录 + insert_sql = """ + INSERT INTO wsbz_pallet_archives ( + pallet_code, tier, create_time, create_by, + update_time, update_by, enabled, is_deleted + ) VALUES (?, ?, ?, ?, ?, ?, TRUE, FALSE) + """ + params = (pallet_code, tier, current_time, user_id, + current_time, user_id) + self.db.execute_update(insert_sql, params) + logging.info(f"创建新托盘档案记录:包装号={pallet_code}, 层数={tier}") + + return True + + except Exception as e: + logging.error(f"保存托盘档案失败: {str(e)}") + return False \ No newline at end of file diff --git a/db/jtDB.db b/db/jtDB.db index d5f56fa9fcffe8e77f0ca4c11a4a58055e47fee3..96af15d3b5c1bf3b08fff990e976c796d19a58d4 100644 GIT binary patch delta 196 zcmZp8z|!!5Wr8&0pNTTgjDI#JwAi!pOY$C=`HgvA@Y-z_6gbCIU&t@Oz`(%C;Hd4W&B4H+$;e=2U}UOmV5Vziq+noVWoT(- zYOZHtXlh|>`DE|r7p?oAuUq(hLfg}cGl*8`72+Ha5@2L%U}j)qXv7@C3$fBz)>w9P I`resE0J3pB@&Et; delta 98 zcmV-o0G