新增表面工艺外协需求

This commit is contained in:
jinling.yang
2023-03-20 17:37:23 +08:00
parent 9e5f70c988
commit 740df7c99a
7 changed files with 58 additions and 19 deletions

View File

@@ -50,6 +50,7 @@ class MrsProductionProcess(models.Model):
partner_process_ids = fields.Many2many('res.partner', 'process_ids', '加工工厂')
active = fields.Boolean('有效', default=True)
parameter_ids = fields.One2many('sf.production.process.parameter', 'process_id', string='可选参数')
gain_way = fields.Selection([("自加工", "自加工"), ("外协", "外协")], default="", string="获取方式")
class MrsProcessingTechnology(models.Model):

View File

@@ -58,8 +58,8 @@
<group>
<field name="process_encode" readonly="1"/>
<field name="name" required="1"/>
<field name="gain_way" required="1"/>
</group>
<notebook>
<page string="工序">
<field name='processing_order_ids' options="{'no_create':True}" widget="one2many">
@@ -101,6 +101,8 @@
</field>
</page>
</notebook>
<group>
<field name="remark"/>
</group>

View File

@@ -11,6 +11,9 @@ class ModelType(models.Model):
'成品工序模板')
embryo_routing_tmpl_ids = fields.One2many('sf.embryo.model.type.routing.sort', 'embryo_model_type_id',
'胚料工序模板')
surface_technics_routing_tmpl_ids = fields.One2many('sf.surface_technics.model.type.routing.sort',
'surface_technics_model_type_id',
'表面工艺工序模板')
class ProductModelTypeRoutingSort(models.Model):
@@ -26,7 +29,7 @@ class ProductModelTypeRoutingSort(models.Model):
('前置三元定位检测', '前置三元定位检测'),
('CNC加工', 'CNC加工'),
('后置三元质量检测', '后置三元质量检测'),
('解除装夹', '解除装夹'), ('切割', '切割')
('解除装夹', '解除装夹'), ('切割', '切割'), ('绑定表面工艺', '绑定表面工艺')
], string="工序类型", related='route_workcenter_id.routing_type')
workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
product_model_type_id = fields.Many2one('sf.model.type')
@@ -49,7 +52,7 @@ class EmbryoModelTypeRoutingSort(models.Model):
('前置三元定位检测', '前置三元定位检测'),
('CNC加工', 'CNC加工'),
('后置三元质量检测', '后置三元质量检测'),
('解除装夹', '解除装夹'), ('切割', '切割')
('解除装夹', '解除装夹'), ('切割', '切割'), ('绑定表面工艺', '绑定表面工艺')
], string="工序类型", related='route_workcenter_id.routing_type')
workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
embryo_model_type_id = fields.Many2one('sf.model.type')
@@ -57,3 +60,27 @@ class EmbryoModelTypeRoutingSort(models.Model):
_sql_constraints = [
('route_model_type_uniq', 'unique (route_workcenter_id,embryo_model_type_id)', '胚料工序不能重复!')
]
class SurfaceTechnicsModelTypeRoutingSort(models.Model):
_name = 'sf.surface_technics.model.type.routing.sort'
_description = '表面工艺工序排序'
sequence = fields.Integer('Sequence')
route_workcenter_id = fields.Many2one('mrp.routing.workcenter')
is_repeat = fields.Boolean('重复', related='route_workcenter_id.is_repeat')
routing_type = fields.Selection([
('获取CNC加工程序', '获取CNC加工程序'),
('装夹', '装夹'),
('前置三元定位检测', '前置三元定位检测'),
('CNC加工', 'CNC加工'),
('后置三元质量检测', '后置三元质量检测'),
('解除装夹', '解除装夹'), ('切割', '切割'), ('绑定表面工艺', '绑定表面工艺')
], string="工序类型", related='route_workcenter_id.routing_type')
workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
surface_technics_model_type_id = fields.Many2one('sf.model.type')
_sql_constraints = [
(
'route_model_type_uniq', 'unique (route_workcenter_id,surface_technics_model_type_id)', '表面工艺工序不能重复!')
]

View File

