1.工单状态新增‘返工’,2,在制造订单上点击返工选择加工面确认后,新增加工面的对应工单及新增重置cloud的编程单的状态3.优化返工向导

This commit is contained in:
jinling.yang
2024-07-09 17:36:47 +08:00
parent b383a6d229
commit 7533d23d3e
5 changed files with 100 additions and 74 deletions

View File

@@ -103,7 +103,8 @@ class MrpProduction(models.Model):
precision_rounding=production.product_uom_id.rounding) >= 0:
production.state = 'to_close'
elif any(
wo.test_results == '返工' and wo.state == 'done' for wo in production.workorder_ids):
(wo.test_results == '返工' and wo.state == 'done') or wo.state == 'rework' for wo in
production.workorder_ids):
production.state = 'rework'
elif any(wo_state in ('progress', 'done') for wo_state in production.workorder_ids.mapped('state')):
production.state = 'progress'
@@ -155,27 +156,25 @@ class MrpProduction(models.Model):
for production in self:
production.maintenance_count = len(production.request_ids)
# 制造订单报废:编程单更新
def updateCNC(self):
# 编程单更新
def update_programming_state(self):
try:
res = {'production_no': self.name, 'programming_no': self.programming_no,
'order_no': self.origin}
res = {'programming_no': self.programming_no}
logging.info('res=%s:' % res)
configsettings = self.env['res.config.settings'].get_values()
config_header = Common.get_headers(self, configsettings['token'], configsettings['sf_secret_key'])
url = '/api/intelligent_programming/update_intelligent_programmings'
url = '/api/intelligent_programming/reset_state_again'
config_url = configsettings['sf_url'] + url
res['token'] = configsettings['token']
ret = requests.post(config_url, json={}, data=res, headers=config_header)
ret = ret.json()
logging.info('updateCNC-ret:%s' % ret)
logging.info('update_programming_state-ret:%s' % ret)
if ret['status'] == 1:
self.write({'work_state': '已编程'})
else:
raise UserError(ret['message'])
except Exception as e:
logging.info('updateCNC error:%s' % e)
raise UserError("更新程单失败,请联系管理员")
logging.info('update_programming_state error:%s' % e)
raise UserError("更新程单状态失败,请联系管理员")
# cnc程序获取
def fetchCNC(self, production_names):
@@ -698,8 +697,9 @@ class MrpProduction(models.Model):
'res_model': 'sf.rework.wizard',
'target': 'new',
'context': {
'default_production_id': [(6, 0, [self.id])],
'default_product_id': self.product_id.id
'default_production_id': self.id,
'default_product_id': self.product_id.id,
'default_is_reprogramming': True
}
}