Accept Merge Request #967: (feature/优化工件配送添加编码字段 -> develop)

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

Created By: @杨金灵
Reviewed By: @马广威
Approved By: @马广威 
Accepted By: @杨金灵
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/967
This commit is contained in:
杨金灵
2024-04-23 19:21:38 +08:00
committed by Coding
2 changed files with 11 additions and 7 deletions

View File

@@ -24,8 +24,10 @@ class Workpiece(http.Controller):
if 'reqCode' in ret:
if 'method' in ret:
if ret['method'] == 'end':
logging.info('backfeed-ret:%s' % ret['reqCode'].rsplit('-', 1)[0])
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
[('production_id.name', '=', ret['reqCode']), ('agv_task_code'), '=', ret['taskCode']])
[('production_id.name', '=', ret['reqCode'].rsplit('-', 1)[0]), ('agv_task_code'), '=',
ret['taskCode']])
if workpiece_delivery:
workpiece_delivery.write({'status': '已配送', 'task_completion_time': ret['reqTime']})
if workpiece_delivery.type == '下产线':

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': '',