优化工件配送
This commit is contained in:
@@ -446,9 +446,6 @@ class Manufacturing_Connect(http.Controller):
|
|||||||
if next_workpiece:
|
if next_workpiece:
|
||||||
logging.info('next_workpiece:%s' % next_workpiece.delivery_num)
|
logging.info('next_workpiece:%s' % next_workpiece.delivery_num)
|
||||||
next_workpiece.write({'status': '待下发'})
|
next_workpiece.write({'status': '待下发'})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
res = {'Succeed': False, 'ErrorCode': 203, 'Error': '该DeviceId没有对应的已配送工件数据'}
|
res = {'Succeed': False, 'ErrorCode': 203, 'Error': '该DeviceId没有对应的已配送工件数据'}
|
||||||
else:
|
else:
|
||||||
@@ -507,7 +504,7 @@ class Manufacturing_Connect(http.Controller):
|
|||||||
if delivery_workpiece:
|
if delivery_workpiece:
|
||||||
logging.info('开始向agv下发下产线任务')
|
logging.info('开始向agv下发下产线任务')
|
||||||
delivery_workpiece._delivery_avg()
|
delivery_workpiece._delivery_avg()
|
||||||
logging.info('agv下发下产线任务已配送')
|
logging.info('agv下发下产线任务下发完成')
|
||||||
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)
|
||||||
|
|||||||
@@ -25,12 +25,11 @@ 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(',')
|
req_codes = ret['reqCode'].split(',')
|
||||||
for req_code in req_codes:
|
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]),
|
[('production_id.name', '=', req_code.rsplit('-', 1)[0]),
|
||||||
('delivery_num', '=', req_code)])
|
('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': ret['reqTime']})
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -990,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']:
|
||||||
@@ -1200,7 +1191,6 @@ class WorkPieceDelivery(models.Model):
|
|||||||
'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'}
|
||||||
@@ -1211,11 +1201,13 @@ class WorkPieceDelivery(models.Model):
|
|||||||
req_codes = ret['reqCode'].split(',')
|
req_codes = ret['reqCode'].split(',')
|
||||||
for delivery_item in self:
|
for delivery_item in self:
|
||||||
for req_code in req_codes:
|
for req_code in req_codes:
|
||||||
if delivery_item.delivery_num == req_code:
|
if delivery_item.delivery_num == req_code.strip():
|
||||||
|
logging.info('delivery_num:%s' % delivery_item.delivery_num)
|
||||||
delivery_item.write({
|
delivery_item.write({
|
||||||
'task_delivery_time': fields.Datetime.now(),
|
'task_delivery_time': fields.Datetime.now(),
|
||||||
'status': '待配送'
|
'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:
|
||||||
|
|||||||
@@ -608,6 +608,9 @@
|
|||||||
<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="feeder_station_start_id"/>
|
<field name="feeder_station_start_id"/>
|
||||||
<field name="production_line_id"/>
|
<field name="production_line_id"/>
|
||||||
@@ -618,6 +621,7 @@
|
|||||||
<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"/>
|
||||||
</searchpanel>
|
</searchpanel>
|
||||||
</search>
|
</search>
|
||||||
@@ -627,6 +631,8 @@
|
|||||||
<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>-->
|
<!-- <field name="domain">[('type','in',['上产线']),('status','in',['待下发'])]</field>-->
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
@@ -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_ids" />
|
<field name="delivery_ids" invisible="True"/>
|
||||||
<field name="workorder_id" invisible="True"/>
|
<field name="workorder_id" invisible="True"/>
|
||||||
<div>是否确定配送?</div>
|
<div>是否确定配送?</div>
|
||||||
<footer>
|
<footer>
|
||||||
|
|||||||
@@ -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')
|
||||||
|
|||||||
Reference in New Issue
Block a user