diff --git a/sf_bf_connect/models/process_status.py b/sf_bf_connect/models/process_status.py
index 09fecfae..69eb84f1 100644
--- a/sf_bf_connect/models/process_status.py
+++ b/sf_bf_connect/models/process_status.py
@@ -36,6 +36,8 @@ class StatusChange(models.Model):
# 使用super()来调用原始方法(在本例中为'sale.order'模型的'action_confirm'方法)
try:
res = super(StatusChange, self).action_confirm()
+ # 修改销售订单状态为【加工中】
+ self.write({'state': 'processing'})
logging.info('原生方法返回结果:%s' % res)
# 原有方法执行后,进行额外的操作(如调用外部API)
process_start_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py
index 4d8f11df..24616662 100644
--- a/sf_manufacturing/models/mrp_production.py
+++ b/sf_manufacturing/models/mrp_production.py
@@ -963,10 +963,11 @@ class MrpProduction(models.Model):
work_ids = workorder_ids.filtered(lambda item: item.sequence == 0)
# 对工单进行逐个插入
for work_id in work_ids:
- for order_id in rec.workorder_ids.filtered(lambda item: item.sequence > 0):
- if work_id.name == order_id.name and work_id.processing_panel == order_id.processing_panel:
- work_id.sequence = order_id.sequence + 1
- break
+ order_rework_ids = rec.workorder_ids.filtered(
+ lambda item: (item.sequence > 0 and work_id.name == item.name
+ and work_id.processing_panel == item.processing_panel))
+ order_rework_ids = sorted(order_rework_ids, key=lambda item: item.sequence, reverse=True)
+ work_id.sequence = order_rework_ids[0].sequence + 1
# 对该工单之后的工单工序进行加一
work_order_ids = rec.workorder_ids.filtered(
lambda item: item.sequence >= work_id.sequence and item.id != work_id.id)
diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py
index 52fa30c8..410f8d1b 100644
--- a/sf_manufacturing/models/mrp_workorder.py
+++ b/sf_manufacturing/models/mrp_workorder.py
@@ -138,7 +138,8 @@ class ResMrpWorkOrder(models.Model):
is_subcontract = fields.Boolean(string='是否外协')
surface_technics_parameters_id = fields.Many2one('sf.production.process.parameter', string="表面工艺可选参数")
- picking_ids = fields.Many2many('stock.picking', string='外协出入库单', compute='_compute_surface_technics_picking_ids')
+ picking_ids = fields.Many2many('stock.picking', string='外协出入库单',
+ compute='_compute_surface_technics_picking_ids')
purchase_id = fields.Many2many('purchase.order', string='外协采购单')
surface_technics_picking_count = fields.Integer("外协出入库", compute='_compute_surface_technics_picking_ids')
@@ -327,7 +328,7 @@ class ResMrpWorkOrder(models.Model):
'view_mode': 'form',
}
return result
-
+
def _get_surface_technics_purchase_ids(self):
domain = [('origin', '=', self.production_id.name), ('purchase_type', '=', 'consignment')]
purchase_orders = self.env['purchase.order'].search(domain)
@@ -1429,6 +1430,8 @@ class ResMrpWorkOrder(models.Model):
rfid_code = workorder.rfid_code
workorder.write({'rfid_code_old': rfid_code,
'rfid_code': False})
+ self.env['stock.lot'].sudo().search([('rfid', '=', rfid_code)]).write(
+ {'tool_material_status': '可用'})
if workorder.rfid_code:
raise ValidationError(f'【{workorder.name}】工单解绑失败,请重新点击完成按钮!!!')
# workorder.rfid_code_old = rfid_code
@@ -1567,7 +1570,7 @@ class ResMrpWorkOrder(models.Model):
'default_confirm_button': '确认解除',
# 'default_feeder_station_start_id': feeder_station_start_id,
}}
-
+
move_subcontract_workorder_ids = fields.One2many('stock.move', 'subcontract_workorder_id', string='组件')
@@ -1778,6 +1781,7 @@ class SfWorkOrderBarcodes(models.Model):
if workorder_rfid:
for item in workorder_rfid:
item.write({'rfid_code': barcode})
+ lot.sudo().write({'tool_material_status': '在用'})
logging.info("Rfid[%s]绑定成功!!!" % barcode)
else:
raise UserError('该Rfid【%s】绑定的是【%s】, 不是托盘!!!' % (barcode, lot.product_id.name))
diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml
index c9856cb8..567930dd 100644
--- a/sf_manufacturing/views/mrp_production_addional_change.xml
+++ b/sf_manufacturing/views/mrp_production_addional_change.xml
@@ -444,9 +444,7 @@
diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml
index de94390a..7fc2e8c5 100644
--- a/sf_manufacturing/views/mrp_workorder_view.xml
+++ b/sf_manufacturing/views/mrp_workorder_view.xml
@@ -55,10 +55,7 @@
- {'invisible': ['|', '|', '|','|','|', ('production_state','in', ('draft',
- 'done',
- 'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done','rework', 'cancel')),
- ('is_user_working', '!=', False),("user_permissions","=",False),("name","in",("CNC加工","解除装夹"))]}
+ {'invisible': [('state', '!=', 'ready')]}
@@ -176,9 +173,9 @@
+ attrs="{'invisible': [('state', '!=', 'ready')]}"/>
+ attrs="{'invisible': [('state', '!=', 'ready')]}"/>