添加退回调整

This commit is contained in:
jinling.yang
2024-11-12 17:53:17 +08:00
parent d646019c93
commit ff072a32bb
10 changed files with 246 additions and 139 deletions

View File

@@ -22,6 +22,7 @@
'wizard/rework_wizard_views.xml', 'wizard/rework_wizard_views.xml',
'wizard/production_wizard_views.xml', 'wizard/production_wizard_views.xml',
'wizard/production_technology_wizard_views.xml', 'wizard/production_technology_wizard_views.xml',
'wizard/production_technology_re_adjust_wizard_views.xml',
'views/mrp_views_menus.xml', 'views/mrp_views_menus.xml',
'views/agv_scheduling_views.xml', 'views/agv_scheduling_views.xml',
'views/stock_lot_views.xml', 'views/stock_lot_views.xml',

View File

@@ -257,51 +257,49 @@ class MrpProduction(models.Model):
if production.tool_state == '2': if production.tool_state == '2':
production.state = 'rework' production.state = 'rework'
# 退回调整
def technology_back_adjust(self): def technology_back_adjust(self):
special_design = self.technology_design_ids.filtered( domain = [('state', '=', 'confirmed')]
lambda a: a.routing_tag == 'special' and a.is_auto is False and a.active in [True, False]) if self.production_type == '自动化产线加工':
workorders_values = [] cloud_programming = self._cron_get_programming_state()
for item in special_design: if cloud_programming['send_state'] == 'sending':
if item.active is False: raise UserError(_("编程文件正在下发中,请稍后重试"))
domain = [('production_id', '=', self.id)] domain += [('programming_no', '=', self.programming_no)]
if item.surface_technics_parameters_id: # 带排程的制造订单
domain += [('surface_technics_parameters_id', '=', item.process_parameters_id)] production_confirmed = self.env['mrp.production'].search(domain)
else: if production_confirmed:
domain += [('name', '=', item.route_id.name)] return {
workorder = self.env['mrp.workorder'].search(domain) 'name': _('退回调整'),
if workorder: 'type': 'ir.actions.act_window',
workorder.write({'state': 'cancel'}) 'view_mode': 'form',
else: 'res_model': 'sf.production.technology.re_adjust.wizard',
workorder = self.env['mrp.workorder'].search([('name', '=', item.route_id.name)]) 'target': 'new',
if not workorder: 'context': {
if item.route_id.routing_type == '表面工艺': 'default_production_id': self.id,
product_production_process = self.env['product.template'].search( 'default_origin': self.origin,
[('server_product_process_parameters_id', '=', item.process_parameters_id.id)]) }}
workorders_values.append(
self.env[
'mrp.workorder']._json_workorder_surface_process_str(self, item,
product_production_process.seller_ids[
0].partner_id.id))
else:
workorders_values.append(
self.env['mrp.workorder'].json_workorder_str(self, item))
if workorders_values:
self.write({'workorder_ids': workorders_values})
self._reset_work_order_sequence()
# 工艺确认 # 工艺确认
def technology_confirm(self): def technology_confirm(self):
process_parameters = [] process_parameters = []
account_moves = []
special_design = self.technology_design_ids.filtered( special_design = self.technology_design_ids.filtered(
lambda a: a.routing_tag == 'special' and a.process_parameters_id is not False) lambda a: a.routing_tag == 'special' and a.active in [True, False] and special.is_auto is False)
for special in special_design: for special in special_design:
if special.process_parameters_id: if special.process_parameters_id and special.active is True:
product_production_process = self.env['product.template'].search( product_production_process = self.env['product.template'].search(
[('server_product_process_parameters_id', '=', special.process_parameters_id.id)]) [('server_product_process_parameters_id', '=', special.process_parameters_id.id)])
if not product_production_process: if not product_production_process:
if special.process_parameters_id not in process_parameters: if special.process_parameters_id not in process_parameters:
process_parameters.append(special.process_parameters_id.display_name) process_parameters.append(special.process_parameters_id.display_name)
if special.active is False:
purchase = self.env['purchase.order'].search([('origin', '=', special.production_id.name)])
account = self.env['account.move'].search([('id', 'in', purchase.invoice_ids)])
if account.state != 'cancel':
if purchase.name not in account_moves:
account_moves.append(purchase.name)
if account_moves:
raise UserError(_("请联系工厂生产经理对采购订单为%s生成的账单进行取消", ", ".join(account_moves)))
if process_parameters: if process_parameters:
raise UserError(_("【工艺设计】-【参数】为%s的在【产品】中不存在,请先创建", ", ".join(process_parameters))) raise UserError(_("【工艺设计】-【参数】为%s的在【产品】中不存在,请先创建", ", ".join(process_parameters)))
# 判断同一个加工面的标准工序的顺序是否依次排序 # 判断同一个加工面的标准工序的顺序是否依次排序

