Accept Merge Request #1791: (feature/制造功能优化 -> develop)

Merge Request: 调整程序写入逻辑

Created By: @马广威
Accepted By: @马广威
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1791?initial=true
This commit is contained in:
马广威
2025-02-08 16:01:11 +08:00
committed by Coding
2 changed files with 4 additions and 3 deletions

View File

@@ -1295,7 +1295,7 @@ class MrpProduction(models.Model):
for rework_item in rework_workorder: for rework_item in rework_workorder:
pending_workorder = production.workorder_ids.filtered( pending_workorder = production.workorder_ids.filtered(
lambda m1: m1.state in [ lambda m1: m1.state in [
'pending'] and m1.processing_panel == rework_item.processing_panel and m1.routing_type == 'CNC加工') 'pending'] and m1.processing_panel == rework_item.processing_panel and m1.routing_type in ['CNC加工', '人工线下加工'])
if not pending_workorder.cnc_ids: if not pending_workorder.cnc_ids:
production.get_new_program(rework_item.processing_panel) production.get_new_program(rework_item.processing_panel)
# production.write({'state': 'progress', 'programming_state': '已编程', 'is_rework': False}) # production.write({'state': 'progress', 'programming_state': '已编程', 'is_rework': False})
@@ -1338,7 +1338,7 @@ class MrpProduction(models.Model):
if productions: if productions:
for production in productions: for production in productions:
panel_workorder = production.workorder_ids.filtered(lambda panel_workorder = production.workorder_ids.filtered(lambda
pw: pw.processing_panel == processing_panel and pw.routing_type == 'CNC加工' and pw.state not in ( pw: pw.processing_panel == processing_panel and pw.routing_type in ['CNC加工', '人工线下加工'] and pw.state not in (
'rework', 'done')) 'rework', 'done'))
if panel_workorder: if panel_workorder:
if panel_workorder.cmm_ids: if panel_workorder.cmm_ids:

View File

@@ -103,7 +103,8 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
try: try:
logging.info(f'已更新制造订单:{productions}') logging.info(f'已更新制造订单:{productions}')
re_tool_chekout = False re_tool_chekout = False
re_tool_chekout = productions.production_cnc_tool_checkout() productions_temp = productions.filtered(lambda p: p.production_type == '自动化产线加工')
re_tool_chekout = productions_temp.production_cnc_tool_checkout()
if re_tool_chekout: if re_tool_chekout:
return json.JSONEncoder().encode({'status': -3, 'message': '对cnc工单的程序用刀进行校验失败'}) return json.JSONEncoder().encode({'status': -3, 'message': '对cnc工单的程序用刀进行校验失败'})
except Exception as e: except Exception as e: