From ff072a32bbd8f7a8779f7079c18257600278a4bf Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Tue, 12 Nov 2024 17:53:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=80=80=E5=9B=9E=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/__manifest__.py | 1 + sf_manufacturing/models/mrp_production.py | 64 +++++----- sf_manufacturing/models/mrp_workorder.py | 28 +++-- .../models/sf_technology_design.py | 4 +- sf_manufacturing/models/stock.py | 52 +++----- .../views/mrp_production_addional_change.xml | 7 +- sf_manufacturing/wizard/__init__.py | 1 + .../production_technology_re_adjust_wizard.py | 75 +++++++++++ ...tion_technology_re_adjust_wizard_views.xml | 34 +++++ sf_mrs_connect/controllers/controllers.py | 119 +++++++++--------- 10 files changed, 246 insertions(+), 139 deletions(-) create mode 100644 sf_manufacturing/wizard/production_technology_re_adjust_wizard.py create mode 100644 sf_manufacturing/wizard/production_technology_re_adjust_wizard_views.xml diff --git a/sf_manufacturing/__manifest__.py b/sf_manufacturing/__manifest__.py index 98c71f21..da1e497e 100644 --- a/sf_manufacturing/__manifest__.py +++ b/sf_manufacturing/__manifest__.py @@ -22,6 +22,7 @@ 'wizard/rework_wizard_views.xml', 'wizard/production_wizard_views.xml', 'wizard/production_technology_wizard_views.xml', + 'wizard/production_technology_re_adjust_wizard_views.xml', 'views/mrp_views_menus.xml', 'views/agv_scheduling_views.xml', 'views/stock_lot_views.xml', diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index ab78eaab..5a782984 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -257,51 +257,49 @@ class MrpProduction(models.Model): if production.tool_state == '2': production.state = 'rework' + # 退回调整 def technology_back_adjust(self): - special_design = self.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', '=', self.id)] - if item.surface_technics_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'}) - 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)) - 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() + domain = [('state', '=', 'confirmed')] + if self.production_type == '自动化产线加工': + cloud_programming = self._cron_get_programming_state() + if cloud_programming['send_state'] == 'sending': + raise UserError(_("编程文件正在下发中,请稍后重试")) + domain += [('programming_no', '=', self.programming_no)] + # 带排程的制造订单 + production_confirmed = self.env['mrp.production'].search(domain) + if production_confirmed: + return { + 'name': _('退回调整'), + 'type': 'ir.actions.act_window', + 'view_mode': 'form', + 'res_model': 'sf.production.technology.re_adjust.wizard', + 'target': 'new', + 'context': { + 'default_production_id': self.id, + 'default_origin': self.origin, + }} # 工艺确认 def technology_confirm(self): process_parameters = [] + account_moves = [] 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: - if special.process_parameters_id: + if special.process_parameters_id and special.active is True: product_production_process = self.env['product.template'].search( [('server_product_process_parameters_id', '=', special.process_parameters_id.id)]) if not product_production_process: if special.process_parameters_id not in process_parameters: 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: raise UserError(_("【工艺设计】-【参数】为%s的在【产品】中不存在,请先创建", ", ".join(process_parameters))) # 判断同一个加工面的标准工序的顺序是否依次排序 diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 5c70712b..500e9a9b 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -183,23 +183,37 @@ class ResMrpWorkOrder(models.Model): for order in self: if order.routing_type == '表面工艺': 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_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: - if line.product_id.server_product_process_parameters_id == order.surface_technics_parameters_id and line.product_qty == len( - production_no_remanufacture): - order.surface_technics_purchase_count = len(purchase) + if line.product_id.server_product_process_parameters_id == order.surface_technics_parameters_id: + if (line.product_qty == len(production_no_remanufacture)) or technology_design.is_auto is False: + order.surface_technics_purchase_count = len(purchase) else: order.surface_technics_purchase_count = 0 def action_view_surface_technics_purchase(self): self.ensure_one() 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] - 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 = { "type": "ir.actions.act_window", "res_model": "purchase.order", diff --git a/sf_manufacturing/models/sf_technology_design.py b/sf_manufacturing/models/sf_technology_design.py index da9c88ee..b1bd229d 100644 --- a/sf_manufacturing/models/sf_technology_design.py +++ b/sf_manufacturing/models/sf_technology_design.py @@ -16,13 +16,13 @@ class sf_technology_design(models.Model): is_auto = fields.Boolean('是否自动生成', default=False) 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, '', { 'route_id': route.id, 'panel': k, 'process_parameters_id': False if route.routing_type != '表面工艺' else self.env[ 'sf.production.process.parameter'].search( - [('process_id', '=', route.surface_technics_id.id)]).id, + [('id', '=', process_parameter.id)]).id, 'sequence': i, 'is_auto': True}] return workorders_values_str diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index 209d76f2..000e0620 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -372,7 +372,7 @@ class StockRule(models.Model): for route in product_routing_workcenter: i += 1 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 == '坯料': embryo_routing_workcenter = self.env['sf.embryo.model.type.routing.sort'].search( [('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: i += 1 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 = [] route_workcenter_arr = [] - aa = production.product_id.model_process_parameters_ids.ids - aa1 = tuple(production.product_id.model_process_parameters_ids.ids) - aa2 = production.product_id.product_model_type_id.surface_technics_routing_tmpl_ids.filtered( - lambda st: st.id == 12) - for process_param in production.product_id.product_model_type_id.surface_technics_routing_tmpl_ids.filtered( - lambda st: st.id in (12,16)): - # if item.route_workcenter_id.surface_technics_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) + for item in production.product_id.product_model_type_id.surface_technics_routing_tmpl_ids: + if item.route_workcenter_id.surface_technics_id.id: + for process_param in production.product_id.model_process_parameters_ids: + if item.route_workcenter_id.surface_technics_id == process_param.process_id: + 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: production_process = self.env['sf.production.process'].search( [('id', 'in', surface_technics_arr)], @@ -410,9 +401,6 @@ class StockRule(models.Model): logging.info('production_process:%s' % p.name) process_parameter = production.product_id.model_process_parameters_ids.filtered( 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: i += 1 route_production_process = self.env[ @@ -420,21 +408,21 @@ class StockRule(models.Model): [('surface_technics_id', '=', p.id), ('id', 'in', route_workcenter_arr)]) 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, - product_production_process, - i)) + i, + process_parameter)) productions.technology_design_ids = technology_design_values # 同一个产品多个制造订单对应一个编程单和模型库 # 只调用一次fetchCNC,并将所有生产订单的名称作为字符串传递 - if not production_item.programming_no and production.production_type == '自动化产线加工': - if not production_programming.programming_no: - production_item.fetchCNC( - ', '.join(product_id_to_production_names[production_item.product_id.id])) - else: - production_item.write({'programming_no': production_programming.programming_no, - 'programming_state': '编程中'}) + # if not production_item.programming_no and production.production_type == '自动化产线加工': + # if not production_programming.programming_no: + # production_item.fetchCNC( + # ', '.join(product_id_to_production_names[production_item.product_id.id])) + # else: + # production_item.write({'programming_no': production_programming.programming_no, + # 'programming_state': '编程中'}) return True diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index fc03ba6e..44416d7a 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -82,9 +82,12 @@ - - + + diff --git a/sf_manufacturing/wizard/__init__.py b/sf_manufacturing/wizard/__init__.py index b10ec066..e2206a5f 100644 --- a/sf_manufacturing/wizard/__init__.py +++ b/sf_manufacturing/wizard/__init__.py @@ -2,3 +2,4 @@ from . import workpiece_delivery_wizard from . import rework_wizard from . import production_wizard from . import production_technology_wizard +from . import production_technology_re_adjust_wizard diff --git a/sf_manufacturing/wizard/production_technology_re_adjust_wizard.py b/sf_manufacturing/wizard/production_technology_re_adjust_wizard.py new file mode 100644 index 00000000..e3550b58 --- /dev/null +++ b/sf_manufacturing/wizard/production_technology_re_adjust_wizard.py @@ -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() + diff --git a/sf_manufacturing/wizard/production_technology_re_adjust_wizard_views.xml b/sf_manufacturing/wizard/production_technology_re_adjust_wizard_views.xml new file mode 100644 index 00000000..48346cb2 --- /dev/null +++ b/sf_manufacturing/wizard/production_technology_re_adjust_wizard_views.xml @@ -0,0 +1,34 @@ + + + + sf.production.technology.re_adjust.wizard.form.view + sf.production.technology.re_adjust.wizard + +
+ + + +
+ + 当前制造订单,同一销售订单相同产品所生成的制造订单是否统一进行退回调整操作 +
+
+
+
+
+
+
+ + + 工艺退回调整 + sf.production.technology.re_adjust.wizard + form + + + + new + + +
\ No newline at end of file diff --git a/sf_mrs_connect/controllers/controllers.py b/sf_mrs_connect/controllers/controllers.py index 39b4ad8a..ae8597b9 100644 --- a/sf_mrs_connect/controllers/controllers.py +++ b/sf_mrs_connect/controllers/controllers.py @@ -30,72 +30,65 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController): domain += [('state', 'not in', ['done', 'scrap', 'cancel'])] productions = request.env['mrp.production'].with_user( 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: # 拉取所有加工面的程序文件 - for r in ret['processing_panel'].split(','): - program_path_tmp_r = os.path.join('/tmp', ret['folder_name'], 'return', r) - if os.path.exists(program_path_tmp_r): - files_r = os.listdir(program_path_tmp_r) - if files_r: - for file_name in files_r: - file_path = os.path.join(program_path_tmp_r, file_name) - os.remove(file_path) - download_state = request.env['sf.cnc.processing'].with_user( - request.env.ref("base.user_admin")).download_file_tmp( - ret['folder_name'], r) - if download_state is False: - res['status'] = -2 - res['message'] = '编程单号为%s的CNC程序文件从FTP拉取失败' % (ret['programming_no']) - return json.JSONEncoder().encode(res) + # for r in ret['processing_panel'].split(','): + # program_path_tmp_r = os.path.join('/tmp', ret['folder_name'], 'return', r) + # if os.path.exists(program_path_tmp_r): + # files_r = os.listdir(program_path_tmp_r) + # if files_r: + # for file_name in files_r: + # file_path = os.path.join(program_path_tmp_r, file_name) + # os.remove(file_path) + # download_state = request.env['sf.cnc.processing'].with_user( + # request.env.ref("base.user_admin")).download_file_tmp( + # ret['folder_name'], r) + # if download_state is False: + # res['status'] = -2 + # res['message'] = '编程单号为%s的CNC程序文件从FTP拉取失败' % (ret['programming_no']) + # return json.JSONEncoder().encode(res) for production in productions: - if not production.workorder_ids: - production.product_id.model_processing_panel = ret['processing_panel'] - production._create_workorder(ret) - productions.process_range_time() - else: - for panel in ret['processing_panel'].split(','): - # 查询状态为进行中且工序类型为CNC加工的工单 - cnc_workorder_has = production.workorder_ids.filtered( - lambda ach: ach.routing_type == 'CNC加工' and ach.state not in ['progress', 'done', - 'rework', - 'cancel'] and ach.processing_panel == panel) - if cnc_workorder_has: - if cnc_workorder_has.cnc_ids: - cnc_workorder_has.cmm_ids.sudo().unlink() - cnc_workorder_has.cnc_ids.sudo().unlink() - # request.env['sf.cam.work.order.program.knife.plan'].sudo().unlink_cam_plan( - # production) - cnc_workorder_has.write( - {'cnc_ids': cnc_workorder_has.cnc_ids.sudo()._json_cnc_processing(panel, ret), - 'cmm_ids': cnc_workorder_has.cmm_ids.sudo()._json_cmm_program(panel, ret)}) - for panel in ret['processing_panel'].split(','): - # 查询状态为进行中且工序类型为CNC加工的工单 - cnc_workorder = productions.workorder_ids.filtered( - lambda ac: ac.routing_type == 'CNC加工' and ac.state not in ['progress', 'done', 'rework' - 'cancel'] and ac.processing_panel == panel) - if cnc_workorder: - # program_path_tmp_panel = os.path.join('C://Users//43484//Desktop//fsdownload//test', - # panel) - program_path_tmp_panel = os.path.join('/tmp', ret['folder_name'], 'return', panel) - logging.info('program_path_tmp_panel:%s' % program_path_tmp_panel) - files_panel = os.listdir(program_path_tmp_panel) - if files_panel: - for file in files_panel: - file_extension = os.path.splitext(file)[1] - if file_extension.lower() == '.pdf': - panel_file_path = os.path.join(program_path_tmp_panel, file) - logging.info('panel_file_path:%s' % panel_file_path) - logging.info('更新工作指令:%s' % cnc_workorder) - cnc_workorder.write({'cnc_worksheet': 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) + for panel in ret['processing_panel'].split(','): + # 查询状态为进行中且工序类型为CNC加工的工单 + cnc_workorder_has = production.workorder_ids.filtered( + lambda ach: ach.routing_type == 'CNC加工' and ach.state not in ['progress', 'done', + 'rework', + 'cancel'] and ach.processing_panel == panel) + if cnc_workorder_has: + if cnc_workorder_has.cnc_ids: + cnc_workorder_has.cmm_ids.sudo().unlink() + cnc_workorder_has.cnc_ids.sudo().unlink() + # request.env['sf.cam.work.order.program.knife.plan'].sudo().unlink_cam_plan( + # production) + cnc_workorder_has.write( + {'cnc_ids': cnc_workorder_has.cnc_ids.sudo()._json_cnc_processing(panel, ret), + 'cmm_ids': cnc_workorder_has.cmm_ids.sudo()._json_cmm_program(panel, ret)}) + # for panel in ret['processing_panel'].split(','): + # # 查询状态为进行中且工序类型为CNC加工的工单 + # cnc_workorder = productions.workorder_ids.filtered( + # lambda ac: ac.routing_type == 'CNC加工' and ac.state not in ['progress', 'done', 'rework' + # 'cancel'] and ac.processing_panel == panel) + # if cnc_workorder: + # # program_path_tmp_panel = os.path.join('C://Users//43484//Desktop//fsdownload//test', + # # panel) + # program_path_tmp_panel = os.path.join('/tmp', ret['folder_name'], 'return', panel) + # logging.info('program_path_tmp_panel:%s' % program_path_tmp_panel) + # files_panel = os.listdir(program_path_tmp_panel) + # if files_panel: + # for file in files_panel: + # file_extension = os.path.splitext(file)[1] + # if file_extension.lower() == '.pdf': + # panel_file_path = os.path.join(program_path_tmp_panel, file) + # logging.info('panel_file_path:%s' % panel_file_path) + # cnc_workorder.write({'cnc_worksheet': base64.b64encode(open(panel_file_path, 'rb').read())}) + # 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: + # pre_workorder.write( + # {'processing_drawing': base64.b64encode(open(panel_file_path, 'rb').read())}) productions.write({'programming_state': '已编程', 'work_state': '已编程'}) logging.info('已更新制造订单编程状态:%s' % productions.ids) res.update({