View File

@@ -183,23 +183,37 @@ class ResMrpWorkOrder(models.Model):
for order in self: for order in self:
if order.routing_type == '表面工艺': if order.routing_type == '表面工艺':
production_programming = self.env['mrp.production'].search( production_programming = self.env['mrp.production'].search(
[('programming_no', '=', order.production_id.programming_no)], order='name asc') [('origin', '=', order.production_id.origin)], order='name asc')
production_no_remanufacture = production_programming.filtered(lambda a: a.is_remanufacture is False) production_no_remanufacture = production_programming.filtered(lambda a: a.is_remanufacture is False)
production_list = [production.name for production in production_programming] production_list = [production.name for production in production_programming]
purchase = self.env['purchase.order'].search([('origin', '=', ','.join(production_list))]) technology_design = self.env['sf.technology.design'].search(
[('process_parameters_id', '=', order.surface_technics_parameters_id.id),
('production_id', '=', order.production_id.id)])
if technology_design.is_auto is False:
domain = [('origin', '=', order.production_id.name)]
else:
domain = [('origin', '=', ','.join(production_list))]
purchase = self.env['purchase.order'].search(domain)
for line in purchase.order_line: for line in purchase.order_line:
if line.product_id.server_product_process_parameters_id == order.surface_technics_parameters_id and line.product_qty == len( if line.product_id.server_product_process_parameters_id == order.surface_technics_parameters_id:
production_no_remanufacture): if (line.product_qty == len(production_no_remanufacture)) or technology_design.is_auto is False:
order.surface_technics_purchase_count = len(purchase) order.surface_technics_purchase_count = len(purchase)
else: else:
order.surface_technics_purchase_count = 0 order.surface_technics_purchase_count = 0
def action_view_surface_technics_purchase(self): def action_view_surface_technics_purchase(self):
self.ensure_one() self.ensure_one()
production_programming = self.env['mrp.production'].search( production_programming = self.env['mrp.production'].search(
[('programming_no', '=', self.production_id.programming_no)], order='name asc') [('origin', '=', self.production_id.origin)], order='name asc')
production_list = [production.name for production in production_programming] production_list = [production.name for production in production_programming]
purchase_orders = self.env['purchase.order'].search([('origin', '=', ','.join(production_list))]) technology_design = self.env['sf.technology.design'].search(
[('process_parameters_id', '=', self.surface_technics_parameters_id.id),
('production_id', '=', self.production_id.id)])
if technology_design.is_auto is False:
domain = [('origin', '=', self.production_id.name)]
else:
domain = [('origin', '=', ','.join(production_list))]
purchase_orders = self.env['purchase.order'].search(domain)
result = { result = {
"type": "ir.actions.act_window", "type": "ir.actions.act_window",
"res_model": "purchase.order", "res_model": "purchase.order",

View File

@@ -16,13 +16,13 @@ class sf_technology_design(models.Model):
is_auto = fields.Boolean('是否自动生成', default=False) is_auto = fields.Boolean('是否自动生成', default=False)
active = fields.Boolean('有效', default=True) active = fields.Boolean('有效', default=True)
def json_technology_design_str(self, k, route, i): def json_technology_design_str(self, k, route, i, process_parameter):
workorders_values_str = [0, '', { workorders_values_str = [0, '', {
'route_id': route.id, 'route_id': route.id,
'panel': k, 'panel': k,
'process_parameters_id': False if route.routing_type != '表面工艺' else self.env[ 'process_parameters_id': False if route.routing_type != '表面工艺' else self.env[
'sf.production.process.parameter'].search( 'sf.production.process.parameter'].search(
[('process_id', '=', route.surface_technics_id.id)]).id, [('id', '=', process_parameter.id)]).id,
'sequence': i, 'sequence': i,
'is_auto': True}] 'is_auto': True}]
return workorders_values_str return workorders_values_str

View File

@@ -372,7 +372,7 @@ class StockRule(models.Model):
for route in product_routing_workcenter: for route in product_routing_workcenter:
i += 1 i += 1
technology_design_values.append( technology_design_values.append(
self.env['sf.technology.design'].json_technology_design_str(k, route, i)) self.env['sf.technology.design'].json_technology_design_str(k, route, i, False))
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)],
@@ -381,26 +381,17 @@ class StockRule(models.Model):
for route_embryo in embryo_routing_workcenter: for route_embryo in embryo_routing_workcenter:
i += 1 i += 1
technology_design_values.append( technology_design_values.append(
self.env['sf.technology.design'].json_technology_design_str('', route_embryo, i)) self.env['sf.technology.design'].json_technology_design_str(False, route_embryo, i,
False))
surface_technics_arr = [] surface_technics_arr = []
route_workcenter_arr = [] route_workcenter_arr = []
aa = production.product_id.model_process_parameters_ids.ids for item in production.product_id.product_model_type_id.surface_technics_routing_tmpl_ids:
aa1 = tuple(production.product_id.model_process_parameters_ids.ids) if item.route_workcenter_id.surface_technics_id.id:
aa2 = production.product_id.product_model_type_id.surface_technics_routing_tmpl_ids.filtered( for process_param in production.product_id.model_process_parameters_ids:
lambda st: st.id == 12) if item.route_workcenter_id.surface_technics_id == process_param.process_id:
for process_param in production.product_id.product_model_type_id.surface_technics_routing_tmpl_ids.filtered( surface_technics_arr.append(
lambda st: st.id in (12,16)): item.route_workcenter_id.surface_technics_id.id)
# if item.route_workcenter_id.surface_technics_id.id: route_workcenter_arr.append(item.route_workcenter_id.id)
# for process_param in production.product_id.model_process_parameters_ids:
logging.info('process_param:%s%s' % (process_param.id, process_param.name))
if item.route_workcenter_id.surface_technics_id == process_param.process_id:
logging.info(
'surface_technics_id:%s%s' % (
item.route_workcenter_id.surface_technics_id.id,
item.route_workcenter_id.surface_technics_id.name))
surface_technics_arr.append(
item.route_workcenter_id.surface_technics_id.id)
route_workcenter_arr.append(item.route_workcenter_id.id)
if surface_technics_arr: if surface_technics_arr:
production_process = self.env['sf.production.process'].search( production_process = self.env['sf.production.process'].search(
[('id', 'in', surface_technics_arr)], [('id', 'in', surface_technics_arr)],
@@ -410,9 +401,6 @@ class StockRule(models.Model):
logging.info('production_process:%s' % p.name) logging.info('production_process:%s' % p.name)
process_parameter = production.product_id.model_process_parameters_ids.filtered( process_parameter = production.product_id.model_process_parameters_ids.filtered(
lambda pm: pm.process_id.id == p.id) lambda pm: pm.process_id.id == p.id)
product_production_process = self.env['product.template'].search(
[('server_product_process_parameters_id', '=',
process_parameter.id)])
if process_parameter: if process_parameter:
i += 1 i += 1
route_production_process = self.env[ route_production_process = self.env[
@@ -420,21 +408,21 @@ class StockRule(models.Model):
[('surface_technics_id', '=', p.id), [('surface_technics_id', '=', p.id),
('id', 'in', route_workcenter_arr)]) ('id', 'in', route_workcenter_arr)])
technology_design_values.append( technology_design_values.append(
self.env['sf.technology.design'].json_technology_design_str(k, self.env['sf.technology.design'].json_technology_design_str(False,
route_production_process, route_production_process,
product_production_process, i,
i)) process_parameter))
productions.technology_design_ids = technology_design_values productions.technology_design_ids = technology_design_values
# 同一个产品多个制造订单对应一个编程单和模型库 # 同一个产品多个制造订单对应一个编程单和模型库
# 只调用一次fetchCNC并将所有生产订单的名称作为字符串传递 # 只调用一次fetchCNC并将所有生产订单的名称作为字符串传递
if not production_item.programming_no and production.production_type == '自动化产线加工': # if not production_item.programming_no and production.production_type == '自动化产线加工':
if not production_programming.programming_no: # if not production_programming.programming_no:
production_item.fetchCNC( # production_item.fetchCNC(
', '.join(product_id_to_production_names[production_item.product_id.id])) # ', '.join(product_id_to_production_names[production_item.product_id.id]))
else: # else:
production_item.write({'programming_no': production_programming.programming_no, # production_item.write({'programming_no': production_programming.programming_no,
'programming_state': '编程中'}) # 'programming_state': '编程中'})
return True return True

View File

@@ -82,9 +82,12 @@
</xpath> </xpath>
<xpath expr="//sheet//group//group//div[3]" position="after"> <xpath expr="//sheet//group//group//div[3]" position="after">
<field name="production_type" readonly="1"/> <field name="production_type" readonly="1"/>
<field name="manual_quotation" readonly="1"/> <field name="manual_quotation" readonly="1"
<field name="programming_no" readonly="1"/> attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工'])]}"/>
<field name="programming_no" readonly="1"
attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工'])]}"/>
<field name="programming_state" readonly="1" <field name="programming_state" readonly="1"
attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工'])]}"
decoration-success="programming_state == '已编程'" decoration-success="programming_state == '已编程'"
decoration-warning="programming_state =='编程中'" decoration-warning="programming_state =='编程中'"
decoration-danger="programming_state =='已编程未下发'"/> decoration-danger="programming_state =='已编程未下发'"/>

View File

@@ -2,3 +2,4 @@ from . import workpiece_delivery_wizard
from . import rework_wizard from . import rework_wizard
from . import production_wizard from . import production_wizard
from . import production_technology_wizard from . import production_technology_wizard
from . import production_technology_re_adjust_wizard

View File

@@ -0,0 +1,75 @@
# -*- coding: utf-8 -*-
# Part of YiZuo. See LICENSE file for full copyright and licensing details.
import logging
from odoo.exceptions import UserError, ValidationError
from collections import defaultdict, namedtuple
from odoo.addons.stock.models.stock_rule import ProcurementException
from datetime import datetime
from odoo import models, api, fields, _
class ProductionTechnologyReAdjustWizard(models.TransientModel):
_name = 'sf.production.technology.re_adjust.wizard'
_description = '制造订单工艺调整'
production_id = fields.Many2one('mrp.production', string='制造订单号')
origin = fields.Char(string='源单据')
is_technology_re_adjust = fields.Boolean(default=False)
def confirm(self):
if self.is_technology_re_adjust is True:
domain = [('origin', '=', self.origin),('state', '=', 'confirmed')]
else:
domain = [('id', '=', self.production_id.id)]
productions = self.env['mrp.production'].search(domain)
for item in productions:
special_design = item.technology_design_ids.filtered(
lambda a: a.routing_tag == 'special' and a.is_auto is False and a.active in [True, False])
workorders_values = []
for item in special_design:
if item.active is False:
# 工单采购单外协出入库单皆需取消
domain = [('production_id', '=', item.id)]
if item.process_parameters_id:
domain += [('surface_technics_parameters_id', '=', item.process_parameters_id)]
else:
domain += [('name', '=', item.route_id.name)]
workorder = self.env['mrp.workorder'].search(domain)
if workorder:
workorder.write({'state': 'cancel'})
workorder.picking_ids.write({'state': 'cancel'})
purchase_order = self.env['purchase.order'].search(
[('origin', '=', workorder.production_id.origin)])
for line in purchase.order_line:
if line.product_id.server_product_process_parameters_id == workorder.surface_technics_parameters_id:
purchase_order.write({'state': 'cancel'})
else:
workorder = self.env['mrp.workorder'].search([('name', '=', item.route_id.name)])
if not workorder:
if item.route_id.routing_type == '表面工艺':
product_production_process = self.env['product.template'].search(
[('server_product_process_parameters_id', '=', item.process_parameters_id.id)])
workorders_values.append(
self.env[
'mrp.workorder']._json_workorder_surface_process_str(self, item,
product_production_process.seller_ids[
0].partner_id.id))
if item.process_parameters_id.gain_way == '外协':
product_id_to_production_names = {}
# grouped_product_ids = {k: list(g) for k, g in
# groupby(self, key=lambda x: x.product_id.id)}
product_id_to_production_names[self.product_id] = [production.name for production in self]
self.env['purchase.order'].get_purchase_order(item.process_parameters_id,
self,
product_id_to_production_names)
else:
workorders_values.append(
self.env['mrp.workorder'].json_workorder_str(self, item))
if workorders_values:
self.write({'workorder_ids': workorders_values})
self._reset_work_order_sequence()

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.ui.view" id="sf_production_technology_re_adjust_wizard_form_view">
<field name="name">sf.production.technology.re_adjust.wizard.form.view</field>
<field name="model">sf.production.technology.re_adjust.wizard</field>
<field name="arch" type="xml">
<form>
<sheet>
<field name="production_id" invisible="1"/>
<field name="origin" invisible="1"/>
<div>
<field name="is_technology_re_adjust" force_save="1"/>
当前制造订单,同一销售订单相同产品所生成的制造订单是否统一进行退回调整操作
</div>
<footer>
<button string="确认" name="confirm" type="object" class="oe_highlight" confirm="是否确认退回调整"/>
<button string="取消" class="btn btn-secondary" special="cancel"/>
</footer>
</sheet>
</form>
</field>
</record>
<record id="action_sf_production_technology_re_adjust_wizard" model="ir.actions.act_window">
<field name="name">工艺退回调整</field>
<field name="res_model">sf.production.technology.re_adjust.wizard</field>
<field name="view_mode">form</field>
<!-- <field name="context">{-->
<!-- 'default_production_id': active_id}-->
<!-- </field>-->
<field name="target">new</field>
</record>
</odoo>

View File

@@ -30,72 +30,65 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
domain += [('state', 'not in', ['done', 'scrap', 'cancel'])] domain += [('state', 'not in', ['done', 'scrap', 'cancel'])]
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)
production_technology_comfirm = request.env['mrp.production'].with_user(
request.env.ref("base.user_admin")).search([('programming_no', '=', ret['programming_no']),('state','=','confirmed')])
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):
files_r = os.listdir(program_path_tmp_r) # files_r = os.listdir(program_path_tmp_r)
if files_r: # if files_r:
for file_name in files_r: # for file_name in files_r:
file_path = os.path.join(program_path_tmp_r, file_name) # file_path = os.path.join(program_path_tmp_r, file_name)
os.remove(file_path) # os.remove(file_path)
download_state = request.env['sf.cnc.processing'].with_user( # download_state = request.env['sf.cnc.processing'].with_user(
request.env.ref("base.user_admin")).download_file_tmp( # request.env.ref("base.user_admin")).download_file_tmp(
ret['folder_name'], r) # ret['folder_name'], r)
if download_state is False: # if download_state is False:
res['status'] = -2 # res['status'] = -2
res['message'] = '编程单号为%s的CNC程序文件从FTP拉取失败' % (ret['programming_no']) # res['message'] = '编程单号为%s的CNC程序文件从FTP拉取失败' % (ret['programming_no'])
return json.JSONEncoder().encode(res) # return json.JSONEncoder().encode(res)
for production in productions: for production in productions:
if not production.workorder_ids: for panel in ret['processing_panel'].split(','):
production.product_id.model_processing_panel = ret['processing_panel'] # 查询状态为进行中且工序类型为CNC加工的工单
production._create_workorder(ret) cnc_workorder_has = production.workorder_ids.filtered(
productions.process_range_time() lambda ach: ach.routing_type == 'CNC加工' and ach.state not in ['progress', 'done',
else: 'rework',
for panel in ret['processing_panel'].split(','): 'cancel'] and ach.processing_panel == panel)
# 查询状态为进行中且工序类型为CNC加工的工单 if cnc_workorder_has:
cnc_workorder_has = production.workorder_ids.filtered( if cnc_workorder_has.cnc_ids:
lambda ach: ach.routing_type == 'CNC加工' and ach.state not in ['progress', 'done', cnc_workorder_has.cmm_ids.sudo().unlink()
'rework', cnc_workorder_has.cnc_ids.sudo().unlink()
'cancel'] and ach.processing_panel == panel) # request.env['sf.cam.work.order.program.knife.plan'].sudo().unlink_cam_plan(
if cnc_workorder_has: # production)
if cnc_workorder_has.cnc_ids: cnc_workorder_has.write(
cnc_workorder_has.cmm_ids.sudo().unlink() {'cnc_ids': cnc_workorder_has.cnc_ids.sudo()._json_cnc_processing(panel, ret),
cnc_workorder_has.cnc_ids.sudo().unlink() 'cmm_ids': cnc_workorder_has.cmm_ids.sudo()._json_cmm_program(panel, ret)})
# request.env['sf.cam.work.order.program.knife.plan'].sudo().unlink_cam_plan( # for panel in ret['processing_panel'].split(','):
# production) # # 查询状态为进行中且工序类型为CNC加工的工单
cnc_workorder_has.write( # cnc_workorder = productions.workorder_ids.filtered(
{'cnc_ids': cnc_workorder_has.cnc_ids.sudo()._json_cnc_processing(panel, ret), # lambda ac: ac.routing_type == 'CNC加工' and ac.state not in ['progress', 'done', 'rework'
'cmm_ids': cnc_workorder_has.cmm_ids.sudo()._json_cmm_program(panel, ret)}) # 'cancel'] and ac.processing_panel == panel)
for panel in ret['processing_panel'].split(','): # if cnc_workorder:
# 查询状态为进行中且工序类型为CNC加工的工单 # # program_path_tmp_panel = os.path.join('C://Users//43484//Desktop//fsdownload//test',
cnc_workorder = productions.workorder_ids.filtered( # # panel)
lambda ac: ac.routing_type == 'CNC加工' and ac.state not in ['progress', 'done', 'rework' # program_path_tmp_panel = os.path.join('/tmp', ret['folder_name'], 'return', panel)
'cancel'] and ac.processing_panel == panel) # logging.info('program_path_tmp_panel:%s' % program_path_tmp_panel)
if cnc_workorder: # files_panel = os.listdir(program_path_tmp_panel)
# program_path_tmp_panel = os.path.join('C://Users//43484//Desktop//fsdownload//test', # if files_panel:
# panel) # for file in files_panel:
program_path_tmp_panel = os.path.join('/tmp', ret['folder_name'], 'return', panel) # file_extension = os.path.splitext(file)[1]
logging.info('program_path_tmp_panel:%s' % program_path_tmp_panel) # if file_extension.lower() == '.pdf':
files_panel = os.listdir(program_path_tmp_panel) # panel_file_path = os.path.join(program_path_tmp_panel, file)
if files_panel: # logging.info('panel_file_path:%s' % panel_file_path)
for file in files_panel: # cnc_workorder.write({'cnc_worksheet': base64.b64encode(open(panel_file_path, 'rb').read())})
file_extension = os.path.splitext(file)[1] # pre_workorder = productions.workorder_ids.filtered(
if file_extension.lower() == '.pdf': # lambda ap: ap.routing_type == '装夹预调' and ap.state not in ['done', 'rework'
panel_file_path = os.path.join(program_path_tmp_panel, file) # 'cancel'] and ap.processing_panel == panel)
logging.info('panel_file_path:%s' % panel_file_path) # if pre_workorder:
logging.info('更新工作指令:%s' % cnc_workorder) # pre_workorder.write(
cnc_workorder.write({'cnc_worksheet': base64.b64encode(open(panel_file_path, 'rb').read())}) # {'processing_drawing': base64.b64encode(open(panel_file_path, 'rb').read())})
logging.info('更新工作指令完成:%s' % cnc_workorder)
pre_workorder = productions.workorder_ids.filtered(
lambda ap: ap.routing_type == '装夹预调' and ap.state not in ['done', 'rework'
'cancel'] and ap.processing_panel == panel)
if pre_workorder:
logging.info('更新加工图纸:%s' % pre_workorder)
pre_workorder.write(
{'processing_drawing': base64.b64encode(open(panel_file_path, 'rb').read())})
logging.info('更新加工图纸完成:%s' % pre_workorder)
productions.write({'programming_state': '已编程', 'work_state': '已编程'}) productions.write({'programming_state': '已编程', 'work_state': '已编程'})
logging.info('已更新制造订单编程状态:%s' % productions.ids) logging.info('已更新制造订单编程状态:%s' % productions.ids)
res.update({ res.update({