@@ -11,7 +11,8 @@ class ResMrpRoutingWorkcenter(models.Model):
('CNC加工', 'CNC加工'),
('后置三元质量检测', '后置三元质量检测'),
('解除装夹', '解除装夹'),
('切割', '切割')
('切割', '切割'),
('绑定表面工艺', '绑定表面工艺')
], string="工序类型")
is_repeat = fields.Boolean('重复', default=False)
workcenter_id = fields.Many2one('mrp.workcenter', required=False)
@@ -42,8 +43,10 @@ class ResMrpRoutingWorkcenter(models.Model):
print(item.name)
if item.machine_tool_id:
machine_tool = self.env['sf.machine_tool'].search(
[('x_axis', '>', product.bom_ids.bom_line_ids.product_id.length), ('y_axis', '>', product.bom_ids.bom_line_ids.product_id.width),
('z_axis', '>', product.bom_ids.bom_line_ids.product_id.height), ('id', '=', item.machine_tool_id.id)])
[('x_axis', '>', product.bom_ids.bom_line_ids.product_id.length),
('y_axis', '>', product.bom_ids.bom_line_ids.product_id.width),
('z_axis', '>', product.bom_ids.bom_line_ids.product_id.height),
('id', '=', item.machine_tool_id.id)])
if machine_tool:
workcenter_ids.append(item.id)
if len(workcenter_ids) == 1:

View File

@@ -29,7 +29,7 @@ class ResMrpWorkOrder(models.Model):
('CNC加工', 'CNC加工'),
('后置三元质量检测', '后置三元质量检测'),
('解除装夹', '解除装夹'),
('切割', '切割')
('切割', '切割'), ('绑定表面工艺', '绑定表面工艺')
], string="工序类型")
results = fields.Char('检测结果')
@@ -255,7 +255,6 @@ class ResMrpWorkOrder(models.Model):
else:
raise UserError('托盘码不能为空')
# 解除托盘绑定
def unbindtray(self):
tray = self.env['sf.tray'].search([("production_id", "=", self.production_id.id)])
@@ -393,7 +392,6 @@ class ResMrpWorkOrder(models.Model):
}]
return workorders_values_str
# 重写工单开始按钮方法
def button_start(self):
if self.routing_type == '装夹':
@@ -467,7 +465,6 @@ class CNCprocessing(models.Model):
workorder_id = fields.Many2one('mrp.workorder', string="工单")
button_state = fields.Boolean(string='是否已经下发')
# mrs下发编程单创建CNC加工
def cnc_processing_create(self, cnc_workorder, ret):
logging.info('ret:%s' % ret)
@@ -567,8 +564,6 @@ class SfWorkOrderBarcodes(models.Model):
else:
self.pro_code_ok = workorder.pro_code_is_ok(barcode)
# return {
# 'type': 'ir.actions.act_window',
# 'name': '工单',
@@ -577,5 +572,3 @@ class SfWorkOrderBarcodes(models.Model):
# 'context': {'active_id': self.id},
# # 'target': 'current',
# }

View File

@@ -3,6 +3,8 @@ access_sf_cnc_processing,sf_cnc_processing,model_sf_cnc_processing,base.group_us
access_sf_model_type,sf_model_type,model_sf_model_type,base.group_user,1,1,1,1
access_sf_product_model_type_routing_sort,sf_product_model_type_routing_sort,model_sf_product_model_type_routing_sort,base.group_user,1,1,1,1
access_sf_embryo_model_type_routing_sort,sf_embryo_model_type_routing_sort,model_sf_embryo_model_type_routing_sort,base.group_user,1,1,1,1
access_sf_surface_technics_model_type_routing_sort,sf_surface_technics_model_type_routing_sort,model_sf_surface_technics_model_type_routing_sort,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
3 access_sf_model_type sf_model_type model_sf_model_type base.group_user 1 1 1 1
4 access_sf_product_model_type_routing_sort sf_product_model_type_routing_sort model_sf_product_model_type_routing_sort base.group_user 1 1 1 1
5 access_sf_embryo_model_type_routing_sort sf_embryo_model_type_routing_sort model_sf_embryo_model_type_routing_sort base.group_user 1 1 1 1
6 access_sf_surface_technics_model_type_routing_sort sf_surface_technics_model_type_routing_sort model_sf_surface_technics_model_type_routing_sort base.group_user 1 1 1 1
7
8
9
10

View File

@@ -55,6 +55,17 @@
</tree>
</field>
</group>
<group>
<field name='surface_technics_routing_tmpl_ids' style="white-space: pre-wrap;">
<tree editable='bottom'>
<field name="sequence" widget="handle" string="序号"/>
<field name="route_workcenter_id" string="工序"/>
<field name="routing_type" string="类型"/>
<field name="is_repeat" string="重复"/>
<field name="workcenter_ids" string="工作中心" widget="many2many_tags"/>
</tree>
</field>
</group>
</form>
</field>
</record>