1、新增功能刀具出入库

This commit is contained in:
yuxianghui
2024-06-12 14:08:21 +08:00
parent 07b1c3cceb
commit 0f32b0acb1
3 changed files with 62 additions and 6 deletions

View File

@@ -95,17 +95,31 @@ class MrsShelfLocationDataSync(models.Model):
return code_pair[0]
return None # 如果没有找到对应的值返回None或适当的默认值
# 定时更新所有设备机床刀库信息
equipment_ids = self.env['maintenance.equipment'].search([('equipment_type', '=', '机床')])
for equipment_id in equipment_ids:
if equipment_id:
equipment_id.register_equipment_tool()
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)
location_id = self.env['sf.shelf.location'].search([('barcode', '=', shelf_barcode)], limit=1)
if location_id:
stock_lot_obj = self.env['stock.lot'].search([('rfid', '=', item['RfidCode'])], limit=1)
if stock_lot_obj:
location_id.product_sn_id = stock_lot_obj.id
if 'Tool' in item['Postion']:
tool = self.env['sf.functional.cutting.tool.entity'].search(['rfid', '=', item['RfidCode']])
tool.tool_in_out_stock_location(location_id)
if tool:
location_id.product_sn_id = tool.barcode_id.id
else:
location_id.product_sn_id = False
else:
location_id.product_sn_id = False
stock_lot_obj = self.env['stock.lot'].search([('rfid', '=', item['RfidCode'])], limit=1)
if stock_lot_obj:
location_id.product_sn_id = stock_lot_obj.id
else:
location_id.product_sn_id = False
logging.info('货架已获取信息:%s' % item)
except Exception as e: