Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造功能优化
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import base64
|
||||
import random
|
||||
import re
|
||||
import traceback
|
||||
|
||||
import qrcode
|
||||
from itertools import groupby
|
||||
@@ -292,7 +293,8 @@ class StockRule(models.Model):
|
||||
if production_item.product_id.id in product_id_to_production_names:
|
||||
# 同一个产品多个制造订单对应一个编程单和模型库
|
||||
# 只调用一次fetchCNC,并将所有生产订单的名称作为字符串传递
|
||||
if not production_item.programming_no and production_item.production_type in ['自动化产线加工', '人工线下加工']:
|
||||
if not production_item.programming_no and production_item.production_type in ['自动化产线加工',
|
||||
'人工线下加工']:
|
||||
if not production_programming.programming_no:
|
||||
production_item.fetchCNC(
|
||||
', '.join(product_id_to_production_names[production_item.product_id.id]))
|
||||
@@ -587,7 +589,7 @@ class StockPicking(models.Model):
|
||||
item.address_of_delivery = sale_info.address_of_delivery
|
||||
|
||||
# 设置外协出入单的名称
|
||||
def _get_name_Res(self, rescode,sequence):
|
||||
def _get_name_Res(self, rescode, sequence):
|
||||
last_picking = self.sudo().search([('name', 'ilike', rescode)], order='name desc', limit=1)
|
||||
sequence_id = sequence.next_by_id()
|
||||
name_without_prefix = last_picking.name.removeprefix(rescode)
|
||||
@@ -624,7 +626,8 @@ class StockPicking(models.Model):
|
||||
if move_in:
|
||||
workorder = move_in.subcontract_workorder_id
|
||||
workorders = workorder.production_id.workorder_ids
|
||||
subcontract_workorders = workorders.filtered(lambda wo: wo.is_subcontract == True and wo.state!='cancel').sorted('sequence')
|
||||
subcontract_workorders = workorders.filtered(
|
||||
lambda wo: wo.is_subcontract == True and wo.state != 'cancel').sorted('sequence')
|
||||
# if workorder == subcontract_workorders[-1]:
|
||||
# self.env['stock.quant']._update_reserved_quantity(
|
||||
# move_in.product_id, move_in.location_dest_id, move_in.product_uom_qty,
|
||||
@@ -750,6 +753,7 @@ class ReStockMove(models.Model):
|
||||
|
||||
@api.depends('product_id')
|
||||
def _compute_part_info(self):
|
||||
try:
|
||||
for move in self:
|
||||
if move.product_id.categ_id.type == '成品':
|
||||
move.part_number = move.product_id.part_number
|
||||
@@ -781,9 +785,13 @@ class ReStockMove(models.Model):
|
||||
if not production_id:
|
||||
if not move.origin:
|
||||
continue
|
||||
logging.info('制造订单的调拨单 %s', move.origin)
|
||||
production_id = self.env['mrp.production'].sudo().search(
|
||||
[('name', '=', move.origin)],limit=1)
|
||||
[('name', '=', move.origin)], limit=1)
|
||||
if not production_id:
|
||||
continue
|
||||
product_name = ''
|
||||
logging.info('制造订单的产品 %s', production_id.product_id.name)
|
||||
match = re.search(r'(S\d{5}-\d)', production_id.product_id.name)
|
||||
# 如果匹配成功,提取结果
|
||||
if match:
|
||||
@@ -804,6 +812,10 @@ class ReStockMove(models.Model):
|
||||
if filtered_order_line:
|
||||
move.part_number = filtered_order_line.part_number
|
||||
move.part_name = filtered_order_line.part_name
|
||||
except Exception as e:
|
||||
traceback_error = traceback.format_exc()
|
||||
logging.error("零件图号 零件名称获取失败:%s" % traceback_error)
|
||||
|
||||
def _get_stock_move_values_Res(self, item, picking_type_id, group_id, move_dest_ids=False):
|
||||
route_id = self.env.ref('sf_manufacturing.route_surface_technology_outsourcing').id
|
||||
stock_rule = self.env['stock.rule'].sudo().search(
|
||||
@@ -836,7 +848,7 @@ class ReStockMove(models.Model):
|
||||
picking_type_id = self.env.ref('sf_manufacturing.outcontract_picking_in').id
|
||||
sequence = self.env.ref('sf_manufacturing.sequence_stock_picking_in')
|
||||
return {
|
||||
'name': self.env['stock.picking']._get_name_Res(rescode,sequence),
|
||||
'name': self.env['stock.picking']._get_name_Res(rescode, sequence),
|
||||
'origin': item.name,
|
||||
'surface_technics_parameters_id': sorted_workorders.surface_technics_parameters_id.id,
|
||||
'company_id': self.mapped('company_id').id,
|
||||
@@ -1061,7 +1073,8 @@ class ReStockMove(models.Model):
|
||||
[('origin', '=', production.origin), ('product_id', '=', production.product_id.id)])
|
||||
res['origin'] = ','.join(productions.mapped('name'))
|
||||
if self.picking_type_id.name == '客供料入库':
|
||||
self.picking_id.sudo().write({'origin': res['origin'] if res.get('origin') else self[0].picking_id.origin})
|
||||
self.picking_id.sudo().write(
|
||||
{'origin': res['origin'] if res.get('origin') else self[0].picking_id.origin})
|
||||
return res
|
||||
|
||||
def _get_new_picking_values(self):
|
||||
|
||||
Reference in New Issue
Block a user