AGV任务调度开发
This commit is contained in:
@@ -1089,6 +1089,8 @@ class ResMrpWorkOrder(models.Model):
|
||||
record.process_state = '待加工'
|
||||
# record.write({'process_state': '待加工'})
|
||||
record.production_id.process_state = '待加工'
|
||||
# 生成工件配送单
|
||||
record.workpiece_delivery_ids = record._json_workpiece_delivery_list()
|
||||
if record.routing_type == 'CNC加工':
|
||||
record.process_state = '待解除装夹'
|
||||
# record.write({'process_state': '待加工'})
|
||||
@@ -1190,8 +1192,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
raw_move.write({'state': 'done'})
|
||||
record.production_id.button_mark_done1()
|
||||
# record.production_id.state = 'done'
|
||||
# 生成工件配送单
|
||||
record.workpiece_delivery_ids = record._json_workpiece_delivery_list()
|
||||
|
||||
|
||||
# 将FTP的检测报告文件下载到临时目录
|
||||
def download_reportfile_tmp(self, workorder, reportpath):
|
||||
@@ -1495,7 +1496,7 @@ class SfWorkOrderBarcodes(models.Model):
|
||||
|
||||
class WorkPieceDelivery(models.Model):
|
||||
_name = "sf.workpiece.delivery"
|
||||
_inherit = ['mail.thread', 'mail.activity.mixin', "barcodes.barcode_events_mixin"]
|
||||
_inherit = ['mail.thread', 'mail.activity.mixin']
|
||||
_description = '工件配送'
|
||||
|
||||
name = fields.Char('单据编码')
|
||||
@@ -1573,12 +1574,12 @@ class WorkPieceDelivery(models.Model):
|
||||
|
||||
# 工件配送
|
||||
def button_delivery(self):
|
||||
delivery_ids = []
|
||||
# delivery_ids = []
|
||||
production_ids = []
|
||||
workorder_ids = []
|
||||
is_cnc_down = 0
|
||||
is_not_production_line = 0
|
||||
same_production_line_id = None
|
||||
same_route_id = None
|
||||
production_type = '上产线'
|
||||
max_num = 4 # 最大配送数量
|
||||
if len(self) > max_num:
|
||||
@@ -1593,24 +1594,25 @@ class WorkPieceDelivery(models.Model):
|
||||
if item.is_cnc_program_down is False:
|
||||
is_cnc_down += 1
|
||||
if is_cnc_down == 0 and is_not_production_line == 0:
|
||||
delivery_ids.append(item.id)
|
||||
# delivery_ids.append(item.id)
|
||||
production_ids.append(item.production_id.id)
|
||||
workorder_ids.append(item.workorder_id.id)
|
||||
if is_cnc_down >= 1:
|
||||
raise UserError('您所选择制造订单的【CNC程序】暂未下发,请在程序下发后再进行配送')
|
||||
if is_not_production_line >= 1:
|
||||
raise UserError('您所选择制造订单的【目的生产线】不一致,请重新确认')
|
||||
if delivery_ids:
|
||||
return {
|
||||
'name': _('确认'),
|
||||
'type': 'ir.actions.act_window',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'sf.workpiece.delivery.wizard',
|
||||
'target': 'new',
|
||||
'context': {
|
||||
'default_delivery_ids': [(6, 0, delivery_ids)],
|
||||
'default_production_ids': [(6, 0, production_ids)],
|
||||
'default_type': production_type,
|
||||
}}
|
||||
return {
|
||||
'name': _('确认'),
|
||||
'type': 'ir.actions.act_window',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'sf.workpiece.delivery.wizard',
|
||||
'target': 'new',
|
||||
'context': {
|
||||
# 'default_delivery_ids': [(6, 0, delivery_ids)],
|
||||
'default_production_ids': [(6, 0, production_ids)],
|
||||
'default_type': production_type,
|
||||
'default_workorder_ids': [(6, 0, workorder_ids)],
|
||||
}}
|
||||
|
||||
|
||||
# 验证agv站点是否可用
|
||||
@@ -1716,11 +1718,6 @@ class WorkPieceDelivery(models.Model):
|
||||
else:
|
||||
obj.delivery_duration = 0.0
|
||||
|
||||
# agv调度单
|
||||
agv_scheduling_id = fields.Many2one('sf.agv.scheduling', 'agv调度单')
|
||||
|
||||
def on_barcode_scanned(self, barcode):
|
||||
logging.info('Rfid:%s' % barcode)
|
||||
|
||||
|
||||
class CMMprogram(models.Model):
|
||||
|
||||
Reference in New Issue
Block a user