新增表面工艺外协需求
This commit is contained in:
@@ -50,6 +50,7 @@ class MrsProductionProcess(models.Model):
|
|||||||
partner_process_ids = fields.Many2many('res.partner', 'process_ids', '加工工厂')
|
partner_process_ids = fields.Many2many('res.partner', 'process_ids', '加工工厂')
|
||||||
active = fields.Boolean('有效', default=True)
|
active = fields.Boolean('有效', default=True)
|
||||||
parameter_ids = fields.One2many('sf.production.process.parameter', 'process_id', string='可选参数')
|
parameter_ids = fields.One2many('sf.production.process.parameter', 'process_id', string='可选参数')
|
||||||
|
gain_way = fields.Selection([("自加工", "自加工"), ("外协", "外协")], default="", string="获取方式")
|
||||||
|
|
||||||
|
|
||||||
class MrsProcessingTechnology(models.Model):
|
class MrsProcessingTechnology(models.Model):
|
||||||
|
|||||||
@@ -58,8 +58,8 @@
|
|||||||
<group>
|
<group>
|
||||||
<field name="process_encode" readonly="1"/>
|
<field name="process_encode" readonly="1"/>
|
||||||
<field name="name" required="1"/>
|
<field name="name" required="1"/>
|
||||||
|
<field name="gain_way" required="1"/>
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<notebook>
|
<notebook>
|
||||||
<page string="工序">
|
<page string="工序">
|
||||||
<field name='processing_order_ids' options="{'no_create':True}" widget="one2many">
|
<field name='processing_order_ids' options="{'no_create':True}" widget="one2many">
|
||||||
@@ -101,6 +101,8 @@
|
|||||||
</field>
|
</field>
|
||||||
</page>
|
</page>
|
||||||
</notebook>
|
</notebook>
|
||||||
|
|
||||||
|
|
||||||
<group>
|
<group>
|
||||||
<field name="remark"/>
|
<field name="remark"/>
|
||||||
</group>
|
</group>
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ class ModelType(models.Model):
|
|||||||
'成品工序模板')
|
'成品工序模板')
|
||||||
embryo_routing_tmpl_ids = fields.One2many('sf.embryo.model.type.routing.sort', 'embryo_model_type_id',
|
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):
|
class ProductModelTypeRoutingSort(models.Model):
|
||||||
@@ -26,7 +29,7 @@ class ProductModelTypeRoutingSort(models.Model):
|
|||||||
('前置三元定位检测', '前置三元定位检测'),
|
('前置三元定位检测', '前置三元定位检测'),
|
||||||
('CNC加工', 'CNC加工'),
|
('CNC加工', 'CNC加工'),
|
||||||
('后置三元质量检测', '后置三元质量检测'),
|
('后置三元质量检测', '后置三元质量检测'),
|
||||||
('解除装夹', '解除装夹'), ('切割', '切割')
|
('解除装夹', '解除装夹'), ('切割', '切割'), ('绑定表面工艺', '绑定表面工艺')
|
||||||
], string="工序类型", related='route_workcenter_id.routing_type')
|
], string="工序类型", related='route_workcenter_id.routing_type')
|
||||||
workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
|
workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
|
||||||
product_model_type_id = fields.Many2one('sf.model.type')
|
product_model_type_id = fields.Many2one('sf.model.type')
|
||||||
@@ -49,7 +52,7 @@ class EmbryoModelTypeRoutingSort(models.Model):
|
|||||||
('前置三元定位检测', '前置三元定位检测'),
|
('前置三元定位检测', '前置三元定位检测'),
|
||||||
('CNC加工', 'CNC加工'),
|
('CNC加工', 'CNC加工'),
|
||||||
('后置三元质量检测', '后置三元质量检测'),
|
('后置三元质量检测', '后置三元质量检测'),
|
||||||
('解除装夹', '解除装夹'), ('切割', '切割')
|
('解除装夹', '解除装夹'), ('切割', '切割'), ('绑定表面工艺', '绑定表面工艺')
|
||||||
], string="工序类型", related='route_workcenter_id.routing_type')
|
], string="工序类型", related='route_workcenter_id.routing_type')
|
||||||
workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
|
workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
|
||||||
embryo_model_type_id = fields.Many2one('sf.model.type')
|
embryo_model_type_id = fields.Many2one('sf.model.type')
|
||||||
@@ -57,3 +60,27 @@ class EmbryoModelTypeRoutingSort(models.Model):
|
|||||||
_sql_constraints = [
|
_sql_constraints = [
|
||||||
('route_model_type_uniq', 'unique (route_workcenter_id,embryo_model_type_id)', '胚料工序不能重复!')
|
('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)', '表面工艺工序不能重复!')
|
||||||
|
]
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ class ResMrpRoutingWorkcenter(models.Model):
|
|||||||
('CNC加工', 'CNC加工'),
|
('CNC加工', 'CNC加工'),
|
||||||
('后置三元质量检测', '后置三元质量检测'),
|
('后置三元质量检测', '后置三元质量检测'),
|
||||||
('解除装夹', '解除装夹'),
|
('解除装夹', '解除装夹'),
|
||||||
('切割', '切割')
|
('切割', '切割'),
|
||||||
|
('绑定表面工艺', '绑定表面工艺')
|
||||||
], string="工序类型")
|
], string="工序类型")
|
||||||
is_repeat = fields.Boolean('重复', default=False)
|
is_repeat = fields.Boolean('重复', default=False)
|
||||||
workcenter_id = fields.Many2one('mrp.workcenter', required=False)
|
workcenter_id = fields.Many2one('mrp.workcenter', required=False)
|
||||||
@@ -42,8 +43,10 @@ class ResMrpRoutingWorkcenter(models.Model):
|
|||||||
print(item.name)
|
print(item.name)
|
||||||
if item.machine_tool_id:
|
if item.machine_tool_id:
|
||||||
machine_tool = self.env['sf.machine_tool'].search(
|
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),
|
[('x_axis', '>', product.bom_ids.bom_line_ids.product_id.length),
|
||||||
('z_axis', '>', product.bom_ids.bom_line_ids.product_id.height), ('id', '=', item.machine_tool_id.id)])
|
('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:
|
if machine_tool:
|
||||||
workcenter_ids.append(item.id)
|
workcenter_ids.append(item.id)
|
||||||
if len(workcenter_ids) == 1:
|
if len(workcenter_ids) == 1:
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
('CNC加工', 'CNC加工'),
|
('CNC加工', 'CNC加工'),
|
||||||
('后置三元质量检测', '后置三元质量检测'),
|
('后置三元质量检测', '后置三元质量检测'),
|
||||||
('解除装夹', '解除装夹'),
|
('解除装夹', '解除装夹'),
|
||||||
('切割', '切割')
|
('切割', '切割'), ('绑定表面工艺', '绑定表面工艺')
|
||||||
], string="工序类型")
|
], string="工序类型")
|
||||||
results = fields.Char('检测结果')
|
results = fields.Char('检测结果')
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
except:
|
except:
|
||||||
raise UserError("参数计算有误")
|
raise UserError("参数计算有误")
|
||||||
|
|
||||||
#拼接工单对象属性值
|
# 拼接工单对象属性值
|
||||||
def json_workorder_str(self, k, production, route):
|
def json_workorder_str(self, k, production, route):
|
||||||
workorders_values_str = [0, '', {
|
workorders_values_str = [0, '', {
|
||||||
'product_uom_id': production.product_uom_id.id,
|
'product_uom_id': production.product_uom_id.id,
|
||||||
@@ -203,9 +203,9 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
else:
|
else:
|
||||||
raise UserError('托盘码不能为空')
|
raise UserError('托盘码不能为空')
|
||||||
|
|
||||||
#验证坯料序列号是否正确
|
# 验证坯料序列号是否正确
|
||||||
def pro_code_is_ok(self,barcode):
|
def pro_code_is_ok(self, barcode):
|
||||||
if barcode!=False:
|
if barcode != False:
|
||||||
if barcode != self.pro_code:
|
if barcode != self.pro_code:
|
||||||
raise UserError('坯料序列号错误')
|
raise UserError('坯料序列号错误')
|
||||||
return False
|
return False
|
||||||
@@ -216,7 +216,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
|
|
||||||
pro_code_ok = fields.Boolean(default=False)
|
pro_code_ok = fields.Boolean(default=False)
|
||||||
|
|
||||||
#托盘扫码绑定
|
# 托盘扫码绑定
|
||||||
def gettray_auto(self, barcode):
|
def gettray_auto(self, barcode):
|
||||||
if barcode != False:
|
if barcode != False:
|
||||||
values = self.env['sf.tray'].search([("code", "=", barcode)])
|
values = self.env['sf.tray'].search([("code", "=", barcode)])
|
||||||
@@ -255,7 +255,6 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
else:
|
else:
|
||||||
raise UserError('托盘码不能为空')
|
raise UserError('托盘码不能为空')
|
||||||
|
|
||||||
|
|
||||||
# 解除托盘绑定
|
# 解除托盘绑定
|
||||||
def unbindtray(self):
|
def unbindtray(self):
|
||||||
tray = self.env['sf.tray'].search([("production_id", "=", self.production_id.id)])
|
tray = self.env['sf.tray'].search([("production_id", "=", self.production_id.id)])
|
||||||
@@ -393,7 +392,6 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
}]
|
}]
|
||||||
return workorders_values_str
|
return workorders_values_str
|
||||||
|
|
||||||
|
|
||||||
# 重写工单开始按钮方法
|
# 重写工单开始按钮方法
|
||||||
def button_start(self):
|
def button_start(self):
|
||||||
if self.routing_type == '装夹':
|
if self.routing_type == '装夹':
|
||||||
@@ -467,7 +465,6 @@ class CNCprocessing(models.Model):
|
|||||||
workorder_id = fields.Many2one('mrp.workorder', string="工单")
|
workorder_id = fields.Many2one('mrp.workorder', string="工单")
|
||||||
button_state = fields.Boolean(string='是否已经下发')
|
button_state = fields.Boolean(string='是否已经下发')
|
||||||
|
|
||||||
|
|
||||||
# mrs下发编程单创建CNC加工
|
# mrs下发编程单创建CNC加工
|
||||||
def cnc_processing_create(self, cnc_workorder, ret):
|
def cnc_processing_create(self, cnc_workorder, ret):
|
||||||
logging.info('ret:%s' % ret)
|
logging.info('ret:%s' % ret)
|
||||||
@@ -567,8 +564,6 @@ class SfWorkOrderBarcodes(models.Model):
|
|||||||
else:
|
else:
|
||||||
self.pro_code_ok = workorder.pro_code_is_ok(barcode)
|
self.pro_code_ok = workorder.pro_code_is_ok(barcode)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# return {
|
# return {
|
||||||
# 'type': 'ir.actions.act_window',
|
# 'type': 'ir.actions.act_window',
|
||||||
# 'name': '工单',
|
# 'name': '工单',
|
||||||
@@ -577,5 +572,3 @@ class SfWorkOrderBarcodes(models.Model):
|
|||||||
# 'context': {'active_id': self.id},
|
# 'context': {'active_id': self.id},
|
||||||
# # 'target': 'current',
|
# # 'target': 'current',
|
||||||
# }
|
# }
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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_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_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_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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
|
@@ -55,6 +55,17 @@
|
|||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</group>
|
</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>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
Reference in New Issue
Block a user