diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index f0c006ea..fd9e3e2e 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -184,8 +184,8 @@ class MrpProduction(models.Model): production.workorder_ids): production.state = 'rework' # 如果制造订单的功能刀具为【无效刀】则制造订单状态改为返工 - if production.tool_state == '2': - production.state = 'rework' + # if production.tool_state == '2': + # production.state = 'rework' def action_check(self): """ diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index e60d56c2..a7142ea4 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -827,14 +827,18 @@ class ResMrpWorkOrder(models.Model): ('sequence', '=', workorder.sequence - 1), ('state', 'in', ['done'])]) if unclamp_workorder: - workorder.state = 'ready' + if workorder.is_subcontract is False: + workorder.state = 'ready' + # else: + + # else: # if workorder.state not in ['cancel', 'rework']: # workorder.state = 'rework' - if workorder.production_id.state == 'pending_cam': - if workorder.routing_type == '装夹预调' and workorder.state in ['ready', 'waiting']: - if workorder.production_id.tool_state in ['1', '2']: - workorder.state = 'waiting' + # if workorder.production_id.state == 'pending_cam': + # if workorder.routing_type == '装夹预调' and workorder.state in ['ready', 'waiting']: + # if workorder.production_id.tool_state in ['1', '2']: + # workorder.state = 'waiting' logging.info('工序:%s' % workorder.sequence) logging.info('工单最终状态:%s' % workorder.state) diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index fc0b7814..f6d35b54 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -272,44 +272,44 @@ class StockRule(models.Model): product_id_to_production_names[product_id] = [production.name for production in all_production] for production_item in productions: if production_item.product_id.id in product_id_to_production_names: - sorted_process_parameters = sorted(production_item.product_id.model_process_parameters_ids, key=lambda w: w.id) - consecutive_process_parameters = [] - m = 0 - for i in range(len(sorted_workorders) - 1): - if m == 0: - is_pick = False - if sorted_process_parameters[i].supplier_id.id == sorted_process_parameters[i + 1].supplier_id.id : - if sorted_process_parameters[i] not in consecutive_process_parameters: - consecutive_process_parameters.append(sorted_process_parameters[i]) - consecutive_process_parameters.append(sorted_process_parameters[i + 1]) - m += 1 - continue - else: - if m == len(consecutive_process_parameters) - 1 and m != 0: - self.env['stock.picking'].create_outcontract_picking(consecutive_process_parameters, - production_item) - if sorted_process_parameters[i] in consecutive_workorders: - is_pick = True - consecutive_process_parameters = [] - m = 0 - # 当前面的连续工序生成对应的采购单再生成当前工序的外协采购单 - if is_pick is False: - self.env['stock.picking'].create_outcontract_picking(sorted_workorders[i], - production_item) - if m == len(consecutive_process_parameters) - 1 and m != 0: - self.env['stock.picking'].create_outcontract_picking(consecutive_process_parameters, - production_item) - if sorted_process_parameters[i] in consecutive_process_parameters: - is_pick = True - consecutive_process_parameters = [] - m = 0 - if m == len(consecutive_process_parameters) - 1 and m != 0: - self.env['stock.picking'].create_outcontract_picking(consecutive_process_parameters, production_item) - if is_pick is False and m == 0: - if len(sorted_process_parameters) == 1: - self.env['stock.picking'].create_outcontract_picking(sorted_process_parameters, production_item) - else: - self.env['stock.picking'].create_outcontract_picking(sorted_process_parameters[i], production_item) + # sorted_process_parameters = sorted(production_item.product_id.model_process_parameters_ids, key=lambda w: w.id) + # consecutive_process_parameters = [] + # m = 0 + # for i in range(len(sorted_process_parameters) - 1): + # if m == 0: + # is_pick = False + # if sorted_process_parameters[i].supplier_id.id == sorted_process_parameters[i + 1].supplier_id.id and : + # if sorted_process_parameters[i] not in consecutive_process_parameters: + # consecutive_process_parameters.append(sorted_process_parameters[i]) + # consecutive_process_parameters.append(sorted_process_parameters[i + 1]) + # m += 1 + # continue + # else: + # if m == len(consecutive_process_parameters) - 1 and m != 0: + # self.env['stock.picking'].create_outcontract_picking(consecutive_process_parameters, + # production_item) + # if sorted_process_parameters[i] in consecutive_workorders: + # is_pick = True + # consecutive_process_parameters = [] + # m = 0 + # # 当前面的连续工序生成对应的采购单再生成当前工序的外协采购单 + # if is_pick is False: + # self.env['stock.picking'].create_outcontract_picking(sorted_workorders[i], + # production_item) + # if m == len(consecutive_process_parameters) - 1 and m != 0: + # self.env['stock.picking'].create_outcontract_picking(consecutive_process_parameters, + # production_item) + # if sorted_process_parameters[i] in consecutive_process_parameters: + # is_pick = True + # consecutive_process_parameters = [] + # m = 0 + # if m == len(consecutive_process_parameters) - 1 and m != 0: + # self.env['stock.picking'].create_outcontract_picking(consecutive_process_parameters, production_item) + # if is_pick is False and m == 0: + # if len(sorted_process_parameters) == 1: + # self.env['stock.picking'].create_outcontract_picking(sorted_process_parameters, production_item) + # else: + # self.env['stock.picking'].create_outcontract_picking(sorted_process_parameters[i], production_item) for pp in production_item.product_id.model_process_parameters_ids: if pp.gain_way == '外协': server_product = self.env['product.template'].search( @@ -567,26 +567,26 @@ class StockPicking(models.Model): [('barcode', 'ilike', 'WH-PREPRODUCTION')]).id), ('location_id', '=', self.env['stock.location'].search( [('barcode', 'ilike', 'VL-SPOC')]).id), - ('origin', '=', self.origin)]) + ('origin', '=', self.origin), ('picking_id', '=', self.id)]) if self.location_id == move_in.location_id and self.location_dest_id == move_in.location_dest_id: if move_out.origin == move_in.origin: if move_out.picking_id.state != 'done': raise UserError( _('该入库单对应的单号为%s的出库单还未完成,不能进行验证操作!' % move_out.picking_id.name)) res = super().button_validate() - if res is True: - if self.id == move_out.picking_id.id: - # if move_out.move_line_ids.workorder_id.state == 'progress': - move_in = self.env['stock.move'].search( - [('location_dest_id', '=', self.env['stock.location'].search( - [('barcode', 'ilike', 'WH-PREPRODUCTION')]).id), - ('location_id', '=', self.env['stock.location'].search( - [('barcode', 'ilike', 'VL-SPOC')]).id), - ('origin', '=', self.origin)]) - production = self.env['mrp.production'].search([('name', '=', self.origin)]) - if move_in: - move_in.write({'state': 'assigned'}) - self.env['stock.move.line'].create(move_in.get_move_line(production, None)) + # if res is True: + # if self.id == move_out.picking_id.id: + # # if move_out.move_line_ids.workorder_id.state == 'progress': + # move_in = self.env['stock.move'].search( + # [('location_dest_id', '=', self.env['stock.location'].search( + # [('barcode', 'ilike', 'WH-PREPRODUCTION')]).id), + # ('location_id', '=', self.env['stock.location'].search( + # [('barcode', 'ilike', 'VL-SPOC')]).id), + # ('origin', '=', self.origin)]) + # production = self.env['mrp.production'].search([('name', '=', self.origin)]) + # if move_in: + # move_in.write({'state': 'assigned'}) + # self.env['stock.move.line'].create(move_in.get_move_line(production, None)) return res diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index fdbec99f..53df7491 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -285,7 +285,7 @@ - + @@ -566,7 +566,7 @@
- +