申请编程需求
This commit is contained in:
@@ -1600,6 +1600,57 @@ class MrpProduction(models.Model):
|
||||
raise UserError(
|
||||
_('You must enter a serial number for each line of %s') % sml.product_id.display_name)
|
||||
return True
|
||||
|
||||
reprogramming_count = fields.Integer(string='重新编程次数', default=0)
|
||||
|
||||
# 申请编程
|
||||
def action_apply_programming(self):
|
||||
"""
|
||||
检查前置条件:制造订单【状态】=“待排程、待加工”,制造订单的【编程状态】=“已编程”。
|
||||
"""
|
||||
print('申请编程')
|
||||
if len(self) > 1:
|
||||
raise UserError('仅支持选择单个制造订单进行编程申请,请重新选择')
|
||||
# problem_productions = []
|
||||
# for production in self:
|
||||
# if production.state not in ['待排程', '待加工'] or production.programming_state != '已编程':
|
||||
# problem_productions.append(production.name)
|
||||
# if problem_productions:
|
||||
# raise UserError('以下制造订单状态或编程状态不符合要求: %s' % ', '.join(problem_productions))
|
||||
|
||||
# 上述通过后,返回一个action id为sf_programming_reason_action,用作二次确认wizard,显示“重新编程原因:XXXXX(用户录入)注意:该制造订单产品已申请重新编程次数为N,且当前编程状态为XXX”
|
||||
cloud_programming = self._cron_get_programming_state()
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'sf.programming.reason',
|
||||
'view_mode': 'form',
|
||||
'target': 'new',
|
||||
'context': {
|
||||
'default_production_id': self.id,
|
||||
'active_id': self.id,
|
||||
# 传当前时间
|
||||
'default_apply_time': fields.Datetime.now(),
|
||||
},
|
||||
'view_id': self.env.ref('sf_manufacturing.sf_programming_reason_form_view').id,
|
||||
}
|
||||
|
||||
# 编程记录
|
||||
programming_record_ids = fields.One2many('sf.programming.record', 'production_id')
|
||||
|
||||
# 编程记录
|
||||
class sf_programming_record(models.Model):
|
||||
_name = 'sf.programming.record'
|
||||
_description = "编程记录"
|
||||
|
||||
production_id = fields.Many2one('mrp.production')
|
||||
# 编号、编程原因、编程方式、当前编程次数、目标制造单号、申请时间、下发时间
|
||||
number = fields.Char('编号')
|
||||
reason = fields.Text('重新编程原因')
|
||||
programming_method = fields.Selection([('人工编程', '人工编程'), ('自动编程', '自动编程')], string="编程方式")
|
||||
current_programming_count = fields.Integer('当前编程次数')
|
||||
target_production_id = fields.Char('目标制造单号')
|
||||
apply_time = fields.Datetime('申请时间')
|
||||
send_time = fields.Datetime('下发时间')
|
||||
|
||||
|
||||
class sf_detection_result(models.Model):
|
||||
|
||||
Reference in New Issue
Block a user