Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/新增工件装夹预调工单任务
# Conflicts: # sf_manufacturing/models/mrp_workorder.py
This commit is contained in:
@@ -50,6 +50,18 @@ class MrpProduction(models.Model):
|
||||
work_state = fields.Char('业务状态')
|
||||
programming_state = fields.Char('编程状态')
|
||||
glb_file = fields.Binary("glb模型文件")
|
||||
production_line_id = fields.Many2one('sf.production.line', string='生产线', compute='_compute_production_line_id',
|
||||
store=True)
|
||||
plan_start_processing_time = fields.Datetime('计划开始加工时间')
|
||||
|
||||
@api.depends('name')
|
||||
def _compute_production_line_id(self):
|
||||
for production in self:
|
||||
if production.name:
|
||||
plan_production = self.env['sf.production.plan'].search([('production_id', '=', self.id)])
|
||||
if plan_production:
|
||||
production.production_line_id = plan_production.production_id.id
|
||||
production.plan_start_processing_time = plan_production.date_planned_start
|
||||
|
||||
@api.depends(
|
||||
'move_raw_ids.state', 'move_raw_ids.quantity_done', 'move_finished_ids.state',
|
||||
@@ -511,7 +523,7 @@ class MrpProduction(models.Model):
|
||||
|
||||
# if completed products make other confirmed/partially_available moves available, assign them
|
||||
done_move_finished_ids = (
|
||||
productions_to_backorder.move_finished_ids | productions_not_to_backorder.move_finished_ids).filtered(
|
||||
productions_to_backorder.move_finished_ids | productions_not_to_backorder.move_finished_ids).filtered(
|
||||
lambda m: m.state == 'done')
|
||||
done_move_finished_ids._trigger_assign()
|
||||
|
||||
|
||||
@@ -131,6 +131,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
maximum_clamping_force = fields.Char(string="最大夹持力[n]")
|
||||
production_line = fields.Char(string="生产线")
|
||||
preset_program_information = fields.Char(string="预调程序信息")
|
||||
workpiece_delivery_id = fields.One2many('sf.workpiece.delivery', 'workorder_id', '工件配送')
|
||||
|
||||
@api.onchange('is_ok')
|
||||
def _onchange_inspection_user_id(self):
|
||||
@@ -582,11 +583,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
for move_raw_id in self.production_id.move_raw_ids:
|
||||
move_raw_id.quantity_done = move_raw_id.product_uom_qty
|
||||
self.production_id.button_mark_done1()
|
||||
# self.production_id.state = 'done'
|
||||
|
||||
|
||||
|
||||
|
||||
# self.production_id.state = 'done'
|
||||
|
||||
|
||||
class CNCprocessing(models.Model):
|
||||
@@ -774,14 +771,33 @@ class SfWorkOrderBarcodes(models.Model):
|
||||
# self.pro_code_ok = workorder.pro_code_is_ok(barcode)
|
||||
|
||||
|
||||
class WorkPieceDispatch(models.Model):
|
||||
_name = "mrp.workpiece.dispatch"
|
||||
class WorkPieceDelivery(models.Model):
|
||||
_name = "sf.workpiece.delivery"
|
||||
_description = '工件配送'
|
||||
|
||||
workorder_id = fields.Many2one('mrp.workorder')
|
||||
workorder_code = fields.Char(related='workorder_id.','任务编号(工件编码)')
|
||||
|
||||
|
||||
|
||||
workorder_id = fields.Many2one('mrp.workorder', string='工单',
|
||||
domain=[('name', 'in', ('装夹', '解除装夹'))])
|
||||
name = fields.Char(related='workorder_id.production_id.name', string='工件编码/任务编码', store=True)
|
||||
plan_start_processing_time = fields.Datetime('计划开始加工时间')
|
||||
workpiece_code = fields.Char('同运工件编码')
|
||||
feeder_station_start = fields.Char('起点接驳站')
|
||||
feeder_station_destination = fields.Char('目的接驳站')
|
||||
production_line_id = fields.Many2one('sf.production.line', string='目标生产线')
|
||||
task_delivery_time = fields.Datetime('任务下发时间')
|
||||
task_completion_time = fields.Datetime('任务完成时间')
|
||||
delivery_time = fields.Char('配送时长', compute='_compute_delivery_time')
|
||||
status = fields.Selection([('待下发', '待下发'), ('待配送', '待配送'), ('已配送', '已配送')], string='状态',
|
||||
default='待下发')
|
||||
|
||||
@api.depends('task_delivery_time', 'task_completion_time')
|
||||
def _compute_delivery_time(self):
|
||||
for obj in self:
|
||||
if obj.task_delivery_time and obj.task_completion_time:
|
||||
delivery_duration = obj.task_completion_time - obj.task_delivery_time
|
||||
hours, seconds = divmod(delivery_duration.total_seconds(), 3600)
|
||||
minutes, _ = divmod(seconds, 60)
|
||||
delivery_time_str = "{:.0f}时 {:.0f}分".format(hours, minutes)
|
||||
|
||||
obj.delivery_time = delivery_time_str
|
||||
else:
|
||||
obj.delivery_time = ''
|
||||
|
||||
@@ -6,8 +6,8 @@ import os
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.modules import get_resource_path
|
||||
from OCC.Extend.DataExchange import read_step_file
|
||||
from OCC.Extend.DataExchange import write_stl_file
|
||||
# from OCC.Extend.DataExchange import read_step_file
|
||||
# from OCC.Extend.DataExchange import write_stl_file
|
||||
|
||||
|
||||
class ResProductMo(models.Model):
|
||||
@@ -874,6 +874,20 @@ class SfMaintenanceEquipmentTool(models.Model):
|
||||
code = fields.Char('机床刀位号')
|
||||
name = fields.Char('刀位号', compute='_compute_name')
|
||||
|
||||
# 待删除字段
|
||||
product_template_id = fields.Many2one('product.template', string='功能刀具名称',
|
||||
domain="[('categ_type', '=', '刀具')]")
|
||||
image_1920 = fields.Binary('图片', related='product_template_id.image_1920')
|
||||
categ_type = fields.Char(string='功能刀具类型')
|
||||
diameter = fields.Char('直径')
|
||||
precision = fields.Char('粗\中\精')
|
||||
tool_code = fields.Char('功能刀具编码')
|
||||
hilt_name = fields.Char('刀柄名称')
|
||||
hilt_code = fields.Char('刀柄编码')
|
||||
life_value_max = fields.Char('最大寿命值')
|
||||
alarm_value = fields.Char('报警值')
|
||||
used_value = fields.Char('已使用值')
|
||||
|
||||
@api.depends('code')
|
||||
def _compute_name(self):
|
||||
for record in self:
|
||||
|
||||
Reference in New Issue
Block a user