Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造代码优化
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
<searchpanel>
|
<searchpanel>
|
||||||
<field name="routing_type" select="multi" string="工序类型" icon="fa-building" enable_counters="1"/>
|
<field name="routing_type" select="multi" string="工序类型" icon="fa-building" enable_counters="1"/>
|
||||||
<field name="state" select="multi" string="状态" icon="fa-building" enable_counters="1"/>
|
<field name="state" select="multi" string="状态" icon="fa-building" enable_counters="1"/>
|
||||||
|
<!-- <field name="manual_quotation" select="multi" string="" icon="fa-building" enable_counters="1"/>-->
|
||||||
</searchpanel>
|
</searchpanel>
|
||||||
|
|
||||||
<!-- <field name="name" filter_domain="['|', '|', ('明确的字段内容', 'ilike', self), ('shortdesc', 'ilike', self), ('name', 'ilike', self)]" string="Theme"/>-->
|
<!-- <field name="name" filter_domain="['|', '|', ('明确的字段内容', 'ilike', self), ('shortdesc', 'ilike', self), ('name', 'ilike', self)]" string="Theme"/>-->
|
||||||
@@ -19,7 +20,11 @@
|
|||||||
<!-- <xpath expr="//search//group//filter[@name='product']" position="before">-->
|
<!-- <xpath expr="//search//group//filter[@name='product']" position="before">-->
|
||||||
<!-- <filter string="Tray code" name="traycode" domain="[]" context="{'group_by': 'tray_code'}"/>-->
|
<!-- <filter string="Tray code" name="traycode" domain="[]" context="{'group_by': 'tray_code'}"/>-->
|
||||||
<!-- </xpath>-->
|
<!-- </xpath>-->
|
||||||
|
<xpath expr="//filter[@name='date_start_filter']" position="after">
|
||||||
|
<separator/>
|
||||||
|
<filter string="人工编程" name="manual_quotation" domain="[('manual_quotation', '=', True)]"/>
|
||||||
|
<filter string="自动编程" name="no_manual_quotation" domain="[('manual_quotation', '=', False)]"/>
|
||||||
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
</odoo>
|
</odoo>
|
||||||
@@ -426,18 +426,33 @@ class Manufacturing_Connect(http.Controller):
|
|||||||
res = {'Succeed': True}
|
res = {'Succeed': True}
|
||||||
datas = request.httprequest.data
|
datas = request.httprequest.data
|
||||||
ret = json.loads(datas)
|
ret = json.loads(datas)
|
||||||
|
logging.info('ret:%s' % ret)
|
||||||
if 'DeviceId' in ret:
|
if 'DeviceId' in ret:
|
||||||
logging.info('DeviceId:%s' % ret['DeviceId'])
|
logging.info('DeviceId:%s' % ret['DeviceId'])
|
||||||
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
|
for i in range(1, 5):
|
||||||
[('feeder_station_destination_id.name', '=', ret['DeviceId']),
|
logging.info('F-RfidCode:%s' % i)
|
||||||
('status', '=', '已配送'), ('type', '=', '上产线')], order='id asc')
|
if f'RfidCode{i}' in ret:
|
||||||
|
rfid_code = ret[f'RfidCode{i}']
|
||||||
|
logging.info('RfidCode:%s' % rfid_code)
|
||||||
|
domain = [
|
||||||
|
('feeder_station_destination_id.name', '=', ret['DeviceId']),
|
||||||
|
('workorder_id.rfid_code', '=', rfid_code),
|
||||||
|
('status', '=', '已配送'),
|
||||||
|
('type', '=', '上产线')
|
||||||
|
]
|
||||||
|
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(domain, order='id asc')
|
||||||
if workpiece_delivery:
|
if workpiece_delivery:
|
||||||
for wd in workpiece_delivery:
|
for wd in workpiece_delivery:
|
||||||
logging.info('wd.production_id:%s' % wd.production_id.name)
|
logging.info('wd.production_id:%s' % wd.production_id.name)
|
||||||
if wd.workorder_id.state == 'done' and wd.production_id.production_line_state == '待上产线':
|
if wd.workorder_id.state == 'done' and wd.production_id.production_line_state == '待上产线':
|
||||||
logging.info('wd.production_line_state:%s' % wd.production_id.production_line_state)
|
logging.info('wd.production_line_state:%s' % wd.production_id.production_line_state)
|
||||||
wd.production_id.write({'production_line_state': '已上产线'})
|
wd.production_id.write({'production_line_state': '已上产线'})
|
||||||
wd.write({'production_line_state': '已上产线'})
|
next_workpiece = request.env['sf.workpiece.delivery'].sudo().search(
|
||||||
|
[('workorder_id.rfid_code', '=', rfid_code), ('type', '=', '下产线'),
|
||||||
|
('production_id', '=', wd.production_id.id)])
|
||||||
|
if next_workpiece:
|
||||||
|
logging.info('next_workpiece:%s' % next_workpiece.delivery_num)
|
||||||
|
next_workpiece.write({'status': '待下发', 'task_delivery_time': datetime.now()})
|
||||||
else:
|
else:
|
||||||
res = {'Succeed': False, 'ErrorCode': 203, 'Error': '该DeviceId没有对应的已配送工件数据'}
|
res = {'Succeed': False, 'ErrorCode': 203, 'Error': '该DeviceId没有对应的已配送工件数据'}
|
||||||
else:
|
else:
|
||||||
@@ -461,31 +476,50 @@ class Manufacturing_Connect(http.Controller):
|
|||||||
res = {'Succeed': True}
|
res = {'Succeed': True}
|
||||||
datas = request.httprequest.data
|
datas = request.httprequest.data
|
||||||
ret = json.loads(datas)
|
ret = json.loads(datas)
|
||||||
|
logging.info('ret:%s' % ret)
|
||||||
if 'DeviceId' in ret:
|
if 'DeviceId' in ret:
|
||||||
logging.info('DeviceId:%s' % ret['DeviceId'])
|
logging.info('DeviceId:%s' % ret['DeviceId'])
|
||||||
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
|
delivery_Arr = []
|
||||||
[('feeder_station_destination_id.name', '=', ret['DeviceId']),
|
for i in range(1, 5):
|
||||||
('status', '=', '已配送'), ('type', '=', '下产线')], order='id asc')
|
logging.info('F-RfidCode:%s' % i)
|
||||||
|
if f'RfidCode{i}' in ret:
|
||||||
|
rfid_code = ret[f'RfidCode{i}']
|
||||||
|
logging.info('RfidCode:%s' % rfid_code)
|
||||||
|
domain = [
|
||||||
|
('feeder_station_start_id.name', '=', ret['DeviceId']),
|
||||||
|
('workorder_id.rfid_code', '=', rfid_code),
|
||||||
|
('status', '=', '待下发'),
|
||||||
|
('type', '=', '下产线')
|
||||||
|
]
|
||||||
|
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(domain, order='id asc')
|
||||||
if workpiece_delivery:
|
if workpiece_delivery:
|
||||||
for wd in workpiece_delivery:
|
for wd in workpiece_delivery:
|
||||||
logging.info('wd.production_id:%s' % wd.production_id.name)
|
logging.info('wd.production_id:%s' % wd.production_id.name)
|
||||||
if wd.workorder_id.state == 'done' and wd.production_id.production_line_state == '已上产线':
|
if wd.workorder_id.state == 'done' and wd.production_id.production_line_state == '已上产线':
|
||||||
logging.info('wd.production_line_state:%s' % wd.production_id.production_line_state)
|
logging.info('wd.production_line_state:%s' % wd.production_id.production_line_state)
|
||||||
wd.production_id.write({'production_line_state': '已下产线'})
|
wd.production_id.write({'production_line_state': '已下产线'})
|
||||||
|
delivery_Arr.append({wd.id})
|
||||||
|
next_workpiece = request.env['sf.workpiece.delivery'].sudo().search(
|
||||||
|
[('workorder_id.rfid_code', '=', rfid_code), ('type', '=', '运送空料架'),
|
||||||
|
('production_id', '=', wd.production_id.id)])
|
||||||
|
if next_workpiece:
|
||||||
|
logging.info('next_workpiece:%s' % next_workpiece.delivery_num)
|
||||||
|
next_workpiece.write({'status': '待下发', 'task_delivery_time': datetime.now()})
|
||||||
|
if delivery_Arr:
|
||||||
|
logging.info('delivery_Arr:%s' % delivery_Arr)
|
||||||
|
delivery_workpiece = request.env['sf.workpiece.delivery'].sudo().search(
|
||||||
|
[('id', 'in', delivery_Arr)])
|
||||||
|
if delivery_workpiece:
|
||||||
logging.info('开始向agv下发下产线任务')
|
logging.info('开始向agv下发下产线任务')
|
||||||
wd._delivery_avg()
|
delivery_workpiece._delivery_avg()
|
||||||
logging.info('agv下发下产线任务已配送')
|
logging.info('agv下发下产线任务下发完成')
|
||||||
|
|
||||||
else:
|
|
||||||
res = {'Succeed': False, 'ErrorCode': 203, 'Error': '该DeviceId没有对应的工件配送数据'}
|
|
||||||
else:
|
|
||||||
res = {'Succeed': False, 'ErrorCode': 201, 'Error': '未传DeviceId字段'}
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||||
logging.info('AGVDownProduct error:%s' % e)
|
logging.info('AGVDownProduct error:%s' % e)
|
||||||
return json.JSONEncoder().encode(res)
|
return json.JSONEncoder().encode(res)
|
||||||
|
|
||||||
@http.route('/AutoDeviceApi/EquipmentBaseCoordinate', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False,
|
@http.route('/AutoDeviceApi/EquipmentBaseCoordinate', type='json', auth='sf_token', methods=['GET', 'POST'],
|
||||||
|
csrf=False,
|
||||||
cors="*")
|
cors="*")
|
||||||
def PutEquipmentBaseCoordinate(self, **kw):
|
def PutEquipmentBaseCoordinate(self, **kw):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
|
from datetime import datetime
|
||||||
from odoo import http
|
from odoo import http
|
||||||
from odoo.http import request
|
from odoo.http import request
|
||||||
|
|
||||||
@@ -24,14 +25,16 @@ class Workpiece(http.Controller):
|
|||||||
if 'reqCode' in ret:
|
if 'reqCode' in ret:
|
||||||
if 'method' in ret:
|
if 'method' in ret:
|
||||||
if ret['method'] == 'end':
|
if ret['method'] == 'end':
|
||||||
logging.info('backfeed-ret:%s' % ret['reqCode'].rsplit('-', 1)[0])
|
req_codes = ret['reqCode'].split(',')
|
||||||
|
for req_code in req_codes:
|
||||||
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
|
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
|
||||||
[('production_id.name', '=', ret['reqCode'].rsplit('-', 1)[0]), ('delivery_num', '=',
|
[('production_id.name', '=', req_code.rsplit('-', 1)[0]),
|
||||||
ret['reqCode'])])
|
('delivery_num', '=', req_code.strip())])
|
||||||
if workpiece_delivery:
|
if workpiece_delivery:
|
||||||
workpiece_delivery.write({'status': '已配送', 'task_completion_time': ret['reqTime']})
|
workpiece_delivery.write({'status': '已配送', 'task_completion_time': datetime.now()})
|
||||||
else:
|
else:
|
||||||
res = {'Succeed': False, 'ErrorCode': 203, 'Error': '该reqCode暂未查到对应的工件配送记录'}
|
res = {'Succeed': False, 'ErrorCode': 203,
|
||||||
|
'Error': '该reqCode暂未查到对应的工件配送记录'}
|
||||||
else:
|
else:
|
||||||
res = {'Succeed': False, 'ErrorCode': 204, 'Error': '未传method字段'}
|
res = {'Succeed': False, 'ErrorCode': 204, 'Error': '未传method字段'}
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
is_delivery = fields.Boolean('是否配送完成', default=False)
|
is_delivery = fields.Boolean('是否配送完成', default=False)
|
||||||
rfid_code = fields.Char('RFID码')
|
rfid_code = fields.Char('RFID码')
|
||||||
rfid_code_old = fields.Char('RFID码(已解除)')
|
rfid_code_old = fields.Char('RFID码(已解除)')
|
||||||
|
|
||||||
production_line_id = fields.Many2one('sf.production.line', related='production_id.production_line_id',
|
production_line_id = fields.Many2one('sf.production.line', related='production_id.production_line_id',
|
||||||
string='生产线', store=True)
|
string='生产线', store=True)
|
||||||
production_line_state = fields.Selection(related='production_id.production_line_state',
|
production_line_state = fields.Selection(related='production_id.production_line_state',
|
||||||
@@ -419,10 +420,8 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
for item in self.workpiece_delivery_ids:
|
for item in self.workpiece_delivery_ids:
|
||||||
if not item.route_id:
|
if not item.route_id:
|
||||||
raise UserError('【工件配送】明细中请选择【任务路线】')
|
raise UserError('【工件配送】明细中请选择【任务路线】')
|
||||||
# if not item.workpiece_code:
|
|
||||||
# raise UserError('请对【同运工件】进行扫描')
|
|
||||||
else:
|
else:
|
||||||
if self.cnc_program_down_state == '已下发':
|
if item.is_cnc_program_down is True:
|
||||||
if item.status == '待下发':
|
if item.status == '待下发':
|
||||||
return {
|
return {
|
||||||
'name': _('确认'),
|
'name': _('确认'),
|
||||||
@@ -773,6 +772,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
raise UserError("请对前置三元检测定位参数进行计算定位")
|
raise UserError("请对前置三元检测定位参数进行计算定位")
|
||||||
if not self.rfid_code:
|
if not self.rfid_code:
|
||||||
raise UserError("请扫RFID码进行绑定")
|
raise UserError("请扫RFID码进行绑定")
|
||||||
|
self.workpiece_delivery_ids[0].write({'status': '待下发'})
|
||||||
if self.picking_out_id:
|
if self.picking_out_id:
|
||||||
picking_out = self.env['stock.picking'].search([('id', '=', self.picking_out_id.id)])
|
picking_out = self.env['stock.picking'].search([('id', '=', self.picking_out_id.id)])
|
||||||
if picking_out.workorder_out_id:
|
if picking_out.workorder_out_id:
|
||||||
@@ -901,6 +901,11 @@ class CNCprocessing(models.Model):
|
|||||||
# cnc_workorder.state = 'done'
|
# cnc_workorder.state = 'done'
|
||||||
cnc_workorder.work_state = '已编程'
|
cnc_workorder.work_state = '已编程'
|
||||||
cnc_workorder.programming_state = '已编程'
|
cnc_workorder.programming_state = '已编程'
|
||||||
|
workpiece_delivery = self.env['sf.workpiece.delivery'].search(
|
||||||
|
[('production_id', '=', cnc_workorder.id)])
|
||||||
|
if workpiece_delivery:
|
||||||
|
for item in workpiece_delivery:
|
||||||
|
item.is_cnc_program_down = True
|
||||||
# cnc_workorder.time_ids.date_end = datetime.now()
|
# cnc_workorder.time_ids.date_end = datetime.now()
|
||||||
# cnc_workorder.button_finish()
|
# cnc_workorder.button_finish()
|
||||||
|
|
||||||
@@ -985,20 +990,11 @@ class SfWorkOrderBarcodes(models.Model):
|
|||||||
|
|
||||||
def on_barcode_scanned(self, barcode):
|
def on_barcode_scanned(self, barcode):
|
||||||
workorder = self.env['mrp.workorder'].browse(self.ids)
|
workorder = self.env['mrp.workorder'].browse(self.ids)
|
||||||
workorder_preset = self.env['mrp.workorder'].search(
|
# workorder_preset = self.env['mrp.workorder'].search(
|
||||||
[('routing_type', '=', '装夹预调'), ('rfid_code', '=', barcode)])
|
# [('routing_type', '=', '装夹预调'), ('rfid_code', '=', barcode)])
|
||||||
# workorder_old = self.env['mrp.workorder'].search([('rfid_code', '=', barcode)])
|
workorder_old = self.env['mrp.workorder'].search([('rfid_code', '=', barcode)])
|
||||||
if len(workorder_preset) <= 4:
|
if workorder_old:
|
||||||
workpiece_ids = []
|
raise UserError('该托盘已绑定【%s】制造订单,请先解除绑定!!!' % workorder_old.production_id.name)
|
||||||
for item in workorder_preset:
|
|
||||||
if item.production_line_id.id == workorder.production_line_id.id:
|
|
||||||
workpiece_ids.append(item.production_id.id)
|
|
||||||
else:
|
|
||||||
raise UserError('工件生产线不一致,请重新确认')
|
|
||||||
if workpiece_ids:
|
|
||||||
workorder.workpiece_delivery_ids.write({'sametransport_production_ids': [(6, 0, workpiece_ids)]})
|
|
||||||
|
|
||||||
# raise UserError('该托盘已绑定【%s】制造订单,请先解除绑定!!!' % workorder_old.production_id.name)
|
|
||||||
if workorder:
|
if workorder:
|
||||||
if workorder.routing_type == '装夹预调':
|
if workorder.routing_type == '装夹预调':
|
||||||
if workorder.state in ['done']:
|
if workorder.state in ['done']:
|
||||||
@@ -1086,12 +1082,11 @@ class WorkPieceDelivery(models.Model):
|
|||||||
|
|
||||||
delivery_num = fields.Char('工件配送编码')
|
delivery_num = fields.Char('工件配送编码')
|
||||||
workorder_id = fields.Many2one('mrp.workorder', string='工单', readonly=True)
|
workorder_id = fields.Many2one('mrp.workorder', string='工单', readonly=True)
|
||||||
production_id = fields.Many2one('mrp.production', string='制造订单', readonly=True)
|
production_id = fields.Many2one('mrp.production', string='制造订单号', readonly=True)
|
||||||
production_line_id = fields.Many2one('sf.production.line', compute='_compute_production_line_id',
|
production_line_id = fields.Many2one('sf.production.line', compute='_compute_production_line_id',
|
||||||
string='目的生产线', readonly=True,
|
string='目的生产线', readonly=True,
|
||||||
store=True)
|
store=True)
|
||||||
plan_start_processing_time = fields.Datetime('计划开始加工时间', readonly=True)
|
plan_start_processing_time = fields.Datetime('计划开始加工时间', readonly=True)
|
||||||
sametransport_production_ids = fields.Many2many('mrp.production', 'rel_workpiece_production', string='同运工件编码')
|
|
||||||
|
|
||||||
route_id = fields.Many2one('sf.agv.task.route', '任务路线')
|
route_id = fields.Many2one('sf.agv.task.route', '任务路线')
|
||||||
feeder_station_start_id = fields.Many2one('sf.agv.site', '起点接驳站')
|
feeder_station_start_id = fields.Many2one('sf.agv.site', '起点接驳站')
|
||||||
@@ -1102,25 +1097,56 @@ class WorkPieceDelivery(models.Model):
|
|||||||
[('上产线', '上产线'), ('下产线', '下产线'), ('运送空料架', '运送空料架')], string='类型')
|
[('上产线', '上产线'), ('下产线', '下产线'), ('运送空料架', '运送空料架')], string='类型')
|
||||||
delivery_duration = fields.Float('配送时长', compute='_compute_delivery_duration')
|
delivery_duration = fields.Float('配送时长', compute='_compute_delivery_duration')
|
||||||
status = fields.Selection(
|
status = fields.Selection(
|
||||||
[('待下发', '待下发'), ('待配送', '待配送'), ('已配送', '已配送')], string='状态',
|
[('待下发', '待下发'), ('待配送', '待配送'), ('已配送', '已配送')], string='状态', )
|
||||||
default='待下发')
|
is_cnc_program_down = fields.Boolean('程序是否下发', default=False)
|
||||||
production_line_state = fields.Selection(
|
|
||||||
[('待上产线', '待上产线'), ('已上产线', '已上产线'), ('已下产线', '已下产线')],
|
|
||||||
string='上/下产线', default='待上产线')
|
|
||||||
cnc_program_down_state = fields.Selection([('待下发', '待下发'), ('已下发', '已下发')],
|
|
||||||
string='CNC程序下发状态', default='待下发')
|
|
||||||
|
|
||||||
@api.onchange('route_id')
|
@api.onchange('route_id')
|
||||||
def onchage_route(self):
|
def onchange_route(self):
|
||||||
if self.route_id:
|
if self.route_id:
|
||||||
self.feeder_station_start_id = self.route_id.start_site_id
|
self.feeder_station_start_id = self.route_id.start_site_id.id
|
||||||
self.feeder_station_destination_id = self.route_id.end_site_id
|
self.feeder_station_destination_id = self.route_id.end_site_id.id
|
||||||
|
|
||||||
# 工件配送
|
# 工件配送
|
||||||
def button_delivery(self):
|
def button_delivery(self):
|
||||||
if self.cnc_program_down_state == '待下发':
|
delivery_ids = []
|
||||||
if self.route_id:
|
is_cnc_down = 0
|
||||||
if self.status == '待下发':
|
is_not_production_line = 0
|
||||||
|
is_not_route = 0
|
||||||
|
same_production_line_id = None
|
||||||
|
same_route_id = None
|
||||||
|
down_status = '待下发'
|
||||||
|
production_type = '上产线'
|
||||||
|
num = 0
|
||||||
|
for item in self:
|
||||||
|
num += 1
|
||||||
|
if num > 4:
|
||||||
|
raise UserError('仅限于配送1-4个制造订单,请重新选择')
|
||||||
|
if item.route_id:
|
||||||
|
if same_route_id is None:
|
||||||
|
same_route_id = item.route_id.id
|
||||||
|
if item.route_id.id != same_route_id:
|
||||||
|
is_not_route += 1
|
||||||
|
else:
|
||||||
|
raise UserError('请选择【任务路线】再进行配送')
|
||||||
|
# if production_type != item.type:
|
||||||
|
# raise UserError('请选择类型为【上产线】的制造订单进行配送')
|
||||||
|
if down_status != item.status:
|
||||||
|
raise UserError('请选择状态为【待下发】的制造订单进行配送')
|
||||||
|
if same_production_line_id is None:
|
||||||
|
same_production_line_id = item.production_line_id.id
|
||||||
|
if item.production_line_id.id != same_production_line_id:
|
||||||
|
is_not_production_line += 1
|
||||||
|
if item.is_cnc_program_down is False:
|
||||||
|
is_cnc_down += 1
|
||||||
|
if is_cnc_down == 0 and is_not_production_line == 0 and is_not_route == 0:
|
||||||
|
delivery_ids.append(item.id)
|
||||||
|
if is_cnc_down >= 1:
|
||||||
|
raise UserError('您所选择制造订单的【CNC程序】暂未下发,请在程序下发后再进行配送')
|
||||||
|
if is_not_production_line >= 1:
|
||||||
|
raise UserError('您所选择制造订单的【目的生产线】不一致,请重新确认')
|
||||||
|
if is_not_route >= 1:
|
||||||
|
raise UserError('您所选择制造订单的【任务路线】不一致,请重新确认')
|
||||||
|
if delivery_ids:
|
||||||
return {
|
return {
|
||||||
'name': _('确认'),
|
'name': _('确认'),
|
||||||
'type': 'ir.actions.act_window',
|
'type': 'ir.actions.act_window',
|
||||||
@@ -1128,40 +1154,43 @@ class WorkPieceDelivery(models.Model):
|
|||||||
'res_model': 'sf.workpiece.delivery.wizard',
|
'res_model': 'sf.workpiece.delivery.wizard',
|
||||||
'target': 'new',
|
'target': 'new',
|
||||||
'context': {
|
'context': {
|
||||||
'default_delivery_id': self.id,
|
'default_delivery_ids': [(6, 0, delivery_ids)],
|
||||||
}}
|
}}
|
||||||
else:
|
|
||||||
raise UserError('状态为【待下发】的工件记录可进行配送')
|
|
||||||
else:
|
|
||||||
raise UserError('请选择任务路线再进行配送')
|
|
||||||
else:
|
|
||||||
raise UserError(_("该制造订单还未下发CNC程序单,无法进行工件配送"))
|
|
||||||
|
|
||||||
# 配送至avg小车
|
# 配送至avg小车
|
||||||
def _delivery_avg(self):
|
def _delivery_avg(self):
|
||||||
agv_site = self.env['sf.agv.site'].search([])
|
agv_site = self.env['sf.agv.site'].search([])
|
||||||
# if agv_site:
|
if agv_site:
|
||||||
# agv_site.update_site_state()
|
agv_site.update_site_state()
|
||||||
config = self.env['res.config.settings'].get_values()
|
config = self.env['res.config.settings'].get_values()
|
||||||
positionCode_Arr = []
|
positionCode_Arr = []
|
||||||
if self.feeder_station_start_id:
|
delivery_Arr = []
|
||||||
|
feeder_station_start = None
|
||||||
|
feeder_station_destination = None
|
||||||
|
for item in self:
|
||||||
|
if feeder_station_start is None:
|
||||||
|
feeder_station_start = item.feeder_station_start_id.name
|
||||||
|
if feeder_station_destination is None:
|
||||||
|
feeder_station_destination = item.feeder_station_destination_id.name
|
||||||
|
delivery_Arr.append(item.delivery_num)
|
||||||
|
delivery_str = ', '.join(map(str, delivery_Arr))
|
||||||
|
if feeder_station_start is not None:
|
||||||
positionCode_Arr.append({
|
positionCode_Arr.append({
|
||||||
'positionCode': self.feeder_station_start_id.name,
|
'positionCode': feeder_station_start,
|
||||||
'code': '00'
|
'code': '00'
|
||||||
})
|
})
|
||||||
if self.feeder_station_destination_id:
|
if feeder_station_destination is not None:
|
||||||
positionCode_Arr.append({
|
positionCode_Arr.append({
|
||||||
'positionCode': self.feeder_station_destination_id.name,
|
'positionCode': feeder_station_destination,
|
||||||
'code': '00'
|
'code': '00'
|
||||||
})
|
})
|
||||||
res = {'reqCode': self.delivery_num, 'reqTime': '', 'clientCode': '', 'tokenCode': '',
|
res = {'reqCode': delivery_str, 'reqTime': '', 'clientCode': '', 'tokenCode': '',
|
||||||
'taskTyp': 'F01', 'ctnrTyp': '', 'ctnrCode': '', 'wbCode': config['wbcode'],
|
'taskTyp': 'F01', 'ctnrTyp': '', 'ctnrCode': '', 'wbCode': config['wbcode'],
|
||||||
'positionCodePath': positionCode_Arr,
|
'positionCodePath': positionCode_Arr,
|
||||||
'podCode': '',
|
'podCode': '',
|
||||||
'podDir': '', 'materialLot': '', 'priority': '', 'taskCode': '', 'agvCode': '', 'materialLot': '',
|
'podDir': '', 'materialLot': '', 'priority': '', 'taskCode': '', 'agvCode': '', 'materialLot': '',
|
||||||
'data': ''}
|
'data': ''}
|
||||||
try:
|
try:
|
||||||
# config['agv_rcs_url'] = 'http://172.16.10.114:8182/rcms/services/rest/hikRpcService/genAgvSchedulingTask'
|
|
||||||
logging.info('AGV请求路径:%s' % config['agv_rcs_url'])
|
logging.info('AGV请求路径:%s' % config['agv_rcs_url'])
|
||||||
logging.info('AGV-json:%s' % res)
|
logging.info('AGV-json:%s' % res)
|
||||||
headers = {'Content-Type': 'application/json'}
|
headers = {'Content-Type': 'application/json'}
|
||||||
@@ -1169,16 +1198,16 @@ class WorkPieceDelivery(models.Model):
|
|||||||
ret = ret.json()
|
ret = ret.json()
|
||||||
logging.info('config-ret:%s' % ret)
|
logging.info('config-ret:%s' % ret)
|
||||||
if ret['code'] == 0:
|
if ret['code'] == 0:
|
||||||
if self.delivery_num == ret['reqCode']:
|
req_codes = ret['reqCode'].split(',')
|
||||||
if self.sametransport_production_ids:
|
for delivery_item in self:
|
||||||
for item in self.sametransport_production_ids:
|
for req_code in req_codes:
|
||||||
sametransport_workpiece = self.search(
|
if delivery_item.delivery_num == req_code.strip():
|
||||||
[('production_id', '=', item.id), ('type', '=', '上产线')])
|
logging.info('delivery_num:%s' % delivery_item.delivery_num)
|
||||||
if sametransport_workpiece:
|
delivery_item.write({
|
||||||
sametransport_workpiece.write(
|
'task_delivery_time': fields.Datetime.now(),
|
||||||
{'task_delivery_time': fields.Datetime.now(), 'status': '待配送'})
|
'status': '待配送'
|
||||||
self.write(
|
})
|
||||||
{'task_delivery_time': fields.Datetime.now(), 'status': '待配送'})
|
delivery_item.workorder_id.write({'is_delivery': True})
|
||||||
else:
|
else:
|
||||||
raise UserError(ret['message'])
|
raise UserError(ret['message'])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -269,6 +269,13 @@ class ProductionLot(models.Model):
|
|||||||
rfid = fields.Char('Rfid', readonly=True)
|
rfid = fields.Char('Rfid', readonly=True)
|
||||||
product_specification = fields.Char('规格', compute='_compute_product_specification', store=True)
|
product_specification = fields.Char('规格', compute='_compute_product_specification', store=True)
|
||||||
|
|
||||||
|
def search_lot_put_rfid(self):
|
||||||
|
# 使用SQL将所有刀柄Rfid不满十位的值在前方补零
|
||||||
|
self.env.cr.execute(
|
||||||
|
'''UPDATE stock_lot SET rfid = LPAD(rfid, 10, '0') WHERE rfid IS NOT NULL AND LENGTH(rfid) < 10'''
|
||||||
|
)
|
||||||
|
self.env.cr.commit()
|
||||||
|
|
||||||
@api.depends('product_id')
|
@api.depends('product_id')
|
||||||
def _compute_product_specification(self):
|
def _compute_product_specification(self):
|
||||||
for stock in self:
|
for stock in self:
|
||||||
|
|||||||
@@ -67,6 +67,7 @@
|
|||||||
<attribute name="statusbar_visible">progress,pending_cam,pending_processing,pending_era_cam,completed,done
|
<attribute name="statusbar_visible">progress,pending_cam,pending_processing,pending_era_cam,completed,done
|
||||||
</attribute>
|
</attribute>
|
||||||
</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"/>
|
<field name="state"/>
|
||||||
|
|||||||
@@ -23,6 +23,9 @@
|
|||||||
<field name="product_id" position="after">
|
<field name="product_id" position="after">
|
||||||
<field name="equipment_id" optional="hide"/>
|
<field name="equipment_id" optional="hide"/>
|
||||||
</field>
|
</field>
|
||||||
|
<xpath expr="//field[@name='qty_remaining']" position="after">
|
||||||
|
<field name="manual_quotation" optional="show"/>
|
||||||
|
</xpath>
|
||||||
<xpath expr="//field[@name='date_planned_start']" position="replace">
|
<xpath expr="//field[@name='date_planned_start']" position="replace">
|
||||||
<field name="date_planned_start" string="计划开始日期" optional="show"/>
|
<field name="date_planned_start" string="计划开始日期" optional="show"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
@@ -174,6 +177,8 @@
|
|||||||
attrs="{'invisible': [('production_state','=', 'draft')], 'readonly': [('is_user_working', '=', True)]}"
|
attrs="{'invisible': [('production_state','=', 'draft')], 'readonly': [('is_user_working', '=', True)]}"
|
||||||
sum="real duration"/>
|
sum="real duration"/>
|
||||||
<field name="glb_file" readonly="1" widget="Viewer3D" string="加工模型"/>
|
<field name="glb_file" readonly="1" widget="Viewer3D" string="加工模型"/>
|
||||||
|
<field name="manual_quotation" readonly="1"
|
||||||
|
attrs="{'invisible': [('routing_type', '!=', 'CNC加工')]}"/>
|
||||||
<field name="processing_panel" readonly="1"
|
<field name="processing_panel" readonly="1"
|
||||||
attrs='{"invisible": [("routing_type","in",("获取CNC加工程序","切割"))]}'/>
|
attrs='{"invisible": [("routing_type","in",("获取CNC加工程序","切割"))]}'/>
|
||||||
<field name="equipment_id"
|
<field name="equipment_id"
|
||||||
@@ -186,7 +191,6 @@
|
|||||||
attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/>
|
attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/>
|
||||||
<field name="functional_fixture_type_id"
|
<field name="functional_fixture_type_id"
|
||||||
attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/>
|
attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/>
|
||||||
|
|
||||||
<field name="rfid_code" force_save="1" readonly="1" 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)]}"/>
|
||||||
@@ -265,7 +269,7 @@
|
|||||||
placeholder="如有预调程序信息请在此处输入....."/>
|
placeholder="如有预调程序信息请在此处输入....."/>
|
||||||
</group>
|
</group>
|
||||||
<group string="加工图纸">
|
<group string="加工图纸">
|
||||||
<!-- 隐藏加工图纸字段名 -->
|
<!-- 隐藏加工图纸字段名 -->
|
||||||
<field name="processing_drawing" widget="pdf_viewer" string=""/>
|
<field name="processing_drawing" widget="pdf_viewer" string=""/>
|
||||||
</group>
|
</group>
|
||||||
</page>
|
</page>
|
||||||
@@ -429,14 +433,14 @@
|
|||||||
<field name="workpiece_delivery_ids">
|
<field name="workpiece_delivery_ids">
|
||||||
<tree editable="bottom">
|
<tree editable="bottom">
|
||||||
<field name="production_id" invisible="1"/>
|
<field name="production_id" invisible="1"/>
|
||||||
<field name="sametransport_production_ids" widget="many2many_tags"/>
|
|
||||||
<field name="route_id" options="{'no_create': True}"/>
|
<field name="route_id" options="{'no_create': True}"/>
|
||||||
<field name="feeder_station_start_id" readonly="1" force_save="1"/>
|
<field name="feeder_station_start_id" readonly="1" force_save="1"/>
|
||||||
<field name="feeder_station_destination_id" readonly="1" force_save="1"/>
|
<field name="feeder_station_destination_id" readonly="1" force_save="1"/>
|
||||||
<field name="cnc_program_down_state" readonly="1"/>
|
<field name="is_cnc_program_down" readonly="1"/>
|
||||||
<field name="production_line_id"/>
|
<field name="production_line_id"/>
|
||||||
<field name="task_delivery_time" readonly="1"/>
|
<field name="task_delivery_time" readonly="1"/>
|
||||||
<field name="task_completion_time" readonly="1"/>
|
<field name="task_completion_time" readonly="1"/>
|
||||||
|
<field name="status"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</page>
|
</page>
|
||||||
@@ -532,7 +536,8 @@
|
|||||||
<field name="is_ok"/>
|
<field name="is_ok"/>
|
||||||
<field name="processing_user_id"/>
|
<field name="processing_user_id"/>
|
||||||
<field name="inspection_user_id"/>
|
<field name="inspection_user_id"/>
|
||||||
<field name="save_name" widget="CopyClipboardChar" attrs="{'invisible':[('routing_type','!=','装夹预调')]}"/>
|
<field name="save_name" widget="CopyClipboardChar"
|
||||||
|
attrs="{'invisible':[('routing_type','!=','装夹预调')]}"/>
|
||||||
<label for="material_length" string="物料尺寸"/>
|
<label for="material_length" string="物料尺寸"/>
|
||||||
<div class="o_address_format">
|
<div class="o_address_format">
|
||||||
<label for="material_length" string="长"/>
|
<label for="material_length" string="长"/>
|
||||||
@@ -583,14 +588,14 @@
|
|||||||
decoration-success="status == '已配送'"
|
decoration-success="status == '已配送'"
|
||||||
decoration-warning="status == '待下发'"
|
decoration-warning="status == '待下发'"
|
||||||
decoration-danger="status == '待配送'"/>
|
decoration-danger="status == '待配送'"/>
|
||||||
<field name="production_id" string="工件编码"/>
|
<field name="production_id"/>
|
||||||
<field name="sametransport_production_ids" widget="many2many_tags"/>
|
<field name="type"/>
|
||||||
<field name="type" />
|
<!-- <field name="delivery_num" />-->
|
||||||
<field name="production_line_id" options="{'no_create': True}"/>
|
<field name="production_line_id" options="{'no_create': True}"/>
|
||||||
<field name="route_id" options="{'no_create': True}"/>
|
<field name="route_id" options="{'no_create': True}"/>
|
||||||
<field name="feeder_station_start_id" readonly="1" force_save="1"/>
|
<field name="feeder_station_start_id" readonly="1" force_save="1"/>
|
||||||
<field name="feeder_station_destination_id" readonly="1" force_save="1"/>
|
<field name="feeder_station_destination_id" readonly="1" force_save="1"/>
|
||||||
<field name="cnc_program_down_state" readonly="1"/>
|
<field name="is_cnc_program_down" readonly="1"/>
|
||||||
<field name="task_delivery_time" readonly="1"/>
|
<field name="task_delivery_time" readonly="1"/>
|
||||||
<field name="task_completion_time" readonly="1"/>
|
<field name="task_completion_time" readonly="1"/>
|
||||||
<field name="delivery_duration" widget="float_time"/>
|
<field name="delivery_duration" widget="float_time"/>
|
||||||
@@ -603,8 +608,10 @@
|
|||||||
<field name="model">sf.workpiece.delivery</field>
|
<field name="model">sf.workpiece.delivery</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<search string="工件配送">
|
<search string="工件配送">
|
||||||
|
<!-- <filter string="待下发" name="status" domain="[('status', '=', '待下发')]"/>-->
|
||||||
|
<!-- <filter string="待配送" name="status" domain="[('status', '=', '待配送')]"/>-->
|
||||||
|
<!-- <filter string="已配送" name="status" domain="[('status', '=', '已配送')]"/>-->
|
||||||
<field name="production_id"/>
|
<field name="production_id"/>
|
||||||
<field name="sametransport_production_ids" widget="many2many_tags"/>
|
|
||||||
<field name="feeder_station_start_id"/>
|
<field name="feeder_station_start_id"/>
|
||||||
<field name="production_line_id"/>
|
<field name="production_line_id"/>
|
||||||
<field name="task_delivery_time"/>
|
<field name="task_delivery_time"/>
|
||||||
@@ -614,10 +621,8 @@
|
|||||||
<field name="status"/>
|
<field name="status"/>
|
||||||
<searchpanel>
|
<searchpanel>
|
||||||
<field name="production_line_id" icon="fa-building" enable_counters="1"/>
|
<field name="production_line_id" icon="fa-building" enable_counters="1"/>
|
||||||
|
<field name="type" icon="fa-building" enable_counters="1"/>
|
||||||
<field name="status" icon="fa-building" enable_counters="1"/>
|
<field name="status" icon="fa-building" enable_counters="1"/>
|
||||||
<field name="production_line_state" icon="fa-building" enable_counters="1"/>
|
|
||||||
<field name="cnc_program_down_state" icon="fa-building" enable_counters="1"/>
|
|
||||||
|
|
||||||
</searchpanel>
|
</searchpanel>
|
||||||
</search>
|
</search>
|
||||||
</field>
|
</field>
|
||||||
@@ -626,7 +631,10 @@
|
|||||||
<record id="sf_workpiece_delivery_act" model="ir.actions.act_window">
|
<record id="sf_workpiece_delivery_act" model="ir.actions.act_window">
|
||||||
<field name="name">工件配送</field>
|
<field name="name">工件配送</field>
|
||||||
<field name="res_model">sf.workpiece.delivery</field>
|
<field name="res_model">sf.workpiece.delivery</field>
|
||||||
|
<!-- <field name="search_view_id" ref="sf_workpiece_delivery_search"/>-->
|
||||||
|
<!-- <field name="context">{'search_default_status':'待下发'}</field>-->
|
||||||
<field name="view_mode">tree,search</field>
|
<field name="view_mode">tree,search</field>
|
||||||
|
<!-- <field name="domain">[('type','in',['上产线']),('status','in',['待下发'])]</field>-->
|
||||||
</record>
|
</record>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,31 @@
|
|||||||
<xpath expr="//field[@name='product_id']" position="after">
|
<xpath expr="//field[@name='product_id']" position="after">
|
||||||
<field name="product_specification"/>
|
<field name="product_specification"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
<xpath expr="//field[@name='qr_code_image']" position="after">
|
||||||
|
<button name="search_lot_put_rfid" string="Rfid补零" type="object" invisible="1"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="search_product_lot_view" model="ir.ui.view">
|
||||||
|
<field name="name">stock.production.lot.view</field>
|
||||||
|
<field name="model">stock.lot</field>
|
||||||
|
<field name="inherit_id" ref="stock.search_product_lot_filter"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//field[@name='product_id']" position="after">
|
||||||
|
<field name="rfid"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="view_production_lot_view_tree_tree" model="ir.ui.view">
|
||||||
|
<field name="name">stock.production.lot.tree.inherit.product.expiry</field>
|
||||||
|
<field name="model">stock.lot</field>
|
||||||
|
<field name="inherit_id" ref="stock.view_production_lot_tree"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//field[@name='create_date']" position="after">
|
||||||
|
<field name="rfid" invisible="1"/>
|
||||||
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
</odoo>
|
</odoo>
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
<field name="model">sf.workpiece.delivery.wizard</field>
|
<field name="model">sf.workpiece.delivery.wizard</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form>
|
<form>
|
||||||
<field name="delivery_id" invisible="True"/>
|
<field name="delivery_ids" invisible="True"/>
|
||||||
<field name="workorder_id" invisible="True"/>
|
<field name="workorder_id" invisible="True"/>
|
||||||
<div>是否确定配送?</div>
|
<div>是否确定配送?</div>
|
||||||
<footer>
|
<footer>
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ class WorkpieceDeliveryWizard(models.TransientModel):
|
|||||||
_name = 'sf.workpiece.delivery.wizard'
|
_name = 'sf.workpiece.delivery.wizard'
|
||||||
_description = '工件配送'
|
_description = '工件配送'
|
||||||
|
|
||||||
delivery_id = fields.Many2one('sf.workpiece.delivery', string='配送')
|
delivery_ids = fields.Many2many('sf.workpiece.delivery', string='配送')
|
||||||
workorder_id = fields.Many2one('mrp.workorder', string='工单')
|
workorder_id = fields.Many2one('mrp.workorder', string='工单')
|
||||||
|
|
||||||
def confirm(self):
|
def confirm(self):
|
||||||
if self.workorder_id:
|
if self.workorder_id:
|
||||||
self.workorder_id.workpiece_delivery_ids._delivery_avg()
|
self.workorder_id.workpiece_delivery_ids[0]._delivery_avg()
|
||||||
else:
|
else:
|
||||||
self.delivery_id._delivery_avg()
|
self.delivery_ids._delivery_avg()
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ class sf_production_plan(models.Model):
|
|||||||
# # 加工时长
|
# # 加工时长
|
||||||
# process_time = fields.Float(string='加工时长', digits=(16, 2))
|
# process_time = fields.Float(string='加工时长', digits=(16, 2))
|
||||||
# 实际加工时长、实际开始时间、实际结束时间
|
# 实际加工时长、实际开始时间、实际结束时间
|
||||||
actual_process_time = fields.Float(string='实际加工时长(分钟)', digits=(16, 2), compute='_compute_actual_process_time')
|
actual_process_time = fields.Float(string='实际加工时长(分钟)', digits=(16, 2),
|
||||||
|
compute='_compute_actual_process_time')
|
||||||
actual_start_time = fields.Datetime(string='实际开始时间')
|
actual_start_time = fields.Datetime(string='实际开始时间')
|
||||||
actual_end_time = fields.Datetime(string='实际结束时间')
|
actual_end_time = fields.Datetime(string='实际结束时间')
|
||||||
shift = fields.Char(string='班次')
|
shift = fields.Char(string='班次')
|
||||||
@@ -81,6 +82,9 @@ class sf_production_plan(models.Model):
|
|||||||
def _compute_production_line_id(self):
|
def _compute_production_line_id(self):
|
||||||
for item in self:
|
for item in self:
|
||||||
item.sudo().production_id.production_line_id = item.production_line_id.id
|
item.sudo().production_id.production_line_id = item.production_line_id.id
|
||||||
|
item.sudo().production_id.workorder_ids.filtered(
|
||||||
|
lambda b: b.routing_type == "装夹预调").workpiece_delivery_ids.write(
|
||||||
|
{'production_line_id': item.production_line_id.id})
|
||||||
# item.sudo().production_id.plan_start_processing_time = item.date_planned_start
|
# item.sudo().production_id.plan_start_processing_time = item.date_planned_start
|
||||||
|
|
||||||
# @api.onchange('state')
|
# @api.onchange('state')
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ class QualityCheck(models.Model):
|
|||||||
production_id = self.env['mrp.production'].sudo().search([('name', '=', origin)])
|
production_id = self.env['mrp.production'].sudo().search([('name', '=', origin)])
|
||||||
rfid = '' if not production_id.workorder_ids else production_id.workorder_ids[-1].rfid_code or ''
|
rfid = '' if not production_id.workorder_ids else production_id.workorder_ids[-1].rfid_code or ''
|
||||||
val = [rfid]
|
val = [rfid]
|
||||||
|
# todo 需修改
|
||||||
|
val = ['0037818516']
|
||||||
|
logging.info('获取到的工单信息%s' % val)
|
||||||
r = requests.post(crea_url, json=val, headers=headers)
|
r = requests.post(crea_url, json=val, headers=headers)
|
||||||
ret = r.json()
|
ret = r.json()
|
||||||
logging.info('_register_quality_check:%s' % ret)
|
logging.info('_register_quality_check:%s' % ret)
|
||||||
@@ -28,10 +31,10 @@ class QualityCheck(models.Model):
|
|||||||
else:
|
else:
|
||||||
raise ValidationError("零件特采发送失败")
|
raise ValidationError("零件特采发送失败")
|
||||||
|
|
||||||
def do_fail(self):
|
# def do_fail(self):
|
||||||
self.write({
|
# self.write({
|
||||||
'quality_state': 'fail',
|
# 'quality_state': 'fail',
|
||||||
'user_id': self.env.user.id,
|
# 'user_id': self.env.user.id,
|
||||||
'control_date': datetime.now()})
|
# 'control_date': datetime.now()})
|
||||||
if self.picking_id and 'WH/MO/' in self.picking_id.origin:
|
# if self.picking_id and 'WH/MO/' in self.picking_id.origin:
|
||||||
self._register_quality_check()
|
# self._register_quality_check()
|
||||||
|
|||||||
@@ -258,10 +258,6 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
|
|||||||
names = categories._search([], order=order, access_rights_uid=SUPERUSER_ID)
|
names = categories._search([], order=order, access_rights_uid=SUPERUSER_ID)
|
||||||
return categories.browse(names)
|
return categories.browse(names)
|
||||||
|
|
||||||
def knife_plan_cnc_processing(self):
|
|
||||||
# MES装刀指令接口 測試
|
|
||||||
self.env['sf.cnc.processing'].register_cnc_processing(self)
|
|
||||||
|
|
||||||
def apply_for_tooling(self):
|
def apply_for_tooling(self):
|
||||||
"""
|
"""
|
||||||
申请装刀
|
申请装刀
|
||||||
|
|||||||
@@ -63,8 +63,9 @@ class SfMaintenanceEquipment(models.Model):
|
|||||||
for data in datas:
|
for data in datas:
|
||||||
maintenance_equipment_id = self.search([('name', '=', data['DeviceId'])])
|
maintenance_equipment_id = self.search([('name', '=', data['DeviceId'])])
|
||||||
if maintenance_equipment_id:
|
if maintenance_equipment_id:
|
||||||
|
tool_id = '%s%s' % (data['ToolId'][0:1], data['ToolId'][1:].zfill(2))
|
||||||
equipment_tool_id = self.env['maintenance.equipment.tool'].sudo().search(
|
equipment_tool_id = self.env['maintenance.equipment.tool'].sudo().search(
|
||||||
[('equipment_id', '=', maintenance_equipment_id.id), ('code', '=', data['ToolId'])])
|
[('equipment_id', '=', maintenance_equipment_id.id), ('code', '=', tool_id)])
|
||||||
functional_tool_id = self.env['sf.functional.cutting.tool.entity'].sudo().search(
|
functional_tool_id = self.env['sf.functional.cutting.tool.entity'].sudo().search(
|
||||||
[('rfid', '=', data['RfidCode'])])
|
[('rfid', '=', data['RfidCode'])])
|
||||||
time = None
|
time = None
|
||||||
|
|||||||
@@ -11,23 +11,23 @@ class CNCprocessing(models.Model):
|
|||||||
_description = 'CNC加工用刀检测'
|
_description = 'CNC加工用刀检测'
|
||||||
|
|
||||||
# ==========MES装刀指令接口==========
|
# ==========MES装刀指令接口==========
|
||||||
def register_cnc_processing(self, knife_plan):
|
# def register_cnc_processing(self, knife_plan):
|
||||||
config = self.env['res.config.settings'].get_values()
|
# config = self.env['res.config.settings'].get_values()
|
||||||
# token = sf_sync_config['token'Ba F2CF5DCC-1A00-4234-9E95-65603F70CC8A]
|
# # token = sf_sync_config['token'Ba F2CF5DCC-1A00-4234-9E95-65603F70CC8A]
|
||||||
headers = {'Authorization': config['center_control_Authorization']}
|
# headers = {'Authorization': config['center_control_Authorization']}
|
||||||
crea_url = config['center_control_url'] + "/AutoDeviceApi/ToolLoadInstruct"
|
# crea_url = config['center_control_url'] + "/AutoDeviceApi/ToolLoadInstruct"
|
||||||
val = {
|
# val = {
|
||||||
'DeviceId': knife_plan.machine_table_name,
|
# 'DeviceId': knife_plan.machine_table_name,
|
||||||
'RfidCode': knife_plan.sf_functional_tool_assembly_id.rfid,
|
# 'RfidCode': knife_plan.sf_functional_tool_assembly_id.rfid.zfill(10),
|
||||||
'ToolId': int(knife_plan.cutter_spacing_code_id.code[1:])
|
# 'ToolId': int(knife_plan.cam_cutter_spacing_code[1:])
|
||||||
}
|
# }
|
||||||
r = requests.post(crea_url, json=val, headers=headers)
|
# r = requests.post(crea_url, json=val, headers=headers)
|
||||||
ret = r.json()
|
# ret = r.json()
|
||||||
logging.info('register_cnc_processing:%s' % ret)
|
# logging.info('register_cnc_processing:%s' % ret)
|
||||||
if ret['Succeed']:
|
# if ret['Succeed']:
|
||||||
return "MES装刀指令发送成功"
|
# return "MES装刀指令发送成功"
|
||||||
else:
|
# else:
|
||||||
raise ValidationError("MES装刀指令发送失败")
|
# raise ValidationError("MES装刀指令发送失败")
|
||||||
|
|
||||||
@api.model_create_multi
|
@api.model_create_multi
|
||||||
def create(self, vals):
|
def create(self, vals):
|
||||||
|
|||||||
@@ -23,13 +23,13 @@
|
|||||||
parent="menu_sf_tool_manage"
|
parent="menu_sf_tool_manage"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<menuitem
|
<!-- <menuitem-->
|
||||||
sequence="10"
|
<!-- sequence="10"-->
|
||||||
name="机床换刀申请"
|
<!-- name="机床换刀申请"-->
|
||||||
id="menu_sf_machine_table_tool_changing_apply"
|
<!-- id="menu_sf_machine_table_tool_changing_apply"-->
|
||||||
action="sf_machine_table_tool_changing_apply_view_act"
|
<!-- action="sf_machine_table_tool_changing_apply_view_act"-->
|
||||||
parent="menu_sf_function_tool_plan"
|
<!-- parent="menu_sf_function_tool_plan"-->
|
||||||
/>
|
<!-- />-->
|
||||||
<menuitem
|
<menuitem
|
||||||
sequence="20"
|
sequence="20"
|
||||||
name="CAM工单程序用刀计划"
|
name="CAM工单程序用刀计划"
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
<!-- ================功能菜单================= -->
|
<!-- ================功能菜单================= -->
|
||||||
<menuitem
|
<menuitem
|
||||||
sequence="5"
|
sequence="5"
|
||||||
name="功能"
|
name="作业单"
|
||||||
id="menu_sf_function_tool_function"
|
id="menu_sf_function_tool_function"
|
||||||
parent="menu_sf_tool_manage"
|
parent="menu_sf_tool_manage"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -12,10 +12,10 @@
|
|||||||
<button string="获取机床刀库信息" name="register_equipment_tool" type="object" class="btn-primary"/>
|
<button string="获取机床刀库信息" name="register_equipment_tool" type="object" class="btn-primary"/>
|
||||||
<field name='product_template_ids'>
|
<field name='product_template_ids'>
|
||||||
<tree editable='bottom'>
|
<tree editable='bottom'>
|
||||||
<field name="code" readonly="false"/>
|
<field name="code" readonly="1"/>
|
||||||
<field name="tool_code"/>
|
<field name="tool_code"/>
|
||||||
<field name="functional_tool_type"/>
|
<field name="functional_tool_type"/>
|
||||||
<field name="functional_tool_name_id"/>
|
<field name="functional_tool_name_id" readonly="1"/>
|
||||||
<field name="image" widget="image"/>
|
<field name="image" widget="image"/>
|
||||||
<field name="tool_groups"/>
|
<field name="tool_groups"/>
|
||||||
<field name="diameter"/>
|
<field name="diameter"/>
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
<field name="life_value_max"/>
|
<field name="life_value_max"/>
|
||||||
<field name="alarm_value"/>
|
<field name="alarm_value"/>
|
||||||
<field name="used_value"/>
|
<field name="used_value"/>
|
||||||
<field name="tool_install_time"/>
|
<field name="tool_install_time" readonly="1"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</page>
|
</page>
|
||||||
|
|||||||
@@ -321,8 +321,6 @@
|
|||||||
attrs="{'invisible': [('plan_execute_status', '!=', '0')]}" confirm="是否确认申请装刀"/>
|
attrs="{'invisible': [('plan_execute_status', '!=', '0')]}" confirm="是否确认申请装刀"/>
|
||||||
<button string="撤回" name="revocation" type="object" class="btn-primary"
|
<button string="撤回" name="revocation" type="object" class="btn-primary"
|
||||||
attrs="{'invisible': [('plan_execute_status', '!=', '1')]}" confirm="是否确认撤回装刀"/>
|
attrs="{'invisible': [('plan_execute_status', '!=', '1')]}" confirm="是否确认撤回装刀"/>
|
||||||
<button string="发起中控装刀" name="knife_plan_cnc_processing" type="object" class="btn-primary"
|
|
||||||
attrs="{'invisible': [('plan_execute_status', '!=', '2')]}"/>
|
|
||||||
<field name="plan_execute_status" widget="statusbar" statusbar_visible="0,1,2"/>
|
<field name="plan_execute_status" widget="statusbar" statusbar_visible="0,1,2"/>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
|||||||
@@ -602,7 +602,6 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
('id', '=', functional_tool_assembly.sf_cam_work_order_program_knife_plan_id.id)
|
('id', '=', functional_tool_assembly.sf_cam_work_order_program_knife_plan_id.id)
|
||||||
])
|
])
|
||||||
cam_plan.write({'plan_execute_status': '2'})
|
cam_plan.write({'plan_execute_status': '2'})
|
||||||
self.env['sf.cnc.processing'].register_cnc_processing(cam_plan)
|
|
||||||
|
|
||||||
# 关闭弹出窗口
|
# 关闭弹出窗口
|
||||||
return {'type': 'ir.actions.act_window_close'}
|
return {'type': 'ir.actions.act_window_close'}
|
||||||
|
|||||||
@@ -1006,6 +1006,14 @@ class CustomStockMove(models.Model):
|
|||||||
"""
|
"""
|
||||||
for record in self:
|
for record in self:
|
||||||
if record:
|
if record:
|
||||||
|
lot = self.env['stock.lot'].sudo().search([('rfid', '=', barcode)])
|
||||||
|
if lot:
|
||||||
|
if lot.product_id.cutting_tool_material_id:
|
||||||
|
material = lot.product_id.cutting_tool_material_id.name
|
||||||
|
else:
|
||||||
|
material = lot.product_id.fixture_material_id.name
|
||||||
|
raise ValidationError(
|
||||||
|
'该Rfid【%s】已经被序列号为【%s】的【%s】物料所占用!' % (barcode, lot.name, material))
|
||||||
if '刀柄' in (record.product_id.cutting_tool_material_id.name or '') or '托盘' in (
|
if '刀柄' in (record.product_id.cutting_tool_material_id.name or '') or '托盘' in (
|
||||||
record.product_id.fixture_material_id.name or ''):
|
record.product_id.fixture_material_id.name or ''):
|
||||||
for move_line_nosuggest_id in record.move_line_nosuggest_ids:
|
for move_line_nosuggest_id in record.move_line_nosuggest_ids:
|
||||||
|
|||||||
Reference in New Issue
Block a user