优化坯料的制造订单
This commit is contained in:
@@ -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()
|
||||
@@ -995,10 +996,12 @@ class MrpProduction(models.Model):
|
||||
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)
|
||||
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:
|
||||
|
||||
@@ -794,7 +794,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
'operation_id': False,
|
||||
'name': route.name if hasattr(route, 'routing_type') else route.route_id.name,
|
||||
'processing_panel': False if hasattr(route, 'routing_type') else route.panel,
|
||||
'sequence': 1 if hasattr(route, 'routing_type') else route.sequence,
|
||||
'sequence': route.sequence,
|
||||
'quality_point_ids': False if hasattr(route, 'routing_type') else route.route_id.quality_point_ids,
|
||||
'routing_type': route.routing_type if hasattr(route, 'routing_type') else route.route_id.routing_type,
|
||||
'workcenter_id': False if hasattr(route, 'routing_type') else self.env[
|
||||
@@ -2031,6 +2031,7 @@ class CMMprogram(models.Model):
|
||||
date_planned_end = date_planned_start + duration_expected
|
||||
last_time = date_planned_end
|
||||
return date_planned_start, date_planned_end, last_time
|
||||
|
||||
def manual_offline_process(self, last_time, is_first):
|
||||
date_planned_end = None
|
||||
date_planned_start = None
|
||||
|
||||
@@ -104,6 +104,7 @@ class ProductionTechnologyReAdjustWizard(models.TransientModel):
|
||||
else:
|
||||
workorder.blocked_by_workorder_ids = blocked_by_workorder_ids[0]
|
||||
productions._reset_work_order_sequence()
|
||||
if self.production_id.product_id.categ_id.type == '成品':
|
||||
productions._reset_subcontract_pick_purchase()
|
||||
productions.get_subcontract_pick_purchase()
|
||||
productions.is_adjust = True
|
||||
@@ -111,6 +112,7 @@ class ProductionTechnologyReAdjustWizard(models.TransientModel):
|
||||
workorders = item.workorder_ids.filtered(lambda wo: wo.state not in ('cancel')).sorted(
|
||||
key=lambda a: a.sequence)
|
||||
if workorders[0].state in ['pending']:
|
||||
if workorder[0].production_id.product_id.categ_id.type == '成品':
|
||||
cnc_workorder = self.search(
|
||||
[('production_id', '=', item.id), ('routing_type', '=', 'CNC加工')],
|
||||
limit=1, order='id asc')
|
||||
|
||||
@@ -14,7 +14,7 @@ class ProductionTechnologyWizard(models.TransientModel):
|
||||
is_technology_confirm = fields.Boolean(default=False)
|
||||
|
||||
def confirm(self):
|
||||
if self.is_technology_confirm is True:
|
||||
if self.is_technology_confirm is True and self.production_id.product_id.categ_id.type == '成品':
|
||||
domain = [('origin', '=', self.origin), ('state', '=', 'technology_to_confirmed')]
|
||||
else:
|
||||
domain = [('id', '=', self.production_id.id)]
|
||||
@@ -56,12 +56,14 @@ class ProductionTechnologyWizard(models.TransientModel):
|
||||
# lambda td: td.is_auto is False and td.process_parameters_id is not False)
|
||||
# # if special:
|
||||
productions._create_workorder(False)
|
||||
if self.production_id.product_id.categ_id.type == '成品':
|
||||
productions.get_subcontract_pick_purchase()
|
||||
productions.is_adjust = False
|
||||
for item in productions:
|
||||
workorder = item.workorder_ids.filtered(lambda wo: wo.state not in ('cancel')).sorted(
|
||||
key=lambda a: a.sequence)
|
||||
if workorder[0].state in ['pending']:
|
||||
if workorder[0].production_id.product_id.categ_id.type == '成品':
|
||||
cnc_workorder = self.search(
|
||||
[('production_id', '=', item.id), ('routing_type', '=', 'CNC加工')],
|
||||
limit=1, order='id asc')
|
||||
|
||||
Reference in New Issue
Block a user