修复返工bug
This commit is contained in:
@@ -814,17 +814,17 @@ class MrpProduction(models.Model):
|
|||||||
r = r.json()
|
r = r.json()
|
||||||
result = json.loads(r['result'])
|
result = json.loads(r['result'])
|
||||||
if result['status'] == 1:
|
if result['status'] == 1:
|
||||||
# program_path_tmp_panel = os.path.join('/tmp', result['folder_name'], 'return', processing_panel)
|
program_path_tmp_panel = os.path.join('/tmp', result['folder_name'], 'return', processing_panel)
|
||||||
# if os.path.exists(program_path_tmp_panel):
|
if os.path.exists(program_path_tmp_panel):
|
||||||
# files_r = os.listdir(program_path_tmp_panel)
|
files_r = os.listdir(program_path_tmp_panel)
|
||||||
# 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_panel, file_name)
|
file_path = os.path.join(program_path_tmp_panel, file_name)
|
||||||
# os.remove(file_path)
|
os.remove(file_path)
|
||||||
# download_state = self.env['sf.cnc.processing'].download_file_tmp(result['folder_name'],
|
download_state = self.env['sf.cnc.processing'].download_file_tmp(result['folder_name'],
|
||||||
# processing_panel)
|
processing_panel)
|
||||||
# if download_state is False:
|
if download_state is False:
|
||||||
# raise UserError('编程单号为%s的CNC程序文件从FTP拉取失败' % (self.programming_no))
|
raise UserError('编程单号为%s的CNC程序文件从FTP拉取失败' % (self.programming_no))
|
||||||
productions = self.env['mrp.production'].search(
|
productions = self.env['mrp.production'].search(
|
||||||
[('programming_no', '=', self.programming_no), ('state', 'not in', ('cancel', 'done'))])
|
[('programming_no', '=', self.programming_no), ('state', 'not in', ('cancel', 'done'))])
|
||||||
if productions:
|
if productions:
|
||||||
@@ -838,8 +838,8 @@ class MrpProduction(models.Model):
|
|||||||
panel_workorder.cnc_ids.sudo().unlink()
|
panel_workorder.cnc_ids.sudo().unlink()
|
||||||
self.env['sf.cam.work.order.program.knife.plan'].sudo().unlink_cam_plan(
|
self.env['sf.cam.work.order.program.knife.plan'].sudo().unlink_cam_plan(
|
||||||
productions)
|
productions)
|
||||||
program_path_tmp_panel = os.path.join('C://Users//43484//Desktop//fsdownload//test',
|
# program_path_tmp_panel = os.path.join('C://Users//43484//Desktop//fsdownload//test',
|
||||||
processing_panel)
|
# processing_panel)
|
||||||
logging.info('program_path_tmp_panel:%s' % program_path_tmp_panel)
|
logging.info('program_path_tmp_panel:%s' % program_path_tmp_panel)
|
||||||
files_panel = os.listdir(program_path_tmp_panel)
|
files_panel = os.listdir(program_path_tmp_panel)
|
||||||
if files_panel:
|
if files_panel:
|
||||||
|
|||||||
@@ -732,6 +732,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
logging.info('工序:%s' % workorder.routing_type)
|
logging.info('工序:%s' % workorder.routing_type)
|
||||||
logging.info('状态:%s' % workorder.state)
|
logging.info('状态:%s' % workorder.state)
|
||||||
logging.info('is_rework:%s' % workorder.is_rework)
|
logging.info('is_rework:%s' % workorder.is_rework)
|
||||||
|
logging.info('production_id.is_rework:%s' % workorder.production_id.is_rework)
|
||||||
logging.info('面:%s' % workorder.processing_panel)
|
logging.info('面:%s' % workorder.processing_panel)
|
||||||
logging.info('编程状态:%s' % workorder.production_id.programming_state)
|
logging.info('编程状态:%s' % workorder.production_id.programming_state)
|
||||||
logging.info('制造状态:%s' % workorder.production_id.state)
|
logging.info('制造状态:%s' % workorder.production_id.state)
|
||||||
@@ -741,7 +742,8 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
if workorder.production_id.programming_state == '已编程':
|
if workorder.production_id.programming_state == '已编程':
|
||||||
workorder.state = 'ready'
|
workorder.state = 'ready'
|
||||||
else:
|
else:
|
||||||
workorder.state = 'waiting'
|
if workorder.production_id.is_rework is True:
|
||||||
|
workorder.state = 'waiting'
|
||||||
if workorder.routing_type == 'CNC加工' and workorder.state not in ['done', 'rework', 'cancel']:
|
if workorder.routing_type == 'CNC加工' and workorder.state not in ['done', 'rework', 'cancel']:
|
||||||
pre_workorder = self.env['mrp.workorder'].search(
|
pre_workorder = self.env['mrp.workorder'].search(
|
||||||
[('production_id', '=', workorder.production_id.id),
|
[('production_id', '=', workorder.production_id.id),
|
||||||
@@ -762,6 +764,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
logging.info('工序:%s' % workorder.routing_type)
|
logging.info('工序:%s' % workorder.routing_type)
|
||||||
logging.info('状态:%s' % workorder.state)
|
logging.info('状态:%s' % workorder.state)
|
||||||
logging.info('is_rework:%s' % workorder.is_rework)
|
logging.info('is_rework:%s' % workorder.is_rework)
|
||||||
|
logging.info('production_id.is_rework:%s' % workorder.production_id.is_rework)
|
||||||
logging.info('面:%s' % workorder.processing_panel)
|
logging.info('面:%s' % workorder.processing_panel)
|
||||||
logging.info('编程状态:%s' % workorder.production_id.programming_state)
|
logging.info('编程状态:%s' % workorder.production_id.programming_state)
|
||||||
logging.info('制造状态:%s' % workorder.production_id.state)
|
logging.info('制造状态:%s' % workorder.production_id.state)
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import os
|
|||||||
from odoo import models, fields, api, _
|
from odoo import models, fields, api, _
|
||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
from odoo.modules import get_resource_path
|
from odoo.modules import get_resource_path
|
||||||
# from OCC.Extend.DataExchange import read_step_file
|
from OCC.Extend.DataExchange import read_step_file
|
||||||
# from OCC.Extend.DataExchange import write_stl_file
|
from OCC.Extend.DataExchange import write_stl_file
|
||||||
|
|
||||||
|
|
||||||
class ResProductMo(models.Model):
|
class ResProductMo(models.Model):
|
||||||
|
|||||||
@@ -75,14 +75,14 @@
|
|||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//sheet//group//group[2]//label" position="before">
|
<xpath expr="//sheet//group//group[2]//label" position="before">
|
||||||
<!-- <field name="process_state"/> -->
|
<!-- <field name="process_state"/> -->
|
||||||
<field name="state" readonly="0"/>
|
<field name="state" readonly="1"/>
|
||||||
<!-- <field name="process_state"/> -->
|
<!-- <field name="process_state"/> -->
|
||||||
|
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//sheet//group//group//div[3]" position="after">
|
<xpath expr="//sheet//group//group//div[3]" position="after">
|
||||||
<field name="manual_quotation" readonly="1"/>
|
<field name="manual_quotation" readonly="1"/>
|
||||||
<field name="programming_no" readonly="1"/>
|
<field name="programming_no" readonly="1"/>
|
||||||
<field name="programming_state" readonly="0"
|
<field name="programming_state" readonly="1"
|
||||||
decoration-success="programming_state == '已编程'"
|
decoration-success="programming_state == '已编程'"
|
||||||
decoration-warning="programming_state =='编程中'"
|
decoration-warning="programming_state =='编程中'"
|
||||||
decoration-danger="programming_state =='已编程未下发'"/>
|
decoration-danger="programming_state =='已编程未下发'"/>
|
||||||
|
|||||||
@@ -189,7 +189,7 @@
|
|||||||
<xpath expr="//label[1]" position="before">
|
<xpath expr="//label[1]" position="before">
|
||||||
<field name='routing_type' readonly="1"/>
|
<field name='routing_type' readonly="1"/>
|
||||||
<field name='process_state' attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/>
|
<field name='process_state' attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/>
|
||||||
<field name="rfid_code" force_save="1" readonly="0" cache="True"
|
<field name="rfid_code" force_save="1" readonly="1" cache="True"
|
||||||
attrs="{'invisible': [('rfid_code_old', '!=', False)]}"/>
|
attrs="{'invisible': [('rfid_code_old', '!=', False)]}"/>
|
||||||
<field name="rfid_code_old" readonly="1" attrs="{'invisible': [('rfid_code_old', '=', False)]}"/>
|
<field name="rfid_code_old" readonly="1" attrs="{'invisible': [('rfid_code_old', '=', False)]}"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ class ReworkWizard(models.TransientModel):
|
|||||||
if cnc_rework.cnc_ids:
|
if cnc_rework.cnc_ids:
|
||||||
for item_line in cnc_rework.cnc_ids:
|
for item_line in cnc_rework.cnc_ids:
|
||||||
vals = {
|
vals = {
|
||||||
'processing_panel': item_line.processing_panel,
|
|
||||||
'sequence_number': item_line.sequence_number,
|
'sequence_number': item_line.sequence_number,
|
||||||
'program_name': item_line.program_name,
|
'program_name': item_line.program_name,
|
||||||
'cutting_tool_name': item_line.cutting_tool_name,
|
'cutting_tool_name': item_line.cutting_tool_name,
|
||||||
@@ -107,7 +106,9 @@ class ReworkWizard(models.TransientModel):
|
|||||||
'cutting_tool_extension_length': item_line.cutting_tool_extension_length,
|
'cutting_tool_extension_length': item_line.cutting_tool_extension_length,
|
||||||
'estimated_processing_time': item_line.estimated_processing_time,
|
'estimated_processing_time': item_line.estimated_processing_time,
|
||||||
'cutting_tool_handle_type': item_line.cutting_tool_handle_type,
|
'cutting_tool_handle_type': item_line.cutting_tool_handle_type,
|
||||||
'ftp_path': item_line.ftp_path,
|
'program_path': item_line.program_path,
|
||||||
|
'ftp_path': item_line.program_path,
|
||||||
|
'processing_panel': panel.name,
|
||||||
'program_create_date': datetime.strftime(item_line.program_create_date,
|
'program_create_date': datetime.strftime(item_line.program_create_date,
|
||||||
'%Y-%m-%d %H:%M:%S'),
|
'%Y-%m-%d %H:%M:%S'),
|
||||||
'remark': item_line.remark
|
'remark': item_line.remark
|
||||||
@@ -117,7 +118,9 @@ class ReworkWizard(models.TransientModel):
|
|||||||
vals = {
|
vals = {
|
||||||
'sequence_number': cmm_line.sequence_number,
|
'sequence_number': cmm_line.sequence_number,
|
||||||
'program_name': cmm_line.program_name,
|
'program_name': cmm_line.program_name,
|
||||||
'ftp_path': cmm_line.ftp_path,
|
'program_path': cmm_line.program_path,
|
||||||
|
'ftp_path': item_line.program_path,
|
||||||
|
'processing_panel': panel.name,
|
||||||
'program_create_date': datetime.strftime(cmm_line.program_create_date,
|
'program_create_date': datetime.strftime(cmm_line.program_create_date,
|
||||||
'%Y-%m-%d %H:%M:%S')
|
'%Y-%m-%d %H:%M:%S')
|
||||||
}
|
}
|
||||||
@@ -137,10 +140,10 @@ class ReworkWizard(models.TransientModel):
|
|||||||
if new_pre_workorder:
|
if new_pre_workorder:
|
||||||
pre_rework = self.production_id.workorder_ids.filtered(
|
pre_rework = self.production_id.workorder_ids.filtered(
|
||||||
lambda pr: pr.processing_panel == panel.name and pr.state in (
|
lambda pr: pr.processing_panel == panel.name and pr.state in (
|
||||||
'rework') and crw.routing_type == '装夹预调')
|
'rework') and pr.routing_type == '装夹预调')
|
||||||
new_pre_workorder.write(
|
new_pre_workorder.write(
|
||||||
{'processing_drawing': pre_rework.processing_drawing})
|
{'processing_drawing': pre_rework.processing_drawing})
|
||||||
self.production_id.write({'state': 'progress'})
|
self.production_id.write({'state': 'progress', 'is_rework': False})
|
||||||
if self.is_reprogramming is True:
|
if self.is_reprogramming is True:
|
||||||
self.production_id.update_programming_state()
|
self.production_id.update_programming_state()
|
||||||
self.production_id.write(
|
self.production_id.write(
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ from datetime import datetime
|
|||||||
import requests
|
import requests
|
||||||
from odoo import http
|
from odoo import http
|
||||||
from odoo.http import request
|
from odoo.http import request
|
||||||
# from OCC.Extend.DataExchange import read_step_file
|
from OCC.Extend.DataExchange import read_step_file
|
||||||
# from OCC.Extend.DataExchange import write_stl_file
|
from OCC.Extend.DataExchange import write_stl_file
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
from odoo.modules import get_resource_path
|
from odoo.modules import get_resource_path
|
||||||
from odoo.exceptions import ValidationError, UserError
|
from odoo.exceptions import ValidationError, UserError
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import os
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from stl import mesh
|
from stl import mesh
|
||||||
# from OCC.Core.GProp import GProp_GProps
|
# from OCC.Core.GProp import GProp_GProps
|
||||||
# from OCC.Extend.DataExchange import read_step_file
|
from OCC.Extend.DataExchange import read_step_file
|
||||||
# from OCC.Extend.DataExchange import write_stl_file
|
from OCC.Extend.DataExchange import write_stl_file
|
||||||
from odoo.addons.sf_base.commons.common import Common
|
from odoo.addons.sf_base.commons.common import Common
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
from odoo.modules import get_resource_path
|
from odoo.modules import get_resource_path
|
||||||
|
|||||||
Reference in New Issue
Block a user