From bf2c7fd3c50d1d28d43fbaa858b31eb503241f28 Mon Sep 17 00:00:00 2001
From: mgw <1392924357@qq.com>
Date: Tue, 20 Aug 2024 11:27:18 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=A7=A3=E7=BB=91=E6=89=98?=
=?UTF-8?q?=E7=9B=98=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_manufacturing/models/mrp_workorder.py | 16 ++++++++++++++++
sf_manufacturing/views/mrp_workorder_view.xml | 4 ++++
2 files changed, 20 insertions(+)
diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py
index 847e1a37..1b4cc642 100644
--- a/sf_manufacturing/models/mrp_workorder.py
+++ b/sf_manufacturing/models/mrp_workorder.py
@@ -135,6 +135,9 @@ class ResMrpWorkOrder(models.Model):
surface_technics_picking_count = fields.Integer("外协出入库", compute='_compute_surface_technics_picking_ids')
surface_technics_purchase_count = fields.Integer("外协采购", compute='_compute_surface_technics_purchase_ids')
+ # 是否绑定托盘
+ is_trayed = fields.Boolean(string='是否绑定托盘', default=False)
+
@api.depends('name', 'production_id.name')
def _compute_surface_technics_picking_ids(self):
for workorder in self:
@@ -1248,6 +1251,18 @@ class ResMrpWorkOrder(models.Model):
record.production_id.button_mark_done1()
# record.production_id.state = 'done'
+ # 解绑托盘
+ def unbind_tray(self):
+ self.write({
+ 'rfid_code': False,
+ 'tray_serial_number': False,
+ 'tray_product_id': False,
+ 'tray_brand_id': False,
+ 'tray_type_id': False,
+ 'tray_model_id': False,
+ 'is_trayed': False
+ })
+
# 将FTP的检测报告文件下载到临时目录
def download_reportfile_tmp(self, workorder, reportpath):
@@ -1556,6 +1571,7 @@ class SfWorkOrderBarcodes(models.Model):
raise UserError('该Rfid【%s】绑定的是【%s】, 不是托盘!!!' % (barcode, lot.product_id.name))
self.process_state = '待检测'
self.date_start = datetime.now()
+ self.is_trayed = True
else:
raise UserError('没有找到Rfid为【%s】的托盘信息!!!' % barcode)
# stock_move_line = self.env['stock.move.line'].search([('lot_name', '=', barcode)])
diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml
index fb29dc96..be9cbf46 100644
--- a/sf_manufacturing/views/mrp_workorder_view.xml
+++ b/sf_manufacturing/views/mrp_workorder_view.xml
@@ -149,6 +149,7 @@
+
@@ -192,6 +193,9 @@
+