Accept Merge Request #1177: (feature/修复返工-工件配送 -> develop)
Merge Request: 修复返工-工件配送 Created By: @杨金灵 Reviewed By: @马广威 Approved By: @马广威 Accepted By: @杨金灵 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1177?initial=true
This commit is contained in:
@@ -486,7 +486,9 @@ class Manufacturing_Connect(http.Controller):
|
||||
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
|
||||
[
|
||||
('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 == '待下发':
|
||||
workpiece_delivery.write({'is_manual_work': True})
|
||||
else:
|
||||
@@ -548,8 +550,11 @@ class Manufacturing_Connect(http.Controller):
|
||||
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
|
||||
[
|
||||
('rfid_code', '=', rfid_code), ('type', '=', '下产线'),
|
||||
('production_id', '=', order.production_id.id)])
|
||||
delivery_Arr.append(workpiece_delivery.id)
|
||||
('production_id', '=', order.production_id.id),
|
||||
('workorder_id', '=', order.id),
|
||||
('workorder_state', '=', 'done')])
|
||||
if workpiece_delivery:
|
||||
delivery_Arr.append(workpiece_delivery.id)
|
||||
else:
|
||||
res = {'Succeed': False, 'ErrorCode': 204,
|
||||
'Error': 'DeviceId为%s没有对应的已配送工件数据' % ret['DeviceId']}
|
||||
|
||||
@@ -734,7 +734,7 @@ class MrpProduction(models.Model):
|
||||
|
||||
for production in self:
|
||||
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.write({
|
||||
'date_finished': fields.Datetime.now(),
|
||||
@@ -897,6 +897,7 @@ class MrpProduction(models.Model):
|
||||
result),
|
||||
'cmm_ids': panel_workorder.cmm_ids.sudo()._json_cmm_program(processing_panel, result),
|
||||
'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
|
||||
ap: ap.routing_type == '装夹预调' and ap.processing_panel == processing_panel and ap.state not in (
|
||||
'rework', 'done'))
|
||||
|
||||
@@ -1404,7 +1404,8 @@ class WorkPieceDelivery(models.Model):
|
||||
[('上产线', '上产线'), ('下产线', '下产线'), ('运送空料架', '运送空料架')], string='类型')
|
||||
delivery_duration = fields.Float('配送时长', compute='_compute_delivery_duration')
|
||||
status = fields.Selection(
|
||||
[('待下发', '待下发'), ('待配送', '待配送'), ('已配送', '已配送')], string='状态', default='待下发',
|
||||
[('待下发', '待下发'), ('待配送', '待配送'), ('已配送', '已配送'), ('已取消', '已取消')], string='状态',
|
||||
default='待下发',
|
||||
tracking=True)
|
||||
is_cnc_program_down = fields.Boolean('程序是否下发', default=False, tracking=True)
|
||||
is_manual_work = fields.Boolean('人工操作', default=False)
|
||||
|
||||
@@ -475,7 +475,8 @@
|
||||
<field name="status" readonly="1" widget="badge"
|
||||
decoration-success="status == '已配送'"
|
||||
decoration-warning="status == '待下发'"
|
||||
decoration-danger="status == '待配送'"/>
|
||||
decoration-danger="status == '待配送'"
|
||||
decoration-info="status== '已取消'"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
@@ -635,7 +636,9 @@
|
||||
<field name="status" widget="badge"
|
||||
decoration-success="status == '已配送'"
|
||||
decoration-warning="status == '待下发'"
|
||||
decoration-danger="status == '待配送'"/>
|
||||
decoration-danger="status == '待配送'"
|
||||
decoration-info="status == '已取消'"
|
||||
/>
|
||||
<field name="name"/>
|
||||
<field name="production_id"/>
|
||||
<field name="type" readonly="1"/>
|
||||
@@ -731,7 +734,7 @@
|
||||
</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">
|
||||
[('type','in',['上产线','下产线']),('workorder_state','=','done'),('is_manual_work','=',false)]
|
||||
[('type','in',['上产线','下产线']),('workorder_state','in',['done','rework']),('is_manual_work','=',false)]
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -69,6 +69,12 @@ class ReworkWizard(models.TransientModel):
|
||||
lambda ap: ap.processing_panel == panel.name and ap.state != 'rework')
|
||||
if panel_workorder:
|
||||
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_model_type_id', '=', self.production_id.product_id.product_model_type_id.id)],
|
||||
order='sequence asc'
|
||||
@@ -137,7 +143,7 @@ class ReworkWizard(models.TransientModel):
|
||||
ret),
|
||||
'cmm_ids': new_cnc_workorder.cmm_ids.sudo()._json_cmm_program(panel.name,
|
||||
ret),
|
||||
'cnc_worksheet': new_cnc_workorder.cnc_worksheet})
|
||||
'cnc_worksheet': cnc_rework.cnc_worksheet})
|
||||
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 (
|
||||
'rework', 'done'))
|
||||
|
||||
Reference in New Issue
Block a user