1.修复材料型号同步报验证问题2.优化工单的工件派送3.计划里新增生产线的优化
This commit is contained in:
@@ -61,7 +61,7 @@ class MrsMaterialModel(models.Model):
|
||||
supplier_ids = fields.One2many('sf.supplier.sort', 'materials_model_id', string='供应商')
|
||||
active = fields.Boolean('有效', default=True)
|
||||
|
||||
@api.constrains('gain_way', 'supplier_ids')
|
||||
@api.constrains('supplier_ids')
|
||||
def _check_gain_way(self):
|
||||
if not self.gain_way:
|
||||
raise UserError("请输入获取方式")
|
||||
|
||||
@@ -50,6 +50,8 @@ 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='生产线')
|
||||
plan_start_processing_time = fields.Datetime('计划开始加工时间')
|
||||
|
||||
|
||||
@api.depends(
|
||||
|
||||
@@ -131,7 +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', '工件配送')
|
||||
workpiece_delivery_ids = fields.One2many('sf.workpiece.delivery', 'workorder_id', '工件配送')
|
||||
|
||||
@api.onchange('is_ok')
|
||||
def _onchange_inspection_user_id(self):
|
||||
@@ -196,9 +196,24 @@ 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]
|
||||
workorder.button_finish()
|
||||
|
||||
except:
|
||||
raise UserError("参数计算有误")
|
||||
|
||||
# def button_workpiece_delivery(self):
|
||||
# if self.routing_type == '装夹预调':
|
||||
# if not self.workpiece_delivery_ids:
|
||||
# raise UserError('请添加【工件配送】信息')
|
||||
# else:
|
||||
# for item in self.workpiece_delivery_ids:
|
||||
# if not item.feeder_station_start:
|
||||
# raise UserError('【工件配送】明细中请输入起点接驳站')
|
||||
# if not item.workpiece_code:
|
||||
# raise UserError('请对【同运工件】进行扫描')
|
||||
# else:
|
||||
# workpiece_code
|
||||
|
||||
# 拼接工单对象属性值
|
||||
def json_workorder_str(self, k, production, route):
|
||||
# 计算预计时长duration_expected
|
||||
@@ -241,7 +256,9 @@ class ResMrpWorkOrder(models.Model):
|
||||
'date_planned_finished': False,
|
||||
'duration_expected': duration_expected,
|
||||
'duration': 0,
|
||||
|
||||
'workpiece_delivery_ids': False if not route.routing_type == '装夹预调' else self.env[
|
||||
'sf.workpiece.delivery'].create(
|
||||
{'production_id': production.id})
|
||||
}]
|
||||
return workorders_values_str
|
||||
|
||||
@@ -731,7 +748,7 @@ class SfWorkOrderBarcodes(models.Model):
|
||||
if workorder:
|
||||
if workorder.routing_type == '装夹预调':
|
||||
stock_move_line = self.env['stock.move.line'].search([('lot_name', '=', barcode)])
|
||||
if stock_move_line:
|
||||
if stock_move_line.product_id.categ_type == '夹具':
|
||||
workorder.write({
|
||||
'tray_serial_number': stock_move_line.lot_name,
|
||||
'tray_product_id': stock_move_line.product_id.id,
|
||||
@@ -740,26 +757,36 @@ class SfWorkOrderBarcodes(models.Model):
|
||||
'tray_model_id': stock_move_line.product_id.fixture_model_id.id
|
||||
})
|
||||
workorder.button_start()
|
||||
# elif stock_move_line.product_id.categ_type == '坯料':
|
||||
# if stock_move_line.production_id.production_line_id.id == workorder.production_id.production_line_id.id
|
||||
# workorder.
|
||||
|
||||
|
||||
class WorkPieceDelivery(models.Model):
|
||||
_name = "sf.workpiece.delivery"
|
||||
_description = '工件配送'
|
||||
|
||||
workorder_id = fields.Many2one('mrp.workorder', string='工单',
|
||||
domain=[('name', 'in', ('装夹', '解除装夹'))])
|
||||
production_code = fields.Char(related='workorder_id.production_id.name', string='工件编码/任务编码', store=True)
|
||||
plan_start_processing_time = fields.Datetime('计划开始加工时间')
|
||||
workorder_id = fields.Many2one('mrp.workorder', string='工单', readonly=True)
|
||||
production_id = fields.Many2one('mrp.production', string='制造订单', readonly=True)
|
||||
production_line_id = fields.Many2one('sf.production.line', compute='_compute_production_line_id',
|
||||
string='目标生产线', readonly=True,
|
||||
store=True)
|
||||
plan_start_processing_time = fields.Datetime('计划开始加工时间', readonly=True)
|
||||
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('production_id.production_line_id')
|
||||
def _compute_production_line_id(self):
|
||||
if self.production_id.production_line_id:
|
||||
self.production_line_id = self.production_id.production_line_id.id
|
||||
self.plan_start_processing_time = self.production_id.plan_start_processing_time
|
||||
|
||||
@api.depends('task_delivery_time', 'task_completion_time')
|
||||
def _compute_delivery_time(self):
|
||||
for obj in self:
|
||||
|
||||
@@ -69,6 +69,8 @@
|
||||
<field name="programming_no" readonly="1"/>
|
||||
<field name="work_state" invisible="1"/>
|
||||
<field name="programming_state" readonly="1"/>
|
||||
<field name="production_line_id" readonly="1"/>
|
||||
<field name="plan_start_processing_time" readonly="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//header//button[@name='action_cancel']" position="replace">
|
||||
<button name="action_cancel" type="object" string="取消" data-hotkey="z"
|
||||
|
||||
@@ -401,9 +401,9 @@
|
||||
</group>
|
||||
</page>
|
||||
<page string="工件配送" attrs='{"invisible": [("routing_type","!=","装夹预调")]}'>
|
||||
<field name="workpiece_delivery_id" widget="one2many">
|
||||
<tree>
|
||||
<field name="production_code" invisible="1"/>
|
||||
<field name="workpiece_delivery_ids" widget="one2many">
|
||||
<tree editable="bottom">
|
||||
<field name="production_id" invisible="1"/>
|
||||
<field name="workpiece_code"/>
|
||||
<field name="feeder_station_start"/>
|
||||
<field name="feeder_station_destination"/>
|
||||
@@ -514,7 +514,7 @@
|
||||
<field name="model">sf.workpiece.delivery</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="工件配送" editable="bottom">
|
||||
<field name="production_code"/>
|
||||
<field name="production_id"/>
|
||||
<field name="workpiece_code"/>
|
||||
<field name="feeder_station_start"/>
|
||||
<field name="production_line_id"/>
|
||||
@@ -532,7 +532,7 @@
|
||||
<field name="model">sf.workpiece.delivery</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="工件配送">
|
||||
<field name="production_code"/>
|
||||
<field name="production_id"/>
|
||||
<field name="workpiece_code"/>
|
||||
<field name="feeder_station_start"/>
|
||||
<field name="production_line_id"/>
|
||||
|
||||
@@ -67,6 +67,12 @@ class sf_production_plan(models.Model):
|
||||
sequence = fields.Integer(string='序号', copy=False, readonly=True, index=True)
|
||||
current_operation_name = fields.Char(string='当前工序名称', size=64, default='生产计划')
|
||||
|
||||
@api.onchange('production_line_id')
|
||||
def _compute_production_line_id(self):
|
||||
for item in self:
|
||||
item.production_id.production_line_id = item.production_line_id.id
|
||||
item.production_id.plan_start_processing_time = item.date_planned_start
|
||||
|
||||
@api.onchange('state')
|
||||
def _onchange_state(self):
|
||||
if self.state == 'finished':
|
||||
@@ -324,23 +330,6 @@ class sf_production_plan(models.Model):
|
||||
raise UserError(e)
|
||||
|
||||
|
||||
class ReMrpProduction(models.Model):
|
||||
_inherit = 'mrp.production'
|
||||
|
||||
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', '=', production.id)])
|
||||
if plan_production:
|
||||
production.production_line_id = plan_production.production_line_id
|
||||
production.plan_start_processing_time = plan_production.date_planned_start
|
||||
|
||||
|
||||
# 机台作业计划
|
||||
class machine_work_schedule(models.Model):
|
||||
_name = 'sf.machine.schedule'
|
||||
|
||||
@@ -301,16 +301,5 @@
|
||||
parent="sf_production_plan_menu"
|
||||
/>
|
||||
|
||||
<record id="plan_mrp_production_form_view_inherit_sf" model="ir.ui.view">
|
||||
<field name="name">plan.mrp.production.form.inherit.sf</field>
|
||||
<field name="model">mrp.production</field>
|
||||
<field name="inherit_id" ref="sf_manufacturing.custom_mrp_production_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='programming_state']" position="after">
|
||||
<field name="production_line_id" readonly="1"/>
|
||||
<field name="plan_start_processing_time" readonly="1"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user