恢复刀具房样式和编码
This commit is contained in:
@@ -4,8 +4,14 @@ def migrate(cr, version):
|
|||||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||||
sf_shelf_model = env["sf.shelf"]
|
sf_shelf_model = env["sf.shelf"]
|
||||||
sf_shelf_location_model = env["sf.shelf.location"]
|
sf_shelf_location_model = env["sf.shelf.location"]
|
||||||
|
|
||||||
|
preproduction_shelf_ids = sf_shelf_location_model.get_preproduction_shelf_ids()
|
||||||
|
|
||||||
shelves = sf_shelf_model.search([])
|
shelves = sf_shelf_model.search([])
|
||||||
for shelf in shelves:
|
for shelf in shelves:
|
||||||
|
if shelf.id not in preproduction_shelf_ids:
|
||||||
|
continue
|
||||||
|
|
||||||
shelf_barcode = shelf.barcode or ""
|
shelf_barcode = shelf.barcode or ""
|
||||||
if not shelf_barcode:
|
if not shelf_barcode:
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -470,7 +470,6 @@ class ShelfLocation(models.Model):
|
|||||||
record.display_rfid = record.product_sn_id.rfid if record.product_sn_id else ''
|
record.display_rfid = record.product_sn_id.rfid if record.product_sn_id else ''
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
record.display_rfid = ''
|
record.display_rfid = ''
|
||||||
_logger.error(f"计算 display_rfid 时出错: {e}")
|
|
||||||
|
|
||||||
@api.depends('product_id')
|
@api.depends('product_id')
|
||||||
def _compute_tool(self):
|
def _compute_tool(self):
|
||||||
@@ -600,6 +599,24 @@ class ShelfLocation(models.Model):
|
|||||||
_layer_capacity = f"{_layer_capacity:02d}"
|
_layer_capacity = f"{_layer_capacity:02d}"
|
||||||
record.kanban_show_layer_info=f"{_layer}-{_layer_capacity}"
|
record.kanban_show_layer_info=f"{_layer}-{_layer_capacity}"
|
||||||
record.kanban_show_center_control_code=f"{_cc_code}"
|
record.kanban_show_center_control_code=f"{_cc_code}"
|
||||||
|
@api.model
|
||||||
|
def get_preproduction_shelf_ids(self):
|
||||||
|
"""
|
||||||
|
获取预生产区域的货架ID列表
|
||||||
|
Returns:
|
||||||
|
list: 货架ID列表
|
||||||
|
"""
|
||||||
|
query = """
|
||||||
|
SELECT DISTINCT b.shelf_id
|
||||||
|
FROM stock_location a
|
||||||
|
LEFT JOIN sf_shelf_location b ON a.id = b.location_id
|
||||||
|
WHERE a.barcode LIKE 'WH-PREPRODUCTION'
|
||||||
|
"""
|
||||||
|
self.env.cr.execute(query)
|
||||||
|
result = self.env.cr.fetchall()
|
||||||
|
# 将结果转换为ID列表
|
||||||
|
shelf_ids = [record[0] for record in result if record[0]]
|
||||||
|
return shelf_ids
|
||||||
|
|
||||||
class SfShelfLocationLot(models.Model):
|
class SfShelfLocationLot(models.Model):
|
||||||
_name = 'sf.shelf.location.lot'
|
_name = 'sf.shelf.location.lot'
|
||||||
@@ -618,6 +635,7 @@ class SfShelfLocationLot(models.Model):
|
|||||||
raise ValidationError('变更数量不能比库存数量大!!!')
|
raise ValidationError('变更数量不能比库存数量大!!!')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class SfStockMoveLine(models.Model):
|
class SfStockMoveLine(models.Model):
|
||||||
_name = 'stock.move.line'
|
_name = 'stock.move.line'
|
||||||
_inherit = ['stock.move.line', 'printing.utils']
|
_inherit = ['stock.move.line', 'printing.utils']
|
||||||
|
|||||||
@@ -28,8 +28,18 @@ class CustomKanbanController extends KanbanController {
|
|||||||
isBaseStyle: true
|
isBaseStyle: true
|
||||||
});
|
});
|
||||||
let self = this;
|
let self = this;
|
||||||
// 获取货架分层数据
|
|
||||||
onWillStart(async () => {
|
onWillStart(async () => {
|
||||||
|
try {
|
||||||
|
this.preproductionShelfIds = await this.orm.call(
|
||||||
|
'sf.shelf.location',
|
||||||
|
'get_preproduction_shelf_ids',
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
this.preproductionShelfIds = [];
|
||||||
|
}
|
||||||
|
|
||||||
this.searchModel.on('update', self, self._onUpdate);
|
this.searchModel.on('update', self, self._onUpdate);
|
||||||
await this.loadShelfLayersData();
|
await this.loadShelfLayersData();
|
||||||
});
|
});
|
||||||
@@ -50,10 +60,14 @@ class CustomKanbanController extends KanbanController {
|
|||||||
let domain = this.searchModel.domain;
|
let domain = this.searchModel.domain;
|
||||||
if (domain.length > 0) {
|
if (domain.length > 0) {
|
||||||
let shelfDomain = domain.find(item => item[0] === 'shelf_id');
|
let shelfDomain = domain.find(item => item[0] === 'shelf_id');
|
||||||
|
if (shelfDomain && shelfDomain[2] && this.preproductionShelfIds && this.preproductionShelfIds.includes(shelfDomain[2])) {
|
||||||
this.onShelfChange(shelfDomain[2]);
|
this.onShelfChange(shelfDomain[2]);
|
||||||
} else {
|
} else {
|
||||||
this.setKanbanStyle('sf_kanban_location_style');
|
this.setKanbanStyle('sf_kanban_location_style');
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.setKanbanStyle('sf_kanban_location_style');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_handleSearchUpdate() {
|
_handleSearchUpdate() {
|
||||||
@@ -63,8 +77,7 @@ class CustomKanbanController extends KanbanController {
|
|||||||
let shelfDomain = domain.find(item => item[0] === 'shelf_id');
|
let shelfDomain = domain.find(item => item[0] === 'shelf_id');
|
||||||
if (shelfDomain) {
|
if (shelfDomain) {
|
||||||
let shelfId = shelfDomain[2];
|
let shelfId = shelfDomain[2];
|
||||||
// 如果货架ID存在,则设置相应的样式
|
if (shelfId && this.preproductionShelfIds.includes(shelfId)) {
|
||||||
if (shelfId) {
|
|
||||||
this.onShelfChange(shelfId);
|
this.onShelfChange(shelfId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -75,7 +88,6 @@ class CustomKanbanController extends KanbanController {
|
|||||||
this.setKanbanStyle('sf_kanban_location_style');
|
this.setKanbanStyle('sf_kanban_location_style');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载所有货架的层数数据
|
// 加载所有货架的层数数据
|
||||||
@@ -107,11 +119,19 @@ class CustomKanbanController extends KanbanController {
|
|||||||
// 添加新类
|
// 添加新类
|
||||||
if (isHave) kanbanViewEl.classList.add(style);
|
if (isHave) kanbanViewEl.classList.add(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取当前的搜索域
|
||||||
|
let domain = this.searchModel.domain;
|
||||||
|
let shelfDomain = domain.find(item => item[0] === 'shelf_id');
|
||||||
|
|
||||||
|
// 只有当shelf_id在preproductionShelfIds中时才删除幽灵看板
|
||||||
|
if (shelfDomain && this.preproductionShelfIds && this.preproductionShelfIds.includes(shelfDomain[2])) {
|
||||||
const ghostCards = document.querySelectorAll('.o_kanban_ghost');
|
const ghostCards = document.querySelectorAll('.o_kanban_ghost');
|
||||||
ghostCards.forEach(card => {
|
ghostCards.forEach(card => {
|
||||||
card.remove();
|
card.remove();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
updatePagerLimit(limit) {
|
updatePagerLimit(limit) {
|
||||||
if (this.model.root.limit !== limit) {
|
if (this.model.root.limit !== limit) {
|
||||||
|
|||||||
@@ -229,7 +229,7 @@
|
|||||||
<field name="kanban_show_layer_info"/>
|
<field name="kanban_show_layer_info"/>
|
||||||
</div>
|
</div>
|
||||||
<!-- 添加RFID字段 -->
|
<!-- 添加RFID字段 -->
|
||||||
<t t-if="record.data and record.data.display_rfid">
|
<!-- <t t-if="record.data and record.data.display_rfid">
|
||||||
<div class="o_kanban_record_bottom">
|
<div class="o_kanban_record_bottom">
|
||||||
<field name="display_rfid"/>
|
<field name="display_rfid"/>
|
||||||
</div>
|
</div>
|
||||||
@@ -238,7 +238,7 @@
|
|||||||
<div class="o_kanban_record_bottom">
|
<div class="o_kanban_record_bottom">
|
||||||
<field name="tool_rfid"/>
|
<field name="tool_rfid"/>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t> -->
|
||||||
<!-- 悬停时显示的详细信息 -->
|
<!-- 悬停时显示的详细信息 -->
|
||||||
<div class="status-hover-bar">
|
<div class="status-hover-bar">
|
||||||
<t t-if="record.product_id.value">
|
<t t-if="record.product_id.value">
|
||||||
|
|||||||
Reference in New Issue
Block a user