优化agv及工件配送
This commit is contained in:
@@ -420,10 +420,8 @@ class ResMrpWorkOrder(models.Model):
|
||||
for item in self.workpiece_delivery_ids:
|
||||
if not item.route_id:
|
||||
raise UserError('【工件配送】明细中请选择【任务路线】')
|
||||
# if not item.workpiece_code:
|
||||
# raise UserError('请对【同运工件】进行扫描')
|
||||
else:
|
||||
if self.is_cnc_program_down is True:
|
||||
if item.is_cnc_program_down is True:
|
||||
if item.status == '待下发':
|
||||
return {
|
||||
'name': _('确认'),
|
||||
@@ -774,6 +772,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
raise UserError("请对前置三元检测定位参数进行计算定位")
|
||||
if not self.rfid_code:
|
||||
raise UserError("请扫RFID码进行绑定")
|
||||
self.workpiece_delivery_ids[0].write({'status': '待下发'})
|
||||
if self.picking_out_id:
|
||||
picking_out = self.env['stock.picking'].search([('id', '=', self.picking_out_id.id)])
|
||||
if picking_out.workorder_out_id:
|
||||
@@ -1107,15 +1106,14 @@ class WorkPieceDelivery(models.Model):
|
||||
[('上产线', '上产线'), ('下产线', '下产线'), ('运送空料架', '运送空料架')], string='类型')
|
||||
delivery_duration = fields.Float('配送时长', compute='_compute_delivery_duration')
|
||||
status = fields.Selection(
|
||||
[('待下发', '待下发'), ('待配送', '待配送'), ('已配送', '已配送')], string='状态',
|
||||
default='待下发')
|
||||
[('待下发', '待下发'), ('待配送', '待配送'), ('已配送', '已配送')], string='状态', )
|
||||
is_cnc_program_down = fields.Boolean('程序是否下发', default=False)
|
||||
|
||||
@api.onchange('route_id')
|
||||
def onchange_route(self):
|
||||
if self.route_id:
|
||||
self.feeder_station_start_id = self.route_id.start_site_id
|
||||
self.feeder_station_destination_id = self.route_id.end_site_id
|
||||
self.feeder_station_start_id = self.route_id.start_site_id.id
|
||||
self.feeder_station_destination_id = self.route_id.end_site_id.id
|
||||
|
||||
# 工件配送
|
||||
def button_delivery(self):
|
||||
@@ -1125,14 +1123,24 @@ class WorkPieceDelivery(models.Model):
|
||||
is_not_route = 0
|
||||
same_production_line_id = None
|
||||
same_route_id = None
|
||||
down_status = '待下发'
|
||||
production_type = '上产线'
|
||||
num = 0
|
||||
for item in self:
|
||||
num += 1
|
||||
if num > 4:
|
||||
raise UserError('仅限于配送1-4个制造订单,请重新选择')
|
||||
if item.route_id:
|
||||
if same_route_id is None:
|
||||
same_route_id = item.route_id.id
|
||||
if item.route_id.id != same_route_id:
|
||||
is_not_route += 1
|
||||
else:
|
||||
raise UserError('请选择任务路线再进行配送')
|
||||
raise UserError('请选择【任务路线】再进行配送')
|
||||
if production_type != item.type:
|
||||
raise UserError('请选择类型为【上产线】的制造订单进行配送')
|
||||
if down_status != item.status:
|
||||
raise UserError('请选择状态为【待下发】的制造订单进行配送')
|
||||
if same_production_line_id is None:
|
||||
same_production_line_id = item.production_line_id.id
|
||||
if item.production_line_id.id != same_production_line_id:
|
||||
@@ -1140,13 +1148,13 @@ 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 and is_not_route == 0:
|
||||
delivery_ids.append(item.production_id.id)
|
||||
delivery_ids.append(item.id)
|
||||
if is_cnc_down >= 1:
|
||||
raise UserError('您所选择制造订单的CNC程序暂未下发,请在程序下发后再进行配送')
|
||||
raise UserError('您所选择制造订单的【CNC程序】暂未下发,请在程序下发后再进行配送')
|
||||
if is_not_production_line >= 1:
|
||||
raise UserError('您所选择制造订单的目的生产线不一致,请重新确认')
|
||||
raise UserError('您所选择制造订单的【目的生产线】不一致,请重新确认')
|
||||
if is_not_route >= 1:
|
||||
raise UserError('您所选择制造订单的任务路线不一致,请重新确认')
|
||||
raise UserError('您所选择制造订单的【任务路线】不一致,请重新确认')
|
||||
if delivery_ids:
|
||||
return {
|
||||
'name': _('确认'),
|
||||
@@ -1172,7 +1180,7 @@ class WorkPieceDelivery(models.Model):
|
||||
if feeder_station_start is None:
|
||||
feeder_station_start = item.feeder_station_start_id.name
|
||||
if feeder_station_destination is None:
|
||||
feeder_station_destination = item.feeder_station_start_id.name
|
||||
feeder_station_destination = item.feeder_station_destination_id.name
|
||||
delivery_Arr.append(item.delivery_num)
|
||||
delivery_str = ', '.join(map(str, delivery_Arr))
|
||||
if feeder_station_start is not None:
|
||||
|
||||
Reference in New Issue
Block a user