Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/优化工件配送

This commit is contained in:
jinling.yang
2024-04-25 15:43:30 +08:00
44 changed files with 3562 additions and 103 deletions

View File

@@ -123,6 +123,23 @@ class ResMrpWorkOrder(models.Model):
# 获取数据状态
data_state = fields.Boolean(string='获取数据状态', default=False)
# 坯料长宽高
material_length = fields.Float(string='')
material_width = fields.Float(string='')
material_height = fields.Float(string='')
# 零件图号
part_number = fields.Char(string='零件图号')
# 工序状态
process_state = fields.Selection([
('待装夹', '待装夹'),
('待检测', '待检测'),
('待加工', '待加工'),
('待解除装夹', '待解除装夹'),
('已完工', '已完工'),
], string='工序状态', default='待装夹')
# 加工图纸
processing_drawing = fields.Binary(string='加工图纸', related='production_id.part_drawing')
@api.depends('production_id')
def _compute_save_name(self):
"""
@@ -390,7 +407,10 @@ class ResMrpWorkOrder(models.Model):
work = workorder.production_id.workorder_ids
work.compensation_value_x = eval(self.material_center_point)[0]
work.compensation_value_y = eval(self.material_center_point)[1]
work.process_state = '待加工'
self.sudo().production_id.state = 'pending_processing'
workorder.button_finish()
except Exception as e:
# 重新抛出捕获到的异常信息
raise UserError(str(e))
@@ -696,6 +716,11 @@ class ResMrpWorkOrder(models.Model):
'materiel_width': self.move_raw_ids[0].product_id.width,
'materiel_height': self.move_raw_ids[0].product_id.height
})
self.write({
'material_length': self.move_raw_ids[0].product_id.length,
'material_width': self.move_raw_ids[0].product_id.width,
'material_height': self.move_raw_ids[0].product_id.height
})
self.ensure_one()
if any(not time.date_end for time in self.time_ids.filtered(lambda t: t.user_id.id == self.env.user.id)):
@@ -782,6 +807,7 @@ class ResMrpWorkOrder(models.Model):
workorder.rfid_code = None
for move_raw_id in self.production_id.move_raw_ids:
move_raw_id.quantity_done = move_raw_id.product_uom_qty
self.process_state = '已完工'
self.production_id.button_mark_done1()
# self.production_id.state = 'done'
@@ -1006,6 +1032,7 @@ class SfWorkOrderBarcodes(models.Model):
for item in workorder_rfid:
item.write({'rfid_code': barcode})
logging.info("Rfid绑定成功")
self.process_state = '待检测'
else:
raise UserError('该托盘信息不存在!!!')
# stock_move_line = self.env['stock.move.line'].search([('lot_name', '=', barcode)])