1、库位变更接口、库位信息接口优化;2、功能刀具预警模型优化;
This commit is contained in:
@@ -13,13 +13,14 @@ class MrsShelfLocationDataSync(models.Model):
|
||||
_name = 'sf.shelf.location.datasync'
|
||||
_description = '同步库存信息'
|
||||
|
||||
def _cron_shelf_location_datasync(self):
|
||||
try:
|
||||
# 建立对应关系的函数
|
||||
def align_data(my_data, their_data):
|
||||
paired_data = list(zip(my_data, their_data))
|
||||
return paired_data
|
||||
def find_our_code(self, their_code):
|
||||
|
||||
# 建立对应关系的函数
|
||||
def align_data(my_data, their_data):
|
||||
paired_data = list(zip(my_data, their_data))
|
||||
return paired_data
|
||||
|
||||
def get_total_data():
|
||||
shelf_1_obj = self.env['sf.shelf'].search([('name', '=', '一号产线-一号线边刀架')], limit=1)
|
||||
tool_location_objs_1 = self.env['sf.shelf.location'].search([('shelf_id', '=', shelf_1_obj.id)], order='id')
|
||||
|
||||
@@ -82,19 +83,21 @@ class MrsShelfLocationDataSync(models.Model):
|
||||
total_data = aligned_data_1 + aligned_data_2 + aligned_data_3 + aligned_data_4 + aligned_data_5
|
||||
print(total_data)
|
||||
logging.info(f"total_data: {total_data}")
|
||||
return total_data
|
||||
|
||||
for code_pair in get_total_data():
|
||||
if code_pair[1] == their_code:
|
||||
return code_pair[0]
|
||||
return None # 如果没有找到对应的值,返回None或适当的默认值
|
||||
|
||||
def _cron_shelf_location_datasync(self):
|
||||
try:
|
||||
def find_their_code(my_code, aligned_data):
|
||||
for code_pair in aligned_data:
|
||||
if code_pair[0] == my_code:
|
||||
return code_pair[1]
|
||||
return None # 如果没有找到对应的值,返回None或适当的默认值
|
||||
|
||||
def find_our_code(their_code, aligned_data):
|
||||
for code_pair in aligned_data:
|
||||
if code_pair[1] == their_code:
|
||||
return code_pair[0]
|
||||
return None # 如果没有找到对应的值,返回None或适当的默认值
|
||||
|
||||
# 定时更新所有设备机床刀库信息
|
||||
equipment_ids = self.env['maintenance.equipment'].search(
|
||||
[('equipment_type', '=', '机床'), ('function_type', '!=', False)])
|
||||
@@ -105,7 +108,7 @@ class MrsShelfLocationDataSync(models.Model):
|
||||
shelfinfo = self.env['sf.shelf.location'].get_sf_shelf_location_info()
|
||||
print('shelfinfo:', shelfinfo)
|
||||
for item in shelfinfo:
|
||||
shelf_barcode = find_our_code(item['Postion'], total_data)
|
||||
shelf_barcode = self.find_our_code(item['Postion'])
|
||||
location_id = self.env['sf.shelf.location'].search([('barcode', '=', shelf_barcode)], limit=1)
|
||||
if location_id:
|
||||
# 如果是线边刀库信息,则对功能刀具移动生成记录
|
||||
|
||||
Reference in New Issue
Block a user