修复报废bug

This commit is contained in:
jinling.yang
2024-08-20 17:52:36 +08:00
parent 4ed7ecf628
commit 7b2908defa
6 changed files with 18 additions and 53 deletions

View File

@@ -619,12 +619,12 @@ class Manufacturing_Connect(http.Controller):
# if is_free is True:
# delivery_workpiece._delivery_avg()
# logging.info('agv下发下产线任务下发完成')
if ret['IsComplete'] is True:
# 向AGV任务调度下发下产线任务
workorders = request.env['mrp.workorder'].browse(workorder_ids)
request.env['sf.agv.scheduling'].add_scheduling(ret['DeviceId'], '下产线', workorders)
else:
res = {'Succeed': False, 'ErrorCode': 203, 'Error': '未传IsComplete字段'}
# if ret['IsComplete'] is True:
# # 向AGV任务调度下发下产线任务
# workorders = request.env['mrp.workorder'].browse(workorder_ids)
# request.env['sf.agv.scheduling'].add_scheduling(ret['DeviceId'], '下产线', workorders)
# else:
# res = {'Succeed': False, 'ErrorCode': 203, 'Error': '未传IsComplete字段'}
except RepeatTaskException as e:
logging.info('AGVToProduct error:%s' % e)
except Exception as e:

View File

@@ -808,7 +808,8 @@ class MrpProduction(models.Model):
'target': 'new',
'context': {
'default_production_id': self.id,
'default_programming_state': cloud_programming['programming_state'],
'default_programming_state': '编程中' if cloud_programming[
'programming_state'] != '已下发' else '已下发',
'default_is_reprogramming': True if cloud_programming['programming_state'] in ['已下发'] else False
}
}
@@ -995,6 +996,8 @@ class MrpProduction(models.Model):
mo.picking_type_id = picking_type.id
mo._assign_picking()
mo.reference = mo.picking_id.name
else:
mo.reference = productions.name
productions.write({'programming_no': self.programming_no, 'is_remanufacture': True})
productions.procurement_group_id.mrp_production_ids.move_dest_ids.write(
{'group_id': self.env['procurement.group'].search([('name', '=', sale_order.name)])})
@@ -1066,46 +1069,6 @@ class MrpProduction(models.Model):
production_item)
else:
productions.programming_state = '编程中'
for production in productions:
origin_production = production.move_dest_ids and production.move_dest_ids[
0].raw_material_production_id or False
orderpoint = production.orderpoint_id
if orderpoint and orderpoint.create_uid.id == SUPERUSER_ID and orderpoint.trigger == 'manual':
production.message_post(
body=_('This production order has been created from Replenishment Report.'),
message_type='comment',
subtype_xmlid='mail.mt_note')
elif orderpoint:
production.message_post_with_view(
'mail.message_origin_link',
values={'self': production, 'origin': orderpoint},
subtype_id=self.env.ref('mail.mt_note').id)
elif origin_production:
production.message_post_with_view(
'mail.message_origin_link',
values={'self': production, 'origin': origin_production},
subtype_id=self.env.ref('mail.mt_note').id)
'''
创建生产计划
'''
# 工单耗时
workorder_duration = 0
for workorder in productions.workorder_ids:
workorder_duration += workorder.duration_expected
if sale_order:
# sale_order.mrp_production_ids |= productions
self.env['sf.production.plan'].sudo().with_company(self.company_id).create({
'name': productions.name,
'order_deadline': sale_order.deadline_of_delivery,
'production_id': productions.id,
'date_planned_start': productions.date_planned_start,
'origin': productions.origin,
'product_qty': productions.product_qty,
'product_id': productions.product_id.id,
'state': 'draft',
})
return productions
# 在之前的销售单上重新生成制造订单

View File

@@ -1094,7 +1094,9 @@ class ResMrpWorkOrder(models.Model):
# move_out._action_assign()
if self.state == 'waiting' or self.state == 'ready' or self.state == 'progress':
print(self.production_id.move_raw_ids)
self.move_raw_ids = self.production_id.move_raw_ids
print(self.move_raw_ids)
self.move_raw_ids[0].write({
'materiel_length': self.move_raw_ids[0].product_id.length,
'materiel_width': self.move_raw_ids[0].product_id.width,

View File

@@ -9,8 +9,8 @@ from odoo.exceptions import ValidationError, UserError
from odoo.modules import get_resource_path
from OCC.Extend.DataExchange import read_step_file
from OCC.Extend.DataExchange import write_stl_file
# from OCC.Extend.DataExchange import read_step_file
# from OCC.Extend.DataExchange import write_stl_file
class ResProductMo(models.Model):

View File

@@ -8,8 +8,8 @@ from datetime import datetime
import requests
from odoo import http
from odoo.http import request
from OCC.Extend.DataExchange import read_step_file
from OCC.Extend.DataExchange import write_stl_file
# from OCC.Extend.DataExchange import read_step_file
# from OCC.Extend.DataExchange import write_stl_file
from odoo import models, fields, api
from odoo.modules import get_resource_path
from odoo.exceptions import ValidationError, UserError

View File

@@ -6,8 +6,8 @@ import os
from datetime import datetime
from stl import mesh
# from OCC.Core.GProp import GProp_GProps
from OCC.Extend.DataExchange import read_step_file
from OCC.Extend.DataExchange import write_stl_file
# from OCC.Extend.DataExchange import read_step_file
# from OCC.Extend.DataExchange import write_stl_file
from odoo.addons.sf_base.commons.common import Common
from odoo import models, fields, api
from odoo.modules import get_resource_path