修改排程单的问题
This commit is contained in:
@@ -1378,7 +1378,8 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
# workorder.rfid_code_old = rfid_code
|
# workorder.rfid_code_old = rfid_code
|
||||||
# workorder.rfid_code = False
|
# workorder.rfid_code = False
|
||||||
logging.info('workorder.rfid_code:%s' % workorder.rfid_code)
|
logging.info('workorder.rfid_code:%s' % workorder.rfid_code)
|
||||||
if is_production_id is True and record.routing_type in ['解除装夹', '表面工艺', '切割']:
|
# if is_production_id is True and record.routing_type in ['解除装夹', '表面工艺', '切割']:
|
||||||
|
if is_production_id is True:
|
||||||
logging.info('product_qty:%s' % record.production_id.product_qty)
|
logging.info('product_qty:%s' % record.production_id.product_qty)
|
||||||
for move_raw_id in record.production_id.move_raw_ids:
|
for move_raw_id in record.production_id.move_raw_ids:
|
||||||
move_raw_id.quantity_done = move_raw_id.product_uom_qty
|
move_raw_id.quantity_done = move_raw_id.product_uom_qty
|
||||||
|
|||||||
@@ -231,6 +231,8 @@ class sf_production_plan(models.Model):
|
|||||||
if not record.production_line_id:
|
if not record.production_line_id:
|
||||||
raise ValidationError("未选择生产线")
|
raise ValidationError("未选择生产线")
|
||||||
else:
|
else:
|
||||||
|
# 自动化产线加工
|
||||||
|
if record.production_id.production_type == '自动化产线加工':
|
||||||
if record.production_id.workorder_ids:
|
if record.production_id.workorder_ids:
|
||||||
last_cnc_start = record.date_planned_start if record.date_planned_start else datetime.now()
|
last_cnc_start = record.date_planned_start if record.date_planned_start else datetime.now()
|
||||||
for item in record.production_id.workorder_ids:
|
for item in record.production_id.workorder_ids:
|
||||||
@@ -251,6 +253,20 @@ class sf_production_plan(models.Model):
|
|||||||
# 计算下一个cnc工单的开始时间
|
# 计算下一个cnc工单的开始时间
|
||||||
last_cnc_start = workorder_list[-1].date_planned_finished + timedelta(minutes=pre_duration)
|
last_cnc_start = workorder_list[-1].date_planned_finished + timedelta(minutes=pre_duration)
|
||||||
# 没有工单也能排程
|
# 没有工单也能排程
|
||||||
|
else:
|
||||||
|
# 人工线下加工只排第一张工单
|
||||||
|
if record.production_id.workorder_ids:
|
||||||
|
item = record.production_id.workorder_ids[0]
|
||||||
|
last_wo_start = record.date_planned_start if record.date_planned_start else datetime.now()
|
||||||
|
routing_workcenter = record.env['mrp.routing.workcenter'].sudo().search(
|
||||||
|
[('name', '=', item.routing_type)], limit=1)
|
||||||
|
item.date_planned_start = datetime.now() - timedelta(days=100)
|
||||||
|
item.date_planned_finished = last_wo_start + timedelta(
|
||||||
|
minutes=routing_workcenter.time_cycle)
|
||||||
|
item.date_planned_start = last_wo_start
|
||||||
|
record.sudo().production_id.plan_start_processing_time = item.date_planned_start
|
||||||
|
item.duration_expected = routing_workcenter.time_cycle
|
||||||
|
record.calculate_plan_time(item, item)
|
||||||
record.state = 'done'
|
record.state = 'done'
|
||||||
# record.production_id.schedule_state = '已排'
|
# record.production_id.schedule_state = '已排'
|
||||||
record.sudo().production_id.schedule_state = '已排'
|
record.sudo().production_id.schedule_state = '已排'
|
||||||
|
|||||||
Reference in New Issue
Block a user