优化动态刀具按批次管理的数据同步接口

This commit is contained in:
yuxianghui
2024-06-17 11:40:12 +08:00
parent e1f4e1e701
commit 77ad0dd635
2 changed files with 4 additions and 6 deletions

View File

@@ -80,7 +80,7 @@ class StockLot(models.Model):
headers = Common.get_headers(self, token, sf_secret_key)
str_url = sf_sync_config['sf_url'] + "/api/tool_material_stock/create"
product_ids = self.env['product.product'].sudo().search([('categ_type', '=', '刀具')]).ids
objs_all = self.env['stock.lot'].search([('rfid', '!=', False), ('product_id', 'in', product_ids)])
objs_all = self.env['stock.lot'].search([('product_id', 'in', product_ids)])
self._get_sync_stock_lot(objs_all, str_url, token, headers)
def _get_sync_stock_lot(self, objs_all, str_url, token, headers):
@@ -90,6 +90,7 @@ class StockLot(models.Model):
for item in objs_all:
val = {
'name': item.name,
'qty': item.product_qty,
'tool_material_status': item.tool_material_status,
'location': [] if not item.quant_ids else item.quant_ids[-1].location_id.name,
'tool_material_search_id': item.tool_material_search_id.id,
@@ -105,7 +106,7 @@ class StockLot(models.Model):
logging.info("没有刀具物料序列号信息")
except Exception as e:
logging.info("刀具物料序列号同步失败:%s" % e)
class ToolMaterial(models.Model):
_inherit = 'sf.tool.material.search'
@@ -163,8 +164,6 @@ class ToolMaterial(models.Model):
logging.info("刀具物料同步失败:%s" % e)
class FunctionalCuttingToolEntity(models.Model):
_inherit = 'sf.functional.cutting.tool.entity'
_description = '功能刀具列表注册'
@@ -251,8 +250,6 @@ class FunctionalCuttingToolEntity(models.Model):
logging.info("功能刀具同步失败:%s" % e)
class FunctionalToolWarning(models.Model):
_inherit = 'sf.functional.tool.warning'
_description = '功能刀具预警注册'