From f8101c2a16683743a0069a8f4e1214a83ece0b7f Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Fri, 23 Feb 2024 09:57:02 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B4=A7=E4=BD=8D?= =?UTF-8?q?=E7=BC=96=E7=A0=81=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_warehouse/models/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py index a1891c71..0f4ea0af 100644 --- a/sf_warehouse/models/model.py +++ b/sf_warehouse/models/model.py @@ -327,7 +327,7 @@ class ShelfLocation(models.Model): record.storage_time = False name = fields.Char('货位名称', required=True, size=20) - barcode = fields.Char('货位编码', copy=False, size=15) + barcode = fields.Char('货位编码', copy=False, size=50) # 货架 shelf_id = fields.Many2one('sf.shelf', string='货架') From ad0b9983bf04ae18aa02a00403e28f6bba9d6c25 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Fri, 23 Feb 2024 10:17:20 +0800 Subject: [PATCH 2/3] =?UTF-8?q?1.=E6=96=B0=E5=A2=9E=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=E9=93=BE=E6=8E=A5=E5=9C=B0=E5=9D=80=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=202.=E4=BC=98=E5=8C=96rfid=E7=A0=81=E6=89=AB=E6=8F=8F?= =?UTF-8?q?=203.=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 @@ + From 9ecd95faa090fa0a48bf00f079059ec0c7122d14 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Fri, 23 Feb 2024 11:09:57 +0800 Subject: [PATCH 3/3] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E8=B4=A8=E9=87=8F?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=9A=84=E6=9D=83=E9=99=902.=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Dagv=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- quality/security/ir.model.access.csv | 6 +++++- sf_manufacturing/controllers/controllers.py | 12 ++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/quality/security/ir.model.access.csv b/quality/security/ir.model.access.csv index f13d0de5..ee2c26a9 100644 --- a/quality/security/ir.model.access.csv +++ b/quality/security/ir.model.access.csv @@ -9,8 +9,12 @@ access_quality_point_user,quality.point,quality.model_quality_point,quality.grou access_quality_point_test_type_user,quality.point.test_type,quality.model_quality_point_test_type,quality.group_quality_user,1,0,0,0 access_quality_check_stock_user,quality.check,quality.model_quality_check,stock.group_stock_user,1,1,1,0 access_stock_lot_user,stock.lot,stock.model_stock_lot,quality.group_quality_user,1,0,0,0 +access_stock_lot_group_quality_manager,stock_lot_group_quality_manager,stock.model_stock_lot,quality.group_quality_manager,1,0,0,0 + access_stock_pack_user,stock.move.line,stock.model_stock_move_line,quality.group_quality_user,1,0,0,0 -access_stock_picking,stock.move.line,stock.model_stock_picking,quality.group_quality_user,1,0,0,0 +access_stock_picking_group_quality_user,stock_picking_group_quality_user,stock.model_stock_picking,quality.group_quality_user,1,0,0,0 +access_stock_picking_group_quality_manager,stock_picking_group_quality_manager,stock.model_stock_picking,quality.group_quality_manager,1,0,0,0 + access_quality_alert_team_manager,quality.alert.team,quality.model_quality_alert_team,quality.group_quality_manager,1,1,1,1 access_quality_check_manager,quality.check,quality.model_quality_check,quality.group_quality_manager,1,1,1,1 access_quality_alert_manager,quality.alert,quality.model_quality_alert,quality.group_quality_manager,1,1,1,1 diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index bb0bd331..fe1a3776 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -337,8 +337,10 @@ 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': '已上产线'}) + for wd in workpiece_delivery: + if wd.production_id.production_line_state == '待上产线': + logging.info('wd.production_id:%s' % workpiece_delivery.production_id.id) + wd.production_id.write({'production_line_state': '已上产线'}) else: res = {'Succeed': False, 'ErrorCode': 203, 'Error': '该DeviceId没有对应的工件配送数据'} else: @@ -367,8 +369,10 @@ 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': '已下产线'}) + for wd in workpiece_delivery: + if wd.production_id.production_line_state == '已上产线': + logging.info('wd.production_id:%s' % workpiece_delivery.production_id.id) + wd.production_id.write({'production_line_state': '已下产线'}) else: res = {'Succeed': False, 'ErrorCode': 203, 'Error': '该DeviceId没有对应的工件配送数据'} else: