修复工单实际开始时间
This commit is contained in:
@@ -409,6 +409,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
work.compensation_value_y = eval(self.material_center_point)[1]
|
work.compensation_value_y = eval(self.material_center_point)[1]
|
||||||
work.process_state = '待加工'
|
work.process_state = '待加工'
|
||||||
self.sudo().production_id.state = 'pending_processing'
|
self.sudo().production_id.state = 'pending_processing'
|
||||||
|
self.date_finished = datetime.now()
|
||||||
workorder.button_finish()
|
workorder.button_finish()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -700,6 +701,12 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
def button_start(self):
|
def button_start(self):
|
||||||
if self.routing_type == '装夹预调' and self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name:
|
if self.routing_type == '装夹预调' and self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name:
|
||||||
self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name
|
self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name
|
||||||
|
|
||||||
|
if self.routing_type == '解除装夹':
|
||||||
|
'''
|
||||||
|
记录开始时间
|
||||||
|
'''
|
||||||
|
self.date_start = datetime.now()
|
||||||
# 外协出库单,从“正在等待”变为“就绪”状态
|
# 外协出库单,从“正在等待”变为“就绪”状态
|
||||||
if self.is_subcontract is True:
|
if self.is_subcontract is True:
|
||||||
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)])
|
||||||
@@ -771,6 +778,13 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
if not self.rfid_code:
|
if not self.rfid_code:
|
||||||
raise UserError("请扫RFID码进行绑定")
|
raise UserError("请扫RFID码进行绑定")
|
||||||
self.workpiece_delivery_ids[0].write({'status': '待下发'})
|
self.workpiece_delivery_ids[0].write({'status': '待下发'})
|
||||||
|
|
||||||
|
if self.routing_type == '解除装夹':
|
||||||
|
'''
|
||||||
|
记录结束时间
|
||||||
|
'''
|
||||||
|
self.date_finished = datetime.now()
|
||||||
|
|
||||||
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:
|
||||||
@@ -1021,6 +1035,7 @@ class SfWorkOrderBarcodes(models.Model):
|
|||||||
item.write({'rfid_code': barcode})
|
item.write({'rfid_code': barcode})
|
||||||
logging.info("Rfid绑定成功!!!")
|
logging.info("Rfid绑定成功!!!")
|
||||||
self.process_state = '待检测'
|
self.process_state = '待检测'
|
||||||
|
self.date_start = datetime.now()
|
||||||
else:
|
else:
|
||||||
raise UserError('该托盘信息不存在!!!')
|
raise UserError('该托盘信息不存在!!!')
|
||||||
# stock_move_line = self.env['stock.move.line'].search([('lot_name', '=', barcode)])
|
# stock_move_line = self.env['stock.move.line'].search([('lot_name', '=', barcode)])
|
||||||
|
|||||||
Reference in New Issue
Block a user