优化工件配送添加编码字段

This commit is contained in:
jinling.yang
2024-04-23 17:20:32 +08:00
parent 1d54066664
commit 90d1f96857
2 changed files with 11 additions and 7 deletions

View File

@@ -465,9 +465,10 @@ class ResMrpWorkOrder(models.Model):
def _json_workpiece_delivery_list(self, production):
return [
[0, '', {'production_id': production.id, 'type': '上产线'}],
[0, '', {'production_id': production.id, 'type': '下产线'}],
[0, '', {'production_id': production.id, 'type': '运送空料架'}],
[0, '', {'production_id': production.id, 'type': '上产线', 'delivery_num': '%s-%s' % (production.name, 1)}],
[0, '', {'production_id': production.id, 'type': '下产线', 'delivery_num': '%s-%s' % (production.name, 2)}],
[0, '',
{'production_id': production.id, 'type': '运送空料架', 'delivery_num': '%s-%s' % (production.name, 3)}],
]
# 拼接工单对象属性值(表面工艺)
@@ -1078,6 +1079,7 @@ class WorkPieceDelivery(models.Model):
_name = "sf.workpiece.delivery"
_description = '工件配送'
delivery_num = fields.Char('工件配送编码')
workorder_id = fields.Many2one('mrp.workorder', string='工单', readonly=True)
production_id = fields.Many2one('mrp.production', string='制造订单', readonly=True)
production_line_id = fields.Many2one('sf.production.line', compute='_compute_production_line_id',
@@ -1133,8 +1135,8 @@ class WorkPieceDelivery(models.Model):
# 配送至avg小车
def _delivery_avg(self):
agv_site = self.env['sf.agv.site'].search([])
if agv_site:
agv_site.update_site_state()
# if agv_site:
# agv_site.update_site_state()
config = self.env['res.config.settings'].get_values()
positionCode_Arr = []
if self.feeder_station_start_id:
@@ -1147,7 +1149,7 @@ class WorkPieceDelivery(models.Model):
'positionCode': self.feeder_station_destination_id.name,
'code': '00'
})
res = {'reqCode': self.production_id.name, 'reqTime': '', 'clientCode': '', 'tokenCode': '',
res = {'reqCode': self.delivery_num, 'reqTime': '', 'clientCode': '', 'tokenCode': '',
'taskTyp': 'F01', 'ctnrTyp': '', 'ctnrCode': '', 'wbCode': config['wbcode'],
'positionCodePath': positionCode_Arr,
'podCode': '',