From ad0b9983bf04ae18aa02a00403e28f6bba9d6c25 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Fri, 23 Feb 2024 10:17:20 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=96=B0=E5=A2=9E=E6=A3=80=E6=B5=8B=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E9=93=BE=E6=8E=A5=E5=9C=B0=E5=9D=80=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=202.=E4=BC=98=E5=8C=96rfid=E7=A0=81=E6=89=AB=E6=8F=8F=203.?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B7=A5=E5=8D=95=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/controllers/controllers.py | 2 ++ sf_manufacturing/models/mrp_workorder.py | 21 ++++++++++++------- sf_manufacturing/views/mrp_workorder_view.xml | 20 ++++++++++-------- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index cb2fe7ab..55f4bfbf 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -325,6 +325,7 @@ class Manufacturing_Connect(http.Controller): workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search( [('feeder_station_destination', '=', ret['DeviceId'])]) if workpiece_delivery: + logging.info('workpiece_delivery.production_id:%s' % workpiece_delivery.production_id.id) workpiece_delivery.production_id.write({'production_line_state': '已上产线'}) else: res = {'Succeed': False, 'ErrorCode': 203, 'Error': '该DeviceId没有对应的工件配送数据'} @@ -354,6 +355,7 @@ class Manufacturing_Connect(http.Controller): workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search( [('feeder_station_destination', '=', ret['DeviceId'])]) if workpiece_delivery: + logging.info('workpiece_delivery.production_id:%s' % workpiece_delivery.production_id.id) workpiece_delivery.production_id.write({'production_line_state': '已下产线'}) else: res = {'Succeed': False, 'ErrorCode': 203, 'Error': '该DeviceId没有对应的工件配送数据'} diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 023bd26d..39333a15 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -134,18 +134,19 @@ class ResMrpWorkOrder(models.Model): preset_program_information = fields.Char(string="预调程序信息") workpiece_delivery_ids = fields.One2many('sf.workpiece.delivery', 'workorder_id', '工件配送') is_delivery = fields.Boolean('是否配送完成', default=False) - rfid_code = fields.Char('RFID') + rfid_code = fields.Char('RFID码') production_line_id = fields.Many2one('sf.production.line', related='production_id.production_line_id', string='生产线', store=True) production_line_state = fields.Selection(related='production_id.production_line_state', string='上/下产线', store=True) + detection_report_path = fields.Char('检测报告链接地址') - @api.onchange('rfid_code') - def compute_rfid(self): - workorder = self.env['mrp.workorder'].search([('production_id', '=', self.production_id)]) - if workorder: - for item in workorder: - item.rfid_code = self.rfid_code + # @api.onchange('rfid_code') + # def compute_rfid(self): + # workorder = self.env['mrp.workorder'].search([('production_id', '=', self.production_id.id)]) + # if workorder: + # for item in workorder: + # item.write({'rfid_code': self.rfid_code}) def get_plan_workorder(self, production_line): tomorrow = (date.today() + timedelta(days=+1)).strftime("%Y-%m-%d") @@ -821,6 +822,12 @@ class SfWorkOrderBarcodes(models.Model): workpiece_delivery.write({'workpiece_code': embryo_workpiece_code}) else: raise UserError('工件生产线不一致,请重新确认') + else: + workorder_rfid = self.env['mrp.workorder'].search( + [('production_id', '=', workorder.production_id.id)]) + if workorder_rfid: + for item in workorder_rfid: + item.write({'rfid_code': barcode}) class WorkPieceDelivery(models.Model): diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index 259d5f12..cf4fa679 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -166,6 +166,7 @@ + - - - - -
-
- +
+ + + + + + + @@ -428,6 +429,7 @@ +