1.sf的工作中心新增表面工艺字段,工序类型新增表面工艺类型,且当工序类型为表面工艺时,则显示表面工艺,其他则不显示

2.sf的工作中心新增工艺外协字段,该字段若被勾选则为表面工艺的外协加工中心
3.sf的销售订单上点击生成制造订单时在已有的成品工序后累加表面工艺工序,表面工艺的工序生成规则需根据表面工艺所对应的类别的排序来依次生成,并且工序里的工作中心的匹配规则需根据表面工艺的可选参数里的获取方式字段的值来匹配
This commit is contained in:
jinling.yang
2023-03-30 17:52:05 +08:00
parent 20d9e469f5
commit a008dbb76a
8 changed files with 79 additions and 30 deletions

View File

@@ -23,7 +23,7 @@ class MrpProduction(models.Model):
for production in self:
production.maintenance_count = len(production.request_ids)
#维修模块按钮
# 维修模块按钮
def button_maintenance_req(self):
self.ensure_one()
return {
@@ -37,7 +37,8 @@ class MrpProduction(models.Model):
},
'domain': [('production_id', '=', self.id)],
}
#打开维修模块请求
# 打开维修模块请求
def open_maintenance_request_mo(self):
self.ensure_one()
action = {
@@ -59,7 +60,8 @@ class MrpProduction(models.Model):
def action_generate_serial(self):
self.ensure_one()
iot_code = self.env['stock.lot']._get_next_serial(self.company_id, self.product_id) or self.env['ir.sequence'].next_by_code('stock.lot.serial')
iot_code = self.env['stock.lot']._get_next_serial(self.company_id, self.product_id) or self.env[
'ir.sequence'].next_by_code('stock.lot.serial')
iot_code_name = re.sub('[\u4e00-\u9fa5]', "", iot_code)
self.lot_producing_id = self.env['stock.lot'].create({
'product_id': self.product_id.id,
@@ -127,10 +129,33 @@ class MrpProduction(models.Model):
if i == processing_panel_len and route.routing_type == '解除装夹':
workorders_values.append(
self.env['mrp.workorder'].json_workorder_str(k, production, route))
# 表面工艺
# for item in production.product_id.product_model_type_id.surface_technics_routing_tmpl_ids:
# workorders_values.append(
# self.env['mrp.workorder']._json_workorder_surface_process_str(production, item))
# 表面工艺工序
# 获取表面工艺id
surface_technics_arr = []
#工序id
route_workcenter_arr = []
for item in production.product_id.product_model_type_id.surface_technics_routing_tmpl_ids:
surface_technics_arr.append(item.route_workcenter_id.surface_technics_id.id)
route_workcenter_arr.append(item.route_workcenter_id)
if surface_technics_arr:
production_process = self.env['sf.production.process.category'].search(
[('production_process_ids.id', 'in', surface_technics_arr)],
order='sequence asc'
)
if production_process:
for p in production_process:
for pitem in p.production_process_ids:
if pitem.id in surface_technics_arr:
process_parameter = self.env['sf.production.process.parameter'].search(
[('id', '=', pitem.id)])
for ritem in route_workcenter_arr:
route_production_process = self.env['mrp.routing.workcenter'].search(
[('surface_technics_id', '=', pitem.id), ('id', '=', ritem)])
if route_production_process:
workorders_values.append(
self.env['mrp.workorder']._json_workorder_surface_process_str(
production, route_production_process,
process_parameter))
elif production.product_id.categ_id.type == '胚料':
embryo_routing_workcenter = self.env['sf.embryo.model.type.routing.sort'].search(
[('embryo_model_type_id', '=', production.product_id.embryo_model_type_id.id)],
@@ -143,8 +168,7 @@ class MrpProduction(models.Model):
for workorder in production.workorder_ids:
workorder.duration_expected = workorder._get_duration_expected()
#在之前的销售单上重新生成制造订单
# 在之前的销售单上重新生成制造订单
def create_production1_values(self, production):
production_values_str = {'origin': production.origin,
'product_id': production.product_id.id,
@@ -166,7 +190,7 @@ class MrpProduction(models.Model):
'user_id': production.user_id.id}
return production_values_str
#工单排序
# 工单排序
def _reset_work_order_sequence1(self, k):
sequen = 0
for rec in self:
@@ -183,7 +207,7 @@ class MrpProduction(models.Model):
if work.name == 'CNC加工(返工)' and work.processing_panel == k:
work.sequence = sequen + 1
#在制造订单上新增工单
# 在制造订单上新增工单
def _create_workorder1(self, k):
for production in self:
if not production.bom_id or not production.product_id:
@@ -217,9 +241,9 @@ class MrpProduction(models.Model):
production.product_id.model_processing_panel = k
for k in (production.product_id.model_processing_panel.split(',')):
routingworkcenter = self.env['sf.product.model.type.routing.sort'].search(
[('product_model_type_id', '=', production.product_id.product_model_type_id.id)],
order='sequence asc'
)
[('product_model_type_id', '=', production.product_id.product_model_type_id.id)],
order='sequence asc'
)
i += 1
for route in routingworkcenter:
@@ -251,10 +275,10 @@ class MrpProduction(models.Model):
current_sequence += 1
if work.name == '获取CNC加工程序':
work.button_start()
#work.button_finish()
#work.fetchCNC()
# work.button_finish()
# work.fetchCNC()
#创建工单并进行排序
# 创建工单并进行排序
def _create_workorder(self):
res = self._create_workorder3()
self._reset_work_order_sequence()