Merge branch 'feature/制造订单状态优化_2' into feature/制造订单状态优化_3
This commit is contained in:
@@ -960,6 +960,13 @@ class MrpProduction(models.Model):
|
||||
productions_not_delivered.write(
|
||||
{'state': 'progress', 'programming_state': '已编程', 'is_rework': False})
|
||||
|
||||
# 对制造订单所以面的cnc工单的程序用刀进行校验
|
||||
try:
|
||||
logging.info(f'已更新制造订单:{productions_not_delivered}')
|
||||
productions_not_delivered.production_cnc_tool_checkout()
|
||||
except Exception as e:
|
||||
logging.info(f'对cnc工单的程序用刀进行校验报错:{e}')
|
||||
|
||||
# 从cloud获取重新编程过的最新程序
|
||||
def get_new_program(self, processing_panel):
|
||||
try:
|
||||
|
||||
@@ -584,6 +584,12 @@
|
||||
position="after">
|
||||
<field name="duration" string="实际时长"/>
|
||||
</xpath>
|
||||
<xpath expr="//page[@name='time_tracking']" position="attributes">
|
||||
<attribute name="groups">
|
||||
mrp.group_mrp_manager,sf_base.group_sf_mrp_manager,sf_base.group_sf_equipment_user,sf_base.group_sf_order_user
|
||||
</attribute>
|
||||
</xpath>
|
||||
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -104,6 +104,7 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
|
||||
|
||||
# 对制造订单所以面的cnc工单的程序用刀进行校验
|
||||
try:
|
||||
logging.info(f'已更新制造订单:{productions}')
|
||||
productions.production_cnc_tool_checkout()
|
||||
except Exception as e:
|
||||
logging.info(f'对cnc工单的程序用刀进行校验报错:{e}')
|
||||
|
||||
@@ -170,6 +170,7 @@ class MrpProduction(models.Model):
|
||||
# 修改cnc程序的‘刀具状态’
|
||||
workorder_ids = self.env['mrp.workorder'].sudo().search([('production_id', 'in', self.ids)])
|
||||
if invalid_tool:
|
||||
logging.info(f'无效刀:{invalid_tool}')
|
||||
# 修改cnc程序的‘刀具状态’为 ‘无效刀’
|
||||
cnc_ids = self.env['sf.cnc.processing'].sudo().search(
|
||||
[('workorder_id', 'in', workorder_ids.ids), ('cutting_tool_name', 'in', invalid_tool)])
|
||||
@@ -198,12 +199,14 @@ class MrpProduction(models.Model):
|
||||
# 修改制造订单 编程状态变为“编程中” 制造订单状态为‘返工’
|
||||
self.write({'programming_state': '编程中', 'work_state': '编程中', 'state': 'rework'})
|
||||
if missing_tool_1:
|
||||
logging.info(f'线边、机内缺刀:{missing_tool_1}')
|
||||
# 修改 修改cnc程序的‘刀具状态’ 为 ‘缺刀’
|
||||
cnc_ids = self.env['sf.cnc.processing'].sudo().search(
|
||||
[('workorder_id', 'in', workorder_ids.ids), ('cutting_tool_name', 'in', missing_tool_1)])
|
||||
if cnc_ids:
|
||||
cnc_ids.write({'tool_state': '1'})
|
||||
if missing_tool_2 and not invalid_tool:
|
||||
if missing_tool_2 and invalid_tool != []:
|
||||
logging.info(f'库存缺刀:{missing_tool_2}')
|
||||
# 调用CAM工单程序用刀计划创建方法
|
||||
cnc_ids = self.env['sf.cnc.processing'].sudo().search(
|
||||
[('workorder_id', 'in', workorder_ids.filtered(lambda a: a.production_id == self[0].id).ids),
|
||||
@@ -211,4 +214,6 @@ class MrpProduction(models.Model):
|
||||
if cnc_ids:
|
||||
logging.info('调用CAM工单程序用刀计划创建方法!!!')
|
||||
self.env['sf.cam.work.order.program.knife.plan'].sudo().create_cam_work_plan(cnc_ids)
|
||||
if not invalid_tool and not missing_tool_1:
|
||||
logging.info('校验cnc用刀正常!!!')
|
||||
logging.info('工单cnc程序用刀校验完成!!!')
|
||||
|
||||
Reference in New Issue
Block a user