Accept Merge Request #934: (feature/功能刀具组装功能优化 -> develop)

Merge Request: 1、处理刀具物料注册时搜索不到的问题;2、功能刀具组装时,当没有选择物料的时候功能刀具编码不显示数据;添加最大寿命值、报警值、有效长、避空长的必填验证;

Created By: @禹翔辉
Reviewed By: @马广威
Approved By: @马广威 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/934?initial=true
This commit is contained in:
禹翔辉
2024-04-07 16:46:26 +08:00
committed by Coding
2 changed files with 13 additions and 3 deletions

View File

@@ -40,7 +40,7 @@ class StockLot(models.Model):
sf_secret_key = sf_sync_config['sf_secret_key']
headers = Common.get_headers(self, token, sf_secret_key)
str_url = sf_sync_config['sf_url'] + "/api/tool_material_stock/create"
objs_all = self.env['stock.lot'].search([('id', '=', self.id)])
objs_all = self.env['stock.lot'].search([('id', '=', self.id), ('active', 'in', [True, False])])
tool_material_stock_list = []
if objs_all:
for item in objs_all:

View File

@@ -413,7 +413,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
num = self._get_code(str_2)
obj.tool_code = str_2 + str(num)
else:
obj.tool_code = None
obj.tool_code = ''
def _get_code(self, str_2):
functional_tool_assembly = self.env['sf.functional.tool.assembly'].sudo().search(
@@ -470,13 +470,23 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
else:
record.L_D_number = 0
@api.constrains('after_assembly_tool_loading_length', 'after_assembly_functional_tool_length')
@api.constrains('after_assembly_tool_loading_length', 'after_assembly_functional_tool_length',
'after_assembly_max_lifetime_value', 'after_assembly_alarm_value',
'after_assembly_effective_length', 'hiding_length')
def _check_length_control(self):
for obj in self:
if obj.after_assembly_tool_loading_length == 0:
raise ValidationError('组装参数信息【总长度】不能为0')
if obj.after_assembly_functional_tool_length == 0:
raise ValidationError('组装参数信息【伸出长】不能为0')
if obj.after_assembly_max_lifetime_value == 0:
raise ValidationError('组装参数信息【最大寿命值】不能为0')
if obj.after_assembly_alarm_value == 0:
raise ValidationError('组装参数信息【报警值】不能为0')
if obj.after_assembly_effective_length == 0:
raise ValidationError('组装参数信息【有效长】不能为0')
if obj.hiding_length == 0:
raise ValidationError('组装参数信息【避空长】不能为0')
def functional_tool_assembly(self):
"""