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 @@ +