报废不申请重新编程时新生成的制造订单没有程序
This commit is contained in:
@@ -1416,36 +1416,36 @@ class MrpProduction(models.Model):
|
|||||||
# 'production_id': False})
|
# 'production_id': False})
|
||||||
# productions.procurement_group_id.mrp_production_ids.move_dest_ids.write(
|
# productions.procurement_group_id.mrp_production_ids.move_dest_ids.write(
|
||||||
# {'group_id': self.env['procurement.group'].search([('name', '=', sale_order.name)])})
|
# {'group_id': self.env['procurement.group'].search([('name', '=', sale_order.name)])})
|
||||||
stock_picking_remanufacture = self.env['stock.picking'].search([('origin', '=', productions.name)])
|
# stock_picking_remanufacture = self.env['stock.picking'].search([('origin', '=', productions.name)])
|
||||||
for pick in stock_picking_remanufacture:
|
# for pick in stock_picking_remanufacture:
|
||||||
if pick.name.startswith('WH/PC/') or pick.name.startswith('WH/INT/'):
|
# if pick.name.startswith('WH/PC/') or pick.name.startswith('WH/INT/'):
|
||||||
if pick.move_ids:
|
# if pick.move_ids:
|
||||||
product_type_id = pick.move_ids[0].product_id.categ_id
|
# product_type_id = pick.move_ids[0].product_id.categ_id
|
||||||
if product_type_id.name == '坯料':
|
# if product_type_id.name == '坯料':
|
||||||
location_id = self.env['stock.location'].search([('name', '=', '坯料存货区')])
|
# location_id = self.env['stock.location'].search([('name', '=', '坯料存货区')])
|
||||||
if not location_id:
|
# if not location_id:
|
||||||
logging.info(f'没有搜索到【坯料存货区】: {location_id}')
|
# logging.info(f'没有搜索到【坯料存货区】: {location_id}')
|
||||||
break
|
# break
|
||||||
if pick.picking_type_id.name == '内部调拨':
|
# if pick.picking_type_id.name == '内部调拨':
|
||||||
if pick.location_dest_id.product_type != product_type_id:
|
# if pick.location_dest_id.product_type != product_type_id:
|
||||||
pick.location_dest_id = location_id.id
|
# pick.location_dest_id = location_id.id
|
||||||
elif pick.picking_type_id.name == '生产发料':
|
# elif pick.picking_type_id.name == '生产发料':
|
||||||
if pick.location_id.product_type != product_type_id:
|
# if pick.location_id.product_type != product_type_id:
|
||||||
pick.location_id = location_id.id
|
# pick.location_id = location_id.id
|
||||||
scarp_process_parameter_workorder = self.env['mrp.workorder'].search(
|
# scarp_process_parameter_workorder = self.env['mrp.workorder'].search(
|
||||||
[('surface_technics_parameters_id', '!=', False), ('production_id', '=', self.id),
|
# [('surface_technics_parameters_id', '!=', False), ('production_id', '=', self.id),
|
||||||
('is_subcontract', '=', True)])
|
# ('is_subcontract', '=', True)])
|
||||||
if scarp_process_parameter_workorder:
|
# if scarp_process_parameter_workorder:
|
||||||
production_programming = self.env['mrp.production'].search(
|
# production_programming = self.env['mrp.production'].search(
|
||||||
[('programming_no', '=', self.programming_no), ('id', '!=', productions.id)], order='name asc')
|
# [('programming_no', '=', self.programming_no), ('id', '!=', productions.id)], order='name asc')
|
||||||
production_list = [production.name for production in production_programming]
|
# production_list = [production.name for production in production_programming]
|
||||||
purchase_orders = self.env['purchase.order'].search([('origin', 'ilike', ','.join(production_list))])
|
# purchase_orders = self.env['purchase.order'].search([('origin', 'ilike', ','.join(production_list))])
|
||||||
for purchase_item in purchase_orders.order_line:
|
# for purchase_item in purchase_orders.order_line:
|
||||||
for process_item in scarp_process_parameter_workorder:
|
# for process_item in scarp_process_parameter_workorder:
|
||||||
if purchase_item.product_id.categ_type == '表面工艺':
|
# if purchase_item.product_id.categ_type == '表面工艺':
|
||||||
if purchase_item.product_id.server_product_process_parameters_id == process_item.surface_technics_parameters_id:
|
# if purchase_item.product_id.server_product_process_parameters_id == process_item.surface_technics_parameters_id:
|
||||||
if purchase_orders.origin.find(productions.name) == -1:
|
# if purchase_orders.origin.find(productions.name) == -1:
|
||||||
purchase_orders.origin += ',' + productions.name
|
# purchase_orders.origin += ',' + productions.name
|
||||||
if item['is_reprogramming'] is False:
|
if item['is_reprogramming'] is False:
|
||||||
productions.programming_state = '已编程'
|
productions.programming_state = '已编程'
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
Y10_axis = fields.Float(default=0)
|
Y10_axis = fields.Float(default=0)
|
||||||
Z10_axis = fields.Float(default=0)
|
Z10_axis = fields.Float(default=0)
|
||||||
X_deviation_angle = fields.Integer(string="X轴偏差度", default=0)
|
X_deviation_angle = fields.Integer(string="X轴偏差度", default=0)
|
||||||
test_results = fields.Selection([("合格", "合格"), ("返工", "返工")], default='合格',
|
test_results = fields.Selection([("合格", "合格"), ("返工", "返工"), ("报废", "报废")], default='合格',
|
||||||
string="检测结果", tracking=True)
|
string="检测结果", tracking=True)
|
||||||
cnc_ids = fields.One2many("sf.cnc.processing", 'workorder_id', string="CNC加工程序")
|
cnc_ids = fields.One2many("sf.cnc.processing", 'workorder_id', string="CNC加工程序")
|
||||||
cmm_ids = fields.One2many("sf.cmm.program", 'workorder_id', string="CMM程序")
|
cmm_ids = fields.One2many("sf.cmm.program", 'workorder_id', string="CMM程序")
|
||||||
|
|||||||
@@ -91,4 +91,20 @@ class ProductionTechnologyWizard(models.TransientModel):
|
|||||||
if workorder[0].state in ['pending']:
|
if workorder[0].state in ['pending']:
|
||||||
if workorder[0].production_id.product_id.categ_id.type == '成品' and item.programming_state != '已编程':
|
if workorder[0].production_id.product_id.categ_id.type == '成品' and item.programming_state != '已编程':
|
||||||
workorder[0].state = 'waiting'
|
workorder[0].state = 'waiting'
|
||||||
|
if item.is_remanufacture and item.programming_state == '已编程':
|
||||||
|
mrp_production = self.env['mrp.production'].sudo().search(
|
||||||
|
[('remanufacture_production_id', '=', item.name)])
|
||||||
|
workorder_ids = mrp_production.workorder_ids.filtered(
|
||||||
|
lambda ap: ap.routing_type in ('装夹预调', 'CNC加工'))
|
||||||
|
for workorder_id in workorder_ids:
|
||||||
|
workorder = item.workorder_ids.filtered(lambda
|
||||||
|
ap: ap.routing_type == workorder_id.routing_type and ap.processing_panel == workorder_id.processing_panel)
|
||||||
|
if workorder:
|
||||||
|
if workorder.routing_type == '装夹预调':
|
||||||
|
workorder.write(
|
||||||
|
{'processing_drawing': workorder_id.processing_drawing})
|
||||||
|
if workorder.routing_type == 'CNC加工':
|
||||||
|
workorder.write(
|
||||||
|
{'cnc_worksheet': workorder_id.cnc_worksheet, 'cnc_ids': workorder_id.cnc_ids,
|
||||||
|
'cmm_ids': workorder_id.cmm_ids})
|
||||||
return productions
|
return productions
|
||||||
|
|||||||
@@ -53,4 +53,5 @@ class ProductionWizard(models.TransientModel):
|
|||||||
if self.is_reprogramming is True:
|
if self.is_reprogramming is True:
|
||||||
self.mrp_production_id.update_programming_state(trigger_time=datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
|
self.mrp_production_id.update_programming_state(trigger_time=datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
|
||||||
new_production = self.mrp_production_id.recreateManufacturing(ret)
|
new_production = self.mrp_production_id.recreateManufacturing(ret)
|
||||||
|
new_production.technology_design_ids = self.mrp_production_id.technology_design_ids
|
||||||
self.mrp_production_id.write({'remanufacture_production_id': new_production.id})
|
self.mrp_production_id.write({'remanufacture_production_id': new_production.id})
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class QualityCheck(models.Model):
|
|||||||
model_file = fields.Binary(related='workorder_id.glb_file', string='加工模型')
|
model_file = fields.Binary(related='workorder_id.glb_file', string='加工模型')
|
||||||
|
|
||||||
detection_report = fields.Binary(related='workorder_id.detection_report', readonly=True, string='检测报告')
|
detection_report = fields.Binary(related='workorder_id.detection_report', readonly=True, string='检测报告')
|
||||||
test_results = fields.Selection([("合格", "合格"), ("返工", "返工")], string="检测结果",
|
test_results = fields.Selection([("合格", "合格"), ("返工", "返工"), ("报废", "报废")], string="检测结果",
|
||||||
default='合格')
|
default='合格')
|
||||||
reason = fields.Selection(
|
reason = fields.Selection(
|
||||||
[("programming", "编程"), ("cutter", "刀具"), ("clamping", "装夹"), ("operate computer", "操机"),
|
[("programming", "编程"), ("cutter", "刀具"), ("clamping", "装夹"), ("operate computer", "操机"),
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class SfQualityCncTest(models.Model):
|
|||||||
('pass', '合格'),
|
('pass', '合格'),
|
||||||
('fail', '不合格')], string='判定结果')
|
('fail', '不合格')], string='判定结果')
|
||||||
number = fields.Integer('数量', default=1)
|
number = fields.Integer('数量', default=1)
|
||||||
test_results = fields.Selection([("合格", "合格"), ("返工", "返工")], string="检测结果")
|
test_results = fields.Selection([("合格", "合格"), ("返工", "返工"), ("报废", "报废")], string="检测结果")
|
||||||
reason = fields.Selection(
|
reason = fields.Selection(
|
||||||
[("programming", "编程"), ("cutter", "刀具"), ("clamping", "装夹"), ("operate computer", "操机"),
|
[("programming", "编程"), ("cutter", "刀具"), ("clamping", "装夹"), ("operate computer", "操机"),
|
||||||
("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因")
|
("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因")
|
||||||
|
|||||||
Reference in New Issue
Block a user