优化工件配送
This commit is contained in:
@@ -446,9 +446,6 @@ class Manufacturing_Connect(http.Controller):
|
||||
if next_workpiece:
|
||||
logging.info('next_workpiece:%s' % next_workpiece.delivery_num)
|
||||
next_workpiece.write({'status': '待下发'})
|
||||
|
||||
|
||||
|
||||
else:
|
||||
res = {'Succeed': False, 'ErrorCode': 203, 'Error': '该DeviceId没有对应的已配送工件数据'}
|
||||
else:
|
||||
@@ -507,7 +504,7 @@ class Manufacturing_Connect(http.Controller):
|
||||
if delivery_workpiece:
|
||||
logging.info('开始向agv下发下产线任务')
|
||||
delivery_workpiece._delivery_avg()
|
||||
logging.info('agv下发下产线任务已配送')
|
||||
logging.info('agv下发下产线任务下发完成')
|
||||
except Exception as e:
|
||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||
logging.info('AGVDownProduct error:%s' % e)
|
||||
|
||||
@@ -25,12 +25,11 @@ class Workpiece(http.Controller):
|
||||
if 'reqCode' in ret:
|
||||
if 'method' in ret:
|
||||
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(
|
||||
[('production_id.name', '=', ret['reqCode'].rsplit('-', 1)[0]),
|
||||
('delivery_num', '=', req_code)])
|
||||
[('production_id.name', '=', req_code.rsplit('-', 1)[0]),
|
||||
('delivery_num', '=', req_code.strip())])
|
||||
if workpiece_delivery:
|
||||
workpiece_delivery.write({'status': '已配送', 'task_completion_time': ret['reqTime']})
|
||||
else:
|
||||
|
||||
@@ -990,20 +990,11 @@ class SfWorkOrderBarcodes(models.Model):
|
||||
|
||||
def on_barcode_scanned(self, barcode):
|
||||
workorder = self.env['mrp.workorder'].browse(self.ids)
|
||||
workorder_preset = self.env['mrp.workorder'].search(
|
||||
[('routing_type', '=', '装夹预调'), ('rfid_code', '=', barcode)])
|
||||
# workorder_old = self.env['mrp.workorder'].search([('rfid_code', '=', barcode)])
|
||||
if len(workorder_preset) <= 4:
|
||||
workpiece_ids = []
|
||||
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)
|
||||
# workorder_preset = self.env['mrp.workorder'].search(
|
||||
# [('routing_type', '=', '装夹预调'), ('rfid_code', '=', barcode)])
|
||||
workorder_old = self.env['mrp.workorder'].search([('rfid_code', '=', barcode)])
|
||||
if workorder_old:
|
||||
raise UserError('该托盘已绑定【%s】制造订单,请先解除绑定!!!' % workorder_old.production_id.name)
|
||||
if workorder:
|
||||
if workorder.routing_type == '装夹预调':
|
||||
if workorder.state in ['done']:
|
||||
@@ -1200,7 +1191,6 @@ class WorkPieceDelivery(models.Model):
|
||||
'podDir': '', 'materialLot': '', 'priority': '', 'taskCode': '', 'agvCode': '', 'materialLot': '',
|
||||
'data': ''}
|
||||
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-json:%s' % res)
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
@@ -1211,11 +1201,13 @@ class WorkPieceDelivery(models.Model):
|
||||
req_codes = ret['reqCode'].split(',')
|
||||
for delivery_item in self:
|
||||
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({
|
||||
'task_delivery_time': fields.Datetime.now(),
|
||||
'status': '待配送'
|
||||
})
|
||||
delivery_item.workorder_id.write({'is_delivery': True})
|
||||
else:
|
||||
raise UserError(ret['message'])
|
||||
except Exception as e:
|
||||
|
||||
@@ -608,6 +608,9 @@
|
||||
<field name="model">sf.workpiece.delivery</field>
|
||||
<field name="arch" type="xml">
|
||||
<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="feeder_station_start_id"/>
|
||||
<field name="production_line_id"/>
|
||||
@@ -618,6 +621,7 @@
|
||||
<field name="status"/>
|
||||
<searchpanel>
|
||||
<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"/>
|
||||
</searchpanel>
|
||||
</search>
|
||||
@@ -627,8 +631,10 @@
|
||||
<record id="sf_workpiece_delivery_act" model="ir.actions.act_window">
|
||||
<field name="name">工件配送</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="domain">[('type','in',['上产线']),('status','in',['待下发'])]</field>-->
|
||||
<!-- <field name="domain">[('type','in',['上产线']),('status','in',['待下发'])]</field>-->
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<field name="model">sf.workpiece.delivery.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<field name="delivery_ids" />
|
||||
<field name="delivery_ids" invisible="True"/>
|
||||
<field name="workorder_id" invisible="True"/>
|
||||
<div>是否确定配送?</div>
|
||||
<footer>
|
||||
|
||||
@@ -56,7 +56,8 @@ class sf_production_plan(models.Model):
|
||||
# # 加工时长
|
||||
# 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_end_time = fields.Datetime(string='实际结束时间')
|
||||
shift = fields.Char(string='班次')
|
||||
@@ -81,6 +82,9 @@ class sf_production_plan(models.Model):
|
||||
def _compute_production_line_id(self):
|
||||
for item in self:
|
||||
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
|
||||
|
||||
# @api.onchange('state')
|
||||
|
||||
Reference in New Issue
Block a user