Accept Merge Request #1556: (feature/sale_order_route_pick -> develop)
Merge Request: 解决工单开始结束的问题 Created By: @胡尧 Accepted By: @胡尧 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1556?initial=true
This commit is contained in:
@@ -309,8 +309,7 @@ class MrpProduction(models.Model):
|
||||
for move in production.move_raw_ids if move.product_id):
|
||||
production.state = 'progress'
|
||||
# 新添加的状态逻辑
|
||||
if (
|
||||
production.state == 'to_close' or production.state == 'progress') and production.schedule_state == '未排':
|
||||
if production.state in ['to_close', 'progress', 'technology_to_confirmed'] and production.schedule_state == '未排':
|
||||
if not production.workorder_ids or production.is_adjust is True:
|
||||
production.state = 'technology_to_confirmed'
|
||||
else:
|
||||
@@ -321,9 +320,15 @@ class MrpProduction(models.Model):
|
||||
elif production.state == 'pending_cam' and production.schedule_state == '未排':
|
||||
production.state = 'confirmed'
|
||||
elif production.state == 'to_close' and production.schedule_state == '已排':
|
||||
production.state = 'pending_cam'
|
||||
if all(
|
||||
wo_state in ('done', 'cancel') for wo_state in production.workorder_ids.mapped('state')):
|
||||
production.state = 'done'
|
||||
else:
|
||||
production.state = 'pending_cam'
|
||||
elif production.state == 'confirmed' and production.is_adjust is True:
|
||||
production.state = 'technology_to_confirmed'
|
||||
if production.state == 'confirmed' and production.schedule_state == '已排':
|
||||
production.state = 'pending_cam'
|
||||
if production.state == 'progress':
|
||||
if all(wo_state not in ('progress', 'done', 'rework', 'scrap') for wo_state in
|
||||
production.workorder_ids.mapped('state')):
|
||||
@@ -650,8 +655,8 @@ class MrpProduction(models.Model):
|
||||
if self.move_finished_ids.filtered(lambda m: m.product_id == self.product_id).move_line_ids:
|
||||
self.move_finished_ids.filtered(
|
||||
lambda m: m.product_id == self.product_id).move_line_ids.lot_id = self.lot_producing_id
|
||||
if self.product_id.tracking == 'serial':
|
||||
self._set_qty_producing()
|
||||
# if self.product_id.tracking == 'serial':
|
||||
# self._set_qty_producing()
|
||||
|
||||
# 重载根据工序生成工单的程序:如果产品BOM中没有工序时,
|
||||
# 根据产品对应的模板类型中工序,去生成工单;
|
||||
|
||||
@@ -1201,13 +1201,19 @@ class ResMrpWorkOrder(models.Model):
|
||||
})
|
||||
|
||||
if self.sequence == 1:
|
||||
# 判断工单状态是否为等待组件
|
||||
if self.state == 'waiting':
|
||||
raise UserError('制造订单【%s】缺少组件信息!' % self.production_id.name)
|
||||
# 判断是否有坯料的序列号信息
|
||||
boolean = False
|
||||
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 == '坯料':
|
||||
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:
|
||||
boolean = True
|
||||
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:
|
||||
boolean = True
|
||||
else:
|
||||
boolean = True
|
||||
if not boolean:
|
||||
raise UserError('制造订单【%s】缺少组件的序列号信息!' % self.production_id.name)
|
||||
self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name
|
||||
@@ -1216,8 +1222,8 @@ class ResMrpWorkOrder(models.Model):
|
||||
cnc_workorder = self.search(
|
||||
[('production_id', '=', self.production_id.id), ('routing_type', '=', 'CNC加工')],
|
||||
limit=1, order='id asc')
|
||||
if not cnc_workorder.cnc_ids:
|
||||
raise UserError(_('该制造订单还未下发CNC程序,请稍后再试'))
|
||||
# if not cnc_workorder.cnc_ids:
|
||||
# raise UserError(_('该制造订单还未下发CNC程序,请稍后再试'))
|
||||
else:
|
||||
if self.production_id.tool_state in ['1', '2']:
|
||||
if self.production_id.tool_state == '1':
|
||||
|
||||
@@ -388,6 +388,7 @@ class StockRule(models.Model):
|
||||
i,
|
||||
process_parameter))
|
||||
productions.technology_design_ids = technology_design_values
|
||||
productions.write({'state': 'technology_to_confirmed'})
|
||||
return True
|
||||
|
||||
|
||||
@@ -965,7 +966,7 @@ class ReStockMove(models.Model):
|
||||
合并制造订单的完成move单据
|
||||
"""
|
||||
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')
|
||||
productions = self.env['mrp.production'].search(
|
||||
[('origin', '=', production.origin), ('product_id', '=', production.product_id.id)])
|
||||
|
||||
Reference in New Issue
Block a user