优化坯料的制造订单

This commit is contained in:
jinling.yang
2024-11-21 11:45:48 +08:00
parent 085d26669f
commit b415278997
4 changed files with 43 additions and 35 deletions

View File

@@ -56,6 +56,7 @@ class MrpProduction(models.Model):
production.deadline_of_delivery = False
else:
production.deadline_of_delivery = False
def _compute_default_delivery_status(self):
try:
if self.state == 'cancel':
@@ -676,7 +677,7 @@ class MrpProduction(models.Model):
'operation_id': operation.id,
'state': 'pending',
}]
if production.product_id.categ_id.type == '成品':
if production.product_id.categ_id.type in ['成品', '坯料']:
# # 根据工序设计生成工单
for route in production.technology_design_ids:
workorder_has = self.env['mrp.workorder'].search([('name', '=', route.route_id.name)])
@@ -691,16 +692,16 @@ class MrpProduction(models.Model):
self.env[
'mrp.workorder']._json_workorder_surface_process_str(
production, route, product_production_process.seller_ids[0].partner_id.id))
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)],
order='sequence asc'
)
for route_embryo in embryo_routing_workcenter:
workorder_embryo_has = self.env['mrp.workorder'].search([('name', '=', route.route_id.name)])
if not workorder_embryo_has:
workorders_values.append(
self.env['mrp.workorder'].json_workorder_str('', production, route_embryo))
# 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)],
# order='sequence asc'
# )
# for route_embryo in embryo_routing_workcenter:
# workorder_embryo_has = self.env['mrp.workorder'].search([('name', '=', route_embryo.route_id.name)])
# if not workorder_embryo_has:
# workorders_values.append(
# self.env['mrp.workorder'].json_workorder_str('', production, route_embryo))
production.workorder_ids = workorders_values
for workorder in production.workorder_ids:
workorder.duration_expected = workorder._get_duration_expected()
@@ -990,15 +991,17 @@ class MrpProduction(models.Model):
last_time = pro_plan.date_planned_start
# 预置时间
works = self.workorder_ids
for index,work in enumerate(works):
for index, work in enumerate(works):
count = type_map.get(work.routing_type)
date_planned_end = None
date_planned_start = None
if self.production_type=='自动化产线加工':
date_planned_start,date_planned_end,last_time = work.auto_production_process(last_time,count,type_map)
elif self.production_type=='':
date_planned_start,date_planned_end,last_time = work.manual_offline_process(last_time,index)
work.update_work_start_end(date_planned_start,date_planned_end)
if self.production_type == '自动化产线加工':
date_planned_start, date_planned_end, last_time = work.auto_production_process(last_time, count,
type_map)
elif self.production_type == '':
date_planned_start, date_planned_end, last_time = work.manual_offline_process(last_time, index)
work.update_work_start_end(date_planned_start, date_planned_end)
# def
def process_range_time(self):
for production in self: