Accept Merge Request #2219: (feature/7154 -> develop)
Merge Request: 恢复刀具房样式和编码 Created By: @谷耀东 Reviewed By: @胡尧 Approved By: @胡尧 Accepted By: @谷耀东 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2219
This commit is contained in:
@@ -7,8 +7,14 @@ def migrate(cr, version):
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
sf_shelf_model = env["sf.shelf"]
|
||||
sf_shelf_location_model = env["sf.shelf.location"]
|
||||
|
||||
preproduction_shelf_ids = sf_shelf_location_model.get_preproduction_shelf_ids()
|
||||
|
||||
shelves = sf_shelf_model.search([])
|
||||
for shelf in shelves:
|
||||
if shelf.id not in preproduction_shelf_ids:
|
||||
continue
|
||||
|
||||
shelf_barcode = shelf.barcode or ""
|
||||
if not shelf_barcode:
|
||||
continue
|
||||
|
||||
@@ -471,7 +471,6 @@ class ShelfLocation(models.Model):
|
||||
record.display_rfid = record.product_sn_id.rfid if record.product_sn_id else ''
|
||||
except Exception as e:
|
||||
record.display_rfid = ''
|
||||
_logger.error(f"计算 display_rfid 时出错: {e}")
|
||||
|
||||
@api.depends('product_id')
|
||||
def _compute_tool(self):
|
||||
@@ -601,6 +600,24 @@ class ShelfLocation(models.Model):
|
||||
_layer_capacity = f"{_layer_capacity:02d}"
|
||||
record.kanban_show_layer_info=f"{_layer}-{_layer_capacity}"
|
||||
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):
|
||||
_name = 'sf.shelf.location.lot'
|
||||
@@ -619,6 +636,7 @@ class SfShelfLocationLot(models.Model):
|
||||
raise ValidationError('变更数量不能比库存数量大!!!')
|
||||
|
||||
|
||||
|
||||
class SfStockMoveLine(models.Model):
|
||||
_name = 'stock.move.line'
|
||||
_inherit = ['stock.move.line', 'printing.utils']
|
||||
|
||||
@@ -28,8 +28,18 @@ class CustomKanbanController extends KanbanController {
|
||||
isBaseStyle: true
|
||||
});
|
||||
let self = this;
|
||||
// 获取货架分层数据
|
||||
|
||||
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);
|
||||
await this.loadShelfLayersData();
|
||||
});
|
||||
@@ -50,7 +60,11 @@ class CustomKanbanController extends KanbanController {
|
||||
let domain = this.searchModel.domain;
|
||||
if (domain.length > 0) {
|
||||
let shelfDomain = domain.find(item => item[0] === 'shelf_id');
|
||||
this.onShelfChange(shelfDomain[2]);
|
||||
if (shelfDomain && shelfDomain[2] && this.preproductionShelfIds && this.preproductionShelfIds.includes(shelfDomain[2])) {
|
||||
this.onShelfChange(shelfDomain[2]);
|
||||
} else {
|
||||
this.setKanbanStyle('sf_kanban_location_style');
|
||||
}
|
||||
} else {
|
||||
this.setKanbanStyle('sf_kanban_location_style');
|
||||
}
|
||||
@@ -63,8 +77,7 @@ class CustomKanbanController extends KanbanController {
|
||||
let shelfDomain = domain.find(item => item[0] === 'shelf_id');
|
||||
if (shelfDomain) {
|
||||
let shelfId = shelfDomain[2];
|
||||
// 如果货架ID存在,则设置相应的样式
|
||||
if (shelfId) {
|
||||
if (shelfId && this.preproductionShelfIds.includes(shelfId)) {
|
||||
this.onShelfChange(shelfId);
|
||||
return;
|
||||
}
|
||||
@@ -75,7 +88,6 @@ class CustomKanbanController extends KanbanController {
|
||||
this.setKanbanStyle('sf_kanban_location_style');
|
||||
} catch (error) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 加载所有货架的层数数据
|
||||
@@ -107,10 +119,18 @@ class CustomKanbanController extends KanbanController {
|
||||
// 添加新类
|
||||
if (isHave) kanbanViewEl.classList.add(style);
|
||||
}
|
||||
const ghostCards = document.querySelectorAll('.o_kanban_ghost');
|
||||
ghostCards.forEach(card => {
|
||||
card.remove();
|
||||
});
|
||||
|
||||
// 获取当前的搜索域
|
||||
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');
|
||||
ghostCards.forEach(card => {
|
||||
card.remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
updatePagerLimit(limit) {
|
||||
|
||||
@@ -229,7 +229,7 @@
|
||||
<field name="kanban_show_layer_info"/>
|
||||
</div>
|
||||
<!-- 添加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">
|
||||
<field name="display_rfid"/>
|
||||
</div>
|
||||
@@ -238,7 +238,7 @@
|
||||
<div class="o_kanban_record_bottom">
|
||||
<field name="tool_rfid"/>
|
||||
</div>
|
||||
</t>
|
||||
</t> -->
|
||||
<!-- 悬停时显示的详细信息 -->
|
||||
<div class="status-hover-bar">
|
||||
<t t-if="record.product_id.value">
|
||||
|
||||
Reference in New Issue
Block a user