修改工单开始
This commit is contained in:
@@ -309,8 +309,7 @@ class MrpProduction(models.Model):
|
|||||||
for move in production.move_raw_ids if move.product_id):
|
for move in production.move_raw_ids if move.product_id):
|
||||||
production.state = 'progress'
|
production.state = 'progress'
|
||||||
# 新添加的状态逻辑
|
# 新添加的状态逻辑
|
||||||
if (
|
if production.state in ['to_close', 'progress', 'technology_to_confirmed'] and production.schedule_state == '未排':
|
||||||
production.state == 'to_close' or production.state == 'progress') and production.schedule_state == '未排':
|
|
||||||
if not production.workorder_ids or production.is_adjust is True:
|
if not production.workorder_ids or production.is_adjust is True:
|
||||||
production.state = 'technology_to_confirmed'
|
production.state = 'technology_to_confirmed'
|
||||||
else:
|
else:
|
||||||
@@ -324,6 +323,8 @@ class MrpProduction(models.Model):
|
|||||||
production.state = 'pending_cam'
|
production.state = 'pending_cam'
|
||||||
elif production.state == 'confirmed' and production.is_adjust is True:
|
elif production.state == 'confirmed' and production.is_adjust is True:
|
||||||
production.state = 'technology_to_confirmed'
|
production.state = 'technology_to_confirmed'
|
||||||
|
if production.state == 'confirmed' and production.schedule_state == '已排':
|
||||||
|
production.state = 'pending_cam'
|
||||||
if production.state == 'progress':
|
if production.state == 'progress':
|
||||||
if all(wo_state not in ('progress', 'done', 'rework', 'scrap') for wo_state in
|
if all(wo_state not in ('progress', 'done', 'rework', 'scrap') for wo_state in
|
||||||
production.workorder_ids.mapped('state')):
|
production.workorder_ids.mapped('state')):
|
||||||
@@ -650,8 +651,8 @@ class MrpProduction(models.Model):
|
|||||||
if self.move_finished_ids.filtered(lambda m: m.product_id == self.product_id).move_line_ids:
|
if self.move_finished_ids.filtered(lambda m: m.product_id == self.product_id).move_line_ids:
|
||||||
self.move_finished_ids.filtered(
|
self.move_finished_ids.filtered(
|
||||||
lambda m: m.product_id == self.product_id).move_line_ids.lot_id = self.lot_producing_id
|
lambda m: m.product_id == self.product_id).move_line_ids.lot_id = self.lot_producing_id
|
||||||
if self.product_id.tracking == 'serial':
|
# if self.product_id.tracking == 'serial':
|
||||||
self._set_qty_producing()
|
# self._set_qty_producing()
|
||||||
|
|
||||||
# 重载根据工序生成工单的程序:如果产品BOM中没有工序时,
|
# 重载根据工序生成工单的程序:如果产品BOM中没有工序时,
|
||||||
# 根据产品对应的模板类型中工序,去生成工单;
|
# 根据产品对应的模板类型中工序,去生成工单;
|
||||||
|
|||||||
@@ -1194,20 +1194,24 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
# 判断是否有坯料的序列号信息
|
# 判断是否有坯料的序列号信息
|
||||||
boolean = False
|
boolean = False
|
||||||
if self.production_id.move_raw_ids:
|
if self.production_id.move_raw_ids:
|
||||||
if self.production_id.move_raw_ids[0].move_line_ids:
|
# 如果是原材料,不判断序列号
|
||||||
|
if self.production_id.move_raw_ids[0].product_id.categ_type == '原材料':
|
||||||
|
boolean = True
|
||||||
|
elif self.production_id.move_raw_ids[0].move_line_ids:
|
||||||
if self.production_id.move_raw_ids[0].move_line_ids:
|
if self.production_id.move_raw_ids[0].move_line_ids:
|
||||||
if self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name:
|
if self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name:
|
||||||
boolean = True
|
boolean = True
|
||||||
if not boolean:
|
if not boolean:
|
||||||
raise UserError('制造订单【%s】缺少组件的序列号信息!' % self.production_id.name)
|
raise UserError('制造订单【%s】缺少组件的序列号信息!' % self.production_id.name)
|
||||||
self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name
|
if self.production_id.move_raw_ids[0].product_id.categ_type == '坯料':
|
||||||
|
self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name
|
||||||
# cnc校验
|
# cnc校验
|
||||||
if self.production_id.production_type == '自动化产线加工':
|
if self.production_id.production_type == '自动化产线加工':
|
||||||
cnc_workorder = self.search(
|
cnc_workorder = self.search(
|
||||||
[('production_id', '=', self.production_id.id), ('routing_type', '=', 'CNC加工')],
|
[('production_id', '=', self.production_id.id), ('routing_type', '=', 'CNC加工')],
|
||||||
limit=1, order='id asc')
|
limit=1, order='id asc')
|
||||||
if not cnc_workorder.cnc_ids:
|
# if not cnc_workorder.cnc_ids:
|
||||||
raise UserError(_('该制造订单还未下发CNC程序,请稍后再试'))
|
# raise UserError(_('该制造订单还未下发CNC程序,请稍后再试'))
|
||||||
else:
|
else:
|
||||||
if self.production_id.tool_state in ['1', '2']:
|
if self.production_id.tool_state in ['1', '2']:
|
||||||
if self.production_id.tool_state == '1':
|
if self.production_id.tool_state == '1':
|
||||||
|
|||||||
@@ -388,6 +388,7 @@ class StockRule(models.Model):
|
|||||||
i,
|
i,
|
||||||
process_parameter))
|
process_parameter))
|
||||||
productions.technology_design_ids = technology_design_values
|
productions.technology_design_ids = technology_design_values
|
||||||
|
productions.write({'state': 'technology_to_confirmed'})
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@@ -965,7 +966,7 @@ class ReStockMove(models.Model):
|
|||||||
合并制造订单的完成move单据
|
合并制造订单的完成move单据
|
||||||
"""
|
"""
|
||||||
res = super(ReStockMove, self)._merge_moves_fields()
|
res = super(ReStockMove, self)._merge_moves_fields()
|
||||||
if self[0].origin and self.picking_type_id.name in ['生产发料', '内部调拨']:
|
if self[0].origin and self.picking_type_id.name in ['生产发料', '内部调拨', '生产入库']:
|
||||||
production = self.env['mrp.production'].search([('name', '=', self[0].origin)], limit=1, order='id asc')
|
production = self.env['mrp.production'].search([('name', '=', self[0].origin)], limit=1, order='id asc')
|
||||||
productions = self.env['mrp.production'].search(
|
productions = self.env['mrp.production'].search(
|
||||||
[('origin', '=', production.origin), ('product_id', '=', production.product_id.id)])
|
[('origin', '=', production.origin), ('product_id', '=', production.product_id.id)])
|
||||||
|
|||||||
Reference in New Issue
Block a user