1.cnc工单新增程序文件字段2.优化获取编程单接口3.修复与中控对接的接口
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import logging
|
||||
import base64
|
||||
from datetime import datetime
|
||||
from datetime import date
|
||||
from datetime import datetime, timedelta
|
||||
import requests
|
||||
import os
|
||||
import math
|
||||
@@ -129,12 +130,30 @@ class ResMrpWorkOrder(models.Model):
|
||||
total_wight = fields.Float(string="总重量")
|
||||
maximum_carrying_weight = fields.Char(string="最大承载重量[kg]")
|
||||
maximum_clamping_force = fields.Char(string="最大夹持力[n]")
|
||||
production_line = fields.Char(string="生产线")
|
||||
production_line_id = fields.Many2one('sf.production.line', string="生产线")
|
||||
preset_program_information = fields.Char(string="预调程序信息")
|
||||
workpiece_delivery_ids = fields.One2many('sf.workpiece.delivery', 'workorder_id', '工件配送')
|
||||
is_delivery = fields.Boolean('是否配送完成', default=False)
|
||||
rfid_code = fields.Char('RFID')
|
||||
|
||||
def get_plan_workorder(self, production_line):
|
||||
tomorrow = (date.today() + timedelta(days=+1)).strftime("%Y-%m-%d")
|
||||
sql = """
|
||||
SELECT *
|
||||
FROM mrp_workorder
|
||||
WHERE date_planned_start = %s::timestamp
|
||||
AND date_planned_start < (%s::timestamp + interval '1 day')
|
||||
AND date_planned_finished >= %s::timestamp
|
||||
AND date_planned_finished < (%s::timestamp + interval '1 day')
|
||||
"""
|
||||
params = [tomorrow, tomorrow, tomorrow, tomorrow]
|
||||
if production_line:
|
||||
sql += "AND production_line_id = %s"
|
||||
params.append(production_line)
|
||||
self.env.cr.execute(sql, params)
|
||||
ids = [t[0] for t in self.env.cr.fetchall()]
|
||||
return [('id', 'in', ids)]
|
||||
|
||||
@api.onchange('is_ok')
|
||||
def _onchange_inspection_user_id(self):
|
||||
"""
|
||||
@@ -626,10 +645,12 @@ class CNCprocessing(models.Model):
|
||||
workorder_id = fields.Many2one('mrp.workorder', string="工单")
|
||||
production_id = fields.Many2one('mrp.production', string="制造订单")
|
||||
button_state = fields.Boolean(string='是否已经下发')
|
||||
program_path = fields.Char('程序文件路径')
|
||||
|
||||
# mrs下发编程单创建CNC加工
|
||||
def cnc_processing_create(self, cnc_workorder, ret):
|
||||
def cnc_processing_create(self, cnc_workorder, ret, program_path_ftp):
|
||||
logging.info('ret:%s' % ret)
|
||||
logging.info('program_path_ftp:%s' % program_path_ftp)
|
||||
for obj in ret['programming_list']:
|
||||
workorder = self.env['mrp.workorder'].search([('production_id.name', '=', ret['production_order_no']),
|
||||
('processing_panel', '=', obj['processing_panel']),
|
||||
@@ -649,7 +670,8 @@ class CNCprocessing(models.Model):
|
||||
'cutting_tool_extension_length': obj['cutting_tool_extension_length'],
|
||||
'cutting_tool_handle_type': obj['cutting_tool_handle_type'],
|
||||
'estimated_processing_time': obj['estimated_processing_time'],
|
||||
'remark': obj['remark']
|
||||
'remark': obj['remark'],
|
||||
'program_path': '%s/%s' % (program_path_ftp, obj['program_name'])
|
||||
})
|
||||
cnc_processing.get_cnc_processing_file(ret['folder_name'], cnc_processing, workorder.processing_panel)
|
||||
# cnc_workorder.state = 'done'
|
||||
|
||||
Reference in New Issue
Block a user