Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/优化agv和ftp
# Conflicts: # sf_manufacturing/models/mrp_production.py # sf_manufacturing/models/mrp_workorder.py # sf_mrs_connect/models/ftp_operate.py # sf_sale/models/quick_easy_order_old.py
This commit is contained in:
@@ -46,6 +46,8 @@ class ResMrpWorkOrder(models.Model):
|
||||
], string="工序类型")
|
||||
results = fields.Char('结果')
|
||||
|
||||
manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
|
||||
|
||||
@api.onchange('users_ids')
|
||||
def get_user_permissions(self):
|
||||
uid = self.env.uid
|
||||
@@ -364,6 +366,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
y7 = self.Y7_axis
|
||||
y8 = self.Y8_axis
|
||||
z1 = self.Z9_axis
|
||||
z2 = self.Z10_axis
|
||||
x0 = ((x3 - x4) * (x2 * y1 - x1 * y2) - (x1 - x2) * (x4 * y3 - x3 * y4)) / (
|
||||
(x3 - x4) * (y1 - y2) - (x1 - x2) * (y3 - y4))
|
||||
y0 = ((y3 - y4) * (y2 * x1 - y1 * x2) - (y1 - y2) * (y4 * x3 - y3 * x4)) / (
|
||||
@@ -374,7 +377,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
(y7 - y8) * (x5 - x6) - (y5 - y6) * (x7 - x8))
|
||||
x = (x0 + x1) / 2
|
||||
y = (y0 + y1) / 2
|
||||
z = z1 / 2
|
||||
z = (z1 + z2) / 2
|
||||
|
||||
jd = math.atan2((x5 - x6), (y5 - y6))
|
||||
jdz = jd * 180 / math.pi
|
||||
@@ -815,7 +818,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
production_no_ftp = reportpath.split('/')
|
||||
production_no = workorder.production_id.name.replace('/', '_')
|
||||
# ftp地址
|
||||
remotepath = os.path.join('/NC/', production_no_ftp[1], 'detection')
|
||||
remotepath = os.path.join('/NC', production_no_ftp[1], 'detection')
|
||||
logging.info('ftp地址:%s' % remotepath)
|
||||
if reportpath.find(production_no) != -1:
|
||||
# 服务器内临时地址
|
||||
@@ -894,7 +897,7 @@ class CNCprocessing(models.Model):
|
||||
'cutting_tool_handle_type': obj['cutting_tool_handle_type'],
|
||||
'estimated_processing_time': obj['estimated_processing_time'],
|
||||
'remark': obj['remark'],
|
||||
'program_path': program_path.replace('/tmp', '')
|
||||
'program_path': program_path.replace('/tmp', '/home/ftp/ftp_root/NC')
|
||||
})
|
||||
cnc_processing.get_cnc_processing_file(program_path_tmp, cnc_processing, program_path)
|
||||
# cnc_workorder.state = 'done'
|
||||
@@ -933,7 +936,7 @@ class CNCprocessing(models.Model):
|
||||
|
||||
# 将FTP的nc文件下载到临时目录
|
||||
def download_file_tmp(self, production_no, processing_panel):
|
||||
remotepath = os.path.join('/NC/', production_no, 'return', processing_panel)
|
||||
remotepath = os.path.join('/NC', production_no, 'return', processing_panel)
|
||||
serverdir = os.pat.join('/tmp', production_no, 'return', processing_panel)
|
||||
ftp_resconfig = self.env['res.config.settings'].get_values()
|
||||
ftp = FtpController(str(ftp_resconfig['ftp_host']), int(ftp_resconfig['ftp_port']), ftp_resconfig['ftp_user'],
|
||||
@@ -986,15 +989,16 @@ class SfWorkOrderBarcodes(models.Model):
|
||||
workorder = self.env['mrp.workorder'].browse(self.ids)
|
||||
# workorder = self.env['mrp.workorder'].search(
|
||||
# [('routing_type', '=', '装夹预调'), ('production_id', '=', self.production_id.id)])
|
||||
# workorder_old = self.env['mrp.workorder'].search([('rfid_code', '=', barcode)])
|
||||
# if workorder_old:
|
||||
# raise UserError('该托盘已绑定工件,请先解除绑定!!!')
|
||||
workorder_old = self.env['mrp.workorder'].search([('rfid_code', '=', barcode)])
|
||||
if workorder_old:
|
||||
raise UserError('该托盘已绑定工件,请先解除绑定!!!')
|
||||
if workorder:
|
||||
if workorder.routing_type == '装夹预调':
|
||||
if workorder.state in ['progress', 'done']:
|
||||
work_state = {'progress': '进行中', 'done': '已完工'}
|
||||
raise UserError('该工单%s,不能重新绑定托盘' % work_state.get(workorder.state))
|
||||
if workorder.state in ['done']:
|
||||
work_state = {'done': '已完工'}
|
||||
raise UserError('装夹%s,请勿重复扫码' % work_state.get(workorder.state))
|
||||
lots = self.env['stock.lot'].sudo().search([('rfid', '=', barcode)])
|
||||
logging.info("托盘信息:%s" % lots)
|
||||
if lots:
|
||||
for lot in lots:
|
||||
if lot.product_id.categ_type == '夹具':
|
||||
@@ -1013,6 +1017,7 @@ class SfWorkOrderBarcodes(models.Model):
|
||||
if workorder_rfid:
|
||||
for item in workorder_rfid:
|
||||
item.write({'rfid_code': barcode})
|
||||
logging.info("Rfid绑定成功!!!")
|
||||
else:
|
||||
embryo_stock_lot = self.env['stock.lot'].search([('name', '=', barcode)])
|
||||
if embryo_stock_lot:
|
||||
|
||||
Reference in New Issue
Block a user