Merge branch 'feature/优化表面工艺排序' into develop
This commit is contained in:
@@ -88,6 +88,7 @@ class MrsProductionProcess(models.Model):
|
|||||||
code = fields.Char("编码")
|
code = fields.Char("编码")
|
||||||
name = fields.Char('名称')
|
name = fields.Char('名称')
|
||||||
remark = fields.Text("备注")
|
remark = fields.Text("备注")
|
||||||
|
sequence = fields.Integer('排序')
|
||||||
# processing_order_ids = fields.One2many('sf.processing.order', 'production_process_id', string='工序')
|
# processing_order_ids = fields.One2many('sf.processing.order', 'production_process_id', string='工序')
|
||||||
partner_process_ids = fields.Many2many('res.partner', 'process_ids', '加工工厂')
|
partner_process_ids = fields.Many2many('res.partner', 'process_ids', '加工工厂')
|
||||||
active = fields.Boolean('有效', default=True)
|
active = fields.Boolean('有效', default=True)
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
diff a/sf_base/models/tool_base_new.py b/sf_base/models/tool_base_new.py (rejected hunks)
|
|
||||||
@@ -108,6 +108,4 @@
|
|
||||||
cutting_speed_ids = fields.One2many('sf.cutting.speed', 'standard_library_id', string='切削速度Vc')
|
|
||||||
- feed_per_tooth_ids = fields.One2many('sf.feed.per.tooth', 'standard_library_id', '每齿走刀量fz',
|
|
||||||
- domain=[('cutting_speed', '!=', False)])
|
|
||||||
- feed_per_tooth_ids_3 = fields.One2many('sf.feed.per.tooth', 'standard_library_id', '每齿走刀量fz',
|
|
||||||
- domain=[('cutting_speed', '!=', False)])
|
|
||||||
+ feed_per_tooth_ids = fields.One2many('sf.feed.per.tooth', 'standard_library_id', '每齿走刀量fz')
|
|
||||||
+ feed_per_tooth_ids_3 = fields.One2many('sf.feed.per.tooth', 'standard_library_id', '每齿走刀量fz')
|
|
||||||
|
|
||||||
@@ -476,44 +476,45 @@ class MrpProduction(models.Model):
|
|||||||
# self.env['mrp.workorder'].json_workorder_str(k, production, route))
|
# self.env['mrp.workorder'].json_workorder_str(k, production, route))
|
||||||
# 表面工艺工序
|
# 表面工艺工序
|
||||||
# 获取表面工艺id
|
# 获取表面工艺id
|
||||||
if production.product_id.model_process_parameters_ids:
|
# 工序id
|
||||||
logging.info('model_process_parameters_ids:%s' % production.product_id.model_process_parameters_ids)
|
surface_technics_arr = []
|
||||||
surface_technics_arr = []
|
route_workcenter_arr = []
|
||||||
# 工序id
|
for item in production.product_id.product_model_type_id.surface_technics_routing_tmpl_ids:
|
||||||
route_workcenter_arr = []
|
if item.route_workcenter_id.surface_technics_id.id:
|
||||||
for item in production.product_id.product_model_type_id.surface_technics_routing_tmpl_ids:
|
for process_param in production.product_id.model_process_parameters_ids:
|
||||||
surface_technics_arr.append(item.route_workcenter_id.surface_technics_id.id)
|
logging.info('process_param:%s%s' % (process_param.id, process_param.name))
|
||||||
route_workcenter_arr.append(item.route_workcenter_id.id)
|
if item.route_workcenter_id.surface_technics_id == process_param.process_id:
|
||||||
if surface_technics_arr:
|
logging.info(
|
||||||
production_process_category = self.env['sf.production.process.category'].search(
|
'surface_technics_id:%s%s' % (item.route_workcenter_id.surface_technics_id.id,
|
||||||
[('production_process_ids.id', 'in', surface_technics_arr)],
|
item.route_workcenter_id.surface_technics_id.name))
|
||||||
order='sequence asc'
|
surface_technics_arr.append(item.route_workcenter_id.surface_technics_id.id)
|
||||||
)
|
route_workcenter_arr.append(item.route_workcenter_id.id)
|
||||||
# 用filter刷选表面工艺id'是否存在工艺类别对象里
|
if surface_technics_arr:
|
||||||
if production_process_category:
|
production_process = self.env['sf.production.process'].search(
|
||||||
for p in production_process_category:
|
[('id', 'in', surface_technics_arr)],
|
||||||
logging.info('production_process_category:%s' % p.name)
|
order='sequence asc'
|
||||||
production_process = p.production_process_ids.filtered(
|
)
|
||||||
lambda pp: pp.id in surface_technics_arr)
|
for p in production_process:
|
||||||
if production_process:
|
logging.info('production_process:%s' % p.name)
|
||||||
process_parameter = production.product_id.model_process_parameters_ids.filtered(
|
# if production_process:
|
||||||
lambda pm: pm.process_id.id == production_process.id)
|
process_parameter = production.product_id.model_process_parameters_ids.filtered(
|
||||||
if process_parameter:
|
lambda pm: pm.process_id.id == p.id)
|
||||||
# 产品为表面工艺服务的供应商
|
if process_parameter:
|
||||||
product_production_process = self.env['product.template'].search(
|
# 产品为表面工艺服务的供应商
|
||||||
[('server_product_process_parameters_id', '=', process_parameter.id)])
|
product_production_process = self.env['product.template'].search(
|
||||||
if product_production_process:
|
[('server_product_process_parameters_id', '=', process_parameter.id)])
|
||||||
route_production_process = self.env[
|
if product_production_process:
|
||||||
'mrp.routing.workcenter'].search(
|
route_production_process = self.env[
|
||||||
[('surface_technics_id', '=', production_process.id),
|
'mrp.routing.workcenter'].search(
|
||||||
('id', 'in', route_workcenter_arr)])
|
[('surface_technics_id', '=', p.id),
|
||||||
if route_production_process:
|
('id', 'in', route_workcenter_arr)])
|
||||||
workorders_values.append(
|
if route_production_process:
|
||||||
self.env[
|
workorders_values.append(
|
||||||
'mrp.workorder']._json_workorder_surface_process_str(
|
self.env[
|
||||||
production, route_production_process,
|
'mrp.workorder']._json_workorder_surface_process_str(
|
||||||
process_parameter,
|
production, route_production_process,
|
||||||
product_production_process.seller_ids[0].partner_id.id))
|
process_parameter,
|
||||||
|
product_production_process.seller_ids[0].partner_id.id))
|
||||||
elif production.product_id.categ_id.type == '坯料':
|
elif production.product_id.categ_id.type == '坯料':
|
||||||
embryo_routing_workcenter = self.env['sf.embryo.model.type.routing.sort'].search(
|
embryo_routing_workcenter = self.env['sf.embryo.model.type.routing.sort'].search(
|
||||||
[('embryo_model_type_id', '=', production.product_id.embryo_model_type_id.id)],
|
[('embryo_model_type_id', '=', production.product_id.embryo_model_type_id.id)],
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class Sf_Mrs_Connect(http.Controller):
|
|||||||
productions = request.env['mrp.production'].with_user(
|
productions = request.env['mrp.production'].with_user(
|
||||||
request.env.ref("base.user_admin")).search(domain)
|
request.env.ref("base.user_admin")).search(domain)
|
||||||
if productions:
|
if productions:
|
||||||
# # 拉取所有加工面的程序文件
|
# 拉取所有加工面的程序文件
|
||||||
for r in ret['processing_panel'].split(','):
|
for r in ret['processing_panel'].split(','):
|
||||||
program_path_tmp_r = os.path.join('/tmp', ret['folder_name'], 'return', r)
|
program_path_tmp_r = os.path.join('/tmp', ret['folder_name'], 'return', r)
|
||||||
if os.path.exists(program_path_tmp_r):
|
if os.path.exists(program_path_tmp_r):
|
||||||
@@ -110,12 +110,6 @@ class Sf_Mrs_Connect(http.Controller):
|
|||||||
pre_workorder.write(
|
pre_workorder.write(
|
||||||
{'processing_drawing': base64.b64encode(open(panel_file_path, 'rb').read())})
|
{'processing_drawing': base64.b64encode(open(panel_file_path, 'rb').read())})
|
||||||
productions.write({'programming_state': '已编程', 'work_state': '已编程'})
|
productions.write({'programming_state': '已编程', 'work_state': '已编程'})
|
||||||
# cnc_program_ids = [item.id for item in productions]
|
|
||||||
# workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
|
|
||||||
# [('production_id', 'in', cnc_program_ids)])
|
|
||||||
# if workpiece_delivery:
|
|
||||||
# workpiece_delivery.write(
|
|
||||||
# {'is_cnc_program_down': True, 'production_line_id': productions.production_line_id.id})
|
|
||||||
return json.JSONEncoder().encode(res)
|
return json.JSONEncoder().encode(res)
|
||||||
else:
|
else:
|
||||||
res = {'status': 0, 'message': '该制造订单暂未开始'}
|
res = {'status': 0, 'message': '该制造订单暂未开始'}
|
||||||
|
|||||||
Reference in New Issue
Block a user