修复返工-工件配送
This commit is contained in:
@@ -486,7 +486,9 @@ class Manufacturing_Connect(http.Controller):
|
|||||||
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
|
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
|
||||||
[
|
[
|
||||||
('rfid_code', '=', rfid_code), ('type', '=', '上产线'),
|
('rfid_code', '=', rfid_code), ('type', '=', '上产线'),
|
||||||
('production_id', '=', order.production_id.id)])
|
('production_id', '=', order.production_id.id),
|
||||||
|
('workorder_id', '=', order.id),
|
||||||
|
('workorder_state', '=', 'done')])
|
||||||
if workpiece_delivery.status == '待下发':
|
if workpiece_delivery.status == '待下发':
|
||||||
workpiece_delivery.write({'is_manual_work': True})
|
workpiece_delivery.write({'is_manual_work': True})
|
||||||
else:
|
else:
|
||||||
@@ -548,7 +550,10 @@ class Manufacturing_Connect(http.Controller):
|
|||||||
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
|
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
|
||||||
[
|
[
|
||||||
('rfid_code', '=', rfid_code), ('type', '=', '下产线'),
|
('rfid_code', '=', rfid_code), ('type', '=', '下产线'),
|
||||||
('production_id', '=', order.production_id.id)])
|
('production_id', '=', order.production_id.id),
|
||||||
|
('workorder_id', '=', order.id),
|
||||||
|
('workorder_state', '=', 'done')])
|
||||||
|
if workpiece_delivery:
|
||||||
delivery_Arr.append(workpiece_delivery.id)
|
delivery_Arr.append(workpiece_delivery.id)
|
||||||
else:
|
else:
|
||||||
res = {'Succeed': False, 'ErrorCode': 204,
|
res = {'Succeed': False, 'ErrorCode': 204,
|
||||||
|
|||||||
@@ -734,7 +734,7 @@ class MrpProduction(models.Model):
|
|||||||
|
|
||||||
for production in self:
|
for production in self:
|
||||||
logging.info('qty_produced:%s' % production.qty_produced)
|
logging.info('qty_produced:%s' % production.qty_produced)
|
||||||
if production.qty_produced == '0.0':
|
if production.qty_produced == 0.0:
|
||||||
production.qty_produced = 1.0
|
production.qty_produced = 1.0
|
||||||
production.write({
|
production.write({
|
||||||
'date_finished': fields.Datetime.now(),
|
'date_finished': fields.Datetime.now(),
|
||||||
@@ -897,6 +897,7 @@ class MrpProduction(models.Model):
|
|||||||
result),
|
result),
|
||||||
'cmm_ids': panel_workorder.cmm_ids.sudo()._json_cmm_program(processing_panel, result),
|
'cmm_ids': panel_workorder.cmm_ids.sudo()._json_cmm_program(processing_panel, result),
|
||||||
'cnc_worksheet': base64.b64encode(open(panel_file_path, 'rb').read())})
|
'cnc_worksheet': base64.b64encode(open(panel_file_path, 'rb').read())})
|
||||||
|
logging.info('len(cnc_worksheet):%s' % len(panel_workorder.cnc_worksheet))
|
||||||
pre_workorder = production.workorder_ids.filtered(lambda
|
pre_workorder = production.workorder_ids.filtered(lambda
|
||||||
ap: ap.routing_type == '装夹预调' and ap.processing_panel == processing_panel and ap.state not in (
|
ap: ap.routing_type == '装夹预调' and ap.processing_panel == processing_panel and ap.state not in (
|
||||||
'rework', 'done'))
|
'rework', 'done'))
|
||||||
|
|||||||
@@ -1404,7 +1404,8 @@ 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='状态', default='待下发',
|
[('待下发', '待下发'), ('待配送', '待配送'), ('已配送', '已配送'), ('已取消', '已取消')], string='状态',
|
||||||
|
default='待下发',
|
||||||
tracking=True)
|
tracking=True)
|
||||||
is_cnc_program_down = fields.Boolean('程序是否下发', default=False, tracking=True)
|
is_cnc_program_down = fields.Boolean('程序是否下发', default=False, tracking=True)
|
||||||
is_manual_work = fields.Boolean('人工操作', default=False)
|
is_manual_work = fields.Boolean('人工操作', default=False)
|
||||||
|
|||||||
@@ -475,7 +475,8 @@
|
|||||||
<field name="status" readonly="1" widget="badge"
|
<field name="status" readonly="1" widget="badge"
|
||||||
decoration-success="status == '已配送'"
|
decoration-success="status == '已配送'"
|
||||||
decoration-warning="status == '待下发'"
|
decoration-warning="status == '待下发'"
|
||||||
decoration-danger="status == '待配送'"/>
|
decoration-danger="status == '待配送'"
|
||||||
|
decoration-info="status== '已取消'"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</page>
|
</page>
|
||||||
@@ -635,7 +636,9 @@
|
|||||||
<field name="status" widget="badge"
|
<field name="status" widget="badge"
|
||||||
decoration-success="status == '已配送'"
|
decoration-success="status == '已配送'"
|
||||||
decoration-warning="status == '待下发'"
|
decoration-warning="status == '待下发'"
|
||||||
decoration-danger="status == '待配送'"/>
|
decoration-danger="status == '待配送'"
|
||||||
|
decoration-info="status == '已取消'"
|
||||||
|
/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="production_id"/>
|
<field name="production_id"/>
|
||||||
<field name="type" readonly="1"/>
|
<field name="type" readonly="1"/>
|
||||||
@@ -731,7 +734,7 @@
|
|||||||
</field>
|
</field>
|
||||||
<field name="view_mode">tree,form</field>
|
<field name="view_mode">tree,form</field>
|
||||||
<field name="domain">
|
<field name="domain">
|
||||||
[('type','in',['上产线','下产线']),('workorder_state','=','done'),('is_manual_work','=',false)]
|
[('type','in',['上产线','下产线']),('workorder_state','in',['done','rework']),('is_manual_work','=',false)]
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,12 @@ class ReworkWizard(models.TransientModel):
|
|||||||
lambda ap: ap.processing_panel == panel.name and ap.state != 'rework')
|
lambda ap: ap.processing_panel == panel.name and ap.state != 'rework')
|
||||||
if panel_workorder:
|
if panel_workorder:
|
||||||
panel_workorder.write({'state': 'rework'})
|
panel_workorder.write({'state': 'rework'})
|
||||||
|
panel_workorder.filtered(
|
||||||
|
lambda wo: wo.routing_type == '装夹预调').workpiece_delivery_ids.filtered(
|
||||||
|
lambda wd: wd.status == '待下发').write({'status': '已取消'})
|
||||||
|
# workpiece = self.env['sf.workpiece.delivery'].search([('status', '=', '待下发'), (
|
||||||
|
# 'workorder_id', '=',
|
||||||
|
# panel_workorder.filtered(lambda wd: wd.routing_type == '装夹预调').id)])
|
||||||
product_routing_workcenter = self.env['sf.product.model.type.routing.sort'].search(
|
product_routing_workcenter = self.env['sf.product.model.type.routing.sort'].search(
|
||||||
[('product_model_type_id', '=', self.production_id.product_id.product_model_type_id.id)],
|
[('product_model_type_id', '=', self.production_id.product_id.product_model_type_id.id)],
|
||||||
order='sequence asc'
|
order='sequence asc'
|
||||||
@@ -137,7 +143,7 @@ class ReworkWizard(models.TransientModel):
|
|||||||
ret),
|
ret),
|
||||||
'cmm_ids': new_cnc_workorder.cmm_ids.sudo()._json_cmm_program(panel.name,
|
'cmm_ids': new_cnc_workorder.cmm_ids.sudo()._json_cmm_program(panel.name,
|
||||||
ret),
|
ret),
|
||||||
'cnc_worksheet': new_cnc_workorder.cnc_worksheet})
|
'cnc_worksheet': cnc_rework.cnc_worksheet})
|
||||||
new_pre_workorder = self.production_id.workorder_ids.filtered(lambda
|
new_pre_workorder = self.production_id.workorder_ids.filtered(lambda
|
||||||
p: p.routing_type == '装夹预调' and p.processing_panel == panel.name and p.state not in (
|
p: p.routing_type == '装夹预调' and p.processing_panel == panel.name and p.state not in (
|
||||||
'rework', 'done'))
|
'rework', 'done'))
|
||||||
|
|||||||
Reference in New Issue
Block a user